diff --git a/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_train_balanced_10to1.jsonl b/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_train_balanced_10to1.jsonl deleted file mode 100644 index a25db5388da77acd383069ff29f934531202a763..0000000000000000000000000000000000000000 --- a/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_train_balanced_10to1.jsonl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f46aac92fbeb532aa24dd4f2438eebcb67fcc564cefd68cad71477a7c068a1d9 -size 71628348 diff --git a/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_train_filtered_total_length.jsonl b/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_train_filtered_total_length.jsonl deleted file mode 100644 index 2425b136ddc84231a6edbff49226d99bb7c697a7..0000000000000000000000000000000000000000 --- a/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_train_filtered_total_length.jsonl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3f84a290996afd64efabde7131ccddd5d561de416bf47da2a7b294da4074c96f -size 211430523 diff --git a/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_valid_balanced_10to1.jsonl b/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_valid_balanced_10to1.jsonl deleted file mode 100644 index c4f23884cc22920218afe993f1fa8d80e16a1142..0000000000000000000000000000000000000000 --- a/Primevul_categorized_&_processed_for_finetuning/4.Primevul_undersample10To1_MAX8K_Token/primevul_valid_balanced_10to1.jsonl +++ /dev/null @@ -1,6380 +0,0 @@ -{"idx": 231078, "input": "void enc_untrusted_notify(int32_t *const queue, int32_t num_threads) { enc_untrusted_sys_futex_wake(queue, num_threads); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219933, "input": "bool CPlayListRAM::LoadData(std::istream& stream) { CLog::Log(LOGINFO, \"Parsing RAM\"); std::string strMMS; while( stream.peek() != '\\n' && stream.peek() != '\\r' ) strMMS += stream.get(); CLog::Log(LOGINFO, \"Adding element {}\", strMMS); CFileItemPtr newItem(new CFileItem(strMMS)); newItem->SetPath(strMMS); Add(newItem); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 498267, "input": "full_path_write (const struct url *url, char *where) { #define FROB(el, chr) do { \\ char *f_el = url->el; \\ if (f_el) { \\ int l = strlen (f_el); \\ *where++ = chr; \\ memcpy (where, f_el, l); \\ where += l; \\ } \\ } while (0) FROB (path, '/'); FROB (params, ';'); FROB (query, '?'); #undef FROB }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431392, "input": "static void encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closeargs *arg, struct compound_hdr *hdr) { encode_op_hdr(xdr, OP_OPEN_DOWNGRADE, decode_open_downgrade_maxsz, hdr); encode_nfs4_stateid(xdr, &arg->stateid); encode_nfs4_seqid(xdr, arg->seqid); encode_share_access(xdr, arg->share_access); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246415, "input": "static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer, void * pvRxData, size_t xBufferLengthBytes, size_t xBytesAvailable, size_t xBytesToStoreMessageLength ) { size_t xOriginalTail, xReceivedLength, xNextMessageLength; configMESSAGE_BUFFER_LENGTH_TYPE xTempNextMessageLength; if( xBytesToStoreMessageLength != ( size_t ) 0 ) { /* A discrete message is being received. First receive the length * of the message. A copy of the tail is stored so the buffer can be * returned to its prior state if the length of the message is too * large for the provided buffer. */ xOriginalTail = pxStreamBuffer->xTail; ( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempNextMessageLength, xBytesToStoreMessageLength, xBytesAvailable ); xNextMessageLength = ( size_t ) xTempNextMessageLength; /* Reduce the number of bytes available by the number of bytes just * read out. */ xBytesAvailable -= xBytesToStoreMessageLength; /* Check there is enough space in the buffer provided by the * user. */ if( xNextMessageLength > xBufferLengthBytes ) { /* The user has provided insufficient space to read the message * so return the buffer to its previous state (so the length of * the message is in the buffer again). */ pxStreamBuffer->xTail = xOriginalTail; xNextMessageLength = 0; } else { mtCOVERAGE_TEST_MARKER(); } } else { /* A stream of bytes is being received (as opposed to a discrete * message), so read as many bytes as possible. */ xNextMessageLength = xBufferLengthBytes; } /* Read the actual data. */ xReceivedLength = prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) pvRxData, xNextMessageLength, xBytesAvailable ); /*lint !e9079 Data storage area is implemented as uint8_t array for ease of sizing, indexing and alignment. */ return xReceivedLength; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195966, "input": "bool initiate_stratum(struct pool *pool) { char s[RBUFSIZE], *sret = NULL, *nonce1, *sessionid; json_t *val = NULL, *res_val, *err_val; bool ret = false, recvd = false; json_error_t err; int n2size; if (!setup_stratum_curl(pool)) goto out; resend: if (pool->sessionid) sprintf(s, \"{\\\"id\\\": %d, \\\"method\\\": \\\"mining.subscribe\\\", \\\"params\\\": [\\\"%s\\\"]}\", swork_id++, pool->sessionid); else sprintf(s, \"{\\\"id\\\": %d, \\\"method\\\": \\\"mining.subscribe\\\", \\\"params\\\": []}\", swork_id++); if (!__stratum_send(pool, s, strlen(s))) { applog(LOG_DEBUG, \"Failed to send s in initiate_stratum\"); goto out; } if (!socket_full(pool, true)) { applog(LOG_DEBUG, \"Timed out waiting for response in initiate_stratum\"); goto out; } sret = recv_line(pool); if (!sret) goto out; recvd = true; val = JSON_LOADS(sret, &err); free(sret); if (!val) { applog(LOG_INFO, \"JSON decode failed(%d): %s\", err.line, err.text); goto out; } res_val = json_object_get(val, \"result\"); err_val = json_object_get(val, \"error\"); if (!res_val || json_is_null(res_val) || (err_val && !json_is_null(err_val))) { char *ss; if (err_val) ss = json_dumps(err_val, JSON_INDENT(3)); else ss = strdup(\"(unknown reason)\"); applog(LOG_INFO, \"JSON-RPC decode failed: %s\", ss); free(ss); goto out; } sessionid = json_array_string(json_array_get(res_val, 0), 1); if (!sessionid) { applog(LOG_INFO, \"Failed to get sessionid in initiate_stratum\"); goto out; } nonce1 = json_array_string(res_val, 1); if (!nonce1) { applog(LOG_INFO, \"Failed to get nonce1 in initiate_stratum\"); free(sessionid); goto out; } n2size = json_integer_value(json_array_get(res_val, 2)); if (!n2size) { applog(LOG_INFO, \"Failed to get n2size in initiate_stratum\"); free(sessionid); free(nonce1); goto out; } mutex_lock(&pool->pool_lock); pool->sessionid = sessionid; free(pool->nonce1); pool->nonce1 = nonce1; pool->n1_len = strlen(nonce1) / 2; pool->n2size = n2size; mutex_unlock(&pool->pool_lock); applog(LOG_DEBUG, \"Pool %d stratum session id: %s\", pool->pool_no, pool->sessionid); ret = true; out: if (val) json_decref(val); if (ret) { if (!pool->stratum_url) pool->stratum_url = pool->sockaddr_url; pool->stratum_active = true; pool->swork.diff = 1; if (opt_protocol) { applog(LOG_DEBUG, \"Pool %d confirmed mining.subscribe with extranonce1 %s extran2size %d\", pool->pool_no, pool->nonce1, pool->n2size); } } else { if (recvd && pool->sessionid) { /* Reset the sessionid used for stratum resuming in case the pool * does not support it, or does not know how to respond to the * presence of the sessionid parameter. */ mutex_lock(&pool->pool_lock); free(pool->sessionid); free(pool->nonce1); pool->sessionid = pool->nonce1 = NULL; mutex_unlock(&pool->pool_lock); applog(LOG_DEBUG, \"Failed to resume stratum, trying afresh\"); goto resend; } applog(LOG_DEBUG, \"Initiate stratum failed\"); if (pool->sock != INVSOCK) { shutdown(pool->sock, SHUT_RDWR); pool->sock = INVSOCK; } } return ret; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "Multiple heap-based buffer overflows in the parse_notify function in sgminer before 4.2.2, cgminer before 4.3.5, and BFGMiner before 4.1.0 allow remote pool servers to have unspecified impact via a (1) large or (2) negative value in the Extranonc2_size parameter in a mining.subscribe response and a crafted mining.notify request.", "severity_level": "High", "cwe": "CWE-787", "cve": "CVE-2014-4502"}} -{"idx": 342096, "input": "static int fuse_symlink(struct inode *dir, struct dentry *entry, const char *link) { struct fuse_mount *fm = get_fuse_mount(dir); unsigned len = strlen(link) + 1; FUSE_ARGS(args); args.opcode = FUSE_SYMLINK; args.in_numargs = 2; args.in_args[0].size = entry->d_name.len + 1; args.in_args[0].value = entry->d_name.name; args.in_args[1].size = len; args.in_args[1].value = link; return create_new_entry(fm, &args, dir, entry, S_IFLNK); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197460, "input": "TfLiteIntArray* TfLiteIntArrayCreate(int size) { TfLiteIntArray* ret = (TfLiteIntArray*)malloc(TfLiteIntArrayGetSizeInBytes(size)); ret->size = size; return ret; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The TFLite code for allocating `TFLiteIntArray`s is vulnerable to an integer overflow issue(https://github.com/tensorflow/tensorflow/blob/4ceffae632721e52bf3501b736e4fe9d1221cdfa/tensorflow/lite/c/common.c#L24-L27). An attacker can craft a model such that the `size` multiplier is so large that the return value overflows the `int` datatype and becomes negative. In turn, this results in invalid value being given to `malloc`(https://github.com/tensorflow/tensorflow/blob/4ceffae632721e52bf3501b736e4fe9d1221cdfa/tensorflow/lite/c/common.c#L47-L52). In this case, `ret->size` would dereference an invalid pointer. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2021-29605"}} -{"idx": 393139, "input": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCompoundTrailingFields) { const bool multikey = true; addIndex(BSON(\"b\" << 1 << \"a\" << 1 << \"c\" << 1), multikey); addIndex(BSON(\"d\" << 1)); runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}]}\")); assertNumSolutions(2); assertSolutionExists( \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\" \"{ixscan: {pattern: {b: 1, a: 1, c: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \" \"true]], c: [[7, 7, true, true]]}}},\" \"{ixscan: {pattern: {d: 1}, bounds: {d: [[8, 8, true, true]]}}}\" \"]}}}}\"); assertSolutionExists(\"{cscan: {dir: 1}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277036, "input": "file_continue(i_ctx_t *i_ctx_p) { os_ptr op = osp; es_ptr pscratch = esp - 2; file_enum *pfen = r_ptr(esp - 1, file_enum); int devlen = esp[-3].value.intval; gx_io_device *iodev = r_ptr(esp - 4, gx_io_device); uint len = r_size(pscratch); uint code; if (len < devlen) return_error(gs_error_rangecheck); /* not even room for device len */ do { memcpy((char *)pscratch->value.bytes, iodev->dname, devlen); code = iodev->procs.enumerate_next(pfen, (char *)pscratch->value.bytes + devlen, len - devlen); if (code == ~(uint) 0) { /* all done */ esp -= 5; /* pop proc, pfen, devlen, iodev , mark */ return o_pop_estack; } else if (code > len) /* overran string */ return_error(gs_error_rangecheck); else if (iodev != iodev_default(imemory) || (check_file_permissions_reduced(i_ctx_p, (char *)pscratch->value.bytes, code + devlen, \"PermitFileReading\")) == 0) { push(1); ref_assign(op, pscratch); r_set_size(op, code + devlen); push_op_estack(file_continue); /* come again */ *++esp = pscratch[2]; /* proc */ return o_push_estack; } } while(1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 272261, "input": "multi_process_per_second_timers_dowork(struct multi_context *m) { /* possibly reap instances/routes in vhash */ multi_reap_process(m); /* possibly print to status log */ if (m->top.c1.status_output) { if (status_trigger(m->top.c1.status_output)) { multi_print_status(m, m->top.c1.status_output, m->status_file_version); } } /* possibly flush ifconfig-pool file */ multi_ifconfig_pool_persist(m, false); #ifdef ENABLE_DEBUG gremlin_flood_clients(m); #endif /* Should we check for stale routes? */ if (m->top.options.stale_routes_check_interval && stale_route_check_trigger(m)) { check_stale_routes(m); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445767, "input": "void tracing_reset_all_online_cpus(void) { struct trace_array *tr; list_for_each_entry(tr, &ftrace_trace_arrays, list) { if (!tr->clear_trace) continue; tr->clear_trace = false; tracing_reset_online_cpus(&tr->trace_buffer); #ifdef CONFIG_TRACER_MAX_TRACE tracing_reset_online_cpus(&tr->max_buffer); #endif } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204825, "input": "lyxml_parse_elem(struct ly_ctx *ctx, const char *data, unsigned int *len, struct lyxml_elem *parent, int options) { const char *c = data, *start, *e; const char *lws; /* leading white space for handling mixed content */ int uc; char *str; char *prefix = NULL; unsigned int prefix_len = 0; struct lyxml_elem *elem = NULL, *child; struct lyxml_attr *attr; unsigned int size; int nons_flag = 0, closed_flag = 0; *len = 0; if (*c != '<') { return NULL; } /* locate element name */ c++; e = c; uc = lyxml_getutf8(ctx, e, &size); if (!is_xmlnamestartchar(uc)) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_NONE, NULL, \"NameStartChar of the element\"); return NULL; } e += size; uc = lyxml_getutf8(ctx, e, &size); while (is_xmlnamechar(uc)) { if (*e == ':') { if (prefix_len) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_NONE, NULL, \"element name, multiple colons found\"); goto error; } /* element in a namespace */ start = e + 1; /* look for the prefix in namespaces */ prefix_len = e - c; LY_CHECK_ERR_GOTO(prefix, LOGVAL(ctx, LYE_XML_INCHAR, LY_VLOG_NONE, NULL, e), error); prefix = malloc((prefix_len + 1) * sizeof *prefix); LY_CHECK_ERR_GOTO(!prefix, LOGMEM(ctx), error); memcpy(prefix, c, prefix_len); prefix[prefix_len] = '\\0'; c = start; } e += size; uc = lyxml_getutf8(ctx, e, &size); } if (!*e) { LOGVAL(ctx, LYE_EOF, LY_VLOG_NONE, NULL); free(prefix); return NULL; } /* allocate element structure */ elem = calloc(1, sizeof *elem); LY_CHECK_ERR_RETURN(!elem, free(prefix); LOGMEM(ctx), NULL); elem->next = NULL; elem->prev = elem; if (parent) { lyxml_add_child(ctx, parent, elem); } /* store the name into the element structure */ elem->name = lydict_insert(ctx, c, e - c); c = e; process: ign_xmlws(c); if (!strncmp(\"/>\", c, 2)) { /* we are done, it was EmptyElemTag */ c += 2; elem->content = lydict_insert(ctx, \"\", 0); closed_flag = 1; } else if (*c == '>') { /* process element content */ c++; lws = NULL; while (*c) { if (!strncmp(c, \"child) { /* leading white spaces were actually content */ goto store_content; } /* Etag */ c += 2; /* get name and check it */ e = c; uc = lyxml_getutf8(ctx, e, &size); if (!is_xmlnamestartchar(uc)) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_XML, elem, \"NameStartChar of the element\"); goto error; } e += size; uc = lyxml_getutf8(ctx, e, &size); while (is_xmlnamechar(uc)) { if (*e == ':') { /* element in a namespace */ start = e + 1; /* look for the prefix in namespaces */ if (!prefix || memcmp(prefix, c, e - c)) { LOGVAL(ctx, LYE_SPEC, LY_VLOG_XML, elem, \"Invalid (different namespaces) opening (%s) and closing element tags.\", elem->name); goto error; } c = start; } e += size; uc = lyxml_getutf8(ctx, e, &size); } if (!*e) { LOGVAL(ctx, LYE_EOF, LY_VLOG_NONE, NULL); goto error; } /* check that it corresponds to opening tag */ size = e - c; str = malloc((size + 1) * sizeof *str); LY_CHECK_ERR_GOTO(!str, LOGMEM(ctx), error); memcpy(str, c, e - c); str[e - c] = '\\0'; if (size != strlen(elem->name) || memcmp(str, elem->name, size)) { LOGVAL(ctx, LYE_SPEC, LY_VLOG_XML, elem, \"Invalid (mixed names) opening (%s) and closing (%s) element tags.\", elem->name, str); free(str); goto error; } free(str); c = e; ign_xmlws(c); if (*c != '>') { LOGVAL(ctx, LYE_SPEC, LY_VLOG_XML, elem, \"Data after closing element tag \\\"%s\\\".\", elem->name); goto error; } c++; if (!(elem->flags & LYXML_ELEM_MIXED) && !elem->content) { /* there was no content, but we don't want NULL (only if mixed content) */ elem->content = lydict_insert(ctx, \"\", 0); } closed_flag = 1; break; } else if (!strncmp(c, \"\", &size)) { goto error; } c += size; } else if (!strncmp(c, \"\", &size)) { goto error; } c += size; } else if (!strncmp(c, \"flags & LYXML_ELEM_MIXED) { /* we have a mixed content */ goto store_content; } else { /* leading white spaces were only formatting */ lws = NULL; } } if (elem->content) { /* we have a mixed content */ if (options & LYXML_PARSE_NOMIXEDCONTENT) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_XML, elem, \"XML element with mixed content\"); goto error; } child = calloc(1, sizeof *child); LY_CHECK_ERR_GOTO(!child, LOGMEM(ctx), error); child->content = elem->content; elem->content = NULL; lyxml_add_child(ctx, elem, child); elem->flags |= LYXML_ELEM_MIXED; } child = lyxml_parse_elem(ctx, c, &size, elem, options); if (!child) { goto error; } c += size; /* move after processed child element */ } else if (is_xmlws(*c)) { lws = c; ign_xmlws(c); } else { store_content: /* store text content */ if (lws) { /* process content including the leading white spaces */ c = lws; lws = NULL; } str = parse_text(ctx, c, '<', &size); if (!str && !size) { goto error; } elem->content = lydict_insert_zc(ctx, str); c += size; /* move after processed text content */ if (elem->child) { /* we have a mixed content */ if (options & LYXML_PARSE_NOMIXEDCONTENT) { LOGVAL(ctx, LYE_XML_INVAL, LY_VLOG_XML, elem, \"XML element with mixed content\"); goto error; } child = calloc(1, sizeof *child); LY_CHECK_ERR_GOTO(!child, LOGMEM(ctx), error); child->content = elem->content; elem->content = NULL; lyxml_add_child(ctx, elem, child); elem->flags |= LYXML_ELEM_MIXED; } } } } else { /* process attribute */ attr = parse_attr(ctx, c, &size, elem); if (!attr) { goto error; } c += size; /* move after processed attribute */ /* check namespace */ if (attr->type == LYXML_ATTR_NS) { if ((!prefix || !prefix[0]) && !attr->name) { if (attr->value) { /* default prefix */ elem->ns = (struct lyxml_ns *)attr; } else { /* xmlns=\"\" -> no namespace */ nons_flag = 1; } } else if (prefix && prefix[0] && attr->name && !strncmp(attr->name, prefix, prefix_len + 1)) { /* matching namespace with prefix */ elem->ns = (struct lyxml_ns *)attr; } } /* go back to finish element processing */ goto process; } *len = c - data; if (!closed_flag) { LOGVAL(ctx, LYE_XML_MISS, LY_VLOG_XML, elem, \"closing element tag\", elem->name); goto error; } /* resolve all attribute prefixes */ LY_TREE_FOR(elem->attr, attr) { if (attr->type == LYXML_ATTR_STD_UNRES) { str = (char *)attr->ns; attr->ns = lyxml_get_ns(elem, str); free(str); attr->type = LYXML_ATTR_STD; } } if (!elem->ns && !nons_flag && parent) { elem->ns = lyxml_get_ns(parent, prefix_len ? prefix : NULL); } free(prefix); return elem; error: lyxml_free(ctx, elem); free(prefix); return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Uncontrolled Recursion"], "explanation": "A stack overflow in libyang <= v1.0.225 can cause a denial of service through function lyxml_parse_mem(). lyxml_parse_elem() function will be called recursively, which will consume stack space and lead to crash.", "severity_level": "NoInfo", "cwe": "CWE-674", "cve": "CVE-2021-28903"}} -{"idx": 421567, "input": "filter_protocol_internal(struct filter_session *fs, uint64_t *token, uint64_t reqid, enum filter_phase phase, const char *param) { struct filter_chain *filter_chain; struct filter_entry *filter_entry; struct filter *filter; struct timeval tv; const char *phase_name = filter_execs[phase].phase_name; int resume = 1; if (!*token) { fs->phase = phase; resume = 0; } /* XXX - this sanity check requires a protocol change, stub for now */ phase = fs->phase; if (fs->phase != phase) fatalx(\"misbehaving filter\"); /* based on token, identify the filter_entry we should apply */ filter_chain = dict_get(&filter_chains, fs->filter_name); filter_entry = TAILQ_FIRST(&filter_chain->chain[fs->phase]); if (*token) { TAILQ_FOREACH(filter_entry, &filter_chain->chain[fs->phase], entries) if (filter_entry->id == *token) break; if (filter_entry == NULL) fatalx(\"misbehaving filter\"); filter_entry = TAILQ_NEXT(filter_entry, entries); } /* no filter_entry, we either had none or reached end of chain */ if (filter_entry == NULL) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, resume=%s, \" \"action=proceed\", fs->id, phase_name, resume ? \"y\" : \"n\"); filter_result_proceed(reqid); return; } /* process param with current filter_entry */ *token = filter_entry->id; filter = dict_get(&filters, filter_entry->name); if (filter->proc) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=deferred, filter=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name); filter_protocol_query(filter, filter_entry->id, reqid, filter_execs[fs->phase].phase_name, param); return; /* deferred response */ } if (filter_execs[fs->phase].func(fs, filter, reqid, param)) { if (filter->config->rewrite) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=rewrite, filter=%s, query=%s, response=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param, filter->config->rewrite); filter_result_rewrite(reqid, filter->config->rewrite); return; } else if (filter->config->disconnect) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=disconnect, filter=%s, query=%s, response=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param, filter->config->disconnect); filter_result_disconnect(reqid, filter->config->disconnect); return; } else if (filter->config->junk) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=junk, filter=%s, query=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param); filter_result_junk(reqid); return; } else if (filter->config->report) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=report, filter=%s, query=%s response=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param, filter->config->report); gettimeofday(&tv, NULL); lka_report_filter_report(fs->id, filter->name, 1, \"smtp-in\", &tv, filter->config->report); } else if (filter->config->bypass) { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=bypass, filter=%s, query=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param); filter_result_proceed(reqid); return; } else { log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=reject, filter=%s, query=%s, response=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param, filter->config->reject); filter_result_reject(reqid, filter->config->reject); return; } } log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters protocol phase=%s, \" \"resume=%s, action=proceed, filter=%s, query=%s\", fs->id, phase_name, resume ? \"y\" : \"n\", filter->name, param); /* filter_entry resulted in proceed, try next filter */ filter_protocol_internal(fs, token, reqid, phase, param); return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196802, "input": "static void launch(OpKernelContext* context, const PoolParameters& params, const Tensor& grad_in, const Tensor& argmax, Tensor* grad_out, const bool include_batch_in_index) { const DeviceBase::CpuWorkerThreads& worker_threads = *(context->device()->tensorflow_cpu_worker_threads()); auto shard = [&grad_in, &argmax, &grad_out, include_batch_in_index]( int64 start, int64 limit) { const int64 batch_size = GetTensorDim(grad_out->shape(), FORMAT_NHWC, 'N'); const int64 output_size_per_batch = grad_out->NumElements() / batch_size; const int64 input_size_per_batch = grad_in.NumElements() / batch_size; { auto grad_out_flat = grad_out->flat(); auto argmax_flat = argmax.flat(); auto grad_in_flat = grad_in.flat(); const int64 output_start = start * output_size_per_batch; const int64 output_end = limit * output_size_per_batch; EigenMatrixMap inputShard(grad_out_flat.data() + output_start, 1, output_end - output_start); inputShard.setConstant(T(0)); const int input_start = start * input_size_per_batch; const int input_end = limit * input_size_per_batch; for (int64 index = input_start; index < input_end; index++) { int64 grad_out_index = argmax_flat(index); if (!include_batch_in_index) { const int64 cur_batch = index / input_size_per_batch; grad_out_index += cur_batch * output_size_per_batch; } CHECK(grad_out_index >= output_start && grad_out_index < output_end) << \"Invalid output gradient index: \" << grad_out_index << \", \" << output_start << \", \" << output_end; grad_out_flat(grad_out_index) += grad_in_flat(index); } } }; const int64 batch_size = GetTensorDim(grad_out->shape(), FORMAT_NHWC, 'N'); const int64 shard_cost = grad_out->NumElements() / batch_size; Shard(worker_threads.num_threads, worker_threads.workers, batch_size, shard_cost, shard); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPoolGradWithArgmax` can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/ef0c008ee84bad91ec6725ddc42091e19a30cf0e/tensorflow/core/kernels/maxpooling_op.cc#L1016-L1017) uses the same value to index in two different arrays but there is no guarantee that the sizes are identical. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-29570"}} -{"idx": 265428, "input": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { // Retrieve tensors (All should be allocated by now) const TfLiteTensor* output_shape; TF_LITE_ENSURE_OK( context, GetInputSafe(context, node, kOutputShapeTensor, &output_shape)); const TfLiteTensor* weights; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kWeightsTensor, &weights)); const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kDataInputTensor, &input)); const TfLiteTensor* bias = (NumInputs(node) == 4) ? GetOptionalInputTensor(context, node, kBiasTensor) : nullptr; TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, kOutputTensor, &output)); OpData* data = reinterpret_cast(node->user_data); TfLiteTensor* col2im = data->has_col2im ? GetTemporary(context, node, data->col2im_index) : nullptr; TfLiteTensor* transposed_weights = data->weights_are_transposed ? GetTemporary(context, node, data->transposed_weights_index) : nullptr; const auto* params = reinterpret_cast(node->builtin_data); // Prevent divisions by 0 TF_LITE_ENSURE(context, params->stride_height > 0); TF_LITE_ENSURE(context, params->stride_width > 0); // Resize any deferred dynamic tensors if (IsDynamicTensor(output)) { TF_LITE_ENSURE_OK(context, ResizeTensor(context, output_shape, output)); } if (data->has_col2im && IsDynamicTensor(col2im)) { TF_LITE_ENSURE_OK(context, ResizeCol2ImTensor(context, output_shape, weights, input, col2im)); } // Get height and width of the output image. const int width = SizeOfDimension(output, 2); const int height = SizeOfDimension(output, 1); const int filter_width = SizeOfDimension(weights, 2); const int filter_height = SizeOfDimension(weights, 1); int unused_output_height, unused_output_width; data->padding = ComputePaddingHeightWidth( params->stride_height, params->stride_width, 1, 1, height, width, filter_height, filter_width, params->padding, &unused_output_height, &unused_output_width); // Currently support float32, uint8, int8, int16. switch (input->type) { case kTfLiteFloat32: { // Only for GenericOptimized path, we use transposed weights. if (data->weights_are_transposed) { if (!IsConstantTensor(weights)) { ResizeAndTransposeWeights(context, weights, transposed_weights); } } EvalFloat(context, params, data, input, weights, bias, transposed_weights, col2im, output); break; } case kTfLiteUInt8: { TfLiteTensor* scratch_buffer; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, data->scratch_tensor_index, &scratch_buffer)); if (IsDynamicTensor(scratch_buffer)) { TF_LITE_ENSURE_OK(context, ResizeTensor(context, output_shape, scratch_buffer)); } if (data->weights_are_transposed) { if (!IsConstantTensor(weights)) { ResizeAndTransposeWeights(context, weights, transposed_weights); } } EvalQuantized(context, params, data, input, weights, transposed_weights, bias, col2im, output, scratch_buffer); break; } case kTfLiteInt8: { TfLiteTensor* scratch_buffer; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, data->scratch_tensor_index, &scratch_buffer)); if (IsDynamicTensor(scratch_buffer)) { TF_LITE_ENSURE_OK(context, ResizeTensor(context, output_shape, scratch_buffer)); } if (data->weights_are_transposed && !IsConstantTensor(weights)) { ResizeAndTransposeWeights(context, weights, transposed_weights); } EvalQuantizedPerChannel(context, params, data, input, weights, transposed_weights, bias, col2im, output, scratch_buffer); break; } case kTfLiteInt16: { TfLiteTensor* scratch_buffer; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, data->scratch_tensor_index, &scratch_buffer)); if (IsDynamicTensor(scratch_buffer)) { TF_LITE_ENSURE_OK(context, ResizeTensor(context, output_shape, scratch_buffer)); } if (data->weights_are_transposed && !IsConstantTensor(weights)) { ResizeAndTransposeWeights(context, weights, transposed_weights); } EvalQuantizedPerChannel16x8(context, params, data, input, weights, transposed_weights, bias, col2im, output, scratch_buffer); break; } default: context->ReportError(context, \"Type '%s' is not currently supported.\", TfLiteTypeGetName(input->type)); return kTfLiteError; } return kTfLiteOk; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385971, "input": "file_apprentice(struct magic_set *ms, const char *fn, int action) { char *p, *mfn; int file_err, errs = -1; size_t i; /* XXX disabling default magic loading so the compiled in data is used */ #if 0 if ((fn = magic_getpath(fn, action)) == NULL) return -1; #endif init_file_tables(); if (fn == NULL) fn = getenv(\"MAGIC\"); if (fn == NULL) { for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); if ((ms->mlist[i] = mlist_alloc()) == NULL) { file_oomem(ms, sizeof(*ms->mlist[i])); return -1; } } return apprentice_1(ms, fn, action); } if ((mfn = estrdup(fn)) == NULL) { file_oomem(ms, strlen(fn)); return -1; } for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); if ((ms->mlist[i] = mlist_alloc()) == NULL) { file_oomem(ms, sizeof(*ms->mlist[i])); if (i != 0) { --i; do mlist_free(ms->mlist[i]); while (i != 0); } efree(mfn); return -1; } } fn = mfn; while (fn) { p = strchr(fn, PATHSEP); if (p) *p++ = '\\0'; if (*fn == '\\0') break; file_err = apprentice_1(ms, fn, action); errs = MAX(errs, file_err); fn = p; } efree(mfn); if (errs == -1) { for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); ms->mlist[i] = NULL; } file_error(ms, 0, \"could not find any valid magic files!\"); return -1; } if (action == FILE_LOAD) return 0; for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); ms->mlist[i] = NULL; } switch (action) { case FILE_COMPILE: case FILE_CHECK: case FILE_LIST: return 0; default: file_error(ms, 0, \"Invalid action %d\", action); return -1; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281288, "input": "int RGWPutObj_ObjStore_S3::get_params() { if (!s->length) return -ERR_LENGTH_REQUIRED; RGWObjectCtx& obj_ctx = *static_cast(s->obj_ctx); map src_attrs; size_t pos; int ret; map_qs_metadata(s); RGWAccessControlPolicy_S3 s3policy(s->cct); ret = create_s3_policy(s, store, s3policy, s->owner); if (ret < 0) return ret; policy = s3policy; if_match = s->info.env->get(\"HTTP_IF_MATCH\"); if_nomatch = s->info.env->get(\"HTTP_IF_NONE_MATCH\"); copy_source = url_decode(s->info.env->get(\"HTTP_X_AMZ_COPY_SOURCE\", \"\")); copy_source_range = s->info.env->get(\"HTTP_X_AMZ_COPY_SOURCE_RANGE\"); /* handle x-amz-copy-source */ boost::string_view cs_view(copy_source); if (! cs_view.empty()) { if (cs_view[0] == '/') cs_view.remove_prefix(1); copy_source_bucket_name = cs_view.to_string(); pos = copy_source_bucket_name.find(\"/\"); if (pos == std::string::npos) { ret = -EINVAL; ldout(s->cct, 5) << \"x-amz-copy-source bad format\" << dendl; return ret; } copy_source_object_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size()); copy_source_bucket_name = copy_source_bucket_name.substr(0, pos); #define VERSION_ID_STR \"?versionId=\" pos = copy_source_object_name.find(VERSION_ID_STR); if (pos == std::string::npos) { copy_source_object_name = url_decode(copy_source_object_name); } else { copy_source_version_id = copy_source_object_name.substr(pos + sizeof(VERSION_ID_STR) - 1); copy_source_object_name = url_decode(copy_source_object_name.substr(0, pos)); } pos = copy_source_bucket_name.find(\":\"); if (pos == std::string::npos) { copy_source_tenant_name = s->src_tenant_name; } else { copy_source_tenant_name = copy_source_bucket_name.substr(0, pos); copy_source_bucket_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size()); if (copy_source_bucket_name.empty()) { ret = -EINVAL; ldout(s->cct, 5) << \"source bucket name is empty\" << dendl; return ret; } } ret = store->get_bucket_info(obj_ctx, copy_source_tenant_name, copy_source_bucket_name, copy_source_bucket_info, NULL, &src_attrs); if (ret < 0) { ldout(s->cct, 5) << __func__ << \"(): get_bucket_info() returned ret=\" << ret << dendl; return ret; } /* handle x-amz-copy-source-range */ if (copy_source_range) { string range = copy_source_range; pos = range.find(\"=\"); if (pos == std::string::npos) { ret = -EINVAL; ldout(s->cct, 5) << \"x-amz-copy-source-range bad format\" << dendl; return ret; } range = range.substr(pos + 1); pos = range.find(\"-\"); if (pos == std::string::npos) { ret = -EINVAL; ldout(s->cct, 5) << \"x-amz-copy-source-range bad format\" << dendl; return ret; } string first = range.substr(0, pos); string last = range.substr(pos + 1); copy_source_range_fst = strtoull(first.c_str(), NULL, 10); copy_source_range_lst = strtoull(last.c_str(), NULL, 10); } } /* copy_source */ /* handle object tagging */ auto tag_str = s->info.env->get(\"HTTP_X_AMZ_TAGGING\"); if (tag_str){ obj_tags = std::make_unique(); ret = obj_tags->set_from_string(tag_str); if (ret < 0){ ldout(s->cct,0) << \"setting obj tags failed with \" << ret << dendl; if (ret == -ERR_INVALID_TAG){ ret = -EINVAL; //s3 returns only -EINVAL for PUT requests } return ret; } } return RGWPutObj_ObjStore::get_params(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303102, "input": "static int compname_to_clibcode(const char* compname) { if (strcmp(compname, BLOSC_BLOSCLZ_COMPNAME) == 0) return BLOSC_BLOSCLZ_LIB; if (strcmp(compname, BLOSC_LZ4_COMPNAME) == 0) return BLOSC_LZ4_LIB; if (strcmp(compname, BLOSC_LZ4HC_COMPNAME) == 0) return BLOSC_LZ4_LIB; if (strcmp(compname, BLOSC_LIZARD_COMPNAME) == 0) return BLOSC_LIZARD_LIB; if (strcmp(compname, BLOSC_SNAPPY_COMPNAME) == 0) return BLOSC_SNAPPY_LIB; if (strcmp(compname, BLOSC_ZLIB_COMPNAME) == 0) return BLOSC_ZLIB_LIB; if (strcmp(compname, BLOSC_ZSTD_COMPNAME) == 0) return BLOSC_ZSTD_LIB; return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280053, "input": "static int any_slab_objects(struct kmem_cache *s) { int node; struct kmem_cache_node *n; for_each_kmem_cache_node(s, node, n) if (atomic_long_read(&n->total_objects)) return 1; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508970, "input": "Item_string(THD *thd, const char *name_par, const char *str, uint length, CHARSET_INFO *cs, Derivation dv, uint repertoire): Item_basic_constant(thd) { str_value.set_or_copy_aligned(str, length, cs); fix_from_value(dv, Metadata(&str_value, repertoire)); set_name(thd, name_par, 0, system_charset_info); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279625, "input": "packet_buffer_destroy(struct packet_buffer *buffer) { kfree(buffer->data); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354579, "input": "int kvm_arch_prepare_memory_region(struct kvm *kvm, struct kvm_memory_slot *memslot, const struct kvm_userspace_memory_region *mem, enum kvm_mr_change change) { /* A few sanity checks. We can have memory slots which have to be located/ended at a segment boundary (1MB). The memory in userland is ok to be fragmented into various different vmas. It is okay to mmap() and munmap() stuff in this slot after doing this call at any time */ if (mem->userspace_addr & 0xffffful) return -EINVAL; if (mem->memory_size & 0xffffful) return -EINVAL; if (mem->guest_phys_addr + mem->memory_size > kvm->arch.mem_limit) return -EINVAL; /* When we are protected, we should not change the memory slots */ if (kvm_s390_pv_get_handle(kvm)) return -EINVAL; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244719, "input": "static int parse_tables(struct archive_read* a, struct rar5* rar, const uint8_t* p) { int ret, value, i, w, idx = 0; uint8_t bit_length[HUFF_BC], table[HUFF_TABLE_SIZE], nibble_mask = 0xF0, nibble_shift = 4; enum { ESCAPE = 15 }; /* The data for table generation is compressed using a simple RLE-like * algorithm when storing zeroes, so we need to unpack it first. */ for(w = 0, i = 0; w < HUFF_BC;) { if(i >= rar->cstate.cur_block_size) { /* Truncated data, can't continue. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Truncated data in huffman tables\"); return ARCHIVE_FATAL; } value = (p[i] & nibble_mask) >> nibble_shift; if(nibble_mask == 0x0F) ++i; nibble_mask ^= 0xFF; nibble_shift ^= 4; /* Values smaller than 15 is data, so we write it directly. * Value 15 is a flag telling us that we need to unpack more * bytes. */ if(value == ESCAPE) { value = (p[i] & nibble_mask) >> nibble_shift; if(nibble_mask == 0x0F) ++i; nibble_mask ^= 0xFF; nibble_shift ^= 4; if(value == 0) { /* We sometimes need to write the actual value * of 15, so this case handles that. */ bit_length[w++] = ESCAPE; } else { int k; /* Fill zeroes. */ for(k = 0; (k < value + 2) && (w < HUFF_BC); k++) { bit_length[w++] = 0; } } } else { bit_length[w++] = value; } } rar->bits.in_addr = i; rar->bits.bit_addr = nibble_shift ^ 4; ret = create_decode_tables(bit_length, &rar->cstate.bd, HUFF_BC); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Decoding huffman tables failed\"); return ARCHIVE_FATAL; } for(i = 0; i < HUFF_TABLE_SIZE;) { uint16_t num; if((rar->bits.in_addr + 6) >= rar->cstate.cur_block_size) { /* Truncated data, can't continue. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Truncated data in huffman tables (#2)\"); return ARCHIVE_FATAL; } ret = decode_number(a, &rar->cstate.bd, p, &num); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Decoding huffman tables failed\"); return ARCHIVE_FATAL; } if(num < 16) { /* 0..15: store directly */ table[i] = (uint8_t) num; i++; } else if(num < 18) { /* 16..17: repeat previous code */ uint16_t n; if(ARCHIVE_OK != read_bits_16(rar, p, &n)) return ARCHIVE_EOF; if(num == 16) { n >>= 13; n += 3; skip_bits(rar, 3); } else { n >>= 9; n += 11; skip_bits(rar, 7); } if(i > 0) { while(n-- > 0 && i < HUFF_TABLE_SIZE) { table[i] = table[i - 1]; i++; } } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Unexpected error when decoding \" \"huffman tables\"); return ARCHIVE_FATAL; } } else { /* other codes: fill with zeroes `n` times */ uint16_t n; if(ARCHIVE_OK != read_bits_16(rar, p, &n)) return ARCHIVE_EOF; if(num == 18) { n >>= 13; n += 3; skip_bits(rar, 3); } else { n >>= 9; n += 11; skip_bits(rar, 7); } while(n-- > 0 && i < HUFF_TABLE_SIZE) table[i++] = 0; } } ret = create_decode_tables(&table[idx], &rar->cstate.ld, HUFF_NC); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Failed to create literal table\"); return ARCHIVE_FATAL; } idx += HUFF_NC; ret = create_decode_tables(&table[idx], &rar->cstate.dd, HUFF_DC); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Failed to create distance table\"); return ARCHIVE_FATAL; } idx += HUFF_DC; ret = create_decode_tables(&table[idx], &rar->cstate.ldd, HUFF_LDC); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Failed to create lower bits of distances table\"); return ARCHIVE_FATAL; } idx += HUFF_LDC; ret = create_decode_tables(&table[idx], &rar->cstate.rd, HUFF_RC); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, \"Failed to create repeating distances table\"); return ARCHIVE_FATAL; } return ARCHIVE_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333793, "input": "void RGWListBucket_ObjStore_S3v2::send_versioned_response() { s->formatter->open_object_section_in_ns(\"ListVersionsResult\", XMLNS_AWS_S3); RGWListBucket_ObjStore_S3v2::send_common_versioned_response(); s->formatter->dump_string(\"KeyContinuationToken\", marker.name); s->formatter->dump_string(\"VersionIdContinuationToken\", marker.instance); if (is_truncated && !next_marker.empty()) { s->formatter->dump_string(\"NextKeyContinuationToken\", next_marker.name); s->formatter->dump_string(\"NextVersionIdContinuationToken\", next_marker.instance); } if (strcasecmp(encoding_type.c_str(), \"url\") == 0) { s->formatter->dump_string(\"EncodingType\", \"url\"); encode_key = true; } if (op_ret >= 0) { if (objs_container) { s->formatter->open_array_section(\"Entries\"); } vector::iterator iter; for (iter = objs.begin(); iter != objs.end(); ++iter) { const char *section_name = (iter->is_delete_marker() ? \"DeleteContinuationToken\" : \"Version\"); s->formatter->open_object_section(section_name); if (objs_container) { s->formatter->dump_bool(\"IsDeleteContinuationToken\", iter->is_delete_marker()); } rgw_obj_key key(iter->key); if (encode_key) { string key_name; url_encode(key.name, key_name); s->formatter->dump_string(\"Key\", key_name); } else { s->formatter->dump_string(\"Key\", key.name); } string version_id = key.instance; if (version_id.empty()) { version_id = \"null\"; } if (s->system_request) { if (iter->versioned_epoch > 0) { s->formatter->dump_int(\"VersionedEpoch\", iter->versioned_epoch); } s->formatter->dump_string(\"RgwxTag\", iter->tag); utime_t ut(iter->meta.mtime); ut.gmtime_nsec(s->formatter->dump_stream(\"RgwxMtime\")); } s->formatter->dump_string(\"VersionId\", version_id); s->formatter->dump_bool(\"IsLatest\", iter->is_current()); dump_time(s, \"LastModified\", &iter->meta.mtime); if (!iter->is_delete_marker()) { s->formatter->dump_format(\"ETag\", \"\\\"%s\\\"\", iter->meta.etag.c_str()); s->formatter->dump_int(\"Size\", iter->meta.accounted_size); auto& storage_class = rgw_placement_rule::get_canonical_storage_class(iter->meta.storage_class); s->formatter->dump_string(\"StorageClass\", storage_class.c_str()); } if (fetchOwner == true) { dump_owner(s, s->user->user_id, s->user->display_name); } s->formatter->close_section(); } if (objs_container) { s->formatter->close_section(); } if (!common_prefixes.empty()) { map::iterator pref_iter; for (pref_iter = common_prefixes.begin(); pref_iter != common_prefixes.end(); ++pref_iter) { s->formatter->open_array_section(\"CommonPrefixes\"); if (encode_key) { s->formatter->dump_string(\"Prefix\", url_encode(pref_iter->first, false)); } else { s->formatter->dump_string(\"Prefix\", pref_iter->first); } s->formatter->dump_int(\"KeyCount\",objs.size()); if (start_after_exist) { s->formatter->dump_string(\"StartAfter\", startAfter); } s->formatter->close_section(); } } s->formatter->close_section(); rgw_flush_formatter_and_reset(s, s->formatter); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431235, "input": "static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs41_reclaim_complete_args *args = data; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args) }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_reclaim_complete(xdr, args, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519651, "input": "XMLNode::dump (ostream& s, string p) const { if (_is_content) { s << p << \" \" << content() << \"\\n\"; } else { s << p << \"<\" << _name; for (XMLPropertyList::const_iterator i = _proplist.begin(); i != _proplist.end(); ++i) { s << \" \" << (*i)->name() << \"=\\\"\" << (*i)->value() << \"\\\"\"; } s << \">\\n\"; for (XMLNodeList::const_iterator i = _children.begin(); i != _children.end(); ++i) { (*i)->dump (s, p + \" \"); } s << p << \"\\n\"; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281290, "input": "int RGWPutObj_ObjStore_S3::get_decrypt_filter( std::unique_ptr* filter, RGWGetObj_Filter* cb, map& attrs, bufferlist* manifest_bl) { std::map crypt_http_responses_unused; int res = 0; std::unique_ptr block_crypt; res = rgw_s3_prepare_decrypt(s, attrs, &block_crypt, crypt_http_responses_unused); if (res == 0) { if (block_crypt != nullptr) { auto f = std::unique_ptr(new RGWGetObj_BlockDecrypt(s->cct, cb, std::move(block_crypt))); //RGWGetObj_BlockDecrypt* f = new RGWGetObj_BlockDecrypt(s->cct, cb, std::move(block_crypt)); if (f != nullptr) { if (manifest_bl != nullptr) { res = f->read_manifest(*manifest_bl); if (res == 0) { *filter = std::move(f); } } } } } return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269043, "input": "R_API int r_sys_fork() { #if HAVE_FORK #if __WINDOWS__ return -1; #else return fork (); #endif #else return -1; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273022, "input": "SWFInput_input_seek(SWFInput input, long offset, int whence) { if ( whence == SEEK_CUR ) { if ( offset >= 0 ) input->offset = min(input->length, input->offset + offset); else input->offset = max(0, input->offset + offset); } else if ( whence == SEEK_END ) input->offset = max(0, input->length - offset); else if ( whence == SEEK_SET ) input->offset = min(input->length, offset); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 299144, "input": "yaffsfs_get_default_attr_type(const TSK_FS_FILE * /*a_file*/) { return TSK_FS_ATTR_TYPE_DEFAULT; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 521657, "input": "static bool validate_hash(uuid_t type, int size) { if (uuid_equals(&type, &EFI_CERT_SHA1_GUID) && (size == 20)) return true; if (uuid_equals(&type, &EFI_CERT_SHA224_GUID) && (size == 28)) return true; if (uuid_equals(&type, &EFI_CERT_SHA256_GUID) && (size == 32)) return true; if (uuid_equals(&type, &EFI_CERT_SHA384_GUID) && (size == 48)) return true; if (uuid_equals(&type, &EFI_CERT_SHA512_GUID) && (size == 64)) return true; return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 258445, "input": "static HostnameValidationResult matches_subject_alternative_name(const char *hostname, const X509 *server_cert) { HostnameValidationResult result = MatchNotFound; int i; int san_names_nb = -1; STACK_OF(GENERAL_NAME) *san_names = NULL; // Try to extract the names within the SAN extension from the certificate san_names = X509_get_ext_d2i((X509 *) server_cert, NID_subject_alt_name, NULL, NULL); if (san_names == NULL) { return NoSANPresent; } san_names_nb = sk_GENERAL_NAME_num(san_names); // Check each name within the extension for (i=0; itype == GEN_DNS) { // Current name is a DNS name, let's check it char *dns_name = (char *) ASN1_STRING_data(current_name->d.dNSName); // Make sure there isn't an embedded NUL character in the DNS name if (ASN1_STRING_length(current_name->d.dNSName) != strlen(dns_name)) { result = MalformedCertificate; break; } else { // Compare expected hostname with the DNS name if (strcasecmp(hostname, dns_name) == 0) { result = MatchFound; break; } } } } sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506542, "input": "string_expand_macros() { if (expand_1level_macros() && expand_1level_macros() && expand_1level_macros() && expand_1level_macros()) int_error(NO_CARET, \"Macros nested too deeply\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 343497, "input": "void kvm_hv_init_vm(struct kvm *kvm) { struct kvm_hv *hv = to_kvm_hv(kvm); mutex_init(&hv->hv_lock); idr_init(&hv->conn_to_evt); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383677, "input": "spnego_gss_acquire_cred_with_password(OM_uint32 *minor_status, const gss_name_t desired_name, const gss_buffer_t password, OM_uint32 time_req, const gss_OID_set desired_mechs, gss_cred_usage_t cred_usage, gss_cred_id_t *output_cred_handle, gss_OID_set *actual_mechs, OM_uint32 *time_rec) { OM_uint32 status, tmpmin; gss_OID_set amechs = GSS_C_NULL_OID_SET; gss_cred_id_t mcred = NULL; spnego_gss_cred_id_t spcred = NULL; dsyslog(\"Entering spnego_gss_acquire_cred_with_password\\n\"); if (actual_mechs) *actual_mechs = NULL; if (time_rec) *time_rec = 0; status = get_available_mechs(minor_status, desired_name, cred_usage, GSS_C_NO_CRED_STORE, NULL, &amechs); if (status != GSS_S_COMPLETE) goto cleanup; status = gss_acquire_cred_with_password(minor_status, desired_name, password, time_req, amechs, cred_usage, &mcred, actual_mechs, time_rec); if (status != GSS_S_COMPLETE) goto cleanup; spcred = malloc(sizeof(spnego_gss_cred_id_rec)); if (spcred == NULL) { *minor_status = ENOMEM; status = GSS_S_FAILURE; goto cleanup; } spcred->neg_mechs = GSS_C_NULL_OID_SET; spcred->mcred = mcred; mcred = GSS_C_NO_CREDENTIAL; *output_cred_handle = (gss_cred_id_t)spcred; cleanup: (void) gss_release_oid_set(&tmpmin, &amechs); (void) gss_release_cred(&tmpmin, &mcred); dsyslog(\"Leaving spnego_gss_acquire_cred_with_password\\n\"); return (status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385961, "input": "addentry(struct magic_set *ms, struct magic_entry *me, struct magic_entry **mentry, uint32_t *mentrycount) { size_t i = me->mp->type == FILE_NAME ? 1 : 0; if (mentrycount[i] == maxmagic[i]) { struct magic_entry *mp; maxmagic[i] += ALLOC_INCR; if ((mp = CAST(struct magic_entry *, erealloc(mentry[i], sizeof(*mp) * maxmagic[i]))) == NULL) { file_oomem(ms, sizeof(*mp) * maxmagic[i]); return -1; } (void)memset(&mp[mentrycount[i]], 0, sizeof(*mp) * ALLOC_INCR); mentry[i] = mp; } mentry[i][mentrycount[i]++] = *me; memset(me, 0, sizeof(*me)); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212350, "input": "ImagingFliDecode(Imaging im, ImagingCodecState state, UINT8 *buf, Py_ssize_t bytes) { UINT8 *ptr; int framesize; int c, chunks, advance; int l, lines; int i, j, x = 0, y, ymax; /* If not even the chunk size is present, we'd better leave */ if (bytes < 4) { return 0; } /* We don't decode anything unless we have a full chunk in the input buffer */ ptr = buf; framesize = I32(ptr); if (framesize < I32(ptr)) { return 0; } /* Make sure this is a frame chunk. The Python driver takes case of other chunk types. */ if (bytes < 8) { state->errcode = IMAGING_CODEC_OVERRUN; return -1; } if (I16(ptr + 4) != 0xF1FA) { state->errcode = IMAGING_CODEC_UNKNOWN; return -1; } chunks = I16(ptr + 6); ptr += 16; bytes -= 16; /* Process subchunks */ for (c = 0; c < chunks; c++) { UINT8 *data; if (bytes < 10) { state->errcode = IMAGING_CODEC_OVERRUN; return -1; } data = ptr + 6; switch (I16(ptr + 4)) { case 4: case 11: /* FLI COLOR chunk */ break; /* ignored; handled by Python code */ case 7: /* FLI SS2 chunk (word delta) */ /* OOB ok, we've got 4 bytes min on entry */ lines = I16(data); data += 2; for (l = y = 0; l < lines && y < state->ysize; l++, y++) { UINT8 *local_buf = (UINT8 *)im->image[y]; int p, packets; ERR_IF_DATA_OOB(2) packets = I16(data); data += 2; while (packets & 0x8000) { /* flag word */ if (packets & 0x4000) { y += 65536 - packets; /* skip lines */ if (y >= state->ysize) { state->errcode = IMAGING_CODEC_OVERRUN; return -1; } local_buf = (UINT8 *)im->image[y]; } else { /* store last byte (used if line width is odd) */ local_buf[state->xsize - 1] = (UINT8)packets; } ERR_IF_DATA_OOB(2) packets = I16(data); data += 2; } for (p = x = 0; p < packets; p++) { ERR_IF_DATA_OOB(2) x += data[0]; /* pixel skip */ if (data[1] >= 128) { ERR_IF_DATA_OOB(4) i = 256 - data[1]; /* run */ if (x + i + i > state->xsize) { break; } for (j = 0; j < i; j++) { local_buf[x++] = data[2]; local_buf[x++] = data[3]; } data += 2 + 2; } else { i = 2 * (int)data[1]; /* chunk */ if (x + i > state->xsize) { break; } ERR_IF_DATA_OOB(2 + i) memcpy(local_buf + x, data + 2, i); data += 2 + i; x += i; } } if (p < packets) { break; /* didn't process all packets */ } } if (l < lines) { /* didn't process all lines */ state->errcode = IMAGING_CODEC_OVERRUN; return -1; } break; case 12: /* FLI LC chunk (byte delta) */ /* OOB Check ok, we have 4 bytes min here */ y = I16(data); ymax = y + I16(data + 2); data += 4; for (; y < ymax && y < state->ysize; y++) { UINT8 *out = (UINT8 *)im->image[y]; ERR_IF_DATA_OOB(1) int p, packets = *data++; for (p = x = 0; p < packets; p++, x += i) { ERR_IF_DATA_OOB(2) x += data[0]; /* skip pixels */ if (data[1] & 0x80) { i = 256 - data[1]; /* run */ if (x + i > state->xsize) { break; } ERR_IF_DATA_OOB(3) memset(out + x, data[2], i); data += 3; } else { i = data[1]; /* chunk */ if (x + i > state->xsize) { break; } ERR_IF_DATA_OOB(2 + i) memcpy(out + x, data + 2, i); data += i + 2; } } if (p < packets) { break; /* didn't process all packets */ } } if (y < ymax) { /* didn't process all lines */ state->errcode = IMAGING_CODEC_OVERRUN; return -1; } break; case 13: /* FLI BLACK chunk */ for (y = 0; y < state->ysize; y++) { memset(im->image[y], 0, state->xsize); } break; case 15: /* FLI BRUN chunk */ /* OOB, ok, we've got 4 bytes min on entry */ for (y = 0; y < state->ysize; y++) { UINT8 *out = (UINT8 *)im->image[y]; data += 1; /* ignore packetcount byte */ for (x = 0; x < state->xsize; x += i) { ERR_IF_DATA_OOB(2) if (data[0] & 0x80) { i = 256 - data[0]; if (x + i > state->xsize) { break; /* safety first */ } ERR_IF_DATA_OOB(i + 1) memcpy(out + x, data + 1, i); data += i + 1; } else { i = data[0]; if (x + i > state->xsize) { break; /* safety first */ } memset(out + x, data[1], i); data += 2; } } if (x != state->xsize) { /* didn't unpack whole line */ state->errcode = IMAGING_CODEC_OVERRUN; return -1; } } break; case 16: /* COPY chunk */ if (state->xsize > bytes / state->ysize) { /* not enough data for frame */ return ptr - buf; /* bytes consumed */ } for (y = 0; y < state->ysize; y++) { UINT8 *local_buf = (UINT8 *)im->image[y]; memcpy(local_buf, data, state->xsize); data += state->xsize; } break; case 18: /* PSTAMP chunk */ break; /* ignored */ default: /* unknown chunk */ /* printf(\"unknown FLI/FLC chunk: %d\\n\", I16(ptr+4)); */ state->errcode = IMAGING_CODEC_UNKNOWN; return -1; } advance = I32(ptr); if (advance < 0 || advance > bytes) { state->errcode = IMAGING_CODEC_OVERRUN; return -1; } ptr += advance; bytes -= advance; } return -1; /* end of frame */ }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Loop with Unreachable Exit Condition ('Infinite Loop')"], "explanation": "An issue was discovered in Pillow before 8.2.0. For FLI data, FliDecode did not properly check that the block advance was non-zero, potentially leading to an infinite loop on load.", "severity_level": "NoInfo", "cwe": "CWE-835", "cve": "CVE-2021-28676"}} -{"idx": 368096, "input": "float IIR2_filter::update(float x) { prev[0] = x; double y = x * coeffs[0]; for (int i = 4; i >= 1; i--) { y += coeffs[i] * prev[i]; prev[i] = prev[i - 1]; } prev[3] = y; return (float)y; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 199860, "input": "UINT rdpgfx_read_rect16(wStream* s, RECTANGLE_16* rect16) { if (Stream_GetRemainingLength(s) < 8) { WLog_ERR(TAG, \"not enough data!\"); return ERROR_INVALID_DATA; } Stream_Read_UINT16(s, rect16->left); /* left (2 bytes) */ Stream_Read_UINT16(s, rect16->top); /* top (2 bytes) */ Stream_Read_UINT16(s, rect16->right); /* right (2 bytes) */ Stream_Read_UINT16(s, rect16->bottom); /* bottom (2 bytes) */ return CHANNEL_RC_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "In FreeRDP less than or equal to 2.1.2, an integer overflow exists due to missing input sanitation in rdpegfx channel. All FreeRDP clients are affected. The input rectangles from the server are not checked against local surface coordinates and blindly accepted. A malicious server can send data that will crash the client later on (invalid length arguments to a `memcpy`) This has been fixed in 2.2.0. As a workaround, stop using command line arguments /gfx, /gfx-h264 and /network:auto", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-15103"}} -{"idx": 375240, "input": "SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t __user *, uinfo) { kernel_siginfo_t info; int ret = __copy_siginfo_from_user(sig, &info, uinfo); if (unlikely(ret)) return ret; return do_rt_sigqueueinfo(pid, sig, &info); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234440, "input": "nfs4_ff_layout_stat_io_update_requested(struct nfs4_ff_layoutstat *layoutstat, __u64 requested) { struct nfs4_ff_io_stat *iostat = &layoutstat->io_stat; iostat->ops_requested++; iostat->bytes_requested += requested; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280597, "input": "check_subactions(struct ofpact *ofpacts, size_t ofpacts_len, struct ofpact_check_params *cp) { struct ofpact_check_params sub = *cp; enum ofperr error = ofpacts_check(ofpacts, ofpacts_len, &sub); cp->usable_protocols &= sub.usable_protocols; return error; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370077, "input": "Value ExpressionRandom::serialize(const bool explain) const { return Value(DOC(getOpName() << Document())); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269102, "input": "subscription *GetNextSubscription(service_info *service, subscription *current) { time_t current_time; subscription *next = NULL; subscription *previous = NULL; int notDone = 1; /* get the current_time */ time(¤t_time); while (notDone && current) { previous = current; current = current->next; if (!current) { notDone = 0; next = current; } else if (current->expireTime && current->expireTime < current_time) { previous->next = current->next; current->next = NULL; freeSubscriptionList(current); current = previous; service->TotalSubscriptions--; } else if (current->active) { notDone = 0; next = current; } } return next; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198430, "input": "void Compute(OpKernelContext* context) override { const Tensor& image = context->input(0); OP_REQUIRES(context, image.dims() == 3, errors::InvalidArgument(\"image must be 3-dimensional\", image.shape().DebugString())); OP_REQUIRES( context, FastBoundsCheck(image.NumElements(), std::numeric_limits::max()), errors::InvalidArgument(\"image cannot have >= int32 max elements\")); const int32 height = static_cast(image.dim_size(0)); const int32 width = static_cast(image.dim_size(1)); const int32 channels = static_cast(image.dim_size(2)); // In some cases, we pass width*channels*2 to png. const int32 max_row_width = std::numeric_limits::max() / 2; OP_REQUIRES(context, FastBoundsCheck(width * channels, max_row_width), errors::InvalidArgument(\"image too wide to encode\")); OP_REQUIRES(context, channels >= 1 && channels <= 4, errors::InvalidArgument( \"image must have 1, 2, 3, or 4 channels, got \", channels)); // Encode image to png string Tensor* output = nullptr; OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape({}), &output)); if (desired_channel_bits_ == 8) { OP_REQUIRES(context, png::WriteImageToBuffer( image.flat().data(), width, height, width * channels, channels, desired_channel_bits_, compression_, &output->scalar()(), nullptr), errors::Internal(\"PNG encoding failed\")); } else { OP_REQUIRES(context, png::WriteImageToBuffer( image.flat().data(), width, height, width * channels * 2, channels, desired_channel_bits_, compression_, &output->scalar()(), nullptr), errors::Internal(\"PNG encoding failed\")); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a `CHECK` fail in PNG encoding by providing an empty input tensor as the pixel data. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/e312e0791ce486a80c9d23110841525c6f7c3289/tensorflow/core/kernels/image/encode_png_op.cc#L57-L60) only validates that the total number of pixels in the image does not overflow. Thus, an attacker can send an empty matrix for encoding. However, if the tensor is empty, then the associated buffer is `nullptr`. Hence, when calling `png::WriteImageToBuffer`(https://github.com/tensorflow/tensorflow/blob/e312e0791ce486a80c9d23110841525c6f7c3289/tensorflow/core/kernels/image/encode_png_op.cc#L79-L93), the first argument (i.e., `image.flat().data()`) is `NULL`. This then triggers the `CHECK_NOTNULL` in the first line of `png::WriteImageToBuffer`(https://github.com/tensorflow/tensorflow/blob/e312e0791ce486a80c9d23110841525c6f7c3289/tensorflow/core/lib/png/png_io.cc#L345-L349). Since `image` is null, this results in `abort` being called after printing the stacktrace. Effectively, this allows an attacker to mount a denial of service attack. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29531"}} -{"idx": 281250, "input": "void RGWGetACLs_ObjStore_S3::send_response() { if (op_ret) set_req_state_err(s, op_ret); dump_errno(s); end_header(s, this, \"application/xml\"); dump_start(s); rgw_flush_formatter(s, s->formatter); dump_body(s, acls); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 482969, "input": "struct timing_generator *dcn20_timing_generator_create( struct dc_context *ctx, uint32_t instance) { struct optc *tgn10 = kzalloc(sizeof(struct optc), GFP_KERNEL); if (!tgn10) return NULL; tgn10->base.inst = instance; tgn10->base.ctx = ctx; tgn10->tg_regs = &tg_regs[instance]; tgn10->tg_shift = &tg_shift; tgn10->tg_mask = &tg_mask; dcn20_timing_generator_init(tgn10); return &tgn10->base; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 367055, "input": "size_t RemoteIo::read(byte* buf, size_t rcount) { assert(p_->isMalloced_); if (p_->eof_) return 0; p_->totalRead_ += (uint32_t)rcount; size_t allow = std::min(rcount, p_->size_ - p_->idx_); size_t lowBlock = p_->idx_ /p_->blockSize_; size_t highBlock = (p_->idx_ + allow)/p_->blockSize_; // connect to the remote machine & populate the blocks just in time. p_->populateBlocks(lowBlock, highBlock); byte* fakeData = (byte*) std::calloc(p_->blockSize_, sizeof(byte)); if (!fakeData) { throw Error(kerErrorMessage, \"Unable to allocate data\"); } size_t iBlock = lowBlock; size_t startPos = p_->idx_ - lowBlock*p_->blockSize_; size_t totalRead = 0; do { byte* data = p_->blocksMap_[iBlock++].getData(); if (data == nullptr) data = fakeData; size_t blockR = std::min(allow, p_->blockSize_ - startPos); std::memcpy(&buf[totalRead], &data[startPos], blockR); totalRead += blockR; startPos = 0; allow -= blockR; } while(allow); if (fakeData) std::free(fakeData); p_->idx_ += (long)totalRead; p_->eof_ = (p_->idx_ == p_->size_); return totalRead; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333128, "input": "repodata_add_stubkey(Repodata *data, Id keyname, Id keytype) { Repokey xkey; xkey.name = keyname; xkey.type = keytype; xkey.storage = KEY_STORAGE_INCORE; xkey.size = 0; repodata_key2id(data, &xkey, 1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370042, "input": "auto operator()(ExpressionContext* const expCtx, BSONElement bsonExpr, const VariablesParseState& vps) const { return ExpressionCompare::parse(expCtx, std::move(bsonExpr), vps, op); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333103, "input": "repodata_search_keyskip(Repodata *data, Id solvid, Id keyname, int flags, Id *keyskip, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata) { Id schema; Repokey *key; Id keyid, *kp, *keyp; unsigned char *dp, *ddp; int onekey = 0; int stop; KeyValue kv; Solvable *s; if (!maybe_load_repodata(data, keyname)) return; if ((flags & SEARCH_SUBSCHEMA) != 0) { flags ^= SEARCH_SUBSCHEMA; kv.parent = (KeyValue *)keyskip; keyskip = 0; schema = kv.parent->id; dp = (unsigned char *)kv.parent->str; } else { schema = 0; dp = solvid2data(data, solvid, &schema); if (!dp) return; kv.parent = 0; } s = solvid > 0 ? data->repo->pool->solvables + solvid : 0; keyp = data->schemadata + data->schemata[schema]; if (keyname) { /* search for a specific key */ for (kp = keyp; *kp; kp++) if (data->keys[*kp].name == keyname) break; if (!*kp) return; dp = forward_to_key(data, *kp, keyp, dp); if (!dp) return; keyp = kp; onekey = 1; } while ((keyid = *keyp++) != 0) { stop = 0; key = data->keys + keyid; ddp = get_data(data, key, &dp, *keyp && !onekey ? 1 : 0); if (keyskip && (key->name >= keyskip[0] || keyskip[3 + key->name] != keyskip[1] + data->repodataid)) { if (onekey) return; continue; } if (key->type == REPOKEY_TYPE_DELETED && !(flags & SEARCH_KEEP_TYPE_DELETED)) { if (onekey) return; continue; } if (key->type == REPOKEY_TYPE_FLEXARRAY || key->type == REPOKEY_TYPE_FIXARRAY) { kv.entry = -1; ddp = data_read_id(ddp, (Id *)&kv.num); kv.str = (const char *)ddp; stop = repodata_search_array(data, solvid, 0, flags, key, &kv, callback, cbdata); if (onekey || stop > SEARCH_NEXT_KEY) return; continue; } kv.entry = 0; do { ddp = data_fetch(ddp, &kv, key); if (!ddp) break; stop = callback(cbdata, s, data, key, &kv); kv.entry++; } while (!kv.eof && !stop); if (onekey || stop > SEARCH_NEXT_KEY) return; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 492322, "input": "lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, union futex_key *key, struct futex_pi_state **ps) { struct futex_pi_state *pi_state = NULL; struct futex_q *this, *next; struct plist_head *head; struct task_struct *p; pid_t pid = uval & FUTEX_TID_MASK; head = &hb->chain; plist_for_each_entry_safe(this, next, head, list) { if (match_futex(&this->key, key)) { /* * Another waiter already exists - bump up * the refcount and return its pi_state: */ pi_state = this->pi_state; /* * Userspace might have messed up non PI and PI futexes */ if (unlikely(!pi_state)) return -EINVAL; WARN_ON(!atomic_read(&pi_state->refcount)); WARN_ON(pid && pi_state->owner && pi_state->owner->pid != pid); atomic_inc(&pi_state->refcount); *ps = pi_state; return 0; } } /* * We are the first waiter - try to look up the real owner and attach * the new pi_state to it, but bail out when TID = 0 */ if (!pid) return -ESRCH; p = futex_find_get_task(pid); if (IS_ERR(p)) return PTR_ERR(p); /* * We need to look at the task state flags to figure out, * whether the task is exiting. To protect against the do_exit * change of the task flags, we do this protected by * p->pi_lock: */ raw_spin_lock_irq(&p->pi_lock); if (unlikely(p->flags & PF_EXITING)) { /* * The task is on the way out. When PF_EXITPIDONE is * set, we know that the task has finished the * cleanup: */ int ret = (p->flags & PF_EXITPIDONE) ? -ESRCH : -EAGAIN; raw_spin_unlock_irq(&p->pi_lock); put_task_struct(p); return ret; } pi_state = alloc_pi_state(); /* * Initialize the pi_mutex in locked state and make 'p' * the owner of it: */ rt_mutex_init_proxy_locked(&pi_state->pi_mutex, p); /* Store the key for possible exit cleanups: */ pi_state->key = *key; WARN_ON(!list_empty(&pi_state->list)); list_add(&pi_state->list, &p->pi_state_list); pi_state->owner = p; raw_spin_unlock_irq(&p->pi_lock); put_task_struct(p); *ps = pi_state; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462441, "input": "static inline int dw_spi_debugfs_init(struct dw_spi *dws) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 424305, "input": "static MagickBooleanType WritePICONImage(const ImageInfo *image_info, Image *image) { #define ColormapExtent 155 #define GraymapExtent 95 #define PiconGeometry \"48x48>\" static unsigned char Colormap[]= { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x06, 0x00, 0x05, 0x00, 0xf4, 0x05, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x4f, 0x4f, 0x70, 0x80, 0x90, 0x7e, 0x7e, 0x7e, 0xdc, 0xdc, 0xdc, 0xff, 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0xff, 0x1e, 0x90, 0xff, 0x87, 0xce, 0xeb, 0xe6, 0xe6, 0xfa, 0x00, 0xff, 0xff, 0x80, 0x00, 0x80, 0xb2, 0x22, 0x22, 0x2e, 0x8b, 0x57, 0x32, 0xcd, 0x32, 0x00, 0xff, 0x00, 0x98, 0xfb, 0x98, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x63, 0x47, 0xff, 0xa5, 0x00, 0xff, 0xd7, 0x00, 0xff, 0xff, 0x00, 0xee, 0x82, 0xee, 0xa0, 0x52, 0x2d, 0xcd, 0x85, 0x3f, 0xd2, 0xb4, 0x8c, 0xf5, 0xde, 0xb3, 0xff, 0xfa, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xf9, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x05, 0x18, 0x20, 0x10, 0x08, 0x03, 0x51, 0x18, 0x07, 0x92, 0x28, 0x0b, 0xd3, 0x38, 0x0f, 0x14, 0x49, 0x13, 0x55, 0x59, 0x17, 0x96, 0x69, 0x1b, 0xd7, 0x85, 0x00, 0x3b, }, Graymap[]= { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x04, 0x00, 0x04, 0x00, 0xf3, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x12, 0x21, 0x21, 0x21, 0x33, 0x33, 0x33, 0x45, 0x45, 0x45, 0x54, 0x54, 0x54, 0x66, 0x66, 0x66, 0x78, 0x78, 0x78, 0x87, 0x87, 0x87, 0x99, 0x99, 0x99, 0xab, 0xab, 0xab, 0xba, 0xba, 0xba, 0xcc, 0xcc, 0xcc, 0xde, 0xde, 0xde, 0xed, 0xed, 0xed, 0xff, 0xff, 0xff, 0x21, 0xf9, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x04, 0x0c, 0x10, 0x04, 0x31, 0x48, 0x31, 0x07, 0x25, 0xb5, 0x58, 0x73, 0x4f, 0x04, 0x00, 0x3b, }; #define MaxCixels 92 static const char Cixel[MaxCixels+1] = \" .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjk\" \"lzxcvbnmMNBVCZASDFGHJKLPIUYTREWQ!~^/()_`'][{}|\"; char buffer[MaxTextExtent], basename[MaxTextExtent], name[MaxTextExtent], symbol[MaxTextExtent]; ExceptionInfo *exception; Image *affinity_image, *picon; ImageInfo *blob_info; MagickBooleanType status, transparent; MagickPixelPacket pixel; QuantizeInfo *quantize_info; RectangleInfo geometry; register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t i, x; register PixelPacket *q; size_t characters_per_pixel, colors; ssize_t j, k, y; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); if (status == MagickFalse) return(status); (void) TransformImageColorspace(image,sRGBColorspace); SetGeometry(image,&geometry); (void) ParseMetaGeometry(PiconGeometry,&geometry.x,&geometry.y, &geometry.width,&geometry.height); picon=ResizeImage(image,geometry.width,geometry.height,TriangleFilter,1.0, &image->exception); blob_info=CloneImageInfo(image_info); (void) AcquireUniqueFilename(blob_info->filename); if ((image_info->type != TrueColorType) && (SetImageGray(image,&image->exception) != MagickFalse)) affinity_image=BlobToImage(blob_info,Graymap,GraymapExtent, &image->exception); else affinity_image=BlobToImage(blob_info,Colormap,ColormapExtent, &image->exception); (void) RelinquishUniqueFileResource(blob_info->filename); blob_info=DestroyImageInfo(blob_info); if ((picon == (Image *) NULL) || (affinity_image == (Image *) NULL)) { if (affinity_image != (Image *) NULL) affinity_image=DestroyImage(affinity_image); if (picon != (Image *) NULL) picon=DestroyImage(picon); return(MagickFalse); } quantize_info=AcquireQuantizeInfo(image_info); status=RemapImage(quantize_info,picon,affinity_image); quantize_info=DestroyQuantizeInfo(quantize_info); affinity_image=DestroyImage(affinity_image); transparent=MagickFalse; exception=(&image->exception); if (picon->storage_class == PseudoClass) { (void) CompressImageColormap(picon); if (picon->matte != MagickFalse) transparent=MagickTrue; } else { /* Convert DirectClass to PseudoClass picon. */ if (picon->matte != MagickFalse) { /* Map all the transparent pixels. */ for (y=0; y < (ssize_t) picon->rows; y++) { q=GetAuthenticPixels(picon,0,y,picon->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) picon->columns; x++) { if (q->opacity == (Quantum) TransparentOpacity) transparent=MagickTrue; else SetPixelOpacity(q,OpaqueOpacity); q++; } if (SyncAuthenticPixels(picon,exception) == MagickFalse) break; } } (void) SetImageType(picon,PaletteType); } colors=picon->colors; if (transparent != MagickFalse) { register IndexPacket *indexes; colors++; picon->colormap=(PixelPacket *) ResizeQuantumMemory((void **) picon->colormap,(size_t) colors,sizeof(*picon->colormap)); if (picon->colormap == (PixelPacket *) NULL) ThrowWriterException(ResourceLimitError,\"MemoryAllocationError\"); picon->colormap[colors-1].red=0; picon->colormap[colors-1].green=0; picon->colormap[colors-1].blue=0; picon->colormap[colors-1].opacity=TransparentOpacity; for (y=0; y < (ssize_t) picon->rows; y++) { q=GetAuthenticPixels(picon,0,y,picon->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(picon); for (x=0; x < (ssize_t) picon->columns; x++) { if (q->opacity == (Quantum) TransparentOpacity) SetPixelIndex(indexes+x,picon->colors); q++; } if (SyncAuthenticPixels(picon,exception) == MagickFalse) break; } } /* Compute the character per pixel. */ characters_per_pixel=1; for (k=MaxCixels; (ssize_t) colors > k; k*=MaxCixels) characters_per_pixel++; /* XPM header. */ (void) WriteBlobString(image,\"/* XPM */\\n\"); GetPathComponent(picon->filename,BasePath,basename); (void) FormatLocaleString(buffer,MaxTextExtent, \"static char *%.1024s[] = {\\n\",basename); (void) WriteBlobString(image,buffer); (void) WriteBlobString(image,\"/* columns rows colors chars-per-pixel */\\n\"); (void) FormatLocaleString(buffer,MaxTextExtent, \"\\\"%.20g %.20g %.20g %.20g\\\",\\n\",(double) picon->columns,(double) picon->rows,(double) colors,(double) characters_per_pixel); (void) WriteBlobString(image,buffer); GetMagickPixelPacket(image,&pixel); for (i=0; i < (ssize_t) colors; i++) { const char *symbolic; /* Define XPM color. */ SetMagickPixelPacket(image,picon->colormap+i,(IndexPacket *) NULL,&pixel); pixel.colorspace=sRGBColorspace; pixel.depth=8; pixel.opacity=(MagickRealType) OpaqueOpacity; (void) QueryMagickColorname(image,&pixel,XPMCompliance,name, &image->exception); if (transparent != MagickFalse) { if (i == (ssize_t) (colors-1)) (void) CopyMagickString(name,\"grey75\",MaxTextExtent); } /* Write XPM color. */ k=i % MaxCixels; symbol[0]=Cixel[k]; for (j=1; j < (ssize_t) characters_per_pixel; j++) { k=((i-k)/MaxCixels) % MaxCixels; symbol[j]=Cixel[k]; } symbol[j]='\\0'; symbolic=(const char *) GetValueFromSplayTree(xpm_symbolic,name); if (symbolic == (const char *) NULL) (void) FormatLocaleString(buffer,MaxTextExtent,\"\\\"%.1024s c %.1024s\\\",\\n\", symbol,name); else (void) FormatLocaleString(buffer,MaxTextExtent, \"\\\"%.1024s c %.1024s %.1024s\\\",\\n\",symbol,name,symbolic); (void) WriteBlobString(image,buffer); } /* Define XPM pixels. */ (void) WriteBlobString(image,\"/* pixels */\\n\"); for (y=0; y < (ssize_t) picon->rows; y++) { p=GetVirtualPixels(picon,0,y,picon->columns,1,&picon->exception); if (p == (const PixelPacket *) NULL) break; indexes=GetVirtualIndexQueue(picon); (void) WriteBlobString(image,\"\\\"\"); for (x=0; x < (ssize_t) picon->columns; x++) { k=((ssize_t) GetPixelIndex(indexes+x) % MaxCixels); symbol[0]=Cixel[k]; for (j=1; j < (ssize_t) characters_per_pixel; j++) { k=(((int) GetPixelIndex(indexes+x)-k)/MaxCixels) % MaxCixels; symbol[j]=Cixel[k]; } symbol[j]='\\0'; (void) CopyMagickString(buffer,symbol,MaxTextExtent); (void) WriteBlobString(image,buffer); } (void) FormatLocaleString(buffer,MaxTextExtent,\"\\\"%.1024s\\n\", y == (ssize_t) (picon->rows-1) ? \"\" : \",\"); (void) WriteBlobString(image,buffer); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, picon->rows); if (status == MagickFalse) break; } picon=DestroyImage(picon); (void) WriteBlobString(image,\"};\\n\"); (void) CloseBlob(image); return(MagickTrue); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 217248, "input": "int PasswdMgr::updatePasswdSpecialFile(const std::string& userName, const std::string& newUserName) { phosphor::user::shadow::Lock lock(); size_t bytesWritten = 0; size_t inBytesLen = 0; size_t isUsrFound = false; const EVP_CIPHER* cipher = EVP_aes_128_cbc(); std::vector dataBuf; // Read the encrypted file and get the file data // Check user existance and return if not exist. if (readPasswdFileData(dataBuf) != 0) { log(\"Error in reading the encrypted pass file\"); return -EIO; } if (dataBuf.size() != 0) { inBytesLen = dataBuf.size() + newUserName.size() + EVP_CIPHER_block_size(cipher); } std::vector inBytes(inBytesLen); if (inBytesLen != 0) { char* outPtr = reinterpret_cast(dataBuf.data()); char* nToken = NULL; char* linePtr = strtok_r(outPtr, \"\\n\", &nToken); while (linePtr != NULL) { size_t userEPos = 0; std::string lineStr(linePtr); if ((userEPos = lineStr.find(\":\")) != std::string::npos) { if (userName.compare(lineStr.substr(0, userEPos)) == 0) { isUsrFound = true; if (!newUserName.empty()) { bytesWritten += std::snprintf( reinterpret_cast(&inBytes[0]) + bytesWritten, (inBytesLen - bytesWritten), \"%s%s\\n\", newUserName.c_str(), lineStr.substr(userEPos, lineStr.size()).data()); } } else { bytesWritten += std::snprintf( reinterpret_cast(&inBytes[0]) + bytesWritten, (inBytesLen - bytesWritten), \"%s\\n\", lineStr.data()); } } linePtr = strtok_r(NULL, \"\\n\", &nToken); } inBytesLen = bytesWritten; } if (!isUsrFound) { log(\"User doesn't exist\"); return 0; } // Read the key buff from key file std::array keyBuff; std::ifstream keyFile(encryptKeyFileName, std::ios::in | std::ios::binary); if (!keyFile.good()) { log(\"Error in opening encryption key file\"); return -EIO; } keyFile.read(reinterpret_cast(keyBuff.data()), keyBuff.size()); if (keyFile.fail()) { log(\"Error in reading encryption key file\"); return -EIO; } keyFile.close(); // Read the original passwd file mode struct stat st = {}; if (stat(passwdFileName, &st) != 0) { log(\"Error in getting password file fstat()\"); return -EIO; } // Create temporary file for write std::string pwdFile(passwdFileName); std::vector tempFileName(pwdFile.begin(), pwdFile.end()); std::vector fileTemplate = {'_', '_', 'X', 'X', 'X', 'X', 'X', 'X', '\\0'}; tempFileName.insert(tempFileName.end(), fileTemplate.begin(), fileTemplate.end()); int fd = mkstemp((char*)tempFileName.data()); if (fd == -1) { log(\"Error creating temp file\"); return -EIO; } std::string strTempFileName(tempFileName.data()); // Open the temp file for writing from provided fd // By \"true\", remove it at exit if still there. // This is needed to cleanup the temp file at exception phosphor::user::File temp(fd, strTempFileName, \"w\", true); if ((temp)() == NULL) { close(fd); log(\"Error creating temp file\"); return -EIO; } // Set the file mode as of actual ipmi-pass file. if (fchmod(fileno((temp)()), st.st_mode) < 0) { log(\"Error setting fchmod for temp file\"); return -EIO; } const EVP_MD* digest = EVP_sha256(); size_t hashLen = EVP_MD_block_size(digest); std::vector hash(hashLen); size_t ivLen = EVP_CIPHER_iv_length(cipher); std::vector iv(ivLen); std::array key; size_t keyLen = key.size(); std::array mac; size_t macLen = mac.size(); // Create random hash and generate hash key which will be used for // encryption. if (RAND_bytes(hash.data(), hashLen) != 1) { log(\"Hash genertion failed, bailing out\"); return -EIO; } if (NULL == HMAC(digest, keyBuff.data(), keyBuff.size(), hash.data(), hashLen, key.data(), reinterpret_cast(&keyLen))) { log(\"Failed to create MAC for authentication\"); return -EIO; } // Generate IV values if (RAND_bytes(iv.data(), ivLen) != 1) { log(\"UV genertion failed, bailing out\"); return -EIO; } // Encrypt the input data std::vector outBytes(inBytesLen + EVP_MAX_BLOCK_LENGTH); size_t outBytesLen = 0; if (inBytesLen != 0) { if (encryptDecryptData(true, EVP_aes_128_cbc(), key.data(), keyLen, iv.data(), ivLen, inBytes.data(), inBytesLen, mac.data(), &macLen, outBytes.data(), &outBytesLen) != 0) { log(\"Error while encrypting the data\"); return -EIO; } outBytes[outBytesLen] = 0; } OPENSSL_cleanse(key.data(), keyLen); // Update the meta password structure. MetaPassStruct metaData = {META_PASSWD_SIG, {0, 0}, 0, 0, 0, 0, 0}; metaData.hashSize = hashLen; metaData.ivSize = ivLen; metaData.dataSize = bytesWritten; metaData.padSize = outBytesLen - bytesWritten; metaData.macSize = macLen; if (fwrite(&metaData, 1, sizeof(metaData), (temp)()) != sizeof(metaData)) { log(\"Error in writing meta data\"); return -EIO; } if (fwrite(&hash[0], 1, hashLen, (temp)()) != hashLen) { log(\"Error in writing hash data\"); return -EIO; } if (fwrite(&iv[0], 1, ivLen, (temp)()) != ivLen) { log(\"Error in writing IV data\"); return -EIO; } if (fwrite(&outBytes[0], 1, outBytesLen, (temp)()) != outBytesLen) { log(\"Error in writing encrypted data\"); return -EIO; } if (fwrite(&mac[0], 1, macLen, (temp)()) != macLen) { log(\"Error in writing MAC data\"); return -EIO; } if (fflush((temp)())) { log( \"File fflush error while writing entries to special file\"); return -EIO; } OPENSSL_cleanse(iv.data(), ivLen); // Rename the tmp file to actual file if (std::rename(strTempFileName.data(), passwdFileName) != 0) { log(\"Failed to rename tmp file to ipmi-pass\"); return -EIO; } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Incorrect Default Permissions"], "explanation": "user_channel/passwd_mgr.cpp in OpenBMC phosphor-host-ipmid before 2020-04-03 does not ensure that /etc/ipmi-pass has strong file permissions.", "severity_level": "NoInfo", "cwe": "CWE-276", "cve": "CVE-2020-14156"}} -{"idx": 384472, "input": "*iwl_dump_ini_mon_fill_header(struct iwl_fw_runtime *fwrt, struct iwl_fw_ini_region_cfg *reg, struct iwl_fw_ini_monitor_dump *data, u32 write_ptr_addr, u32 write_ptr_msk, u32 cycle_cnt_addr, u32 cycle_cnt_msk) { u32 write_ptr, cycle_cnt; unsigned long flags; if (!iwl_trans_grab_nic_access(fwrt->trans, &flags)) { IWL_ERR(fwrt, \"Failed to get monitor header\\n\"); return NULL; } write_ptr = iwl_read_prph_no_grab(fwrt->trans, write_ptr_addr); cycle_cnt = iwl_read_prph_no_grab(fwrt->trans, cycle_cnt_addr); iwl_trans_release_nic_access(fwrt->trans, &flags); data->header.version = cpu_to_le32(IWL_INI_DUMP_VER); data->write_ptr = cpu_to_le32(write_ptr & write_ptr_msk); data->cycle_cnt = cpu_to_le32(cycle_cnt & cycle_cnt_msk); return data->ranges; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462780, "input": "LUA_API int lua_setcstacklimit (lua_State *L, unsigned int limit) { global_State *g = G(L); int ccalls; luaE_freeCI(L); /* release unused CIs */ ccalls = getCcalls(L); if (limit >= 40000) return 0; /* out of bounds */ limit += CSTACKERR; if (L != g-> mainthread) return 0; /* only main thread can change the C stack */ else if (ccalls <= CSTACKERR) return 0; /* handling overflow */ else { int diff = limit - g->Cstacklimit; if (ccalls + diff <= CSTACKERR) return 0; /* new limit would cause an overflow */ g->Cstacklimit = limit; /* set new limit */ L->nCcalls += diff; /* correct 'nCcalls' */ return limit - diff - CSTACKERR; /* success; return previous limit */ } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197613, "input": "ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { int klinux_flags = TokLinuxRecvSendFlag(flags); if (klinux_flags == 0 && flags != 0) { errno = EINVAL; return -1; } MessageWriter input; input.Push(sockfd); input.Push(len); input.Push(klinux_flags); MessageReader output; const auto status = NonSystemCallDispatcher( ::asylo::host_call::kRecvFromHandler, &input, &output); CheckStatusAndParamCount(status, output, \"enc_untrusted_recvfrom\", 4); int result = output.next(); int klinux_errno = output.next(); // recvfrom() returns -1 on failure, with errno set to indicate the cause // of the error. if (result == -1) { errno = FromkLinuxErrorNumber(klinux_errno); return result; } auto buffer_received = output.next(); memcpy(buf, buffer_received.data(), std::min(len, buffer_received.size())); // If |src_addr| is not NULL, and the underlying protocol provides the source // address, this source address is filled in. When |src_addr| is NULL, nothing // is filled in; in this case, |addrlen| is not used, and should also be NULL. if (src_addr != nullptr && addrlen != nullptr) { auto klinux_sockaddr_buf = output.next(); const struct klinux_sockaddr *klinux_addr = klinux_sockaddr_buf.As(); FromkLinuxSockAddr(klinux_addr, klinux_sockaddr_buf.size(), src_addr, addrlen, TrustedPrimitives::BestEffortAbort); } return result; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "An arbitrary memory read vulnerability in Asylo versions up to 0.6.0 allows an untrusted attacker to make a call to enc_untrusted_recvfrom whose return size was not validated against the requested size. The parameter size is unchecked allowing the attacker to read memory locations outside of the intended buffer size including memory addresses within the secure enclave. We recommend upgrading past commit 6e158d558abd3c29a0208e30c97c9a8c5bd4230f", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-8943"}} -{"idx": 400918, "input": "void rfbClientCleanup(rfbClient* client) { #ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBJPEG int i; for ( i = 0; i < 4; i++ ) { if (client->zlibStreamActive[i] == TRUE ) { if (inflateEnd (&client->zlibStream[i]) != Z_OK && client->zlibStream[i].msg != NULL) rfbClientLog(\"inflateEnd: %s\\n\", client->zlibStream[i].msg); } } if ( client->decompStreamInited == TRUE ) { if (inflateEnd (&client->decompStream) != Z_OK && client->decompStream.msg != NULL) rfbClientLog(\"inflateEnd: %s\\n\", client->decompStream.msg ); } #endif #endif if (client->ultra_buffer) free(client->ultra_buffer); if (client->raw_buffer) free(client->raw_buffer); FreeTLS(client); while (client->clientData) { rfbClientData* next = client->clientData->next; free(client->clientData); client->clientData = next; } if (client->sock != RFB_INVALID_SOCKET) rfbCloseSocket(client->sock); if (client->listenSock != RFB_INVALID_SOCKET) rfbCloseSocket(client->listenSock); free(client->desktopName); free(client->serverHost); if (client->destHost) free(client->destHost); if (client->clientAuthSchemes) free(client->clientAuthSchemes); #ifdef LIBVNCSERVER_HAVE_SASL if (client->saslSecret) free(client->saslSecret); #endif /* LIBVNCSERVER_HAVE_SASL */ #ifdef WIN32 if(WSACleanup() != 0) { errno=WSAGetLastError(); rfbClientErr(\"Could not terminate Windows Sockets: %s\\n\", strerror(errno)); } #endif free(client); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280270, "input": "static void init_kmem_cache_cpus(struct kmem_cache *s) { int cpu; for_each_possible_cpu(cpu) per_cpu_ptr(s->cpu_slab, cpu)->tid = init_tid(cpu); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410748, "input": "static inline struct sk_buff *tcp_send_head(const struct sock *sk) { return sk->sk_send_head; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207463, "input": "ipmi_get_session_info(struct ipmi_intf * intf, Ipmi_Session_Request_Type session_request_type, uint32_t id_or_handle) { int i, retval = 0; struct ipmi_rs * rsp; struct ipmi_rq req; uint8_t rqdata[5]; // max length of the variable length request struct get_session_info_rsp session_info; memset(&req, 0, sizeof(req)); memset(&session_info, 0, sizeof(session_info)); req.msg.netfn = IPMI_NETFN_APP; // 0x06 req.msg.cmd = IPMI_GET_SESSION_INFO; // 0x3D req.msg.data = rqdata; switch (session_request_type) { case IPMI_SESSION_REQUEST_CURRENT: case IPMI_SESSION_REQUEST_BY_ID: case IPMI_SESSION_REQUEST_BY_HANDLE: switch (session_request_type) { case IPMI_SESSION_REQUEST_CURRENT: rqdata[0] = 0x00; req.msg.data_len = 1; break; case IPMI_SESSION_REQUEST_BY_ID: rqdata[0] = 0xFF; rqdata[1] = id_or_handle & 0x000000FF; rqdata[2] = (id_or_handle >> 8) & 0x000000FF; rqdata[3] = (id_or_handle >> 16) & 0x000000FF; rqdata[4] = (id_or_handle >> 24) & 0x000000FF; req.msg.data_len = 5; break; case IPMI_SESSION_REQUEST_BY_HANDLE: rqdata[0] = 0xFE; rqdata[1] = (uint8_t)id_or_handle; req.msg.data_len = 2; break; case IPMI_SESSION_REQUEST_ALL: break; } rsp = intf->sendrecv(intf, &req); if (!rsp) { lprintf(LOG_ERR, \"Get Session Info command failed\"); retval = -1; } else if (rsp->ccode) { lprintf(LOG_ERR, \"Get Session Info command failed: %s\", val2str(rsp->ccode, completion_code_vals)); retval = -1; } if (retval < 0) { if ((session_request_type == IPMI_SESSION_REQUEST_CURRENT) && (strncmp(intf->name, \"lan\", 3) != 0)) lprintf(LOG_ERR, \"It is likely that the channel in use \" \"does not support sessions\"); } else { memcpy(&session_info, rsp->data, rsp->data_len); print_session_info(&session_info, rsp->data_len); } break; case IPMI_SESSION_REQUEST_ALL: req.msg.data_len = 1; i = 1; do { rqdata[0] = i++; rsp = intf->sendrecv(intf, &req); if (!rsp) { lprintf(LOG_ERR, \"Get Session Info command failed\"); retval = -1; break; } else if (rsp->ccode && rsp->ccode != 0xCC && rsp->ccode != 0xCB) { lprintf(LOG_ERR, \"Get Session Info command failed: %s\", val2str(rsp->ccode, completion_code_vals)); retval = -1; break; } else if (rsp->data_len < 3) { retval = -1; break; } memcpy(&session_info, rsp->data, rsp->data_len); print_session_info(&session_info, rsp->data_len); } while (i <= session_info.session_slot_count); break; } return retval; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')"], "explanation": "It's been found that multiple functions in ipmitool before 1.8.19 neglect proper checking of the data received from a remote LAN party, which may lead to buffer overflows and potentially to remote code execution on the ipmitool side. This is especially dangerous if ipmitool is run as a privileged user. This problem is fixed in version 1.8.19.", "severity_level": "NoInfo", "cwe": "CWE-120", "cve": "CVE-2020-5208"}} -{"idx": 385238, "input": "check_follow_fragments(follow_info_t *follow_info, gboolean is_server, guint32 acknowledged, guint32 packet_num) { GList *fragment_entry; follow_record_t *fragment, *follow_record; guint32 lowest_seq = 0; gchar *dummy_str; fragment_entry = g_list_first(follow_info->fragments[is_server]); if (fragment_entry == NULL) return FALSE; fragment = (follow_record_t*)fragment_entry->data; lowest_seq = fragment->seq; for (; fragment_entry != NULL; fragment_entry = g_list_next(fragment_entry)) { fragment = (follow_record_t*)fragment_entry->data; if( GT_SEQ(lowest_seq, fragment->seq) ) { lowest_seq = fragment->seq; } if( LT_SEQ(fragment->seq, follow_info->seq[is_server]) ) { guint32 newseq; /* this sequence number seems dated, but check the end to make sure it has no more info than we have already seen */ newseq = fragment->seq + fragment->data->len; if( GT_SEQ(newseq, follow_info->seq[is_server]) ) { guint32 new_pos; /* this one has more than we have seen. let's get the payload that we have not seen. This happens when part of this frame has been retransmitted */ new_pos = follow_info->seq[is_server] - fragment->seq; if ( fragment->data->len > new_pos ) { guint32 new_frag_size = fragment->data->len - new_pos; follow_record = g_new0(follow_record_t,1); follow_record->is_server = is_server; follow_record->packet_num = fragment->packet_num; follow_record->seq = follow_info->seq[is_server] + new_frag_size; follow_record->data = g_byte_array_append(g_byte_array_new(), fragment->data->data + new_pos, new_frag_size); follow_info->payload = g_list_prepend(follow_info->payload, follow_record); } follow_info->seq[is_server] += (fragment->data->len - new_pos); } /* Remove the fragment from the list as the \"new\" part of it * has been processed or its data has been seen already in * another packet. */ g_byte_array_free(fragment->data, TRUE); g_free(fragment); follow_info->fragments[is_server] = g_list_delete_link(follow_info->fragments[is_server], fragment_entry); return TRUE; } if( EQ_SEQ(fragment->seq, follow_info->seq[is_server]) ) { /* this fragment fits the stream */ if( fragment->data->len > 0 ) { follow_info->payload = g_list_prepend(follow_info->payload, fragment); } follow_info->seq[is_server] += fragment->data->len; follow_info->fragments[is_server] = g_list_delete_link(follow_info->fragments[is_server], fragment_entry); return TRUE; } } if( GT_SEQ(acknowledged, lowest_seq) ) { /* There are frames missing in the capture file that were seen * by the receiving host. Add dummy stream chunk with the data * \"[xxx bytes missing in capture file]\". */ dummy_str = g_strdup_printf(\"[%d bytes missing in capture file]\", (int)(lowest_seq - follow_info->seq[is_server]) ); // XXX the dummy replacement could be larger than the actual missing bytes. follow_record = g_new0(follow_record_t,1); follow_record->data = g_byte_array_append(g_byte_array_new(), dummy_str, (guint)strlen(dummy_str)+1); g_free(dummy_str); follow_record->is_server = is_server; follow_record->packet_num = packet_num; follow_record->seq = lowest_seq; follow_info->seq[is_server] = lowest_seq; follow_info->payload = g_list_prepend(follow_info->payload, follow_record); return TRUE; } return FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 408527, "input": "static void msf2_emac_init(Object *obj) { MSF2EmacState *s = MSS_EMAC(obj); sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); memory_region_init_io(&s->mmio, obj, &emac_ops, s, \"msf2-emac\", R_MAX * 4); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417946, "input": "static void SFDGetHintMask(FILE *sfd,HintMask *hintmask) { int nibble = 0, ch; memset(hintmask,0,sizeof(HintMask)); for (;;) { ch = nlgetc(sfd); if ( isdigit(ch)) ch -= '0'; else if ( ch>='a' && ch<='f' ) ch -= 'a'-10; else if ( ch>='A' && ch<='F' ) ch -= 'A'-10; else { ungetc(ch,sfd); break; } if ( nibble<2*HntMax/8 ) (*hintmask)[nibble>>1] |= ch<<(4*(1-(nibble&1))); ++nibble; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 451255, "input": "static int ext4_find_delete_entry(handle_t *handle, struct inode *dir, const struct qstr *d_name) { int retval = -ENOENT; struct buffer_head *bh; struct ext4_dir_entry_2 *de; bh = ext4_find_entry(dir, d_name, &de, NULL); if (IS_ERR(bh)) return PTR_ERR(bh); if (bh) { retval = ext4_delete_entry(handle, dir, de, bh); brelse(bh); } return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445591, "input": "ftrace_snapshot(unsigned long ip, unsigned long parent_ip, struct trace_array *tr, struct ftrace_probe_ops *ops, void *data) { tracing_snapshot_instance(tr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219238, "input": "const HtmlBasicEntity* get_basic_table(bool all, entity_doctype doctype) { if (doctype == entity_doctype::xhtml) { return all ? basic_entities_noapos : basic_entities_apos; } if (doctype == entity_doctype::html401) { return basic_entities_noapos; } return basic_entities_apos; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354700, "input": "static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) { return -ENOSYS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 374508, "input": "vmod_append(VRT_CTX, VCL_HEADER hdr, VCL_STRANDS s) { struct http *hp; struct strands st[1]; const char *p[s->n + 2]; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); /* prefix the strand with $hdr_name + space */ p[0] = hdr->what + 1; p[1] = \" \"; AN(memcpy(p + 2, s->p, s->n * sizeof *s->p)); st->n = s->n + 2; st->p = p; b = VRT_StrandsWS(ctx->ws, NULL, st); if (b == NULL) { VRT_fail(ctx, \"vmod_header: workspace allocation failure\"); return; } hp = VRT_selecthttp(ctx, hdr->where); http_SetHeader(hp, b); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402160, "input": "static inline uint8_t *bcf_unpack_info_core1(uint8_t *ptr, bcf_info_t *info) { uint8_t *ptr_start = ptr; info->key = bcf_dec_typed_int1(ptr, &ptr); info->len = bcf_dec_size(ptr, &ptr, &info->type); info->vptr = ptr; info->vptr_off = ptr - ptr_start; info->vptr_free = 0; info->v1.i = 0; if (info->len == 1) { if (info->type == BCF_BT_INT8 || info->type == BCF_BT_CHAR) info->v1.i = *(int8_t*)ptr; else if (info->type == BCF_BT_INT32) info->v1.i = le_to_i32(ptr); else if (info->type == BCF_BT_FLOAT) info->v1.f = le_to_float(ptr); else if (info->type == BCF_BT_INT16) info->v1.i = le_to_i16(ptr); else if (info->type == BCF_BT_INT64) info->v1.i = le_to_i64(ptr); } ptr += info->len << bcf_type_shift[info->type]; info->vptr_len = ptr - info->vptr; return ptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269793, "input": "void WebContents::PostMessage(const std::string& channel, v8::Local message_value, base::Optional> transfer) { blink::TransferableMessage transferable_message; if (!electron::SerializeV8Value(isolate(), message_value, &transferable_message)) { // SerializeV8Value sets an exception. return; } std::vector> wrapped_ports; if (transfer) { if (!gin::ConvertFromV8(isolate(), *transfer, &wrapped_ports)) { isolate()->ThrowException(v8::Exception::Error( gin::StringToV8(isolate(), \"Invalid value for transfer\"))); return; } } bool threw_exception = false; transferable_message.ports = MessagePort::DisentanglePorts(isolate(), wrapped_ports, &threw_exception); if (threw_exception) return; content::RenderFrameHost* frame_host = web_contents()->GetMainFrame(); mojo::AssociatedRemote electron_renderer; frame_host->GetRemoteAssociatedInterfaces()->GetInterface(&electron_renderer); electron_renderer->ReceivePostMessage(channel, std::move(transferable_message)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409906, "input": "static inline int tcp_packet_delayed(const struct tcp_sock *tp) { return !tp->retrans_stamp || (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && before(tp->rx_opt.rcv_tsecr, tp->retrans_stamp)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445699, "input": "int trace_find_tgid(int pid) { if (unlikely(!tgid_map || !pid || pid > PID_MAX_DEFAULT)) return 0; return tgid_map[pid]; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499721, "input": "field_width_error (const char *filename, const char *fieldname, uintmax_t value, size_t width, bool nul) { char valbuf[UINTMAX_STRSIZE_BOUND + 1]; char maxbuf[UINTMAX_STRSIZE_BOUND + 1]; error (0, 0, _(\"%s: value %s %s out of allowed range 0..%s\"), filename, fieldname, STRINGIFY_BIGINT (value, valbuf), STRINGIFY_BIGINT (MAX_VAL_WITH_DIGITS (width - nul, LG_8), maxbuf)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269725, "input": "base::string16 GetDefaultPrinterAsync() { base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); scoped_refptr backend = printing::PrintBackend::CreateInstance( nullptr, g_browser_process->GetApplicationLocale()); std::string printer_name = backend->GetDefaultPrinterName(); return base::UTF8ToUTF16(printer_name); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 302857, "input": "xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { const xmlChar *name = NULL; xmlChar *value = NULL; xmlChar *URI = NULL, *literal = NULL; const xmlChar *ndata = NULL; int isParameter = 0; xmlChar *orig = NULL; int skipped; /* GROW; done in the caller */ if (CMP8(CUR_PTR, '<', '!', 'E', 'N', 'T', 'I', 'T', 'Y')) { xmlParserInputPtr input = ctxt->input; SHRINK; SKIP(8); skipped = SKIP_BLANKS; if (skipped == 0) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, \"Space required after 'instate = XML_PARSER_ENTITY_DECL; /* * handle the various case of definitions... */ if (isParameter) { if ((RAW == '\"') || (RAW == '\\'')) { value = xmlParseEntityValue(ctxt, &orig); if (value) { if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) ctxt->sax->entityDecl(ctxt->userData, name, XML_INTERNAL_PARAMETER_ENTITY, NULL, NULL, value); } } else { URI = xmlParseExternalID(ctxt, &literal, 1); if ((URI == NULL) && (literal == NULL)) { xmlFatalErr(ctxt, XML_ERR_VALUE_REQUIRED, NULL); } if (URI) { xmlURIPtr uri; uri = xmlParseURI((const char *) URI); if (uri == NULL) { xmlErrMsgStr(ctxt, XML_ERR_INVALID_URI, \"Invalid URI: %s\\n\", URI); /* * This really ought to be a well formedness error * but the XML Core WG decided otherwise c.f. issue * E26 of the XML erratas. */ } else { if (uri->fragment != NULL) { /* * Okay this is foolish to block those but not * invalid URIs. */ xmlFatalErr(ctxt, XML_ERR_URI_FRAGMENT, NULL); } else { if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) ctxt->sax->entityDecl(ctxt->userData, name, XML_EXTERNAL_PARAMETER_ENTITY, literal, URI, NULL); } xmlFreeURI(uri); } } } } else { if ((RAW == '\"') || (RAW == '\\'')) { value = xmlParseEntityValue(ctxt, &orig); if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) ctxt->sax->entityDecl(ctxt->userData, name, XML_INTERNAL_GENERAL_ENTITY, NULL, NULL, value); /* * For expat compatibility in SAX mode. */ if ((ctxt->myDoc == NULL) || (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) { if (ctxt->myDoc == NULL) { ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE); if (ctxt->myDoc == NULL) { xmlErrMemory(ctxt, \"New Doc failed\"); return; } ctxt->myDoc->properties = XML_DOC_INTERNAL; } if (ctxt->myDoc->intSubset == NULL) ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST \"fake\", NULL, NULL); xmlSAX2EntityDecl(ctxt, name, XML_INTERNAL_GENERAL_ENTITY, NULL, NULL, value); } } else { URI = xmlParseExternalID(ctxt, &literal, 1); if ((URI == NULL) && (literal == NULL)) { xmlFatalErr(ctxt, XML_ERR_VALUE_REQUIRED, NULL); } if (URI) { xmlURIPtr uri; uri = xmlParseURI((const char *)URI); if (uri == NULL) { xmlErrMsgStr(ctxt, XML_ERR_INVALID_URI, \"Invalid URI: %s\\n\", URI); /* * This really ought to be a well formedness error * but the XML Core WG decided otherwise c.f. issue * E26 of the XML erratas. */ } else { if (uri->fragment != NULL) { /* * Okay this is foolish to block those but not * invalid URIs. */ xmlFatalErr(ctxt, XML_ERR_URI_FRAGMENT, NULL); } xmlFreeURI(uri); } } if ((RAW != '>') && (!IS_BLANK_CH(CUR))) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, \"Space required before 'NDATA'\\n\"); } SKIP_BLANKS; if (CMP5(CUR_PTR, 'N', 'D', 'A', 'T', 'A')) { SKIP(5); if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, \"Space required after 'NDATA'\\n\"); } SKIP_BLANKS; ndata = xmlParseName(ctxt); if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->unparsedEntityDecl != NULL)) ctxt->sax->unparsedEntityDecl(ctxt->userData, name, literal, URI, ndata); } else { if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->entityDecl != NULL)) ctxt->sax->entityDecl(ctxt->userData, name, XML_EXTERNAL_GENERAL_PARSED_ENTITY, literal, URI, NULL); /* * For expat compatibility in SAX mode. * assuming the entity repalcement was asked for */ if ((ctxt->replaceEntities != 0) && ((ctxt->myDoc == NULL) || (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE)))) { if (ctxt->myDoc == NULL) { ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE); if (ctxt->myDoc == NULL) { xmlErrMemory(ctxt, \"New Doc failed\"); return; } ctxt->myDoc->properties = XML_DOC_INTERNAL; } if (ctxt->myDoc->intSubset == NULL) ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST \"fake\", NULL, NULL); xmlSAX2EntityDecl(ctxt, name, XML_EXTERNAL_GENERAL_PARSED_ENTITY, literal, URI, NULL); } } } } if (ctxt->instate == XML_PARSER_EOF) return; SKIP_BLANKS; if (RAW != '>') { xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, \"xmlParseEntityDecl: entity %s not terminated\\n\", name); xmlHaltParser(ctxt); } else { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, \"Entity declaration doesn't start and stop in the same entity\\n\"); } NEXT; } if (orig != NULL) { /* * Ugly mechanism to save the raw entity value. */ xmlEntityPtr cur = NULL; if (isParameter) { if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) cur = ctxt->sax->getParameterEntity(ctxt->userData, name); } else { if ((ctxt->sax != NULL) && (ctxt->sax->getEntity != NULL)) cur = ctxt->sax->getEntity(ctxt->userData, name); if ((cur == NULL) && (ctxt->userData==ctxt)) { cur = xmlSAX2GetEntity(ctxt, name); } } if (cur != NULL) { if (cur->orig != NULL) xmlFree(orig); else cur->orig = orig; } else xmlFree(orig); } if (value != NULL) xmlFree(value); if (URI != NULL) xmlFree(URI); if (literal != NULL) xmlFree(literal); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198558, "input": "void Compute(OpKernelContext* ctx) override { const Tensor* inputs; const Tensor* seq_len; Tensor* log_prob = nullptr; OpOutputList decoded_indices; OpOutputList decoded_values; OpOutputList decoded_shape; OP_REQUIRES_OK(ctx, decode_helper_.ValidateInputsGenerateOutputs( ctx, &inputs, &seq_len, &log_prob, &decoded_indices, &decoded_values, &decoded_shape)); const TensorShape& inputs_shape = inputs->shape(); std::vector::UnalignedConstMatrix> input_list_t; const int64 max_time = inputs_shape.dim_size(0); const int64 batch_size = inputs_shape.dim_size(1); const int64 num_classes_raw = inputs_shape.dim_size(2); OP_REQUIRES( ctx, FastBoundsCheck(num_classes_raw, std::numeric_limits::max()), errors::InvalidArgument(\"num_classes cannot exceed max int\")); const int num_classes = static_cast(num_classes_raw); auto inputs_t = inputs->tensor(); input_list_t.reserve(max_time); for (std::size_t t = 0; t < max_time; ++t) { input_list_t.emplace_back(inputs_t.data() + t * batch_size * num_classes, batch_size, num_classes); } auto seq_len_t = seq_len->vec(); auto log_prob_t = log_prob->matrix(); log_prob_t.setZero(); // Assumption: the blank index is num_classes - 1 int blank_index = num_classes - 1; // Perform best path decoding std::vector > > sequences(batch_size); auto decode = [&](const int64 begin, const int64 end) { for (int b = begin; b < end; ++b) { sequences[b].resize(1); auto &sequence = sequences[b][0]; int prev_indices = -1; for (int t = 0; t < seq_len_t(b); ++t) { int max_class_indices; log_prob_t(b, 0) += -RowMax(input_list_t[t], b, &max_class_indices); if (max_class_indices != blank_index && !(merge_repeated_ && max_class_indices == prev_indices)) { sequence.push_back(max_class_indices); } prev_indices = max_class_indices; } } }; const int64 kCostPerUnit = 50 * max_time * num_classes; const int64 total = batch_size; const DeviceBase::CpuWorkerThreads& worker_threads = *ctx->device()->tensorflow_cpu_worker_threads(); Shard(worker_threads.num_threads, worker_threads.workers, total, kCostPerUnit, decode); OP_REQUIRES_OK( ctx, decode_helper_.StoreAllDecodedSequences( sequences, &decoded_indices, &decoded_values, &decoded_shape)); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a denial of service via a `CHECK`-fail in `tf.raw_ops.CTCGreedyDecoder`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/1615440b17b364b875eb06f43d087381f1460a65/tensorflow/core/kernels/ctc_decoder_ops.cc#L37-L50) has a `CHECK_LT` inserted to validate some invariants. When this condition is false, the program aborts, instead of returning a valid error to the user. This abnormal termination can be weaponized in denial of service attacks. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2021-29543"}} -{"idx": 409937, "input": "static void tcp_dsack_seen(struct tcp_sock *tp) { tp->rx_opt.sack_ok |= 4; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417934, "input": "static struct ttf_table *SFDGetTtTable(FILE *sfd, SplineFont *sf,struct ttf_table *lasttab[2]) { /* We've read the TtTable token, it is followed by a tag */ /* and then the instructions in text format */ int ch; int which; struct ttf_table *tab = chunkalloc(sizeof(struct ttf_table)); char *buf=NULL, *pt=buf, *end=buf; int backlen = strlen(end_tt_instrs); tab->tag = gettag(sfd); if ( tab->tag==CHR('f','p','g','m') || tab->tag==CHR('p','r','e','p') || tab->tag==CHR('c','v','t',' ') || tab->tag==CHR('m','a','x','p')) which = 0; else which = 1; while ( (ch=nlgetc(sfd))!=EOF ) { if ( pt>=end ) { char *newbuf = realloc(buf,(end-buf+200)); pt = newbuf+(pt-buf); end = newbuf+(end+200-buf); buf = newbuf; } *pt++ = ch; if ( pt-buf>backlen && strncmp(pt-backlen,end_tt_instrs,backlen)==0 ) { pt -= backlen; break; } } *pt = '\\0'; tab->data = _IVParse(sf,buf,&tab->len,tterr,NULL); free(buf); if ( lasttab[which]!=NULL ) lasttab[which]->next = tab; else if ( which==0 ) sf->ttf_tables = tab; else sf->ttf_tab_saved = tab; lasttab[which] = tab; return( tab ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422538, "input": "TEST(EqOp, ElemMatchKeyWithImplicitAndExplicitTraversal) { BSONObj operand = BSON(\"a.0.b\" << 3); BSONElement operandFirstElt = operand.firstElement(); EqualityMatchExpression eq(operandFirstElt.fieldName(), operandFirstElt); MatchDetails details; details.requestElemMatchKey(); BSONObj obj = fromjson(\"{a: [{b: [2, 3]}, {b: [4, 5]}]}\"); ASSERT(eq.matchesBSON(obj, &details)); ASSERT(details.hasElemMatchKey()); ASSERT_EQUALS(\"1\", details.elemMatchKey()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410736, "input": "static inline void tcp_highest_sack_reset(struct sock *sk) { tcp_sk(sk)->highest_sack = tcp_write_queue_head(sk); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 392951, "input": "TEST_F(QueryPlannerTest, CoveredOrUniqueIndexLookup) { params.options = QueryPlannerParams::NO_TABLE_SCAN; addIndex(BSON(\"a\" << 1 << \"b\" << 1)); addIndex(BSON(\"a\" << 1), false, // multikey false, // sparse, true); // unique runQuerySortProj(fromjson(\"{a: 1, b: 1}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\")); assertNumSolutions(2U); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1}, node: \" \"{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}}}}}}}\"); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1}, node: \" \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280501, "input": "format_SET_IP_TTL(const struct ofpact_ip_ttl *a, const struct ofpact_format_params *fp) { ds_put_format(fp->s, \"%smod_nw_ttl:%s%d\", colors.param, colors.end, a->ttl); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325910, "input": "best_effort_strncat_to_utf16le(struct archive_string *as16, const void *_p, size_t length, struct archive_string_conv *sc) { return (best_effort_strncat_to_utf16(as16, _p, length, sc, 0)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333167, "input": "dataiterator_set_keyname(Dataiterator *di, Id keyname) { di->nkeynames = 0; di->keyname = keyname; di->keynames[0] = keyname; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431987, "input": "static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) { __u8 status = *((__u8 *) skb->data); BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); clear_bit(HCI_RESET, &hdev->flags); if (status) return; /* Reset all non-persistent flags */ hci_dev_clear_volatile_flags(hdev); hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hdev->inq_tx_power = HCI_TX_POWER_INVALID; hdev->adv_tx_power = HCI_TX_POWER_INVALID; memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); hdev->adv_data_len = 0; memset(hdev->scan_rsp_data, 0, sizeof(hdev->scan_rsp_data)); hdev->scan_rsp_data_len = 0; hdev->le_scan_type = LE_SCAN_PASSIVE; hdev->ssp_debug_mode = 0; hci_bdaddr_list_clear(&hdev->le_white_list); hci_bdaddr_list_clear(&hdev->le_resolv_list); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519072, "input": "void ecall_find_range_bounds(uint8_t *sort_order, size_t sort_order_length, uint32_t num_partitions, uint8_t *input_rows, size_t input_rows_length, uint8_t **output_rows, size_t *output_rows_length) { // Guard against operating on arbitrary enclave memory assert(sgx_is_outside_enclave(input_rows, input_rows_length) == 1); sgx_lfence(); try { find_range_bounds(sort_order, sort_order_length, num_partitions, input_rows, input_rows_length, output_rows, output_rows_length); } catch (const std::runtime_error &e) { ocall_throw(e.what()); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336954, "input": "rb_str_chomp(int argc, VALUE *argv, VALUE str) { str = rb_str_dup(str); rb_str_chomp_bang(argc, argv, str); return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198349, "input": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast(node->builtin_data); int axis = params->axis; int num_inputs = node->inputs->size; // The number of dimensions of the input tensors must match, and all // dimensions except 'axis' must be equal. const TfLiteTensor* t0; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &t0)); TfLiteType input_type = t0->type; if (axis < 0) axis += t0->dims->size; TF_LITE_ENSURE(context, axis >= 0); TF_LITE_ENSURE(context, axis < t0->dims->size); TF_LITE_ENSURE_EQ(context, params->activation, kTfLiteActNone); TF_LITE_ENSURE(context, input_type == kTfLiteFloat32 || input_type == kTfLiteUInt8 || input_type == kTfLiteInt8 || input_type == kTfLiteInt16 || input_type == kTfLiteInt32 || input_type == kTfLiteInt64 || input_type == kTfLiteBool); // Output dimensions will match input dimensions, except 'axis', which // will be the sum of inputs int sum_axis = t0->dims->data[axis]; for (int i = 1; i < num_inputs; ++i) { const TfLiteTensor* t; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, i, &t)); TF_LITE_ENSURE_EQ(context, t->dims->size, t0->dims->size); TF_LITE_ENSURE_EQ(context, t->type, input_type); for (int d = 0; d < t0->dims->size; ++d) { if (d == axis) { sum_axis += t->dims->data[axis]; } else { TF_LITE_ENSURE_EQ(context, t->dims->data[d], t0->dims->data[d]); } } } TfLiteIntArray* output_size = TfLiteIntArrayCreate(t0->dims->size); for (int d = 0; d < t0->dims->size; ++d) { output_size->data[d] = (d == axis) ? sum_axis : t0->dims->data[d]; } TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output)); TF_LITE_ENSURE_TYPES_EQ(context, output->type, input_type); if (input_type == kTfLiteInt8) { // Make sure there is no re-scaling needed for Int8 quantized kernel. This // is a restriction we introduced to Int8 kernels. VectorOfTensors all_inputs(*context, *node->inputs); for (int i = 0; i < node->inputs->size; ++i) { const TfLiteTensor* t; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, i, &t)); TF_LITE_ENSURE_EQ(context, t->params.scale, output->params.scale); TF_LITE_ENSURE_EQ(context, t->params.zero_point, output->params.zero_point); } } if (input_type == kTfLiteInt16) { // Make sure that all Int16 inputs have a null zero-point. for (int i = 0; i < node->inputs->size; ++i) { const TfLiteTensor* t = GetInput(context, node, i); TF_LITE_ENSURE_EQ(context, t->params.zero_point, 0); } TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); } return context->ResizeTensor(context, output, output_size); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The TFLite implementation of concatenation is vulnerable to an integer overflow issue(https://github.com/tensorflow/tensorflow/blob/7b7352a724b690b11bfaae2cd54bc3907daf6285/tensorflow/lite/kernels/concatenation.cc#L70-L76). An attacker can craft a model such that the dimensions of one of the concatenation input overflow the values of `int`. TFLite uses `int` to represent tensor dimensions, whereas TF uses `int64`. Hence, valid TF models can trigger an integer overflow when converted to TFLite format. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-29601"}} -{"idx": 509380, "input": "Type_std_attributes(const Type_std_attributes *other) :collation(other->collation), decimals(other->decimals), max_length(other->max_length), unsigned_flag(other->unsigned_flag) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346280, "input": "static int do_token_in(USBDevice *dev, USBPacket *p) { USBHostDevice *s = (USBHostDevice *) dev; int ret = 0; if (p->devep != 0) return usb_host_handle_data(s, p); switch(s->ctrl.state) { case CTRL_STATE_ACK: if (!(s->ctrl.req.bRequestType & USB_DIR_IN)) { ret = usb_host_handle_control(s, p); if (ret == USB_RET_ASYNC) return USB_RET_ASYNC; s->ctrl.state = CTRL_STATE_IDLE; return ret > 0 ? 0 : ret; } return 0; case CTRL_STATE_DATA: if (s->ctrl.req.bRequestType & USB_DIR_IN) { int len = s->ctrl.len - s->ctrl.offset; if (len > p->len) len = p->len; memcpy(p->data, s->ctrl.buffer + s->ctrl.offset, len); s->ctrl.offset += len; if (s->ctrl.offset >= s->ctrl.len) s->ctrl.state = CTRL_STATE_ACK; return len; } s->ctrl.state = CTRL_STATE_IDLE; return USB_RET_STALL; default: return USB_RET_STALL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255349, "input": "bool pb_decode_fixed32(pb_istream_t *stream, void *dest) { #ifdef __BIG_ENDIAN__ uint8_t *bytes = (uint8_t*)dest; uint8_t lebytes[4]; if (!pb_read(stream, lebytes, 4)) return false; bytes[0] = lebytes[3]; bytes[1] = lebytes[2]; bytes[2] = lebytes[1]; bytes[3] = lebytes[0]; return true; #else return pb_read(stream, (uint8_t*)dest, 4); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 310354, "input": "static bool control_type_valid(void *control_type) { struct powercap_control_type *pos = NULL; bool found = false; mutex_lock(&powercap_cntrl_list_lock); list_for_each_entry(pos, &powercap_cntrl_list, node) { if (pos == control_type) { found = true; break; } } mutex_unlock(&powercap_cntrl_list_lock); return found; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333113, "input": "repodata_add_stub(Repodata **datap) { Repodata *data = *datap; Repo *repo = data->repo; Id repodataid = data - repo->repodata; Repodata *sdata = repo_add_repodata(repo, 0); data = repo->repodata + repodataid; if (data->end > data->start) repodata_extend_block(sdata, data->start, data->end - data->start); sdata->state = REPODATA_STUB; sdata->loadcallback = repodata_stub_loader; *datap = data; return sdata; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 353379, "input": "static unsigned int input_estimate_events_per_packet(struct input_dev *dev) { int mt_slots; int i; unsigned int events; if (dev->mt) { mt_slots = dev->mt->num_slots; } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, mt_slots = clamp(mt_slots, 2, 32); } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { mt_slots = 2; } else { mt_slots = 0; } events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ if (test_bit(EV_ABS, dev->evbit)) for_each_set_bit(i, dev->absbit, ABS_CNT) events += input_is_mt_axis(i) ? mt_slots : 1; if (test_bit(EV_REL, dev->evbit)) events += bitmap_weight(dev->relbit, REL_CNT); /* Make room for KEY and MSC events */ events += 7; return events; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269089, "input": "R_API int r_socket_puts(RSocket *s, char *buf) { return r_socket_write (s, buf, strlen (buf)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432497, "input": "static void svm_disable_lbrv(struct vcpu_svm *svm) { u32 *msrpm = svm->msrpm; svm->vmcb->control.virt_ext &= ~LBR_CTL_ENABLE_MASK; set_msr_interception(msrpm, MSR_IA32_LASTBRANCHFROMIP, 0, 0); set_msr_interception(msrpm, MSR_IA32_LASTBRANCHTOIP, 0, 0); set_msr_interception(msrpm, MSR_IA32_LASTINTFROMIP, 0, 0); set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508965, "input": "void update_table_bitmaps() { if (field && field->table) { TABLE *tab= field->table; tab->covering_keys.intersect(field->part_of_key); if (tab->read_set) bitmap_fast_test_and_set(tab->read_set, field->field_index); /* Do not mark a self-referecing virtual column. Such virtual columns are reported as invalid. */ if (field->vcol_info && tab->vcol_set) tab->mark_virtual_col(field); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431212, "input": "static void nfs41_sequence_call_done(struct rpc_task *task, void *data) { struct nfs4_sequence_data *calldata = data; struct nfs_client *clp = calldata->clp; if (!nfs41_sequence_done(task, task->tk_msg.rpc_resp)) return; trace_nfs4_sequence(clp, task->tk_status); if (task->tk_status < 0) { dprintk(\"%s ERROR %d\\n\", __func__, task->tk_status); if (refcount_read(&clp->cl_count) == 1) goto out; if (nfs41_sequence_handle_errors(task, clp) == -EAGAIN) { rpc_restart_call_prepare(task); return; } } dprintk(\"%s rpc_cred %p\\n\", __func__, task->tk_msg.rpc_cred); out: dprintk(\"<-- %s\\n\", __func__); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385625, "input": "bool WhiteSpace::Is(uchar c) { int chunk_index = c >> 13; switch (chunk_index) { case 0: return LookupPredicate(kWhiteSpaceTable0, kWhiteSpaceTable0Size, c); case 1: return LookupPredicate(kWhiteSpaceTable1, kWhiteSpaceTable1Size, c); default: return false; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431400, "input": "static void nfs4_xdr_enc_setclientid(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs4_setclientid *sc = data; struct compound_hdr hdr = { .nops = 0, }; encode_compound_hdr(xdr, req, &hdr); encode_setclientid(xdr, sc, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232411, "input": "static bool type_is_pkt_pointer(enum bpf_reg_type type) { return type == PTR_TO_PACKET || type == PTR_TO_PACKET_META; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430830, "input": "UnicodeStringTest::TestReadOnlyAlias() { UChar uchars[]={ 0x61, 0x62, 0 }; UnicodeString alias(TRUE, uchars, 2); if(alias.length()!=2 || alias.getBuffer()!=uchars || alias.getTerminatedBuffer()!=uchars) { errln(\"UnicodeString read-only-aliasing constructor does not behave as expected.\"); return; } alias.truncate(1); if(alias.length()!=1 || alias.getBuffer()!=uchars) { errln(\"UnicodeString(read-only-alias).truncate() did not preserve aliasing as expected.\"); } if(alias.getTerminatedBuffer()==uchars) { errln(\"UnicodeString(read-only-alias).truncate().getTerminatedBuffer() \" \"did not allocate and copy as expected.\"); } if(uchars[1]!=0x62) { errln(\"UnicodeString(read-only-alias).truncate().getTerminatedBuffer() \" \"modified the original buffer.\"); } if(1!=u_strlen(alias.getTerminatedBuffer())) { errln(\"UnicodeString(read-only-alias).truncate().getTerminatedBuffer() \" \"does not return a buffer terminated at the proper length.\"); } alias.setTo(TRUE, uchars, 2); if(alias.length()!=2 || alias.getBuffer()!=uchars || alias.getTerminatedBuffer()!=uchars) { errln(\"UnicodeString read-only-aliasing setTo() does not behave as expected.\"); return; } alias.remove(); if(alias.length()!=0) { errln(\"UnicodeString(read-only-alias).remove() did not work.\"); } if(alias.getTerminatedBuffer()==uchars) { errln(\"UnicodeString(read-only-alias).remove().getTerminatedBuffer() \" \"did not un-alias as expected.\"); } if(uchars[0]!=0x61) { errln(\"UnicodeString(read-only-alias).remove().getTerminatedBuffer() \" \"modified the original buffer.\"); } if(0!=u_strlen(alias.getTerminatedBuffer())) { errln(\"UnicodeString.setTo(read-only-alias).remove().getTerminatedBuffer() \" \"does not return a buffer terminated at length 0.\"); } UnicodeString longString=UNICODE_STRING_SIMPLE(\"abcdefghijklmnopqrstuvwxyz0123456789\"); alias.setTo(FALSE, longString.getBuffer(), longString.length()); alias.remove(0, 10); if(longString.compare(10, INT32_MAX, alias)!=0 || alias.getBuffer()!=longString.getBuffer()+10) { errln(\"UnicodeString.setTo(read-only-alias).remove(0, 10) did not preserve aliasing as expected.\"); } alias.setTo(FALSE, longString.getBuffer(), longString.length()); alias.remove(27, 99); if(longString.compare(0, 27, alias)!=0 || alias.getBuffer()!=longString.getBuffer()) { errln(\"UnicodeString.setTo(read-only-alias).remove(27, 99) did not preserve aliasing as expected.\"); } alias.setTo(FALSE, longString.getBuffer(), longString.length()); alias.retainBetween(6, 30); if(longString.compare(6, 24, alias)!=0 || alias.getBuffer()!=longString.getBuffer()+6) { errln(\"UnicodeString.setTo(read-only-alias).retainBetween(6, 30) did not preserve aliasing as expected.\"); } UChar abc[]={ 0x61, 0x62, 0x63, 0 }; UBool hasRVO= wrapUChars(abc).getBuffer()==abc; UnicodeString temp; temp.fastCopyFrom(longString.tempSubString()); if(temp!=longString || (hasRVO && temp.getBuffer()!=longString.getBuffer())) { errln(\"UnicodeString.tempSubString() failed\"); } temp.fastCopyFrom(longString.tempSubString(-3, 5)); if(longString.compare(0, 5, temp)!=0 || (hasRVO && temp.getBuffer()!=longString.getBuffer())) { errln(\"UnicodeString.tempSubString(-3, 5) failed\"); } temp.fastCopyFrom(longString.tempSubString(17)); if(longString.compare(17, INT32_MAX, temp)!=0 || (hasRVO && temp.getBuffer()!=longString.getBuffer()+17)) { errln(\"UnicodeString.tempSubString(17) failed\"); } temp.fastCopyFrom(longString.tempSubString(99)); if(!temp.isEmpty()) { errln(\"UnicodeString.tempSubString(99) failed\"); } temp.fastCopyFrom(longString.tempSubStringBetween(6)); if(longString.compare(6, INT32_MAX, temp)!=0 || (hasRVO && temp.getBuffer()!=longString.getBuffer()+6)) { errln(\"UnicodeString.tempSubStringBetween(6) failed\"); } temp.fastCopyFrom(longString.tempSubStringBetween(8, 18)); if(longString.compare(8, 10, temp)!=0 || (hasRVO && temp.getBuffer()!=longString.getBuffer()+8)) { errln(\"UnicodeString.tempSubStringBetween(8, 18) failed\"); } UnicodeString bogusString; bogusString.setToBogus(); temp.fastCopyFrom(bogusString.tempSubStringBetween(8, 18)); if(!temp.isBogus()) { errln(\"UnicodeString.setToBogus().tempSubStringBetween(8, 18) failed\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230168, "input": "void JSObject::preventExtensions(JSObject *self) { assert( !self->flags_.proxyObject && \"[[Extensible]] slot cannot be set directly on Proxy objects\"); self->flags_.noExtend = true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338518, "input": "static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force) { struct io_rings *rings = ctx->rings; unsigned long flags; bool all_flushed, posted; if (!force && __io_cqring_events(ctx) == rings->cq_ring_entries) return false; posted = false; spin_lock_irqsave(&ctx->completion_lock, flags); while (!list_empty(&ctx->cq_overflow_list)) { struct io_uring_cqe *cqe = io_get_cqring(ctx); struct io_overflow_cqe *ocqe; if (!cqe && !force) break; ocqe = list_first_entry(&ctx->cq_overflow_list, struct io_overflow_cqe, list); if (cqe) memcpy(cqe, &ocqe->cqe, sizeof(*cqe)); else WRITE_ONCE(ctx->rings->cq_overflow, ++ctx->cached_cq_overflow); posted = true; list_del(&ocqe->list); kfree(ocqe); } all_flushed = list_empty(&ctx->cq_overflow_list); if (all_flushed) { clear_bit(0, &ctx->sq_check_overflow); clear_bit(0, &ctx->cq_check_overflow); ctx->rings->sq_flags &= ~IORING_SQ_CQ_OVERFLOW; } if (posted) io_commit_cqring(ctx); spin_unlock_irqrestore(&ctx->completion_lock, flags); if (posted) io_cqring_ev_posted(ctx); return all_flushed; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468932, "input": "int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) { struct inet_sock *inet = inet_sk(sk); struct udp_sock *up = udp_sk(sk); struct flowi4 fl4_stack; struct flowi4 *fl4; int ulen = len; struct ipcm_cookie ipc; struct rtable *rt = NULL; int free = 0; int connected = 0; __be32 daddr, faddr, saddr; __be16 dport; u8 tos; int err, is_udplite = IS_UDPLITE(sk); int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); struct sk_buff *skb; struct ip_options_data opt_copy; if (len > 0xFFFF) return -EMSGSIZE; /* * Check the flags. */ if (msg->msg_flags & MSG_OOB) /* Mirror BSD error message compatibility */ return -EOPNOTSUPP; ipc.opt = NULL; ipc.tx_flags = 0; ipc.ttl = 0; ipc.tos = -1; getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; fl4 = &inet->cork.fl.u.ip4; if (up->pending) { /* * There are pending frames. * The socket lock must be held while it's corked. */ lock_sock(sk); if (likely(up->pending)) { if (unlikely(up->pending != AF_INET)) { release_sock(sk); return -EINVAL; } goto do_append_data; } release_sock(sk); } ulen += sizeof(struct udphdr); /* * Get and verify the address. */ if (msg->msg_name) { DECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name); if (msg->msg_namelen < sizeof(*usin)) return -EINVAL; if (usin->sin_family != AF_INET) { if (usin->sin_family != AF_UNSPEC) return -EAFNOSUPPORT; } daddr = usin->sin_addr.s_addr; dport = usin->sin_port; if (dport == 0) return -EINVAL; } else { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; daddr = inet->inet_daddr; dport = inet->inet_dport; /* Open fast path for connected socket. Route will not be used, if at least one option is set. */ connected = 1; } ipc.sockc.tsflags = sk->sk_tsflags; ipc.addr = inet->inet_saddr; ipc.oif = sk->sk_bound_dev_if; if (msg->msg_controllen) { err = ip_cmsg_send(sk, msg, &ipc, sk->sk_family == AF_INET6); if (unlikely(err)) { kfree(ipc.opt); return err; } if (ipc.opt) free = 1; connected = 0; } if (!ipc.opt) { struct ip_options_rcu *inet_opt; rcu_read_lock(); inet_opt = rcu_dereference(inet->inet_opt); if (inet_opt) { memcpy(&opt_copy, inet_opt, sizeof(*inet_opt) + inet_opt->opt.optlen); ipc.opt = &opt_copy.opt; } rcu_read_unlock(); } saddr = ipc.addr; ipc.addr = faddr = daddr; sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags); if (ipc.opt && ipc.opt->opt.srr) { if (!daddr) return -EINVAL; faddr = ipc.opt->opt.faddr; connected = 0; } tos = get_rttos(&ipc, inet); if (sock_flag(sk, SOCK_LOCALROUTE) || (msg->msg_flags & MSG_DONTROUTE) || (ipc.opt && ipc.opt->opt.is_strictroute)) { tos |= RTO_ONLINK; connected = 0; } if (ipv4_is_multicast(daddr)) { if (!ipc.oif) ipc.oif = inet->mc_index; if (!saddr) saddr = inet->mc_addr; connected = 0; } else if (!ipc.oif) ipc.oif = inet->uc_index; if (connected) rt = (struct rtable *)sk_dst_check(sk, 0); if (!rt) { struct net *net = sock_net(sk); __u8 flow_flags = inet_sk_flowi_flags(sk); fl4 = &fl4_stack; flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, sk->sk_protocol, flow_flags, faddr, saddr, dport, inet->inet_sport, sk->sk_uid); security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); rt = ip_route_output_flow(net, fl4, sk); if (IS_ERR(rt)) { err = PTR_ERR(rt); rt = NULL; if (err == -ENETUNREACH) IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); goto out; } err = -EACCES; if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) goto out; if (connected) sk_dst_set(sk, dst_clone(&rt->dst)); } if (msg->msg_flags&MSG_CONFIRM) goto do_confirm; back_from_confirm: saddr = fl4->saddr; if (!ipc.addr) daddr = ipc.addr = fl4->daddr; /* Lockless fast path for the non-corking case. */ if (!corkreq) { skb = ip_make_skb(sk, fl4, getfrag, msg, ulen, sizeof(struct udphdr), &ipc, &rt, msg->msg_flags); err = PTR_ERR(skb); if (!IS_ERR_OR_NULL(skb)) err = udp_send_skb(skb, fl4); goto out; } lock_sock(sk); if (unlikely(up->pending)) { /* The socket is already corked while preparing it. */ /* ... which is an evident application bug. --ANK */ release_sock(sk); net_dbg_ratelimited(\"cork app bug 2\\n\"); err = -EINVAL; goto out; } /* * Now cork the socket to pend data. */ fl4 = &inet->cork.fl.u.ip4; fl4->daddr = daddr; fl4->saddr = saddr; fl4->fl4_dport = dport; fl4->fl4_sport = inet->inet_sport; up->pending = AF_INET; do_append_data: up->len += ulen; err = ip_append_data(sk, fl4, getfrag, msg, ulen, sizeof(struct udphdr), &ipc, &rt, corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags); if (err) udp_flush_pending_frames(sk); else if (!corkreq) err = udp_push_pending_frames(sk); else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) up->pending = 0; release_sock(sk); out: ip_rt_put(rt); if (free) kfree(ipc.opt); if (!err) return len; /* * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space. Reporting * ENOBUFS might not be good (it's not tunable per se), but otherwise * we don't have a good statistic (IpOutDiscards but it can be too many * things). We could add another new stat but at least for now that * seems like overkill. */ if (err == -ENOBUFS || test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { UDP_INC_STATS(sock_net(sk), UDP_MIB_SNDBUFERRORS, is_udplite); } return err; do_confirm: if (msg->msg_flags & MSG_PROBE) dst_confirm_neigh(&rt->dst, &fl4->daddr); if (!(msg->msg_flags&MSG_PROBE) || len) goto back_from_confirm; err = 0; goto out; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206412, "input": "int ReadJpegSections (FILE * infile, ReadMode_t ReadMode) { int a; int HaveCom = FALSE; a = fgetc(infile); if (a != 0xff || fgetc(infile) != M_SOI){ return FALSE; } ImageInfo.JfifHeader.XDensity = ImageInfo.JfifHeader.YDensity = 300; ImageInfo.JfifHeader.ResolutionUnits = 1; for(;;){ int itemlen; int prev; int marker = 0; int ll,lh, got; uchar * Data; CheckSectionsAllocated(); prev = 0; for (a=0;;a++){ marker = fgetc(infile); if (marker != 0xff && prev == 0xff) break; if (marker == EOF){ ErrFatal(\"Unexpected end of file\"); } prev = marker; } if (a > 10){ ErrNonfatal(\"Extraneous %d padding bytes before section %02X\",a-1,marker); } Sections[SectionsRead].Type = marker; // Read the length of the section. lh = fgetc(infile); ll = fgetc(infile); if (lh == EOF || ll == EOF){ ErrFatal(\"Unexpected end of file\"); } itemlen = (lh << 8) | ll; if (itemlen < 2){ ErrFatal(\"invalid marker\"); } Sections[SectionsRead].Size = itemlen; Data = (uchar *)malloc(itemlen); if (Data == NULL){ ErrFatal(\"Could not allocate memory\"); } Sections[SectionsRead].Data = Data; // Store first two pre-read bytes. Data[0] = (uchar)lh; Data[1] = (uchar)ll; got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section. if (got != itemlen-2){ ErrFatal(\"Premature end of file?\"); } SectionsRead += 1; switch(marker){ case M_SOS: // stop before hitting compressed data // If reading entire image is requested, read the rest of the data. if (ReadMode & READ_IMAGE){ int cp, ep, size; // Determine how much file is left. cp = ftell(infile); fseek(infile, 0, SEEK_END); ep = ftell(infile); fseek(infile, cp, SEEK_SET); size = ep-cp; Data = (uchar *)malloc(size); if (Data == NULL){ ErrFatal(\"could not allocate data for entire image\"); } got = fread(Data, 1, size, infile); if (got != size){ ErrFatal(\"could not read the rest of the image\"); } CheckSectionsAllocated(); Sections[SectionsRead].Data = Data; Sections[SectionsRead].Size = size; Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER; SectionsRead ++; HaveAll = 1; } return TRUE; case M_DQT: // Use for jpeg quality guessing process_DQT(Data, itemlen); break; case M_DHT: // Use for jpeg quality guessing process_DHT(Data, itemlen); break; case M_EOI: // in case it's a tables-only JPEG stream fprintf(stderr,\"No image in jpeg!\\n\"); return FALSE; case M_COM: // Comment section if (HaveCom || ((ReadMode & READ_METADATA) == 0)){ // Discard this section. free(Sections[--SectionsRead].Data); }else{ process_COM(Data, itemlen); HaveCom = TRUE; } break; case M_JFIF: // Regular jpegs always have this tag, exif images have the exif // marker instead, althogh ACDsee will write images with both markers. // this program will re-create this marker on absence of exif marker. // hence no need to keep the copy from the file. if (itemlen < 16){ fprintf(stderr,\"Jfif header too short\\n\"); goto ignore; } if (memcmp(Data+2, \"JFIF\\0\",5)){ fprintf(stderr,\"Header missing JFIF marker\\n\"); } ImageInfo.JfifHeader.Present = TRUE; ImageInfo.JfifHeader.ResolutionUnits = Data[9]; ImageInfo.JfifHeader.XDensity = (Data[10]<<8) | Data[11]; ImageInfo.JfifHeader.YDensity = (Data[12]<<8) | Data[13]; if (ShowTags){ printf(\"JFIF SOI marker: Units: %d \",ImageInfo.JfifHeader.ResolutionUnits); switch(ImageInfo.JfifHeader.ResolutionUnits){ case 0: printf(\"(aspect ratio)\"); break; case 1: printf(\"(dots per inch)\"); break; case 2: printf(\"(dots per cm)\"); break; default: printf(\"(unknown)\"); break; } printf(\" X-density=%d Y-density=%d\\n\",ImageInfo.JfifHeader.XDensity, ImageInfo.JfifHeader.YDensity); if (Data[14] || Data[15]){ fprintf(stderr,\"Ignoring jfif header thumbnail\\n\"); } } ignore: free(Sections[--SectionsRead].Data); break; case M_EXIF: // There can be different section using the same marker. if (ReadMode & READ_METADATA){ if (memcmp(Data+2, \"Exif\", 4) == 0){ process_EXIF(Data, itemlen); break; }else if (memcmp(Data+2, \"http:\", 5) == 0){ Sections[SectionsRead-1].Type = M_XMP; // Change tag for internal purposes. if (ShowTags){ printf(\"Image contains XMP section, %d bytes long\\n\", itemlen); if (ShowTags){ ShowXmp(Sections[SectionsRead-1]); } } break; } } // Oterwise, discard this section. free(Sections[--SectionsRead].Data); break; case M_IPTC: if (ReadMode & READ_METADATA){ if (ShowTags){ printf(\"Image contains IPTC section, %d bytes long\\n\", itemlen); } // Note: We just store the IPTC section. Its relatively straightforward // and we don't act on any part of it, so just display it at parse time. }else{ free(Sections[--SectionsRead].Data); } break; case M_SOF0: case M_SOF1: case M_SOF2: case M_SOF3: case M_SOF5: case M_SOF6: case M_SOF7: case M_SOF9: case M_SOF10: case M_SOF11: case M_SOF13: case M_SOF14: case M_SOF15: if (itemlen < 8){ fprintf(stderr,\"Section too short\\n\"); break; } process_SOFn(Data, marker); break; default: // Skip any other sections. if (ShowTags){ printf(\"Jpeg section marker 0x%02x size %d\\n\",marker, itemlen); } break; } } return TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "JHEAD is a simple command line tool for displaying and some manipulation of EXIF header data embedded in Jpeg images from digital cameras. In affected versions there is a heap-buffer-overflow on jhead-3.04/jpgfile.c:285 ReadJpegSections. Crafted jpeg images can be provided to the user resulting in a program crash or potentially incorrect exif information retrieval. Users are advised to upgrade. There is no known workaround for this issue.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-26208"}} -{"idx": 337032, "input": "rb_str_associated(VALUE str) { if (STR_SHARED_P(str)) str = RSTRING(str)->as.heap.aux.shared; if (STR_ASSOC_P(str)) { return RSTRING(str)->as.heap.aux.shared; } return Qfalse; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364199, "input": "static inline void zap_deposited_table(struct mm_struct *mm, pmd_t *pmd) { pgtable_t pgtable; pgtable = pgtable_trans_huge_withdraw(mm, pmd); pte_free(mm, pgtable); mm_dec_nr_ptes(mm); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197512, "input": "void Compute(OpKernelContext* context) override { // Checks what we're remapping and inverts the relevant remapping Tensors to // be maps with key = old ID, value = new ID. std::unordered_map old_row_to_new_row_map; std::vector row_id_present; const Tensor* row_remapping_t; OP_REQUIRES_OK(context, context->input(\"row_remapping\", &row_remapping_t)); const auto row_remapping = row_remapping_t->vec(); OP_REQUIRES(context, row_remapping.size() == num_rows_, errors::InvalidArgument(strings::StrCat( \"Size of row_remapping is \", row_remapping.size(), \" instead of being equal to num_rows=\", num_rows_))); OP_REQUIRES_OK(context, RemapVectorToMap(row_remapping, &row_id_present, &old_row_to_new_row_map)); // Calculates the min/max old row ID that we need to read, to save us from // reading some unnecessary slices of the old tensor. int64 min_old_row = -1; int64 max_old_row = -1; for (int i = 0; i < row_remapping.size(); ++i) { if (min_old_row < 0 || (row_remapping(i) >= 0 && row_remapping(i) < min_old_row)) { min_old_row = row_remapping(i); } if (max_old_row < 0 || (row_remapping(i) >= 0 && row_remapping(i) > max_old_row)) { max_old_row = row_remapping(i); } } // Processes the remapping for columns. std::unordered_map old_col_to_new_col_map; std::vector col_id_present; const Tensor* col_remapping_t; OP_REQUIRES_OK(context, context->input(\"col_remapping\", &col_remapping_t)); const auto col_remapping = col_remapping_t->vec(); // Note that we always \"remap rows\", even when the row vocabulary does // not change, because partitioning requires a mapping from partitioned // Variables to the full checkpoints we load. const bool remap_cols = col_remapping.size() > 0; if (remap_cols) { OP_REQUIRES( context, col_remapping.size() == num_cols_, errors::InvalidArgument(strings::StrCat( \"Provided col_remapping, but its size is \", col_remapping.size(), \" instead of being equal to num_cols=\", num_cols_))); OP_REQUIRES_OK(context, RemapVectorToMap(col_remapping, &col_id_present, &old_col_to_new_col_map)); } else { col_id_present.clear(); col_id_present.resize(num_cols_, true); } // Processes the checkpoint source and the provided Tensor name. const Tensor* ckpt_path_t; OP_REQUIRES_OK(context, context->input(\"ckpt_path\", &ckpt_path_t)); const string& ckpt_path = ckpt_path_t->scalar()(); const Tensor* old_tensor_name_t; OP_REQUIRES_OK(context, context->input(\"old_tensor_name\", &old_tensor_name_t)); const string& old_tensor_name = old_tensor_name_t->scalar()(); LOG(INFO) << \"Processing checkpoint : \" << ckpt_path; BundleReader reader(context->env(), ckpt_path); OP_REQUIRES_OK(context, reader.status()); DataType tensor_type; TensorShape tensor_shape; OP_REQUIRES_OK(context, reader.LookupDtypeAndShape( old_tensor_name, &tensor_type, &tensor_shape)); OP_REQUIRES(context, tensor_type == DT_FLOAT, errors::InvalidArgument(strings::StrCat( \"Tensor \", old_tensor_name, \" has invalid type \", DataTypeString(tensor_type), \" instead of expected type \", DataTypeString(DT_FLOAT)))); // This op is limited to loading Tensors of rank 2 (matrices). OP_REQUIRES( context, tensor_shape.dims() == 2, errors::InvalidArgument(strings::StrCat( \"Tensor \", old_tensor_name, \" has shape \", tensor_shape.DebugString(), \" of invalid rank \", tensor_shape.dims(), \" instead of expected shape of rank 2.\"))); if (!remap_cols) { // TODO(weiho): Consider relaxing this restriction to allow partial column // loading (even when no column remapping is specified) if there turns out // to be a use case for it. OP_REQUIRES(context, num_cols_ == tensor_shape.dim_size(1), errors::InvalidArgument(strings::StrCat( \"Tensor \", old_tensor_name, \" has shape \", tensor_shape.DebugString(), \", where the size of its 2nd dimension is \", tensor_shape.dim_size(1), \" instead of being equal to num_cols=\", num_cols_))); } // Uses TensorSlice to potentially load the old tensor in chunks in case // memory usage is a concern. std::vector tensor_slices; TensorSlice slice(tensor_shape.dims()); if (min_old_row >= 0 && max_old_row >= 0) { int64 row_start = min_old_row; // TODO(weiho): Given the list of old row IDs of interest (the keys of // old_row_to_new_row_map), we could also try something smarter to // find some minimal set of covering ranges for the list of old row IDs // such that the size of each range is less than max_rows_in_memory_. while (row_start <= max_old_row) { const int64 slice_length = max_rows_in_memory_ <= 0 // If max_rows_in_memory_ <= 0, we just load the entire chunk. ? max_old_row - row_start + 1 : std::min(max_rows_in_memory_, max_old_row - row_start + 1); slice.set_start(0, row_start); slice.set_length(0, slice_length); tensor_slices.push_back(slice); row_start += slice_length; } } // Allocates the output matrix. Tensor* output_matrix_t = nullptr; OP_REQUIRES_OK(context, context->allocate_output(\"output_matrix\", TensorShape({num_rows_, num_cols_}), &output_matrix_t)); auto output_matrix = output_matrix_t->matrix(); // Iterates through tensor slices and copies over values from the old tensor // to the output matrix. int64 row_index = min_old_row; int64 rows_copied = 0; Tensor loaded_tensor_t; for (const TensorSlice& tensor_slice : tensor_slices) { LOG(INFO) << \"Loading slice \" << tensor_slice.DebugString(); TensorShape slice_shape; OP_REQUIRES_OK(context, tensor_slice.SliceTensorShape(tensor_shape, &slice_shape)); // Potentially re-allocates the tensor buffer since the last slice may // have fewer rows than the other slices. if (loaded_tensor_t.shape() != slice_shape) { loaded_tensor_t = Tensor(DT_FLOAT, slice_shape); } OP_REQUIRES_OK(context, reader.LookupSlice(old_tensor_name, tensor_slice, &loaded_tensor_t)); // Iterates through the old loaded tensor slice row-by-row. for (int row = 0; row < loaded_tensor_t.dim_size(0); ++row, ++row_index) { if (row_index % 500000 == min_old_row) { LOG(INFO) << \"Processing old row \" << row_index; } // If the old row ID is not found in old_row_to_new_row_map, continue // to the next row; otherwise, copy it to the output matrix. const int64* new_row_ptr = gtl::FindOrNull(old_row_to_new_row_map, row_index); if (new_row_ptr == nullptr) { continue; } ++rows_copied; const int64 new_row = *new_row_ptr; // Copies over the row element-by-element, in case remapping is needed // along the column axis. const auto& loaded_tensor = loaded_tensor_t.matrix(); for (int old_col = 0; old_col < loaded_tensor_t.dim_size(1); ++old_col) { int64 new_col = old_col; if (remap_cols) { const int64* new_col_ptr = gtl::FindOrNull(old_col_to_new_col_map, old_col); if (new_col_ptr == nullptr) { // Column remapping is specified, but this column is not found in // old_col_to_new_col_map, so we leave it uninitialized, to be // filled in with initializing_values later. continue; } new_col = *new_col_ptr; } OP_REQUIRES(context, new_row < num_rows_ && new_col < num_cols_ && new_row >= 0 && new_col >= 0, errors::Internal(strings::StrCat( \"new_row=\", new_row, \" and new_col=\", new_col, \" should have been less than num_rows_=\", num_rows_, \" and num_cols_=\", num_cols_, \" and non-negative. This should never have happened \" \"if the code were correct. Please file a bug.\"))); output_matrix(new_row, new_col) = loaded_tensor(row, old_col); } } } LOG(INFO) << \"Copied \" << rows_copied << \" rows from old matrix (with \" << tensor_shape.dim_size(0) << \" rows) to new matrix (with \" << num_rows_ << \" rows).\"; // At this point, there are potentially whole rows/columns uninitialized // (corresponding to the indices where row_id_present/col_id_present are // false). We fill this in cell-by-cell using row_id_present and // col_id_present while dequeuing from the initializing_values vector. const Tensor* initializing_values_t; OP_REQUIRES_OK( context, context->input(\"initializing_values\", &initializing_values_t)); const auto initializing_values = initializing_values_t->flat(); int64 initializing_values_index = 0; for (int i = 0; i < num_rows_; ++i) { for (int j = 0; j < num_cols_; ++j) { if (row_id_present[i] && col_id_present[j]) continue; OP_REQUIRES( context, initializing_values_index < initializing_values.size(), errors::InvalidArgument( \"initializing_values contained \", initializing_values.size(), \" elements, but more missing values remain.\")); output_matrix(i, j) = initializing_values(initializing_values_index); ++initializing_values_index; } } // Checks that we used all the given initializing values. OP_REQUIRES( context, initializing_values_index == initializing_values.size(), errors::InvalidArgument( \"initializing_values contained \", initializing_values.size(), \" elements, but only \", initializing_values_index, \" elements were used to fill in missing values.\")); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a denial of service by exploiting a `CHECK`-failure coming from `tf.raw_ops.LoadAndRemapMatrix`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/d94227d43aa125ad8b54115c03cece54f6a1977b/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc#L219-L222) assumes that the `ckpt_path` is always a valid scalar. However, an attacker can send any other tensor as the first argument of `LoadAndRemapMatrix`. This would cause the rank `CHECK` in `scalar()()` to trigger and terminate the process. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-29561"}} -{"idx": 416754, "input": "static void cil_reset_avrule(struct cil_avrule *rule) { cil_reset_classperms_list(rule->perms.classperms); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246800, "input": "GF_EXPORT GF_Err gf_isom_get_sidx_duration(GF_ISOFile *movie, u64 *sidx_dur, u32 *sidx_timescale) { u64 dur=0; u32 i; if (!movie || !movie->moov || !sidx_timescale || !sidx_dur) return GF_BAD_PARAM; if (!movie->main_sidx) return GF_NOT_SUPPORTED; *sidx_timescale = movie->main_sidx->timescale; for (i=0; imain_sidx->nb_refs; i++) { dur += movie->main_sidx->refs[i].subsegment_duration; } *sidx_dur = dur; return GF_OK;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 316681, "input": "MagickExport MagickBooleanType DrawClipPath(Image *image, const DrawInfo *draw_info,const char *id) { const char *clip_path; Image *clipping_mask; MagickBooleanType status; clip_path=GetImageArtifact(image,id); if (clip_path == (const char *) NULL) return(MagickFalse); clipping_mask=DrawClippingMask(image,draw_info,draw_info->clip_mask,clip_path, &image->exception); if (clipping_mask == (Image *) NULL) return(MagickFalse); status=SetImageClipMask(image,clipping_mask); clipping_mask=DestroyImage(clipping_mask); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509370, "input": "virtual Item *convert_to_basic_const_item(THD *thd) { return 0; };", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462474, "input": "INLINE void gdi_RgnToRect(HGDI_RGN rgn, HGDI_RECT rect) { rect->left = rgn->x; rect->top = rgn->y; rect->right = rgn->x + rgn->w - 1; rect->bottom = rgn->y + rgn->h - 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398085, "input": "static inline void __sctp_put_port(struct sock *sk) { struct sctp_bind_hashbucket *head = &sctp_port_hashtable[sctp_phashfn(sock_net(sk), inet_sk(sk)->inet_num)]; struct sctp_bind_bucket *pp; spin_lock(&head->lock); pp = sctp_sk(sk)->bind_hash; __sk_del_bind_node(sk); sctp_sk(sk)->bind_hash = NULL; inet_sk(sk)->inet_num = 0; sctp_bucket_destroy(pp); spin_unlock(&head->lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446299, "input": "ScanLineInputFile::Data::Data (int numThreads): partNumber(-1), memoryMapped(false) { // // We need at least one lineBuffer, but if threading is used, // to keep n threads busy we need 2*n lineBuffers // lineBuffers.resize (max (1, 2 * numThreads)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 306288, "input": "static void setcontrast(struct gspca_dev *gspca_dev, s32 val) { struct sd *sd = (struct sd *) gspca_dev; static const struct ov_i2c_regvals contrast_7660[][31] = { {{0x6c, 0xf0}, {0x6d, 0xf0}, {0x6e, 0xf8}, {0x6f, 0xa0}, {0x70, 0x58}, {0x71, 0x38}, {0x72, 0x30}, {0x73, 0x30}, {0x74, 0x28}, {0x75, 0x28}, {0x76, 0x24}, {0x77, 0x24}, {0x78, 0x22}, {0x79, 0x28}, {0x7a, 0x2a}, {0x7b, 0x34}, {0x7c, 0x0f}, {0x7d, 0x1e}, {0x7e, 0x3d}, {0x7f, 0x65}, {0x80, 0x70}, {0x81, 0x77}, {0x82, 0x7d}, {0x83, 0x83}, {0x84, 0x88}, {0x85, 0x8d}, {0x86, 0x96}, {0x87, 0x9f}, {0x88, 0xb0}, {0x89, 0xc4}, {0x8a, 0xd9}}, {{0x6c, 0xf0}, {0x6d, 0xf0}, {0x6e, 0xf8}, {0x6f, 0x94}, {0x70, 0x58}, {0x71, 0x40}, {0x72, 0x30}, {0x73, 0x30}, {0x74, 0x30}, {0x75, 0x30}, {0x76, 0x2c}, {0x77, 0x24}, {0x78, 0x22}, {0x79, 0x28}, {0x7a, 0x2a}, {0x7b, 0x31}, {0x7c, 0x0f}, {0x7d, 0x1e}, {0x7e, 0x3d}, {0x7f, 0x62}, {0x80, 0x6d}, {0x81, 0x75}, {0x82, 0x7b}, {0x83, 0x81}, {0x84, 0x87}, {0x85, 0x8d}, {0x86, 0x98}, {0x87, 0xa1}, {0x88, 0xb2}, {0x89, 0xc6}, {0x8a, 0xdb}}, {{0x6c, 0xf0}, {0x6d, 0xf0}, {0x6e, 0xf0}, {0x6f, 0x84}, {0x70, 0x58}, {0x71, 0x48}, {0x72, 0x40}, {0x73, 0x40}, {0x74, 0x28}, {0x75, 0x28}, {0x76, 0x28}, {0x77, 0x24}, {0x78, 0x26}, {0x79, 0x28}, {0x7a, 0x28}, {0x7b, 0x34}, {0x7c, 0x0f}, {0x7d, 0x1e}, {0x7e, 0x3c}, {0x7f, 0x5d}, {0x80, 0x68}, {0x81, 0x71}, {0x82, 0x79}, {0x83, 0x81}, {0x84, 0x86}, {0x85, 0x8b}, {0x86, 0x95}, {0x87, 0x9e}, {0x88, 0xb1}, {0x89, 0xc5}, {0x8a, 0xd9}}, {{0x6c, 0xf0}, {0x6d, 0xf0}, {0x6e, 0xf0}, {0x6f, 0x70}, {0x70, 0x58}, {0x71, 0x58}, {0x72, 0x48}, {0x73, 0x48}, {0x74, 0x38}, {0x75, 0x40}, {0x76, 0x34}, {0x77, 0x34}, {0x78, 0x2e}, {0x79, 0x28}, {0x7a, 0x24}, {0x7b, 0x22}, {0x7c, 0x0f}, {0x7d, 0x1e}, {0x7e, 0x3c}, {0x7f, 0x58}, {0x80, 0x63}, {0x81, 0x6e}, {0x82, 0x77}, {0x83, 0x80}, {0x84, 0x87}, {0x85, 0x8f}, {0x86, 0x9c}, {0x87, 0xa9}, {0x88, 0xc0}, {0x89, 0xd4}, {0x8a, 0xe6}}, {{0x6c, 0xa0}, {0x6d, 0xf0}, {0x6e, 0x90}, {0x6f, 0x80}, {0x70, 0x70}, {0x71, 0x80}, {0x72, 0x60}, {0x73, 0x60}, {0x74, 0x58}, {0x75, 0x60}, {0x76, 0x4c}, {0x77, 0x38}, {0x78, 0x38}, {0x79, 0x2a}, {0x7a, 0x20}, {0x7b, 0x0e}, {0x7c, 0x0a}, {0x7d, 0x14}, {0x7e, 0x26}, {0x7f, 0x46}, {0x80, 0x54}, {0x81, 0x64}, {0x82, 0x70}, {0x83, 0x7c}, {0x84, 0x87}, {0x85, 0x93}, {0x86, 0xa6}, {0x87, 0xb4}, {0x88, 0xd0}, {0x89, 0xe5}, {0x8a, 0xf5}}, {{0x6c, 0x60}, {0x6d, 0x80}, {0x6e, 0x60}, {0x6f, 0x80}, {0x70, 0x80}, {0x71, 0x80}, {0x72, 0x88}, {0x73, 0x30}, {0x74, 0x70}, {0x75, 0x68}, {0x76, 0x64}, {0x77, 0x50}, {0x78, 0x3c}, {0x79, 0x22}, {0x7a, 0x10}, {0x7b, 0x08}, {0x7c, 0x06}, {0x7d, 0x0e}, {0x7e, 0x1a}, {0x7f, 0x3a}, {0x80, 0x4a}, {0x81, 0x5a}, {0x82, 0x6b}, {0x83, 0x7b}, {0x84, 0x89}, {0x85, 0x96}, {0x86, 0xaf}, {0x87, 0xc3}, {0x88, 0xe1}, {0x89, 0xf2}, {0x8a, 0xfa}}, {{0x6c, 0x20}, {0x6d, 0x40}, {0x6e, 0x20}, {0x6f, 0x60}, {0x70, 0x88}, {0x71, 0xc8}, {0x72, 0xc0}, {0x73, 0xb8}, {0x74, 0xa8}, {0x75, 0xb8}, {0x76, 0x80}, {0x77, 0x5c}, {0x78, 0x26}, {0x79, 0x10}, {0x7a, 0x08}, {0x7b, 0x04}, {0x7c, 0x02}, {0x7d, 0x06}, {0x7e, 0x0a}, {0x7f, 0x22}, {0x80, 0x33}, {0x81, 0x4c}, {0x82, 0x64}, {0x83, 0x7b}, {0x84, 0x90}, {0x85, 0xa7}, {0x86, 0xc7}, {0x87, 0xde}, {0x88, 0xf1}, {0x89, 0xf9}, {0x8a, 0xfd}}, }; switch (sd->sensor) { case SEN_OV7610: case SEN_OV6620: i2c_w(sd, OV7610_REG_CNT, val); break; case SEN_OV6630: case SEN_OV66308AF: i2c_w_mask(sd, OV7610_REG_CNT, val >> 4, 0x0f); break; case SEN_OV8610: { static const u8 ctab[] = { 0x03, 0x09, 0x0b, 0x0f, 0x53, 0x6f, 0x35, 0x7f }; /* Use Y gamma control instead. Bit 0 enables it. */ i2c_w(sd, 0x64, ctab[val >> 5]); break; } case SEN_OV7620: case SEN_OV7620AE: { static const u8 ctab[] = { 0x01, 0x05, 0x09, 0x11, 0x15, 0x35, 0x37, 0x57, 0x5b, 0xa5, 0xa7, 0xc7, 0xc9, 0xcf, 0xef, 0xff }; /* Use Y gamma control instead. Bit 0 enables it. */ i2c_w(sd, 0x64, ctab[val >> 4]); break; } case SEN_OV7660: write_i2c_regvals(sd, contrast_7660[val], ARRAY_SIZE(contrast_7660[0])); break; case SEN_OV7670: /* check that this isn't just the same as ov7610 */ i2c_w(sd, OV7670_R56_CONTRAS, val >> 1); break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336859, "input": "rb_str_tr(VALUE str, VALUE src, VALUE repl) { str = rb_str_dup(str); tr_trans(str, src, repl, 0); return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325861, "input": "create_sconv_object(const char *fc, const char *tc, unsigned current_codepage, int flag) { struct archive_string_conv *sc; sc = calloc(1, sizeof(*sc)); if (sc == NULL) return (NULL); sc->next = NULL; sc->from_charset = strdup(fc); if (sc->from_charset == NULL) { free(sc); return (NULL); } sc->to_charset = strdup(tc); if (sc->to_charset == NULL) { free(sc->from_charset); free(sc); return (NULL); } archive_string_init(&sc->utftmp); if (flag & SCONV_TO_CHARSET) { /* * Convert characters from the current locale charset to * a specified charset. */ sc->from_cp = current_codepage; sc->to_cp = make_codepage_from_charset(tc); #if defined(_WIN32) && !defined(__CYGWIN__) if (IsValidCodePage(sc->to_cp)) flag |= SCONV_WIN_CP; #endif } else if (flag & SCONV_FROM_CHARSET) { /* * Convert characters from a specified charset to * the current locale charset. */ sc->to_cp = current_codepage; sc->from_cp = make_codepage_from_charset(fc); #if defined(_WIN32) && !defined(__CYGWIN__) if (IsValidCodePage(sc->from_cp)) flag |= SCONV_WIN_CP; #endif } /* * Check if \"from charset\" and \"to charset\" are the same. */ if (strcmp(fc, tc) == 0 || (sc->from_cp != (unsigned)-1 && sc->from_cp == sc->to_cp)) sc->same = 1; else sc->same = 0; /* * Mark if \"from charset\" or \"to charset\" are UTF-8 or UTF-16BE/LE. */ if (strcmp(tc, \"UTF-8\") == 0) flag |= SCONV_TO_UTF8; else if (strcmp(tc, \"UTF-16BE\") == 0) flag |= SCONV_TO_UTF16BE; else if (strcmp(tc, \"UTF-16LE\") == 0) flag |= SCONV_TO_UTF16LE; if (strcmp(fc, \"UTF-8\") == 0) flag |= SCONV_FROM_UTF8; else if (strcmp(fc, \"UTF-16BE\") == 0) flag |= SCONV_FROM_UTF16BE; else if (strcmp(fc, \"UTF-16LE\") == 0) flag |= SCONV_FROM_UTF16LE; #if defined(_WIN32) && !defined(__CYGWIN__) if (sc->to_cp == CP_UTF8) flag |= SCONV_TO_UTF8; else if (sc->to_cp == CP_UTF16BE) flag |= SCONV_TO_UTF16BE | SCONV_WIN_CP; else if (sc->to_cp == CP_UTF16LE) flag |= SCONV_TO_UTF16LE | SCONV_WIN_CP; if (sc->from_cp == CP_UTF8) flag |= SCONV_FROM_UTF8; else if (sc->from_cp == CP_UTF16BE) flag |= SCONV_FROM_UTF16BE | SCONV_WIN_CP; else if (sc->from_cp == CP_UTF16LE) flag |= SCONV_FROM_UTF16LE | SCONV_WIN_CP; #endif /* * Set a flag for Unicode NFD. Usually iconv cannot correctly * handle it. So we have to translate NFD characters to NFC ones * ourselves before iconv handles. Another reason is to prevent * that the same sight of two filenames, one is NFC and other * is NFD, would be in its directory. * On Mac OS X, although its filesystem layer automatically * convert filenames to NFD, it would be useful for filename * comparing to find out the same filenames that we normalize * that to be NFD ourselves. */ if ((flag & SCONV_FROM_CHARSET) && (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8))) { #if defined(__APPLE__) if (flag & SCONV_TO_UTF8) flag |= SCONV_NORMALIZATION_D; else #endif flag |= SCONV_NORMALIZATION_C; } #if defined(__APPLE__) /* * In case writing an archive file, make sure that a filename * going to be passed to iconv is a Unicode NFC string since * a filename in HFS Plus filesystem is a Unicode NFD one and * iconv cannot handle it with \"UTF-8\" charset. It is simpler * than a use of \"UTF-8-MAC\" charset. */ if ((flag & SCONV_TO_CHARSET) && (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) && !(flag & (SCONV_TO_UTF16 | SCONV_TO_UTF8))) flag |= SCONV_NORMALIZATION_C; /* * In case reading an archive file. make sure that a filename * will be passed to users is a Unicode NFD string in order to * correctly compare the filename with other one which comes * from HFS Plus filesystem. */ if ((flag & SCONV_FROM_CHARSET) && !(flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8)) && (flag & SCONV_TO_UTF8)) flag |= SCONV_NORMALIZATION_D; #endif #if defined(HAVE_ICONV) sc->cd_w = (iconv_t)-1; /* * Create an iconv object. */ if (((flag & (SCONV_TO_UTF8 | SCONV_TO_UTF16)) && (flag & (SCONV_FROM_UTF8 | SCONV_FROM_UTF16))) || (flag & SCONV_WIN_CP)) { /* This case we won't use iconv. */ sc->cd = (iconv_t)-1; } else { sc->cd = iconv_open(tc, fc); if (sc->cd == (iconv_t)-1 && (sc->flag & SCONV_BEST_EFFORT)) { /* * Unfortunately, all of iconv implements do support * \"CP932\" character-set, so we should use \"SJIS\" * instead if iconv_open failed. */ if (strcmp(tc, \"CP932\") == 0) sc->cd = iconv_open(\"SJIS\", fc); else if (strcmp(fc, \"CP932\") == 0) sc->cd = iconv_open(tc, \"SJIS\"); } #if defined(_WIN32) && !defined(__CYGWIN__) /* * archive_mstring on Windows directly convert multi-bytes * into archive_wstring in order not to depend on locale * so that you can do a I18N programming. This will be * used only in archive_mstring_copy_mbs_len_l so far. */ if (flag & SCONV_FROM_CHARSET) { sc->cd_w = iconv_open(\"UTF-8\", fc); if (sc->cd_w == (iconv_t)-1 && (sc->flag & SCONV_BEST_EFFORT)) { if (strcmp(fc, \"CP932\") == 0) sc->cd_w = iconv_open(\"UTF-8\", \"SJIS\"); } } #endif /* _WIN32 && !__CYGWIN__ */ } #endif /* HAVE_ICONV */ sc->flag = flag; /* * Set up converters. */ setup_converter(sc); return (sc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 386447, "input": "do_line_print_now(Dwarf_Debug dbg, int line_version, Dwarf_Small *comp_dir, Dwarf_Line_Context line_context) { dwarfstring m7; Dwarf_Unsigned i = 0; dwarfstring_constructor(&m7); dwarfstring_append_printf_i(&m7, \"total line info length %ld bytes,\", line_context->lc_total_length); dwarfstring_append_printf_u(&m7, \" line offset 0x%\" DW_PR_XZEROS DW_PR_DUx, line_context->lc_section_offset); dwarfstring_append_printf_u(&m7, \" %\" DW_PR_DUu \"\\n\", line_context->lc_section_offset); if (line_version <= DW_LINE_VERSION5) { dwarfstring_append_printf_i(&m7, \" line table version %d\\n\", (int) line_context->lc_version_number); } else { dwarfstring_append_printf_u(&m7, \" line table version 0x%x\\n\", (int) line_context->lc_version_number); } if (line_version == DW_LINE_VERSION5) { dwarfstring_append_printf_i(&m7, \" address size %d\\n\", line_context->lc_address_size); dwarfstring_append_printf_i(&m7, \" segment selector size %d\\n\", line_context->lc_segment_selector_size); } _dwarf_printf(dbg,dwarfstring_string(&m7)); dwarfstring_reset(&m7); dwarfstring_append_printf_i(&m7, \" line table length field length %d\\n\", line_context->lc_length_field_length); dwarfstring_append_printf_i(&m7, \" prologue length %d\\n\", line_context->lc_prologue_length); dwarfstring_append_printf_s(&m7, \" compilation_directory %s\\n\", comp_dir ? ((char *) comp_dir) : \"\"); dwarfstring_append_printf_i(&m7, \" min instruction length %d\\n\", line_context->lc_minimum_instruction_length); _dwarf_printf(dbg,dwarfstring_string(&m7)); dwarfstring_reset(&m7); if (line_version == DW_LINE_VERSION5 || line_version == DW_LINE_VERSION4 || line_version == EXPERIMENTAL_LINE_TABLES_VERSION) { dwarfstring_append_printf_u(&m7, \" maximum ops per instruction %u\\n\", line_context->lc_maximum_ops_per_instruction); _dwarf_printf(dbg,dwarfstring_string(&m7)); dwarfstring_reset(&m7); } if (line_version == EXPERIMENTAL_LINE_TABLES_VERSION) { dwarfstring_append_printf_u(&m7, \" actuals table offset \" \"0x%\" DW_PR_XZEROS DW_PR_DUx \"\\n\", line_context->lc_actuals_table_offset); dwarfstring_append_printf_u(&m7,\" logicals table offset \" \"0x%\" DW_PR_XZEROS DW_PR_DUx \"\\n\", line_context->lc_logicals_table_offset); _dwarf_printf(dbg,dwarfstring_string(&m7)); dwarfstring_reset(&m7); } dwarfstring_append_printf_i(&m7, \" default is stmt %d\\n\", (int)line_context->lc_default_is_stmt); dwarfstring_append_printf_i(&m7, \" line base %d\\n\", (int)line_context->lc_line_base); dwarfstring_append_printf_i(&m7, \" line_range %d\\n\", (int)line_context->lc_line_range); dwarfstring_append_printf_i(&m7, \" opcode base %d\\n\", (int)line_context->lc_opcode_base); dwarfstring_append_printf_i(&m7, \" standard opcode count %d\\n\", (int)line_context->lc_std_op_count); _dwarf_printf(dbg,dwarfstring_string(&m7)); dwarfstring_reset(&m7); for (i = 1; i < line_context->lc_opcode_base; i++) { dwarfstring_append_printf_i(&m7, \" opcode[%2d] length\", (int) i); dwarfstring_append_printf_i(&m7, \" %d\\n\", (int) line_context->lc_opcode_length_table[i - 1]); _dwarf_printf(dbg,dwarfstring_string(&m7)); dwarfstring_reset(&m7); } dwarfstring_destructor(&m7); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445724, "input": "static int tracing_trace_options_open(struct inode *inode, struct file *file) { struct trace_array *tr = inode->i_private; int ret; if (tracing_disabled) return -ENODEV; if (trace_array_get(tr) < 0) return -ENODEV; ret = single_open(file, tracing_trace_options_show, inode->i_private); if (ret < 0) trace_array_put(tr); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445571, "input": "tracing_free_buffer_release(struct inode *inode, struct file *filp) { struct trace_array *tr = inode->i_private; /* disable tracing ? */ if (tr->trace_flags & TRACE_ITER_STOP_ON_FREE) tracer_tracing_off(tr); /* resize the ring buffer to 0 */ tracing_resize_ring_buffer(tr, 0, RING_BUFFER_ALL_CPUS); trace_array_put(tr); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382051, "input": "void CServer::SendServerInfo(int ClientID) { CMsgPacker Msg(NETMSG_SERVERINFO, true); GenerateServerInfo(&Msg, -1); if(ClientID == -1) { for(int i = 0; i < MAX_CLIENTS; i++) { if(m_aClients[i].m_State != CClient::STATE_EMPTY) SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, i); } } else if(ClientID >= 0 && ClientID < MAX_CLIENTS && m_aClients[ClientID].m_State != CClient::STATE_EMPTY) SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202609, "input": "dissect_dnp3_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti, *tdl, *tc, *hidden_item; proto_tree *dnp3_tree, *dl_tree, *field_tree; int offset = 0, temp_offset = 0; gboolean dl_prm; guint8 dl_len, dl_ctl, dl_func; const gchar *func_code_str; guint16 dl_dst, dl_src, calc_dl_crc; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, \"DNP 3.0\"); col_clear(pinfo->cinfo, COL_INFO); /* Skip \"0x0564\" header bytes */ temp_offset += 2; dl_len = tvb_get_guint8(tvb, temp_offset); temp_offset += 1; dl_ctl = tvb_get_guint8(tvb, temp_offset); temp_offset += 1; dl_dst = tvb_get_letohs(tvb, temp_offset); temp_offset += 2; dl_src = tvb_get_letohs(tvb, temp_offset); dl_func = dl_ctl & DNP3_CTL_FUNC; dl_prm = dl_ctl & DNP3_CTL_PRM; func_code_str = val_to_str(dl_func, dl_prm ? dnp3_ctl_func_pri_vals : dnp3_ctl_func_sec_vals, \"Unknown function (0x%02x)\"); /* Make sure source and dest are always in the info column */ col_append_fstr(pinfo->cinfo, COL_INFO, \"from %u to %u\", dl_src, dl_dst); col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, \"len=%u, %s\", dl_len, func_code_str); /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_dnp3, tvb, offset, -1, ENC_NA); dnp3_tree = proto_item_add_subtree(ti, ett_dnp3); /* Create Subtree for Data Link Layer */ dl_tree = proto_tree_add_subtree_format(dnp3_tree, tvb, offset, DNP_HDR_LEN, ett_dnp3_dl, &tdl, \"Data Link Layer, Len: %u, From: %u, To: %u, \", dl_len, dl_src, dl_dst); if (dl_prm) { if (dl_ctl & DNP3_CTL_DIR) proto_item_append_text(tdl, \"DIR, \"); if (dl_ctl & DNP3_CTL_PRM) proto_item_append_text(tdl, \"PRM, \"); if (dl_ctl & DNP3_CTL_FCB) proto_item_append_text(tdl, \"FCB, \"); if (dl_ctl & DNP3_CTL_FCV) proto_item_append_text(tdl, \"FCV, \"); } else { if (dl_ctl & DNP3_CTL_DIR) proto_item_append_text(tdl, \"DIR, \"); if (dl_ctl & DNP3_CTL_PRM) proto_item_append_text(tdl, \"PRM, \"); if (dl_ctl & DNP3_CTL_RES) proto_item_append_text(tdl, \"RES, \"); if (dl_ctl & DNP3_CTL_DFC) proto_item_append_text(tdl, \"DFC, \"); } proto_item_append_text(tdl, \"%s\", func_code_str); /* start bytes */ proto_tree_add_item(dl_tree, hf_dnp3_start, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* add length field */ proto_tree_add_item(dl_tree, hf_dnp3_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* Add Control Byte Subtree */ tc = proto_tree_add_uint_format_value(dl_tree, hf_dnp3_ctl, tvb, offset, 1, dl_ctl, \"0x%02x (\", dl_ctl); /* Add Text to Control Byte Subtree Header */ if (dl_prm) { if (dl_ctl & DNP3_CTL_DIR) proto_item_append_text(tc, \"DIR, \"); if (dl_ctl & DNP3_CTL_PRM) proto_item_append_text(tc, \"PRM, \"); if (dl_ctl & DNP3_CTL_FCB) proto_item_append_text(tc, \"FCB, \"); if (dl_ctl & DNP3_CTL_FCV) proto_item_append_text(tc, \"FCV, \"); } else { if (dl_ctl & DNP3_CTL_DIR) proto_item_append_text(tc, \"DIR, \"); if (dl_ctl & DNP3_CTL_PRM) proto_item_append_text(tc, \"PRM, \"); if (dl_ctl & DNP3_CTL_RES) proto_item_append_text(tc, \"RES, \"); if (dl_ctl & DNP3_CTL_DFC) proto_item_append_text(tc, \"DFC, \"); } proto_item_append_text(tc, \"%s)\", func_code_str ); field_tree = proto_item_add_subtree(tc, ett_dnp3_dl_ctl); /* Add Control Byte Subtree Items */ if (dl_prm) { proto_tree_add_item(field_tree, hf_dnp3_ctl_dir, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_prm, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_fcb, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_fcv, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_prifunc, tvb, offset, 1, ENC_BIG_ENDIAN); } else { proto_tree_add_item(field_tree, hf_dnp3_ctl_dir, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_prm, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_dfc, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(field_tree, hf_dnp3_ctl_secfunc, tvb, offset, 1, ENC_BIG_ENDIAN); } offset += 1; /* add destination and source addresses */ proto_tree_add_item(dl_tree, hf_dnp3_dst, tvb, offset, 2, ENC_LITTLE_ENDIAN); hidden_item = proto_tree_add_item(dl_tree, hf_dnp3_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_item_set_hidden(hidden_item); offset += 2; proto_tree_add_item(dl_tree, hf_dnp3_src, tvb, offset, 2, ENC_LITTLE_ENDIAN); hidden_item = proto_tree_add_item(dl_tree, hf_dnp3_addr, tvb, offset, 2, ENC_LITTLE_ENDIAN); proto_item_set_hidden(hidden_item); offset += 2; /* and header CRC */ calc_dl_crc = calculateCRCtvb(tvb, 0, DNP_HDR_LEN - 2); proto_tree_add_checksum(dl_tree, tvb, offset, hf_dnp3_data_hdr_crc, hf_dnp3_data_hdr_crc_status, &ei_dnp3_data_hdr_crc_incorrect, pinfo, calc_dl_crc, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); offset += 2; /* If the DataLink function is 'Request Link Status' or 'Status of Link', or 'Reset Link' we don't expect any Transport or Application Layer Data NOTE: This code should probably check what DOES have TR or AL data */ if ((dl_func != DL_FUNC_LINK_STAT) && (dl_func != DL_FUNC_STAT_LINK) && (dl_func != DL_FUNC_RESET_LINK) && (dl_func != DL_FUNC_ACK)) { proto_tree *data_tree; proto_item *data_ti; guint8 tr_ctl, tr_seq; gboolean tr_fir, tr_fin; guint8 *al_buffer, *al_buffer_ptr; guint8 data_len; int data_start = offset; int tl_offset; gboolean crc_OK = FALSE; tvbuff_t *next_tvb; guint i; static int * const transport_flags[] = { &hf_dnp3_tr_fin, &hf_dnp3_tr_fir, &hf_dnp3_tr_seq, NULL }; /* get the transport layer byte */ tr_ctl = tvb_get_guint8(tvb, offset); tr_seq = tr_ctl & DNP3_TR_SEQ; tr_fir = tr_ctl & DNP3_TR_FIR; tr_fin = tr_ctl & DNP3_TR_FIN; /* Add Transport Layer Tree */ tc = proto_tree_add_bitmask(dnp3_tree, tvb, offset, hf_dnp3_tr_ctl, ett_dnp3_tr_ctl, transport_flags, ENC_BIG_ENDIAN); proto_item_append_text(tc, \"(\"); if (tr_fir) proto_item_append_text(tc, \"FIR, \"); if (tr_fin) proto_item_append_text(tc, \"FIN, \"); proto_item_append_text(tc, \"Sequence %u)\", tr_seq); /* Add data chunk tree */ data_tree = proto_tree_add_subtree(dnp3_tree, tvb, offset, -1, ett_dnp3_dl_data, &data_ti, \"Data Chunks\"); /* extract the application layer data, validating the CRCs */ /* XXX - check for dl_len <= 5 */ data_len = dl_len - 5; al_buffer = (guint8 *)wmem_alloc(pinfo->pool, data_len); al_buffer_ptr = al_buffer; i = 0; tl_offset = 1; /* skip the initial transport layer byte when assembling chunks for the application layer tvb */ while (data_len > 0) { guint8 chk_size; const guint8 *chk_ptr; proto_tree *chk_tree; proto_item *chk_len_ti; guint16 calc_crc, act_crc; chk_size = MIN(data_len, AL_MAX_CHUNK_SIZE); chk_ptr = tvb_get_ptr(tvb, offset, chk_size); memcpy(al_buffer_ptr, chk_ptr + tl_offset, chk_size - tl_offset); al_buffer_ptr += chk_size - tl_offset; chk_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, chk_size + 2, ett_dnp3_dl_chunk, NULL, \"Data Chunk: %u\", i); proto_tree_add_item(chk_tree, hf_dnp3_data_chunk, tvb, offset, chk_size, ENC_NA); chk_len_ti = proto_tree_add_uint(chk_tree, hf_dnp3_data_chunk_len, tvb, offset, 0, chk_size); proto_item_set_generated(chk_len_ti); offset += chk_size; calc_crc = calculateCRC(chk_ptr, chk_size); proto_tree_add_checksum(chk_tree, tvb, offset, hf_dnp3_data_chunk_crc, hf_dnp3_data_chunk_crc_status, &ei_dnp3_data_chunk_crc_incorrect, pinfo, calc_crc, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); act_crc = tvb_get_letohs(tvb, offset); offset += 2; crc_OK = calc_crc == act_crc; if (!crc_OK) { /* Don't trust the rest of the data, get out of here */ break; } data_len -= chk_size; i++; tl_offset = 0; /* copy all the data in the rest of the chunks */ } proto_item_set_len(data_ti, offset - data_start); /* if crc OK, set up new tvb */ if (crc_OK) { tvbuff_t *al_tvb; gboolean save_fragmented; al_tvb = tvb_new_child_real_data(tvb, al_buffer, (guint) (al_buffer_ptr-al_buffer), (gint) (al_buffer_ptr-al_buffer)); /* Check for fragmented packet */ save_fragmented = pinfo->fragmented; /* Reassemble AL fragments */ static guint al_max_fragments = 60; static guint al_fragment_aging = 64; /* sequence numbers only 6 bit */ fragment_head *frag_al = NULL; pinfo->fragmented = TRUE; if (!pinfo->fd->visited) { frag_al = fragment_add_seq_single_aging(&al_reassembly_table, al_tvb, 0, pinfo, tr_seq, NULL, tvb_reported_length(al_tvb), /* As this is a constructed tvb, all of it is ok */ tr_fir, tr_fin, al_max_fragments, al_fragment_aging); } else { frag_al = fragment_get_reassembled_id(&al_reassembly_table, pinfo, tr_seq); } next_tvb = process_reassembled_data(al_tvb, 0, pinfo, \"Reassembled DNP 3.0 Application Layer message\", frag_al, &dnp3_frag_items, NULL, dnp3_tree); if (frag_al) { if (pinfo->num == frag_al->reassembled_in && pinfo->curr_layer_num == frag_al->reas_in_layer_num) { /* As a complete AL message will have cleared the info column, make sure source and dest are always in the info column */ //col_append_fstr(pinfo->cinfo, COL_INFO, \"from %u to %u\", dl_src, dl_dst); //col_set_fence(pinfo->cinfo, COL_INFO); dissect_dnp3_al(next_tvb, pinfo, dnp3_tree); } else { /* Lock any column info set by the DL and TL */ col_set_fence(pinfo->cinfo, COL_INFO); col_append_fstr(pinfo->cinfo, COL_INFO, \" (Application Layer fragment %u, reassembled in packet %u)\", tr_seq, frag_al->reassembled_in); proto_tree_add_item(dnp3_tree, hf_al_frag_data, al_tvb, 0, -1, ENC_NA); } } else { col_append_fstr(pinfo->cinfo, COL_INFO, \" (Application Layer Unreassembled fragment %u)\", tr_seq); proto_tree_add_item(dnp3_tree, hf_al_frag_data, al_tvb, 0, -1, ENC_NA); } pinfo->fragmented = save_fragmented; } else { /* CRC error - throw away the data. */ next_tvb = NULL; } } /* Set the length of the message */ proto_item_set_len(ti, offset); return offset; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Loop with Unreachable Exit Condition ('Infinite Loop')"], "explanation": "Crash in DNP dissector in Wireshark 3.4.0 to 3.4.6 and 3.2.0 to 3.2.14 allows denial of service via packet injection or crafted capture file", "severity_level": "NoInfo", "cwe": "CWE-835", "cve": "CVE-2021-22235"}} -{"idx": 379430, "input": "get_bash_command (var) SHELL_VAR *var; { char *p; if (the_printed_command_except_trap) p = savestring (the_printed_command_except_trap); else { p = (char *)xmalloc (1); p[0] = '\\0'; } FREE (value_cell (var)); var_setvalue (var, p); return (var); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303448, "input": "gnutls_priority_init(gnutls_priority_t * priority_cache, const char *priorities, const char **err_pos) { char *broken_list[MAX_ELEMENTS]; int broken_list_size = 0, i = 0, j; char *darg = NULL; unsigned ikeyword_set = 0; int algo; rmadd_func *fn; bulk_rmadd_func *bulk_fn; bulk_rmadd_func *bulk_given_fn; const cipher_entry_st *centry; if (err_pos) *err_pos = priorities; *priority_cache = gnutls_calloc(1, sizeof(struct gnutls_priority_st)); if (*priority_cache == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } /* for now unsafe renegotiation is default on everyone. To be removed * when we make it the default. */ (*priority_cache)->sr = SR_PARTIAL; (*priority_cache)->min_record_version = 1; if (priorities == NULL) priorities = \"NORMAL\"; darg = resolve_priorities(priorities); if (darg == NULL) { gnutls_assert(); goto error; } break_list(darg, broken_list, &broken_list_size); /* This is our default set of protocol version, certificate types and * compression methods. */ if (strcasecmp(broken_list[0], LEVEL_NONE) != 0) { _set_priority(&(*priority_cache)->protocol, protocol_priority); _set_priority(&(*priority_cache)->compression, comp_priority); _set_priority(&(*priority_cache)->cert_type, cert_type_priority_default); _set_priority(&(*priority_cache)->sign_algo, sign_priority_default); _set_priority(&(*priority_cache)->supported_ecc, supported_ecc_normal); i = 0; } else { ikeyword_set = 1; i = 1; } for (; i < broken_list_size; i++) { if (check_level(broken_list[i], *priority_cache, ikeyword_set) != 0) { ikeyword_set = 1; continue; } else if (broken_list[i][0] == '!' || broken_list[i][0] == '+' || broken_list[i][0] == '-') { if (broken_list[i][0] == '+') { fn = prio_add; bulk_fn = _add_priority; bulk_given_fn = _add_priority; } else { fn = prio_remove; bulk_fn = _clear_priorities; bulk_given_fn = _clear_given_priorities; } if (broken_list[i][0] == '+' && check_level(&broken_list[i][1], *priority_cache, 1) != 0) { continue; } else if ((algo = gnutls_mac_get_id(&broken_list[i][1])) != GNUTLS_MAC_UNKNOWN) fn(&(*priority_cache)->mac, algo); else if ((centry = cipher_name_to_entry(&broken_list[i][1])) != NULL) { fn(&(*priority_cache)->cipher, centry->id); if (centry->type == CIPHER_BLOCK) (*priority_cache)->have_cbc = 1; } else if ((algo = gnutls_kx_get_id(&broken_list[i][1])) != GNUTLS_KX_UNKNOWN) fn(&(*priority_cache)->kx, algo); else if (strncasecmp (&broken_list[i][1], \"VERS-\", 5) == 0) { if (strncasecmp (&broken_list[i][1], \"VERS-TLS-ALL\", 12) == 0) { bulk_given_fn(&(*priority_cache)-> protocol, stream_protocol_priority); } else if (strncasecmp (&broken_list[i][1], \"VERS-DTLS-ALL\", 13) == 0) { bulk_given_fn(&(*priority_cache)-> protocol, (bulk_given_fn==_add_priority)?dtls_protocol_priority:dgram_protocol_priority); } else if (strncasecmp (&broken_list[i][1], \"VERS-ALL\", 8) == 0) { bulk_fn(&(*priority_cache)-> protocol, protocol_priority); } else { if ((algo = gnutls_protocol_get_id (&broken_list[i][6])) != GNUTLS_VERSION_UNKNOWN) fn(&(*priority_cache)-> protocol, algo); else goto error; } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], \"COMP-\", 5) == 0) { if (strncasecmp (&broken_list[i][1], \"COMP-ALL\", 8) == 0) { bulk_fn(&(*priority_cache)-> compression, comp_priority); } else { if ((algo = gnutls_compression_get_id (&broken_list[i][6])) != GNUTLS_COMP_UNKNOWN) fn(&(*priority_cache)-> compression, algo); else goto error; } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], \"CURVE-\", 6) == 0) { if (strncasecmp (&broken_list[i][1], \"CURVE-ALL\", 9) == 0) { bulk_fn(&(*priority_cache)-> supported_ecc, supported_ecc_normal); } else { if ((algo = gnutls_ecc_curve_get_id (&broken_list[i][7])) != GNUTLS_ECC_CURVE_INVALID) fn(&(*priority_cache)-> supported_ecc, algo); else goto error; } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], \"CTYPE-\", 6) == 0) { if (strncasecmp (&broken_list[i][1], \"CTYPE-ALL\", 9) == 0) { bulk_fn(&(*priority_cache)-> cert_type, cert_type_priority_all); } else { if ((algo = gnutls_certificate_type_get_id (&broken_list[i][7])) != GNUTLS_CRT_UNKNOWN) fn(&(*priority_cache)-> cert_type, algo); else goto error; } } /* now check if the element is something like -ALGO */ else if (strncasecmp (&broken_list[i][1], \"SIGN-\", 5) == 0) { if (strncasecmp (&broken_list[i][1], \"SIGN-ALL\", 8) == 0) { bulk_fn(&(*priority_cache)-> sign_algo, sign_priority_default); } else { if ((algo = gnutls_sign_get_id (&broken_list[i][6])) != GNUTLS_SIGN_UNKNOWN) fn(&(*priority_cache)-> sign_algo, algo); else goto error; } } else if (strncasecmp (&broken_list[i][1], \"MAC-ALL\", 7) == 0) { bulk_fn(&(*priority_cache)->mac, mac_priority_normal); } else if (strncasecmp (&broken_list[i][1], \"CIPHER-ALL\", 10) == 0) { bulk_fn(&(*priority_cache)->cipher, cipher_priority_normal); } else if (strncasecmp (&broken_list[i][1], \"KX-ALL\", 6) == 0) { bulk_fn(&(*priority_cache)->kx, kx_priority_secure); } else goto error; } else if (broken_list[i][0] == '%') { const struct priority_options_st * o; /* to add a new option modify * priority_options.gperf */ o = in_word_set(&broken_list[i][1], strlen(&broken_list[i][1])); if (o == NULL) { goto error; } o->func(*priority_cache); } else goto error; } free(darg); return 0; error: if (err_pos != NULL && i < broken_list_size) { *err_pos = priorities; for (j = 0; j < i; j++) { (*err_pos) += strlen(broken_list[j]) + 1; } } free(darg); gnutls_free(*priority_cache); *priority_cache = NULL; return GNUTLS_E_INVALID_REQUEST; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280724, "input": "check_DECAP(const struct ofpact_decap *a OVS_UNUSED, struct ofpact_check_params *cp) { struct flow *flow = &cp->match->flow; if (flow->packet_type == htonl(PT_ETH)) { /* Adjust the packet_type to allow subsequent actions. */ flow->packet_type = PACKET_TYPE_BE(OFPHTN_ETHERTYPE, ntohs(flow->dl_type)); } else { /* The actual packet_type is only known after decapsulation. * Do not allow subsequent actions that depend on packet headers. */ flow->packet_type = htonl(PT_UNKNOWN); flow->dl_type = OVS_BE16_MAX; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295112, "input": "static BOOL update_send_monitored_desktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, const MONITORED_DESKTOP_ORDER* monitoredDesktop) { UINT32 i; wStream* s; rdpUpdate* update = context->update; BYTE controlFlags = ORDER_SECONDARY | (ORDER_TYPE_WINDOW << 2); UINT16 orderSize = update_calculate_monitored_desktop(orderInfo, monitoredDesktop); update_check_flush(context, orderSize); s = update->us; if (!s) return FALSE; Stream_Write_UINT8(s, controlFlags); /* Header (1 byte) */ Stream_Write_UINT16(s, orderSize); /* OrderSize (2 bytes) */ Stream_Write_UINT32(s, orderInfo->fieldFlags); /* FieldsPresentFlags (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND) { Stream_Write_UINT32(s, monitoredDesktop->activeWindowId); /* activeWindowId (4 bytes) */ } if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER) { Stream_Write_UINT8(s, monitoredDesktop->numWindowIds); /* numWindowIds (1 byte) */ /* windowIds */ for (i = 0; i < monitoredDesktop->numWindowIds; i++) { Stream_Write_UINT32(s, monitoredDesktop->windowIds[i]); } } update->numberOrders++; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 322085, "input": "int pidfile_set(const char *pidfile) { g_pidfile = strdup(pidfile); if (!g_pidfile) { logprintf(STDERR_FILENO, \"Out of memory.\\n\"); return -1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 403805, "input": "static bool torture_smb2_notify_rmdir(struct torture_context *torture, struct smb2_tree *tree1, struct smb2_tree *tree2, bool initial_delete_on_close) { bool ret = true; NTSTATUS status; union smb_notify notify = {}; union smb_setfileinfo sfinfo = {}; union smb_open io = {}; struct smb2_handle h = {}; struct smb2_request *req; torture_comment(torture, \"TESTING NOTIFY CANCEL FOR DELETED DIR\\n\"); smb2_deltree(tree1, BASEDIR_RMD); smb2_util_rmdir(tree1, BASEDIR_RMD); ZERO_STRUCT(io.smb2); io.generic.level = RAW_OPEN_SMB2; io.smb2.in.create_flags = 0; io.smb2.in.desired_access = SEC_FILE_ALL; io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL; io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE ; io.smb2.in.alloc_size = 0; io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE; io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS; io.smb2.in.security_flags = 0; io.smb2.in.fname = BASEDIR_RMD; status = smb2_create(tree1, torture, &(io.smb2)); CHECK_STATUS(status, NT_STATUS_OK); h = io.smb2.out.file.handle; ZERO_STRUCT(notify.smb2); notify.smb2.level = RAW_NOTIFY_SMB2; notify.smb2.in.buffer_size = 1000; notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.smb2.in.file.handle = h; notify.smb2.in.recursive = false; io.smb2.in.desired_access |= SEC_STD_DELETE; io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN; req = smb2_notify_send(tree1, &(notify.smb2)); if (initial_delete_on_close) { status = smb2_util_rmdir(tree2, BASEDIR_RMD); CHECK_STATUS(status, NT_STATUS_OK); } else { status = smb2_create(tree2, torture, &(io.smb2)); CHECK_STATUS(status, NT_STATUS_OK); sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION; sfinfo.generic.in.file.handle = io.smb2.out.file.handle; sfinfo.disposition_info.in.delete_on_close = 1; status = smb2_setinfo_file(tree2, &sfinfo); CHECK_STATUS(status, NT_STATUS_OK); smb2_util_close(tree2, io.smb2.out.file.handle); } status = smb2_notify_recv(req, torture, &(notify.smb2)); CHECK_STATUS(status, NT_STATUS_DELETE_PENDING); done: smb2_util_close(tree1, h); smb2_deltree(tree1, BASEDIR_RMD); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197084, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& shape_tensor = ctx->input(0); const Tensor& means_tensor = ctx->input(1); const Tensor& stddevs_tensor = ctx->input(2); const Tensor& minvals_tensor = ctx->input(3); const Tensor& maxvals_tensor = ctx->input(4); OP_REQUIRES( ctx, TensorShapeUtils::IsVector(shape_tensor.shape()), errors::InvalidArgument(\"Input shape should be a vector, got shape: \", shape_tensor.shape().DebugString())); int32 num_batches = shape_tensor.flat()(0); int32 samples_per_batch = 1; const int32 num_dims = shape_tensor.dim_size(0); for (int32 i = 1; i < num_dims; i++) { samples_per_batch *= shape_tensor.flat()(i); } const int32 num_elements = num_batches * samples_per_batch; // Allocate the output before fudging num_batches and samples_per_batch. auto shape_vec = shape_tensor.flat(); TensorShape tensor_shape; OP_REQUIRES_OK(ctx, TensorShapeUtils::MakeShape( shape_vec.data(), shape_vec.size(), &tensor_shape)); Tensor* samples_tensor; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, tensor_shape, &samples_tensor)); // Parameters must be 0-d or 1-d. OP_REQUIRES(ctx, means_tensor.dims() <= 1, errors::InvalidArgument( \"Input means should be a scalar or vector, got shape: \", means_tensor.shape().DebugString())); OP_REQUIRES(ctx, stddevs_tensor.dims() <= 1, errors::InvalidArgument( \"Input stddevs should be a scalar or vector, got shape: \", stddevs_tensor.shape().DebugString())); OP_REQUIRES(ctx, minvals_tensor.dims() <= 1, errors::InvalidArgument( \"Input minvals should be a scalar or vector, got shape: \", minvals_tensor.shape().DebugString())); OP_REQUIRES(ctx, maxvals_tensor.dims() <= 1, errors::InvalidArgument( \"Input maxvals should be a scalar or vector, got shape: \", maxvals_tensor.shape().DebugString())); if ((means_tensor.dims() == 0 || means_tensor.dim_size(0) == 1) && (stddevs_tensor.dims() == 0 || stddevs_tensor.dim_size(0) == 1) && minvals_tensor.dims() == 0 && maxvals_tensor.dims() == 0) { // All batches have the same parameters, so we can update the batch size // to a reasonable value to improve parallelism (ensure enough batches, // and no very small batches which have high overhead). int32 size = num_batches * samples_per_batch; int32 adjusted_samples = kDesiredBatchSize; // Ensure adjusted_batches * adjusted_samples >= size. int32 adjusted_batches = Eigen::divup(size, adjusted_samples); num_batches = adjusted_batches; samples_per_batch = adjusted_samples; } else { // Parameters must be broadcastable to the shape [num_batches]. OP_REQUIRES( ctx, TensorShapeUtils::IsScalar(means_tensor.shape()) || means_tensor.dim_size(0) == 1 || means_tensor.dim_size(0) == num_batches, errors::InvalidArgument( \"Input means should have length 1 or shape[0], got shape: \", means_tensor.shape().DebugString())); OP_REQUIRES( ctx, TensorShapeUtils::IsScalar(stddevs_tensor.shape()) || stddevs_tensor.dim_size(0) == 1 || stddevs_tensor.dim_size(0) == num_batches, errors::InvalidArgument( \"Input stddevs should have length 1 or shape[0], got shape: \", stddevs_tensor.shape().DebugString())); OP_REQUIRES( ctx, TensorShapeUtils::IsScalar(minvals_tensor.shape()) || minvals_tensor.dim_size(0) == 1 || minvals_tensor.dim_size(0) == num_batches, errors::InvalidArgument( \"Input minvals should have length 1 or shape[0], got shape: \", minvals_tensor.shape().DebugString())); OP_REQUIRES( ctx, TensorShapeUtils::IsScalar(maxvals_tensor.shape()) || maxvals_tensor.dim_size(0) == 1 || maxvals_tensor.dim_size(0) == num_batches, errors::InvalidArgument( \"Input maxvals should have length 1 or shape[0], got shape: \", maxvals_tensor.shape().DebugString())); } auto truncFunctor = functor::TruncatedNormalFunctor(); // Each worker has the fudge factor for samples_per_batch, so use it here. random::PhiloxRandom rng = generator_.ReserveSamples128(num_batches * 2 * functor::kMaxIterations * (samples_per_batch + 3) / 4); truncFunctor(ctx, ctx->eigen_device(), num_batches, samples_per_batch, num_elements, means_tensor.flat(), stddevs_tensor.flat(), minvals_tensor.flat(), maxvals_tensor.flat(), rng, samples_tensor->flat()); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger undefined behavior by binding to null pointer in `tf.raw_ops.ParameterizedTruncatedNormal`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/3f6fe4dfef6f57e768260b48166c27d148f3015f/tensorflow/core/kernels/parameterized_truncated_normal_op.cc#L630) does not validate input arguments before accessing the first element of `shape`. If `shape` argument is empty, then `shape_tensor.flat()` is an empty array. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-29568"}} -{"idx": 244718, "input": "static void** cdeque_filter_p(struct filter_info** f) { return (void**) (size_t) f; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219638, "input": "bool HHVM_FUNCTION(socket_bind, const Resource& socket, const String& address, int port /* = 0 */) { auto sock = cast(socket); sockaddr_storage sa_storage; struct sockaddr *sa_ptr; size_t sa_size; if (!set_sockaddr(sa_storage, sock, address, port, sa_ptr, sa_size)) { return false; } long retval = ::bind(sock->fd(), sa_ptr, sa_size); if (retval != 0) { std::string msg = \"unable to bind address\"; msg += address.data(); msg += \":\"; msg += folly::to(port); SOCKET_ERROR(sock, msg.c_str(), errno); return false; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370070, "input": "ExpressionObject::ExpressionObject(ExpressionContext* const expCtx, std::vector> _children, vector&>>&& expressions) : Expression(expCtx, std::move(_children)), _expressions(std::move(expressions)) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410412, "input": "int mnt_context_umount(struct libmnt_context *cxt) { int rc; struct libmnt_ns *ns_old; assert(cxt); assert(cxt->fs); assert(cxt->helper_exec_status == 1); assert(cxt->syscall_status == 1); DBG(CXT, ul_debugobj(cxt, \"umount: %s\", mnt_context_get_target(cxt))); ns_old = mnt_context_switch_target_ns(cxt); if (!ns_old) return -MNT_ERR_NAMESPACE; rc = mnt_context_prepare_umount(cxt); if (!rc) rc = mnt_context_prepare_update(cxt); if (!rc) rc = mnt_context_do_umount(cxt); if (!rc) rc = mnt_context_update_tabs(cxt); if (!mnt_context_switch_ns(cxt, ns_old)) return -MNT_ERR_NAMESPACE; return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409948, "input": "static void tcp_undo_cwr(struct sock *sk, const bool undo_ssthresh) { struct tcp_sock *tp = tcp_sk(sk); if (tp->prior_ssthresh) { const struct inet_connection_sock *icsk = inet_csk(sk); if (icsk->icsk_ca_ops->undo_cwnd) tp->snd_cwnd = icsk->icsk_ca_ops->undo_cwnd(sk); else tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh << 1); if (undo_ssthresh && tp->prior_ssthresh > tp->snd_ssthresh) { tp->snd_ssthresh = tp->prior_ssthresh; TCP_ECN_withdraw_cwr(tp); } } else { tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh); } tp->snd_cwnd_stamp = tcp_time_stamp; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270701, "input": "cardos_decipher(struct sc_card *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen) { cardos_data_t* priv = (cardos_data_t*)card->drv_data; int r; size_t card_max_send_size = card->max_send_size; size_t reader_max_send_size = card->reader->max_send_size; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); /* 5.3 supports command chaining. Others may also * card_max_send_size for 5.3 is already based on reader max_send_size */ if (card->type == SC_CARD_TYPE_CARDOS_V5_0 || card->type == SC_CARD_TYPE_CARDOS_V5_3) { r = iso_ops->decipher(card, crgram, crgram_len, out, outlen); /* * 5.3 supports RAW as well as PKCS1 and PSS * description may strip padding if card supports it * with cards that support RAW, it always appears to * drop first 00 that is start of padding. */ if (r > 0 && priv->sec_env->algorithm_flags & SC_ALGORITHM_RSA_RAW) { size_t rsize = r; /* RSA RAW crgram_len == modlen */ /* removed padding is always > 1 byte */ /* add back missing leading zero if card dropped it */ if (rsize == crgram_len - 1 && rsize < outlen) { memmove(out+1, out, rsize); out[0] =0x00; r++; } } SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); } if (sc_get_max_send_size(card) < crgram_len + 1) { /* CardOS doesn't support chaining for PSO:DEC, so we just _hope_ * that both, the reader and the card are able to send enough data. * (data is prefixed with 1 byte padding content indicator) */ card->max_send_size = crgram_len + 1; card->reader->max_send_size = crgram_len + 1; } r = iso_ops->decipher(card, crgram, crgram_len, out, outlen); /* reset whatever we've modified above */ card->max_send_size = card_max_send_size; card->reader->max_send_size = reader_max_send_size; SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431276, "input": "static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, struct nfs_open_context *ctx, struct nfs4_lock_state *lsp, gfp_t gfp_mask) { struct nfs4_lockdata *p; struct inode *inode = lsp->ls_state->inode; struct nfs_server *server = NFS_SERVER(inode); struct nfs_seqid *(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t); p = kzalloc(sizeof(*p), gfp_mask); if (p == NULL) return NULL; p->arg.fh = NFS_FH(inode); p->arg.fl = &p->fl; p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid, gfp_mask); if (IS_ERR(p->arg.open_seqid)) goto out_free; alloc_seqid = server->nfs_client->cl_mvops->alloc_seqid; p->arg.lock_seqid = alloc_seqid(&lsp->ls_seqid, gfp_mask); if (IS_ERR(p->arg.lock_seqid)) goto out_free_seqid; p->arg.lock_owner.clientid = server->nfs_client->cl_clientid; p->arg.lock_owner.id = lsp->ls_seqid.owner_id; p->arg.lock_owner.s_dev = server->s_dev; p->res.lock_seqid = p->arg.lock_seqid; p->lsp = lsp; p->server = server; p->ctx = get_nfs_open_context(ctx); locks_init_lock(&p->fl); locks_copy_lock(&p->fl, fl); return p; out_free_seqid: nfs_free_seqid(p->arg.open_seqid); out_free: kfree(p); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 236232, "input": "void NativeModule::InitForContext(Isolate* isolate, Local context, Local target) { init(isolate, context, target); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 264823, "input": "GF_Err stts_box_read(GF_Box *s, GF_BitStream *bs) { u32 i; GF_TimeToSampleBox *ptr = (GF_TimeToSampleBox *)s; #ifndef GPAC_DISABLE_ISOM_WRITE ptr->w_LastDTS = 0; #endif ISOM_DECREASE_SIZE(ptr, 4); ptr->nb_entries = gf_bs_read_u32(bs); if (ptr->size < ptr->nb_entries * 8) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Invalid number of entries %d in stts\\n\", ptr->nb_entries)); return GF_ISOM_INVALID_FILE; } ptr->alloc_size = ptr->nb_entries; ptr->entries = gf_malloc(sizeof(GF_SttsEntry)*ptr->alloc_size); if (!ptr->entries) return GF_OUT_OF_MEM; for (i=0; inb_entries; i++) { ptr->entries[i].sampleCount = gf_bs_read_u32(bs); ptr->entries[i].sampleDelta = gf_bs_read_u32(bs); #ifndef GPAC_DISABLE_ISOM_WRITE ptr->w_currentSampleNum += ptr->entries[i].sampleCount; ptr->w_LastDTS += (u64)ptr->entries[i].sampleCount * ptr->entries[i].sampleDelta; #endif if (ptr->max_ts_deltaentries[i].sampleDelta) ptr->max_ts_delta = ptr->entries[i].sampleDelta; if (!ptr->entries[i].sampleDelta) { if ((i+1nb_entries) ) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[iso file] Found stts entry with sample_delta=0 - forbidden ! Fixing to 1\\n\" )); ptr->entries[i].sampleDelta = 1; } else if (ptr->entries[i].sampleCount>1) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[iso file] more than one stts entry at the end of the track with sample_delta=0 - forbidden ! Fixing to 1\\n\" )); ptr->entries[i].sampleDelta = 1; } } else if ((s32) ptr->entries[i].sampleDelta < 0) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[iso file] stts entry %d has negative duration %d - forbidden ! Fixing to 1, sync may get lost (consider reimport raw media)\\n\", i, (s32) ptr->entries[i].sampleDelta )); ptr->entries[i].sampleDelta = 1; } } if (ptr->size<(ptr->nb_entries*8)) return GF_ISOM_INVALID_FILE; ISOM_DECREASE_SIZE(ptr, ptr->nb_entries*8); //remove the last sample delta. #ifndef GPAC_DISABLE_ISOM_WRITE if (ptr->nb_entries) ptr->w_LastDTS -= ptr->entries[ptr->nb_entries-1].sampleDelta; #endif return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431159, "input": "static bool nfs4_update_lock_stateid(struct nfs4_lock_state *lsp, const nfs4_stateid *stateid) { struct nfs4_state *state = lsp->ls_state; bool ret = false; spin_lock(&state->state_lock); if (!nfs4_stateid_match_other(stateid, &lsp->ls_stateid)) goto out_noupdate; if (!nfs4_stateid_is_newer(stateid, &lsp->ls_stateid)) goto out_noupdate; nfs4_stateid_copy(&lsp->ls_stateid, stateid); ret = true; out_noupdate: spin_unlock(&state->state_lock); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394170, "input": "static __be32 nf_expect_get_id(const struct nf_conntrack_expect *exp) { static __read_mostly siphash_key_t exp_id_seed; unsigned long a, b, c, d; net_get_random_once(&exp_id_seed, sizeof(exp_id_seed)); a = (unsigned long)exp; b = (unsigned long)exp->helper; c = (unsigned long)exp->master; d = (unsigned long)siphash(&exp->tuple, sizeof(exp->tuple), &exp_id_seed); #ifdef CONFIG_64BIT return (__force __be32)siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &exp_id_seed); #else return (__force __be32)siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &exp_id_seed); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357392, "input": "static OPJ_BOOL opj_j2k_add_tlmarker(OPJ_UINT32 tileno, opj_codestream_index_t *cstr_index, OPJ_UINT32 type, OPJ_OFF_T pos, OPJ_UINT32 len) { assert(cstr_index != 00); assert(cstr_index->tile_index != 00); /* expand the list? */ if ((cstr_index->tile_index[tileno].marknum + 1) > cstr_index->tile_index[tileno].maxmarknum) { opj_marker_info_t *new_marker; cstr_index->tile_index[tileno].maxmarknum = (OPJ_UINT32)(100 + (OPJ_FLOAT32) cstr_index->tile_index[tileno].maxmarknum); new_marker = (opj_marker_info_t *) opj_realloc( cstr_index->tile_index[tileno].marker, cstr_index->tile_index[tileno].maxmarknum * sizeof(opj_marker_info_t)); if (! new_marker) { opj_free(cstr_index->tile_index[tileno].marker); cstr_index->tile_index[tileno].marker = NULL; cstr_index->tile_index[tileno].maxmarknum = 0; cstr_index->tile_index[tileno].marknum = 0; /* opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to add tl marker\\n\"); */ return OPJ_FALSE; } cstr_index->tile_index[tileno].marker = new_marker; } /* add the marker */ cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].type = (OPJ_UINT16)type; cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].pos = (OPJ_INT32)pos; cstr_index->tile_index[tileno].marker[cstr_index->tile_index[tileno].marknum].len = (OPJ_INT32)len; cstr_index->tile_index[tileno].marknum++; if (type == J2K_MS_SOT) { OPJ_UINT32 l_current_tile_part = cstr_index->tile_index[tileno].current_tpsno; if (cstr_index->tile_index[tileno].tp_index) { cstr_index->tile_index[tileno].tp_index[l_current_tile_part].start_pos = pos; } } return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357365, "input": "static void opj_j2k_read_float32_to_int32(const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem) { OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data; OPJ_INT32 * l_dest_data = (OPJ_INT32 *) p_dest_data; OPJ_UINT32 i; OPJ_FLOAT32 l_temp; for (i = 0; i < p_nb_elem; ++i) { opj_read_float(l_src_data, &l_temp); l_src_data += sizeof(OPJ_FLOAT32); *(l_dest_data++) = (OPJ_INT32) l_temp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432005, "input": "static void hci_cc_le_set_adv_set_random_addr(struct hci_dev *hdev, struct sk_buff *skb) { __u8 status = *((__u8 *) skb->data); struct hci_cp_le_set_adv_set_rand_addr *cp; struct adv_info *adv_instance; if (status) return; cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_ADV_SET_RAND_ADDR); if (!cp) return; hci_dev_lock(hdev); if (!hdev->cur_adv_instance) { /* Store in hdev for instance 0 (Set adv and Directed advs) */ bacpy(&hdev->random_addr, &cp->bdaddr); } else { adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance); if (adv_instance) bacpy(&adv_instance->random_addr, &cp->bdaddr); } hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402177, "input": "static int bcf_record_check(const bcf_hdr_t *hdr, bcf1_t *rec) { uint8_t *ptr, *end; size_t bytes; uint32_t err = 0; int type = 0; int num = 0; int reflen = 0; uint32_t i, reports; const uint32_t is_integer = ((1 << BCF_BT_INT8) | (1 << BCF_BT_INT16) | #ifdef VCF_ALLOW_INT64 (1 << BCF_BT_INT64) | #endif (1 << BCF_BT_INT32)); const uint32_t is_valid_type = (is_integer | (1 << BCF_BT_NULL) | (1 << BCF_BT_FLOAT) | (1 << BCF_BT_CHAR)); int32_t max_id = hdr ? hdr->n[BCF_DT_ID] : 0; // Check for valid contig ID if (rec->rid < 0 || (hdr && (rec->rid >= hdr->n[BCF_DT_CTG] || hdr->id[BCF_DT_CTG][rec->rid].key == NULL))) { hts_log_warning(\"Bad BCF record at %\"PRIhts_pos\": Invalid %s id %d\", rec->pos+1, \"CONTIG\", rec->rid); err |= BCF_ERR_CTG_INVALID; } // Check ID ptr = (uint8_t *) rec->shared.s; end = ptr + rec->shared.l; if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared; if (type != BCF_BT_CHAR) { hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"ID\", type, get_type_name(type)); err |= BCF_ERR_TAG_INVALID; } bytes = (size_t) num << bcf_type_shift[type]; if (end - ptr < bytes) goto bad_shared; ptr += bytes; // Check REF and ALT reports = 0; for (i = 0; i < rec->n_allele; i++) { if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared; if (type != BCF_BT_CHAR) { if (!reports++ || hts_verbose >= HTS_LOG_DEBUG) hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"REF/ALT\", type, get_type_name(type)); err |= BCF_ERR_CHAR; } if (i == 0) reflen = num; bytes = (size_t) num << bcf_type_shift[type]; if (end - ptr < bytes) goto bad_shared; ptr += bytes; } // Check FILTER reports = 0; if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared; if (num > 0) { bytes = (size_t) num << bcf_type_shift[type]; if (((1 << type) & is_integer) == 0) { hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FILTER\", type, get_type_name(type)); err |= BCF_ERR_TAG_INVALID; if (end - ptr < bytes) goto bad_shared; ptr += bytes; } else { if (end - ptr < bytes) goto bad_shared; for (i = 0; i < num; i++) { int32_t key = bcf_dec_int1(ptr, type, &ptr); if (key < 0 || (hdr && (key >= max_id || hdr->id[BCF_DT_ID][key].key == NULL))) { if (!reports++ || hts_verbose >= HTS_LOG_DEBUG) hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s id %d\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FILTER\", key); err |= BCF_ERR_TAG_UNDEF; } } } } // Check INFO reports = 0; for (i = 0; i < rec->n_info; i++) { int32_t key = -1; if (bcf_dec_typed_int1_safe(ptr, end, &ptr, &key) != 0) goto bad_shared; if (key < 0 || (hdr && (key >= max_id || hdr->id[BCF_DT_ID][key].key == NULL))) { if (!reports++ || hts_verbose >= HTS_LOG_DEBUG) hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s id %d\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"INFO\", key); err |= BCF_ERR_TAG_UNDEF; } if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared; if (((1 << type) & is_valid_type) == 0) { if (!reports++ || hts_verbose >= HTS_LOG_DEBUG) hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"INFO\", type, get_type_name(type)); err |= BCF_ERR_TAG_INVALID; } bytes = (size_t) num << bcf_type_shift[type]; if (end - ptr < bytes) goto bad_shared; ptr += bytes; } // Check FORMAT and individual information ptr = (uint8_t *) rec->indiv.s; end = ptr + rec->indiv.l; reports = 0; for (i = 0; i < rec->n_fmt; i++) { int32_t key = -1; if (bcf_dec_typed_int1_safe(ptr, end, &ptr, &key) != 0) goto bad_indiv; if (key < 0 || (hdr && (key >= max_id || hdr->id[BCF_DT_ID][key].key == NULL))) { if (!reports++ || hts_verbose >= HTS_LOG_DEBUG) hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s id %d\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FORMAT\", key); err |= BCF_ERR_TAG_UNDEF; } if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_indiv; if (((1 << type) & is_valid_type) == 0) { if (!reports++ || hts_verbose >= HTS_LOG_DEBUG) hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FORMAT\", type, get_type_name(type)); err |= BCF_ERR_TAG_INVALID; } bytes = ((size_t) num << bcf_type_shift[type]) * rec->n_sample; if (end - ptr < bytes) goto bad_indiv; ptr += bytes; } if (!err && rec->rlen < 0) { // Treat bad rlen as a warning instead of an error, and try to // fix up by using the length of the stored REF allele. static int warned = 0; if (!warned) { hts_log_warning(\"BCF record at %s:%\"PRIhts_pos\" has invalid RLEN (%\"PRIhts_pos\"). \" \"Only one invalid RLEN will be reported.\", bcf_seqname_safe(hdr,rec), rec->pos+1, rec->rlen); warned = 1; } rec->rlen = reflen >= 0 ? reflen : 0; } rec->errcode |= err; return err ? -2 : 0; // Return -2 so bcf_read() reports an error bad_shared: hts_log_error(\"Bad BCF record at %s:%\"PRIhts_pos\" - shared section malformed or too short\", bcf_seqname_safe(hdr,rec), rec->pos+1); return -2; bad_indiv: hts_log_error(\"Bad BCF record at %s:%\"PRIhts_pos\" - individuals section malformed or too short\", bcf_seqname_safe(hdr,rec), rec->pos+1); return -2; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246295, "input": "static APR_INLINE int do_double_reverse (int double_reverse, const char *remote_host, apr_sockaddr_t *client_addr, apr_pool_t *pool) { apr_sockaddr_t *sa; apr_status_t rv; if (double_reverse) { /* already done */ return double_reverse; } if (remote_host == NULL || remote_host[0] == '\\0') { /* single reverse failed, so don't bother */ return -1; } rv = apr_sockaddr_info_get(&sa, remote_host, APR_UNSPEC, 0, 0, pool); if (rv == APR_SUCCESS) { while (sa) { if (apr_sockaddr_equal(sa, client_addr)) { return 1; } sa = sa->next; } } return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508516, "input": "static bool get_range_limit_read_cost(const JOIN_TAB *tab, const TABLE *table, uint keynr, ha_rows rows_limit, double *read_time) { bool res= false; /* We need to adjust the estimates if we had a quick select (or ref(const)) on index keynr. */ if (table->quick_keys.is_set(keynr)) { /* Start from quick select's rows and cost. These are always cheaper than full index scan/cost. */ double best_rows= (double)table->quick_rows[keynr]; double best_cost= (double)table->quick_costs[keynr]; /* Check if ref(const) access was possible on this index. */ if (tab) { key_part_map map= 1; uint kp; /* Find how many key parts would be used by ref(const) */ for (kp=0; kp < MAX_REF_PARTS; map=map << 1, kp++) { if (!(table->const_key_parts[keynr] & map)) break; } if (kp > 0) { ha_rows ref_rows; /* Two possible cases: 1. ref(const) uses the same #key parts as range access. 2. ref(const) uses fewer key parts, becasue there is a range_cond(key_part+1). */ if (kp == table->quick_key_parts[keynr]) ref_rows= table->quick_rows[keynr]; else ref_rows= (ha_rows) table->key_info[keynr].actual_rec_per_key(kp-1); if (ref_rows > 0) { double tmp= (double)ref_rows; /* Reuse the cost formula from best_access_path: */ set_if_smaller(tmp, (double) tab->join->thd->variables.max_seeks_for_key); if (table->covering_keys.is_set(keynr)) tmp= table->file->keyread_time(keynr, 1, (ha_rows) tmp); else tmp= table->file->read_time(keynr, 1, (ha_rows) MY_MIN(tmp,tab->worst_seeks)); if (tmp < best_cost) { best_cost= tmp; best_rows= (double)ref_rows; } } } } if (best_rows > rows_limit) { /* LIMIT clause specifies that we will need to read fewer records than quick select will return. Assume that quick select's cost is proportional to the number of records we need to return (e.g. if we only need 1/3rd of records, it will cost us 1/3rd of quick select's read time) */ best_cost *= rows_limit / best_rows; } *read_time= best_cost; res= true; } return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 313006, "input": "read_string_decrypt(bufinfo_T *bi, int len) { char_u *ptr = alloc((unsigned)len + 1); if (ptr != NULL) { if (len > 0 && undo_read(bi, ptr, len) == FAIL) { vim_free(ptr); return NULL; } ptr[len] = NUL; #ifdef FEAT_CRYPT if (bi->bi_state != NULL && bi->bi_buffer == NULL) crypt_decode_inplace(bi->bi_state, ptr, len); #endif } return ptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468983, "input": "int ip_send_skb(struct net *net, struct sk_buff *skb) { int err; err = ip_local_out(net, skb->sk, skb); if (err) { if (err > 0) err = net_xmit_errno(err); if (err) IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); } return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509087, "input": "inline void Item_sp_variable::make_field(THD *thd, Send_field *field) { Item *it= this_item(); if (name) it->set_name(thd, name, (uint) strlen(name), system_charset_info); else it->set_name(thd, m_name.str, (uint) m_name.length, system_charset_info); it->make_field(thd, field); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207218, "input": "void LibRaw::parseSonySRF(unsigned len) { if ((len > 0xfffff) || (len == 0)) return; INT64 save = ftell(ifp); INT64 offset = 0x0310c0 - save; /* for non-DNG this value normally is 0x8ddc */ if (len < offset || offset < 0) return; INT64 decrypt_len = offset >> 2; /* master key offset value is the next un-encrypted metadata field after SRF0 */ unsigned i, nWB; unsigned MasterKey, SRF2Key, RawDataKey; INT64 srf_offset, tag_offset, tag_data, tag_dataoffset; int tag_dataunitlen; uchar *srf_buf; short entries; unsigned tag_id, tag_type, tag_datalen; srf_buf = (uchar *)malloc(len); fread(srf_buf, len, 1, ifp); offset += srf_buf[offset] << 2; #define CHECKBUFFER_SGET4(offset) \\ do \\ { \\ if ((((offset) + 4) > len) || ((offset) < 0)) \\ goto restore_after_parseSonySRF; \\ } while (0) #define CHECKBUFFER_SGET2(offset) \\ do \\ { \\ if ( ((offset + 2) > len) || ((offset) < 0)) \\ goto restore_after_parseSonySRF; \\ } while (0) CHECKBUFFER_SGET4(offset); /* master key is stored in big endian */ MasterKey = ((unsigned)srf_buf[offset] << 24) | ((unsigned)srf_buf[offset + 1] << 16) | ((unsigned)srf_buf[offset + 2] << 8) | (unsigned)srf_buf[offset + 3]; /* skip SRF0 */ srf_offset = 0; CHECKBUFFER_SGET2(srf_offset); entries = sget2(srf_buf + srf_offset); if (entries > 1000) goto restore_after_parseSonySRF; offset = srf_offset + 2; CHECKBUFFER_SGET4(offset); CHECKBUFFER_SGET4(offset + 12 * entries); srf_offset = sget4(srf_buf + offset + 12 * entries) - save; /* SRF0 ends with SRF1 abs. position */ /* get SRF1, it has fixed 40 bytes length and contains keys to decode metadata * and raw data */ if (srf_offset < 0 || decrypt_len < srf_offset / 4) goto restore_after_parseSonySRF; sony_decrypt((unsigned *)(srf_buf + srf_offset), decrypt_len - srf_offset / 4, 1, MasterKey); CHECKBUFFER_SGET2(srf_offset); entries = sget2(srf_buf + srf_offset); if (entries > 1000) goto restore_after_parseSonySRF; offset = srf_offset + 2; tag_offset = offset; while (entries--) { if (tiff_sget (save, srf_buf, len, &tag_offset, &tag_id, &tag_type, &tag_dataoffset, &tag_datalen, &tag_dataunitlen) == 0) { if (tag_id == 0x0000) { SRF2Key = sget4(srf_buf + tag_dataoffset); } else if (tag_id == 0x0001) { RawDataKey = sget4(srf_buf + tag_dataoffset); } } else goto restore_after_parseSonySRF; } offset = tag_offset; /* get SRF2 */ CHECKBUFFER_SGET4(offset); srf_offset = sget4(srf_buf + offset) - save; /* SRFn ends with SRFn+1 position */ if (srf_offset < 0 || decrypt_len < srf_offset / 4) goto restore_after_parseSonySRF; sony_decrypt((unsigned *)(srf_buf + srf_offset), decrypt_len - srf_offset / 4, 1, SRF2Key); CHECKBUFFER_SGET2(srf_offset); entries = sget2(srf_buf + srf_offset); if (entries > 1000) goto restore_after_parseSonySRF; offset = srf_offset + 2; tag_offset = offset; while (entries--) { if (tiff_sget (save, srf_buf, len, &tag_offset, &tag_id, &tag_type, &tag_dataoffset, &tag_datalen, &tag_dataunitlen) == 0) { if ((tag_id >= 0x00c0) && (tag_id <= 0x00ce)) { i = (tag_id - 0x00c0) % 3; nWB = (tag_id - 0x00c0) / 3; icWBC[Sony_SRF_wb_list[nWB]][i] = sget4(srf_buf + tag_dataoffset); if (i == 1) { icWBC[Sony_SRF_wb_list[nWB]][3] = icWBC[Sony_SRF_wb_list[nWB]][i]; } } else if ((tag_id >= 0x00d0) && (tag_id <= 0x00d2)) { i = (tag_id - 0x00d0) % 3; cam_mul[i] = sget4(srf_buf + tag_dataoffset); if (i == 1) { cam_mul[3] = cam_mul[i]; } } else switch (tag_id) { /* 0x0002 SRF6Offset 0x0003 SRFDataOffset (?) 0x0004 RawDataOffset 0x0005 RawDataLength */ case 0x0043: ilm.MaxAp4MaxFocal = sgetreal(tag_type, srf_buf + tag_dataoffset); break; case 0x0044: ilm.MaxAp4MinFocal = sgetreal(tag_type, srf_buf + tag_dataoffset); break; case 0x0045: ilm.MinFocal = sgetreal(tag_type, srf_buf + tag_dataoffset); break; case 0x0046: ilm.MaxFocal = sgetreal(tag_type, srf_buf + tag_dataoffset); break; } } else goto restore_after_parseSonySRF; } offset = tag_offset; restore_after_parseSonySRF: free(srf_buf); fseek(ifp, save, SEEK_SET); #undef CHECKBUFFER_SGET4 #undef CHECKBUFFER_SGET2 }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In LibRaw, there is an out-of-bounds read vulnerability within the \"LibRaw::parseSonySRF()\" function (libraw\\src\\metadata\\sony.cpp) when processing srf files.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-35535"}} -{"idx": 477345, "input": "static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio, int kern) { struct sock *sk; sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto, kern); if (!sk) return NULL; sock_init_data(sock, sk); INIT_LIST_HEAD(&bt_sk(sk)->accept_q); sk->sk_destruct = sco_sock_destruct; sk->sk_sndtimeo = SCO_CONN_TIMEOUT; sock_reset_flag(sk, SOCK_ZAPPED); sk->sk_protocol = proto; sk->sk_state = BT_OPEN; sco_pi(sk)->setting = BT_VOICE_CVSD_16BIT; timer_setup(&sk->sk_timer, sco_sock_timeout, 0); bt_sock_link(&sco_sk_list, sk); return sk; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 374057, "input": "STATIC void GC_init_explicit_typing(void) { unsigned i; GC_STATIC_ASSERT(sizeof(struct LeafDescriptor) % sizeof(word) == 0); /* Set up object kind with simple indirect descriptor. */ GC_eobjfreelist = (ptr_t *)GC_new_free_list_inner(); GC_explicit_kind = GC_new_kind_inner( (void **)GC_eobjfreelist, (WORDS_TO_BYTES((word)-1) | GC_DS_PER_OBJECT), TRUE, TRUE); /* Descriptors are in the last word of the object. */ GC_typed_mark_proc_index = GC_new_proc_inner(GC_typed_mark_proc); /* Set up object kind with array descriptor. */ GC_array_mark_proc_index = GC_new_proc_inner(GC_array_mark_proc); GC_array_kind = GC_new_kind_inner(GC_new_free_list_inner(), GC_MAKE_PROC(GC_array_mark_proc_index, 0), FALSE, TRUE); GC_bm_table[0] = GC_DS_BITMAP; for (i = 1; i < WORDSZ/2; i++) { GC_bm_table[i] = (((word)-1) << (WORDSZ - i)) | GC_DS_BITMAP; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412008, "input": "update_src_rect(ImageRef *ref, Image *img) { // The src rect in OpenGL co-ords [0, 1] with origin at top-left corner of image ref->src_rect.left = (float)ref->src_x / (float)img->width; ref->src_rect.right = (float)(ref->src_x + ref->src_width) / (float)img->width; ref->src_rect.top = (float)ref->src_y / (float)img->height; ref->src_rect.bottom = (float)(ref->src_y + ref->src_height) / (float)img->height; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281291, "input": "int RGWPutObj_ObjStore_S3::get_encrypt_filter( std::unique_ptr* filter, RGWPutObjDataProcessor* cb) { int res = 0; RGWPutObjProcessor_Multipart* multi_processor=dynamic_cast(cb); if (multi_processor != nullptr) { RGWMPObj* mp = nullptr; multi_processor->get_mp(&mp); if (mp != nullptr) { map xattrs; string meta_oid; meta_oid = mp->get_meta(); rgw_obj obj; obj.init_ns(s->bucket, meta_oid, RGW_OBJ_NS_MULTIPART); obj.set_in_extra_data(true); res = get_obj_attrs(store, s, obj, xattrs); if (res == 0) { std::unique_ptr block_crypt; /* We are adding to existing object. * We use crypto mode that configured as if we were decrypting. */ res = rgw_s3_prepare_decrypt(s, xattrs, &block_crypt, crypt_http_responses); if (res == 0 && block_crypt != nullptr) *filter = std::unique_ptr( new RGWPutObj_BlockEncrypt(s->cct, cb, std::move(block_crypt))); } } /* it is ok, to not have encryption at all */ } else { std::unique_ptr block_crypt; res = rgw_s3_prepare_encrypt(s, attrs, nullptr, &block_crypt, crypt_http_responses); if (res == 0 && block_crypt != nullptr) { *filter = std::unique_ptr( new RGWPutObj_BlockEncrypt(s->cct, cb, std::move(block_crypt))); } } return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342146, "input": "static void fuse_sync_writes(struct inode *inode) { fuse_set_nowrite(inode); fuse_release_nowrite(inode); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421503, "input": "processor_errfd(struct io *io, int evt, void *arg) { const char *name = arg; char *line = NULL; ssize_t len; switch (evt) { case IO_DATAIN: while ((line = io_getline(io, &len)) != NULL) log_warnx(\"%s: %s\", name, line); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303101, "input": "int blosc_compcode_to_compname(int compcode, const char** compname) { int code = -1; /* -1 means non-existent compressor code */ const char* name = NULL; /* Map the compressor code */ if (compcode == BLOSC_BLOSCLZ) name = BLOSC_BLOSCLZ_COMPNAME; else if (compcode == BLOSC_LZ4) name = BLOSC_LZ4_COMPNAME; else if (compcode == BLOSC_LZ4HC) name = BLOSC_LZ4HC_COMPNAME; else if (compcode == BLOSC_LIZARD) name = BLOSC_LIZARD_COMPNAME; else if (compcode == BLOSC_SNAPPY) name = BLOSC_SNAPPY_COMPNAME; else if (compcode == BLOSC_ZLIB) name = BLOSC_ZLIB_COMPNAME; else if (compcode == BLOSC_ZSTD) name = BLOSC_ZSTD_COMPNAME; *compname = name; /* Guess if there is support for this code */ if (compcode == BLOSC_BLOSCLZ) code = BLOSC_BLOSCLZ; #if defined(HAVE_LZ4) else if (compcode == BLOSC_LZ4) code = BLOSC_LZ4; else if (compcode == BLOSC_LZ4HC) code = BLOSC_LZ4HC; #endif /* HAVE_LZ4 */ #if defined(HAVE_LIZARD) else if (compcode == BLOSC_LIZARD) code = BLOSC_LIZARD; #endif /* HAVE_LIZARD */ #if defined(HAVE_SNAPPY) else if (compcode == BLOSC_SNAPPY) code = BLOSC_SNAPPY; #endif /* HAVE_SNAPPY */ #if defined(HAVE_ZLIB) else if (compcode == BLOSC_ZLIB) code = BLOSC_ZLIB; #endif /* HAVE_ZLIB */ #if defined(HAVE_ZSTD) else if (compcode == BLOSC_ZSTD) code = BLOSC_ZSTD; #endif /* HAVE_ZSTD */ return code; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383175, "input": "MagickExport Image *DistortResizeImage(const Image *image,const size_t columns, const size_t rows,ExceptionInfo *exception) { #define DistortResizeImageTag \"Distort/Image\" Image *resize_image, *tmp_image; RectangleInfo crop_area; double distort_args[12]; VirtualPixelMethod vp_save; /* Distort resize image. */ assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if ((columns == 0) || (rows == 0)) return((Image *) NULL); /* Do not short-circuit this resize if final image size is unchanged */ (void) memset(distort_args,0,sizeof(distort_args)); distort_args[4]=(double) image->columns; distort_args[6]=(double) columns; distort_args[9]=(double) image->rows; distort_args[11]=(double) rows; vp_save=GetImageVirtualPixelMethod(image); tmp_image=CloneImage(image,0,0,MagickTrue,exception); if (tmp_image == (Image *) NULL) return((Image *) NULL); (void) SetImageVirtualPixelMethod(tmp_image,TransparentVirtualPixelMethod, exception); if (image->alpha_trait == UndefinedPixelTrait) { /* Image has no alpha channel, so we are free to use it. */ (void) SetImageAlphaChannel(tmp_image,SetAlphaChannel,exception); resize_image=DistortImage(tmp_image,AffineDistortion,12,distort_args, MagickTrue,exception), tmp_image=DestroyImage(tmp_image); if (resize_image == (Image *) NULL) return((Image *) NULL); (void) SetImageAlphaChannel(resize_image,OffAlphaChannel,exception); } else { /* Image has transparency so handle colors and alpha separatly. Basically we need to separate Virtual-Pixel alpha in the resized image, so only the actual original images alpha channel is used. distort alpha channel separately */ Image *resize_alpha; (void) SetImageAlphaChannel(tmp_image,ExtractAlphaChannel,exception); (void) SetImageAlphaChannel(tmp_image,OpaqueAlphaChannel,exception); resize_alpha=DistortImage(tmp_image,AffineDistortion,12,distort_args, MagickTrue,exception), tmp_image=DestroyImage(tmp_image); if (resize_alpha == (Image *) NULL) return((Image *) NULL); /* distort the actual image containing alpha + VP alpha */ tmp_image=CloneImage(image,0,0,MagickTrue,exception); if (tmp_image == (Image *) NULL) return((Image *) NULL); (void) SetImageVirtualPixelMethod(tmp_image, TransparentVirtualPixelMethod,exception); resize_image=DistortImage(tmp_image,AffineDistortion,12,distort_args, MagickTrue,exception), tmp_image=DestroyImage(tmp_image); if (resize_image == (Image *) NULL) { resize_alpha=DestroyImage(resize_alpha); return((Image *) NULL); } /* replace resize images alpha with the separally distorted alpha */ (void) SetImageAlphaChannel(resize_image,OffAlphaChannel,exception); (void) SetImageAlphaChannel(resize_alpha,OffAlphaChannel,exception); (void) CompositeImage(resize_image,resize_alpha,CopyAlphaCompositeOp, MagickTrue,0,0,exception); resize_alpha=DestroyImage(resize_alpha); resize_image->alpha_trait=image->alpha_trait; resize_image->compose=image->compose; } (void) SetImageVirtualPixelMethod(resize_image,vp_save,exception); /* Clean up the results of the Distortion */ crop_area.width=columns; crop_area.height=rows; crop_area.x=0; crop_area.y=0; tmp_image=resize_image; resize_image=CropImage(tmp_image,&crop_area,exception); tmp_image=DestroyImage(tmp_image); if (resize_image != (Image *) NULL) { resize_image->page.width=0; resize_image->page.height=0; } return(resize_image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437549, "input": "static inline int __kvm_irq_line_state(unsigned long *irq_state, int irq_source_id, int level) { /* Logical OR for level trig interrupt */ if (level) __set_bit(irq_source_id, irq_state); else __clear_bit(irq_source_id, irq_state); return !!(*irq_state); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402207, "input": "static int bcf_hdr_add_sample_len(bcf_hdr_t *h, const char *s, size_t len) { if ( !s ) return 0; if (len == 0) len = strlen(s); const char *ss = s; while ( *ss && isspace_c(*ss) && ss - s < len) ss++; if ( !*ss || ss - s == len) { hts_log_error(\"Empty sample name: trailing spaces/tabs in the header line?\"); return -1; } vdict_t *d = (vdict_t*)h->dict[BCF_DT_SAMPLE]; int ret; char *sdup = malloc(len + 1); if (!sdup) return -1; memcpy(sdup, s, len); sdup[len] = 0; // Ensure space is available in h->samples size_t n = kh_size(d); char **new_samples = realloc(h->samples, sizeof(char*) * (n + 1)); if (!new_samples) { free(sdup); return -1; } h->samples = new_samples; int k = kh_put(vdict, d, sdup, &ret); if (ret < 0) { free(sdup); return -1; } if (ret) { // absent kh_val(d, k) = bcf_idinfo_def; kh_val(d, k).id = n; } else { hts_log_error(\"Duplicated sample name '%s'\", s); free(sdup); return -1; } h->samples[n] = sdup; h->dirty = 1; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506508, "input": "read_line(const char *prompt, int start) { int more; char expand_prompt[40]; current_prompt = prompt; /* HBB NEW 20040727 */ prompt_desc.dsc$w_length = strlen(prompt); prompt_desc.dsc$a_pointer = (char *) prompt; strcpy(expand_prompt, \"_\"); strncat(expand_prompt, prompt, sizeof(expand_prompt) - 2); do { line_desc.dsc$w_length = MAX_LINE_LEN - start; line_desc.dsc$a_pointer = &gp_input_line[start]; switch (status[1] = smg$read_composed_line(&vms_vkid, &vms_ktid, &line_desc, &prompt_desc, &vms_len)) { case SMG$_EOF: done(EXIT_SUCCESS); /* ^Z isn't really an error */ break; case RMS$_TNS: /* didn't press return in time */ vms_len--; /* skip the last character */ break; /* and parse anyway */ case RMS$_BES: /* Bad Escape Sequence */ case RMS$_PES: /* Partial Escape Sequence */ sys$putmsg(status); vms_len = 0; /* ignore the line */ break; case SS$_NORMAL: break; /* everything's fine */ default: done(status[1]); /* give the error message */ } start += vms_len; gp_input_line[start] = NUL; inline_num++; if (gp_input_line[start - 1] == '\\\\') { /* Allow for a continuation line. */ prompt_desc.dsc$w_length = strlen(expand_prompt); prompt_desc.dsc$a_pointer = expand_prompt; more = 1; --start; } else { line_desc.dsc$w_length = strlen(gp_input_line); line_desc.dsc$a_pointer = gp_input_line; more = 0; } } while (more); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490338, "input": "static int utf8_encoded_to_unichar(const char *str) { int unichar; int len; int i; len = utf8_encoded_expected_len(str); switch (len) { case 1: return (int)str[0]; case 2: unichar = str[0] & 0x1f; break; case 3: unichar = (int)str[0] & 0x0f; break; case 4: unichar = (int)str[0] & 0x07; break; case 5: unichar = (int)str[0] & 0x03; break; case 6: unichar = (int)str[0] & 0x01; break; default: return -1; } for (i = 1; i < len; i++) { if (((int)str[i] & 0xc0) != 0x80) return -1; unichar <<= 6; unichar |= (int)str[i] & 0x3f; } return unichar; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 411988, "input": "W(set_send_to_gpu) { send_to_gpu = PyObject_IsTrue(args) ? true : false; Py_RETURN_NONE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273003, "input": "SWFInput_input_eof(SWFInput input) { return input->offset >= input->length; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268816, "input": "R_API int r_sys_signal(int sig, void (*handler) (int)) { int s[2] = { sig, 0 }; return r_sys_sigaction (s, handler); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268815, "input": "R_API void r_str_range_foreach(const char *r, RStrRangeCallback cb, void *u) { const char *p = r; for (; *r; r++) { if (*r == ',') { cb (u, atoi (p)); p = r + 1; } if (*r == '-') { if (p != r) { int from = atoi (p); int to = atoi (r + 1); for (; from <= to; from++) { cb (u, from); } } else { fprintf (stderr, \"Invalid range\\n\"); } for (r++; *r && *r != ',' && *r != '-'; r++) { ; } p = r; } } if (*p) { cb (u, atoi (p)); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394623, "input": "void lj_trace_flushproto(global_State *g, GCproto *pt) { while (pt->trace != 0) trace_flushroot(G2J(g), traceref(G2J(g), pt->trace)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 245427, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& input = ctx->input(0); Tensor* output = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output)); // One global scale. Tensor input_min_tensor(DataTypeToEnum::value, TensorShape()); Tensor input_max_tensor(DataTypeToEnum::value, TensorShape()); // Initialize the tensors with the values in the Attrs. input_min_tensor.template scalar()() = static_cast(input_min_); input_max_tensor.template scalar()() = static_cast(input_max_); functor::QuantizeAndDequantizeOneScaleFunctor functor; functor(ctx->eigen_device(), input.flat(), signed_input_, num_bits_, range_given_, &input_min_tensor, &input_max_tensor, ROUND_HALF_TO_EVEN, /*narrow_range=*/false, output->flat()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215589, "input": "long keyctl_session_to_parent(void) { #ifdef TIF_NOTIFY_RESUME struct task_struct *me, *parent; const struct cred *mycred, *pcred; struct cred *cred, *oldcred; key_ref_t keyring_r; int ret; keyring_r = lookup_user_key(KEY_SPEC_SESSION_KEYRING, 0, KEY_LINK); if (IS_ERR(keyring_r)) return PTR_ERR(keyring_r); /* our parent is going to need a new cred struct, a new tgcred struct * and new security data, so we allocate them here to prevent ENOMEM in * our parent */ ret = -ENOMEM; cred = cred_alloc_blank(); if (!cred) goto error_keyring; cred->tgcred->session_keyring = key_ref_to_ptr(keyring_r); keyring_r = NULL; me = current; write_lock_irq(&tasklist_lock); parent = me->real_parent; ret = -EPERM; /* the parent mustn't be init and mustn't be a kernel thread */ if (parent->pid <= 1 || !parent->mm) goto not_permitted; /* the parent must be single threaded */ if (!thread_group_empty(parent)) goto not_permitted; /* the parent and the child must have different session keyrings or * there's no point */ mycred = current_cred(); pcred = __task_cred(parent); if (mycred == pcred || mycred->tgcred->session_keyring == pcred->tgcred->session_keyring) goto already_same; /* the parent must have the same effective ownership and mustn't be * SUID/SGID */ if (pcred->uid != mycred->euid || pcred->euid != mycred->euid || pcred->suid != mycred->euid || pcred->gid != mycred->egid || pcred->egid != mycred->egid || pcred->sgid != mycred->egid) goto not_permitted; /* the keyrings must have the same UID */ if (pcred->tgcred->session_keyring->uid != mycred->euid || mycred->tgcred->session_keyring->uid != mycred->euid) goto not_permitted; /* if there's an already pending keyring replacement, then we replace * that */ oldcred = parent->replacement_session_keyring; /* the replacement session keyring is applied just prior to userspace * restarting */ parent->replacement_session_keyring = cred; cred = NULL; set_ti_thread_flag(task_thread_info(parent), TIF_NOTIFY_RESUME); write_unlock_irq(&tasklist_lock); if (oldcred) put_cred(oldcred); return 0; already_same: ret = 0; not_permitted: write_unlock_irq(&tasklist_lock); put_cred(cred); return ret; error_keyring: key_ref_put(keyring_r); return ret; #else /* !TIF_NOTIFY_RESUME */ /* * To be removed when TIF_NOTIFY_RESUME has been implemented on * m68k/xtensa */ #warning TIF_NOTIFY_RESUME not implemented return -EOPNOTSUPP; #endif /* !TIF_NOTIFY_RESUME */ }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "The keyctl_session_to_parent function in security/keys/keyctl.c in the Linux kernel 2.6.35.4 and earlier expects that a certain parent session keyring exists, which allows local users to cause a denial of service (NULL pointer dereference and system crash) or possibly have unspecified other impact via a KEYCTL_SESSION_TO_PARENT argument to the keyctl function.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2010-2960"}} -{"idx": 269722, "input": "void WebContents::RemoveWorkSpace(gin_helper::Arguments* args, const base::FilePath& path) { if (path.empty()) { args->ThrowError(\"path cannot be empty\"); return; } DevToolsRemoveFileSystem(path); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 201892, "input": "long uv__idna_toascii(const char* s, const char* se, char* d, char* de) { const char* si; const char* st; unsigned c; char* ds; int rc; ds = d; for (si = s; si < se; /* empty */) { st = si; c = uv__utf8_decode1(&si, se); if (c != '.') if (c != 0x3002) /* \u3002 */ if (c != 0xFF0E) /* \uff0e */ if (c != 0xFF61) /* \uff61 */ continue; rc = uv__idna_toascii_label(s, st, &d, de); if (rc < 0) return rc; if (d < de) *d++ = '.'; s = si; } if (s < se) { rc = uv__idna_toascii_label(s, se, &d, de); if (rc < 0) return rc; } if (d < de) *d++ = '\\0'; return d - ds; /* Number of bytes written. */ }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "Node.js before 16.4.1, 14.17.2, 12.22.2 is vulnerable to an out-of-bounds read when uv__idna_toascii() is used to convert strings to ASCII. The pointer p is read and increased without checking whether it is beyond pe, with the latter holding a pointer to the end of the buffer. This can lead to information disclosures or crashes. This function can be triggered via uv_getaddrinfo().", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-22918"}} -{"idx": 509041, "input": "bool str_eq(const String *value, const String *other, CHARSET_INFO *cs, bool binary_cmp) const { return binary_cmp ? value->bin_eq(other) : collation.collation == cs && value->eq(other, collation.collation); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430281, "input": "virSecuritySELinuxGetProcessLabel(virSecurityManager *mgr G_GNUC_UNUSED, virDomainDef *def G_GNUC_UNUSED, pid_t pid, virSecurityLabelPtr sec) { char *ctx; if (getpidcon_raw(pid, &ctx) == -1) { virReportSystemError(errno, _(\"unable to get PID %d security context\"), pid); return -1; } if (virStrcpy(sec->label, ctx, VIR_SECURITY_LABEL_BUFLEN) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _(\"security label exceeds \" \"maximum length: %d\"), VIR_SECURITY_LABEL_BUFLEN - 1); freecon(ctx); return -1; } freecon(ctx); VIR_DEBUG(\"label=%s\", sec->label); sec->enforcing = security_getenforce(); if (sec->enforcing == -1) { virReportSystemError(errno, \"%s\", _(\"error calling security_getenforce()\")); return -1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 473456, "input": "char* crypto_cert_fingerprint_by_hash(X509* xcert, const char* hash) { UINT32 fp_len, i; BYTE* fp; char* p; char* fp_buffer; fp = crypto_cert_hash(xcert, hash, &fp_len); if (!fp) return NULL; fp_buffer = calloc(fp_len * 3 + 1, sizeof(char)); if (!fp_buffer) goto fail; p = fp_buffer; for (i = 0; i < (fp_len - 1); i++) { sprintf_s(p, (fp_len - i) * 3, \"%02\" PRIx8 \":\", fp[i]); p = &fp_buffer[(i + 1) * 3]; } sprintf_s(p, (fp_len - i) * 3, \"%02\" PRIx8 \"\", fp[i]); fail: free(fp); return fp_buffer; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354499, "input": "static void kvm_init_debug(void) { struct kvm_stats_debugfs_item *p; kvm_debugfs_dir = debugfs_create_dir(\"kvm\", NULL); kvm_debugfs_num_entries = 0; for (p = debugfs_entries; p->name; ++p, kvm_debugfs_num_entries++) { debugfs_create_file(p->name, KVM_DBGFS_GET_MODE(p), kvm_debugfs_dir, (void *)(long)p->offset, stat_fops[p->kind]); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402239, "input": "int bcf_update_info(const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const void *values, int n, int type) { static int negative_rlen_warned = 0; int is_end_tag; // Is the field already present? int i, inf_id = bcf_hdr_id2int(hdr,BCF_DT_ID,key); if ( !bcf_hdr_idinfo_exists(hdr,BCF_HL_INFO,inf_id) ) return -1; // No such INFO field in the header if ( !(line->unpacked & BCF_UN_INFO) ) bcf_unpack(line, BCF_UN_INFO); is_end_tag = strcmp(key, \"END\") == 0; for (i=0; in_info; i++) if ( inf_id==line->d.info[i].key ) break; bcf_info_t *inf = i==line->n_info ? NULL : &line->d.info[i]; if ( !n || (type==BCF_HT_STR && !values) ) { if ( n==0 && is_end_tag ) line->rlen = line->n_allele ? strlen(line->d.allele[0]) : 0; if ( inf ) { // Mark the tag for removal, free existing memory if necessary if ( inf->vptr_free ) { free(inf->vptr - inf->vptr_off); inf->vptr_free = 0; } line->d.shared_dirty |= BCF1_DIRTY_INF; inf->vptr = NULL; inf->vptr_off = inf->vptr_len = 0; } return 0; } if (is_end_tag) { if (n != 1) { hts_log_error(\"END info tag should only have one value at %s:%\"PRIhts_pos, bcf_seqname_safe(hdr,line), line->pos+1); line->errcode |= BCF_ERR_TAG_INVALID; return -1; } if (type != BCF_HT_INT && type != BCF_HT_LONG) { hts_log_error(\"Wrong type (%d) for END info tag at %s:%\"PRIhts_pos, type, bcf_seqname_safe(hdr,line), line->pos+1); line->errcode |= BCF_ERR_TAG_INVALID; return -1; } } // Encode the values and determine the size required to accommodate the values kstring_t str = {0,0,0}; bcf_enc_int1(&str, inf_id); if ( type==BCF_HT_INT ) bcf_enc_vint(&str, n, (int32_t*)values, -1); else if ( type==BCF_HT_REAL ) bcf_enc_vfloat(&str, n, (float*)values); else if ( type==BCF_HT_FLAG || type==BCF_HT_STR ) { if ( values==NULL ) bcf_enc_size(&str, 0, BCF_BT_NULL); else bcf_enc_vchar(&str, strlen((char*)values), (char*)values); } #ifdef VCF_ALLOW_INT64 else if ( type==BCF_HT_LONG ) { if (n != 1) { hts_log_error(\"Only storing a single BCF_HT_LONG value is supported at %s:%\"PRIhts_pos, bcf_seqname_safe(hdr,line), line->pos+1); abort(); } bcf_enc_long1(&str, *(int64_t *) values); } #endif else { hts_log_error(\"The type %d not implemented yet at %s:%\"PRIhts_pos, type, bcf_seqname_safe(hdr,line), line->pos+1); abort(); } // Is the INFO tag already present if ( inf ) { // Is it big enough to accommodate new block? if ( str.l <= inf->vptr_len + inf->vptr_off ) { if ( str.l != inf->vptr_len + inf->vptr_off ) line->d.shared_dirty |= BCF1_DIRTY_INF; uint8_t *ptr = inf->vptr - inf->vptr_off; memcpy(ptr, str.s, str.l); free(str.s); int vptr_free = inf->vptr_free; bcf_unpack_info_core1(ptr, inf); inf->vptr_free = vptr_free; } else { if ( inf->vptr_free ) free(inf->vptr - inf->vptr_off); bcf_unpack_info_core1((uint8_t*)str.s, inf); inf->vptr_free = 1; line->d.shared_dirty |= BCF1_DIRTY_INF; } } else { // The tag is not present, create new one line->n_info++; hts_expand0(bcf_info_t, line->n_info, line->d.m_info , line->d.info); inf = &line->d.info[line->n_info-1]; bcf_unpack_info_core1((uint8_t*)str.s, inf); inf->vptr_free = 1; line->d.shared_dirty |= BCF1_DIRTY_INF; } line->unpacked |= BCF_UN_INFO; if ( n==1 && is_end_tag) { hts_pos_t end = type == BCF_HT_INT ? *(int32_t *) values : *(int64_t *) values; if ( (type == BCF_HT_INT && end!=bcf_int32_missing) || (type == BCF_HT_LONG && end!=bcf_int64_missing) ) { if ( end <= line->pos ) { if ( !negative_rlen_warned ) { hts_log_warning(\"INFO/END=%\"PRIhts_pos\" is smaller than POS at %s:%\"PRIhts_pos,end,bcf_seqname_safe(hdr,line),line->pos+1); negative_rlen_warned = 1; } line->rlen = line->n_allele ? strlen(line->d.allele[0]) : 0; } else line->rlen = end - line->pos; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244693, "input": "static int read_bits_16(struct rar5* rar, const uint8_t* p, uint16_t* value) { int bits = (int) ((uint32_t) p[rar->bits.in_addr]) << 16; bits |= (int) p[rar->bits.in_addr + 1] << 8; bits |= (int) p[rar->bits.in_addr + 2]; bits >>= (8 - rar->bits.bit_addr); *value = bits & 0xffff; return ARCHIVE_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364107, "input": "static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) { bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG; u32 chunk_size = mr->chunk_size, headroom = mr->headroom; unsigned int chunks, chunks_per_page; u64 addr = mr->addr, size = mr->len; int err; if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) { /* Strictly speaking we could support this, if: * - huge pages, or* * - using an IOMMU, or * - making sure the memory area is consecutive * but for now, we simply say \"computer says no\". */ return -EINVAL; } if (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG | XDP_UMEM_USES_NEED_WAKEUP)) return -EINVAL; if (!unaligned_chunks && !is_power_of_2(chunk_size)) return -EINVAL; if (!PAGE_ALIGNED(addr)) { /* Memory area has to be page size aligned. For * simplicity, this might change. */ return -EINVAL; } if ((addr + size) < addr) return -EINVAL; chunks = (unsigned int)div_u64(size, chunk_size); if (chunks == 0) return -EINVAL; if (!unaligned_chunks) { chunks_per_page = PAGE_SIZE / chunk_size; if (chunks < chunks_per_page || chunks % chunks_per_page) return -EINVAL; } if (headroom >= chunk_size - XDP_PACKET_HEADROOM) return -EINVAL; umem->address = (unsigned long)addr; umem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK : ~((u64)chunk_size - 1); umem->size = size; umem->headroom = headroom; umem->chunk_size_nohr = chunk_size - headroom; umem->npgs = size / PAGE_SIZE; umem->pgs = NULL; umem->user = NULL; umem->flags = mr->flags; INIT_LIST_HEAD(&umem->xsk_list); spin_lock_init(&umem->xsk_list_lock); refcount_set(&umem->users, 1); err = xdp_umem_account_pages(umem); if (err) return err; err = xdp_umem_pin_pages(umem); if (err) goto out_account; umem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages), GFP_KERNEL_ACCOUNT); if (!umem->pages) { err = -ENOMEM; goto out_pin; } err = xdp_umem_map_pages(umem); if (!err) return 0; kvfree(umem->pages); out_pin: xdp_umem_unpin_pages(umem); out_account: xdp_umem_unaccount_pages(umem); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204533, "input": "void stralgoLCS(client *c) { uint32_t i, j; long long minmatchlen = 0; sds a = NULL, b = NULL; int getlen = 0, getidx = 0, withmatchlen = 0; robj *obja = NULL, *objb = NULL; for (j = 2; j < (uint32_t)c->argc; j++) { char *opt = c->argv[j]->ptr; int moreargs = (c->argc-1) - j; if (!strcasecmp(opt,\"IDX\")) { getidx = 1; } else if (!strcasecmp(opt,\"LEN\")) { getlen = 1; } else if (!strcasecmp(opt,\"WITHMATCHLEN\")) { withmatchlen = 1; } else if (!strcasecmp(opt,\"MINMATCHLEN\") && moreargs) { if (getLongLongFromObjectOrReply(c,c->argv[j+1],&minmatchlen,NULL) != C_OK) goto cleanup; if (minmatchlen < 0) minmatchlen = 0; j++; } else if (!strcasecmp(opt,\"STRINGS\") && moreargs > 1) { if (a != NULL) { addReplyError(c,\"Either use STRINGS or KEYS\"); goto cleanup; } a = c->argv[j+1]->ptr; b = c->argv[j+2]->ptr; j += 2; } else if (!strcasecmp(opt,\"KEYS\") && moreargs > 1) { if (a != NULL) { addReplyError(c,\"Either use STRINGS or KEYS\"); goto cleanup; } obja = lookupKeyRead(c->db,c->argv[j+1]); objb = lookupKeyRead(c->db,c->argv[j+2]); if ((obja && obja->type != OBJ_STRING) || (objb && objb->type != OBJ_STRING)) { addReplyError(c, \"The specified keys must contain string values\"); /* Don't cleanup the objects, we need to do that * only after callign getDecodedObject(). */ obja = NULL; objb = NULL; goto cleanup; } obja = obja ? getDecodedObject(obja) : createStringObject(\"\",0); objb = objb ? getDecodedObject(objb) : createStringObject(\"\",0); a = obja->ptr; b = objb->ptr; j += 2; } else { addReply(c,shared.syntaxerr); goto cleanup; } } /* Complain if the user passed ambiguous parameters. */ if (a == NULL) { addReplyError(c,\"Please specify two strings: \" \"STRINGS or KEYS options are mandatory\"); goto cleanup; } else if (getlen && getidx) { addReplyError(c, \"If you want both the length and indexes, please \" \"just use IDX.\"); goto cleanup; } /* Compute the LCS using the vanilla dynamic programming technique of * building a table of LCS(x,y) substrings. */ uint32_t alen = sdslen(a); uint32_t blen = sdslen(b); /* Setup an uint32_t array to store at LCS[i,j] the length of the * LCS A0..i-1, B0..j-1. Note that we have a linear array here, so * we index it as LCS[j+(blen+1)*j] */ uint32_t *lcs = zmalloc((alen+1)*(blen+1)*sizeof(uint32_t)); #define LCS(A,B) lcs[(B)+((A)*(blen+1))] /* Start building the LCS table. */ for (uint32_t i = 0; i <= alen; i++) { for (uint32_t j = 0; j <= blen; j++) { if (i == 0 || j == 0) { /* If one substring has length of zero, the * LCS length is zero. */ LCS(i,j) = 0; } else if (a[i-1] == b[j-1]) { /* The len LCS (and the LCS itself) of two * sequences with the same final character, is the * LCS of the two sequences without the last char * plus that last char. */ LCS(i,j) = LCS(i-1,j-1)+1; } else { /* If the last character is different, take the longest * between the LCS of the first string and the second * minus the last char, and the reverse. */ uint32_t lcs1 = LCS(i-1,j); uint32_t lcs2 = LCS(i,j-1); LCS(i,j) = lcs1 > lcs2 ? lcs1 : lcs2; } } } /* Store the actual LCS string in \"result\" if needed. We create * it backward, but the length is already known, we store it into idx. */ uint32_t idx = LCS(alen,blen); sds result = NULL; /* Resulting LCS string. */ void *arraylenptr = NULL; /* Deffered length of the array for IDX. */ uint32_t arange_start = alen, /* alen signals that values are not set. */ arange_end = 0, brange_start = 0, brange_end = 0; /* Do we need to compute the actual LCS string? Allocate it in that case. */ int computelcs = getidx || !getlen; if (computelcs) result = sdsnewlen(SDS_NOINIT,idx); /* Start with a deferred array if we have to emit the ranges. */ uint32_t arraylen = 0; /* Number of ranges emitted in the array. */ if (getidx) { addReplyMapLen(c,2); addReplyBulkCString(c,\"matches\"); arraylenptr = addReplyDeferredLen(c); } i = alen, j = blen; while (computelcs && i > 0 && j > 0) { int emit_range = 0; if (a[i-1] == b[j-1]) { /* If there is a match, store the character and reduce * the indexes to look for a new match. */ result[idx-1] = a[i-1]; /* Track the current range. */ if (arange_start == alen) { arange_start = i-1; arange_end = i-1; brange_start = j-1; brange_end = j-1; } else { /* Let's see if we can extend the range backward since * it is contiguous. */ if (arange_start == i && brange_start == j) { arange_start--; brange_start--; } else { emit_range = 1; } } /* Emit the range if we matched with the first byte of * one of the two strings. We'll exit the loop ASAP. */ if (arange_start == 0 || brange_start == 0) emit_range = 1; idx--; i--; j--; } else { /* Otherwise reduce i and j depending on the largest * LCS between, to understand what direction we need to go. */ uint32_t lcs1 = LCS(i-1,j); uint32_t lcs2 = LCS(i,j-1); if (lcs1 > lcs2) i--; else j--; if (arange_start != alen) emit_range = 1; } /* Emit the current range if needed. */ uint32_t match_len = arange_end - arange_start + 1; if (emit_range) { if (minmatchlen == 0 || match_len >= minmatchlen) { if (arraylenptr) { addReplyArrayLen(c,2+withmatchlen); addReplyArrayLen(c,2); addReplyLongLong(c,arange_start); addReplyLongLong(c,arange_end); addReplyArrayLen(c,2); addReplyLongLong(c,brange_start); addReplyLongLong(c,brange_end); if (withmatchlen) addReplyLongLong(c,match_len); arraylen++; } } arange_start = alen; /* Restart at the next match. */ } } /* Signal modified key, increment dirty, ... */ /* Reply depending on the given options. */ if (arraylenptr) { addReplyBulkCString(c,\"len\"); addReplyLongLong(c,LCS(alen,blen)); setDeferredArrayLen(c,arraylenptr,arraylen); } else if (getlen) { addReplyLongLong(c,LCS(alen,blen)); } else { addReplyBulkSds(c,result); result = NULL; } /* Cleanup. */ sdsfree(result); zfree(lcs); cleanup: if (obja) decrRefCount(obja); if (objb) decrRefCount(objb); return; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. An integer overflow bug in Redis version 6.0 or newer could be exploited using the `STRALGO LCS` command to corrupt the heap and potentially result with remote code execution. The problem is fixed in version 6.2.3 and 6.0.13. An additional workaround to mitigate the problem without patching the redis-server executable is to use ACL configuration to prevent clients from using the `STRALGO LCS` command.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2021-29477"}} -{"idx": 272285, "input": "management_client_pf(void *arg, const unsigned long cid, struct buffer_list *pf_config) /* ownership transferred */ { struct multi_context *m = (struct multi_context *) arg; struct multi_instance *mi = lookup_by_cid(m, cid); bool ret = false; if (mi && pf_config) { ret = pf_load_from_buffer_list(&mi->context, pf_config); } if (pf_config) { buffer_list_free(pf_config); } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430267, "input": "virSecuritySELinuxContextItemFree(virSecuritySELinuxContextItem *item) { if (!item) return; g_free(item->path); g_free(item->tcon); g_free(item); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354766, "input": "int kvm_vm_create_worker_thread(struct kvm *kvm, kvm_vm_thread_fn_t thread_fn, uintptr_t data, const char *name, struct task_struct **thread_ptr) { struct kvm_vm_worker_thread_context init_context = {}; struct task_struct *thread; *thread_ptr = NULL; init_context.kvm = kvm; init_context.parent = current; init_context.thread_fn = thread_fn; init_context.data = data; init_completion(&init_context.init_done); thread = kthread_run(kvm_vm_worker_thread, &init_context, \"%s-%d\", name, task_pid_nr(current)); if (IS_ERR(thread)) return PTR_ERR(thread); /* kthread_run is never supposed to return NULL */ WARN_ON(thread == NULL); wait_for_completion(&init_context.init_done); if (!init_context.err) *thread_ptr = thread; return init_context.err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197178, "input": "void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; u_int16_t dport = 0, sport = 0; NDPI_LOG_DBG(ndpi_struct, \"search H323\\n\"); /* The TPKT protocol is used by ISO 8072 (on port 102) and H.323. So this check below is to avoid ambiguities */ if((packet->tcp != NULL) && (packet->tcp->dest != ntohs(102))) { NDPI_LOG_DBG2(ndpi_struct, \"calculated dport over tcp\\n\"); /* H323 */ if(packet->payload_packet_len >= 4 && (packet->payload[0] == 0x03) && (packet->payload[1] == 0x00)) { struct tpkt *t = (struct tpkt*)packet->payload; u_int16_t len = ntohs(t->len); if(packet->payload_packet_len == len) { /* We need to check if this packet is in reality a RDP (Remote Desktop) packet encapsulated on TPTK */ if(packet->payload[4] == (packet->payload_packet_len - sizeof(struct tpkt) - 1)) { /* ISO 8073/X.224 */ if((packet->payload[5] == 0xE0 /* CC Connect Request */) || (packet->payload[5] == 0xD0 /* CC Connect Confirm */)) { NDPI_LOG_INFO(ndpi_struct, \"found RDP\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_RDP, NDPI_PROTOCOL_UNKNOWN); return; } } flow->l4.tcp.h323_valid_packets++; if(flow->l4.tcp.h323_valid_packets >= 2) { NDPI_LOG_INFO(ndpi_struct, \"found H323 broadcast\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN); } } else { /* This is not H.323 */ NDPI_EXCLUDE_PROTO(ndpi_struct, flow); return; } } } else if(packet->udp != NULL) { sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest); NDPI_LOG_DBG2(ndpi_struct, \"calculated dport over udp\\n\"); if(packet->payload_packet_len >= 6 && packet->payload[0] == 0x80 && packet->payload[1] == 0x08 && (packet->payload[2] == 0xe7 || packet->payload[2] == 0x26) && packet->payload[4] == 0x00 && packet->payload[5] == 0x00) { NDPI_LOG_INFO(ndpi_struct, \"found H323 broadcast\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN); return; } /* H323 */ if(sport == 1719 || dport == 1719) { if(packet->payload[0] == 0x16 && packet->payload[1] == 0x80 && packet->payload[4] == 0x06 && packet->payload[5] == 0x00) { NDPI_LOG_INFO(ndpi_struct, \"found H323 broadcast\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN); return; } else if(packet->payload_packet_len >= 20 && packet->payload_packet_len <= 117) { NDPI_LOG_INFO(ndpi_struct, \"found H323 broadcast\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN); return; } else { NDPI_EXCLUDE_PROTO(ndpi_struct, flow); return; } } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In nDPI through 3.2, the H.323 dissector is vulnerable to a heap-based buffer over-read in ndpi_search_h323 in lib/protocols/h323.c, as demonstrated by a payload packet length that is too short.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-15472"}} -{"idx": 219616, "input": "int64_t HHVM_FUNCTION(similar_text, const String& first, const String& second, double& percent) { int ret = string_similar_text(first.data(), first.size(), second.data(), second.size(), &percent); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357419, "input": "static OPJ_BOOL opj_j2k_write_plt_in_memory(opj_j2k_t *p_j2k, opj_tcd_marker_info_t* marker_info, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, opj_event_mgr_t * p_manager) { OPJ_BYTE Zplt = 0; OPJ_UINT16 Lplt; OPJ_BYTE* p_data_start = p_data; OPJ_BYTE* p_data_Lplt = p_data + 2; OPJ_UINT32 i; OPJ_UNUSED(p_j2k); opj_write_bytes(p_data, J2K_MS_PLT, 2); p_data += 2; /* Reserve space for Lplt */ p_data += 2; opj_write_bytes(p_data, Zplt, 1); p_data += 1; Lplt = 3; for (i = 0; i < marker_info->packet_count; i++) { OPJ_BYTE var_bytes[5]; OPJ_UINT8 var_bytes_size = 0; OPJ_UINT32 packet_size = marker_info->p_packet_size[i]; /* Packet size written in variable-length way, starting with LSB */ var_bytes[var_bytes_size] = (OPJ_BYTE)(packet_size & 0x7f); var_bytes_size ++; packet_size >>= 7; while (packet_size > 0) { var_bytes[var_bytes_size] = (OPJ_BYTE)((packet_size & 0x7f) | 0x80); var_bytes_size ++; packet_size >>= 7; } /* Check if that can fit in the current PLT marker. If not, finish */ /* current one, and start a new one */ if (Lplt + var_bytes_size > 65535) { if (Zplt == 255) { opj_event_msg(p_manager, EVT_ERROR, \"More than 255 PLT markers would be needed for current tile-part !\\n\"); return OPJ_FALSE; } /* Patch Lplt */ opj_write_bytes(p_data_Lplt, Lplt, 2); /* Start new segment */ opj_write_bytes(p_data, J2K_MS_PLT, 2); p_data += 2; /* Reserve space for Lplt */ p_data_Lplt = p_data; p_data += 2; Zplt ++; opj_write_bytes(p_data, Zplt, 1); p_data += 1; Lplt = 3; } Lplt = (OPJ_UINT16)(Lplt + var_bytes_size); /* Serialize variable-length packet size, starting with MSB */ for (; var_bytes_size > 0; --var_bytes_size) { opj_write_bytes(p_data, var_bytes[var_bytes_size - 1], 1); p_data += 1; } } *p_data_written = (OPJ_UINT32)(p_data - p_data_start); /* Patch Lplt */ opj_write_bytes(p_data_Lplt, Lplt, 2); return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 349501, "input": "p11_rpc_message_write_byte (p11_rpc_message *msg, CK_BYTE val) { assert (msg != NULL); assert (msg->output != NULL); /* Make sure this is in the right order */ assert (!msg->signature || p11_rpc_message_verify_part (msg, \"y\")); p11_rpc_buffer_add_byte (msg->output, val); return !p11_buffer_failed (msg->output); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431620, "input": "static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_layoutget_res *res) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246798, "input": "GF_EXPORT u64 gf_isom_get_fragmented_duration(GF_ISOFile *movie) { if (movie->moov->mvex && movie->moov->mvex->mehd) return movie->moov->mvex->mehd->fragment_duration; return 0;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385191, "input": "dissect_tcpopt_rvbd_probe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { guint8 ver, type; proto_tree *field_tree; proto_item *pitem; proto_item *length_item; int offset = 0, optlen = tvb_reported_length(tvb); struct tcpheader *tcph = (struct tcpheader*)data; pitem = proto_tree_add_item(tree, proto_tcp_option_rvbd_probe, tvb, offset, -1, ENC_NA); field_tree = proto_item_add_subtree(pitem, ett_tcp_opt_rvbd_probe); proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN); if (optlen < TCPOLEN_RVBD_PROBE_MIN) { /* Bogus - option length is less than what it's supposed to be for this option. */ expert_add_info_format(pinfo, length_item, &ei_tcp_opt_len_invalid, \"option length should be >= %u)\", TCPOLEN_RVBD_PROBE_MIN); return tvb_captured_length(tvb); } rvbd_probe_decode_version_type( tvb_get_guint8(tvb, offset + PROBE_VERSION_TYPE_OFFSET), &ver, &type); proto_item_append_text(pitem, \": %s\", val_to_str_const(type, rvbd_probe_type_vs, \"Probe Unknown\")); if (type >= PROBE_TYPE_MAX) return tvb_captured_length(tvb); if (ver == PROBE_VERSION_1) { guint16 port; proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_type1, tvb, offset + PROBE_VERSION_TYPE_OFFSET, 1, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_version1, tvb, offset + PROBE_VERSION_TYPE_OFFSET, 1, ENC_BIG_ENDIAN); if (type == PROBE_INTERNAL) return offset + PROBE_VERSION_TYPE_OFFSET; proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_reserved, tvb, offset + PROBE_V1_RESERVED_OFFSET, 1, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_prober, tvb, offset + PROBE_V1_PROBER_OFFSET, 4, ENC_BIG_ENDIAN); switch (type) { case PROBE_QUERY: case PROBE_QUERY_SH: case PROBE_TRACE: { rvbd_option_data* option_data; proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_appli_ver, tvb, offset + PROBE_V1_APPLI_VERSION_OFFSET, 2, ENC_BIG_ENDIAN); proto_item_append_text(pitem, \", CSH IP: %s\", tvb_ip_to_str(tvb, offset + PROBE_V1_PROBER_OFFSET)); option_data = (rvbd_option_data*)p_get_proto_data(pinfo->pool, pinfo, proto_tcp_option_rvbd_probe, pinfo->curr_layer_num); if (option_data == NULL) { option_data = wmem_new0(pinfo->pool, rvbd_option_data); p_add_proto_data(pinfo->pool, pinfo, proto_tcp_option_rvbd_probe, pinfo->curr_layer_num, option_data); } option_data->valid = TRUE; option_data->type = type; } break; case PROBE_RESPONSE: proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_proxy, tvb, offset + PROBE_V1_PROXY_ADDR_OFFSET, 4, ENC_BIG_ENDIAN); port = tvb_get_ntohs(tvb, offset + PROBE_V1_PROXY_PORT_OFFSET); proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_proxy_port, tvb, offset + PROBE_V1_PROXY_PORT_OFFSET, 2, ENC_BIG_ENDIAN); rvbd_probe_resp_add_info(pitem, pinfo, tvb, offset + PROBE_V1_PROXY_ADDR_OFFSET, port); break; case PROBE_RESPONSE_SH: proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_client, tvb, offset + PROBE_V1_SH_CLIENT_ADDR_OFFSET, 4, ENC_BIG_ENDIAN); proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_proxy, tvb, offset + PROBE_V1_SH_PROXY_ADDR_OFFSET, 4, ENC_BIG_ENDIAN); port = tvb_get_ntohs(tvb, offset + PROBE_V1_SH_PROXY_PORT_OFFSET); proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_proxy_port, tvb, offset + PROBE_V1_SH_PROXY_PORT_OFFSET, 2, ENC_BIG_ENDIAN); rvbd_probe_resp_add_info(pitem, pinfo, tvb, offset + PROBE_V1_SH_PROXY_ADDR_OFFSET, port); break; } } else if (ver == PROBE_VERSION_2) { proto_item *ver_pi; proto_item *flag_pi; proto_tree *flag_tree; guint8 flags; proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_type2, tvb, offset + PROBE_VERSION_TYPE_OFFSET, 1, ENC_BIG_ENDIAN); proto_tree_add_uint_format_value( field_tree, hf_tcp_option_rvbd_probe_version2, tvb, offset + PROBE_VERSION_TYPE_OFFSET, 1, ver, \"%u\", ver); /* Use version1 for filtering purposes because version2 packet value is 0, but filtering is usually done for value 2 */ ver_pi = proto_tree_add_uint(field_tree, hf_tcp_option_rvbd_probe_version1, tvb, offset + PROBE_VERSION_TYPE_OFFSET, 1, ver); PROTO_ITEM_SET_HIDDEN(ver_pi); switch (type) { case PROBE_QUERY_INFO: case PROBE_QUERY_INFO_SH: case PROBE_QUERY_INFO_SID: flags = tvb_get_guint8(tvb, offset + PROBE_V2_INFO_OFFSET); flag_pi = proto_tree_add_uint(field_tree, hf_tcp_option_rvbd_probe_flags, tvb, offset + PROBE_V2_INFO_OFFSET, 1, flags); flag_tree = proto_item_add_subtree(flag_pi, ett_tcp_opt_rvbd_probe_flags); proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_flag_not_cfe, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_flag_last_notify, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); switch (type) { case PROBE_QUERY_INFO: { rvbd_option_data* option_data = (rvbd_option_data*)p_get_proto_data(pinfo->pool, pinfo, proto_tcp_option_rvbd_probe, pinfo->curr_layer_num); if (option_data == NULL) { option_data = wmem_new0(pinfo->pool, rvbd_option_data); p_add_proto_data(pinfo->pool, pinfo, proto_tcp_option_rvbd_probe, pinfo->curr_layer_num, option_data); } option_data->probe_flags = flags; } break; case PROBE_QUERY_INFO_SH: proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_client, tvb, offset + PROBE_V2_INFO_CLIENT_ADDR_OFFSET, 4, ENC_BIG_ENDIAN); break; case PROBE_QUERY_INFO_SID: proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_storeid, tvb, offset + PROBE_V2_INFO_STOREID_OFFSET, 4, ENC_BIG_ENDIAN); break; } if (type != PROBE_QUERY_INFO_SID && tcph != NULL && (tcph->th_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK) && (flags & RVBD_FLAGS_PROBE_LAST)) { col_prepend_fstr(pinfo->cinfo, COL_INFO, \"SA++, \"); } break; case PROBE_RESPONSE_INFO: flag_pi = proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_flags, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); flag_tree = proto_item_add_subtree(flag_pi, ett_tcp_opt_rvbd_probe_flags); proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_flag_probe_cache, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_flag_sslcert, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_tcp_option_rvbd_probe_flag_server_connected, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); break; case PROBE_RST: proto_tree_add_item(field_tree, hf_tcp_option_rvbd_probe_flags, tvb, offset + PROBE_V2_INFO_OFFSET, 1, ENC_BIG_ENDIAN); break; } } return tvb_captured_length(tvb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 264808, "input": "GF_Err hnti_box_read(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_array_read_ex(s, bs, hnti_on_child_box, s->type); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402490, "input": "static void le_scan_restart_work(struct work_struct *work) { struct hci_dev *hdev = container_of(work, struct hci_dev, le_scan_restart.work); unsigned long timeout, duration, scan_start, now; u8 status; bt_dev_dbg(hdev, \"\"); hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status); if (status) { bt_dev_err(hdev, \"failed to restart LE scan: status %d\", status); return; } hci_dev_lock(hdev); if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) || !hdev->discovery.scan_start) goto unlock; /* When the scan was started, hdev->le_scan_disable has been queued * after duration from scan_start. During scan restart this job * has been canceled, and we need to queue it again after proper * timeout, to make sure that scan does not run indefinitely. */ duration = hdev->discovery.scan_duration; scan_start = hdev->discovery.scan_start; now = jiffies; if (now - scan_start <= duration) { int elapsed; if (now >= scan_start) elapsed = now - scan_start; else elapsed = ULONG_MAX - scan_start + now; timeout = duration - elapsed; } else { timeout = 0; } queue_delayed_work(hdev->req_workqueue, &hdev->le_scan_disable, timeout); unlock: hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 474558, "input": "void FreeTLS(rfbClient* client) { int i; if (mutex_buf != NULL) { CRYPTO_set_dynlock_create_callback(NULL); CRYPTO_set_dynlock_lock_callback(NULL); CRYPTO_set_dynlock_destroy_callback(NULL); CRYPTO_set_locking_callback(NULL); CRYPTO_set_id_callback(NULL); for (i = 0; i < CRYPTO_num_locks(); i++) MUTEX_FREE(mutex_buf[i]); free(mutex_buf); mutex_buf = NULL; } SSL_free(client->tlsSession); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259065, "input": "int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, off_t *size, Error **errp) { char buf[256]; uint64_t magic, s; int rc; bool zeroes = true; TRACE(\"Receiving negotiation tlscreds=%p hostname=%s.\", tlscreds, hostname ? hostname : \"\"); rc = -EINVAL; if (outioc) { *outioc = NULL; } if (tlscreds && !outioc) { error_setg(errp, \"Output I/O channel required for TLS\"); goto fail; } if (read_sync(ioc, buf, 8) != 8) { error_setg(errp, \"Failed to read data\"); goto fail; } buf[8] = '\\0'; if (strlen(buf) == 0) { error_setg(errp, \"Server connection closed unexpectedly\"); goto fail; } TRACE(\"Magic is %c%c%c%c%c%c%c%c\", qemu_isprint(buf[0]) ? buf[0] : '.', qemu_isprint(buf[1]) ? buf[1] : '.', qemu_isprint(buf[2]) ? buf[2] : '.', qemu_isprint(buf[3]) ? buf[3] : '.', qemu_isprint(buf[4]) ? buf[4] : '.', qemu_isprint(buf[5]) ? buf[5] : '.', qemu_isprint(buf[6]) ? buf[6] : '.', qemu_isprint(buf[7]) ? buf[7] : '.'); if (memcmp(buf, \"NBDMAGIC\", 8) != 0) { error_setg(errp, \"Invalid magic received\"); goto fail; } if (read_sync(ioc, &magic, sizeof(magic)) != sizeof(magic)) { error_setg(errp, \"Failed to read magic\"); goto fail; } magic = be64_to_cpu(magic); TRACE(\"Magic is 0x%\" PRIx64, magic); if (magic == NBD_OPTS_MAGIC) { uint32_t clientflags = 0; uint16_t globalflags; bool fixedNewStyle = false; if (read_sync(ioc, &globalflags, sizeof(globalflags)) != sizeof(globalflags)) { error_setg(errp, \"Failed to read server flags\"); goto fail; } globalflags = be16_to_cpu(globalflags); TRACE(\"Global flags are %\" PRIx32, globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; TRACE(\"Server supports fixed new style\"); clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE; } if (globalflags & NBD_FLAG_NO_ZEROES) { zeroes = false; TRACE(\"Server supports no zeroes\"); clientflags |= NBD_FLAG_C_NO_ZEROES; } /* client requested flags */ clientflags = cpu_to_be32(clientflags); if (write_sync(ioc, &clientflags, sizeof(clientflags)) != sizeof(clientflags)) { error_setg(errp, \"Failed to send clientflags field\"); goto fail; } if (tlscreds) { if (fixedNewStyle) { *outioc = nbd_receive_starttls(ioc, tlscreds, hostname, errp); if (!*outioc) { goto fail; } ioc = *outioc; } else { error_setg(errp, \"Server does not support STARTTLS\"); goto fail; } } if (!name) { TRACE(\"Using default NBD export name \\\"\\\"\"); name = \"\"; } if (fixedNewStyle) { /* Check our desired export is present in the * server export list. Since NBD_OPT_EXPORT_NAME * cannot return an error message, running this * query gives us good error reporting if the * server required TLS */ if (nbd_receive_query_exports(ioc, name, errp) < 0) { goto fail; } } /* write the export name request */ if (nbd_send_option_request(ioc, NBD_OPT_EXPORT_NAME, -1, name, errp) < 0) { goto fail; } /* Read the response */ if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) { error_setg(errp, \"Failed to read export length\"); goto fail; } *size = be64_to_cpu(s); if (read_sync(ioc, flags, sizeof(*flags)) != sizeof(*flags)) { error_setg(errp, \"Failed to read export flags\"); goto fail; } be16_to_cpus(flags); } else if (magic == NBD_CLIENT_MAGIC) { uint32_t oldflags; if (name) { error_setg(errp, \"Server does not support export names\"); goto fail; } if (tlscreds) { error_setg(errp, \"Server does not support STARTTLS\"); goto fail; } if (read_sync(ioc, &s, sizeof(s)) != sizeof(s)) { error_setg(errp, \"Failed to read export length\"); goto fail; } *size = be64_to_cpu(s); TRACE(\"Size is %\" PRIu64, *size); if (read_sync(ioc, &oldflags, sizeof(oldflags)) != sizeof(oldflags)) { error_setg(errp, \"Failed to read export flags\"); goto fail; } be32_to_cpus(&oldflags); if (oldflags & ~0xffff) { error_setg(errp, \"Unexpected export flags %0x\" PRIx32, oldflags); goto fail; } *flags = oldflags; } else { error_setg(errp, \"Bad magic received\"); goto fail; } TRACE(\"Size is %\" PRIu64 \", export flags %\" PRIx16, *size, *flags); if (zeroes && drop_sync(ioc, 124) != 124) { error_setg(errp, \"Failed to read reserved block\"); goto fail; } rc = 0; fail: return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380145, "input": "int dlpar_release_drc(u32 drc_index) { int dr_status, rc; rc = rtas_call(rtas_token(\"get-sensor-state\"), 2, 2, &dr_status, DR_ENTITY_SENSE, drc_index); if (rc || dr_status != DR_ENTITY_PRESENT) return -1; rc = rtas_set_indicator(ISOLATION_STATE, drc_index, ISOLATE); if (rc) return rc; rc = rtas_set_indicator(ALLOCATION_STATE, drc_index, ALLOC_UNUSABLE); if (rc) { rtas_set_indicator(ISOLATION_STATE, drc_index, UNISOLATE); return rc; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431317, "input": "static int verify_attr_len(struct xdr_stream *xdr, unsigned int savep, uint32_t attrlen) { unsigned int attrwords = XDR_QUADLEN(attrlen); unsigned int nwords = (xdr_stream_pos(xdr) - savep) >> 2; if (unlikely(attrwords != nwords)) { dprintk(\"%s: server returned incorrect attribute length: \" \"%u %c %u\\n\", __func__, attrwords << 2, (attrwords < nwords) ? '<' : '>', nwords << 2); return -EIO; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509272, "input": "virtual bool find_item_in_field_list_processor(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237561, "input": "GF_Box *SmDm_box_new() { ISOM_DECL_BOX_ALLOC(GF_SMPTE2086MasteringDisplayMetadataBox, GF_ISOM_BOX_TYPE_SMDM); return (GF_Box *)tmp; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 482987, "input": "static bool dce81_construct( uint8_t num_virtual_links, struct dc *dc, struct dce110_resource_pool *pool) { unsigned int i; struct dc_context *ctx = dc->ctx; struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs; pool->base.res_cap = &res_cap_81; pool->base.funcs = &dce80_res_pool_funcs; /************************************************* * Resource + asic cap harcoding * *************************************************/ pool->base.underlay_pipe_index = NO_UNDERLAY_PIPE; pool->base.pipe_count = res_cap_81.num_timing_generator; pool->base.timing_generator_count = res_cap_81.num_timing_generator; dc->caps.max_downscale_ratio = 200; dc->caps.i2c_speed_in_khz = 40; dc->caps.max_cursor_size = 128; dc->caps.is_apu = true; /************************************************* * Create resources * *************************************************/ bp = ctx->dc_bios; if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) { pool->base.dp_clock_source = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true); pool->base.clock_sources[0] = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false); pool->base.clock_sources[1] = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false); pool->base.clock_sources[2] = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false); pool->base.clk_src_count = 3; } else { pool->base.dp_clock_source = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true); pool->base.clock_sources[0] = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false); pool->base.clock_sources[1] = dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false); pool->base.clk_src_count = 2; } if (pool->base.dp_clock_source == NULL) { dm_error(\"DC: failed to create dp clock source!\\n\"); BREAK_TO_DEBUGGER(); goto res_create_fail; } for (i = 0; i < pool->base.clk_src_count; i++) { if (pool->base.clock_sources[i] == NULL) { dm_error(\"DC: failed to create clock sources!\\n\"); BREAK_TO_DEBUGGER(); goto res_create_fail; } } pool->base.dmcu = dce_dmcu_create(ctx, &dmcu_regs, &dmcu_shift, &dmcu_mask); if (pool->base.dmcu == NULL) { dm_error(\"DC: failed to create dmcu!\\n\"); BREAK_TO_DEBUGGER(); goto res_create_fail; } pool->base.abm = dce_abm_create(ctx, &abm_regs, &abm_shift, &abm_mask); if (pool->base.abm == NULL) { dm_error(\"DC: failed to create abm!\\n\"); BREAK_TO_DEBUGGER(); goto res_create_fail; } { struct irq_service_init_data init_data; init_data.ctx = dc->ctx; pool->base.irqs = dal_irq_service_dce80_create(&init_data); if (!pool->base.irqs) goto res_create_fail; } for (i = 0; i < pool->base.pipe_count; i++) { pool->base.timing_generators[i] = dce80_timing_generator_create( ctx, i, &dce80_tg_offsets[i]); if (pool->base.timing_generators[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error(\"DC: failed to create tg!\\n\"); goto res_create_fail; } pool->base.mis[i] = dce80_mem_input_create(ctx, i); if (pool->base.mis[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error(\"DC: failed to create memory input!\\n\"); goto res_create_fail; } pool->base.ipps[i] = dce80_ipp_create(ctx, i); if (pool->base.ipps[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error(\"DC: failed to create input pixel processor!\\n\"); goto res_create_fail; } pool->base.transforms[i] = dce80_transform_create(ctx, i); if (pool->base.transforms[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error(\"DC: failed to create transform!\\n\"); goto res_create_fail; } pool->base.opps[i] = dce80_opp_create(ctx, i); if (pool->base.opps[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error(\"DC: failed to create output pixel processor!\\n\"); goto res_create_fail; } } for (i = 0; i < pool->base.res_cap->num_ddc; i++) { pool->base.engines[i] = dce80_aux_engine_create(ctx, i); if (pool->base.engines[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error( \"DC:failed to create aux engine!!\\n\"); goto res_create_fail; } pool->base.hw_i2cs[i] = dce80_i2c_hw_create(ctx, i); if (pool->base.hw_i2cs[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error( \"DC:failed to create i2c engine!!\\n\"); goto res_create_fail; } pool->base.sw_i2cs[i] = dce80_i2c_sw_create(ctx); if (pool->base.sw_i2cs[i] == NULL) { BREAK_TO_DEBUGGER(); dm_error( \"DC:failed to create sw i2c!!\\n\"); goto res_create_fail; } } dc->caps.max_planes = pool->base.pipe_count; for (i = 0; i < dc->caps.max_planes; ++i) dc->caps.planes[i] = plane_cap; dc->caps.disable_dp_clk_share = true; if (!resource_construct(num_virtual_links, dc, &pool->base, &res_create_funcs)) goto res_create_fail; /* Create hardware sequencer */ dce80_hw_sequencer_construct(dc); return true; res_create_fail: destruct(pool); return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 438541, "input": "MagickExport MagickBooleanType ClipImagePath(Image *image,const char *pathname, const MagickBooleanType inside) { #define ClipImagePathTag \"ClipPath/Image\" char *property; const char *value; Image *clip_mask; ImageInfo *image_info; assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(pathname != NULL); property=AcquireString(pathname); (void) FormatLocaleString(property,MaxTextExtent,\"8BIM:1999,2998:%s\", pathname); value=GetImageProperty(image,property); property=DestroyString(property); if (value == (const char *) NULL) { ThrowFileException(&image->exception,OptionError,\"NoClipPathDefined\", image->filename); return(MagickFalse); } image_info=AcquireImageInfo(); (void) CopyMagickString(image_info->filename,image->filename,MaxTextExtent); (void) ConcatenateMagickString(image_info->filename,pathname,MaxTextExtent); clip_mask=BlobToImage(image_info,value,strlen(value),&image->exception); image_info=DestroyImageInfo(image_info); if (clip_mask == (Image *) NULL) return(MagickFalse); if (clip_mask->storage_class == PseudoClass) { (void) SyncImage(clip_mask); if (SetImageStorageClass(clip_mask,DirectClass) == MagickFalse) return(MagickFalse); } if (inside == MagickFalse) (void) NegateImage(clip_mask,MagickFalse); (void) FormatLocaleString(clip_mask->magick_filename,MaxTextExtent, \"8BIM:1999,2998:%s\\nPS\",pathname); (void) SetImageClipMask(image,clip_mask); clip_mask=DestroyImage(clip_mask); return(MagickTrue); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 249556, "input": "static void do_print_node(GF_Node *node, GF_SceneGraph *sg, const char *name, u32 graph_type, Bool is_nodefield, Bool do_cov) { u32 nbF, i; GF_FieldInfo f; #ifndef GPAC_DISABLE_BIFS u8 qt, at; Fixed bmin, bmax; u32 nbBits; #endif /*GPAC_DISABLE_BIFS*/ nbF = gf_node_get_field_count(node); if (is_nodefield) { char szField[1024]; u32 tfirst, tlast; if (gf_node_get_field_by_name(node, szField, &f) != GF_OK) { fprintf(stderr, \"Field %s is not a member of node %s\\n\", szField, name); return; } fprintf(stderr, \"Allowed nodes in %s.%s:\\n\", name, szField); if (graph_type==1) { tfirst = GF_NODE_RANGE_FIRST_X3D; tlast = GF_NODE_RANGE_LAST_X3D; } else { tfirst = GF_NODE_RANGE_FIRST_MPEG4; tlast = GF_NODE_RANGE_LAST_MPEG4; } for (i=tfirst; icount; j++) { if (j) fprintf(stderr, \" \"); gf_sg_vrml_mf_get_item(f.far_ptr, f.fieldType, &ptr, j); PrintNodeSFField(sftype, ptr); } fprintf(stderr, \"]\"); } #ifndef GPAC_DISABLE_BIFS if (gf_bifs_get_aq_info(node, i, &qt, &at, &bmin, &bmax, &nbBits)) { if (qt) { fprintf(stderr, \" #QP=%d\", qt); if (qt==13) fprintf(stderr, \" NbBits=%d\", nbBits); if (bmin && bmax) { fprintf(stderr, \" Bounds=[\"); PrintFixed(bmin, 0); fprintf(stderr, \",\"); PrintFixed(bmax, 0); fprintf(stderr, \"]\"); } } } #endif /*GPAC_DISABLE_BIFS*/ fprintf(stderr, \"\\n\"); if (do_cov) { gf_node_get_field_by_name(node, (char *) f.name, &f); } } fprintf(stderr, \"}\\n\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430277, "input": "virSecuritySELinuxRestorePCILabel(virPCIDevice *dev G_GNUC_UNUSED, const char *file, void *opaque) { virSecurityManager *mgr = opaque; return virSecuritySELinuxRestoreFileLabel(mgr, file, true); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197575, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& input = ctx->input(0); const float input_min_float = ctx->input(1).flat()(0); const float input_max_float = ctx->input(2).flat()(0); Tensor* output_min = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &output_min)); Tensor* output_max = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(1, TensorShape({}), &output_max)); qint32 used_min_quantized; qint32 used_max_quantized; CalculateUsedRange(input, &used_min_quantized, &used_max_quantized); // We want to make sure that the minimum is no larger than zero, so that the // convolution operation can run efficiently. const float used_min_float = std::min( 0.0f, QuantizedToFloat(used_min_quantized, input_min_float, input_max_float)); const float used_max_float = QuantizedToFloat(used_max_quantized, input_min_float, input_max_float); output_min->flat().setConstant(used_min_float); output_max->flat().setConstant(used_max_float); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPoolGradWithArgmax` can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/ac328eaa3870491ababc147822cd04e91a790643/tensorflow/core/kernels/requantization_range_op.cc#L49-L50) assumes that the `input_min` and `input_max` tensors have at least one element, as it accesses the first element in two arrays. If the tensors are empty, `.flat()` is an empty object, backed by an empty array. Hence, accesing even the 0th element is a read outside the bounds. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-29569"}} -{"idx": 204191, "input": "search_memslots(struct kvm_memslots *slots, gfn_t gfn) { int start = 0, end = slots->used_slots; int slot = atomic_read(&slots->lru_slot); struct kvm_memory_slot *memslots = slots->memslots; if (gfn >= memslots[slot].base_gfn && gfn < memslots[slot].base_gfn + memslots[slot].npages) return &memslots[slot]; while (start < end) { slot = start + (end - start) / 2; if (gfn >= memslots[slot].base_gfn) end = slot; else start = slot + 1; } if (gfn >= memslots[start].base_gfn && gfn < memslots[start].base_gfn + memslots[start].npages) { atomic_set(&slots->lru_slot, start); return &memslots[start]; } return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "An issue was discovered in the Linux kernel before 5.7. The KVM subsystem allows out-of-range access to memslots after a deletion, aka CID-0774a964ef56. This affects arch/s390/kvm/kvm-s390.c, include/linux/kvm_host.h, and virt/kvm/kvm_main.c.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2020-36313"}} -{"idx": 422671, "input": "TEST(RegexMatchExpression, MatchesElementRegexType) { BSONObj match = BSONObjBuilder().appendRegex(\"x\", \"yz\", \"i\").obj(); BSONObj notMatchPattern = BSONObjBuilder().appendRegex(\"x\", \"r\", \"i\").obj(); BSONObj notMatchFlags = BSONObjBuilder().appendRegex(\"x\", \"yz\", \"s\").obj(); RegexMatchExpression regex(\"\", \"yz\", \"i\"); ASSERT(regex.matchesSingleElement(match.firstElement())); ASSERT(!regex.matchesSingleElement(notMatchPattern.firstElement())); ASSERT(!regex.matchesSingleElement(notMatchFlags.firstElement())); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268960, "input": "static void trimbits(char *b) { const int len = strlen (b); char *one = strchr (b, '1'); int pos = one ? (int)(size_t)(one - b) : len - 1; pos = (pos / 8) * 8; memmove (b, b + pos, len - pos + 1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269065, "input": "bool test_r_str_rwx(void) { int rwx = r_str_rwx (\"rwx\"); int rw = r_str_rwx (\"rw-\"); int rx = r_str_rwx (\"rx\"); int none = r_str_rwx (\"---\"); int number = r_str_rwx (\"999\"); int rx_number = r_str_rwx (\"5\"); int rwx_number = r_str_rwx (\"7\"); mu_assert_eq (rwx, 7, \"rwx\"); mu_assert_eq (rw, 6, \"rw\"); mu_assert_eq (rx, 5, \"rx\"); mu_assert_eq (none, 0, \"no permissions\"); mu_assert_eq (number, 0, \"large input number string\"); mu_assert_eq (rx_number, 5, \"rx number\"); mu_assert_eq (rwx_number, 7, \"rwx number\"); mu_end; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212377, "input": "static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max, struct mt_application *app) { struct mt_device *td = hid_get_drvdata(hdev); struct mt_class *cls = &td->mtclass; int code; struct hid_usage *prev_usage = NULL; /* * Model touchscreens providing buttons as touchpads. */ if (field->application == HID_DG_TOUCHSCREEN && (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) { app->mt_flags |= INPUT_MT_POINTER; td->inputmode_value = MT_INPUTMODE_TOUCHPAD; } /* count the buttons on touchpads */ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) app->buttons_count++; if (usage->usage_index) prev_usage = &field->usage[usage->usage_index - 1]; switch (usage->hid & HID_USAGE_PAGE) { case HID_UP_GENDESK: switch (usage->hid) { case HID_GD_X: if (prev_usage && (prev_usage->hid == usage->hid)) { code = ABS_MT_TOOL_X; MT_STORE_FIELD(cx); } else { code = ABS_MT_POSITION_X; MT_STORE_FIELD(x); } set_abs(hi->input, code, field, cls->sn_move); /* * A system multi-axis that exports X and Y has a high * chance of being used directly on a surface */ if (field->application == HID_GD_SYSTEM_MULTIAXIS) { __set_bit(INPUT_PROP_DIRECT, hi->input->propbit); input_set_abs_params(hi->input, ABS_MT_TOOL_TYPE, MT_TOOL_DIAL, MT_TOOL_DIAL, 0, 0); } return 1; case HID_GD_Y: if (prev_usage && (prev_usage->hid == usage->hid)) { code = ABS_MT_TOOL_Y; MT_STORE_FIELD(cy); } else { code = ABS_MT_POSITION_Y; MT_STORE_FIELD(y); } set_abs(hi->input, code, field, cls->sn_move); return 1; } return 0; case HID_UP_DIGITIZER: switch (usage->hid) { case HID_DG_INRANGE: if (app->quirks & MT_QUIRK_HOVERING) { input_set_abs_params(hi->input, ABS_MT_DISTANCE, 0, 1, 0, 0); } MT_STORE_FIELD(inrange_state); return 1; case HID_DG_CONFIDENCE: if (cls->name == MT_CLS_WIN_8 && (field->application == HID_DG_TOUCHPAD || field->application == HID_DG_TOUCHSCREEN)) app->quirks |= MT_QUIRK_CONFIDENCE; if (app->quirks & MT_QUIRK_CONFIDENCE) input_set_abs_params(hi->input, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER, MT_TOOL_PALM, 0, 0); MT_STORE_FIELD(confidence_state); return 1; case HID_DG_TIPSWITCH: if (field->application != HID_GD_SYSTEM_MULTIAXIS) input_set_capability(hi->input, EV_KEY, BTN_TOUCH); MT_STORE_FIELD(tip_state); return 1; case HID_DG_CONTACTID: MT_STORE_FIELD(contactid); app->touches_by_report++; return 1; case HID_DG_WIDTH: if (!(app->quirks & MT_QUIRK_NO_AREA)) set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, cls->sn_width); MT_STORE_FIELD(w); return 1; case HID_DG_HEIGHT: if (!(app->quirks & MT_QUIRK_NO_AREA)) { set_abs(hi->input, ABS_MT_TOUCH_MINOR, field, cls->sn_height); /* * Only set ABS_MT_ORIENTATION if it is not * already set by the HID_DG_AZIMUTH usage. */ if (!test_bit(ABS_MT_ORIENTATION, hi->input->absbit)) input_set_abs_params(hi->input, ABS_MT_ORIENTATION, 0, 1, 0, 0); } MT_STORE_FIELD(h); return 1; case HID_DG_TIPPRESSURE: set_abs(hi->input, ABS_MT_PRESSURE, field, cls->sn_pressure); MT_STORE_FIELD(p); return 1; case HID_DG_SCANTIME: input_set_capability(hi->input, EV_MSC, MSC_TIMESTAMP); app->scantime = &field->value[usage->usage_index]; app->scantime_logical_max = field->logical_maximum; return 1; case HID_DG_CONTACTCOUNT: app->have_contact_count = true; app->raw_cc = &field->value[usage->usage_index]; return 1; case HID_DG_AZIMUTH: /* * Azimuth has the range of [0, MAX) representing a full * revolution. Set ABS_MT_ORIENTATION to a quarter of * MAX according the definition of ABS_MT_ORIENTATION */ input_set_abs_params(hi->input, ABS_MT_ORIENTATION, -field->logical_maximum / 4, field->logical_maximum / 4, cls->sn_move ? field->logical_maximum / cls->sn_move : 0, 0); MT_STORE_FIELD(a); return 1; case HID_DG_CONTACTMAX: /* contact max are global to the report */ return -1; case HID_DG_TOUCH: /* Legacy devices use TIPSWITCH and not TOUCH. * Let's just ignore this field. */ return -1; } /* let hid-input decide for the others */ return 0; case HID_UP_BUTTON: code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE); /* * MS PTP spec says that external buttons left and right have * usages 2 and 3. */ if ((app->quirks & MT_QUIRK_WIN8_PTP_BUTTONS) && field->application == HID_DG_TOUCHPAD && (usage->hid & HID_USAGE) > 1) code--; if (field->application == HID_GD_SYSTEM_MULTIAXIS) code = BTN_0 + ((usage->hid - 1) & HID_USAGE); hid_map_usage(hi, usage, bit, max, EV_KEY, code); input_set_capability(hi->input, EV_KEY, code); return 1; case 0xff000000: /* we do not want to map these: no input-oriented meaning */ return -1; } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "In various methods of hid-multitouch.c, there is a possible out of bounds write due to a missing bounds check. This could lead to local escalation of privilege with no additional execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android kernelAndroid ID: A-162844689References: Upstream kernel", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-0465"}} -{"idx": 206559, "input": "static void *gp_worker_main(void *pvt) { struct gp_thread *t = (struct gp_thread *)pvt; struct gp_query *q = NULL; char dummy = 0; int ret; while (!t->pool->shutdown) { /* initialize debug client id to 0 until work is scheduled */ gp_debug_set_conn_id(0); /* ======> COND_MUTEX */ pthread_mutex_lock(&t->cond_mutex); while (t->query == NULL) { /* wait for next query */ pthread_cond_wait(&t->cond_wakeup, &t->cond_mutex); if (t->pool->shutdown) { pthread_exit(NULL); } } /* grab the query off the shared pointer */ q = t->query; t->query = NULL; /* <====== COND_MUTEX */ pthread_mutex_unlock(&t->cond_mutex); /* set client id before hndling requests */ gp_debug_set_conn_id(gp_conn_get_cid(q->conn)); /* handle the client request */ GPDEBUGN(3, \"[status] Handling query input: %p (%zu)\\n\", q->buffer, q->buflen); gp_handle_query(t->pool, q); GPDEBUGN(3 ,\"[status] Handling query output: %p (%zu)\\n\", q->buffer, q->buflen); /* now get lock on main queue, to play with the reply list */ /* ======> POOL LOCK */ pthread_mutex_lock(&t->pool->lock); /* put back query so that dispatcher can send reply */ q->next = t->pool->reply_list; t->pool->reply_list = q; /* add us back to the free list but only if we are not * shutting down */ if (!t->pool->shutdown) { LIST_DEL(t->pool->busy_list, t); LIST_ADD(t->pool->free_list, t); } /* <====== POOL LOCK */ pthread_mutex_unlock(&t->pool->lock); /* and wake up dispatcher so it will handle it */ ret = write(t->pool->sig_pipe[1], &dummy, 1); if (ret == -1) { GPERROR(\"Failed to signal dispatcher!\"); } } pthread_exit(NULL); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Locking"], "explanation": "gssproxy (aka gss-proxy) before 0.8.3 does not unlock cond_mutex before pthread exit in gp_worker_main() in gp_workers.c. NOTE: An upstream comment states \"We are already on a shutdown path when running the code in question, so a DoS there doesn't make any sense, and there has been no additional information provided us (as upstream) to indicate why this would be a problem.", "severity_level": "NoInfo", "cwe": "CWE-667", "cve": "CVE-2020-12658"}} -{"idx": 269888, "input": "void Commissioner::UpdateJoinerExpirationTimer(void) { TimeMilli now = TimerMilli::GetNow(); uint32_t nextTimeout = TimeMilli::kMaxDuration; // Check if timer should be set for next Joiner. for (Joiner *joiner = &mJoiners[0]; joiner < OT_ARRAY_END(mJoiners); joiner++) { uint32_t diff; if (!joiner->mValid) { continue; } if (now >= joiner->mExpirationTime) { nextTimeout = 0; break; } diff = joiner->mExpirationTime - now; if (diff < nextTimeout) { nextTimeout = diff; } } if (nextTimeout != TimeMilli::kMaxDuration) { // Update the timer to the timeout of the next Joiner. mJoinerExpirationTimer.Start(nextTimeout); } else { // No Joiners, stop the timer. mJoinerExpirationTimer.Stop(); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430902, "input": "operator<< (std::ostream &s, Http::HdrType id) { if (Http::any_HdrType_enum_value(id)) s << Http::HeaderLookupTable.lookup(id).name << '[' << static_cast(id) << ']'; else s << \"Invalid-Header[\" << static_cast(id) << ']'; return s; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263062, "input": "iasecc_decipher(struct sc_card *card, const unsigned char *in, size_t in_len, unsigned char *out, size_t out_len) { struct sc_context *ctx = card->ctx; struct sc_apdu apdu; unsigned char sbuf[0x200]; unsigned char resp[SC_MAX_APDU_BUFFER_SIZE]; size_t offs; int rv; LOG_FUNC_CALLED(ctx); sc_log(card->ctx, \"crgram_len %\"SC_FORMAT_LEN_SIZE_T\"u; outlen %\"SC_FORMAT_LEN_SIZE_T\"u\", in_len, out_len); if (!out || !out_len || in_len > SC_MAX_APDU_BUFFER_SIZE) LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); offs = 0; sbuf[offs++] = 0x81; memcpy(sbuf + offs, in, in_len); offs += in_len; sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86); apdu.flags |= SC_APDU_FLAGS_CHAINING; apdu.data = sbuf; apdu.datalen = offs; apdu.lc = offs; apdu.resp = resp; apdu.resplen = sizeof(resp); apdu.le = 256; rv = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, rv, \"APDU transmit failed\"); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(ctx, rv, \"Card returned error\"); if (out_len > apdu.resplen) out_len = apdu.resplen; memcpy(out, apdu.resp, out_len); rv = out_len; LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 350339, "input": "fopenTiff(FILE *fp, const char *modestring) { PROCNAME(\"fopenTiff\"); if (!fp) return (TIFF *)ERROR_PTR(\"stream not opened\", procName, NULL); if (!modestring) return (TIFF *)ERROR_PTR(\"modestring not defined\", procName, NULL); TIFFSetWarningHandler(NULL); /* disable warnings */ TIFFSetErrorHandler(NULL); /* disable error messages */ fseek(fp, 0, SEEK_SET); return TIFFClientOpen(\"TIFFstream\", modestring, (thandle_t)fp, lept_read_proc, lept_write_proc, lept_seek_proc, lept_close_proc, lept_size_proc, NULL, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 343504, "input": "static u64 current_task_runtime_100ns(void) { u64 utime, stime; task_cputime_adjusted(current, &utime, &stime); return div_u64(utime + stime, 100); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431028, "input": "static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr, void *data) { struct nfs4_getattr_res *res = data; struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (status) goto out; status = decode_sequence(xdr, &res->seq_res, rqstp); if (status) goto out; status = decode_putfh(xdr); if (status) goto out; status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); out: return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204189, "input": "static int kvm_s390_get_cmma(struct kvm *kvm, struct kvm_s390_cmma_log *args, u8 *res, unsigned long bufsize) { unsigned long mem_end, cur_gfn, next_gfn, hva, pgstev; struct kvm_memslots *slots = kvm_memslots(kvm); struct kvm_memory_slot *ms; cur_gfn = kvm_s390_next_dirty_cmma(slots, args->start_gfn); ms = gfn_to_memslot(kvm, cur_gfn); args->count = 0; args->start_gfn = cur_gfn; if (!ms) return 0; next_gfn = kvm_s390_next_dirty_cmma(slots, cur_gfn + 1); mem_end = slots->memslots[0].base_gfn + slots->memslots[0].npages; while (args->count < bufsize) { hva = gfn_to_hva(kvm, cur_gfn); if (kvm_is_error_hva(hva)) return 0; /* Decrement only if we actually flipped the bit to 0 */ if (test_and_clear_bit(cur_gfn - ms->base_gfn, kvm_second_dirty_bitmap(ms))) atomic64_dec(&kvm->arch.cmma_dirty_pages); if (get_pgste(kvm->mm, hva, &pgstev) < 0) pgstev = 0; /* Save the value */ res[args->count++] = (pgstev >> 24) & 0x43; /* If the next bit is too far away, stop. */ if (next_gfn > cur_gfn + KVM_S390_MAX_BIT_DISTANCE) return 0; /* If we reached the previous \"next\", find the next one */ if (cur_gfn == next_gfn) next_gfn = kvm_s390_next_dirty_cmma(slots, cur_gfn + 1); /* Reached the end of memory or of the buffer, stop */ if ((next_gfn >= mem_end) || (next_gfn - args->start_gfn >= bufsize)) return 0; cur_gfn++; /* Reached the end of the current memslot, take the next one. */ if (cur_gfn - ms->base_gfn >= ms->npages) { ms = gfn_to_memslot(kvm, cur_gfn); if (!ms) return 0; } } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "An issue was discovered in the Linux kernel before 5.7. The KVM subsystem allows out-of-range access to memslots after a deletion, aka CID-0774a964ef56. This affects arch/s390/kvm/kvm-s390.c, include/linux/kvm_host.h, and virt/kvm/kvm_main.c.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2020-36313"}} -{"idx": 219456, "input": "char operator[](int pos) const { return charAt(pos);}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219350, "input": "bool HHVM_FUNCTION(imagedashedline, const Resource& image, int64_t x1, int64_t y1, int64_t x2, int64_t y2, int64_t color) { gdImagePtr im = get_valid_image_resource(image); if (!im) return false; gdImageDashedLine(im, x1, y1, x2, y2, color); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268096, "input": "static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct net *net = sock_net(sk); unsigned int dir; int err = 0, delete; struct sadb_x_policy *pol; struct xfrm_policy *xp; struct km_event c; if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL) return -EINVAL; dir = xfrm_policy_id2dir(pol->sadb_x_policy_id); if (dir >= XFRM_POLICY_MAX) return -EINVAL; delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2); xp = xfrm_policy_byid(net, &dummy_mark, 0, XFRM_POLICY_TYPE_MAIN, dir, pol->sadb_x_policy_id, delete, &err); if (xp == NULL) return -ENOENT; if (delete) { xfrm_audit_policy_delete(xp, err ? 0 : 1, true); if (err) goto out; c.seq = hdr->sadb_msg_seq; c.portid = hdr->sadb_msg_pid; c.data.byid = 1; c.event = XFRM_MSG_DELPOLICY; km_policy_notify(xp, dir, &c); } else { err = key_pol_get_resp(sk, xp, hdr, dir); } out: xfrm_pol_put(xp); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499667, "input": "tape_toss_input (int in_des, off_t num_bytes) { off_t bytes_left = num_bytes; /* Bytes needing to be copied. */ off_t space_left; /* Bytes to copy from input buffer. */ while (bytes_left > 0) { if (input_size == 0) tape_fill_input_buffer (in_des, io_block_size); if (bytes_left < input_size) space_left = bytes_left; else space_left = input_size; if (crc_i_flag && only_verify_crc_flag) { int k; for (k = 0; k < space_left; ++k) crc += in_buff[k] & 0xff; } in_buff += space_left; input_size -= space_left; bytes_left -= space_left; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432466, "input": "static inline bool vgif_enabled(struct vcpu_svm *svm) { return !!(svm->vmcb->control.int_ctl & V_GIF_ENABLE_MASK); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 233121, "input": "static bool SplitHasAlignedOutputsInFirstDimension( const TensorShape& input_shape, int32_t split_dim, absl::Span split_sizes) { if (split_dim != 0) { return false; } Tlen start = 0; for (const Tlen split_size : split_sizes) { if (!IsDim0SliceAligned(input_shape, start, start + split_size)) { return false; } start += split_size; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357435, "input": "static OPJ_BOOL opj_j2k_write_poc(opj_j2k_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_nb_comp; OPJ_UINT32 l_nb_poc; OPJ_UINT32 l_poc_size; OPJ_UINT32 l_written_size = 0; opj_tcp_t *l_tcp = 00; OPJ_UINT32 l_poc_room; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); l_tcp = &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]; l_nb_comp = p_j2k->m_private_image->numcomps; l_nb_poc = 1 + l_tcp->numpocs; if (l_nb_comp <= 256) { l_poc_room = 1; } else { l_poc_room = 2; } l_poc_size = 4 + (5 + 2 * l_poc_room) * l_nb_poc; if (l_poc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) { OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc( p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_poc_size); if (! new_header_tile_data) { opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data); p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL; p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0; opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to write POC marker\\n\"); return OPJ_FALSE; } p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data; p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_poc_size; } opj_j2k_write_poc_in_memory(p_j2k, p_j2k->m_specific_param.m_encoder.m_header_tile_data, &l_written_size, p_manager); if (opj_stream_write_data(p_stream, p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_poc_size, p_manager) != l_poc_size) { return OPJ_FALSE; } return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431429, "input": "static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs_commitargs *args = data; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_commit(xdr, args, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497596, "input": "void hmac_update(HMACCTX c, const void *data, unsigned long len) { gcry_md_write(c, data, len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 400919, "input": "ConnectClientToTcpAddr(unsigned int host, int port) { rfbSocket sock = ConnectClientToTcpAddrWithTimeout(host, port, DEFAULT_CONNECT_TIMEOUT); /* put socket back into blocking mode for compatibility reasons */ if (sock != RFB_INVALID_SOCKET) { SetBlocking(sock); } return sock; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212388, "input": "ec_p_init (mpi_ec_t ctx, enum gcry_mpi_ec_models model, enum ecc_dialects dialect, int flags, gcry_mpi_t p, gcry_mpi_t a, gcry_mpi_t b) { int i; static int use_barrett; if (!use_barrett) { if (getenv (\"GCRYPT_BARRETT\")) use_barrett = 1; else use_barrett = -1; } /* Fixme: Do we want to check some constraints? e.g. a < p */ ctx->model = model; ctx->dialect = dialect; ctx->flags = flags; if (dialect == ECC_DIALECT_ED25519) ctx->nbits = 256; else ctx->nbits = mpi_get_nbits (p); ctx->p = mpi_copy (p); ctx->a = mpi_copy (a); ctx->b = mpi_copy (b); ctx->t.p_barrett = use_barrett > 0? _gcry_mpi_barrett_init (ctx->p, 0):NULL; _gcry_mpi_ec_get_reset (ctx); /* Allocate scratch variables. */ for (i=0; i< DIM(ctx->t.scratch); i++) ctx->t.scratch[i] = mpi_alloc_like (ctx->p); /* Prepare for fast reduction. */ /* FIXME: need a test for NIST values. However it does not gain us any real advantage, for 384 bits it is actually slower than using mpi_mulm. */ /* ctx->nist_nbits = mpi_get_nbits (ctx->p); */ /* if (ctx->nist_nbits == 192) */ /* { */ /* for (i=0; i < 4; i++) */ /* ctx->s[i] = mpi_new (192); */ /* ctx->c = mpi_new (192*2); */ /* } */ /* else if (ctx->nist_nbits == 384) */ /* { */ /* for (i=0; i < 10; i++) */ /* ctx->s[i] = mpi_new (384); */ /* ctx->c = mpi_new (384*2); */ /* } */ }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "Libgcrypt before 1.8.1 does not properly consider Curve25519 side-channel attacks, which makes it easier for attackers to discover a secret key, related to cipher/ecc.c and mpi/ec.c.", "severity_level": "Medium", "cwe": "CWE-200", "cve": "CVE-2017-0379"}} -{"idx": 432023, "input": "static void hci_cs_le_create_conn(struct hci_dev *hdev, u8 status) { struct hci_cp_le_create_conn *cp; BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); /* All connection failure handling is taken care of by the * hci_le_conn_failed function which is triggered by the HCI * request completion callbacks used for connecting. */ if (status) return; cp = hci_sent_cmd_data(hdev, HCI_OP_LE_CREATE_CONN); if (!cp) return; hci_dev_lock(hdev); cs_le_create_conn(hdev, &cp->peer_addr, cp->peer_addr_type, cp->own_address_type, cp->filter_policy); hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 360787, "input": "static void nap_set(int tile_cnt) { int nap_in = nap_ok; time_t now = time(NULL); if (scan_count == 0) { /* roll up check for all NSCAN scans */ nap_ok = 0; if (naptile && nap_diff_count < 2 * NSCAN * naptile) { /* \"2\" is a fudge to permit a bit of bg drawing */ nap_ok = 1; } nap_diff_count = 0; } if (nap_ok && ! nap_in && use_xdamage) { if (XD_skip > 0.8 * XD_tot) { /* X DAMAGE is keeping load low, so skip nap */ nap_ok = 0; } } if (! nap_ok && client_count) { if(now > last_fb_bytes_sent + no_fbu_blank) { if (debug_tiles > 1) { fprintf(stderr, \"nap_set: nap_ok=1: now: %d last: %d\\n\", (int) now, (int) last_fb_bytes_sent); } nap_ok = 1; } } if (show_cursor) { /* kludge for the up to 4 tiles the mouse patch could occupy */ if ( tile_cnt > 4) { last_event = now; } } else if (tile_cnt != 0) { last_event = now; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219375, "input": "int string_crc32(const char *p, int len) { uint32_t crcinit = 0; register int32_t crc = crcinit ^ 0xFFFFFFFF; for (; len--; ++p) { crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF]; } return crc ^ 0xFFFFFFFF; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267928, "input": "explicit QuantizedAddOp(OpKernelConstruction* context) : OpKernel(context) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202401, "input": "_decodeStripYCbCr(Imaging im, ImagingCodecState state, TIFF *tiff) { // To avoid dealing with YCbCr subsampling, let libtiff handle it // Use a TIFFRGBAImage wrapping the tiff image, and let libtiff handle // all of the conversion. Metadata read from the TIFFRGBAImage could // be different from the metadata that the base tiff returns. INT32 strip_row; UINT8 *new_data; UINT32 rows_per_strip, row_byte_size, rows_to_read; int ret; TIFFRGBAImage img; char emsg[1024] = \"\"; ret = TIFFGetFieldDefaulted(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip); if (ret != 1) { rows_per_strip = state->ysize; } TRACE((\"RowsPerStrip: %u \\n\", rows_per_strip)); if (!(TIFFRGBAImageOK(tiff, emsg) && TIFFRGBAImageBegin(&img, tiff, 0, emsg))) { TRACE((\"Decode error, msg: %s\", emsg)); state->errcode = IMAGING_CODEC_BROKEN; // nothing to clean up, just return return -1; } img.req_orientation = ORIENTATION_TOPLEFT; img.col_offset = 0; if (state->xsize != img.width || state->ysize != img.height) { TRACE( (\"Inconsistent Image Error: %d =? %d, %d =? %d\", state->xsize, img.width, state->ysize, img.height)); state->errcode = IMAGING_CODEC_BROKEN; goto decodeycbcr_err; } /* overflow check for row byte size */ if (INT_MAX / 4 < img.width) { state->errcode = IMAGING_CODEC_MEMORY; goto decodeycbcr_err; } // TiffRGBAImages are 32bits/pixel. row_byte_size = img.width * 4; /* overflow check for realloc */ if (INT_MAX / row_byte_size < rows_per_strip) { state->errcode = IMAGING_CODEC_MEMORY; goto decodeycbcr_err; } state->bytes = rows_per_strip * row_byte_size; TRACE((\"StripSize: %d \\n\", state->bytes)); /* realloc to fit whole strip */ /* malloc check above */ new_data = realloc(state->buffer, state->bytes); if (!new_data) { state->errcode = IMAGING_CODEC_MEMORY; goto decodeycbcr_err; } state->buffer = new_data; for (; state->y < state->ysize; state->y += rows_per_strip) { img.row_offset = state->y; rows_to_read = min(rows_per_strip, img.height - state->y); if (TIFFRGBAImageGet(&img, (UINT32 *)state->buffer, img.width, rows_to_read) == -1) { TRACE((\"Decode Error, y: %d\\n\", state->y)); state->errcode = IMAGING_CODEC_BROKEN; goto decodeycbcr_err; } TRACE((\"Decoded strip for row %d \\n\", state->y)); // iterate over each row in the strip and stuff data into image for (strip_row = 0; strip_row < min((INT32)rows_per_strip, state->ysize - state->y); strip_row++) { TRACE((\"Writing data into line %d ; \\n\", state->y + strip_row)); // UINT8 * bbb = state->buffer + strip_row * (state->bytes / // rows_per_strip); TRACE((\"chars: %x %x %x %x\\n\", ((UINT8 *)bbb)[0], // ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3])); state->shuffle( (UINT8 *)im->image[state->y + state->yoff + strip_row] + state->xoff * im->pixelsize, state->buffer + strip_row * row_byte_size, state->xsize); } } decodeycbcr_err: TIFFRGBAImageEnd(&img); if (state->errcode != 0) { return -1; } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "An issue was discovered in Pillow before 8.1.1. TiffDecode has a heap-based buffer overflow when decoding crafted YCbCr files because of certain interpretation conflicts with LibTIFF in RGBA mode. NOTE: this issue exists because of an incomplete fix for CVE-2020-35654.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-25289"}} -{"idx": 322086, "input": "int pidfile_set_fd(int newpidfilefd) { pidfilefd = newpidfilefd; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346364, "input": "_evbuffer_testing_use_linear_file_access(void) { #ifdef USE_SENDFILE use_sendfile = 0; #endif #ifdef _EVENT_HAVE_MMAP use_mmap = 0; #endif return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 423623, "input": "report_name_conflict(Oid classId, const char *name) { char *msgfmt; switch (classId) { case EventTriggerRelationId: msgfmt = gettext_noop(\"event trigger \\\"%s\\\" already exists\"); break; case ForeignDataWrapperRelationId: msgfmt = gettext_noop(\"foreign-data wrapper \\\"%s\\\" already exists\"); break; case ForeignServerRelationId: msgfmt = gettext_noop(\"server \\\"%s\\\" already exists\"); break; case LanguageRelationId: msgfmt = gettext_noop(\"language \\\"%s\\\" already exists\"); break; case PublicationRelationId: msgfmt = gettext_noop(\"publication \\\"%s\\\" already exists\"); break; case SubscriptionRelationId: msgfmt = gettext_noop(\"subscription \\\"%s\\\" already exists\"); break; default: elog(ERROR, \"unsupported object class %u\", classId); break; } ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg(msgfmt, name))); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468956, "input": "static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4) { struct sock *sk = skb->sk; struct inet_sock *inet = inet_sk(sk); struct udphdr *uh; int err = 0; int is_udplite = IS_UDPLITE(sk); int offset = skb_transport_offset(skb); int len = skb->len - offset; __wsum csum = 0; /* * Create a UDP header */ uh = udp_hdr(skb); uh->source = inet->inet_sport; uh->dest = fl4->fl4_dport; uh->len = htons(len); uh->check = 0; if (is_udplite) /* UDP-Lite */ csum = udplite_csum(skb); else if (sk->sk_no_check_tx && !skb_is_gso(skb)) { /* UDP csum off */ skb->ip_summed = CHECKSUM_NONE; goto send; } else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */ udp4_hwcsum(skb, fl4->saddr, fl4->daddr); goto send; } else csum = udp_csum(skb); /* add protocol-dependent pseudo-header */ uh->check = csum_tcpudp_magic(fl4->saddr, fl4->daddr, len, sk->sk_protocol, csum); if (uh->check == 0) uh->check = CSUM_MANGLED_0; send: err = ip_send_skb(sock_net(sk), skb); if (err) { if (err == -ENOBUFS && !inet->recverr) { UDP_INC_STATS(sock_net(sk), UDP_MIB_SNDBUFERRORS, is_udplite); err = 0; } } else UDP_INC_STATS(sock_net(sk), UDP_MIB_OUTDATAGRAMS, is_udplite); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204380, "input": "p11_rpc_buffer_get_attribute (p11_buffer *buffer, size_t *offset, CK_ATTRIBUTE *attr) { uint32_t type, length; unsigned char validity; p11_rpc_attribute_serializer *serializer; p11_rpc_value_type value_type; /* The attribute type */ if (!p11_rpc_buffer_get_uint32 (buffer, offset, &type)) return false; /* Attribute validity */ if (!p11_rpc_buffer_get_byte (buffer, offset, &validity)) return false; /* Not a valid attribute */ if (!validity) { attr->ulValueLen = ((CK_ULONG)-1); attr->type = type; return true; } if (!p11_rpc_buffer_get_uint32 (buffer, offset, &length)) return false; /* Decode the attribute value */ value_type = map_attribute_to_value_type (type); assert (value_type < ELEMS (p11_rpc_attribute_serializers)); serializer = &p11_rpc_attribute_serializers[value_type]; assert (serializer != NULL); if (!serializer->decode (buffer, offset, attr->pValue, &attr->ulValueLen)) return false; if (!attr->pValue) attr->ulValueLen = length; attr->type = type; return true; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "An issue was discovered in p11-kit 0.23.6 through 0.23.21. A heap-based buffer overflow has been discovered in the RPC protocol used by p11-kit server/remote commands and the client library. When the remote entity supplies a serialized byte array in a CK_ATTRIBUTE, the receiving entity may not allocate sufficient length for the buffer to store the deserialized value.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-29363"}} -{"idx": 198140, "input": "void Compute(OpKernelContext* ctx) override { // This call processes inputs 1 and 2 to write output 0. ReshapeOp::Compute(ctx); const float input_min_float = ctx->input(2).flat()(0); const float input_max_float = ctx->input(3).flat()(0); Tensor* output_min = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(1, TensorShape({}), &output_min)); output_min->flat()(0) = input_min_float; Tensor* output_max = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(2, TensorShape({}), &output_max)); output_max->flat()(0) = input_max_float; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `QuantizedReshape` by passing in invalid thresholds for the quantization. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/a324ac84e573fba362a5e53d4e74d5de6729933e/tensorflow/core/kernels/quantized_reshape_op.cc#L38-L55) assumes that the 2 arguments are always valid scalars and tries to access the numeric value directly. However, if any of these tensors is empty, then `.flat()` is an empty buffer and accessing the element at position 0 results in overflow. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29536"}} -{"idx": 505388, "input": "struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) { static struct cgit_cmd cmds[] = { def_cmd(HEAD, 1, 0), def_cmd(about, 0, 1), def_cmd(blob, 1, 0), def_cmd(commit, 1, 1), def_cmd(diff, 1, 1), def_cmd(info, 1, 0), def_cmd(log, 1, 1), def_cmd(ls_cache, 0, 0), def_cmd(objects, 1, 0), def_cmd(patch, 1, 0), def_cmd(refs, 1, 1), def_cmd(repolist, 0, 0), def_cmd(snapshot, 1, 0), def_cmd(summary, 1, 1), def_cmd(tag, 1, 1), def_cmd(tree, 1, 1), }; int i; if (ctx->qry.page == NULL) { if (ctx->repo) ctx->qry.page = \"summary\"; else ctx->qry.page = \"repolist\"; } for(i = 0; i < sizeof(cmds)/sizeof(*cmds); i++) if (!strcmp(ctx->qry.page, cmds[i].name)) return &cmds[i]; return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402189, "input": "static inline int is_escaped(const char *min, const char *str) { int n = 0; while ( --str>=min && *str=='\\\\' ) n++; return n%2; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325850, "input": "get_current_oemcp(void) { int i; char *locale, *p; size_t len; locale = setlocale(LC_CTYPE, NULL); if (locale == NULL) return (GetOEMCP()); if (locale[0] == 'C' && locale[1] == '\\0') return (CP_C_LOCALE); p = strrchr(locale, '.'); if (p == NULL) return (GetOEMCP()); len = p - locale; for (i = 0; acp_ocp_map[i].acp; i++) { if (strncmp(acp_ocp_map[i].locale, locale, len) == 0) return (acp_ocp_map[i].ocp); } return (GetOEMCP()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431530, "input": "static int decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) { return decode_opaque_fixed(xdr, stateid, NFS4_STATEID_SIZE); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458389, "input": "static struct hid_input *hidinput_match(struct hid_report *report) { struct hid_device *hid = report->device; struct hid_input *hidinput; list_for_each_entry(hidinput, &hid->inputs, list) { if (hidinput->report && hidinput->report->id == report->id) return hidinput; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439905, "input": "ldns_rdf_type_maybe_quoted(ldns_rdf_type rdf_type) { return rdf_type == LDNS_RDF_TYPE_STR || rdf_type == LDNS_RDF_TYPE_LONG_STR; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357283, "input": "static void opj_j2k_read_float64_to_float(const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem) { OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data; OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data; OPJ_UINT32 i; OPJ_FLOAT64 l_temp; for (i = 0; i < p_nb_elem; ++i) { opj_read_double(l_src_data, &l_temp); l_src_data += sizeof(OPJ_FLOAT64); *(l_dest_data++) = (OPJ_FLOAT32) l_temp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 367052, "input": "static void sm501_pci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->realize = sm501_realize_pci; k->vendor_id = PCI_VENDOR_ID_SILICON_MOTION; k->device_id = PCI_DEVICE_ID_SM501; k->class_id = PCI_CLASS_DISPLAY_OTHER; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->desc = \"SM501 Display Controller\"; device_class_set_props(dc, sm501_pci_properties); dc->reset = sm501_reset_pci; dc->hotpluggable = false; dc->vmsd = &vmstate_sm501_pci; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432520, "input": "static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); u64 cr8; if (svm_nested_virtualize_tpr(vcpu) || kvm_vcpu_apicv_active(vcpu)) return; cr8 = kvm_get_cr8(vcpu); svm->vmcb->control.int_ctl &= ~V_TPR_MASK; svm->vmcb->control.int_ctl |= cr8 & V_TPR_MASK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281392, "input": "int RGWCopyObj_ObjStore_S3::init_dest_policy() { RGWAccessControlPolicy_S3 s3policy(s->cct); /* build a policy for the target object */ int r = create_s3_policy(s, store, s3policy, s->owner); if (r < 0) return r; dest_policy = s3policy; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232627, "input": "static void init_reg_state(struct bpf_verifier_env *env, struct bpf_func_state *state) { struct bpf_reg_state *regs = state->regs; int i; for (i = 0; i < MAX_BPF_REG; i++) { mark_reg_not_init(env, regs, i); regs[i].live = REG_LIVE_NONE; regs[i].parent = NULL; regs[i].subreg_def = DEF_NOT_SUBREG; } /* frame pointer */ regs[BPF_REG_FP].type = PTR_TO_STACK; mark_reg_known_zero(env, regs, BPF_REG_FP); regs[BPF_REG_FP].frameno = state->frameno; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376805, "input": "static avifBool avifParseSampleDescriptionBox(avifSampleTable * sampleTable, const uint8_t * raw, size_t rawLen) { BEGIN_STREAM(s, raw, rawLen); CHECK(avifROStreamReadAndEnforceVersion(&s, 0)); uint32_t entryCount; CHECK(avifROStreamReadU32(&s, &entryCount)); // unsigned int(32) entry_count; for (uint32_t i = 0; i < entryCount; ++i) { avifBoxHeader sampleEntryHeader; CHECK(avifROStreamReadBoxHeader(&s, &sampleEntryHeader)); avifSampleDescription * description = (avifSampleDescription *)avifArrayPushPtr(&sampleTable->sampleDescriptions); avifArrayCreate(&description->properties, sizeof(avifProperty), 16); memcpy(description->format, sampleEntryHeader.type, sizeof(description->format)); size_t remainingBytes = avifROStreamRemainingBytes(&s); if (!memcmp(description->format, \"av01\", 4) && (remainingBytes > VISUALSAMPLEENTRY_SIZE)) { CHECK(avifParseItemPropertyContainerBox( &description->properties, avifROStreamCurrent(&s) + VISUALSAMPLEENTRY_SIZE, remainingBytes - VISUALSAMPLEENTRY_SIZE)); } CHECK(avifROStreamSkip(&s, sampleEntryHeader.size)); } return AVIF_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378520, "input": "static Expr *sqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){ if( 0==sqlite3ExprIsConstant(pExpr) ){ if( IN_RENAME_OBJECT ) sqlite3RenameExprUnmap(pParse, pExpr); sqlite3ExprDelete(pParse->db, pExpr); pExpr = sqlite3ExprAlloc(pParse->db, TK_NULL, 0, 0); } return pExpr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 223185, "input": "TfLiteRegistration* Register_DEPTHWISE_CONVOLUTION_NEON_OPT() { static TfLiteRegistration r = { depthwise_conv::Init, depthwise_conv::Free, depthwise_conv::Prepare, depthwise_conv::Eval}; return &r; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508417, "input": "join_tab_cmp_straight(const void *dummy, const void* ptr1, const void* ptr2) { JOIN_TAB *jt1= *(JOIN_TAB**) ptr1; JOIN_TAB *jt2= *(JOIN_TAB**) ptr2; /* We don't do subquery flattening if the parent or child select has STRAIGHT_JOIN modifier. It is complicated to implement and the semantics is hardly useful. */ DBUG_ASSERT(!jt1->emb_sj_nest); DBUG_ASSERT(!jt2->emb_sj_nest); int cmp; if ((cmp= compare_embedding_subqueries(jt1, jt2)) != 0) return cmp; if (jt1->dependent & jt2->table->map) return 1; if (jt2->dependent & jt1->table->map) return -1; return jt1 > jt2 ? 1 : (jt1 < jt2 ? -1 : 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416758, "input": "static void cil_reset_classpermission(struct cil_classpermission *cp) { if (cp == NULL) { return; } cil_list_destroy(&cp->classperms, CIL_FALSE); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 284238, "input": "void h2_stream_set_request(h2_stream *stream, const h2_request *r) { ap_assert(stream->request == NULL); ap_assert(stream->rtmp == NULL); stream->rtmp = h2_request_clone(stream->pool, r); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212375, "input": "Pl_ASCII85Decoder::flush() { if (this->pos == 0) { QTC::TC(\"libtests\", \"Pl_ASCII85Decoder no-op flush\"); return; } unsigned long lval = 0; for (int i = 0; i < 5; ++i) { lval *= 85; lval += (this->inbuf[i] - 33U); } unsigned char outbuf[4]; memset(outbuf, 0, 4); for (int i = 3; i >= 0; --i) { outbuf[i] = lval & 0xff; lval >>= 8; } QTC::TC(\"libtests\", \"Pl_ASCII85Decoder partial flush\", (this->pos == 5) ? 0 : 1); getNext()->write(outbuf, this->pos - 1); this->pos = 0; memset(this->inbuf, 117, 5); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "QPDF 9.x through 9.1.1 and 10.x through 10.0.4 has a heap-based buffer overflow in Pl_ASCII85Decoder::write (called from Pl_AES_PDF::flush and Pl_AES_PDF::finish) when a certain downstream write fails.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-36978"}} -{"idx": 417877, "input": "char* SFDMoveToNextStartChar( FILE* sfd ) { char ret[2000]; memset( ret, '\\0', 2000 ); char* line = 0; while((line = getquotedeol( sfd ))) { if( !strnmatch( line, \"StartChar:\", strlen( \"StartChar:\" ))) { // FIXME: use the getname()/SFDReadUTF7Str() combo // from SFDGetChar int len = strlen(\"StartChar:\"); while( line[len] && line[len] == ' ' ) len++; strcpy( ret, line+len ); free(line); return copy(ret); } free(line); if(feof( sfd )) break; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393202, "input": "TEST_F(QueryPlannerTest, SkipEvaluatesAfterFetchWithPredicate) { addIndex(fromjson(\"{a: 1}\")); runQuerySkipNToReturn(fromjson(\"{a: 5, b: 7}\"), 8, 0); ASSERT_EQUALS(getNumSolutions(), 2U); assertSolutionExists(\"{skip: {n: 8, node: {cscan: {dir: 1, filter: {a: 5, b: 7}}}}}\"); // When a plan includes a fetch with no predicate, the skip should execute first, so we avoid // fetching a document that we will always discard. When the fetch does have a predicate (as in // this case), however, that optimization would be invalid; we need to fetch the document and // evaluate the filter to determine if the document should count towards the number of skipped // documents. assertSolutionExists( \"{skip: {n: 8, node: {fetch: {filter: {b: 7}, node: \" \"{ixscan: {filter: null, pattern: {a: 1}}}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 321873, "input": "static_fn Namval_t *scope(Namval_t *np, struct lval *lvalue, int assign) { int flag = lvalue->flag; char *sub = 0, *cp = (char *)np; Namval_t *mp; Shell_t *shp = lvalue->shp; int c = 0, nosub = lvalue->nosub; Dt_t *sdict = (shp->st.real_fun ? shp->st.real_fun->sdict : 0); Dt_t *nsdict = (shp->namespace ? nv_dict(shp->namespace) : 0); Dt_t *root = shp->var_tree; nvflag_t nvflags = assign ? NV_ASSIGN : 0; lvalue->nosub = 0; if (nosub < 0 && lvalue->ovalue) return (Namval_t *)lvalue->ovalue; lvalue->ovalue = NULL; if (cp >= lvalue->expr && cp < lvalue->expr + lvalue->elen) { int offset; // Do binding to node now. int d = cp[flag]; cp[flag] = 0; np = nv_open(cp, root, nvflags | NV_VARNAME | NV_NOADD | NV_NOFAIL); if ((!np || nv_isnull(np)) && sh_macfun(shp, cp, offset = stktell(shp->stk))) { Fun = sh_arith(shp, sub = stkptr(shp->stk, offset)); STORE_VT(FunNode.nvalue, sfdoublep, &Fun); FunNode.nvshell = shp; nv_onattr(&FunNode, NV_NOFREE | NV_LDOUBLE | NV_RDONLY); cp[flag] = d; return &FunNode; } if (!np && assign) { np = nv_open(cp, root, nvflags | NV_VARNAME); } cp[flag] = d; if (!np) return 0; root = shp->last_root; if (cp[flag + 1] == '[') { flag++; } else { flag = 0; } } if ((lvalue->emode & ARITH_COMP) && dtvnext(root)) { mp = nv_search_namval(np, sdict ? sdict : root, NV_NOSCOPE); if (!mp && nsdict) mp = nv_search_namval(np, nsdict, 0); if (mp) np = mp; } while (nv_isref(np)) { sub = nv_refsub(np); np = nv_refnode(np); if (sub) nv_putsub(np, sub, 0, assign ? ARRAY_ADD : 0); } if (!nosub && flag) { int hasdot = 0; cp = (char *)&lvalue->expr[flag]; if (sub) goto skip; sub = cp; while (1) { Namarr_t *ap; Namval_t *nq; cp = nv_endsubscript(np, cp, 0, shp); if (c || *cp == '.') { c = '.'; while (*cp == '.') { hasdot = 1; cp++; while (c = mb1char(&cp), isaname(c)) { ; // empty body } } if (c == '[') continue; } flag = *cp; *cp = 0; if (c || hasdot) { sfprintf(shp->strbuf, \"%s%s%c\", nv_name(np), sub, 0); sub = sfstruse(shp->strbuf); } if (strchr(sub, '$')) sub = sh_mactrim(shp, sub, 0); *cp = flag; if (c || hasdot) { np = nv_open(sub, shp->var_tree, NV_VARNAME | nvflags); return np; } cp = nv_endsubscript(np, sub, (assign ? NV_ADD : 0) | NV_SUBQUOTE, np->nvshell); if (*cp != '[') break; skip: nq = nv_opensub(np); if (nq) { np = nq; } else { ap = nv_arrayptr(np); if (ap && !ap->table) { ap->table = dtopen(&_Nvdisc, Dtoset); dtuserdata(ap->table, shp, 1); } if (ap && ap->table && (nq = nv_search(nv_getsub(np), ap->table, NV_ADD))) { nq->nvenv = np; } if (nq && nv_isnull(nq)) np = nv_arraychild(np, nq, 0); } sub = cp; } } else if (nosub > 0) { nv_putsub(np, NULL, nosub - 1, 0); } return np; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509349, "input": "bool is_bool_type() { return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219125, "input": "bool HHVM_FUNCTION(image2wbmp, const Resource& image, const String& filename /* = null_string */, int64_t threshold /* = -1 */) { return _php_image_output(image, filename, threshold, -1, PHP_GDIMG_CONVERT_WBM, \"WBMP\", (void (*)())_php_image_bw_convert); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402376, "input": "HttpStateData::reusableReply(HttpStateData::ReuseDecision &decision) { HttpReply const *rep = finalReply(); HttpHeader const *hdr = &rep->header; const char *v; #if USE_HTTP_VIOLATIONS const RefreshPattern *R = NULL; /* This strange looking define first looks up the refresh pattern * and then checks if the specified flag is set. The main purpose * of this is to simplify the refresh pattern lookup and USE_HTTP_VIOLATIONS * condition */ #define REFRESH_OVERRIDE(flag) \\ ((R = (R ? R : refreshLimits(entry->mem_obj->storeId()))) , \\ (R && R->flags.flag)) #else #define REFRESH_OVERRIDE(flag) 0 #endif if (EBIT_TEST(entry->flags, RELEASE_REQUEST)) return decision.make(ReuseDecision::doNotCacheButShare, \"the entry has been released\"); // RFC 7234 section 4: a cache MUST use the most recent response // (as determined by the Date header field) // TODO: whether such responses could be shareable? if (sawDateGoBack) return decision.make(ReuseDecision::reuseNot, \"the response has an older date header\"); // Check for Surrogate/1.0 protocol conditions // NP: reverse-proxy traffic our parent server has instructed us never to cache if (surrogateNoStore) return decision.make(ReuseDecision::reuseNot, \"Surrogate-Control:no-store\"); // RFC 2616: HTTP/1.1 Cache-Control conditions if (!ignoreCacheControl) { // XXX: check to see if the request headers alone were enough to prevent caching earlier // (ie no-store request header) no need to check those all again here if so. // for now we are not reliably doing that so we waste CPU re-checking request CC // RFC 2616 section 14.9.2 - MUST NOT cache any response with request CC:no-store if (request && request->cache_control && request->cache_control->hasNoStore() && !REFRESH_OVERRIDE(ignore_no_store)) return decision.make(ReuseDecision::reuseNot, \"client request Cache-Control:no-store\"); // NP: request CC:no-cache only means cache READ is forbidden. STORE is permitted. if (rep->cache_control && rep->cache_control->hasNoCacheWithParameters()) { /* TODO: we are allowed to cache when no-cache= has parameters. * Provided we strip away any of the listed headers unless they are revalidated * successfully (ie, must revalidate AND these headers are prohibited on stale replies). * That is a bit tricky for squid right now so we avoid caching entirely. */ return decision.make(ReuseDecision::reuseNot, \"server reply Cache-Control:no-cache has parameters\"); } // NP: request CC:private is undefined. We ignore. // NP: other request CC flags are limiters on HIT/MISS. We don't care about here. // RFC 2616 section 14.9.2 - MUST NOT cache any response with CC:no-store if (rep->cache_control && rep->cache_control->hasNoStore() && !REFRESH_OVERRIDE(ignore_no_store)) return decision.make(ReuseDecision::reuseNot, \"server reply Cache-Control:no-store\"); // RFC 2616 section 14.9.1 - MUST NOT cache any response with CC:private in a shared cache like Squid. // CC:private overrides CC:public when both are present in a response. // TODO: add a shared/private cache configuration possibility. if (rep->cache_control && rep->cache_control->hasPrivate() && !REFRESH_OVERRIDE(ignore_private)) { /* TODO: we are allowed to cache when private= has parameters. * Provided we strip away any of the listed headers unless they are revalidated * successfully (ie, must revalidate AND these headers are prohibited on stale replies). * That is a bit tricky for squid right now so we avoid caching entirely. */ return decision.make(ReuseDecision::reuseNot, \"server reply Cache-Control:private\"); } } // RFC 2068, sec 14.9.4 - MUST NOT cache any response with Authentication UNLESS certain CC controls are present // allow HTTP violations to IGNORE those controls (ie re-block caching Auth) if (request && (request->flags.auth || request->flags.authSent)) { if (!rep->cache_control) return decision.make(ReuseDecision::reuseNot, \"authenticated and server reply missing Cache-Control\"); if (ignoreCacheControl) return decision.make(ReuseDecision::reuseNot, \"authenticated and ignoring Cache-Control\"); bool mayStore = false; // HTTPbis pt6 section 3.2: a response CC:public is present if (rep->cache_control->hasPublic()) { debugs(22, 3, HERE << \"Authenticated but server reply Cache-Control:public\"); mayStore = true; // HTTPbis pt6 section 3.2: a response CC:must-revalidate is present } else if (rep->cache_control->hasMustRevalidate()) { debugs(22, 3, HERE << \"Authenticated but server reply Cache-Control:must-revalidate\"); mayStore = true; #if USE_HTTP_VIOLATIONS // NP: given the must-revalidate exception we should also be able to exempt no-cache. // HTTPbis WG verdict on this is that it is omitted from the spec due to being 'unexpected' by // some. The caching+revalidate is not exactly unsafe though with Squids interpretation of no-cache // (without parameters) as equivalent to must-revalidate in the reply. } else if (rep->cache_control->hasNoCacheWithoutParameters()) { debugs(22, 3, HERE << \"Authenticated but server reply Cache-Control:no-cache (equivalent to must-revalidate)\"); mayStore = true; #endif // HTTPbis pt6 section 3.2: a response CC:s-maxage is present } else if (rep->cache_control->hasSMaxAge()) { debugs(22, 3, HERE << \"Authenticated but server reply Cache-Control:s-maxage\"); mayStore = true; } if (!mayStore) return decision.make(ReuseDecision::reuseNot, \"authenticated transaction\"); // NP: response CC:no-cache is equivalent to CC:must-revalidate,max-age=0. We MAY cache, and do so. // NP: other request CC flags are limiters on HIT/MISS/REFRESH. We don't care about here. } /* HACK: The \"multipart/x-mixed-replace\" content type is used for * continuous push replies. These are generally dynamic and * probably should not be cachable */ if ((v = hdr->getStr(Http::HdrType::CONTENT_TYPE))) if (!strncasecmp(v, \"multipart/x-mixed-replace\", 25)) return decision.make(ReuseDecision::reuseNot, \"Content-Type:multipart/x-mixed-replace\"); // TODO: if possible, provide more specific message for each status code static const char *shareableError = \"shareable error status code\"; static const char *nonShareableError = \"non-shareable error status code\"; ReuseDecision::Answers statusAnswer = ReuseDecision::reuseNot; const char *statusReason = nonShareableError; switch (rep->sline.status()) { /* There are several situations when a non-cacheable response may be * still shareable (e.g., among collapsed clients). We assume that these * are 3xx and 5xx responses, indicating server problems and some of * 4xx responses, common for all clients with a given cache key (e.g., * 404 Not Found or 414 URI Too Long). On the other hand, we should not * share non-cacheable client-specific errors, such as 400 Bad Request * or 406 Not Acceptable. */ /* Responses that are cacheable */ case Http::scOkay: case Http::scNonAuthoritativeInformation: case Http::scMultipleChoices: case Http::scMovedPermanently: case Http::scPermanentRedirect: case Http::scGone: /* * Don't cache objects that need to be refreshed on next request, * unless we know how to refresh it. */ if (refreshIsCachable(entry) || REFRESH_OVERRIDE(store_stale)) decision.make(ReuseDecision::cachePositively, \"refresh check returned cacheable\"); else decision.make(ReuseDecision::doNotCacheButShare, \"refresh check returned non-cacheable\"); break; /* Responses that only are cacheable if the server says so */ case Http::scFound: case Http::scTemporaryRedirect: if (rep->date <= 0) decision.make(ReuseDecision::doNotCacheButShare, \"Date is missing/invalid\"); else if (rep->expires > rep->date) decision.make(ReuseDecision::cachePositively, \"Expires > Date\"); else decision.make(ReuseDecision::doNotCacheButShare, \"Expires <= Date\"); break; /* These responses can be negatively cached. Most can also be shared. */ case Http::scNoContent: case Http::scUseProxy: case Http::scForbidden: case Http::scNotFound: case Http::scMethodNotAllowed: case Http::scUriTooLong: case Http::scInternalServerError: case Http::scNotImplemented: case Http::scBadGateway: case Http::scServiceUnavailable: case Http::scGatewayTimeout: case Http::scMisdirectedRequest: statusAnswer = ReuseDecision::doNotCacheButShare; statusReason = shareableError; // fall through to the actual decision making below case Http::scBadRequest: // no sharing; perhaps the server did not like something specific to this request #if USE_HTTP_VIOLATIONS if (Config.negativeTtl > 0) decision.make(ReuseDecision::cacheNegatively, \"Config.negativeTtl > 0\"); else #endif decision.make(statusAnswer, statusReason); break; /* these responses can never be cached, some of them can be shared though */ case Http::scSeeOther: case Http::scNotModified: case Http::scUnauthorized: case Http::scProxyAuthenticationRequired: case Http::scPaymentRequired: case Http::scInsufficientStorage: // TODO: use more specific reason for non-error status codes decision.make(ReuseDecision::doNotCacheButShare, shareableError); break; case Http::scPartialContent: /* Not yet supported. TODO: make shareable for suitable ranges */ case Http::scNotAcceptable: case Http::scRequestTimeout: // TODO: is this shareable? case Http::scConflict: // TODO: is this shareable? case Http::scLengthRequired: case Http::scPreconditionFailed: case Http::scPayloadTooLarge: case Http::scUnsupportedMediaType: case Http::scUnprocessableEntity: case Http::scLocked: // TODO: is this shareable? case Http::scFailedDependency: case Http::scRequestedRangeNotSatisfied: case Http::scExpectationFailed: case Http::scInvalidHeader: /* Squid header parsing error */ case Http::scHeaderTooLarge: decision.make(ReuseDecision::reuseNot, nonShareableError); break; default: /* RFC 2616 section 6.1.1: an unrecognized response MUST NOT be cached. */ decision.make(ReuseDecision::reuseNot, \"unknown status code\"); break; } return decision.answer; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196768, "input": "static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size) { int i, j, ret; int64_t off; int val_1; int num_video; AVIOContext pb0, *pb = &pb0; ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL); ffio_read_varlen(pb); // track_header_len avio_r8(pb); // '1' val_1 = ffio_read_varlen(pb); for (i=0;iid = i; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = AV_CODEC_ID_VP6; off = avio_tell(pb); off += ffio_read_varlen(pb); avio_r8(pb); // '3' avio_r8(pb); // val_7 num = avio_rl32(pb); // frame_time den = avio_rl32(pb); // time_base avpriv_set_pts_info(st, 64, num, den); st->nb_frames = avio_rl32(pb); // n frames st->codecpar->width = avio_rl16(pb); // width st->codecpar->height = avio_rl16(pb); // height avio_r8(pb); // val_8 avio_rl32(pb); // val_9 avio_seek(pb, off, SEEK_SET); } off = avio_tell(pb); off += ffio_read_varlen(pb); // val_10 avio_r8(pb); // '4' viv->num_audio = avio_r8(pb); avio_seek(pb, off, SEEK_SET); if (viv->num_audio != 1) av_log(s, AV_LOG_WARNING, \"number of audio tracks %d is not 1\\n\", viv->num_audio); for(i=0;inum_audio;i++) { int q; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->id = num_video + i; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_VORBIS; off = avio_tell(pb); off += ffio_read_varlen(pb); // length avio_r8(pb); // '5' avio_r8(pb); //codec_id avio_rl16(pb); //codec_subid st->codecpar->channels = avio_rl16(pb); // channels st->codecpar->sample_rate = avio_rl32(pb); // sample_rate avio_seek(pb, 10, SEEK_CUR); // data_1 q = avio_r8(pb); avio_seek(pb, q, SEEK_CUR); // data_2 avio_r8(pb); // zeropad if (avio_tell(pb) < off) { int num_data; int xd_size = 0; int data_len[256]; int offset = 1; uint8_t *p; ffio_read_varlen(pb); // val_13 avio_r8(pb); // '19' ffio_read_varlen(pb); // len_3 num_data = avio_r8(pb); for (j = 0; j < num_data; j++) { uint64_t len = ffio_read_varlen(pb); if (len > INT_MAX/2 - xd_size) { return AVERROR_INVALIDDATA; } data_len[j] = len; xd_size += len; } ret = ff_alloc_extradata(st->codecpar, 64 + xd_size + xd_size / 255); if (ret < 0) return ret; p = st->codecpar->extradata; p[0] = 2; for (j = 0; j < num_data - 1; j++) { unsigned delta = av_xiphlacing(&p[offset], data_len[j]); if (delta > data_len[j]) { return AVERROR_INVALIDDATA; } offset += delta; } for (j = 0; j < num_data; j++) { int ret = avio_read(pb, &p[offset], data_len[j]); if (ret < data_len[j]) { st->codecpar->extradata_size = 0; av_freep(&st->codecpar->extradata); break; } offset += data_len[j]; } if (offset < st->codecpar->extradata_size) st->codecpar->extradata_size = offset; } } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "track_header in libavformat/vividas.c in FFmpeg 4.3.1 has an out-of-bounds write because of incorrect extradata packing.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-35964"}} -{"idx": 200327, "input": "void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRMLS_DC) { void **old_p, *retval; if (zend_hash_index_find(&xlat_table, (ulong)source, (void **)&old_p) == SUCCESS) { /* we already duplicated this pointer */ return *old_p; } retval = ZCG(mem);; ZCG(mem) = (void*)(((char*)ZCG(mem)) + ZEND_ALIGNED_SIZE(size)); memcpy(retval, source, size); if (free_source) { interned_efree((char*)source); } zend_shared_alloc_register_xlat_entry(source, retval); return retval; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "Use-after-free vulnerability in the _zend_shared_memdup function in zend_shared_alloc.c in the OPcache extension in PHP through 5.6.7 allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors.", "severity_level": "High", "cwe": "CWE-416", "cve": "CVE-2015-1351"}} -{"idx": 268869, "input": "R_API int r_str_unescape(char *buf) { unsigned char ch = 0, ch2 = 0; int err = 0; int i; for (i = 0; buf[i]; i++) { if (buf[i] != '\\\\') { continue; } int esc_seq_len = 2; switch (buf[i + 1]) { case 'e': buf[i] = 0x1b; break; case '\\\\': buf[i] = '\\\\'; break; case 'r': buf[i] = 0x0d; break; case 'n': buf[i] = 0x0a; break; case 'a': buf[i] = 0x07; break; case 'b': buf[i] = 0x08; break; case 't': buf[i] = 0x09; break; case 'v': buf[i] = 0x0b; break; case 'f': buf[i] = 0x0c; break; case 'x': err = ch2 = ch = 0; if (!buf[i + 2] || !buf[i + 3]) { eprintf (\"Unexpected end of string.\\n\"); return 0; } err |= r_hex_to_byte (&ch, buf[i + 2]); err |= r_hex_to_byte (&ch2, buf[i + 3]); if (err) { eprintf (\"Error: Non-hexadecimal chars in input.\\n\"); return 0; // -1? } buf[i] = (ch << 4) + ch2; esc_seq_len = 4; break; default: if (IS_OCTAL (buf[i + 1])) { int num_digits = 1; buf[i] = buf[i + 1] - '0'; if (IS_OCTAL (buf[i + 2])) { num_digits++; buf[i] = (ut8)buf[i] * 8 + (buf[i + 2] - '0'); if (IS_OCTAL (buf[i + 3])) { num_digits++; buf[i] = (ut8)buf[i] * 8 + (buf[i + 3] - '0'); } } esc_seq_len = 1 + num_digits; } else { eprintf (\"Error: Unknown escape sequence.\\n\"); return 0; // -1? } } memmove (buf + i + 1, buf + i + esc_seq_len, strlen (buf + i + esc_seq_len) + 1); } return i; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437081, "input": "static void con_flush(struct vc_data *vc, unsigned long draw_from, unsigned long draw_to, int *draw_x) { if (*draw_x < 0) return; vc->vc_sw->con_putcs(vc, (u16 *)draw_from, (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, *draw_x); *draw_x = -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446293, "input": "ScanLineInputFile::~ScanLineInputFile () { if (!_data->memoryMapped) { for (size_t i = 0; i < _data->lineBuffers.size(); i++) { EXRFreeAligned(_data->lineBuffers[i]->buffer); } } // // ScanLineInputFile should never delete the stream, // because it does not own the stream. // We just delete the Mutex here. // if (_data->partNumber == -1) delete _streamData; delete _data; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 414547, "input": "rndr_strikethrough(struct buf *ob, const struct buf *text, void *opaque) { if (!text || !text->size) return 0; BUFPUTSL(ob, \"\"); bufput(ob, text->data, text->size); BUFPUTSL(ob, \"\"); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 411773, "input": "BOOL bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* interleaved) { if (!interleaved) return FALSE; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263053, "input": "sc_get_iasecc_driver(void) { return sc_get_driver(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366773, "input": "void mpol_free_shared_policy(struct shared_policy *p) { struct sp_node *n; struct rb_node *next; if (!p->root.rb_node) return; write_lock(&p->lock); next = rb_first(&p->root); while (next) { n = rb_entry(next, struct sp_node, nd); next = rb_next(&n->nd); sp_delete(p, n); } write_unlock(&p->lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 438568, "input": "MagickExport Image *DestroyImage(Image *image) { MagickBooleanType destroy; /* Dereference image. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); destroy=MagickFalse; LockSemaphoreInfo(image->semaphore); image->reference_count--; if (image->reference_count == 0) destroy=MagickTrue; UnlockSemaphoreInfo(image->semaphore); if (destroy == MagickFalse) return((Image *) NULL); /* Destroy image. */ DestroyImagePixels(image); if (image->clip_mask != (Image *) NULL) image->clip_mask=DestroyImage(image->clip_mask); if (image->mask != (Image *) NULL) image->mask=DestroyImage(image->mask); if (image->montage != (char *) NULL) image->montage=DestroyString(image->montage); if (image->directory != (char *) NULL) image->directory=DestroyString(image->directory); if (image->colormap != (PixelPacket *) NULL) image->colormap=(PixelPacket *) RelinquishMagickMemory(image->colormap); if (image->geometry != (char *) NULL) image->geometry=DestroyString(image->geometry); DestroyImageProfiles(image); DestroyImageProperties(image); DestroyImageArtifacts(image); if (image->ascii85 != (Ascii85Info*) NULL) image->ascii85=(Ascii85Info *) RelinquishMagickMemory(image->ascii85); DestroyBlob(image); (void) ClearExceptionInfo(&image->exception,MagickTrue); if (image->semaphore != (SemaphoreInfo *) NULL) DestroySemaphoreInfo(&image->semaphore); image->signature=(~MagickCoreSignature); image=(Image *) RelinquishMagickMemory(image); return(image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354538, "input": "int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) { int r; switch (ext) { case KVM_CAP_S390_PSW: case KVM_CAP_S390_GMAP: case KVM_CAP_SYNC_MMU: #ifdef CONFIG_KVM_S390_UCONTROL case KVM_CAP_S390_UCONTROL: #endif case KVM_CAP_ASYNC_PF: case KVM_CAP_SYNC_REGS: case KVM_CAP_ONE_REG: case KVM_CAP_ENABLE_CAP: case KVM_CAP_S390_CSS_SUPPORT: case KVM_CAP_IOEVENTFD: case KVM_CAP_DEVICE_CTRL: case KVM_CAP_S390_IRQCHIP: case KVM_CAP_VM_ATTRIBUTES: case KVM_CAP_MP_STATE: case KVM_CAP_IMMEDIATE_EXIT: case KVM_CAP_S390_INJECT_IRQ: case KVM_CAP_S390_USER_SIGP: case KVM_CAP_S390_USER_STSI: case KVM_CAP_S390_SKEYS: case KVM_CAP_S390_IRQ_STATE: case KVM_CAP_S390_USER_INSTR0: case KVM_CAP_S390_CMMA_MIGRATION: case KVM_CAP_S390_AIS: case KVM_CAP_S390_AIS_MIGRATION: case KVM_CAP_S390_VCPU_RESETS: r = 1; break; case KVM_CAP_S390_HPAGE_1M: r = 0; if (hpage && !kvm_is_ucontrol(kvm)) r = 1; break; case KVM_CAP_S390_MEM_OP: r = MEM_OP_MAX_SIZE; break; case KVM_CAP_NR_VCPUS: case KVM_CAP_MAX_VCPUS: case KVM_CAP_MAX_VCPU_ID: r = KVM_S390_BSCA_CPU_SLOTS; if (!kvm_s390_use_sca_entries()) r = KVM_MAX_VCPUS; else if (sclp.has_esca && sclp.has_64bscao) r = KVM_S390_ESCA_CPU_SLOTS; break; case KVM_CAP_S390_COW: r = MACHINE_HAS_ESOP; break; case KVM_CAP_S390_VECTOR_REGISTERS: r = MACHINE_HAS_VX; break; case KVM_CAP_S390_RI: r = test_facility(64); break; case KVM_CAP_S390_GS: r = test_facility(133); break; case KVM_CAP_S390_BPB: r = test_facility(82); break; case KVM_CAP_S390_PROTECTED: r = is_prot_virt_host(); break; default: r = 0; } return r; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295845, "input": "rfbClientListInit(rfbScreenInfoPtr rfbScreen) { if(sizeof(rfbBool)!=1) { /* a sanity check */ fprintf(stderr,\"rfbBool's size is not 1 (%d)!\\n\",(int)sizeof(rfbBool)); /* we cannot continue, because rfbBool is supposed to be char everywhere */ exit(1); } rfbScreen->clientHead = NULL; INIT_MUTEX(rfbClientListMutex); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230472, "input": "bool CLua::proc_returns(const char *par) const { return strchr(par, '>') != nullptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268301, "input": "const FunctionDefLibrary* library() const override { return library_; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412032, "input": "grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows, CellPixelSize cell) { if (self->last_scrolled_by != scrolled_by) self->layers_dirty = true; self->last_scrolled_by = scrolled_by; if (!self->layers_dirty) return false; self->layers_dirty = false; size_t i, j; self->num_of_below_refs = 0; self->num_of_negative_refs = 0; self->num_of_positive_refs = 0; Image *img; ImageRef *ref; ImageRect r; float screen_width = dx * num_cols, screen_height = dy * num_rows; float screen_bottom = screen_top - screen_height; float screen_width_px = num_cols * cell.width; float screen_height_px = num_rows * cell.height; float y0 = screen_top - dy * scrolled_by; // Iterate over all visible refs and create render data self->count = 0; for (i = 0; i < self->image_count; i++) { img = self->images + i; for (j = 0; j < img->refcnt; j++) { ref = img->refs + j; r.top = y0 - ref->start_row * dy - dy * (float)ref->cell_y_offset / (float)cell.height; if (ref->num_rows > 0) r.bottom = y0 - (ref->start_row + (int32_t)ref->num_rows) * dy; else r.bottom = r.top - screen_height * (float)ref->src_height / screen_height_px; if (r.top <= screen_bottom || r.bottom >= screen_top) continue; // not visible r.left = screen_left + ref->start_column * dx + dx * (float)ref->cell_x_offset / (float) cell.width; if (ref->num_cols > 0) r.right = screen_left + (ref->start_column + (int32_t)ref->num_cols) * dx; else r.right = r.left + screen_width * (float)ref->src_width / screen_width_px; if (ref->z_index < ((int32_t)INT32_MIN/2)) self->num_of_below_refs++; else if (ref->z_index < 0) self->num_of_negative_refs++; else self->num_of_positive_refs++; ensure_space_for(self, render_data, ImageRenderData, self->count + 1, capacity, 64, true); ImageRenderData *rd = self->render_data + self->count; zero_at_ptr(rd); set_vertex_data(rd, ref, &r); self->count++; rd->z_index = ref->z_index; rd->image_id = img->internal_id; rd->texture_id = img->texture_id; }} if (!self->count) return false; // Sort visible refs in draw order (z-index, img) qsort(self->render_data, self->count, sizeof(self->render_data[0]), cmp_by_zindex_and_image); // Calculate the group counts i = 0; while (i < self->count) { id_type image_id = self->render_data[i].image_id, start = i; if (start == self->count - 1) i = self->count; else { while (i < self->count - 1 && self->render_data[++i].image_id == image_id) {} } self->render_data[start].group_count = i - start; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445788, "input": "static void free_trace_buffer(struct trace_buffer *buf) { if (buf->buffer) { ring_buffer_free(buf->buffer); buf->buffer = NULL; free_percpu(buf->data); buf->data = NULL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429723, "input": "MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res) { return res->data_cursor; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196870, "input": "PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp) { if (dt_table[Elf64_Dyn::DT_NULL]) { return; // not 1st time; do not change upx_dt_init } Elf64_Dyn const *const dynp0 = dynp; unsigned ndx = 1+ 0; if (dynp) for (; ; ++ndx, ++dynp) { upx_uint64_t const d_tag = get_te64(&dynp->d_tag); if (d_tag>>32) { // outrageous char msg[50]; snprintf(msg, sizeof(msg), \"bad Elf64_Dyn[%d].d_tag %#lx\", -1+ ndx, (long unsigned)d_tag); throwCantPack(msg); } if (d_tag < DT_NUM) { if (Elf64_Dyn::DT_NEEDED != d_tag && dt_table[d_tag] && get_te64(&dynp->d_val) != get_te64(&dynp0[-1+ dt_table[d_tag]].d_val)) { char msg[50]; snprintf(msg, sizeof(msg), \"duplicate DT_%#x: [%#x] [%#x]\", (unsigned)d_tag, -1+ dt_table[d_tag], -1+ ndx); throwCantPack(msg); } dt_table[d_tag] = ndx; } if (Elf64_Dyn::DT_NULL == d_tag) { break; // check here so that dt_table[DT_NULL] is set } } upx_dt_init = 0; if (dt_table[Elf64_Dyn::DT_INIT]) upx_dt_init = Elf64_Dyn::DT_INIT; else if (dt_table[Elf64_Dyn::DT_PREINIT_ARRAY]) upx_dt_init = Elf64_Dyn::DT_PREINIT_ARRAY; else if (dt_table[Elf64_Dyn::DT_INIT_ARRAY]) upx_dt_init = Elf64_Dyn::DT_INIT_ARRAY; unsigned const z_str = dt_table[Elf64_Dyn::DT_STRSZ]; if (z_str) { strtab_end = get_te64(&dynp0[-1+ z_str].d_val); if ((u64_t)file_size <= strtab_end) { // FIXME: weak char msg[50]; snprintf(msg, sizeof(msg), \"bad DT_STRSZ %#x\", strtab_end); throwCantPack(msg); } } // DT_SYMTAB has no designated length. // End it when next area else starts; often DT_STRTAB. (FIXME) unsigned const x_sym = dt_table[Elf64_Dyn::DT_SYMTAB]; unsigned const x_str = dt_table[Elf64_Dyn::DT_STRTAB]; if (x_sym && x_str) { upx_uint64_t const v_sym = get_te64(&dynp0[-1+ x_sym].d_val); upx_uint64_t const v_str = get_te64(&dynp0[-1+ x_str].d_val); unsigned const z_sym = dt_table[Elf64_Dyn::DT_SYMENT]; unsigned const sz_sym = !z_sym ? sizeof(Elf64_Sym) : get_te64(&dynp0[-1+ z_sym].d_val); if (v_sym < v_str) { symnum_end = (v_str - v_sym) / sz_sym; } } // DT_HASH often ends at DT_SYMTAB unsigned const v_hsh = elf_unsigned_dynamic(Elf64_Dyn::DT_HASH); if (v_hsh && file_image) { hashtab = (unsigned const *)elf_find_dynamic(Elf64_Dyn::DT_HASH); if (!hashtab) { char msg[40]; snprintf(msg, sizeof(msg), \"bad DT_HASH %#x\", v_hsh); throwCantPack(msg); } unsigned const nbucket = get_te32(&hashtab[0]); unsigned const *const buckets = &hashtab[2]; unsigned const *const chains = &buckets[nbucket]; (void)chains; unsigned const v_sym = get_te32(&dynp0[-1+ x_sym].d_val); if (!nbucket || (nbucket>>31) || (file_size/sizeof(unsigned)) <= (2*nbucket) // FIXME: weak || ((v_hsh < v_sym) && (v_sym - v_hsh) < (sizeof(unsigned)*2 // headers + sizeof(*buckets)*nbucket // buckets + sizeof(*chains) *nbucket // chains )) ) { char msg[90]; snprintf(msg, sizeof(msg), \"bad DT_HASH nbucket=%#x len=%#x\", nbucket, (v_sym - v_hsh)); throwCantPack(msg); } } // DT_GNU_HASH often ends at DT_SYMTAB; FIXME: not for Android? unsigned const v_gsh = elf_unsigned_dynamic(Elf64_Dyn::DT_GNU_HASH); if (v_gsh && file_image) { gashtab = (unsigned const *)elf_find_dynamic(Elf64_Dyn::DT_GNU_HASH); if (!gashtab) { char msg[40]; snprintf(msg, sizeof(msg), \"bad DT_GNU_HASH %#x\", v_gsh); throwCantPack(msg); } unsigned const n_bucket = get_te32(&gashtab[0]); unsigned const n_bitmask = get_te32(&gashtab[2]); unsigned const gnu_shift = get_te32(&gashtab[3]); upx_uint64_t const *const bitmask = (upx_uint64_t const *)(void const *)&gashtab[4]; unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask]; unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; //unsigned const *const gashend = &hasharr[n_bucket]; // minimum upx_uint64_t const v_sym = get_te64(&dynp0[-1+ x_sym].d_val); if (!n_bucket || !n_bitmask || (-1+ n_bitmask) & n_bitmask // not a power of 2 || 8*sizeof(upx_uint64_t) <= gnu_shift // shifted result always == 0 || (n_bucket>>30) // fie on fuzzers || (n_bitmask>>30) || (file_size/sizeof(unsigned)) <= ((sizeof(*bitmask)/sizeof(unsigned))*n_bitmask + 2*n_bucket) // FIXME: weak // FIXME: next test does work for Android? || ((v_gsh < v_sym) && (v_sym - v_gsh) < (sizeof(unsigned)*4 // headers + sizeof(*bitmask)*n_bitmask // bitmask + sizeof(*buckets)*n_bucket // buckets + sizeof(*hasharr)*n_bucket // hasharr )) ) { char msg[90]; snprintf(msg, sizeof(msg), \"bad DT_GNU_HASH n_bucket=%#x n_bitmask=%#x len=%#lx\", n_bucket, n_bitmask, (long unsigned)(v_sym - v_gsh)); throwCantPack(msg); } } unsigned const e_shstrndx = get_te16(&ehdri.e_shstrndx); if (e_shnum <= e_shstrndx && !(0==e_shnum && 0==e_shstrndx) ) { char msg[40]; snprintf(msg, sizeof(msg), \"bad .e_shstrndx %d >= .e_shnum %d\", e_shstrndx, e_shnum); throwCantPack(msg); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "A floating point exception issue was discovered in UPX in PackLinuxElf64::invert_pt_dynamic() function of p_lx_elf.cpp file. An attacker with a crafted input file could trigger this issue that could cause a crash leading to a denial of service. The highest impact is to Availability.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2020-27790"}} -{"idx": 204491, "input": "static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, char *name) { XImage *xim; static int reported_flip = 0; int db = 0; shm->shmid = -1; shm->shmaddr = (char *) -1; *ximg_ptr = NULL; if (nofb) { return 1; } X_LOCK; if (! using_shm || xform24to32 || raw_fb) { /* we only need the XImage created */ xim = XCreateImage_wr(dpy, default_visual, depth, ZPixmap, 0, NULL, w, h, raw_fb ? 32 : BitmapPad(dpy), 0); X_UNLOCK; if (xim == NULL) { rfbErr(\"XCreateImage(%s) failed.\\n\", name); if (quiet) { fprintf(stderr, \"XCreateImage(%s) failed.\\n\", name); } return 0; } if (db) fprintf(stderr, \"shm_create simple %d %d\\t%p %s\\n\", w, h, (void *)xim, name); xim->data = (char *) malloc(xim->bytes_per_line * xim->height); if (xim->data == NULL) { rfbErr(\"XCreateImage(%s) data malloc failed.\\n\", name); if (quiet) { fprintf(stderr, \"XCreateImage(%s) data malloc\" \" failed.\\n\", name); } return 0; } if (flip_byte_order) { char *order = flip_ximage_byte_order(xim); if (! reported_flip && ! quiet) { rfbLog(\"Changing XImage byte order\" \" to %s\\n\", order); reported_flip = 1; } } *ximg_ptr = xim; return 1; } if (! dpy) { X_UNLOCK; return 0; } xim = XShmCreateImage_wr(dpy, default_visual, depth, ZPixmap, NULL, shm, w, h); if (xim == NULL) { rfbErr(\"XShmCreateImage(%s) failed.\\n\", name); if (quiet) { fprintf(stderr, \"XShmCreateImage(%s) failed.\\n\", name); } X_UNLOCK; return 0; } *ximg_ptr = xim; #if HAVE_XSHM shm->shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, IPC_CREAT | 0777); if (shm->shmid == -1) { rfbErr(\"shmget(%s) failed.\\n\", name); rfbLogPerror(\"shmget\"); XDestroyImage(xim); *ximg_ptr = NULL; X_UNLOCK; return 0; } shm->shmaddr = xim->data = (char *) shmat(shm->shmid, 0, 0); if (shm->shmaddr == (char *)-1) { rfbErr(\"shmat(%s) failed.\\n\", name); rfbLogPerror(\"shmat\"); XDestroyImage(xim); *ximg_ptr = NULL; shmctl(shm->shmid, IPC_RMID, 0); shm->shmid = -1; X_UNLOCK; return 0; } shm->readOnly = False; if (! XShmAttach_wr(dpy, shm)) { rfbErr(\"XShmAttach(%s) failed.\\n\", name); XDestroyImage(xim); *ximg_ptr = NULL; shmdt(shm->shmaddr); shm->shmaddr = (char *) -1; shmctl(shm->shmid, IPC_RMID, 0); shm->shmid = -1; X_UNLOCK; return 0; } #endif X_UNLOCK; return 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Access Control"], "explanation": "scan.c in x11vnc 0.9.16 uses IPC_CREAT|0777 in shmget calls, which allows access by actors other than the current user.", "severity_level": "NoInfo", "cwe": "CWE-284", "cve": "CVE-2020-29074"}} -{"idx": 197927, "input": "CString CWebSock::GetSkinPath(const CString& sSkinName) { CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName; if (!CFile::IsDir(sRet)) { sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkinName; if (!CFile::IsDir(sRet)) { sRet = CString(_SKINDIR_) + \"/\" + sSkinName; } } return sRet + \"/\"; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')"], "explanation": "ZNC before 1.7.1-rc1 is prone to a path traversal flaw via ../ in a web skin name to access files outside of the intended skins directories.", "severity_level": "Medium", "cwe": "CWE-22", "cve": "CVE-2018-14056"}} -{"idx": 384554, "input": "void AsioFrontend::accept(Listener& l, boost::system::error_code ec) { if (!l.acceptor.is_open()) { return; } else if (ec == boost::asio::error::operation_aborted) { return; } else if (ec) { ldout(ctx(), 1) << \"accept failed: \" << ec.message() << dendl; return; } auto socket = std::move(l.socket); tcp::no_delay options(l.use_nodelay); socket.set_option(options,ec); l.acceptor.async_accept(l.socket, [this, &l] (boost::system::error_code ec) { accept(l, ec); }); // spawn a coroutine to handle the connection #ifdef WITH_RADOSGW_BEAST_OPENSSL if (l.use_ssl) { spawn::spawn(context, [this, s=std::move(socket)] (spawn::yield_context yield) mutable { Connection conn{s}; auto c = connections.add(conn); // wrap the socket in an ssl stream ssl::stream stream{s, *ssl_context}; auto buffer = std::make_unique(); // do ssl handshake boost::system::error_code ec; auto bytes = stream.async_handshake(ssl::stream_base::server, buffer->data(), yield[ec]); if (ec) { ldout(ctx(), 1) << \"ssl handshake failed: \" << ec.message() << dendl; return; } buffer->consume(bytes); handle_connection(context, env, stream, *buffer, true, pause_mutex, scheduler.get(), ec, yield); if (!ec) { // ssl shutdown (ignoring errors) stream.async_shutdown(yield[ec]); } s.shutdown(tcp::socket::shutdown_both, ec); }, make_stack_allocator()); } else { #else { #endif // WITH_RADOSGW_BEAST_OPENSSL spawn::spawn(context, [this, s=std::move(socket)] (spawn::yield_context yield) mutable { Connection conn{s}; auto c = connections.add(conn); auto buffer = std::make_unique(); boost::system::error_code ec; handle_connection(context, env, s, *buffer, false, pause_mutex, scheduler.get(), ec, yield); s.shutdown(tcp::socket::shutdown_both, ec); }, make_stack_allocator()); } } int AsioFrontend::run() { auto cct = ctx(); const int thread_count = cct->_conf->rgw_thread_pool_size; threads.reserve(thread_count); ldout(cct, 4) << \"frontend spawning \" << thread_count << \" threads\" << dendl; // the worker threads call io_context::run(), which will return when there's // no work left. hold a work guard to keep these threads going until join() work.emplace(boost::asio::make_work_guard(context)); for (int i = 0; i < thread_count; i++) { threads.emplace_back([=] { // request warnings on synchronous librados calls in this thread is_asio_thread = true; boost::system::error_code ec; context.run(ec); }); } return 0; } void AsioFrontend::stop() { ldout(ctx(), 4) << \"frontend initiating shutdown...\" << dendl; going_down = true; boost::system::error_code ec; // close all listeners for (auto& listener : listeners) { listener.acceptor.close(ec); } // close all connections connections.close(ec); pause_mutex.cancel(); } void AsioFrontend::join() { if (!going_down) { stop(); } work.reset(); ldout(ctx(), 4) << \"frontend joining threads...\" << dendl; for (auto& thread : threads) { thread.join(); } ldout(ctx(), 4) << \"frontend done\" << dendl; } void AsioFrontend::pause() { ldout(ctx(), 4) << \"frontend pausing connections...\" << dendl; // cancel pending calls to accept(), but don't close the sockets boost::system::error_code ec; for (auto& l : listeners) { l.acceptor.cancel(ec); } // pause and wait for outstanding requests to complete pause_mutex.lock(ec); if (ec) { ldout(ctx(), 1) << \"frontend failed to pause: \" << ec.message() << dendl; } else { ldout(ctx(), 4) << \"frontend paused\" << dendl; } } void AsioFrontend::unpause(rgw::sal::RGWRadosStore* const store, rgw_auth_registry_ptr_t auth_registry) { env.store = store; env.auth_registry = std::move(auth_registry); // unpause to unblock connections pause_mutex.unlock(); // start accepting connections again for (auto& l : listeners) { l.acceptor.async_accept(l.socket, [this, &l] (boost::system::error_code ec) { accept(l, ec); }); } ldout(ctx(), 4) << \"frontend unpaused\" << dendl; } } // anonymous namespace", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 389347, "input": "static bool gprinter_req_match(struct usb_function *f, const struct usb_ctrlrequest *ctrl, bool config0) { struct printer_dev *dev = func_to_printer(f); u16 w_index = le16_to_cpu(ctrl->wIndex); u16 w_value = le16_to_cpu(ctrl->wValue); u16 w_length = le16_to_cpu(ctrl->wLength); if (config0) return false; if ((ctrl->bRequestType & USB_RECIP_MASK) != USB_RECIP_INTERFACE || (ctrl->bRequestType & USB_TYPE_MASK) != USB_TYPE_CLASS) return false; switch (ctrl->bRequest) { case GET_DEVICE_ID: w_index >>= 8; if (USB_DIR_IN & ctrl->bRequestType) break; return false; case GET_PORT_STATUS: if (!w_value && w_length == 1 && (USB_DIR_IN & ctrl->bRequestType)) break; return false; case SOFT_RESET: if (!w_value && !w_length && !(USB_DIR_IN & ctrl->bRequestType)) break; fallthrough; default: return false; } return w_index == dev->interface; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232571, "input": "static void reg_set_min_max_inv(struct bpf_reg_state *true_reg, struct bpf_reg_state *false_reg, u64 val, u8 opcode, bool is_jmp32) { s64 sval; if (__is_pointer_value(false, false_reg)) return; val = is_jmp32 ? (u32)val : val; sval = is_jmp32 ? (s64)(s32)val : (s64)val; switch (opcode) { case BPF_JEQ: case BPF_JNE: { struct bpf_reg_state *reg = opcode == BPF_JEQ ? true_reg : false_reg; if (is_jmp32) { u64 old_v = reg->var_off.value; u64 hi_mask = ~0xffffffffULL; reg->var_off.value = (old_v & hi_mask) | val; reg->var_off.mask &= hi_mask; } else { __mark_reg_known(reg, val); } break; } case BPF_JSET: false_reg->var_off = tnum_and(false_reg->var_off, tnum_const(~val)); if (is_power_of_2(val)) true_reg->var_off = tnum_or(true_reg->var_off, tnum_const(val)); break; case BPF_JGE: case BPF_JGT: { u64 false_umin = opcode == BPF_JGT ? val : val + 1; u64 true_umax = opcode == BPF_JGT ? val - 1 : val; if (is_jmp32) { false_umin += gen_hi_min(false_reg->var_off); true_umax += gen_hi_max(true_reg->var_off); } false_reg->umin_value = max(false_reg->umin_value, false_umin); true_reg->umax_value = min(true_reg->umax_value, true_umax); break; } case BPF_JSGE: case BPF_JSGT: { s64 false_smin = opcode == BPF_JSGT ? sval : sval + 1; s64 true_smax = opcode == BPF_JSGT ? sval - 1 : sval; if (is_jmp32 && !cmp_val_with_extended_s64(sval, false_reg)) break; false_reg->smin_value = max(false_reg->smin_value, false_smin); true_reg->smax_value = min(true_reg->smax_value, true_smax); break; } case BPF_JLE: case BPF_JLT: { u64 false_umax = opcode == BPF_JLT ? val : val - 1; u64 true_umin = opcode == BPF_JLT ? val + 1 : val; if (is_jmp32) { false_umax += gen_hi_max(false_reg->var_off); true_umin += gen_hi_min(true_reg->var_off); } false_reg->umax_value = min(false_reg->umax_value, false_umax); true_reg->umin_value = max(true_reg->umin_value, true_umin); break; } case BPF_JSLE: case BPF_JSLT: { s64 false_smax = opcode == BPF_JSLT ? sval : sval - 1; s64 true_smin = opcode == BPF_JSLT ? sval + 1 : sval; if (is_jmp32 && !cmp_val_with_extended_s64(sval, false_reg)) break; false_reg->smax_value = min(false_reg->smax_value, false_smax); true_reg->smin_value = max(true_reg->smin_value, true_smin); break; } default: break; } __reg_deduce_bounds(false_reg); __reg_deduce_bounds(true_reg); /* We might have learned some bits from the bounds. */ __reg_bound_offset(false_reg); __reg_bound_offset(true_reg); if (is_jmp32) { __reg_bound_offset32(false_reg); __reg_bound_offset32(true_reg); } /* Intersecting with the old var_off might have improved our bounds * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), * then new var_off is (0; 0x7f...fc) which improves our umax. */ __update_reg_bounds(false_reg); __update_reg_bounds(true_reg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499907, "input": "static void mix_pool_bytes_extract(struct entropy_store *r, const void *in, int nbytes, __u8 out[64]) { static __u32 const twist_table[8] = { 0x00000000, 0x3b6e20c8, 0x76dc4190, 0x4db26158, 0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 }; unsigned long i, j, tap1, tap2, tap3, tap4, tap5; int input_rotate; int wordmask = r->poolinfo->poolwords - 1; const char *bytes = in; __u32 w; unsigned long flags; /* Taps are constant, so we can load them without holding r->lock. */ tap1 = r->poolinfo->tap1; tap2 = r->poolinfo->tap2; tap3 = r->poolinfo->tap3; tap4 = r->poolinfo->tap4; tap5 = r->poolinfo->tap5; spin_lock_irqsave(&r->lock, flags); input_rotate = r->input_rotate; i = r->add_ptr; /* mix one byte at a time to simplify size handling and churn faster */ while (nbytes--) { w = rol32(*bytes++, input_rotate & 31); i = (i - 1) & wordmask; /* XOR in the various taps */ w ^= r->pool[i]; w ^= r->pool[(i + tap1) & wordmask]; w ^= r->pool[(i + tap2) & wordmask]; w ^= r->pool[(i + tap3) & wordmask]; w ^= r->pool[(i + tap4) & wordmask]; w ^= r->pool[(i + tap5) & wordmask]; /* Mix the result back in with a twist */ r->pool[i] = (w >> 3) ^ twist_table[w & 7]; /* * Normally, we add 7 bits of rotation to the pool. * At the beginning of the pool, add an extra 7 bits * rotation, so that successive passes spread the * input bits across the pool evenly. */ input_rotate += i ? 7 : 14; } r->input_rotate = input_rotate; r->add_ptr = i; if (out) for (j = 0; j < 16; j++) ((__u32 *)out)[j] = r->pool[(i - j) & wordmask]; spin_unlock_irqrestore(&r->lock, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280846, "input": "ofpacts_parse(char *str, const struct ofpact_parse_params *pp, bool allow_instructions, enum ofpact_type outer_action) { if (pp->depth >= MAX_OFPACT_PARSE_DEPTH) { return xstrdup(\"Action nested too deeply\"); } CONST_CAST(struct ofpact_parse_params *, pp)->depth++; uint32_t orig_size = pp->ofpacts->size; char *error = ofpacts_parse__(str, pp, allow_instructions, outer_action); if (error) { pp->ofpacts->size = orig_size; } CONST_CAST(struct ofpact_parse_params *, pp)->depth--; return error; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336922, "input": "rb_str_rpartition(VALUE str, VALUE sep) { long pos = RSTRING_LEN(str); int regex = FALSE; if (TYPE(sep) == T_REGEXP) { pos = rb_reg_search(sep, str, pos, 1); regex = TRUE; } else { VALUE tmp; tmp = rb_check_string_type(sep); if (NIL_P(tmp)) { rb_raise(rb_eTypeError, \"type mismatch: %s given\", rb_obj_classname(sep)); } sep = tmp; pos = rb_str_sublen(str, pos); pos = rb_str_rindex(str, sep, pos); } if (pos < 0) { return rb_ary_new3(3, rb_str_new(0,0),rb_str_new(0,0), str); } if (regex) { sep = rb_reg_nth_match(0, rb_backref_get()); } return rb_ary_new3(3, rb_str_substr(str, 0, pos), sep, rb_str_substr(str,pos+str_strlen(sep,STR_ENC_GET(sep)),RSTRING_LEN(str))); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269124, "input": "RuntimeShape(int new_shape_size, const RuntimeShape& shape, int pad_value) : size_(0) { // If the following check fails, it is likely because a 4D-only kernel is // being used with an array of larger dimension count. TFLITE_CHECK_GE(new_shape_size, shape.DimensionsCount()); Resize(new_shape_size); const int size_increase = new_shape_size - shape.DimensionsCount(); for (int i = 0; i < size_increase; ++i) { SetDim(i, pad_value); } std::memcpy(DimsData() + size_increase, shape.DimsData(), sizeof(int32_t) * shape.DimensionsCount()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366726, "input": "static int mpol_set_nodemask(struct mempolicy *pol, const nodemask_t *nodes, struct nodemask_scratch *nsc) { int ret; /* if mode is MPOL_DEFAULT, pol is NULL. This is right. */ if (pol == NULL) return 0; /* Check N_MEMORY */ nodes_and(nsc->mask1, cpuset_current_mems_allowed, node_states[N_MEMORY]); VM_BUG_ON(!nodes); if (pol->mode == MPOL_PREFERRED && nodes_empty(*nodes)) nodes = NULL; /* explicit local allocation */ else { if (pol->flags & MPOL_F_RELATIVE_NODES) mpol_relative_nodemask(&nsc->mask2, nodes, &nsc->mask1); else nodes_and(nsc->mask2, *nodes, nsc->mask1); if (mpol_store_user_nodemask(pol)) pol->w.user_nodemask = *nodes; else pol->w.cpuset_mems_allowed = cpuset_current_mems_allowed; } if (nodes) ret = mpol_ops[pol->mode].create(pol, &nsc->mask2); else ret = mpol_ops[pol->mode].create(pol, NULL); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244403, "input": "void PrintGeneralUsage() { u32 i=0; gf_sys_format_help(helpout, help_flags, \"# General Options\\n\" \"MP4Box is a multimedia packager, with a vast number of functionalities: conversion, splitting, hinting, dumping, DASH-ing, encryption and others.\\n\" \"MP4Box provides a large set of options, classified by categories (see [-h]()). These options do not follow any particular ordering.\\n\" \"MP4Box performs in-place rewrite of IsoMedia files (the input file is overwritten). You can change this behaviour by using the [-out]() option.\\n\" \"MP4Box stores by default the file with 0.5 second interleaving and meta-data (`moov`...) at the beginning, making it suitable for HTTP streaming. This may however takes longer to store the file, use [-flat]() to change this behaviour.\\n\" \"MP4Box usually generates a temporary file when creating a new IsoMedia file. The location of this temporary file is OS-dependent, and it may happen that the drive/partition the temporary file is created on has not enough space or no write access. In such a case, you can specify a temporary file location with [-tmp]().\\n\" \"Note: Track operations identify tracks through their ID (usually refered as tkID in the help), not their order.\\n\" \"Option values:\\n\" \"Unless specified otherwise, an option of type `integer` expects a trackID value following it.\" \"An option of type `boolean` expects no following value.\" \" \\n\" \"# File Splitting and Concatenation\\n\" \"MP4Box can split IsoMedia files by size, duration or extract a given part of the file to new IsoMedia file(s). This process requires that at most one track in the input file has non random-access points (typically one video track at most). This process will also ignore all MPEG-4 Systems tracks and hint tracks, but will try to split private media tracks.\\n\" \"Note: The input file must have enough random access points in order to be split. This may not be the case with some video files where only the very first sample of the video track is a key frame (many 3GP files with H263 video are recorded that way). In order to split such files you will have to use a real video editor and re-encode the content.\\n\" \"Note: You can add media to a file and split it in the same pass. In this case, the destination file (the one which would be obtained without spliting) will not be stored.\\n\" \" \\n\" \"Options:\\n\" ); while (m4b_gen_args[i].name) { GF_GPACArg *arg = &m4b_gen_args[i]; i++; gf_sys_print_arg(helpout, help_flags, arg, \"mp4box-gen\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246409, "input": "StreamBufferHandle_t xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer, uint8_t * const pucStreamBufferStorageArea, StaticStreamBuffer_t * const pxStaticStreamBuffer ) { StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) pxStaticStreamBuffer; /*lint !e740 !e9087 Safe cast as StaticStreamBuffer_t is opaque Streambuffer_t. */ StreamBufferHandle_t xReturn; uint8_t ucFlags; configASSERT( pucStreamBufferStorageArea ); configASSERT( pxStaticStreamBuffer ); configASSERT( xTriggerLevelBytes <= xBufferSizeBytes ); /* A trigger level of 0 would cause a waiting task to unblock even when * the buffer was empty. */ if( xTriggerLevelBytes == ( size_t ) 0 ) { xTriggerLevelBytes = ( size_t ) 1; } if( xIsMessageBuffer != pdFALSE ) { /* Statically allocated message buffer. */ ucFlags = sbFLAGS_IS_MESSAGE_BUFFER | sbFLAGS_IS_STATICALLY_ALLOCATED; } else { /* Statically allocated stream buffer. */ ucFlags = sbFLAGS_IS_STATICALLY_ALLOCATED; } /* In case the stream buffer is going to be used as a message buffer * (that is, it will hold discrete messages with a little meta data that * says how big the next message is) check the buffer will be large enough * to hold at least one message. */ configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH ); #if ( configASSERT_DEFINED == 1 ) { /* Sanity check that the size of the structure used to declare a * variable of type StaticStreamBuffer_t equals the size of the real * message buffer structure. */ volatile size_t xSize = sizeof( StaticStreamBuffer_t ); configASSERT( xSize == sizeof( StreamBuffer_t ) ); } /*lint !e529 xSize is referenced is configASSERT() is defined. */ #endif /* configASSERT_DEFINED */ if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) ) { prvInitialiseNewStreamBuffer( pxStreamBuffer, pucStreamBufferStorageArea, xBufferSizeBytes, xTriggerLevelBytes, ucFlags ); /* Remember this was statically allocated in case it is ever deleted * again. */ pxStreamBuffer->ucFlags |= sbFLAGS_IS_STATICALLY_ALLOCATED; traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ); xReturn = ( StreamBufferHandle_t ) pxStaticStreamBuffer; /*lint !e9087 Data hiding requires cast to opaque type. */ } else { xReturn = NULL; traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer ); } return xReturn; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234454, "input": "static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls) { if (fls) { ff_layout_free_mirror_array(fls); kfree(fls); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219715, "input": "Variant HHVM_FUNCTION(imagecreatefromgd2, const String& filename) { gdImagePtr im = _php_image_create_from(filename, -1, -1, -1, -1, PHP_GDIMG_TYPE_GD2, \"GD2\", (gdImagePtr(*)())gdImageCreateFromGd2, (gdImagePtr(*)())gdImageCreateFromGd2Ctx); if (im == nullptr) { return false; } return Variant(req::make(im)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364928, "input": "struct tipc_node *tipc_node_create(struct net *net, u32 addr, u8 *peer_id, u16 capabilities, u32 hash_mixes, bool preliminary) { struct tipc_net *tn = net_generic(net, tipc_net_id); struct tipc_node *n, *temp_node; struct tipc_link *l; unsigned long intv; int bearer_id; int i; spin_lock_bh(&tn->node_list_lock); n = tipc_node_find(net, addr) ?: tipc_node_find_by_id(net, peer_id); if (n) { if (!n->preliminary) goto update; if (preliminary) goto exit; /* A preliminary node becomes \"real\" now, refresh its data */ tipc_node_write_lock(n); n->preliminary = false; n->addr = addr; hlist_del_rcu(&n->hash); hlist_add_head_rcu(&n->hash, &tn->node_htable[tipc_hashfn(addr)]); list_del_rcu(&n->list); list_for_each_entry_rcu(temp_node, &tn->node_list, list) { if (n->addr < temp_node->addr) break; } list_add_tail_rcu(&n->list, &temp_node->list); tipc_node_write_unlock_fast(n); update: if (n->peer_hash_mix ^ hash_mixes) tipc_node_assign_peer_net(n, hash_mixes); if (n->capabilities == capabilities) goto exit; /* Same node may come back with new capabilities */ tipc_node_write_lock(n); n->capabilities = capabilities; for (bearer_id = 0; bearer_id < MAX_BEARERS; bearer_id++) { l = n->links[bearer_id].link; if (l) tipc_link_update_caps(l, capabilities); } tipc_node_write_unlock_fast(n); /* Calculate cluster capabilities */ tn->capabilities = TIPC_NODE_CAPABILITIES; list_for_each_entry_rcu(temp_node, &tn->node_list, list) { tn->capabilities &= temp_node->capabilities; } tipc_bcast_toggle_rcast(net, (tn->capabilities & TIPC_BCAST_RCAST)); goto exit; } n = kzalloc(sizeof(*n), GFP_ATOMIC); if (!n) { pr_warn(\"Node creation failed, no memory\\n\"); goto exit; } tipc_nodeid2string(n->peer_id_string, peer_id); #ifdef CONFIG_TIPC_CRYPTO if (unlikely(tipc_crypto_start(&n->crypto_rx, net, n))) { pr_warn(\"Failed to start crypto RX(%s)!\\n\", n->peer_id_string); kfree(n); n = NULL; goto exit; } #endif n->addr = addr; n->preliminary = preliminary; memcpy(&n->peer_id, peer_id, 16); n->net = net; n->peer_net = NULL; n->peer_hash_mix = 0; /* Assign kernel local namespace if exists */ tipc_node_assign_peer_net(n, hash_mixes); n->capabilities = capabilities; kref_init(&n->kref); rwlock_init(&n->lock); INIT_HLIST_NODE(&n->hash); INIT_LIST_HEAD(&n->list); INIT_LIST_HEAD(&n->publ_list); INIT_LIST_HEAD(&n->conn_sks); skb_queue_head_init(&n->bc_entry.namedq); skb_queue_head_init(&n->bc_entry.inputq1); __skb_queue_head_init(&n->bc_entry.arrvq); skb_queue_head_init(&n->bc_entry.inputq2); for (i = 0; i < MAX_BEARERS; i++) spin_lock_init(&n->links[i].lock); n->state = SELF_DOWN_PEER_LEAVING; n->delete_at = jiffies + msecs_to_jiffies(NODE_CLEANUP_AFTER); n->signature = INVALID_NODE_SIG; n->active_links[0] = INVALID_BEARER_ID; n->active_links[1] = INVALID_BEARER_ID; n->bc_entry.link = NULL; tipc_node_get(n); timer_setup(&n->timer, tipc_node_timeout, 0); /* Start a slow timer anyway, crypto needs it */ n->keepalive_intv = 10000; intv = jiffies + msecs_to_jiffies(n->keepalive_intv); if (!mod_timer(&n->timer, intv)) tipc_node_get(n); hlist_add_head_rcu(&n->hash, &tn->node_htable[tipc_hashfn(addr)]); list_for_each_entry_rcu(temp_node, &tn->node_list, list) { if (n->addr < temp_node->addr) break; } list_add_tail_rcu(&n->list, &temp_node->list); /* Calculate cluster capabilities */ tn->capabilities = TIPC_NODE_CAPABILITIES; list_for_each_entry_rcu(temp_node, &tn->node_list, list) { tn->capabilities &= temp_node->capabilities; } tipc_bcast_toggle_rcast(net, (tn->capabilities & TIPC_BCAST_RCAST)); trace_tipc_node_create(n, true, \" \"); exit: spin_unlock_bh(&tn->node_list_lock); return n; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514746, "input": "int ram_block_uncoordinated_discard_disable(bool state) { int ret = 0; ram_block_discard_disable_mutex_lock(); if (!state) { ram_block_uncoordinated_discard_disabled_cnt--; } else if (ram_block_discard_required_cnt) { ret = -EBUSY; } else { ram_block_uncoordinated_discard_disabled_cnt++; } ram_block_discard_disable_mutex_unlock(); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333211, "input": "repodata_str2dir(Repodata *data, const char *dir, int create) { Id id, parent; #ifdef DIRCACHE_SIZE const char *dirs; #endif const char *dire; if (!*dir) return data->dirpool.ndirs ? 0 : dirpool_add_dir(&data->dirpool, 0, 0, create); while (*dir == '/' && dir[1] == '/') dir++; if (*dir == '/' && !dir[1]) return data->dirpool.ndirs ? 1 : dirpool_add_dir(&data->dirpool, 0, 1, create); parent = 0; #ifdef DIRCACHE_SIZE dirs = dir; if (data->dircache) { int l; struct dircache *dircache = data->dircache; l = strlen(dir); while (l > 0) { if (l < DIRCACHE_SIZE && dircache->ids[l] && !memcmp(dircache->str + l * (l - 1) / 2, dir, l)) { parent = dircache->ids[l]; dir += l; if (!*dir) return parent; while (*dir == '/') dir++; break; } while (--l) if (dir[l] == '/') break; } } #endif while (*dir) { dire = strchrnul(dir, '/'); if (data->localpool) id = stringpool_strn2id(&data->spool, dir, dire - dir, create); else id = pool_strn2id(data->repo->pool, dir, dire - dir, create); if (!id) return 0; parent = dirpool_add_dir(&data->dirpool, parent, id, create); if (!parent) return 0; #ifdef DIRCACHE_SIZE if (!data->dircache) data->dircache = solv_calloc(1, sizeof(struct dircache)); if (data->dircache) { int l = dire - dirs; if (l < DIRCACHE_SIZE) { data->dircache->ids[l] = parent; memcpy(data->dircache->str + l * (l - 1) / 2, dirs, l); } } #endif if (!*dire) break; dir = dire + 1; while (*dir == '/') dir++; } return parent; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219653, "input": "static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, unsigned char *data) { file_section *tmp; int count = ImageInfo->file.count; size_t realloc_size = (count+1) * sizeof(file_section); tmp = (file_section *)IM_REALLOC(ImageInfo->file.list, realloc_size); CHECK_ALLOC_R(tmp, realloc_size, -1); ImageInfo->file.list = tmp; ImageInfo->file.list[count].type = 0xFFFF; ImageInfo->file.list[count].data = nullptr; ImageInfo->file.list[count].size = 0; ImageInfo->file.count = count+1; if (!size) { data = nullptr; } else if (data == nullptr) { data = (unsigned char *)IM_MALLOC(size); if (data == nullptr) IM_FREE(tmp); CHECK_ALLOC_R(data, size, -1); } ImageInfo->file.list[count].type = type; ImageInfo->file.list[count].data = data; ImageInfo->file.list[count].size = size; return count; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 201363, "input": "rpmRC hdrblobInit(const void *uh, size_t uc, rpmTagVal regionTag, int exact_size, struct hdrblob_s *blob, char **emsg) { rpmRC rc = RPMRC_FAIL; memset(blob, 0, sizeof(*blob)); blob->ei = (int32_t *) uh; /* discards const */ blob->il = ntohl(blob->ei[0]); blob->dl = ntohl(blob->ei[1]); blob->pe = (entryInfo) &(blob->ei[2]); blob->pvlen = sizeof(blob->il) + sizeof(blob->dl) + (blob->il * sizeof(*blob->pe)) + blob->dl; blob->dataStart = (uint8_t *) (blob->pe + blob->il); blob->dataEnd = blob->dataStart + blob->dl; /* Is the blob the right size? */ if (blob->pvlen >= headerMaxbytes || (uc && blob->pvlen != uc)) { rasprintf(emsg, _(\"blob size(%d): BAD, 8 + 16 * il(%d) + dl(%d)\"), blob->pvlen, blob->il, blob->dl); goto exit; } if (hdrblobVerifyRegion(regionTag, exact_size, blob, emsg) == RPMRC_FAIL) goto exit; /* Sanity check the rest of the header structure. */ if (hdrblobVerifyInfo(blob, emsg)) goto exit; rc = RPMRC_OK; exit: return rc; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "A flaw was found in RPM's hdrblobInit() in lib/header.c. This flaw allows an attacker who can modify the rpmdb to cause an out-of-bounds read. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-20266"}} -{"idx": 374444, "input": "ZEND_METHOD(error_exception, getSeverity) { DEFAULT_0_PARAMS; _default_exception_get_entry(getThis(), \"severity\", sizeof(\"severity\")-1, return_value TSRMLS_CC); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402384, "input": "HttpStateData::continueAfterParsingHeader() { if (flags.handling1xx) { debugs(11, 5, HERE << \"wait for 1xx handling\"); Must(!flags.headers_parsed); return false; } if (!flags.headers_parsed && !eof) { debugs(11, 9, \"needs more at \" << inBuf.length()); flags.do_next_read = true; /** \\retval false If we have not finished parsing the headers and may get more data. * Schedules more reads to retrieve the missing data. */ maybeReadVirginBody(); // schedules all kinds of reads; TODO: rename return false; } /** If we are done with parsing, check for errors */ err_type error = ERR_NONE; if (flags.headers_parsed) { // parsed headers, possibly with errors // check for header parsing errors if (HttpReply *vrep = virginReply()) { const Http::StatusCode s = vrep->sline.status(); const AnyP::ProtocolVersion &v = vrep->sline.version; if (s == Http::scInvalidHeader && v != Http::ProtocolVersion(0,9)) { debugs(11, DBG_IMPORTANT, \"WARNING: HTTP: Invalid Response: Bad header encountered from \" << entry->url() << \" AKA \" << request->url); error = ERR_INVALID_RESP; } else if (s == Http::scHeaderTooLarge) { fwd->dontRetry(true); error = ERR_TOO_BIG; } else if (vrep->header.conflictingContentLength()) { fwd->dontRetry(true); error = ERR_INVALID_RESP; } else if (vrep->header.unsupportedTe()) { fwd->dontRetry(true); error = ERR_INVALID_RESP; } else { return true; // done parsing, got reply, and no error } } else { // parsed headers but got no reply debugs(11, DBG_IMPORTANT, \"WARNING: HTTP: Invalid Response: No reply at all for \" << entry->url() << \" AKA \" << request->url); error = ERR_INVALID_RESP; } } else { assert(eof); if (inBuf.length()) { error = ERR_INVALID_RESP; debugs(11, DBG_IMPORTANT, \"WARNING: HTTP: Invalid Response: Headers did not parse at all for \" << entry->url() << \" AKA \" << request->url); } else { error = ERR_ZERO_SIZE_OBJECT; debugs(11, (request->flags.accelerated?DBG_IMPORTANT:2), \"WARNING: HTTP: Invalid Response: No object data received for \" << entry->url() << \" AKA \" << request->url); } } assert(error != ERR_NONE); entry->reset(); fwd->fail(new ErrorState(error, Http::scBadGateway, fwd->request)); flags.do_next_read = false; closeServer(); mustStop(\"HttpStateData::continueAfterParsingHeader\"); return false; // quit on error }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383658, "input": "spnego_gss_inquire_names_for_mech( OM_uint32 *minor_status, gss_OID mechanism, gss_OID_set *name_types) { OM_uint32 major, minor; dsyslog(\"Entering inquire_names_for_mech\\n\"); /* * We only know how to handle our own mechanism. */ if ((mechanism != GSS_C_NULL_OID) && !g_OID_equal(gss_mech_spnego, mechanism)) { *minor_status = 0; return (GSS_S_FAILURE); } major = gss_create_empty_oid_set(minor_status, name_types); if (major == GSS_S_COMPLETE) { /* Now add our members. */ if (((major = gss_add_oid_set_member(minor_status, (gss_OID) GSS_C_NT_USER_NAME, name_types)) == GSS_S_COMPLETE) && ((major = gss_add_oid_set_member(minor_status, (gss_OID) GSS_C_NT_MACHINE_UID_NAME, name_types)) == GSS_S_COMPLETE) && ((major = gss_add_oid_set_member(minor_status, (gss_OID) GSS_C_NT_STRING_UID_NAME, name_types)) == GSS_S_COMPLETE)) { major = gss_add_oid_set_member(minor_status, (gss_OID) GSS_C_NT_HOSTBASED_SERVICE, name_types); } if (major != GSS_S_COMPLETE) (void) gss_release_oid_set(&minor, name_types); } dsyslog(\"Leaving inquire_names_for_mech\\n\"); return (major); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268951, "input": "R_API char *r_str_replace_in(char *str, ut32 sz, const char *key, const char *val, int g) { if (!str || !key || !val) { return NULL; } char *heaped = r_str_replace (strdup (str), key, val, g); if (heaped) { strncpy (str, heaped, sz); free (heaped); } return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398092, "input": "static int sctp_getsockopt_peer_addr_info(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_paddrinfo pinfo; struct sctp_transport *transport; int retval = 0; if (len < sizeof(pinfo)) { retval = -EINVAL; goto out; } len = sizeof(pinfo); if (copy_from_user(&pinfo, optval, len)) { retval = -EFAULT; goto out; } transport = sctp_addr_id2transport(sk, &pinfo.spinfo_address, pinfo.spinfo_assoc_id); if (!transport) { retval = -EINVAL; goto out; } if (transport->state == SCTP_PF && transport->asoc->pf_expose == SCTP_PF_EXPOSE_DISABLE) { retval = -EACCES; goto out; } pinfo.spinfo_assoc_id = sctp_assoc2id(transport->asoc); pinfo.spinfo_state = transport->state; pinfo.spinfo_cwnd = transport->cwnd; pinfo.spinfo_srtt = transport->srtt; pinfo.spinfo_rto = jiffies_to_msecs(transport->rto); pinfo.spinfo_mtu = transport->pathmtu; if (pinfo.spinfo_state == SCTP_UNKNOWN) pinfo.spinfo_state = SCTP_ACTIVE; if (put_user(len, optlen)) { retval = -EFAULT; goto out; } if (copy_to_user(optval, &pinfo, len)) { retval = -EFAULT; goto out; } out: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519096, "input": "JNIEXPORT jbyteArray JNICALL Java_edu_berkeley_cs_rise_opaque_execution_SGXEnclave_Project( JNIEnv *env, jobject obj, jlong eid, jbyteArray project_list, jbyteArray input_rows) { (void)obj; jboolean if_copy; uint32_t project_list_length = (uint32_t) env->GetArrayLength(project_list); uint8_t *project_list_ptr = (uint8_t *) env->GetByteArrayElements(project_list, &if_copy); uint32_t input_rows_length = (uint32_t) env->GetArrayLength(input_rows); uint8_t *input_rows_ptr = (uint8_t *) env->GetByteArrayElements(input_rows, &if_copy); uint8_t *output_rows; size_t output_rows_length; sgx_check(\"Project\", ecall_project( eid, project_list_ptr, project_list_length, input_rows_ptr, input_rows_length, &output_rows, &output_rows_length)); env->ReleaseByteArrayElements(project_list, (jbyte *) project_list_ptr, 0); env->ReleaseByteArrayElements(input_rows, (jbyte *) input_rows_ptr, 0); jbyteArray ret = env->NewByteArray(output_rows_length); env->SetByteArrayRegion(ret, 0, output_rows_length, (jbyte *) output_rows); free(output_rows); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430784, "input": "void UnicodeStringTest::TestUnicodeStringInsertAppendToSelf() { IcuTestErrorCode status(*this, \"TestUnicodeStringAppendToSelf\"); // Test append operation UnicodeString str(u\"foo \"); str.append(str); str.append(str); str.append(str); assertEquals(\"\", u\"foo foo foo foo foo foo foo foo \", str); // Test append operation with readonly alias to start str = UnicodeString(TRUE, u\"foo \", 4); str.append(str); str.append(str); str.append(str); assertEquals(\"\", u\"foo foo foo foo foo foo foo foo \", str); // Test append operation with aliased substring str = u\"abcde\"; UnicodeString sub = str.tempSubString(1, 2); str.append(sub); assertEquals(\"\", u\"abcdebc\", str); // Test append operation with double-aliased substring str = UnicodeString(TRUE, u\"abcde\", 5); sub = str.tempSubString(1, 2); str.append(sub); assertEquals(\"\", u\"abcdebc\", str); // Test insert operation str = u\"a-*b\"; str.insert(2, str); str.insert(4, str); str.insert(8, str); assertEquals(\"\", u\"a-a-a-a-a-a-a-a-*b*b*b*b*b*b*b*b\", str); // Test insert operation with readonly alias to start str = UnicodeString(TRUE, u\"a-*b\", 4); str.insert(2, str); str.insert(4, str); str.insert(8, str); assertEquals(\"\", u\"a-a-a-a-a-a-a-a-*b*b*b*b*b*b*b*b\", str); // Test insert operation with aliased substring str = u\"abcde\"; sub = str.tempSubString(1, 3); str.insert(2, sub); assertEquals(\"\", u\"abbcdcde\", str); // Test insert operation with double-aliased substring str = UnicodeString(TRUE, u\"abcde\", 5); sub = str.tempSubString(1, 3); str.insert(2, sub); assertEquals(\"\", u\"abbcdcde\", str); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196997, "input": "#ifndef GPAC_DISABLE_ISOM_HINTING void dump_isom_sdp(GF_ISOFile *file, char *inName, Bool is_final_name) { const char *sdp; u32 size, i; FILE *dump; if (inName) { char szBuf[1024]; strcpy(szBuf, inName); if (!is_final_name) { char *ext = strchr(szBuf, '.'); if (ext) ext[0] = 0; strcat(szBuf, \"_sdp.txt\"); } dump = gf_fopen(szBuf, \"wt\"); if (!dump) { fprintf(stderr, \"Failed to open %s for dumping\\n\", szBuf); return; } } else { dump = stdout; fprintf(dump, \"* File SDP content *\\n\\n\"); } //get the movie SDP gf_isom_sdp_get(file, &sdp, &size); fprintf(dump, \"%s\", sdp); fprintf(dump, \"\\r\\n\"); //then tracks for (i=0; iRemoteFxCodec) bitmapCodecCount++; if (settings->NSCodec) bitmapCodecCount++; #if defined(WITH_JPEG) if (settings->JpegCodec) bitmapCodecCount++; #endif if (settings->RemoteFxImageCodec) bitmapCodecCount++; Stream_Write_UINT8(s, bitmapCodecCount); if (settings->RemoteFxCodec) { rdp_write_bitmap_codec_guid(s, &CODEC_GUID_REMOTEFX); /* codecGUID */ if (settings->ServerMode) { Stream_Write_UINT8(s, 0); /* codecID is defined by the client */ if (!rdp_write_rfx_server_capability_container(s, settings)) return FALSE; } else { Stream_Write_UINT8(s, RDP_CODEC_ID_REMOTEFX); /* codecID */ if (!rdp_write_rfx_client_capability_container(s, settings)) return FALSE; } } if (settings->NSCodec) { rdp_write_bitmap_codec_guid(s, &CODEC_GUID_NSCODEC); /* codecGUID */ if (settings->ServerMode) { Stream_Write_UINT8(s, 0); /* codecID is defined by the client */ if (!rdp_write_nsc_server_capability_container(s, settings)) return FALSE; } else { Stream_Write_UINT8(s, RDP_CODEC_ID_NSCODEC); /* codecID */ if (!rdp_write_nsc_client_capability_container(s, settings)) return FALSE; } } #if defined(WITH_JPEG) if (settings->JpegCodec) { rdp_write_bitmap_codec_guid(s, &CODEC_GUID_JPEG); /* codecGUID */ if (settings->ServerMode) { Stream_Write_UINT8(s, 0); /* codecID is defined by the client */ if (!rdp_write_jpeg_server_capability_container(s, settings)) return FALSE; } else { Stream_Write_UINT8(s, RDP_CODEC_ID_JPEG); /* codecID */ if (!rdp_write_jpeg_client_capability_container(s, settings)) return FALSE; } } #endif if (settings->RemoteFxImageCodec) { rdp_write_bitmap_codec_guid(s, &CODEC_GUID_IMAGE_REMOTEFX); /* codecGUID */ if (settings->ServerMode) { Stream_Write_UINT8(s, 0); /* codecID is defined by the client */ if (!rdp_write_rfx_server_capability_container(s, settings)) return FALSE; } else { Stream_Write_UINT8(s, RDP_CODEC_ID_IMAGE_REMOTEFX); /* codecID */ if (!rdp_write_rfx_client_capability_container(s, settings)) return FALSE; } } rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CODECS); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269010, "input": "R_API char *r_str_between(const char *cmt, const char *prefix, const char *suffix) { char *c0, *c1; if (!cmt || !prefix || !suffix || !*cmt) { return NULL; } c0 = strstr (cmt, prefix); if (c0) { c1 = strstr (c0 + strlen (prefix), suffix); if (c1) { return r_str_ndup (c0 + strlen (prefix), (c1 - c0 - strlen (prefix))); } } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357287, "input": "static void opj_j2k_write_poc_in_memory(opj_j2k_t *p_j2k, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, opj_event_mgr_t * p_manager ) { OPJ_UINT32 i; OPJ_BYTE * l_current_data = 00; OPJ_UINT32 l_nb_comp; OPJ_UINT32 l_nb_poc; OPJ_UINT32 l_poc_size; opj_image_t *l_image = 00; opj_tcp_t *l_tcp = 00; opj_tccp_t *l_tccp = 00; opj_poc_t *l_current_poc = 00; OPJ_UINT32 l_poc_room; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); OPJ_UNUSED(p_manager); l_tcp = &p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]; l_tccp = &l_tcp->tccps[0]; l_image = p_j2k->m_private_image; l_nb_comp = l_image->numcomps; l_nb_poc = 1 + l_tcp->numpocs; if (l_nb_comp <= 256) { l_poc_room = 1; } else { l_poc_room = 2; } l_poc_size = 4 + (5 + 2 * l_poc_room) * l_nb_poc; l_current_data = p_data; opj_write_bytes(l_current_data, J2K_MS_POC, 2); /* POC */ l_current_data += 2; opj_write_bytes(l_current_data, l_poc_size - 2, 2); /* Lpoc */ l_current_data += 2; l_current_poc = l_tcp->pocs; for (i = 0; i < l_nb_poc; ++i) { opj_write_bytes(l_current_data, l_current_poc->resno0, 1); /* RSpoc_i */ ++l_current_data; opj_write_bytes(l_current_data, l_current_poc->compno0, l_poc_room); /* CSpoc_i */ l_current_data += l_poc_room; opj_write_bytes(l_current_data, l_current_poc->layno1, 2); /* LYEpoc_i */ l_current_data += 2; opj_write_bytes(l_current_data, l_current_poc->resno1, 1); /* REpoc_i */ ++l_current_data; opj_write_bytes(l_current_data, l_current_poc->compno1, l_poc_room); /* CEpoc_i */ l_current_data += l_poc_room; opj_write_bytes(l_current_data, (OPJ_UINT32)l_current_poc->prg, 1); /* Ppoc_i */ ++l_current_data; /* change the value of the max layer according to the actual number of layers in the file, components and resolutions*/ l_current_poc->layno1 = (OPJ_UINT32)opj_int_min((OPJ_INT32) l_current_poc->layno1, (OPJ_INT32)l_tcp->numlayers); l_current_poc->resno1 = (OPJ_UINT32)opj_int_min((OPJ_INT32) l_current_poc->resno1, (OPJ_INT32)l_tccp->numresolutions); l_current_poc->compno1 = (OPJ_UINT32)opj_int_min((OPJ_INT32) l_current_poc->compno1, (OPJ_INT32)l_nb_comp); ++l_current_poc; } *p_data_written = l_poc_size; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373765, "input": "if(pThis->pqParent == NULL) { /* if we are not a child, we allocated our own mutex, which we now need to destroy */ pthread_mutex_destroy(pThis->mut); free(pThis->mut); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293112, "input": "static void zipfileCtxErrorMsg(sqlite3_context *ctx, const char *zFmt, ...){ char *zMsg = 0; va_list ap; va_start(ap, zFmt); zMsg = sqlite3_vmprintf(zFmt, ap); sqlite3_result_error(ctx, zMsg, -1); sqlite3_free(zMsg); va_end(ap); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 367053, "input": "static void sm501_init(SM501State *s, DeviceState *dev, uint32_t local_mem_bytes) { s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes); SM501_DPRINTF(\"sm501 local mem size=%x. index=%d\\n\", get_local_mem_size(s), s->local_mem_size_index); /* local memory */ memory_region_init_ram(&s->local_mem_region, OBJECT(dev), \"sm501.local\", get_local_mem_size(s), &error_fatal); memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region); /* i2c */ s->i2c_bus = i2c_init_bus(dev, \"sm501.i2c\"); /* ddc */ I2CDDCState *ddc = I2CDDC(qdev_create(BUS(s->i2c_bus), TYPE_I2CDDC)); i2c_set_slave_address(I2C_SLAVE(ddc), 0x50); /* mmio */ memory_region_init(&s->mmio_region, OBJECT(dev), \"sm501.mmio\", MMIO_SIZE); memory_region_init_io(&s->system_config_region, OBJECT(dev), &sm501_system_config_ops, s, \"sm501-system-config\", 0x6c); memory_region_add_subregion(&s->mmio_region, SM501_SYS_CONFIG, &s->system_config_region); memory_region_init_io(&s->i2c_region, OBJECT(dev), &sm501_i2c_ops, s, \"sm501-i2c\", 0x14); memory_region_add_subregion(&s->mmio_region, SM501_I2C, &s->i2c_region); memory_region_init_io(&s->disp_ctrl_region, OBJECT(dev), &sm501_disp_ctrl_ops, s, \"sm501-disp-ctrl\", 0x1000); memory_region_add_subregion(&s->mmio_region, SM501_DC, &s->disp_ctrl_region); memory_region_init_io(&s->twoD_engine_region, OBJECT(dev), &sm501_2d_engine_ops, s, \"sm501-2d-engine\", 0x54); memory_region_add_subregion(&s->mmio_region, SM501_2D_ENGINE, &s->twoD_engine_region); /* create qemu graphic console */ s->con = graphic_console_init(dev, 0, &sm501_ops, s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458383, "input": "static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { struct mt_device *td = hid_get_drvdata(hdev); struct mt_report_data *rdata; rdata = mt_find_report_data(td, field->report); if (rdata && rdata->is_mt_collection) { /* We own these mappings, tell hid-input to ignore them */ return -1; } /* let hid-core decide for the others */ return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280515, "input": "ofpact_parse(enum ofpact_type type, char *value, const struct ofpact_parse_params *pp) { switch (type) { #define OFPACT(ENUM, STRUCT, MEMBER, NAME) \\ case OFPACT_##ENUM: \\ return parse_##ENUM(value, pp); OFPACTS #undef OFPACT default: OVS_NOT_REACHED(); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 124801, "input": "void AudioContext::derefFinishedSourceNodes() { ASSERT(isGraphOwner()); ASSERT(isAudioThread()); for (unsigned i = 0; i < m_finishedNodes.size(); i++) derefNode(m_finishedNodes[i]); m_finishedNodes.clear(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 313016, "input": "u_unchanged(buf_T *buf) { u_unch_branch(buf->b_u_oldhead); buf->b_did_warn = FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 200450, "input": "static int blosc_c(struct thread_context* thread_context, int32_t bsize, int32_t leftoverblock, int32_t ntbytes, int32_t maxbytes, const uint8_t* src, const int32_t offset, uint8_t* dest, uint8_t* tmp, uint8_t* tmp2) { blosc2_context* context = thread_context->parent_context; int dont_split = (context->header_flags & 0x10) >> 4; int dict_training = context->use_dict && context->dict_cdict == NULL; int32_t j, neblock, nstreams; int32_t cbytes; /* number of compressed bytes in split */ int32_t ctbytes = 0; /* number of compressed bytes in block */ int64_t maxout; int32_t typesize = context->typesize; const char* compname; int accel; const uint8_t* _src; uint8_t *_tmp = tmp, *_tmp2 = tmp2; uint8_t *_tmp3 = thread_context->tmp4; int last_filter_index = last_filter(context->filters, 'c'); bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED; if (last_filter_index >= 0 || context->prefilter != NULL) { /* Apply the filter pipeline just for the prefilter */ if (memcpyed && context->prefilter != NULL) { // We only need the prefilter output _src = pipeline_c(thread_context, bsize, src, offset, dest, _tmp2, _tmp3); if (_src == NULL) { return -9; // signals a problem with the filter pipeline } return bsize; } /* Apply regular filter pipeline */ _src = pipeline_c(thread_context, bsize, src, offset, _tmp, _tmp2, _tmp3); if (_src == NULL) { return -9; // signals a problem with the filter pipeline } } else { _src = src + offset; } assert(context->clevel > 0); /* Calculate acceleration for different compressors */ accel = get_accel(context); /* The number of compressed data streams for this block */ if (!dont_split && !leftoverblock && !dict_training) { nstreams = (int32_t)typesize; } else { nstreams = 1; } neblock = bsize / nstreams; for (j = 0; j < nstreams; j++) { if (!dict_training) { dest += sizeof(int32_t); ntbytes += sizeof(int32_t); ctbytes += sizeof(int32_t); } // See if we have a run here const uint8_t* ip = (uint8_t*)_src + j * neblock; const uint8_t* ipbound = (uint8_t*)_src + (j + 1) * neblock; if (get_run(ip, ipbound)) { // A run. Encode the repeated byte as a negative length in the length of the split. int32_t value = _src[j * neblock]; _sw32(dest - 4, -value); continue; } maxout = neblock; #if defined(HAVE_SNAPPY) if (context->compcode == BLOSC_SNAPPY) { maxout = (int32_t)snappy_max_compressed_length((size_t)neblock); } #endif /* HAVE_SNAPPY */ if (ntbytes + maxout > maxbytes) { /* avoid buffer * overrun */ maxout = (int64_t)maxbytes - (int64_t)ntbytes; if (maxout <= 0) { return 0; /* non-compressible block */ } } if (dict_training) { // We are in the build dict state, so don't compress // TODO: copy only a percentage for sampling memcpy(dest, _src + j * neblock, (unsigned int)neblock); cbytes = (int32_t)neblock; } else if (context->compcode == BLOSC_BLOSCLZ) { cbytes = blosclz_compress(context->clevel, _src + j * neblock, (int)neblock, dest, (int)maxout); } #if defined(HAVE_LZ4) else if (context->compcode == BLOSC_LZ4) { void *hash_table = NULL; #ifdef HAVE_IPP hash_table = (void*)thread_context->lz4_hash_table; #endif cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock, (char*)dest, (size_t)maxout, accel, hash_table); } else if (context->compcode == BLOSC_LZ4HC) { cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock, (char*)dest, (size_t)maxout, context->clevel); } #endif /* HAVE_LZ4 */ #if defined(HAVE_LIZARD) else if (context->compcode == BLOSC_LIZARD) { cbytes = lizard_wrap_compress((char*)_src + j * neblock, (size_t)neblock, (char*)dest, (size_t)maxout, accel); } #endif /* HAVE_LIZARD */ #if defined(HAVE_SNAPPY) else if (context->compcode == BLOSC_SNAPPY) { cbytes = snappy_wrap_compress((char*)_src + j * neblock, (size_t)neblock, (char*)dest, (size_t)maxout); } #endif /* HAVE_SNAPPY */ #if defined(HAVE_ZLIB) else if (context->compcode == BLOSC_ZLIB) { cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock, (char*)dest, (size_t)maxout, context->clevel); } #endif /* HAVE_ZLIB */ #if defined(HAVE_ZSTD) else if (context->compcode == BLOSC_ZSTD) { cbytes = zstd_wrap_compress(thread_context, (char*)_src + j * neblock, (size_t)neblock, (char*)dest, (size_t)maxout, context->clevel); } #endif /* HAVE_ZSTD */ else { blosc_compcode_to_compname(context->compcode, &compname); fprintf(stderr, \"Blosc has not been compiled with '%s' \", compname); fprintf(stderr, \"compression support. Please use one having it.\"); return -5; /* signals no compression support */ } if (cbytes > maxout) { /* Buffer overrun caused by compression (should never happen) */ return -1; } if (cbytes < 0) { /* cbytes should never be negative */ return -2; } if (!dict_training) { if (cbytes == 0 || cbytes == neblock) { /* The compressor has been unable to compress data at all. */ /* Before doing the copy, check that we are not running into a buffer overflow. */ if ((ntbytes + neblock) > maxbytes) { return 0; /* Non-compressible data */ } memcpy(dest, _src + j * neblock, (unsigned int)neblock); cbytes = neblock; } _sw32(dest - 4, cbytes); } dest += cbytes; ntbytes += cbytes; ctbytes += cbytes; } /* Closes j < nstreams */ //printf(\"c%d\", ctbytes); return ctbytes; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "blosc2.c in Blosc C-Blosc2 through 2.0.0.beta.5 has a heap-based buffer overflow when there is a lack of space to write compressed data.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-29367"}} -{"idx": 246133, "input": "void sqlite3SetJoinExpr(Expr *p, int iTable){ while( p ){ ExprSetProperty(p, EP_FromJoin); assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(p, EP_NoReduce); p->iRightJoinTable = (i16)iTable; if( p->op==TK_FUNCTION && p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable); } } sqlite3SetJoinExpr(p->pLeft, iTable); p = p->pRight; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 498284, "input": "path_simplify (enum url_scheme scheme, char *path) { char *h = path; /* hare */ char *t = path; /* tortoise */ char *beg = path; char *end = strchr (path, '\\0'); while (h < end) { /* Hare should be at the beginning of a path element. */ if (h[0] == '.' && (h[1] == '/' || h[1] == '\\0')) { /* Ignore \"./\". */ h += 2; } else if (h[0] == '.' && h[1] == '.' && (h[2] == '/' || h[2] == '\\0')) { /* Handle \"../\" by retreating the tortoise by one path element -- but not past beginning. */ if (t > beg) { /* Move backwards until T hits the beginning of the previous path element or the beginning of path. */ for (--t; t > beg && t[-1] != '/'; t--) ; } else if (scheme == SCHEME_FTP #ifdef HAVE_SSL || scheme == SCHEME_FTPS #endif ) { /* If we're at the beginning, copy the \"../\" literally and move the beginning so a later \"..\" doesn't remove it. This violates RFC 3986; but we do it for FTP anyway because there is otherwise no way to get at a parent directory, when the FTP server drops us in a non-root directory (which is not uncommon). */ beg = t + 3; goto regular; } h += 3; } else { regular: /* A regular path element. If H hasn't advanced past T, simply skip to the next path element. Otherwise, copy the path element until the next slash. */ if (t == h) { /* Skip the path element, including the slash. */ while (h < end && *h != '/') t++, h++; if (h < end) t++, h++; } else { /* Copy the path element, including the final slash. */ while (h < end && *h != '/') *t++ = *h++; if (h < end) *t++ = *h++; } } } if (t != h) *t = '\\0'; return t != h; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281299, "input": "RGWOp *RGWHandler_REST_Bucket_S3::get_obj_op(bool get_data) { // Non-website mode if (get_data) { return new RGWListBucket_ObjStore_S3; } else { return new RGWStatBucket_ObjStore_S3; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393124, "input": "TEST_F(QueryPlannerTest, SortLimit) { // Negative limit indicates hard limit - see query_request.cpp runQuerySortProjSkipNToReturn(BSONObj(), fromjson(\"{a: 1}\"), BSONObj(), 0, -3); assertNumSolutions(1U); assertSolutionExists( \"{sort: {pattern: {a: 1}, limit: 3, node: {sortKeyGen: \" \"{node: {cscan: {dir: 1}}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446282, "input": "ScanLineInputFile::header () const { return _data->header; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198557, "input": "inline Status SparseTensor::Split(const SparseTensor& input_tensor, const int split_dim, const int num_split, std::vector* result) { std::vector output_indices; std::vector output_values; std::vector output_shapes; output_indices.reserve(num_split); output_values.reserve(num_split); output_shapes.reserve(num_split); std::vector::Matrix> output_indices_t; std::vector::Vec> output_values_t; output_indices_t.reserve(num_split); output_values_t.reserve(num_split); auto input_values_t = input_tensor.values().vec(); auto input_indices_t = input_tensor.indices().matrix(); std::vector num_values(num_split, 0); const int num_dim = input_tensor.shape().size(); const int split_dim_size = input_tensor.shape()[split_dim]; const int split_size = split_dim_size / num_split; if (!(num_split > 0 && num_split <= split_dim_size)) { return errors::InvalidArgument(\"num_split must be in the interval (0, \", split_dim_size, \"]\"); } if (!(split_dim >= 0 && split_dim < num_dim)) { return errors::InvalidArgument(\"num_dim must be in the interval [0, \", num_dim, \")\"); } const int residual = split_dim_size % num_split; for (int i = 0; i < input_tensor.indices().dim_size(0); ++i) { const int dim = input_tensor.indices().matrix()(i, split_dim); int slice_index = GetSliceIndex(dim, split_size, residual); num_values[slice_index]++; } for (int i = 0; i < num_split; ++i) { // TODO(ataei): Pass an allocator to avoid allocating large memory buffer. output_indices.emplace_back(DT_INT64, TensorShape({num_values[i], num_dim})); output_values.emplace_back(DataTypeToEnum::v(), TensorShape({num_values[i]})); output_shapes.emplace_back(input_tensor.shape()); output_indices_t.emplace_back(output_indices[i].matrix()); output_values_t.emplace_back(output_values[i].vec()); const int size = GetSliceShape(i, split_size, residual); output_shapes[i].set_dim(split_dim, size); } std::vector values_inserted_in_slice(num_split, 0); for (int i = 0; i < input_tensor.indices().dim_size(0); ++i) { const int dim = input_indices_t(i, split_dim); const int slice_index = GetSliceIndex(dim, split_size, residual); const int slice_dim = values_inserted_in_slice[slice_index]++; output_values_t[slice_index](slice_dim) = input_values_t(i); for (int j = 0; j < num_dim; ++j) { const int64 original_dim = input_indices_t(i, j); output_indices_t[slice_index](slice_dim, j) = (j == split_dim) ? GetDimensionInSlice(original_dim, split_size, residual) : original_dim; } } result->clear(); result->reserve(num_split); for (int i = 0; i < num_split; ++i) { SparseTensor tensor; Status create_status = Create(output_indices[i], output_values[i], output_shapes[i], &tensor); if (!create_status.ok()) { return create_status; } result->push_back(std::move(tensor)); } return Status::OK(); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `tf.raw_ops.SparseSplit`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/699bff5d961f0abfde8fa3f876e6d241681fbef8/tensorflow/core/util/sparse/sparse_tensor.h#L528-L530) accesses an array element based on a user controlled offset. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2021-29558"}} -{"idx": 370108, "input": "Value ExpressionDateFromParts::evaluate(const Document& root, Variables* variables) const { long long hour, minute, second, millisecond; if (!evaluateNumberWithDefaultAndBounds(root, _hour.get(), \"hour\"_sd, 0, &hour, variables) || !evaluateNumberWithDefaultAndBounds( root, _minute.get(), \"minute\"_sd, 0, &minute, variables) || !evaluateNumberWithDefault(root, _second.get(), \"second\"_sd, 0, &second, variables) || !evaluateNumberWithDefault( root, _millisecond.get(), \"millisecond\"_sd, 0, &millisecond, variables)) { // One of the evaluated inputs in nullish. return Value(BSONNULL); } auto timeZone = makeTimeZone(getExpressionContext()->timeZoneDatabase, root, _timeZone.get(), variables); if (!timeZone) { return Value(BSONNULL); } if (_year) { long long year, month, day; if (!evaluateNumberWithDefault(root, _year.get(), \"year\"_sd, 1970, &year, variables) || !evaluateNumberWithDefaultAndBounds( root, _month.get(), \"month\"_sd, 1, &month, variables) || !evaluateNumberWithDefaultAndBounds(root, _day.get(), \"day\"_sd, 1, &day, variables)) { // One of the evaluated inputs in nullish. return Value(BSONNULL); } uassert(40523, str::stream() << \"'year' must evaluate to an integer in the range \" << 1 << \" to \" << 9999 << \", found \" << year, year >= 1 && year <= 9999); return Value( timeZone->createFromDateParts(year, month, day, hour, minute, second, millisecond)); } if (_isoWeekYear) { long long isoWeekYear, isoWeek, isoDayOfWeek; if (!evaluateNumberWithDefault( root, _isoWeekYear.get(), \"isoWeekYear\"_sd, 1970, &isoWeekYear, variables) || !evaluateNumberWithDefaultAndBounds( root, _isoWeek.get(), \"isoWeek\"_sd, 1, &isoWeek, variables) || !evaluateNumberWithDefaultAndBounds( root, _isoDayOfWeek.get(), \"isoDayOfWeek\"_sd, 1, &isoDayOfWeek, variables)) { // One of the evaluated inputs in nullish. return Value(BSONNULL); } uassert(31095, str::stream() << \"'isoWeekYear' must evaluate to an integer in the range \" << 1 << \" to \" << 9999 << \", found \" << isoWeekYear, isoWeekYear >= 1 && isoWeekYear <= 9999); return Value(timeZone->createFromIso8601DateParts( isoWeekYear, isoWeek, isoDayOfWeek, hour, minute, second, millisecond)); } MONGO_UNREACHABLE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 355498, "input": "static void read_conf(void) { FILE *fp = fopen(FUSE_CONF, \"r\"); if (fp != NULL) { int linenum = 1; char line[256]; int isnewline = 1; while (fgets(line, sizeof(line), fp) != NULL) { if (isnewline) { if (line[strlen(line)-1] == '\\n') { strip_line(line); parse_line(line, linenum); } else { isnewline = 0; } } else if(line[strlen(line)-1] == '\\n') { fprintf(stderr, \"%s: reading %s: line %i too long\\n\", progname, FUSE_CONF, linenum); isnewline = 1; } if (isnewline) linenum ++; } if (!isnewline) { fprintf(stderr, \"%s: reading %s: missing newline at end of file\\n\", progname, FUSE_CONF); } if (ferror(fp)) { fprintf(stderr, \"%s: reading %s: read failed\\n\", progname, FUSE_CONF); exit(1); } fclose(fp); } else if (errno != ENOENT) { bool fatal = (errno != EACCES && errno != ELOOP && errno != ENAMETOOLONG && errno != ENOTDIR && errno != EOVERFLOW); fprintf(stderr, \"%s: failed to open %s: %s\\n\", progname, FUSE_CONF, strerror(errno)); if (fatal) exit(1); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 301227, "input": "string_is_ip_address(uschar *s, int *maskptr) { int i; int yield = 4; /* If an optional mask is permitted, check for it. If found, pass back the offset. */ if (maskptr != NULL) { uschar *ss = s + Ustrlen(s); *maskptr = 0; if (s != ss && isdigit(*(--ss))) { while (ss > s && isdigit(ss[-1])) ss--; if (ss > s && *(--ss) == '/') *maskptr = ss - s; } } /* A colon anywhere in the string => IPv6 address */ if (Ustrchr(s, ':') != NULL) { BOOL had_double_colon = FALSE; BOOL v4end = FALSE; int count = 0; yield = 6; /* An IPv6 address must start with hex digit or double colon. A single colon is invalid. */ if (*s == ':' && *(++s) != ':') return 0; /* Now read up to 8 components consisting of up to 4 hex digits each. There may be one and only one appearance of double colon, which implies any number of binary zero bits. The number of preceding components is held in count. */ for (count = 0; count < 8; count++) { /* If the end of the string is reached before reading 8 components, the address is valid provided a double colon has been read. This also applies if we hit the / that introduces a mask or the % that introduces the interface specifier (scope id) of a link-local address. */ if (*s == 0 || *s == '%' || *s == '/') return had_double_colon? yield : 0; /* If a component starts with an additional colon, we have hit a double colon. This is permitted to appear once only, and counts as at least one component. The final component may be of this form. */ if (*s == ':') { if (had_double_colon) return 0; had_double_colon = TRUE; s++; continue; } /* If the remainder of the string contains a dot but no colons, we can expect a trailing IPv4 address. This is valid if either there has been no double-colon and this is the 7th component (with the IPv4 address being the 7th & 8th components), OR if there has been a double-colon and fewer than 6 components. */ if (Ustrchr(s, ':') == NULL && Ustrchr(s, '.') != NULL) { if ((!had_double_colon && count != 6) || (had_double_colon && count > 6)) return 0; v4end = TRUE; yield = 6; break; } /* Check for at least one and not more than 4 hex digits for this component. */ if (!isxdigit(*s++)) return 0; if (isxdigit(*s) && isxdigit(*(++s)) && isxdigit(*(++s))) s++; /* If the component is terminated by colon and there is more to follow, skip over the colon. If there is no more to follow the address is invalid. */ if (*s == ':' && *(++s) == 0) return 0; } /* If about to handle a trailing IPv4 address, drop through. Otherwise all is well if we are at the end of the string or at the mask or at a percent sign, which introduces the interface specifier (scope id) of a link local address. */ if (!v4end) return (*s == 0 || *s == '%' || (*s == '/' && maskptr != NULL && *maskptr != 0))? yield : 0; } /* Test for IPv4 address, which may be the tail-end of an IPv6 address. */ for (i = 0; i < 4; i++) { if (i != 0 && *s++ != '.') return 0; if (!isdigit(*s++)) return 0; if (isdigit(*s) && isdigit(*(++s))) s++; } return (*s == 0 || (*s == '/' && maskptr != NULL && *maskptr != 0))? yield : 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446302, "input": "ScanLineInputFile::frameBuffer () const { #if ILMBASE_THREADING_ENABLED std::lock_guard lock (*_streamData); #endif return _data->frameBuffer; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410728, "input": "static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk) { return skb_peek(&sk->sk_write_queue); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 489884, "input": "static int setup_new_group_blocks(struct super_block *sb, struct ext4_new_group_data *input) { struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_fsblk_t start = ext4_group_first_block_no(sb, input->group); int reserved_gdb = ext4_bg_has_super(sb, input->group) ? le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0; unsigned long gdblocks = ext4_bg_num_gdb(sb, input->group); struct buffer_head *bh; handle_t *handle; ext4_fsblk_t block; ext4_grpblk_t bit; int i; int err = 0, err2; /* This transaction may be extended/restarted along the way */ handle = ext4_journal_start_sb(sb, EXT4_MAX_TRANS_DATA); if (IS_ERR(handle)) return PTR_ERR(handle); lock_super(sb); if (input->group != sbi->s_groups_count) { err = -EBUSY; goto exit_journal; } if (IS_ERR(bh = bclean(handle, sb, input->block_bitmap))) { err = PTR_ERR(bh); goto exit_journal; } if (ext4_bg_has_super(sb, input->group)) { ext4_debug(\"mark backup superblock %#04llx (+0)\\n\", start); ext4_set_bit(0, bh->b_data); } /* Copy all of the GDT blocks into the backup in this group */ for (i = 0, bit = 1, block = start + 1; i < gdblocks; i++, block++, bit++) { struct buffer_head *gdb; ext4_debug(\"update backup group %#04llx (+%d)\\n\", block, bit); if ((err = extend_or_restart_transaction(handle, 1, bh))) goto exit_bh; gdb = sb_getblk(sb, block); if (!gdb) { err = -EIO; goto exit_bh; } if ((err = ext4_journal_get_write_access(handle, gdb))) { brelse(gdb); goto exit_bh; } lock_buffer(gdb); memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, gdb->b_size); set_buffer_uptodate(gdb); unlock_buffer(gdb); ext4_handle_dirty_metadata(handle, NULL, gdb); ext4_set_bit(bit, bh->b_data); brelse(gdb); } /* Zero out all of the reserved backup group descriptor table blocks */ for (i = 0, bit = gdblocks + 1, block = start + bit; i < reserved_gdb; i++, block++, bit++) { struct buffer_head *gdb; ext4_debug(\"clear reserved block %#04llx (+%d)\\n\", block, bit); if ((err = extend_or_restart_transaction(handle, 1, bh))) goto exit_bh; if (IS_ERR(gdb = bclean(handle, sb, block))) { err = PTR_ERR(bh); goto exit_bh; } ext4_handle_dirty_metadata(handle, NULL, gdb); ext4_set_bit(bit, bh->b_data); brelse(gdb); } ext4_debug(\"mark block bitmap %#04llx (+%llu)\\n\", input->block_bitmap, input->block_bitmap - start); ext4_set_bit(input->block_bitmap - start, bh->b_data); ext4_debug(\"mark inode bitmap %#04llx (+%llu)\\n\", input->inode_bitmap, input->inode_bitmap - start); ext4_set_bit(input->inode_bitmap - start, bh->b_data); /* Zero out all of the inode table blocks */ for (i = 0, block = input->inode_table, bit = block - start; i < sbi->s_itb_per_group; i++, bit++, block++) { struct buffer_head *it; ext4_debug(\"clear inode block %#04llx (+%d)\\n\", block, bit); if ((err = extend_or_restart_transaction(handle, 1, bh))) goto exit_bh; if (IS_ERR(it = bclean(handle, sb, block))) { err = PTR_ERR(it); goto exit_bh; } ext4_handle_dirty_metadata(handle, NULL, it); brelse(it); ext4_set_bit(bit, bh->b_data); } if ((err = extend_or_restart_transaction(handle, 2, bh))) goto exit_bh; mark_bitmap_end(input->blocks_count, sb->s_blocksize * 8, bh->b_data); ext4_handle_dirty_metadata(handle, NULL, bh); brelse(bh); /* Mark unused entries in inode bitmap used */ ext4_debug(\"clear inode bitmap %#04llx (+%llu)\\n\", input->inode_bitmap, input->inode_bitmap - start); if (IS_ERR(bh = bclean(handle, sb, input->inode_bitmap))) { err = PTR_ERR(bh); goto exit_journal; } mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8, bh->b_data); ext4_handle_dirty_metadata(handle, NULL, bh); exit_bh: brelse(bh); exit_journal: unlock_super(sb); if ((err2 = ext4_journal_stop(handle)) && !err) err = err2; return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373803, "input": "StartDA(qqueue_t *pThis) { DEFiRet; uchar pszDAQName[128]; ISOBJ_TYPE_assert(pThis, qqueue); /* create message queue */ CHKiRet(qqueueConstruct(&pThis->pqDA, QUEUETYPE_DISK , 1, 0, pThis->pConsumer)); /* give it a name */ snprintf((char*) pszDAQName, sizeof(pszDAQName)/sizeof(uchar), \"%s[DA]\", obj.GetName((obj_t*) pThis)); obj.SetName((obj_t*) pThis->pqDA, pszDAQName); /* as the created queue is the same object class, we take the * liberty to access its properties directly. */ pThis->pqDA->pqParent = pThis; CHKiRet(qqueueSetpUsr(pThis->pqDA, pThis->pUsr)); CHKiRet(qqueueSetsizeOnDiskMax(pThis->pqDA, pThis->sizeOnDiskMax)); CHKiRet(qqueueSetiDeqSlowdown(pThis->pqDA, pThis->iDeqSlowdown)); CHKiRet(qqueueSetMaxFileSize(pThis->pqDA, pThis->iMaxFileSize)); CHKiRet(qqueueSetFilePrefix(pThis->pqDA, pThis->pszFilePrefix, pThis->lenFilePrefix)); CHKiRet(qqueueSetiPersistUpdCnt(pThis->pqDA, pThis->iPersistUpdCnt)); CHKiRet(qqueueSetbSyncQueueFiles(pThis->pqDA, pThis->bSyncQueueFiles)); CHKiRet(qqueueSettoActShutdown(pThis->pqDA, pThis->toActShutdown)); CHKiRet(qqueueSettoEnq(pThis->pqDA, pThis->toEnq)); CHKiRet(qqueueSetiDeqtWinFromHr(pThis->pqDA, pThis->iDeqtWinFromHr)); CHKiRet(qqueueSetiDeqtWinToHr(pThis->pqDA, pThis->iDeqtWinToHr)); CHKiRet(qqueueSettoQShutdown(pThis->pqDA, pThis->toQShutdown)); CHKiRet(qqueueSetiHighWtrMrk(pThis->pqDA, 0)); CHKiRet(qqueueSetiDiscardMrk(pThis->pqDA, 0)); iRet = qqueueStart(pThis->pqDA); /* file not found is expected, that means it is no previous QIF available */ if(iRet != RS_RET_OK && iRet != RS_RET_FILE_NOT_FOUND) { errno = 0; /* else an errno is shown in errmsg! */ errmsg.LogError(errno, iRet, \"error starting up disk queue, using pure in-memory mode\"); pThis->bIsDA = 0; /* disable memory mode */ FINALIZE; /* something is wrong */ } DBGOPRINT((obj_t*) pThis, \"DA queue initialized, disk queue 0x%lx\\n\", qqueueGetID(pThis->pqDA)); finalize_it: if(iRet != RS_RET_OK) { if(pThis->pqDA != NULL) { qqueueDestruct(&pThis->pqDA); } DBGOPRINT((obj_t*) pThis, \"error %d creating disk queue - giving up.\\n\", iRet); pThis->bIsDA = 0; } RETiRet; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263098, "input": "iasecc_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_context *ctx = card->ctx; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, \"iasecc_pin_cmd() cmd 0x%X, PIN type 0x%X, PIN reference %i, PIN-1 %p:%i, PIN-2 %p:%i\", data->cmd, data->pin_type, data->pin_reference, data->pin1.data, data->pin1.len, data->pin2.data, data->pin2.len); switch (data->cmd) { case SC_PIN_CMD_VERIFY: rv = iasecc_pin_verify(card, data, tries_left); break; case SC_PIN_CMD_CHANGE: if (data->pin_type == SC_AC_AUT) rv = iasecc_keyset_change(card, data, tries_left); else rv = iasecc_pin_change(card, data, tries_left); break; case SC_PIN_CMD_UNBLOCK: rv = iasecc_pin_reset(card, data, tries_left); break; case SC_PIN_CMD_GET_INFO: rv = iasecc_pin_get_info(card, data, tries_left); break; default: sc_log(ctx, \"Other pin commands not supported yet: 0x%X\", data->cmd); rv = SC_ERROR_NOT_SUPPORTED; } LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364133, "input": "vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) { struct vm_area_struct *vma = vmf->vma; struct anon_vma *anon_vma = NULL; struct page *page; unsigned long haddr = vmf->address & HPAGE_PMD_MASK; int page_nid = NUMA_NO_NODE, this_nid = numa_node_id(); int target_nid, last_cpupid = -1; bool page_locked; bool migrated = false; bool was_writable; int flags = 0; vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); if (unlikely(!pmd_same(pmd, *vmf->pmd))) goto out_unlock; /* * If there are potential migrations, wait for completion and retry * without disrupting NUMA hinting information. Do not relock and * check_same as the page may no longer be mapped. */ if (unlikely(pmd_trans_migrating(*vmf->pmd))) { page = pmd_page(*vmf->pmd); if (!get_page_unless_zero(page)) goto out_unlock; spin_unlock(vmf->ptl); put_and_wait_on_page_locked(page); goto out; } page = pmd_page(pmd); BUG_ON(is_huge_zero_page(page)); page_nid = page_to_nid(page); last_cpupid = page_cpupid_last(page); count_vm_numa_event(NUMA_HINT_FAULTS); if (page_nid == this_nid) { count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); flags |= TNF_FAULT_LOCAL; } /* See similar comment in do_numa_page for explanation */ if (!pmd_savedwrite(pmd)) flags |= TNF_NO_GROUP; /* * Acquire the page lock to serialise THP migrations but avoid dropping * page_table_lock if at all possible */ page_locked = trylock_page(page); target_nid = mpol_misplaced(page, vma, haddr); if (target_nid == NUMA_NO_NODE) { /* If the page was locked, there are no parallel migrations */ if (page_locked) goto clear_pmdnuma; } /* Migration could have started since the pmd_trans_migrating check */ if (!page_locked) { page_nid = NUMA_NO_NODE; if (!get_page_unless_zero(page)) goto out_unlock; spin_unlock(vmf->ptl); put_and_wait_on_page_locked(page); goto out; } /* * Page is misplaced. Page lock serialises migrations. Acquire anon_vma * to serialises splits */ get_page(page); spin_unlock(vmf->ptl); anon_vma = page_lock_anon_vma_read(page); /* Confirm the PMD did not change while page_table_lock was released */ spin_lock(vmf->ptl); if (unlikely(!pmd_same(pmd, *vmf->pmd))) { unlock_page(page); put_page(page); page_nid = NUMA_NO_NODE; goto out_unlock; } /* Bail if we fail to protect against THP splits for any reason */ if (unlikely(!anon_vma)) { put_page(page); page_nid = NUMA_NO_NODE; goto clear_pmdnuma; } /* * Since we took the NUMA fault, we must have observed the !accessible * bit. Make sure all other CPUs agree with that, to avoid them * modifying the page we're about to migrate. * * Must be done under PTL such that we'll observe the relevant * inc_tlb_flush_pending(). * * We are not sure a pending tlb flush here is for a huge page * mapping or not. Hence use the tlb range variant */ if (mm_tlb_flush_pending(vma->vm_mm)) { flush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE); /* * change_huge_pmd() released the pmd lock before * invalidating the secondary MMUs sharing the primary * MMU pagetables (with ->invalidate_range()). The * mmu_notifier_invalidate_range_end() (which * internally calls ->invalidate_range()) in * change_pmd_range() will run after us, so we can't * rely on it here and we need an explicit invalidate. */ mmu_notifier_invalidate_range(vma->vm_mm, haddr, haddr + HPAGE_PMD_SIZE); } /* * Migrate the THP to the requested node, returns with page unlocked * and access rights restored. */ spin_unlock(vmf->ptl); migrated = migrate_misplaced_transhuge_page(vma->vm_mm, vma, vmf->pmd, pmd, vmf->address, page, target_nid); if (migrated) { flags |= TNF_MIGRATED; page_nid = target_nid; } else flags |= TNF_MIGRATE_FAIL; goto out; clear_pmdnuma: BUG_ON(!PageLocked(page)); was_writable = pmd_savedwrite(pmd); pmd = pmd_modify(pmd, vma->vm_page_prot); pmd = pmd_mkyoung(pmd); if (was_writable) pmd = pmd_mkwrite(pmd); set_pmd_at(vma->vm_mm, haddr, vmf->pmd, pmd); update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); unlock_page(page); out_unlock: spin_unlock(vmf->ptl); out: if (anon_vma) page_unlock_anon_vma_read(anon_vma); if (page_nid != NUMA_NO_NODE) task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR, flags); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336231, "input": "static inline void ep_busy_loop(struct eventpoll *ep, int nonblock) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 489881, "input": "static int verify_reserved_gdb(struct super_block *sb, struct buffer_head *primary) { const ext4_fsblk_t blk = primary->b_blocknr; const ext4_group_t end = EXT4_SB(sb)->s_groups_count; unsigned three = 1; unsigned five = 5; unsigned seven = 7; unsigned grp; __le32 *p = (__le32 *)primary->b_data; int gdbackups = 0; while ((grp = ext4_list_backups(sb, &three, &five, &seven)) < end) { if (le32_to_cpu(*p++) != grp * EXT4_BLOCKS_PER_GROUP(sb) + blk){ ext4_warning(sb, __func__, \"reserved GDT %llu\" \" missing grp %d (%llu)\", blk, grp, grp * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + blk); return -EINVAL; } if (++gdbackups > EXT4_ADDR_PER_BLOCK(sb)) return -EFBIG; } return gdbackups; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214193, "input": "static void dp8393x_do_transmit_packets(dp8393xState *s) { NetClientState *nc = qemu_get_queue(s->nic); int width, size; int tx_len, len; uint16_t i; width = (s->regs[SONIC_DCR] & SONIC_DCR_DW) ? 2 : 1; while (1) { /* Read memory */ size = sizeof(uint16_t) * 6 * width; s->regs[SONIC_TTDA] = s->regs[SONIC_CTDA]; DPRINTF(\"Transmit packet at %08x\\n\", dp8393x_ttda(s)); address_space_read(&s->as, dp8393x_ttda(s) + sizeof(uint16_t) * width, MEMTXATTRS_UNSPECIFIED, s->data, size); tx_len = 0; /* Update registers */ s->regs[SONIC_TCR] = dp8393x_get(s, width, 0) & 0xf000; s->regs[SONIC_TPS] = dp8393x_get(s, width, 1); s->regs[SONIC_TFC] = dp8393x_get(s, width, 2); s->regs[SONIC_TSA0] = dp8393x_get(s, width, 3); s->regs[SONIC_TSA1] = dp8393x_get(s, width, 4); s->regs[SONIC_TFS] = dp8393x_get(s, width, 5); /* Handle programmable interrupt */ if (s->regs[SONIC_TCR] & SONIC_TCR_PINT) { s->regs[SONIC_ISR] |= SONIC_ISR_PINT; } else { s->regs[SONIC_ISR] &= ~SONIC_ISR_PINT; } for (i = 0; i < s->regs[SONIC_TFC]; ) { /* Append fragment */ len = s->regs[SONIC_TFS]; if (tx_len + len > sizeof(s->tx_buffer)) { len = sizeof(s->tx_buffer) - tx_len; } address_space_read(&s->as, dp8393x_tsa(s), MEMTXATTRS_UNSPECIFIED, &s->tx_buffer[tx_len], len); tx_len += len; i++; if (i != s->regs[SONIC_TFC]) { /* Read next fragment details */ size = sizeof(uint16_t) * 3 * width; address_space_read(&s->as, dp8393x_ttda(s) + sizeof(uint16_t) * width * (4 + 3 * i), MEMTXATTRS_UNSPECIFIED, s->data, size); s->regs[SONIC_TSA0] = dp8393x_get(s, width, 0); s->regs[SONIC_TSA1] = dp8393x_get(s, width, 1); s->regs[SONIC_TFS] = dp8393x_get(s, width, 2); } } /* Handle Ethernet checksum */ if (!(s->regs[SONIC_TCR] & SONIC_TCR_CRCI)) { /* Don't append FCS there, to look like slirp packets * which don't have one */ } else { /* Remove existing FCS */ tx_len -= 4; if (tx_len < 0) { SONIC_ERROR(\"tx_len is %d\\n\", tx_len); break; } } if (s->regs[SONIC_RCR] & (SONIC_RCR_LB1 | SONIC_RCR_LB0)) { /* Loopback */ s->regs[SONIC_TCR] |= SONIC_TCR_CRSL; if (nc->info->can_receive(nc)) { s->loopback_packet = 1; nc->info->receive(nc, s->tx_buffer, tx_len); } } else { /* Transmit packet */ qemu_send_packet(nc, s->tx_buffer, tx_len); } s->regs[SONIC_TCR] |= SONIC_TCR_PTX; /* Write status */ dp8393x_put(s, width, 0, s->regs[SONIC_TCR] & 0x0fff); /* status */ size = sizeof(uint16_t) * width; address_space_write(&s->as, dp8393x_ttda(s), MEMTXATTRS_UNSPECIFIED, s->data, size); if (!(s->regs[SONIC_CR] & SONIC_CR_HTX)) { /* Read footer of packet */ size = sizeof(uint16_t) * width; address_space_read(&s->as, dp8393x_ttda(s) + sizeof(uint16_t) * width * (4 + 3 * s->regs[SONIC_TFC]), MEMTXATTRS_UNSPECIFIED, s->data, size); s->regs[SONIC_CTDA] = dp8393x_get(s, width, 0); if (s->regs[SONIC_CTDA] & SONIC_DESC_EOL) { /* EOL detected */ break; } } } /* Done */ s->regs[SONIC_CR] &= ~SONIC_CR_TXP; s->regs[SONIC_ISR] |= SONIC_ISR_TXDN; dp8393x_update_irq(s); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Loop with Unreachable Exit Condition ('Infinite Loop')"], "explanation": "A potential stack overflow via infinite loop issue was found in various NIC emulators of QEMU in versions up to and including 5.2.0. The issue occurs in loopback mode of a NIC wherein reentrant DMA checks get bypassed. A guest user/process may use this flaw to consume CPU cycles or crash the QEMU process on the host resulting in DoS scenario.", "severity_level": "NoInfo", "cwe": "CWE-835", "cve": "CVE-2021-3416"}} -{"idx": 398314, "input": "static void mcba_usb_xmit_cmd(struct mcba_priv *priv, struct mcba_usb_msg *usb_msg) { struct mcba_usb_ctx *ctx = NULL; int err; ctx = mcba_usb_get_free_ctx(priv, NULL); if (!ctx) { netdev_err(priv->netdev, \"Lack of free ctx. Sending (%d) cmd aborted\", usb_msg->cmd_id); return; } err = mcba_usb_xmit(priv, usb_msg, ctx); if (err) netdev_err(priv->netdev, \"Failed to send cmd (%d)\", usb_msg->cmd_id); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402134, "input": "static INLINE BYTE* WRITEFIRSTLINEFGBGIMAGE(BYTE* pbDest, const BYTE* pbDestEnd, BYTE bitmask, PIXEL fgPel, UINT32 cBits) { BYTE mask = 0x01; if (cBits > 8) return NULL; if (!ENSURE_CAPACITY(pbDest, pbDestEnd, cBits)) return NULL; UNROLL(cBits, { UINT32 data; if (bitmask & mask) data = fgPel; else data = BLACK_PIXEL; DESTWRITEPIXEL(pbDest, data); DESTNEXTPIXEL(pbDest); mask = mask << 1; }); return pbDest; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 200525, "input": "gdImagePtr gdImageCreateFromXpm (char *filename) { XpmInfo info; XpmImage image; int i, j, k, number; char buf[5]; gdImagePtr im = 0; int *pointer; int red = 0, green = 0, blue = 0; int *colors; int ret; ret = XpmReadFileToXpmImage(filename, &image, &info); if (ret != XpmSuccess) { return 0; } if (!(im = gdImageCreate(image.width, image.height))) { goto done; } number = image.ncolors; colors = (int *) safe_emalloc(number, sizeof(int), 0); for (i = 0; i < number; i++) { switch (strlen (image.colorTable[i].c_color)) { case 4: buf[1] = '\\0'; buf[0] = image.colorTable[i].c_color[1]; red = strtol(buf, NULL, 16); buf[0] = image.colorTable[i].c_color[2]; green = strtol(buf, NULL, 16); buf[0] = image.colorTable[i].c_color[3]; blue = strtol(buf, NULL, 16); break; case 7: buf[2] = '\\0'; buf[0] = image.colorTable[i].c_color[1]; buf[1] = image.colorTable[i].c_color[2]; red = strtol(buf, NULL, 16); buf[0] = image.colorTable[i].c_color[3]; buf[1] = image.colorTable[i].c_color[4]; green = strtol(buf, NULL, 16); buf[0] = image.colorTable[i].c_color[5]; buf[1] = image.colorTable[i].c_color[6]; blue = strtol(buf, NULL, 16); break; case 10: buf[3] = '\\0'; buf[0] = image.colorTable[i].c_color[1]; buf[1] = image.colorTable[i].c_color[2]; buf[2] = image.colorTable[i].c_color[3]; red = strtol(buf, NULL, 16); red /= 64; buf[0] = image.colorTable[i].c_color[4]; buf[1] = image.colorTable[i].c_color[5]; buf[2] = image.colorTable[i].c_color[6]; green = strtol(buf, NULL, 16); green /= 64; buf[0] = image.colorTable[i].c_color[7]; buf[1] = image.colorTable[i].c_color[8]; buf[2] = image.colorTable[i].c_color[9]; blue = strtol(buf, NULL, 16); blue /= 64; break; case 13: buf[4] = '\\0'; buf[0] = image.colorTable[i].c_color[1]; buf[1] = image.colorTable[i].c_color[2]; buf[2] = image.colorTable[i].c_color[3]; buf[3] = image.colorTable[i].c_color[4]; red = strtol(buf, NULL, 16); red /= 256; buf[0] = image.colorTable[i].c_color[5]; buf[1] = image.colorTable[i].c_color[6]; buf[2] = image.colorTable[i].c_color[7]; buf[3] = image.colorTable[i].c_color[8]; green = strtol(buf, NULL, 16); green /= 256; buf[0] = image.colorTable[i].c_color[9]; buf[1] = image.colorTable[i].c_color[10]; buf[2] = image.colorTable[i].c_color[11]; buf[3] = image.colorTable[i].c_color[12]; blue = strtol(buf, NULL, 16); blue /= 256; break; } colors[i] = gdImageColorResolve(im, red, green, blue); } pointer = (int *) image.data; for (i = 0; i < image.height; i++) { for (j = 0; j < image.width; j++) { k = *pointer++; gdImageSetPixel(im, j, i, colors[k]); } } gdFree(colors); done: XpmFreeXpmImage(&image); XpmFreeXpmInfo(&info); return im; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "The gdImageCreateFromXpm function in gdxpm.c in libgd, as used in PHP 5.4.26 and earlier, allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted color table in an XPM file.", "severity_level": "Medium", "cwe": "CWE-476", "cve": "CVE-2014-2497"}} -{"idx": 207859, "input": "int hci_req_sync(struct hci_dev *hdev, int (*req)(struct hci_request *req, unsigned long opt), unsigned long opt, u32 timeout, u8 *hci_status) { int ret; if (!test_bit(HCI_UP, &hdev->flags)) return -ENETDOWN; /* Serialize all requests */ hci_req_sync_lock(hdev); ret = __hci_req_sync(hdev, req, opt, timeout, hci_status); hci_req_sync_unlock(hdev); return ret; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"], "explanation": "net/bluetooth/hci_request.c in the Linux kernel through 5.12.2 has a race condition for removal of the HCI controller.", "severity_level": "NoInfo", "cwe": "CWE-362", "cve": "CVE-2021-32399"}} -{"idx": 431116, "input": "static bool nfs_open_stateid_recover_openmode(struct nfs4_state *state) { if (state->n_rdonly && !test_bit(NFS_O_RDONLY_STATE, &state->flags)) return true; if (state->n_wronly && !test_bit(NFS_O_WRONLY_STATE, &state->flags)) return true; if (state->n_rdwr && !test_bit(NFS_O_RDWR_STATE, &state->flags)) return true; return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461575, "input": "int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) { u8 *prog = image; sort(funcs, num_funcs, sizeof(funcs[0]), cmp_ips, NULL); return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393099, "input": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionDoesNotUseCoveredIxscanIfDisabled) { params.options &= ~QueryPlannerParams::GENERATE_COVERED_IXSCANS; addIndex(BSON(\"a\" << 1)); runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\")); assertNumSolutions(1); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1}, node: \" \"{cscan: {dir: 1}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195985, "input": "static GF_Err av1dmx_parse_flush_sample(GF_Filter *filter, GF_AV1DmxCtx *ctx) { u32 pck_size; GF_FilterPacket *pck; u8 *output; gf_bs_get_content_no_truncate(ctx->state.bs, &ctx->state.frame_obus, &pck_size, &ctx->state.frame_obus_alloc); if (!pck_size) { GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[AV1Dmx] no frame OBU, skipping OBU\\n\")); return GF_OK; } pck = gf_filter_pck_new_alloc(ctx->opid, pck_size, &output); if (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, pck); gf_filter_pck_set_cts(pck, ctx->cts); gf_filter_pck_set_sap(pck, ctx->state.frame_state.key_frame ? GF_FILTER_SAP_1 : 0); memcpy(output, ctx->state.frame_obus, pck_size); if (ctx->deps) { u8 flags = 0; //dependsOn flags = ( ctx->state.frame_state.key_frame) ? 2 : 1; flags <<= 2; //dependedOn flags |= ctx->state.frame_state.refresh_frame_flags ? 1 : 2; flags <<= 2; //hasRedundant //flags |= ctx->has_redundant ? 1 : 2; gf_filter_pck_set_dependency_flags(pck, flags); } gf_filter_pck_send(pck); av1dmx_update_cts(ctx); gf_av1_reset_state(&ctx->state, GF_FALSE); return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "There is a Null Pointer Dereference in function filter_core/filter_pck.c:gf_filter_pck_new_alloc_internal in GPAC 1.0.1. The pid comes from function av1dmx_parse_flush_sample, the ctx.opid maybe NULL. The result is a crash in gf_filter_pck_new_alloc_internal.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-30015"}} -{"idx": 308276, "input": "writeRandomBytes_getrandom(void * target, size_t count) { int success = 0; /* full count bytes written? */ size_t bytesWrittenTotal = 0; const unsigned int getrandomFlags = 0; do { void * const currentTarget = (void*)((char*)target + bytesWrittenTotal); const size_t bytesToWrite = count - bytesWrittenTotal; const int bytesWrittenMore = #if defined(HAVE_GETRANDOM) getrandom(currentTarget, bytesToWrite, getrandomFlags); #else syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags); #endif if (bytesWrittenMore > 0) { bytesWrittenTotal += bytesWrittenMore; if (bytesWrittenTotal >= count) success = 1; } } while (! success && (errno == EINTR || errno == EAGAIN)); return success; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468890, "input": "table_match(struct table *table, enum table_service kind, const char *key) { return table_lookup(table, kind, key, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267872, "input": "GF_Err gf_isom_refresh_size_info(GF_ISOFile *file, u32 trackNumber) { u32 i, size; GF_TrackBox *trak; GF_SampleSizeBox *stsz; trak = gf_isom_get_track_from_file(file, trackNumber); if (!trak) return GF_BAD_PARAM; stsz = trak->Media->information->sampleTable->SampleSize; if (stsz->sampleSize || !stsz->sampleCount) return GF_OK; size = stsz->sizes[0]; for (i=1; isampleCount; i++) { if (stsz->sizes[i] != size) { size = 0; break; } } if (size) { gf_free(stsz->sizes); stsz->sizes = NULL; stsz->sampleSize = size; } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 274272, "input": "static void ldapsrv_call_writev_done(struct tevent_req *subreq) { struct ldapsrv_call *call = tevent_req_callback_data(subreq, struct ldapsrv_call); struct ldapsrv_connection *conn = call->conn; int sys_errno; int rc; rc = tstream_writev_queue_recv(subreq, &sys_errno); TALLOC_FREE(subreq); /* This releases the ASN.1 encoded packets from memory */ TALLOC_FREE(call->out_iov); if (rc == -1) { const char *reason; reason = talloc_asprintf(call, \"ldapsrv_call_writev_done: \" \"tstream_writev_queue_recv() - %d:%s\", sys_errno, strerror(sys_errno)); if (reason == NULL) { reason = \"ldapsrv_call_writev_done: \" \"tstream_writev_queue_recv() failed\"; } ldapsrv_terminate_connection(conn, reason); return; } if (call->postprocess_send) { subreq = call->postprocess_send(call, conn->connection->event.ctx, call->postprocess_private); if (subreq == NULL) { ldapsrv_terminate_connection(conn, \"ldapsrv_call_writev_done: \" \"call->postprocess_send - no memory\"); return; } tevent_req_set_callback(subreq, ldapsrv_call_postprocess_done, call); return; } /* Perhaps still some more to send */ if (call->replies != NULL) { ldapsrv_call_writev_start(call); return; } if (!call->notification.busy) { TALLOC_FREE(call); } ldapsrv_call_read_next(conn); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 356307, "input": "int sqlite3ColumnsFromExprList( Parse *pParse, /* Parsing context */ ExprList *pEList, /* Expr list from which to derive column names */ i16 *pnCol, /* Write the number of columns here */ Column **paCol /* Write the new column list here */ ){ sqlite3 *db = pParse->db; /* Database connection */ int i, j; /* Loop counters */ u32 cnt; /* Index added to make the name unique */ Column *aCol, *pCol; /* For looping over result columns */ int nCol; /* Number of columns in the result set */ char *zName; /* Column name */ int nName; /* Size of name in zName[] */ Hash ht; /* Hash table of column names */ sqlite3HashInit(&ht); if( pEList ){ nCol = pEList->nExpr; aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol); testcase( aCol==0 ); if( nCol>32767 ) nCol = 32767; }else{ nCol = 0; aCol = 0; } assert( nCol==(i16)nCol ); *pnCol = nCol; *paCol = aCol; for(i=0, pCol=aCol; imallocFailed; i++, pCol++){ /* Get an appropriate name for the column */ if( (zName = pEList->a[i].zName)!=0 ){ /* If the column contains an \"AS \" phrase, use as the name */ }else{ Expr *pColExpr = sqlite3ExprSkipCollateAndLikely(pEList->a[i].pExpr); while( pColExpr->op==TK_DOT ){ pColExpr = pColExpr->pRight; assert( pColExpr!=0 ); } if( pColExpr->op==TK_COLUMN ){ /* For columns use the column name name */ int iCol = pColExpr->iColumn; Table *pTab = pColExpr->y.pTab; assert( pTab!=0 ); if( iCol<0 ) iCol = pTab->iPKey; zName = iCol>=0 ? pTab->aCol[iCol].zName : \"rowid\"; }else if( pColExpr->op==TK_ID ){ assert( !ExprHasProperty(pColExpr, EP_IntValue) ); zName = pColExpr->u.zToken; }else{ /* Use the original text of the column expression as its name */ zName = pEList->a[i].zSpan; } } if( zName ){ zName = sqlite3DbStrDup(db, zName); }else{ zName = sqlite3MPrintf(db,\"column%d\",i+1); } /* Make sure the column name is unique. If the name is not unique, ** append an integer to the name so that it becomes unique. */ cnt = 0; while( zName && sqlite3HashFind(&ht, zName)!=0 ){ nName = sqlite3Strlen30(zName); if( nName>0 ){ for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){} if( zName[j]==':' ) nName = j; } zName = sqlite3MPrintf(db, \"%.*z:%u\", nName, zName, ++cnt); if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt); } pCol->zName = zName; sqlite3ColumnPropertiesFromName(0, pCol); if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){ sqlite3OomFault(db); } } sqlite3HashClear(&ht); if( db->mallocFailed ){ for(j=0; j BLOSC_VERSION_FORMAT) { /* Version from future */ *flags = 0; *typesize = 0; return; } /* Read the interesting values */ *flags = (int)_src[2]; /* flags */ *typesize = (size_t)_src[3]; /* typesize */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378628, "input": "void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){ int n; sqlite3 *db = p->db; if( p->nResColumn ){ releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); sqlite3DbFree(db, p->aColName); } n = nResColumn*COLNAME_N; p->nResColumn = (u16)nResColumn; p->aColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n ); if( p->aColName==0 ) return; initMemArray(p->aColName, n, db, MEM_Null); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234470, "input": "static void ff_layout_commit_count_stats(struct rpc_task *task, void *data) { struct nfs_commit_data *cdata = data; ff_layout_commit_record_layoutstats_done(task, cdata); rpc_count_iostats_metrics(task, &NFS_CLIENT(cdata->inode)->cl_metrics[NFSPROC4_CLNT_COMMIT]); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430816, "input": "UnicodeString::hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const { pinIndices(start, length); // if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for NULL return u_strHasMoreChar32Than(getArrayStart()+start, length, number); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 205909, "input": "SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) { char *res = NULL, *var, *val, *separator = NULL; const char *c_var; zval array; int free_buffer = 0; char *strtok_buf = NULL; zend_long count = 0; ZVAL_UNDEF(&array); switch (arg) { case PARSE_POST: case PARSE_GET: case PARSE_COOKIE: array_init(&array); switch (arg) { case PARSE_POST: zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]); ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_POST], &array); break; case PARSE_GET: zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]); ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_GET], &array); break; case PARSE_COOKIE: zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]); ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_COOKIE], &array); break; } break; default: ZVAL_COPY_VALUE(&array, destArray); break; } if (arg == PARSE_POST) { sapi_handle_post(&array); return; } if (arg == PARSE_GET) { /* GET data */ c_var = SG(request_info).query_string; if (c_var && *c_var) { res = (char *) estrdup(c_var); free_buffer = 1; } else { free_buffer = 0; } } else if (arg == PARSE_COOKIE) { /* Cookie data */ c_var = SG(request_info).cookie_data; if (c_var && *c_var) { res = (char *) estrdup(c_var); free_buffer = 1; } else { free_buffer = 0; } } else if (arg == PARSE_STRING) { /* String data */ res = str; free_buffer = 1; } if (!res) { return; } switch (arg) { case PARSE_GET: case PARSE_STRING: separator = PG(arg_separator).input; break; case PARSE_COOKIE: separator = \";\\0\"; break; } var = php_strtok_r(res, separator, &strtok_buf); while (var) { val = strchr(var, '='); if (arg == PARSE_COOKIE) { /* Remove leading spaces from cookie names, needed for multi-cookie header where ; can be followed by a space */ while (isspace(*var)) { var++; } if (var == val || *var == '\\0') { goto next_cookie; } } if (++count > PG(max_input_vars)) { php_error_docref(NULL, E_WARNING, \"Input variables exceeded \" ZEND_LONG_FMT \". To increase the limit change max_input_vars in php.ini.\", PG(max_input_vars)); break; } if (val) { /* have a value */ size_t val_len; size_t new_val_len; *val++ = '\\0'; php_url_decode(var, strlen(var)); val_len = php_url_decode(val, strlen(val)); val = estrndup(val, val_len); if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) { php_register_variable_safe(var, val, new_val_len, &array); } efree(val); } else { size_t val_len; size_t new_val_len; php_url_decode(var, strlen(var)); val_len = 0; val = estrndup(\"\", val_len); if (sapi_module.input_filter(arg, var, &val, val_len, &new_val_len)) { php_register_variable_safe(var, val, new_val_len, &array); } efree(val); } next_cookie: var = php_strtok_r(NULL, separator, &strtok_buf); } if (free_buffer) { efree(res); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Reliance on Cookies without Validation and Integrity Checking"], "explanation": "In PHP versions 7.2.x below 7.2.34, 7.3.x below 7.3.23 and 7.4.x below 7.4.11, when PHP is processing incoming HTTP cookie values, the cookie names are url-decoded. This may lead to cookies with prefixes like __Host confused with cookies that decode to such prefix, thus leading to an attacker being able to forge cookie which is supposed to be secure. See also CVE-2020-8184 for more information.", "severity_level": "NoInfo", "cwe": "CWE-565", "cve": "CVE-2020-7070"}} -{"idx": 263471, "input": "int64_t TokLinuxStatFsFlags(int64_t input) { int64_t result = 0; if (input & ST_NOSUID) result |= kLinux_ST_NOSUID; if (input & ST_RDONLY) result |= kLinux_ST_RDONLY; #if (defined(__USE_GNU) && __USE_GNU) || \\ (defined(__GNU_VISIBLE) && __GNU_VISIBLE) if (input & ST_MANDLOCK) result |= kLinux_ST_MANDLOCK; if (input & ST_NOATIME) result |= kLinux_ST_NOATIME; if (input & ST_NODEV) result |= kLinux_ST_NODEV; if (input & ST_NODIRATIME) result |= kLinux_ST_NODIRATIME; if (input & ST_NOEXEC) result |= kLinux_ST_NOEXEC; if (input & ST_RELATIME) result |= kLinux_ST_RELATIME; if (input & ST_SYNCHRONOUS) result |= kLinux_ST_SYNCHRONOUS; #endif return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 404492, "input": "CryptRsaDecrypt( TPM2B *dOut, // OUT: the decrypted data TPM2B *cIn, // IN: the data to decrypt OBJECT *key, // IN: the key to use for decryption TPMT_RSA_DECRYPT *scheme, // IN: the padding scheme const TPM2B *label // IN: in case it is needed for the scheme ) { TPM_RC retVal; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *ctx = NULL; const EVP_MD *md = NULL; const char *digestname; size_t outlen; unsigned char *tmp = NULL; unsigned char buffer[MAX_RSA_KEY_BYTES]; // Make sure that the necessary parameters are provided pAssert(cIn != NULL && dOut != NULL && key != NULL); // Size is checked to make sure that the encrypted value is the right size if(cIn->size != key->publicArea.unique.rsa.t.size) ERROR_RETURN(TPM_RC_SIZE); TEST(scheme->scheme); retVal = InitOpenSSLRSAPrivateKey(key, &pkey); if (retVal != TPM_RC_SUCCESS) return retVal; ctx = EVP_PKEY_CTX_new(pkey, NULL); if (ctx == NULL || EVP_PKEY_decrypt_init(ctx) <= 0) ERROR_RETURN(TPM_RC_FAILURE); switch(scheme->scheme) { case ALG_NULL_VALUE: // 'raw' encryption if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_NO_PADDING) <= 0) ERROR_RETURN(TPM_RC_FAILURE); break; case ALG_RSAES_VALUE: if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) ERROR_RETURN(TPM_RC_FAILURE); break; case ALG_OAEP_VALUE: digestname = GetDigestNameByHashAlg(scheme->details.oaep.hashAlg); if (digestname == NULL) ERROR_RETURN(TPM_RC_VALUE); md = EVP_get_digestbyname(digestname); if (md == NULL || EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0 || EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) <= 0) ERROR_RETURN(TPM_RC_FAILURE); if (label->size > 0) { tmp = malloc(label->size); if (tmp == NULL) ERROR_RETURN(TPM_RC_FAILURE); memcpy(tmp, label->buffer, label->size); } if (EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, tmp, label->size) <= 0) ERROR_RETURN(TPM_RC_FAILURE); tmp = NULL; break; default: ERROR_RETURN(TPM_RC_SCHEME); break; } /* cannot use cOut->buffer */ outlen = sizeof(buffer); if (EVP_PKEY_decrypt(ctx, buffer, &outlen, cIn->buffer, cIn->size) <= 0) ERROR_RETURN(TPM_RC_FAILURE); if (outlen > dOut->size) ERROR_RETURN(TPM_RC_FAILURE); memcpy(dOut->buffer, buffer, outlen); dOut->size = outlen; retVal = TPM_RC_SUCCESS; Exit: EVP_PKEY_free(pkey); EVP_PKEY_CTX_free(ctx); free(tmp); return retVal; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338546, "input": "static void io_fixed_file_set(struct io_fixed_file *file_slot, struct file *file) { unsigned long file_ptr = (unsigned long) file; if (__io_file_supports_async(file, READ)) file_ptr |= FFS_ASYNC_READ; if (__io_file_supports_async(file, WRITE)) file_ptr |= FFS_ASYNC_WRITE; if (S_ISREG(file_inode(file)->i_mode)) file_ptr |= FFS_ISREG; file_slot->file_ptr = file_ptr;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409659, "input": "static BOOL rdp_write_remote_programs_capability_set(wStream* s, const rdpSettings* settings) { size_t header; UINT32 railSupportLevel; if (!Stream_EnsureRemainingCapacity(s, 64)) return FALSE; header = rdp_capability_set_start(s); railSupportLevel = RAIL_LEVEL_SUPPORTED; if (settings->RemoteApplicationSupportLevel & RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED) { if (settings->RemoteAppLanguageBarSupported) railSupportLevel |= RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED; } railSupportLevel |= RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED; railSupportLevel |= RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED; railSupportLevel |= RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED; railSupportLevel |= RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED; railSupportLevel |= RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED; railSupportLevel |= RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED; /* Mask out everything the server does not support. */ railSupportLevel &= settings->RemoteApplicationSupportLevel; Stream_Write_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_RAIL); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330536, "input": "static void vnc_dpy_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { VncDisplay *vd = container_of(dcl, VncDisplay, dcl); struct VncSurface *s = &vd->guest; vnc_set_area_dirty(s->dirty, vd, x, y, w, h); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281485, "input": "static void reset_active(struct i915_request *rq, struct intel_engine_cs *engine) { struct intel_context * const ce = rq->hw_context; u32 head; /* * The executing context has been cancelled. We want to prevent * further execution along this context and propagate the error on * to anything depending on its results. * * In __i915_request_submit(), we apply the -EIO and remove the * requests' payloads for any banned requests. But first, we must * rewind the context back to the start of the incomplete request so * that we do not jump back into the middle of the batch. * * We preserve the breadcrumbs and semaphores of the incomplete * requests so that inter-timeline dependencies (i.e other timelines) * remain correctly ordered. And we defer to __i915_request_submit() * so that all asynchronous waits are correctly handled. */ GEM_TRACE(\"%s(%s): { rq=%llx:%lld }\\n\", __func__, engine->name, rq->fence.context, rq->fence.seqno); /* On resubmission of the active request, payload will be scrubbed */ if (i915_request_completed(rq)) head = rq->tail; else head = active_request(ce->timeline, rq)->head; ce->ring->head = intel_ring_wrap(ce->ring, head); intel_ring_update_space(ce->ring); /* Scrub the context image to prevent replaying the previous batch */ restore_default_state(ce, engine); __execlists_update_reg_state(ce, engine); /* We've switched away, so this should be a no-op, but intent matters */ ce->lrc_desc |= CTX_DESC_FORCE_RESTORE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 353350, "input": "static int input_default_setkeycode(struct input_dev *dev, const struct input_keymap_entry *ke, unsigned int *old_keycode) { unsigned int index; int error; int i; if (!dev->keycodesize) return -EINVAL; if (ke->flags & INPUT_KEYMAP_BY_INDEX) { index = ke->index; } else { error = input_scancode_to_scalar(ke, &index); if (error) return error; } if (index >= dev->keycodemax) return -EINVAL; if (dev->keycodesize < sizeof(ke->keycode) && (ke->keycode >> (dev->keycodesize * 8))) return -EINVAL; switch (dev->keycodesize) { case 1: { u8 *k = (u8 *)dev->keycode; *old_keycode = k[index]; k[index] = ke->keycode; break; } case 2: { u16 *k = (u16 *)dev->keycode; *old_keycode = k[index]; k[index] = ke->keycode; break; } default: { u32 *k = (u32 *)dev->keycode; *old_keycode = k[index]; k[index] = ke->keycode; break; } } if (*old_keycode <= KEY_MAX) { __clear_bit(*old_keycode, dev->keybit); for (i = 0; i < dev->keycodemax; i++) { if (input_fetch_keycode(dev, i) == *old_keycode) { __set_bit(*old_keycode, dev->keybit); /* Setting the bit twice is useless, so break */ break; } } } __set_bit(ke->keycode, dev->keybit); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330407, "input": "static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) { struct sk_buff *skb = NULL; struct net_device *dev; struct virtio_net_hdr *vnet_hdr = NULL; struct sockcm_cookie sockc; __be16 proto; int err, reserve = 0; void *ph; DECLARE_SOCKADDR(struct sockaddr_ll *, saddr, msg->msg_name); bool need_wait = !(msg->msg_flags & MSG_DONTWAIT); unsigned char *addr = NULL; int tp_len, size_max; void *data; int len_sum = 0; int status = TP_STATUS_AVAILABLE; int hlen, tlen, copylen = 0; long timeo = 0; mutex_lock(&po->pg_vec_lock); /* packet_sendmsg() check on tx_ring.pg_vec was lockless, * we need to confirm it under protection of pg_vec_lock. */ if (unlikely(!po->tx_ring.pg_vec)) { err = -EBUSY; goto out; } if (likely(saddr == NULL)) { dev = packet_cached_dev_get(po); proto = po->num; } else { err = -EINVAL; if (msg->msg_namelen < sizeof(struct sockaddr_ll)) goto out; if (msg->msg_namelen < (saddr->sll_halen + offsetof(struct sockaddr_ll, sll_addr))) goto out; proto = saddr->sll_protocol; dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex); if (po->sk.sk_socket->type == SOCK_DGRAM) { if (dev && msg->msg_namelen < dev->addr_len + offsetof(struct sockaddr_ll, sll_addr)) goto out_put; addr = saddr->sll_addr; } } err = -ENXIO; if (unlikely(dev == NULL)) goto out; err = -ENETDOWN; if (unlikely(!(dev->flags & IFF_UP))) goto out_put; sockcm_init(&sockc, &po->sk); if (msg->msg_controllen) { err = sock_cmsg_send(&po->sk, msg, &sockc); if (unlikely(err)) goto out_put; } if (po->sk.sk_socket->type == SOCK_RAW) reserve = dev->hard_header_len; size_max = po->tx_ring.frame_size - (po->tp_hdrlen - sizeof(struct sockaddr_ll)); if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !po->has_vnet_hdr) size_max = dev->mtu + reserve + VLAN_HLEN; reinit_completion(&po->skb_completion); do { ph = packet_current_frame(po, &po->tx_ring, TP_STATUS_SEND_REQUEST); if (unlikely(ph == NULL)) { if (need_wait && skb) { timeo = sock_sndtimeo(&po->sk, msg->msg_flags & MSG_DONTWAIT); timeo = wait_for_completion_interruptible_timeout(&po->skb_completion, timeo); if (timeo <= 0) { err = !timeo ? -ETIMEDOUT : -ERESTARTSYS; goto out_put; } } /* check for additional frames */ continue; } skb = NULL; tp_len = tpacket_parse_header(po, ph, size_max, &data); if (tp_len < 0) goto tpacket_error; status = TP_STATUS_SEND_REQUEST; hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; if (po->has_vnet_hdr) { vnet_hdr = data; data += sizeof(*vnet_hdr); tp_len -= sizeof(*vnet_hdr); if (tp_len < 0 || __packet_snd_vnet_parse(vnet_hdr, tp_len)) { tp_len = -EINVAL; goto tpacket_error; } copylen = __virtio16_to_cpu(vio_le(), vnet_hdr->hdr_len); } copylen = max_t(int, copylen, dev->hard_header_len); skb = sock_alloc_send_skb(&po->sk, hlen + tlen + sizeof(struct sockaddr_ll) + (copylen - dev->hard_header_len), !need_wait, &err); if (unlikely(skb == NULL)) { /* we assume the socket was initially writeable ... */ if (likely(len_sum > 0)) err = len_sum; goto out_status; } tp_len = tpacket_fill_skb(po, skb, ph, dev, data, tp_len, proto, addr, hlen, copylen, &sockc); if (likely(tp_len >= 0) && tp_len > dev->mtu + reserve && !po->has_vnet_hdr && !packet_extra_vlan_len_allowed(dev, skb)) tp_len = -EMSGSIZE; if (unlikely(tp_len < 0)) { tpacket_error: if (po->tp_loss) { __packet_set_status(po, ph, TP_STATUS_AVAILABLE); packet_increment_head(&po->tx_ring); kfree_skb(skb); continue; } else { status = TP_STATUS_WRONG_FORMAT; err = tp_len; goto out_status; } } if (po->has_vnet_hdr) { if (virtio_net_hdr_to_skb(skb, vnet_hdr, vio_le())) { tp_len = -EINVAL; goto tpacket_error; } virtio_net_hdr_set_proto(skb, vnet_hdr); } skb->destructor = tpacket_destruct_skb; __packet_set_status(po, ph, TP_STATUS_SENDING); packet_inc_pending(&po->tx_ring); status = TP_STATUS_SEND_REQUEST; err = po->xmit(skb); if (unlikely(err > 0)) { err = net_xmit_errno(err); if (err && __packet_get_status(po, ph) == TP_STATUS_AVAILABLE) { /* skb was destructed already */ skb = NULL; goto out_status; } /* * skb was dropped but not destructed yet; * let's treat it like congestion or err < 0 */ err = 0; } packet_increment_head(&po->tx_ring); len_sum += tp_len; } while (likely((ph != NULL) || /* Note: packet_read_pending() might be slow if we have * to call it as it's per_cpu variable, but in fast-path * we already short-circuit the loop with the first * condition, and luckily don't have to go that path * anyway. */ (need_wait && packet_read_pending(&po->tx_ring)))); err = len_sum; goto out_put; out_status: __packet_set_status(po, ph, status); kfree_skb(skb); out_put: dev_put(dev); out: mutex_unlock(&po->pg_vec_lock); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267189, "input": "GF_Err gf_isom_remove_sample_description(GF_ISOFile *movie, u32 trackNumber, u32 streamDescIndex) { GF_TrackBox *trak; GF_Err e; GF_Box *entry; e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE); if (e) return e; trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak || !trak->Media || !streamDescIndex) return GF_BAD_PARAM; entry = (GF_Box*)gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, streamDescIndex-1); if (!entry) return GF_BAD_PARAM; gf_list_rem(trak->Media->information->sampleTable->SampleDescription->child_boxes, streamDescIndex-1); gf_isom_box_del(entry); return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409613, "input": "static BOOL rdp_read_sound_capability_set(wStream* s, UINT16 length, rdpSettings* settings) { UINT16 soundFlags; if (length < 8) return FALSE; Stream_Read_UINT16(s, soundFlags); /* soundFlags (2 bytes) */ Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */ settings->SoundBeepsEnabled = (soundFlags & SOUND_BEEPS_FLAG) ? TRUE : FALSE; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431185, "input": "static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs_closeargs *args = data; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); if (args->lr_args) encode_layoutreturn(xdr, args->lr_args, &hdr); if (args->bitmask != NULL) encode_getfattr(xdr, args->bitmask, &hdr); encode_close(xdr, args, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448834, "input": "void RGWListBuckets_ObjStore_SWIFT::send_response_data(RGWUserBuckets& buckets) { if (! sent_data) { return; } /* Take care of the prefix parameter of Swift API. There is no business * in applying the filter earlier as we really need to go through all * entries regardless of it (the headers like X-Account-Container-Count * aren't affected by specifying prefix). */ const std::map& m = buckets.get_buckets(); for (auto iter = m.lower_bound(prefix); iter != m.end() && boost::algorithm::starts_with(iter->first, prefix); ++iter) { dump_bucket_entry(iter->second); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 227281, "input": "SimpleParser(const char* input, int length, TypedValue* buffer, JSONContainerType container_type, bool is_tsimplejson) : p(input) , top(buffer) , array_depth(-kMaxArrayDepth) /* Start negative to simplify check. */ , container_type(container_type) , is_tsimplejson(is_tsimplejson) { assertx(input[length] == 0); // Parser relies on sentinel to avoid checks. }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196791, "input": "void Compute(OpKernelContext* context) override { // Get inputs const Tensor& input_tensor = context->input(0); const auto input_tensor_flat = input_tensor.flat(); const Tensor& input_splits = context->input(1); const auto input_splits_flat = input_splits.flat(); // Since we limit to a 2-D input (flat_values of rank 1 and a single splits // tensor), our output dimension will be 1 with it's size equal to the // number of splits (outer dimension or ragged tensor). TensorShape output_shape({input_splits.dim_size(0) - 1}); Tensor* output_tensor; OP_REQUIRES_OK(context, context->allocate_output(\"output\", output_shape, &output_tensor)); auto output_tensor_flat = output_tensor->flat(); // Use a single index over the flattened input values tensor. int idx = 0; // Loop through our split dimension to create a new string at each split. for (int i = 1; i < input_splits_flat.size(); ++i) { icu::UnicodeString unicode_string; icu::UnicodeStringAppendable appendable_unicode_string(unicode_string); for (; idx < input_splits_flat(i); ++idx) { int32 code_point = input_tensor_flat(idx); // Check for invalid code point if (!U_IS_UNICODE_CHAR(code_point)) { if (error_options_.error_on_malformatting) { context->CtxFailure(errors::InvalidArgument( \"Code point is out of range for Unicode, or a noncharacter.\")); return; } else if (!error_options_.elide_replacement) { code_point = error_options_.subst; } } appendable_unicode_string.appendCodePoint(code_point); } // Encode our string and save in the output. tstring result; Encode(encoding_, unicode_string, &result); output_tensor_flat(i - 1) = std::move(result); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can access data outside of bounds of heap allocated array in `tf.raw_ops.UnicodeEncode`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/472c1f12ad9063405737679d4f6bd43094e1d36d/tensorflow/core/kernels/unicode_ops.cc) assumes that the `input_value`/`input_splits` pair specify a valid sparse tensor. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29559"}} -{"idx": 508520, "input": "uint check_join_cache_usage(JOIN_TAB *tab, ulonglong options, uint no_jbuf_after, uint table_index, JOIN_TAB *prev_tab) { Cost_estimate cost; uint flags= 0; ha_rows rows= 0; uint bufsz= 4096; JOIN_CACHE *prev_cache=0; JOIN *join= tab->join; MEM_ROOT *root= join->thd->mem_root; uint cache_level= tab->used_join_cache_level; bool force_unlinked_cache= !(join->allowed_join_cache_types & JOIN_CACHE_INCREMENTAL_BIT); bool no_hashed_cache= !(join->allowed_join_cache_types & JOIN_CACHE_HASHED_BIT); bool no_bka_cache= !(join->allowed_join_cache_types & JOIN_CACHE_BKA_BIT); join->return_tab= 0; /* Don't use join cache if @@join_cache_level==0 or this table is the first one join suborder (either at top level or inside a bush) */ if (cache_level == 0 || !prev_tab) return 0; if (force_unlinked_cache && (cache_level%2 == 0)) cache_level--; if (options & SELECT_NO_JOIN_CACHE) goto no_join_cache; if (tab->use_quick == 2) goto no_join_cache; if (tab->table->map & join->complex_firstmatch_tables) goto no_join_cache; /* Don't use join cache if we're inside a join tab range covered by LooseScan strategy (TODO: LooseScan is very similar to FirstMatch so theoretically it should be possible to use join buffering in the same way we're using it for multi-table firstmatch ranges). */ if (tab->inside_loosescan_range) goto no_join_cache; if (tab->is_inner_table_of_semijoin() && !join->allowed_semijoin_with_cache) goto no_join_cache; if (tab->is_inner_table_of_outer_join() && !join->allowed_outer_join_with_cache) goto no_join_cache; /* Non-linked join buffers can't guarantee one match */ if (tab->is_nested_inner()) { if (force_unlinked_cache || cache_level == 1) goto no_join_cache; if (cache_level & 1) cache_level--; } /* Don't use BKA for materialized tables. We could actually have a meaningful use of BKA when linked join buffers are used. The problem is, the temp.table is not filled (actually not even opened properly) yet, and this doesn't let us call handler->multi_range_read_info(). It is possible to come up with estimates, etc. without acessing the table, but it seems not to worth the effort now. */ if (tab->table->pos_in_table_list->is_materialized_derived()) { no_bka_cache= true; /* Don't use hash join algorithm if the temporary table for the rows of the derived table will be created with an equi-join key. */ if (tab->table->s->keys) no_hashed_cache= true; } /* Don't use join buffering if we're dictated not to by no_jbuf_after (This is not meaningfully used currently) */ if (table_index > no_jbuf_after) goto no_join_cache; /* TODO: BNL join buffer should be perfectly ok with tab->bush_children. */ if (tab->loosescan_match_tab || tab->bush_children) goto no_join_cache; for (JOIN_TAB *first_inner= tab->first_inner; first_inner; first_inner= first_inner->first_upper) { if (first_inner != tab && (!first_inner->use_join_cache || !(tab-1)->use_join_cache)) goto no_join_cache; } if (tab->first_sj_inner_tab && tab->first_sj_inner_tab != tab && (!tab->first_sj_inner_tab->use_join_cache || !(tab-1)->use_join_cache)) goto no_join_cache; if (!prev_tab->use_join_cache) { /* Check whether table tab and the previous one belong to the same nest of inner tables and if so do not use join buffer when joining table tab. */ if (tab->first_inner && tab != tab->first_inner) { for (JOIN_TAB *first_inner= tab[-1].first_inner; first_inner; first_inner= first_inner->first_upper) { if (first_inner == tab->first_inner) goto no_join_cache; } } else if (tab->first_sj_inner_tab && tab != tab->first_sj_inner_tab && tab->first_sj_inner_tab == tab[-1].first_sj_inner_tab) goto no_join_cache; } prev_cache= prev_tab->cache; switch (tab->type) { case JT_ALL: if (cache_level == 1) prev_cache= 0; if ((tab->cache= new (root) JOIN_CACHE_BNL(join, tab, prev_cache))) { tab->icp_other_tables_ok= FALSE; /* If make_join_select() hasn't called make_scan_filter(), do it now */ if (!tab->cache_select && tab->make_scan_filter()) goto no_join_cache; return (2 - MY_TEST(!prev_cache)); } goto no_join_cache; case JT_SYSTEM: case JT_CONST: case JT_REF: case JT_EQ_REF: if (cache_level <=2 || (no_hashed_cache && no_bka_cache)) goto no_join_cache; if (tab->ref.is_access_triggered()) goto no_join_cache; if (!tab->is_ref_for_hash_join() && !no_bka_cache) { flags= HA_MRR_NO_NULL_ENDPOINTS | HA_MRR_SINGLE_POINT; if (tab->table->covering_keys.is_set(tab->ref.key)) flags|= HA_MRR_INDEX_ONLY; rows= tab->table->file->multi_range_read_info(tab->ref.key, 10, 20, tab->ref.key_parts, &bufsz, &flags, &cost); } if ((cache_level <=4 && !no_hashed_cache) || no_bka_cache || tab->is_ref_for_hash_join() || ((flags & HA_MRR_NO_ASSOCIATION) && cache_level <=6)) { if (!tab->hash_join_is_possible() || tab->make_scan_filter()) goto no_join_cache; if (cache_level == 3) prev_cache= 0; if ((tab->cache= new (root) JOIN_CACHE_BNLH(join, tab, prev_cache))) { tab->icp_other_tables_ok= FALSE; return (4 - MY_TEST(!prev_cache)); } goto no_join_cache; } if (cache_level > 4 && no_bka_cache) goto no_join_cache; if ((flags & HA_MRR_NO_ASSOCIATION) && (cache_level <= 6 || no_hashed_cache)) goto no_join_cache; if ((rows != HA_POS_ERROR) && !(flags & HA_MRR_USE_DEFAULT_IMPL)) { if (cache_level <= 6 || no_hashed_cache) { if (cache_level == 5) prev_cache= 0; if ((tab->cache= new (root) JOIN_CACHE_BKA(join, tab, flags, prev_cache))) return (6 - MY_TEST(!prev_cache)); goto no_join_cache; } else { if (cache_level == 7) prev_cache= 0; if ((tab->cache= new (root) JOIN_CACHE_BKAH(join, tab, flags, prev_cache))) { tab->idx_cond_fact_out= FALSE; return (8 - MY_TEST(!prev_cache)); } goto no_join_cache; } } goto no_join_cache; default : ; } no_join_cache: if (tab->type != JT_ALL && tab->is_ref_for_hash_join()) { tab->type= JT_ALL; tab->ref.key_parts= 0; } revise_cache_usage(tab); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364940, "input": "static int __tipc_nl_node_flush_key(struct sk_buff *skb, struct genl_info *info) { struct net *net = sock_net(skb->sk); struct tipc_net *tn = tipc_net(net); struct tipc_node *n; tipc_crypto_key_flush(tn->crypto_tx); rcu_read_lock(); list_for_each_entry_rcu(n, &tn->node_list, list) tipc_crypto_key_flush(n->crypto_rx); rcu_read_unlock(); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 375201, "input": "int force_sig_info(struct kernel_siginfo *info) { return force_sig_info_to_task(info, current); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446283, "input": "void ScanLineInputFile::initialize(const Header& header) { _data->header = header; _data->lineOrder = _data->header.lineOrder(); const Box2i &dataWindow = _data->header.dataWindow(); _data->minX = dataWindow.min.x; _data->maxX = dataWindow.max.x; _data->minY = dataWindow.min.y; _data->maxY = dataWindow.max.y; Compression comp = _data->header.compression(); _data->linesInBuffer = numLinesInBuffer (comp); int lineOffsetSize = (dataWindow.max.y - dataWindow.min.y + _data->linesInBuffer) / _data->linesInBuffer; // // avoid allocating excessive memory due to large lineOffsets and bytesPerLine table sizes. // If the chunktablesize claims to be large, // check the file is big enough to contain the lineOffsets table before allocating memory // in the bytesPerLineTable and the lineOffsets table. // Attempt to read the last entry in the table. Either the seekg() or the read() // call will throw an exception if the file is too small to contain the table // if (lineOffsetSize * _data->linesInBuffer > gLargeChunkTableSize) { Int64 pos = _streamData->is->tellg(); _streamData->is->seekg(pos + (lineOffsetSize-1)*sizeof(Int64)); Int64 temp; OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read (*_streamData->is, temp); _streamData->is->seekg(pos); } size_t maxBytesPerLine = bytesPerLineTable (_data->header, _data->bytesPerLine); if (maxBytesPerLine*numLinesInBuffer(comp) > INT_MAX) { throw IEX_NAMESPACE::InputExc(\"maximum bytes per scanline exceeds maximum permissible size\"); } // // allocate compressor objects // for (size_t i = 0; i < _data->lineBuffers.size(); i++) { _data->lineBuffers[i] = new LineBuffer (newCompressor(comp, maxBytesPerLine, _data->header)); } _data->lineBufferSize = maxBytesPerLine * _data->linesInBuffer; if (!_streamData->is->isMemoryMapped()) { for (size_t i = 0; i < _data->lineBuffers.size(); i++) { _data->lineBuffers[i]->buffer = (char *) EXRAllocAligned(_data->lineBufferSize*sizeof(char),16); if (!_data->lineBuffers[i]->buffer) { throw IEX_NAMESPACE::LogicExc(\"Failed to allocate memory for scanline buffers\"); } } } _data->nextLineBufferMinY = _data->minY - 1; offsetInLineBufferTable (_data->bytesPerLine, _data->linesInBuffer, _data->offsetInLineBuffer); _data->lineOffsets.resize (lineOffsetSize); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 411963, "input": "parseinit(void) { free(deftarg); deftarg = NULL; ndeftarg = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267895, "input": "GF_Err AddCompositionOffset(GF_CompositionOffsetBox *ctts, s32 offset) { if (!ctts) return GF_BAD_PARAM; if (ctts->nb_entries && (ctts->entries[ctts->nb_entries-1].decodingOffset==offset)) { ctts->entries[ctts->nb_entries-1].sampleCount++; } else { if (ctts->alloc_size==ctts->nb_entries) { ALLOC_INC(ctts->alloc_size); ctts->entries = gf_realloc(ctts->entries, sizeof(GF_DttsEntry)*ctts->alloc_size); if (!ctts->entries) return GF_OUT_OF_MEM; memset(&ctts->entries[ctts->nb_entries], 0, sizeof(GF_DttsEntry)*(ctts->alloc_size-ctts->nb_entries) ); } if (!ctts->entries) return GF_OUT_OF_MEM; ctts->entries[ctts->nb_entries].decodingOffset = offset; ctts->entries[ctts->nb_entries].sampleCount = 1; ctts->nb_entries++; } if (offset<0) ctts->version=1; ctts->w_LastSampleNumber++; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280553, "input": "ofpact_is_allowed_in_actions_set(const struct ofpact *a) { return action_set_classify(a) != ACTION_SLOT_INVALID; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 326045, "input": "int tty_standard_install(struct tty_driver *driver, struct tty_struct *tty) { tty_init_termios(tty); tty_driver_kref_get(driver); tty->count++; driver->ttys[tty->index] = tty; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422590, "input": "TEST(EqOp, MatchesNull) { BSONObj operand = BSON(\"a\" << BSONNULL); EqualityMatchExpression eq(\"a\", operand[\"a\"]); ASSERT(eq.matchesBSON(BSONObj(), NULL)); ASSERT(eq.matchesBSON(BSON(\"a\" << BSONNULL), NULL)); ASSERT(!eq.matchesBSON(BSON(\"a\" << 4), NULL)); // A non-existent field is treated same way as an empty bson object ASSERT(eq.matchesBSON(BSON(\"b\" << 4), NULL)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439514, "input": "bfad_im_hw_version_show(struct device *dev, struct device_attribute *attr, char *buf) { struct Scsi_Host *shost = class_to_shost(dev); struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0]; struct bfad_s *bfad = im_port->bfad; char hw_ver[BFA_VERSION_LEN]; bfa_get_pci_chip_rev(&bfad->bfa, hw_ver); return snprintf(buf, PAGE_SIZE, \"%s\\n\", hw_ver); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 444822, "input": "int mwifiex_associate(struct mwifiex_private *priv, struct mwifiex_bssdescriptor *bss_desc) { /* Return error if the adapter is not STA role or table entry * is not marked as infra. */ if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) || (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) return -1; if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info) && !bss_desc->disable_11n && !bss_desc->disable_11ac && priv->adapter->config_bands & BAND_AAC) mwifiex_set_11ac_ba_params(priv); else mwifiex_set_ba_params(priv); /* Clear any past association response stored for application retrieval */ priv->assoc_rsp_size = 0; return mwifiex_send_cmd(priv, HostCmd_CMD_802_11_ASSOCIATE, HostCmd_ACT_GEN_SET, 0, bss_desc, true); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 308312, "input": "processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl) { const char *textStart, *textEnd; const char *next; enum XML_Error result; OPEN_INTERNAL_ENTITY *openEntity; if (freeInternalEntities) { openEntity = freeInternalEntities; freeInternalEntities = openEntity->next; } else { openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY)); if (!openEntity) return XML_ERROR_NO_MEMORY; } entity->open = XML_TRUE; entity->processed = 0; openEntity->next = openInternalEntities; openInternalEntities = openEntity; openEntity->entity = entity; openEntity->startTagLevel = tagLevel; openEntity->betweenDecl = betweenDecl; openEntity->internalEventPtr = NULL; openEntity->internalEventEndPtr = NULL; textStart = (char *)entity->textPtr; textEnd = (char *)(entity->textPtr + entity->textLen); /* Set a safe default value in case 'next' does not get set */ next = textStart; #ifdef XML_DTD if (entity->is_param) { int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); result = doProlog(parser, internalEncoding, textStart, textEnd, tok, next, &next, XML_FALSE); } else #endif /* XML_DTD */ result = doContent(parser, tagLevel, internalEncoding, textStart, textEnd, &next, XML_FALSE); if (result == XML_ERROR_NONE) { if (textEnd != next && ps_parsing == XML_SUSPENDED) { entity->processed = (int)(next - textStart); processor = internalEntityProcessor; } else { entity->open = XML_FALSE; openInternalEntities = openEntity->next; /* put openEntity back in list of free instances */ openEntity->next = freeInternalEntities; freeInternalEntities = openEntity; } } return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 109031, "input": "ServiceWorkerScriptContext::~ServiceWorkerScriptContext() {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219129, "input": "TypedValue HHVM_FUNCTION(chunk_split, const String& body, int chunklen, const String& end) { return tvReturn(StringUtil::ChunkSplit(body, chunklen, end)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412281, "input": "static int verify_halted(struct usbtest_dev *tdev, int ep, struct urb *urb) { int retval; u16 status; /* should look and act halted */ retval = usb_get_std_status(urb->dev, USB_RECIP_ENDPOINT, ep, &status); if (retval < 0) { ERROR(tdev, \"ep %02x couldn't get halt status, %d\\n\", ep, retval); return retval; } if (status != 1) { ERROR(tdev, \"ep %02x bogus status: %04x != 1\\n\", ep, status); return -EINVAL; } retval = simple_io(tdev, urb, 1, 0, -EPIPE, __func__); if (retval != -EPIPE) return -EINVAL; retval = simple_io(tdev, urb, 1, 0, -EPIPE, \"verify_still_halted\"); if (retval != -EPIPE) return -EINVAL; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281269, "input": "int RGWGetObj_ObjStore_S3::get_decrypt_filter(std::unique_ptr *filter, RGWGetObj_Filter* cb, bufferlist* manifest_bl) { if (skip_decrypt) { // bypass decryption for multisite sync requests return 0; } int res = 0; std::unique_ptr block_crypt; res = rgw_s3_prepare_decrypt(s, attrs, &block_crypt, crypt_http_responses); if (res == 0) { if (block_crypt != nullptr) { auto f = std::make_unique(s->cct, cb, std::move(block_crypt)); if (manifest_bl != nullptr) { res = f->read_manifest(*manifest_bl); if (res == 0) { *filter = std::move(f); } } } } return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 278011, "input": "int ctrl_x_mode_dictionary(void) { return ctrl_x_mode == CTRL_X_DICTIONARY; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378507, "input": "void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ if( pCx==0 ){ return; } assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE ); switch( pCx->eCurType ){ case CURTYPE_SORTER: { sqlite3VdbeSorterClose(p->db, pCx); break; } case CURTYPE_BTREE: { if( pCx->isEphemeral ){ if( pCx->pBtx ) sqlite3BtreeClose(pCx->pBtx); /* The pCx->pCursor will be close automatically, if it exists, by ** the call above. */ }else{ assert( pCx->uc.pCursor!=0 ); sqlite3BtreeCloseCursor(pCx->uc.pCursor); } break; } #ifndef SQLITE_OMIT_VIRTUALTABLE case CURTYPE_VTAB: { sqlite3_vtab_cursor *pVCur = pCx->uc.pVCur; const sqlite3_module *pModule = pVCur->pVtab->pModule; assert( pVCur->pVtab->nRef>0 ); pVCur->pVtab->nRef--; pModule->xClose(pVCur); break; } #endif } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357442, "input": "static void opj_j2k_read_int32_to_float(const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem) { OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data; OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data; OPJ_UINT32 i; OPJ_UINT32 l_temp; for (i = 0; i < p_nb_elem; ++i) { opj_read_bytes(l_src_data, &l_temp, 4); l_src_data += sizeof(OPJ_INT32); *(l_dest_data++) = (OPJ_FLOAT32) l_temp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398131, "input": "static int sctp_msghdr_parse(const struct msghdr *msg, struct sctp_cmsgs *cmsgs) { struct msghdr *my_msg = (struct msghdr *)msg; struct cmsghdr *cmsg; for_each_cmsghdr(cmsg, my_msg) { if (!CMSG_OK(my_msg, cmsg)) return -EINVAL; /* Should we parse this header or ignore? */ if (cmsg->cmsg_level != IPPROTO_SCTP) continue; /* Strictly check lengths following example in SCM code. */ switch (cmsg->cmsg_type) { case SCTP_INIT: /* SCTP Socket API Extension * 5.3.1 SCTP Initiation Structure (SCTP_INIT) * * This cmsghdr structure provides information for * initializing new SCTP associations with sendmsg(). * The SCTP_INITMSG socket option uses this same data * structure. This structure is not used for * recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_initmsg))) return -EINVAL; cmsgs->init = CMSG_DATA(cmsg); break; case SCTP_SNDRCV: /* SCTP Socket API Extension * 5.3.2 SCTP Header Information Structure(SCTP_SNDRCV) * * This cmsghdr structure specifies SCTP options for * sendmsg() and describes SCTP header information * about a received message through recvmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ ---------------------- * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_sndrcvinfo))) return -EINVAL; cmsgs->srinfo = CMSG_DATA(cmsg); if (cmsgs->srinfo->sinfo_flags & ~(SCTP_UNORDERED | SCTP_ADDR_OVER | SCTP_SACK_IMMEDIATELY | SCTP_SENDALL | SCTP_PR_SCTP_MASK | SCTP_ABORT | SCTP_EOF)) return -EINVAL; break; case SCTP_SNDINFO: /* SCTP Socket API Extension * 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) * * This cmsghdr structure specifies SCTP options for * sendmsg(). This structure and SCTP_RCVINFO replaces * SCTP_SNDRCV which has been deprecated. * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ --------------------- * IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_sndinfo))) return -EINVAL; cmsgs->sinfo = CMSG_DATA(cmsg); if (cmsgs->sinfo->snd_flags & ~(SCTP_UNORDERED | SCTP_ADDR_OVER | SCTP_SACK_IMMEDIATELY | SCTP_SENDALL | SCTP_PR_SCTP_MASK | SCTP_ABORT | SCTP_EOF)) return -EINVAL; break; case SCTP_PRINFO: /* SCTP Socket API Extension * 5.3.7 SCTP PR-SCTP Information Structure (SCTP_PRINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ --------------------- * IPPROTO_SCTP SCTP_PRINFO struct sctp_prinfo */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_prinfo))) return -EINVAL; cmsgs->prinfo = CMSG_DATA(cmsg); if (cmsgs->prinfo->pr_policy & ~SCTP_PR_SCTP_MASK) return -EINVAL; if (cmsgs->prinfo->pr_policy == SCTP_PR_SCTP_NONE) cmsgs->prinfo->pr_value = 0; break; case SCTP_AUTHINFO: /* SCTP Socket API Extension * 5.3.8 SCTP AUTH Information Structure (SCTP_AUTHINFO) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ --------------------- * IPPROTO_SCTP SCTP_AUTHINFO struct sctp_authinfo */ if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_authinfo))) return -EINVAL; cmsgs->authinfo = CMSG_DATA(cmsg); break; case SCTP_DSTADDRV4: case SCTP_DSTADDRV6: /* SCTP Socket API Extension * 5.3.9/10 SCTP Destination IPv4/6 Address Structure (SCTP_DSTADDRV4/6) * * This cmsghdr structure specifies SCTP options for sendmsg(). * * cmsg_level cmsg_type cmsg_data[] * ------------ ------------ --------------------- * IPPROTO_SCTP SCTP_DSTADDRV4 struct in_addr * ------------ ------------ --------------------- * IPPROTO_SCTP SCTP_DSTADDRV6 struct in6_addr */ cmsgs->addrs_msg = my_msg; break; default: return -EINVAL; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508650, "input": "best_access_path(JOIN *join, JOIN_TAB *s, table_map remaining_tables, const POSITION *join_positions, uint idx, bool disable_jbuf, double record_count, POSITION *pos, POSITION *loose_scan_pos) { THD *thd= join->thd; uint use_cond_selectivity= thd->variables.optimizer_use_condition_selectivity; KEYUSE *best_key= 0; uint best_max_key_part= 0; my_bool found_constraint= 0; double best= DBL_MAX; double best_time= DBL_MAX; double records= DBL_MAX; table_map best_ref_depends_map= 0; double tmp; ha_rows rec; bool best_uses_jbuf= FALSE; MY_BITMAP *eq_join_set= &s->table->eq_join_set; KEYUSE *hj_start_key= 0; SplM_plan_info *spl_plan= 0; disable_jbuf= disable_jbuf || idx == join->const_tables; Loose_scan_opt loose_scan_opt; DBUG_ENTER(\"best_access_path\"); bitmap_clear_all(eq_join_set); loose_scan_opt.init(join, s, remaining_tables); if (s->table->is_splittable()) spl_plan= s->choose_best_splitting(record_count, remaining_tables); if (s->keyuse) { /* Use key if possible */ KEYUSE *keyuse; KEYUSE *start_key=0; TABLE *table= s->table; double best_records= DBL_MAX; uint max_key_part=0; /* Test how we can use keys */ rec= s->records/MATCHING_ROWS_IN_OTHER_TABLE; // Assumed records/key for (keyuse=s->keyuse ; keyuse->table == table ;) { KEY *keyinfo; ulong key_flags; uint key_parts; key_part_map found_part= 0; key_part_map notnull_part=0; // key parts which won't have NULL in lookup tuple. table_map found_ref= 0; uint key= keyuse->key; bool ft_key= (keyuse->keypart == FT_KEYPART); /* Bitmap of keyparts where the ref access is over 'keypart=const': */ key_part_map const_part= 0; /* The or-null keypart in ref-or-null access: */ key_part_map ref_or_null_part= 0; if (is_hash_join_key_no(key)) { /* Hash join as any join employing join buffer can be used to join only those tables that are joined after the first non const table */ if (!(remaining_tables & keyuse->used_tables) && idx > join->const_tables) { if (!hj_start_key) hj_start_key= keyuse; bitmap_set_bit(eq_join_set, keyuse->keypart); } keyuse++; continue; } keyinfo= table->key_info+key; key_parts= table->actual_n_key_parts(keyinfo); key_flags= table->actual_key_flags(keyinfo); /* Calculate how many key segments of the current key we can use */ start_key= keyuse; loose_scan_opt.next_ref_key(); DBUG_PRINT(\"info\", (\"Considering ref access on key %s\", keyuse->table->key_info[keyuse->key].name.str)); do /* For each keypart */ { uint keypart= keyuse->keypart; table_map best_part_found_ref= 0; double best_prev_record_reads= DBL_MAX; do /* For each way to access the keypart */ { /* if 1. expression doesn't refer to forward tables 2. we won't get two ref-or-null's */ if (!(remaining_tables & keyuse->used_tables) && (!keyuse->validity_ref || *keyuse->validity_ref) && s->access_from_tables_is_allowed(keyuse->used_tables, join->sjm_lookup_tables) && !(ref_or_null_part && (keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL))) { found_part|= keyuse->keypart_map; if (!(keyuse->used_tables & ~join->const_table_map)) const_part|= keyuse->keypart_map; if (!keyuse->val->maybe_null || keyuse->null_rejecting) notnull_part|=keyuse->keypart_map; double tmp2= prev_record_reads(join_positions, idx, (found_ref | keyuse->used_tables)); if (tmp2 < best_prev_record_reads) { best_part_found_ref= keyuse->used_tables & ~join->const_table_map; best_prev_record_reads= tmp2; } if (rec > keyuse->ref_table_rows) rec= keyuse->ref_table_rows; /* If there is one 'key_column IS NULL' expression, we can use this ref_or_null optimisation of this field */ if (keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL) ref_or_null_part |= keyuse->keypart_map; } loose_scan_opt.add_keyuse(remaining_tables, keyuse); keyuse++; } while (keyuse->table == table && keyuse->key == key && keyuse->keypart == keypart); found_ref|= best_part_found_ref; } while (keyuse->table == table && keyuse->key == key); /* Assume that that each key matches a proportional part of table. */ if (!found_part && !ft_key && !loose_scan_opt.have_a_case()) continue; // Nothing usable found if (rec < MATCHING_ROWS_IN_OTHER_TABLE) rec= MATCHING_ROWS_IN_OTHER_TABLE; // Fix for small tables /* ft-keys require special treatment */ if (ft_key) { /* Really, there should be records=0.0 (yes!) but 1.0 would be probably safer */ tmp= prev_record_reads(join_positions, idx, found_ref); records= 1.0; } else { found_constraint= MY_TEST(found_part); loose_scan_opt.check_ref_access_part1(s, key, start_key, found_part); /* Check if we found full key */ const key_part_map all_key_parts= PREV_BITS(uint, key_parts); if (found_part == all_key_parts && !ref_or_null_part) { /* use eq key */ max_key_part= (uint) ~0; /* If the index is a unique index (1), and - all its columns are not null (2), or - equalities we are using reject NULLs (3) then the estimate is rows=1. */ if ((key_flags & (HA_NOSAME | HA_EXT_NOSAME)) && // (1) (!(key_flags & HA_NULL_PART_KEY) || // (2) all_key_parts == notnull_part)) // (3) { tmp = prev_record_reads(join_positions, idx, found_ref); records=1.0; } else { if (!found_ref) { /* We found a const key */ /* ReuseRangeEstimateForRef-1: We get here if we've found a ref(const) (c_i are constants): \"(keypart1=c1) AND ... AND (keypartN=cN)\" [ref_const_cond] If range optimizer was able to construct a \"range\" access on this index, then its condition \"quick_cond\" was eqivalent to ref_const_cond (*), and we can re-use E(#rows) from the range optimizer. Proof of (*): By properties of range and ref optimizers quick_cond will be equal or tighther than ref_const_cond. ref_const_cond already covers \"smallest\" possible interval - a singlepoint interval over all keyparts. Therefore, quick_cond is equivalent to ref_const_cond (if it was an empty interval we wouldn't have got here). */ if (table->quick_keys.is_set(key)) records= (double) table->quick_rows[key]; else { /* quick_range couldn't use key! */ records= (double) s->records/rec; } } else { if (!(records= keyinfo->actual_rec_per_key(key_parts-1))) { /* Prefer longer keys */ records= ((double) s->records / (double) rec * (1.0 + ((double) (table->s->max_key_length-keyinfo->key_length) / (double) table->s->max_key_length))); if (records < 2.0) records=2.0; /* Can't be as good as a unique */ } /* ReuseRangeEstimateForRef-2: We get here if we could not reuse E(#rows) from range optimizer. Make another try: If range optimizer produced E(#rows) for a prefix of the ref access we're considering, and that E(#rows) is lower then our current estimate, make an adjustment. The criteria of when we can make an adjustment is a special case of the criteria used in ReuseRangeEstimateForRef-3. */ if (table->quick_keys.is_set(key) && (const_part & (((key_part_map)1 << table->quick_key_parts[key])-1)) == (((key_part_map)1 << table->quick_key_parts[key])-1) && table->quick_n_ranges[key] == 1 && records > (double) table->quick_rows[key]) { records= (double) table->quick_rows[key]; } } /* Limit the number of matched rows */ tmp= records; set_if_smaller(tmp, (double) thd->variables.max_seeks_for_key); if (table->covering_keys.is_set(key)) tmp= table->file->keyread_time(key, 1, (ha_rows) tmp); else tmp= table->file->read_time(key, 1, (ha_rows) MY_MIN(tmp,s->worst_seeks)); tmp= COST_MULT(tmp, record_count); } } else { /* Use as much key-parts as possible and a uniq key is better than a not unique key Set tmp to (previous record count) * (records / combination) */ if ((found_part & 1) && (!(table->file->index_flags(key, 0, 0) & HA_ONLY_WHOLE_INDEX) || found_part == PREV_BITS(uint,keyinfo->user_defined_key_parts))) { max_key_part= max_part_bit(found_part); /* ReuseRangeEstimateForRef-3: We're now considering a ref[or_null] access via (t.keypart1=e1 AND ... AND t.keypartK=eK) [ OR (same-as-above but with one cond replaced with \"t.keypart_i IS NULL\")] (**) Try re-using E(#rows) from \"range\" optimizer: We can do so if \"range\" optimizer used the same intervals as in (**). The intervals used by range optimizer may be not available at this point (as \"range\" access might have choosen to create quick select over another index), so we can't compare them to (**). We'll make indirect judgements instead. The sufficient conditions for re-use are: (C1) All e_i in (**) are constants, i.e. found_ref==FALSE. (if this is not satisfied we have no way to know which ranges will be actually scanned by 'ref' until we execute the join) (C2) max #key parts in 'range' access == K == max_key_part (this is apparently a necessary requirement) We also have a property that \"range optimizer produces equal or tighter set of scan intervals than ref(const) optimizer\". Each of the intervals in (**) are \"tightest possible\" intervals when one limits itself to using keyparts 1..K (which we do in #2). From here it follows that range access used either one, or both of the (I1) and (I2) intervals: (t.keypart1=c1 AND ... AND t.keypartK=eK) (I1) (same-as-above but with one cond replaced with \"t.keypart_i IS NULL\") (I2) The remaining part is to exclude the situation where range optimizer used one interval while we're considering ref-or-null and looking for estimate for two intervals. This is done by last limitation: (C3) \"range optimizer used (have ref_or_null?2:1) intervals\" */ if (table->quick_keys.is_set(key) && !found_ref && //(C1) table->quick_key_parts[key] == max_key_part && //(C2) table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part)) //(C3) { tmp= records= (double) table->quick_rows[key]; } else { /* Check if we have statistic about the distribution */ if ((records= keyinfo->actual_rec_per_key(max_key_part-1))) { /* Fix for the case where the index statistics is too optimistic: If (1) We're considering ref(const) and there is quick select on the same index, (2) and that quick select uses more keyparts (i.e. it will scan equal/smaller interval then this ref(const)) (3) and E(#rows) for quick select is higher then our estimate, Then We'll use E(#rows) from quick select. Q: Why do we choose to use 'ref'? Won't quick select be cheaper in some cases ? TODO: figure this out and adjust the plan choice if needed. */ if (!found_ref && table->quick_keys.is_set(key) && // (1) table->quick_key_parts[key] > max_key_part && // (2) records < (double)table->quick_rows[key]) // (3) records= (double)table->quick_rows[key]; tmp= records; } else { /* Assume that the first key part matches 1% of the file and that the whole key matches 10 (duplicates) or 1 (unique) records. Assume also that more key matches proportionally more records This gives the formula: records = (x * (b-a) + a*c-b)/(c-1) b = records matched by whole key a = records matched by first key part (1% of all records?) c = number of key parts in key x = used key parts (1 <= x <= c) */ double rec_per_key; if (!(rec_per_key=(double) keyinfo->rec_per_key[keyinfo->user_defined_key_parts-1])) rec_per_key=(double) s->records/rec+1; if (!s->records) tmp = 0; else if (rec_per_key/(double) s->records >= 0.01) tmp = rec_per_key; else { double a=s->records*0.01; if (keyinfo->user_defined_key_parts > 1) tmp= (max_key_part * (rec_per_key - a) + a*keyinfo->user_defined_key_parts - rec_per_key)/ (keyinfo->user_defined_key_parts-1); else tmp= a; set_if_bigger(tmp,1.0); } records = (ulong) tmp; } if (ref_or_null_part) { /* We need to do two key searches to find key */ tmp *= 2.0; records *= 2.0; } /* ReuseRangeEstimateForRef-4: We get here if we could not reuse E(#rows) from range optimizer. Make another try: If range optimizer produced E(#rows) for a prefix of the ref access we're considering, and that E(#rows) is lower then our current estimate, make the adjustment. The decision whether we can re-use the estimate from the range optimizer is the same as in ReuseRangeEstimateForRef-3, applied to first table->quick_key_parts[key] key parts. */ if (table->quick_keys.is_set(key) && table->quick_key_parts[key] <= max_key_part && const_part & ((key_part_map)1 << table->quick_key_parts[key]) && table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part & const_part) && records > (double) table->quick_rows[key]) { tmp= records= (double) table->quick_rows[key]; } } /* Limit the number of matched rows */ set_if_smaller(tmp, (double) thd->variables.max_seeks_for_key); if (table->covering_keys.is_set(key)) tmp= table->file->keyread_time(key, 1, (ha_rows) tmp); else tmp= table->file->read_time(key, 1, (ha_rows) MY_MIN(tmp,s->worst_seeks)); tmp= COST_MULT(tmp, record_count); } else tmp= best_time; // Do nothing } tmp= COST_ADD(tmp, s->startup_cost); loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp, found_ref); } /* not ft_key */ if (tmp + 0.0001 < best_time - records/(double) TIME_FOR_COMPARE) { best_time= COST_ADD(tmp, records/(double) TIME_FOR_COMPARE); best= tmp; best_records= records; best_key= start_key; best_max_key_part= max_key_part; best_ref_depends_map= found_ref; } } /* for each key */ records= best_records; } /* If there is no key to access the table, but there is an equi-join predicate connecting the table with the privious tables then we consider the possibility of using hash join. We need also to check that: (1) s is inner table of semi-join -> join cache is allowed for semijoins (2) s is inner table of outer join -> join cache is allowed for outer joins */ if (idx > join->const_tables && best_key == 0 && (join->allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) && join->max_allowed_join_cache_level > 2 && !bitmap_is_clear_all(eq_join_set) && !disable_jbuf && (!s->emb_sj_nest || join->allowed_semijoin_with_cache) && // (1) (!(s->table->map & join->outer_join) || join->allowed_outer_join_with_cache)) // (2) { double join_sel= 0.1; /* Estimate the cost of the hash join access to the table */ double rnd_records= matching_candidates_in_table(s, found_constraint, use_cond_selectivity); tmp= s->quick ? s->quick->read_time : s->scan_time(); double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_ADD(tmp, cmp_time); /* We read the table as many times as join buffer becomes full. */ double refills= (1.0 + floor((double) cache_record_length(join,idx) * record_count / (double) thd->variables.join_buff_size)); tmp= COST_MULT(tmp, refills); best_time= COST_ADD(tmp, COST_MULT((record_count*join_sel) / TIME_FOR_COMPARE, rnd_records)); best= tmp; records= rnd_records; best_key= hj_start_key; best_ref_depends_map= 0; best_uses_jbuf= TRUE; } /* Don't test table scan if it can't be better. Prefer key lookup if we would use the same key for scanning. Don't do a table scan on InnoDB tables, if we can read the used parts of the row from any of the used index. This is because table scans uses index and we would not win anything by using a table scan. A word for word translation of the below if-statement in sergefp's understanding: we check if we should use table scan if: (1) The found 'ref' access produces more records than a table scan (or index scan, or quick select), or 'ref' is more expensive than any of them. (2) This doesn't hold: the best way to perform table scan is to to perform 'range' access using index IDX, and the best way to perform 'ref' access is to use the same index IDX, with the same or more key parts. (note: it is not clear how this rule is/should be extended to index_merge quick selects). Also if we have a hash join we prefer that over a table scan (3) See above note about InnoDB. (4) NOT (\"FORCE INDEX(...)\" is used for table and there is 'ref' access path, but there is no quick select) If the condition in the above brackets holds, then the only possible \"table scan\" access method is ALL/index (there is no quick select). Since we have a 'ref' access path, and FORCE INDEX instructs us to choose it over ALL/index, there is no need to consider a full table scan. (5) Non-flattenable semi-joins: don't consider doing a scan of temporary table if we had an option to make lookups into it. In real-world cases, lookups are cheaper than full scans, but when the table is small, they can be [considered to be] more expensive, which causes lookups not to be used for cases with small datasets, which is annoying. */ if ((records >= s->found_records || best > s->read_time) && // (1) !(best_key && best_key->key == MAX_KEY) && // (2) !(s->quick && best_key && s->quick->index == best_key->key && // (2) best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&// (2) !((s->table->file->ha_table_flags() & HA_TABLE_SCAN_ON_INDEX) && // (3) ! s->table->covering_keys.is_clear_all() && best_key && !s->quick) &&// (3) !(s->table->force_index && best_key && !s->quick) && // (4) !(best_key && s->table->pos_in_table_list->jtbm_subselect)) // (5) { // Check full join double rnd_records= matching_candidates_in_table(s, found_constraint, use_cond_selectivity); /* Range optimizer never proposes a RANGE if it isn't better than FULL: so if RANGE is present, it's always preferred to FULL. Here we estimate its cost. */ if (s->quick) { /* For each record we: - read record range through 'quick' - skip rows which does not satisfy WHERE constraints TODO: We take into account possible use of join cache for ALL/index access (see first else-branch below), but we don't take it into account here for range/index_merge access. Find out why this is so. */ double cmp_time= (s->found_records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_MULT(record_count, COST_ADD(s->quick->read_time, cmp_time)); loose_scan_opt.check_range_access(join, idx, s->quick); } else { /* Estimate cost of reading table. */ if (s->table->force_index && !best_key) // index scan tmp= s->table->file->read_time(s->ref.key, 1, s->records); else // table scan tmp= s->scan_time(); if ((s->table->map & join->outer_join) || disable_jbuf) // Can't use join cache { /* For each record we have to: - read the whole table record - skip rows which does not satisfy join condition */ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_MULT(record_count, COST_ADD(tmp,cmp_time)); } else { double refills= (1.0 + floor((double) cache_record_length(join,idx) * (record_count / (double) thd->variables.join_buff_size))); tmp= COST_MULT(tmp, refills); /* We don't make full cartesian product between rows in the scanned table and existing records because we skip all rows from the scanned table, which does not satisfy join condition when we read the table (see flush_cached_records for details). Here we take into account cost to read and skip these records. */ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_ADD(tmp, cmp_time); } } /* Splitting technique cannot be used with join cache */ if (s->table->is_splittable()) tmp+= s->table->get_materialization_cost(); else tmp+= s->startup_cost; /* We estimate the cost of evaluating WHERE clause for found records as record_count * rnd_records / TIME_FOR_COMPARE. This cost plus tmp give us total cost of using TABLE SCAN */ if (best == DBL_MAX || COST_ADD(tmp, record_count/(double) TIME_FOR_COMPARE*rnd_records) < (best_key->is_for_hash_join() ? best_time : COST_ADD(best, record_count/(double) TIME_FOR_COMPARE*records))) { /* If the table has a range (s->quick is set) make_join_select() will ensure that this will be used */ best= tmp; records= rnd_records; best_key= 0; /* range/index_merge/ALL/index access method are \"independent\", so: */ best_ref_depends_map= 0; best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map & join->outer_join))); spl_plan= 0; } } /* Update the cost information for the current partial plan */ pos->records_read= records; pos->read_time= best; pos->key= best_key; pos->table= s; pos->ref_depend_map= best_ref_depends_map; pos->loosescan_picker.loosescan_key= MAX_KEY; pos->use_join_buffer= best_uses_jbuf; pos->spl_plan= spl_plan; loose_scan_opt.save_to_position(s, loose_scan_pos); if (!best_key && idx == join->const_tables && s->table == join->sort_by_table && join->unit->select_limit_cnt >= records) join->sort_by_table= (TABLE*) 1; // Must use temporary table DBUG_VOID_RETURN; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230220, "input": "CallResult> JSObject::getOwnPropertyKeys( Handle selfHandle, Runtime *runtime, OwnKeysFlags okFlags) { assert( (okFlags.getIncludeNonSymbols() || okFlags.getIncludeSymbols()) && \"Can't exclude symbols and strings\"); if (LLVM_UNLIKELY( selfHandle->flags_.lazyObject || selfHandle->flags_.proxyObject)) { if (selfHandle->flags_.proxyObject) { CallResult> proxyRes = JSProxy::ownPropertyKeys(selfHandle, runtime, okFlags); if (LLVM_UNLIKELY(proxyRes == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } return runtime->makeHandle(std::move(*proxyRes)); } assert(selfHandle->flags_.lazyObject && \"descriptor flags are impossible\"); initializeLazyObject(runtime, selfHandle); } auto range = getOwnIndexedRange(selfHandle.get(), runtime); // Estimate the capacity of the output array. This estimate is only // reasonable for the non-symbol case. uint32_t capacity = okFlags.getIncludeNonSymbols() ? (selfHandle->clazz_.get(runtime)->getNumProperties() + range.second - range.first) : 0; auto arrayRes = JSArray::create(runtime, capacity, 0); if (LLVM_UNLIKELY(arrayRes == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } auto array = runtime->makeHandle(std::move(*arrayRes)); // Optional array of SymbolIDs reported via host object API llvh::Optional> hostObjectSymbols; size_t hostObjectSymbolCount = 0; // If current object is a host object we need to deduplicate its properties llvh::SmallSet dedupSet; // Output index. uint32_t index = 0; // Avoid allocating a new handle per element. MutableHandle<> tmpHandle{runtime}; // Number of indexed properties. uint32_t numIndexed = 0; // Regular properties with names that are array indexes are stashed here, if // encountered. llvh::SmallVector indexNames{}; // Iterate the named properties excluding those which use Symbols. if (okFlags.getIncludeNonSymbols()) { // Get host object property names if (LLVM_UNLIKELY(selfHandle->flags_.hostObject)) { assert( range.first == range.second && \"Host objects cannot own indexed range\"); auto hostSymbolsRes = vmcast(selfHandle.get())->getHostPropertyNames(); if (hostSymbolsRes == ExecutionStatus::EXCEPTION) { return ExecutionStatus::EXCEPTION; } if ((hostObjectSymbolCount = (**hostSymbolsRes)->getEndIndex()) != 0) { Handle hostSymbols = *hostSymbolsRes; hostObjectSymbols = std::move(hostSymbols); capacity += hostObjectSymbolCount; } } // Iterate the indexed properties. GCScopeMarkerRAII marker{runtime}; for (auto i = range.first; i != range.second; ++i) { auto res = getOwnIndexedPropertyFlags(selfHandle.get(), runtime, i); if (!res) continue; // If specified, check whether it is enumerable. if (!okFlags.getIncludeNonEnumerable() && !res->enumerable) continue; tmpHandle = HermesValue::encodeDoubleValue(i); JSArray::setElementAt(array, runtime, index++, tmpHandle); marker.flush(); } numIndexed = index; HiddenClass::forEachProperty( runtime->makeHandle(selfHandle->clazz_), runtime, [runtime, okFlags, array, hostObjectSymbolCount, &index, &indexNames, &tmpHandle, &dedupSet](SymbolID id, NamedPropertyDescriptor desc) { if (!isPropertyNamePrimitive(id)) { return; } // If specified, check whether it is enumerable. if (!okFlags.getIncludeNonEnumerable()) { if (!desc.flags.enumerable) return; } // Host properties might overlap with the ones recognized by the // hidden class. If we're dealing with a host object then keep track // of hidden class properties for the deduplication purposes. if (LLVM_UNLIKELY(hostObjectSymbolCount > 0)) { dedupSet.insert(id.unsafeGetRaw()); } // Check if this property is an integer index. If it is, we stash it // away to deal with it later. This check should be fast since most // property names don't start with a digit. auto propNameAsIndex = toArrayIndex( runtime->getIdentifierTable().getStringView(runtime, id)); if (LLVM_UNLIKELY(propNameAsIndex)) { indexNames.push_back(*propNameAsIndex); return; } tmpHandle = HermesValue::encodeStringValue( runtime->getStringPrimFromSymbolID(id)); JSArray::setElementAt(array, runtime, index++, tmpHandle); }); // Iterate over HostObject properties and append them to the array. Do not // append duplicates. if (LLVM_UNLIKELY(hostObjectSymbols)) { for (size_t i = 0; i < hostObjectSymbolCount; ++i) { assert( (*hostObjectSymbols)->at(runtime, i).isSymbol() && \"Host object needs to return array of SymbolIDs\"); marker.flush(); SymbolID id = (*hostObjectSymbols)->at(runtime, i).getSymbol(); if (dedupSet.count(id.unsafeGetRaw()) == 0) { dedupSet.insert(id.unsafeGetRaw()); assert( !InternalProperty::isInternal(id) && \"host object returned reserved symbol\"); auto propNameAsIndex = toArrayIndex( runtime->getIdentifierTable().getStringView(runtime, id)); if (LLVM_UNLIKELY(propNameAsIndex)) { indexNames.push_back(*propNameAsIndex); continue; } tmpHandle = HermesValue::encodeStringValue( runtime->getStringPrimFromSymbolID(id)); JSArray::setElementAt(array, runtime, index++, tmpHandle); } } } } // Now iterate the named properties again, including only Symbols. // We could iterate only once, if we chose to ignore (and disallow) // own properties on HostObjects, as we do with Proxies. if (okFlags.getIncludeSymbols()) { MutableHandle idHandle{runtime}; HiddenClass::forEachProperty( runtime->makeHandle(selfHandle->clazz_), runtime, [runtime, okFlags, array, &index, &idHandle]( SymbolID id, NamedPropertyDescriptor desc) { if (!isSymbolPrimitive(id)) { return; } // If specified, check whether it is enumerable. if (!okFlags.getIncludeNonEnumerable()) { if (!desc.flags.enumerable) return; } idHandle = id; JSArray::setElementAt(array, runtime, index++, idHandle); }); } // The end (exclusive) of the named properties. uint32_t endNamed = index; // Properly set the length of the array. auto cr = JSArray::setLength( array, runtime, endNamed + indexNames.size(), PropOpFlags{}); (void)cr; assert( cr != ExecutionStatus::EXCEPTION && *cr && \"JSArray::setLength() failed\"); // If we have no index-like names, we are done. if (LLVM_LIKELY(indexNames.empty())) return array; // In the unlikely event that we encountered index-like names, we need to sort // them and merge them with the real indexed properties. Note that it is // guaranteed that there are no clashes. std::sort(indexNames.begin(), indexNames.end()); // Also make space for the new elements by shifting all the named properties // to the right. First, resize the array. JSArray::setStorageEndIndex(array, runtime, endNamed + indexNames.size()); // Shift the non-index property names. The region [numIndexed..endNamed) is // moved to [numIndexed+indexNames.size()..array->size()). // TODO: optimize this by implementing memcpy-like functionality in ArrayImpl. for (uint32_t last = endNamed, toLast = array->getEndIndex(); last != numIndexed;) { --last; --toLast; tmpHandle = array->at(runtime, last); JSArray::setElementAt(array, runtime, toLast, tmpHandle); } // Now we need to merge the indexes in indexNames and the array // [0..numIndexed). We start from the end and copy the larger element from // either array. // 1+ the destination position to copy into. for (uint32_t toLast = numIndexed + indexNames.size(), indexNamesLast = indexNames.size(); toLast != 0;) { if (numIndexed) { uint32_t a = (uint32_t)array->at(runtime, numIndexed - 1).getNumber(); uint32_t b; if (indexNamesLast && (b = indexNames[indexNamesLast - 1]) > a) { tmpHandle = HermesValue::encodeDoubleValue(b); --indexNamesLast; } else { tmpHandle = HermesValue::encodeDoubleValue(a); --numIndexed; } } else { assert(indexNamesLast && \"prematurely ran out of source values\"); tmpHandle = HermesValue::encodeDoubleValue(indexNames[indexNamesLast - 1]); --indexNamesLast; } --toLast; JSArray::setElementAt(array, runtime, toLast, tmpHandle); } return array; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 89033, "input": "void WebGraphicsContext3DDefaultImpl::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) { makeContextCurrent(); bool needsResolve = (m_attributes.antialias && m_boundFBO == m_multisampleFBO); if (needsResolve) { resolveMultisampledFramebuffer(x, y, width, height); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); } glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); if (needsResolve) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430736, "input": "UnicodeString::setTo(UChar *buffer, int32_t buffLength, int32_t buffCapacity) { if(fUnion.fFields.fLengthAndFlags & kOpenGetBuffer) { // do not modify a string that has an \"open\" getBuffer(minCapacity) return *this; } if(buffer == NULL) { // treat as an empty string, do not alias releaseArray(); setToEmpty(); return *this; } if(buffLength < -1 || buffCapacity < 0 || buffLength > buffCapacity) { setToBogus(); return *this; } else if(buffLength == -1) { // buffLength = u_strlen(buff); but do not look beyond buffCapacity const UChar *p = buffer, *limit = buffer + buffCapacity; while(p != limit && *p != 0) { ++p; } buffLength = (int32_t)(p - buffer); } releaseArray(); fUnion.fFields.fLengthAndFlags = kWritableAlias; setArray(buffer, buffLength, buffCapacity); return *this; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 452381, "input": "static void PushRunlengthPacket(Image *image,const unsigned char *pixels, size_t *length,PixelInfo *pixel,ExceptionInfo *exception) { const unsigned char *p; p=pixels; if (image->storage_class == PseudoClass) { pixel->index=0; switch (image->depth) { case 32: { pixel->index=ConstrainColormapIndex(image,((size_t) *p << 24) | ((size_t) *(p+1) << 16) | ((size_t) *(p+2) << 8) | (size_t) *(p+3), exception); p+=4; break; } case 16: { pixel->index=ConstrainColormapIndex(image,(*p << 8) | *(p+1), exception); p+=2; break; } case 8: { pixel->index=ConstrainColormapIndex(image,*p,exception); p++; break; } default: (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageError,\"ImageDepthNotSupported\",\"`%s'\",image->filename); } switch (image->depth) { case 8: { unsigned char quantum; if (image->alpha_trait != UndefinedPixelTrait) { p=PushCharPixel(p,&quantum); pixel->alpha=ScaleCharToQuantum(quantum); } break; } case 16: { unsigned short quantum; if (image->alpha_trait != UndefinedPixelTrait) { p=PushShortPixel(MSBEndian,p,&quantum); pixel->alpha=(Quantum) (quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } break; } case 32: { unsigned int quantum; if (image->alpha_trait != UndefinedPixelTrait) { p=PushLongPixel(MSBEndian,p,&quantum); pixel->alpha=(Quantum) (quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } break; } default: (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageError,\"ImageDepthNotSupported\",\"`%s'\",image->filename); } *length=(size_t) (*p++)+1; return; } switch (image->depth) { case 8: { unsigned char quantum; p=PushCharPixel(p,&quantum); pixel->red=ScaleCharToQuantum(quantum); pixel->green=pixel->red; pixel->blue=pixel->red; if (IsGrayColorspace(image->colorspace) == MagickFalse) { p=PushCharPixel(p,&quantum); pixel->green=ScaleCharToQuantum(quantum); p=PushCharPixel(p,&quantum); pixel->blue=ScaleCharToQuantum(quantum); } if (image->colorspace == CMYKColorspace) { p=PushCharPixel(p,&quantum); pixel->black=ScaleCharToQuantum(quantum); } if (image->alpha_trait != UndefinedPixelTrait) { p=PushCharPixel(p,&quantum); pixel->alpha=ScaleCharToQuantum(quantum); } break; } case 16: { unsigned short quantum; p=PushShortPixel(MSBEndian,p,&quantum); pixel->red=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); pixel->green=pixel->red; pixel->blue=pixel->red; if (IsGrayColorspace(image->colorspace) == MagickFalse) { p=PushShortPixel(MSBEndian,p,&quantum); pixel->green=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); p=PushShortPixel(MSBEndian,p,&quantum); pixel->blue=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); } if (image->colorspace == CMYKColorspace) { p=PushShortPixel(MSBEndian,p,&quantum); pixel->black=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); } if (image->alpha_trait != UndefinedPixelTrait) { p=PushShortPixel(MSBEndian,p,&quantum); pixel->alpha=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); } break; } case 32: { unsigned int quantum; p=PushLongPixel(MSBEndian,p,&quantum); pixel->red=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); pixel->green=pixel->red; pixel->blue=pixel->red; if (IsGrayColorspace(image->colorspace) == MagickFalse) { p=PushLongPixel(MSBEndian,p,&quantum); pixel->green=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); p=PushLongPixel(MSBEndian,p,&quantum); pixel->blue=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); } if (image->colorspace == CMYKColorspace) { p=PushLongPixel(MSBEndian,p,&quantum); pixel->black=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); } if (image->alpha_trait != UndefinedPixelTrait) { p=PushLongPixel(MSBEndian,p,&quantum); pixel->alpha=quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH); } break; } default: (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, \"ImageDepthNotSupported\",\"`%s'\",image->filename); } *length=(size_t) (*p++)+1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506584, "input": "style_from_fill(struct fill_style_type *fs) { int fillpar, style; switch( fs->fillstyle ) { case FS_SOLID: case FS_TRANSPARENT_SOLID: fillpar = fs->filldensity; style = ((fillpar & 0xfff) << 4) + fs->fillstyle; break; case FS_PATTERN: case FS_TRANSPARENT_PATTERN: fillpar = fs->fillpattern; style = ((fillpar & 0xfff) << 4) + fs->fillstyle; break; case FS_EMPTY: default: /* solid fill with background color */ style = FS_EMPTY; break; } return style; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197417, "input": "void CleanWriters(GF_List *writers) { while (gf_list_count(writers)) { TrackWriter *writer = (TrackWriter*)gf_list_get(writers, 0); gf_isom_box_del(writer->stco); gf_isom_box_del((GF_Box *)writer->stsc); gf_free(writer); gf_list_rem(writers, 0); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "An issue was discovered in GPAC version 0.8.0 and 1.0.1. There is a use-after-free in the function gf_isom_box_del() in isomedia/box_funcs.c.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2020-35980"}} -{"idx": 482978, "input": "static void swizzle_to_dml_params( enum swizzle_mode_values swizzle, unsigned int *sw_mode) { switch (swizzle) { case DC_SW_LINEAR: *sw_mode = dm_sw_linear; break; case DC_SW_4KB_S: *sw_mode = dm_sw_4kb_s; break; case DC_SW_4KB_S_X: *sw_mode = dm_sw_4kb_s_x; break; case DC_SW_4KB_D: *sw_mode = dm_sw_4kb_d; break; case DC_SW_4KB_D_X: *sw_mode = dm_sw_4kb_d_x; break; case DC_SW_64KB_S: *sw_mode = dm_sw_64kb_s; break; case DC_SW_64KB_S_X: *sw_mode = dm_sw_64kb_s_x; break; case DC_SW_64KB_S_T: *sw_mode = dm_sw_64kb_s_t; break; case DC_SW_64KB_D: *sw_mode = dm_sw_64kb_d; break; case DC_SW_64KB_D_X: *sw_mode = dm_sw_64kb_d_x; break; case DC_SW_64KB_D_T: *sw_mode = dm_sw_64kb_d_t; break; case DC_SW_64KB_R_X: *sw_mode = dm_sw_64kb_r_x; break; case DC_SW_VAR_S: *sw_mode = dm_sw_var_s; break; case DC_SW_VAR_S_X: *sw_mode = dm_sw_var_s_x; break; case DC_SW_VAR_D: *sw_mode = dm_sw_var_d; break; case DC_SW_VAR_D_X: *sw_mode = dm_sw_var_d_x; break; default: ASSERT(0); /* Not supported */ break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202665, "input": "int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, bool nonblock) { int error; int full_check = 0; struct fd f, tf; struct eventpoll *ep; struct epitem *epi; struct eventpoll *tep = NULL; error = -EBADF; f = fdget(epfd); if (!f.file) goto error_return; /* Get the \"struct file *\" for the target file */ tf = fdget(fd); if (!tf.file) goto error_fput; /* The target file descriptor must support poll */ error = -EPERM; if (!file_can_poll(tf.file)) goto error_tgt_fput; /* Check if EPOLLWAKEUP is allowed */ if (ep_op_has_event(op)) ep_take_care_of_epollwakeup(epds); /* * We have to check that the file structure underneath the file descriptor * the user passed to us _is_ an eventpoll file. And also we do not permit * adding an epoll file descriptor inside itself. */ error = -EINVAL; if (f.file == tf.file || !is_file_epoll(f.file)) goto error_tgt_fput; /* * epoll adds to the wakeup queue at EPOLL_CTL_ADD time only, * so EPOLLEXCLUSIVE is not allowed for a EPOLL_CTL_MOD operation. * Also, we do not currently supported nested exclusive wakeups. */ if (ep_op_has_event(op) && (epds->events & EPOLLEXCLUSIVE)) { if (op == EPOLL_CTL_MOD) goto error_tgt_fput; if (op == EPOLL_CTL_ADD && (is_file_epoll(tf.file) || (epds->events & ~EPOLLEXCLUSIVE_OK_BITS))) goto error_tgt_fput; } /* * At this point it is safe to assume that the \"private_data\" contains * our own data structure. */ ep = f.file->private_data; /* * When we insert an epoll file descriptor, inside another epoll file * descriptor, there is the change of creating closed loops, which are * better be handled here, than in more critical paths. While we are * checking for loops we also determine the list of files reachable * and hang them on the tfile_check_list, so we can check that we * haven't created too many possible wakeup paths. * * We do not need to take the global 'epumutex' on EPOLL_CTL_ADD when * the epoll file descriptor is attaching directly to a wakeup source, * unless the epoll file descriptor is nested. The purpose of taking the * 'epmutex' on add is to prevent complex toplogies such as loops and * deep wakeup paths from forming in parallel through multiple * EPOLL_CTL_ADD operations. */ error = epoll_mutex_lock(&ep->mtx, 0, nonblock); if (error) goto error_tgt_fput; if (op == EPOLL_CTL_ADD) { if (!list_empty(&f.file->f_ep_links) || is_file_epoll(tf.file)) { mutex_unlock(&ep->mtx); error = epoll_mutex_lock(&epmutex, 0, nonblock); if (error) goto error_tgt_fput; full_check = 1; if (is_file_epoll(tf.file)) { error = -ELOOP; if (ep_loop_check(ep, tf.file) != 0) { clear_tfile_check_list(); goto error_tgt_fput; } } else { get_file(tf.file); list_add(&tf.file->f_tfile_llink, &tfile_check_list); } error = epoll_mutex_lock(&ep->mtx, 0, nonblock); if (error) { out_del: list_del(&tf.file->f_tfile_llink); if (!is_file_epoll(tf.file)) fput(tf.file); goto error_tgt_fput; } if (is_file_epoll(tf.file)) { tep = tf.file->private_data; error = epoll_mutex_lock(&tep->mtx, 1, nonblock); if (error) { mutex_unlock(&ep->mtx); goto out_del; } } } } /* * Try to lookup the file inside our RB tree, Since we grabbed \"mtx\" * above, we can be sure to be able to use the item looked up by * ep_find() till we release the mutex. */ epi = ep_find(ep, tf.file, fd); error = -EINVAL; switch (op) { case EPOLL_CTL_ADD: if (!epi) { epds->events |= EPOLLERR | EPOLLHUP; error = ep_insert(ep, epds, tf.file, fd, full_check); } else error = -EEXIST; if (full_check) clear_tfile_check_list(); break; case EPOLL_CTL_DEL: if (epi) error = ep_remove(ep, epi); else error = -ENOENT; break; case EPOLL_CTL_MOD: if (epi) { if (!(epi->event.events & EPOLLEXCLUSIVE)) { epds->events |= EPOLLERR | EPOLLHUP; error = ep_modify(ep, epi, epds); } } else error = -ENOENT; break; } if (tep != NULL) mutex_unlock(&tep->mtx); mutex_unlock(&ep->mtx); error_tgt_fput: if (full_check) mutex_unlock(&epmutex); fdput(tf); error_fput: fdput(f); error_return: return error; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "In do_epoll_ctl and ep_loop_check_proc of eventpoll.c, there is a possible use after free due to a logic error. This could lead to local escalation of privilege with no additional execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android kernelAndroid ID: A-147802478References: Upstream kernel", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2020-0466"}} -{"idx": 272986, "input": "SWFInput_readSBits(SWFInput input, int number) { int num = SWFInput_readBits(input, number); if(number && num & (1<<(number-1))) return num - (1<used_tables(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333145, "input": "repodata_lookup_packed_dirstrarray(Repodata *data, Id solvid, Id keyname) { static unsigned char wrongtype[2] = { 0x00 /* dir id 0 */, 0 /* \"\" */ }; unsigned char *dp; Id schema, *keyp, *kp; Repokey *key; if (!data->incoredata || !data->incoreoffset[solvid - data->start]) return 0; dp = data->incoredata + data->incoreoffset[solvid - data->start]; dp = data_read_id(dp, &schema); keyp = data->schemadata + data->schemata[schema]; for (kp = keyp; *kp; kp++) if (data->keys[*kp].name == keyname) break; if (!*kp) return 0; key = data->keys + *kp; if (key->type != REPOKEY_TYPE_DIRSTRARRAY) return wrongtype; dp = forward_to_key(data, *kp, keyp, dp); if (key->storage == KEY_STORAGE_INCORE) return dp; if (key->storage == KEY_STORAGE_VERTICAL_OFFSET && dp) { Id off, len; dp = data_read_id(dp, &off); data_read_id(dp, &len); return get_vertical_data(data, key, off, len); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519662, "input": "XMLTree::~XMLTree() { delete _root; if (_doc) { xmlFreeDoc (_doc); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376254, "input": "static char *host_end(char **hoststart, int removebrackets) { char *host = *hoststart; char *end; char *start = strstr(host, \"@[\"); if (start) start++; /* Jump over '@' */ else start = host; if (start[0] == '[') { end = strchr(start + 1, ']'); if (end) { if (removebrackets) { *end = 0; memmove(start, start + 1, end - start); end++; } } else end = host; } else end = host; return end; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 434155, "input": "BOOL autodetect_send_bandwidth_measure_payload(rdpContext* context, UINT16 payloadLength, UINT16 sequenceNumber) { wStream* s; UCHAR* buffer = NULL; BOOL bResult = FALSE; s = rdp_message_channel_pdu_init(context->rdp); if (!s) return FALSE; WLog_VRB(AUTODETECT_TAG, \"sending Bandwidth Measure Payload PDU -> payloadLength=%\" PRIu16 \"\", payloadLength); /* 4-bytes aligned */ payloadLength &= ~3; if (!Stream_EnsureRemainingCapacity(s, 8 + payloadLength)) { Stream_Release(s); return FALSE; } Stream_Write_UINT8(s, 0x08); /* headerLength (1 byte) */ Stream_Write_UINT8(s, TYPE_ID_AUTODETECT_REQUEST); /* headerTypeId (1 byte) */ Stream_Write_UINT16(s, sequenceNumber); /* sequenceNumber (2 bytes) */ Stream_Write_UINT16(s, RDP_BW_PAYLOAD_REQUEST_TYPE); /* requestType (2 bytes) */ Stream_Write_UINT16(s, payloadLength); /* payloadLength (2 bytes) */ /* Random data (better measurement in case the line is compressed) */ buffer = (UCHAR*)malloc(payloadLength); if (NULL == buffer) { Stream_Release(s); return FALSE; } winpr_RAND(buffer, payloadLength); Stream_Write(s, buffer, payloadLength); bResult = rdp_send_message_channel_pdu(context->rdp, s, SEC_AUTODETECT_REQ); free(buffer); return bResult; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430983, "input": "static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs4_sequence_args *args = data; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, args, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506569, "input": "system_command() { char *cmd; ++c_token; cmd = try_to_get_string(); do_system(cmd); free(cmd); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378528, "input": "int sqlite3VdbeIdxKeyCompare( sqlite3 *db, /* Database connection */ VdbeCursor *pC, /* The cursor to compare against */ UnpackedRecord *pUnpacked, /* Unpacked version of key */ int *res /* Write the comparison result here */ ){ i64 nCellKey = 0; int rc; BtCursor *pCur; Mem m; assert( pC->eCurType==CURTYPE_BTREE ); pCur = pC->uc.pCursor; assert( sqlite3BtreeCursorIsValid(pCur) ); nCellKey = sqlite3BtreePayloadSize(pCur); /* nCellKey will always be between 0 and 0xffffffff because of the way ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ if( nCellKey<=0 || nCellKey>0x7fffffff ){ *res = 0; return SQLITE_CORRUPT_BKPT; } sqlite3VdbeMemInit(&m, db, 0); rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, &m); if( rc ){ return rc; } *res = sqlite3VdbeRecordCompareWithSkip(m.n, m.z, pUnpacked, 0); sqlite3VdbeMemRelease(&m); return SQLITE_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379619, "input": "cpl_prune () { struct cpelement *cp; while (coproc_list.head && coproc_list.ncoproc > COPROC_MAX) { cp = coproc_list.head; coproc_list.head = coproc_list.head->next; coproc_dispose (cp->coproc); cpe_dispose (cp); coproc_list.ncoproc--; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206554, "input": "static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode) { php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); const char *p1; size_t str_left; unsigned int scan_stat = 0; const char *csname = NULL; size_t csname_len; const char *encoded_text = NULL; size_t encoded_text_len = 0; const char *encoded_word = NULL; const char *spaces = NULL; php_iconv_enc_scheme_t enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; if (next_pos != NULL) { *next_pos = NULL; } cd_pl = iconv_open(enc, ICONV_ASCII_ENCODING); if (cd_pl == (iconv_t)(-1)) { #if ICONV_SUPPORTS_ERRNO if (errno == EINVAL) { err = PHP_ICONV_ERR_WRONG_CHARSET; } else { err = PHP_ICONV_ERR_CONVERTER; } #else err = PHP_ICONV_ERR_UNKNOWN; #endif goto out; } p1 = str; for (str_left = str_nbytes; str_left > 0; str_left--, p1++) { int eos = 0; switch (scan_stat) { case 0: /* expecting any character */ switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ encoded_word = p1; scan_stat = 1; break; case ' ': case '\\t': /* a chunk of whitespaces */ spaces = p1; scan_stat = 11; break; default: /* first letter of a non-encoded word */ err = _php_iconv_appendc(pretval, *p1, cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { if (mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR) { err = PHP_ICONV_ERR_SUCCESS; } else { goto out; } } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } break; } break; case 1: /* expecting a delimiter */ if (*p1 != '?') { if (*p1 == '\\r' || *p1 == '\\n') { --p1; } err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } csname = p1 + 1; scan_stat = 2; break; case 2: /* expecting a charset name */ switch (*p1) { case '?': /* normal delimiter: encoding scheme follows */ scan_stat = 3; break; case '*': /* new style delimiter: locale id follows */ scan_stat = 10; break; case '\\r': case '\\n': /* not an encoded-word */ --p1; _php_iconv_appendc(pretval, '=', cd_pl); _php_iconv_appendc(pretval, '?', cd_pl); err = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } csname = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } continue; } if (scan_stat != 2) { char tmpbuf[80]; if (csname == NULL) { err = PHP_ICONV_ERR_MALFORMED; goto out; } csname_len = (size_t)(p1 - csname); if (csname_len > sizeof(tmpbuf) - 1) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } memcpy(tmpbuf, csname, csname_len); tmpbuf[csname_len] = '\\0'; if (cd != (iconv_t)(-1)) { iconv_close(cd); } cd = iconv_open(enc, tmpbuf); if (cd == (iconv_t)(-1)) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* Bad character set, but the user wants us to * press on. In this case, we'll just insert the * undecoded encoded word, since there isn't really * a more sensible behaviour available; the only * other options are to swallow the encoded word * entirely or decode it with an arbitrarily chosen * single byte encoding, both of which seem to have * a higher WTF factor than leaving it undecoded. * * Given this approach, we need to skip ahead to * the end of the encoded word. */ int qmarks = 2; while (qmarks > 0 && str_left > 1) { if (*(++p1) == '?') { --qmarks; } --str_left; } /* Look ahead to check for the terminating = that * should be there as well; if it's there, we'll * also include that. If it's not, there isn't much * we can do at this point. */ if (*(p1 + 1) == '=') { ++p1; --str_left; } err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } /* Let's go back and see if there are further * encoded words or bare content, and hope they * might actually have a valid character set. */ scan_stat = 12; break; } else { #if ICONV_SUPPORTS_ERRNO if (errno == EINVAL) { err = PHP_ICONV_ERR_WRONG_CHARSET; } else { err = PHP_ICONV_ERR_CONVERTER; } #else err = PHP_ICONV_ERR_UNKNOWN; #endif goto out; } } } break; case 3: /* expecting a encoding scheme specifier */ switch (*p1) { case 'b': case 'B': enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; scan_stat = 4; break; case 'q': case 'Q': enc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT; scan_stat = 4; break; default: if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } break; case 4: /* expecting a delimiter */ if (*p1 != '?') { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } encoded_text = p1 + 1; scan_stat = 5; break; case 5: /* expecting an encoded portion */ if (*p1 == '?') { encoded_text_len = (size_t)(p1 - encoded_text); scan_stat = 6; } break; case 7: /* expecting a \"\\n\" character */ if (*p1 == '\\n') { scan_stat = 8; } else { /* bare CR */ _php_iconv_appendc(pretval, '\\r', cd_pl); _php_iconv_appendc(pretval, *p1, cd_pl); scan_stat = 0; } break; case 8: /* checking whether the following line is part of a folded header */ if (*p1 != ' ' && *p1 != '\\t') { --p1; str_left = 1; /* quit_loop */ break; } if (encoded_word == NULL) { _php_iconv_appendc(pretval, ' ', cd_pl); } spaces = NULL; scan_stat = 11; break; case 6: /* expecting a End-Of-Chunk character \"=\" */ if (*p1 != '=') { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } scan_stat = 9; if (str_left == 1) { eos = 1; } else { break; } case 9: /* choice point, seeing what to do next.*/ switch (*p1) { default: /* Handle non-RFC-compliant formats * * RFC2047 requires the character that comes right * after an encoded word (chunk) to be a whitespace, * while there are lots of broken implementations that * generate such malformed headers that don't fulfill * that requirement. */ if (!eos) { if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } scan_stat = 12; break; } } /* break is omitted intentionally */ case '\\r': case '\\n': case ' ': case '\\t': { zend_string *decoded_text; switch (enc_scheme) { case PHP_ICONV_ENC_SCHEME_BASE64: decoded_text = php_base64_decode((unsigned char*)encoded_text, encoded_text_len); break; case PHP_ICONV_ENC_SCHEME_QPRINT: decoded_text = php_quot_print_decode((unsigned char*)encoded_text, encoded_text_len, 1); break; default: decoded_text = NULL; break; } if (decoded_text == NULL) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_UNKNOWN; goto out; } } err = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd); zend_string_release(decoded_text); if (err != PHP_ICONV_ERR_SUCCESS) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)(p1 - encoded_word), cd_pl); encoded_word = NULL; if (err != PHP_ICONV_ERR_SUCCESS) { break; } } else { goto out; } } if (eos) { /* reached end-of-string. done. */ scan_stat = 0; break; } switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ scan_stat = 1; break; case ' ': case '\\t': /* medial whitespaces */ spaces = p1; scan_stat = 11; break; default: /* first letter of a non-encoded word */ _php_iconv_appendc(pretval, *p1, cd_pl); scan_stat = 12; break; } } break; } break; case 10: /* expects a language specifier. dismiss it for now */ if (*p1 == '?') { scan_stat = 3; } break; case 11: /* expecting a chunk of whitespaces */ switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ if (spaces != NULL && encoded_word == NULL) { _php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl); spaces = NULL; } encoded_word = p1; scan_stat = 1; break; case ' ': case '\\t': break; default: /* first letter of a non-encoded word */ if (spaces != NULL) { _php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl); spaces = NULL; } _php_iconv_appendc(pretval, *p1, cd_pl); encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } break; case 12: /* expecting a non-encoded word */ switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case ' ': case '\\t': spaces = p1; scan_stat = 11; break; case '=': /* first letter of an encoded chunk */ if (!(mode & PHP_ICONV_MIME_DECODE_STRICT)) { encoded_word = p1; scan_stat = 1; break; } /* break is omitted intentionally */ default: _php_iconv_appendc(pretval, *p1, cd_pl); break; } break; } } switch (scan_stat) { case 0: case 8: case 11: case 12: break; default: if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { if (scan_stat == 1) { _php_iconv_appendc(pretval, '=', cd_pl); } err = PHP_ICONV_ERR_SUCCESS; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } if (next_pos != NULL) { *next_pos = p1; } smart_str_0(pretval); out: if (cd != (iconv_t)(-1)) { iconv_close(cd); } if (cd_pl != (iconv_t)(-1)) { iconv_close(cd_pl); } return err; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "Function iconv_mime_decode_headers() in PHP versions 7.1.x below 7.1.30, 7.2.x below 7.2.19 and 7.3.x below 7.3.6 may perform out-of-buffer read due to integer overflow when parsing MIME headers. This may lead to information disclosure or crash.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2019-11039"}} -{"idx": 272267, "input": "route_quota_exceeded(const struct multi_instance *mi) { struct gc_arena gc = gc_new(); msg(D_ROUTE_QUOTA, \"MULTI ROUTE: route quota (%d) exceeded for %s (see --max-routes-per-client option)\", mi->context.options.max_routes_per_client, multi_instance_string(mi, false, &gc)); gc_free(&gc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269750, "input": "v8::Local WebContents::GetOwnerBrowserWindow() const { if (owner_window()) return BrowserWindow::From(isolate(), owner_window()); else return v8::Null(isolate()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357304, "input": "static OPJ_BOOL opj_j2k_write_SPCod_SPCoc(opj_j2k_t *p_j2k, OPJ_UINT32 p_tile_no, OPJ_UINT32 p_comp_no, OPJ_BYTE * p_data, OPJ_UINT32 * p_header_size, struct opj_event_mgr * p_manager) { OPJ_UINT32 i; opj_cp_t *l_cp = 00; opj_tcp_t *l_tcp = 00; opj_tccp_t *l_tccp = 00; /* preconditions */ assert(p_j2k != 00); assert(p_header_size != 00); assert(p_manager != 00); assert(p_data != 00); l_cp = &(p_j2k->m_cp); l_tcp = &l_cp->tcps[p_tile_no]; l_tccp = &l_tcp->tccps[p_comp_no]; /* preconditions again */ assert(p_tile_no < (l_cp->tw * l_cp->th)); assert(p_comp_no < (p_j2k->m_private_image->numcomps)); if (*p_header_size < 5) { opj_event_msg(p_manager, EVT_ERROR, \"Error writing SPCod SPCoc element\\n\"); return OPJ_FALSE; } opj_write_bytes(p_data, l_tccp->numresolutions - 1, 1); /* SPcoc (D) */ ++p_data; opj_write_bytes(p_data, l_tccp->cblkw - 2, 1); /* SPcoc (E) */ ++p_data; opj_write_bytes(p_data, l_tccp->cblkh - 2, 1); /* SPcoc (F) */ ++p_data; opj_write_bytes(p_data, l_tccp->cblksty, 1); /* SPcoc (G) */ ++p_data; opj_write_bytes(p_data, l_tccp->qmfbid, 1); /* SPcoc (H) */ ++p_data; *p_header_size = *p_header_size - 5; if (l_tccp->csty & J2K_CCP_CSTY_PRT) { if (*p_header_size < l_tccp->numresolutions) { opj_event_msg(p_manager, EVT_ERROR, \"Error writing SPCod SPCoc element\\n\"); return OPJ_FALSE; } for (i = 0; i < l_tccp->numresolutions; ++i) { opj_write_bytes(p_data, l_tccp->prcw[i] + (l_tccp->prch[i] << 4), 1); /* SPcoc (I_i) */ ++p_data; } *p_header_size = *p_header_size - l_tccp->numresolutions; } return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330543, "input": "static int vnc_height(VncDisplay *vd) { return MIN(VNC_MAX_HEIGHT, surface_height(vd->ds)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244751, "input": "static int rar5_options(struct archive_read *a, const char *key, const char *val) { (void) a; (void) key; (void) val; /* No options supported in this version. Return the ARCHIVE_WARN code * to signal the options supervisor that the unpacker didn't handle * setting this option. */ return ARCHIVE_WARN; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 250474, "input": "static MagickBooleanType ReadPSDChannelRLE(Image *image,const PSDInfo *psd_info, const ssize_t type,MagickOffsetType *sizes,ExceptionInfo *exception) { MagickBooleanType status; size_t length, row_size; ssize_t count, y; unsigned char *compact_pixels, *pixels; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer data is RLE compressed\"); row_size=GetPSDRowSize(image); pixels=(unsigned char *) AcquireQuantumMemory(row_size,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\", image->filename); length=0; for (y=0; y < (ssize_t) image->rows; y++) if ((MagickOffsetType) length < sizes[y]) length=(size_t) sizes[y]; if (length > row_size + 256) // arbitrary number { pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowBinaryException(ResourceLimitError,\"InvalidLength\", image->filename); } compact_pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels)); if (compact_pixels == (unsigned char *) NULL) { pixels=(unsigned char *) RelinquishMagickMemory(pixels); ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\", image->filename); } (void) ResetMagickMemory(compact_pixels,0,length*sizeof(*compact_pixels)); status=MagickTrue; for (y=0; y < (ssize_t) image->rows; y++) { status=MagickFalse; count=ReadBlob(image,(size_t) sizes[y],compact_pixels); if (count != (ssize_t) sizes[y]) break; count=DecodePSDPixels((size_t) sizes[y],compact_pixels, (ssize_t) (image->depth == 1 ? 123456 : image->depth),row_size,pixels); if (count != (ssize_t) row_size) break; status=ReadPSDChannelPixels(image,psd_info->channels,y,type,pixels, exception); if (status == MagickFalse) break; } compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels); pixels=(unsigned char *) RelinquishMagickMemory(pixels); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281434, "input": "static inline void write_desc(struct intel_engine_execlists *execlists, u64 desc, u32 port) { if (execlists->ctrl_reg) { writel(lower_32_bits(desc), execlists->submit_reg + port * 2); writel(upper_32_bits(desc), execlists->submit_reg + port * 2 + 1); } else { writel(upper_32_bits(desc), execlists->submit_reg); writel(lower_32_bits(desc), execlists->submit_reg); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303076, "input": "static uint8_t filters_to_flags(const uint8_t* filters) { uint8_t flags = 0; for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) { switch (filters[i]) { case BLOSC_SHUFFLE: flags |= BLOSC_DOSHUFFLE; break; case BLOSC_BITSHUFFLE: flags |= BLOSC_DOBITSHUFFLE; break; case BLOSC_DELTA: flags |= BLOSC_DODELTA; break; default : break; } } return flags; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430989, "input": "static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir, const struct qstr *name, struct nfs_fattr *fattr, struct nfs_fh *fhandle) { int status = -ENOMEM; struct page *page = NULL; struct nfs4_fs_locations *locations = NULL; page = alloc_page(GFP_KERNEL); if (page == NULL) goto out; locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL); if (locations == NULL) goto out; status = nfs4_proc_fs_locations(client, dir, name, locations, page); if (status != 0) goto out; /* * If the fsid didn't change, this is a migration event, not a * referral. Cause us to drop into the exception handler, which * will kick off migration recovery. */ if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { dprintk(\"%s: server did not return a different fsid for\" \" a referral at %s\\n\", __func__, name->name); status = -NFS4ERR_MOVED; goto out; } /* Fixup attributes for the nfs_lookup() call to nfs_fhget() */ nfs_fixup_referral_attributes(&locations->fattr); /* replace the lookup nfs_fattr with the locations nfs_fattr */ memcpy(fattr, &locations->fattr, sizeof(struct nfs_fattr)); memset(fhandle, 0, sizeof(struct nfs_fh)); out: if (page) __free_page(page); kfree(locations); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357043, "input": "static size_t longest_common_prefix(char *dest, const char *src, size_t start, size_t dlen) { size_t pos = start; while ((pos < dlen) && dest[pos] && (dest[pos] == src[pos])) pos++; dest[pos] = '\\0'; return pos; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333143, "input": "repodata_empty(Repodata *data, int localpool) { void (*loadcallback)(Repodata *) = data->loadcallback; int state = data->state; repodata_freedata(data); repodata_initdata(data, data->repo, localpool); data->state = state; data->loadcallback = loadcallback; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378582, "input": "static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ int nMaxArgs = *pMaxFuncArgs; Op *pOp; Parse *pParse = p->pParse; int *aLabel = pParse->aLabel; p->readOnly = 1; p->bIsReader = 0; pOp = &p->aOp[p->nOp-1]; while(1){ /* Only JUMP opcodes and the short list of special opcodes in the switch ** below need to be considered. The mkopcodeh.tcl generator script groups ** all these opcodes together near the front of the opcode list. Skip ** any opcode that does not need processing by virtual of the fact that ** it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization. */ if( pOp->opcode<=SQLITE_MX_JUMP_OPCODE ){ /* NOTE: Be sure to update mkopcodeh.tcl when adding or removing ** cases from this switch! */ switch( pOp->opcode ){ case OP_Transaction: { if( pOp->p2!=0 ) p->readOnly = 0; /* fall thru */ } case OP_AutoCommit: case OP_Savepoint: { p->bIsReader = 1; break; } #ifndef SQLITE_OMIT_WAL case OP_Checkpoint: #endif case OP_Vacuum: case OP_JournalMode: { p->readOnly = 0; p->bIsReader = 1; break; } case OP_Next: case OP_SorterNext: { pOp->p4.xAdvance = sqlite3BtreeNext; pOp->p4type = P4_ADVANCE; /* The code generator never codes any of these opcodes as a jump ** to a label. They are always coded as a jump backwards to a ** known address */ assert( pOp->p2>=0 ); break; } case OP_Prev: { pOp->p4.xAdvance = sqlite3BtreePrevious; pOp->p4type = P4_ADVANCE; /* The code generator never codes any of these opcodes as a jump ** to a label. They are always coded as a jump backwards to a ** known address */ assert( pOp->p2>=0 ); break; } #ifndef SQLITE_OMIT_VIRTUALTABLE case OP_VUpdate: { if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2; break; } case OP_VFilter: { int n; assert( (pOp - p->aOp) >= 3 ); assert( pOp[-1].opcode==OP_Integer ); n = pOp[-1].p1; if( n>nMaxArgs ) nMaxArgs = n; /* Fall through into the default case */ } #endif default: { if( pOp->p2<0 ){ /* The mkopcodeh.tcl script has so arranged things that the only ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to ** have non-negative values for P2. */ assert( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ); assert( ADDR(pOp->p2)<-pParse->nLabel ); pOp->p2 = aLabel[ADDR(pOp->p2)]; } break; } } /* The mkopcodeh.tcl script has so arranged things that the only ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to ** have non-negative values for P2. */ assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0); } if( pOp==p->aOp ) break; pOp--; } sqlite3DbFree(p->db, pParse->aLabel); pParse->aLabel = 0; pParse->nLabel = 0; *pMaxFuncArgs = nMaxArgs; assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270127, "input": "int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size) { AVCodecContext *avctx = h->avctx; int ret; if (!buf || size <= 0) return -1; if (buf[0] == 1) { int i, cnt, nalsize; const unsigned char *p = buf; h->is_avc = 1; if (size < 7) { av_log(avctx, AV_LOG_ERROR, \"avcC too short\\n\"); return AVERROR_INVALIDDATA; } /* sps and pps in the avcC always have length coded with 2 bytes, * so put a fake nal_length_size = 2 while parsing them */ h->nal_length_size = 2; // Decode sps from avcC cnt = *(p + 5) & 0x1f; // Number of sps p += 6; for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return AVERROR_INVALIDDATA; ret = decode_nal_units(h, p, nalsize, 1); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, \"Decoding sps %d from avcC failed\\n\", i); return ret; } p += nalsize; } // Decode pps from avcC cnt = *(p++); // Number of pps for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(nalsize > size - (p-buf)) return AVERROR_INVALIDDATA; ret = decode_nal_units(h, p, nalsize, 1); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, \"Decoding pps %d from avcC failed\\n\", i); return ret; } p += nalsize; } // Now store right nal length size, that will be used to parse all other nals h->nal_length_size = (buf[4] & 0x03) + 1; } else { h->is_avc = 0; ret = decode_nal_units(h, buf, size, 1); if (ret < 0) return ret; } return size; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234458, "input": "static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs) { struct rpc_task *task = &hdr->task; pnfs_layoutcommit_inode(hdr->inode, false); if (retry_pnfs) { dprintk(\"%s Reset task %5u for i/o through pNFS \" \"(req %s/%llu, %u bytes @ offset %llu)\\n\", __func__, hdr->task.tk_pid, hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); hdr->completion_ops->reschedule_io(hdr); return; } if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { dprintk(\"%s Reset task %5u for i/o through MDS \" \"(req %s/%llu, %u bytes @ offset %llu)\\n\", __func__, hdr->task.tk_pid, hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); trace_pnfs_mds_fallback_write_done(hdr->inode, hdr->args.offset, hdr->args.count, IOMODE_RW, NFS_I(hdr->inode)->layout, hdr->lseg); task->tk_status = pnfs_write_done_resend_to_mds(hdr); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318186, "input": "static int copyTdEntry(const indexEntry entry, rpmtd td, headerGetFlags flags) { rpm_count_t count = entry->info.count; int rc = 1; /* XXX 1 on success. */ /* ALLOC overrides MINMEM */ int allocMem = flags & HEADERGET_ALLOC; int minMem = allocMem ? 0 : flags & HEADERGET_MINMEM; int argvArray = (flags & HEADERGET_ARGV) ? 1 : 0; assert(td != NULL); td->flags = RPMTD_IMMUTABLE; switch (entry->info.type) { case RPM_BIN_TYPE: /* * XXX This only works for * XXX \"sealed\" HEADER_IMMUTABLE/HEADER_SIGNATURES/HEADER_IMAGE. * XXX This will *not* work for unsealed legacy HEADER_IMAGE (i.e. * XXX a legacy header freshly read, but not yet unloaded to the rpmdb). */ if (ENTRY_IS_REGION(entry)) { int32_t * ei = ((int32_t *)entry->data) - 2; entryInfo pe = (entryInfo) (ei + 2); unsigned char * dataStart = (unsigned char *) (pe + ntohl(ei[0])); int32_t rdl = -entry->info.offset; /* negative offset */ int32_t ril = rdl/sizeof(*pe); rdl = entry->rdlen; count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) + rdl; if (entry->info.tag == RPMTAG_HEADERIMAGE) { ril -= 1; pe += 1; } else { count += REGION_TAG_COUNT; rdl += REGION_TAG_COUNT; } td->data = xmalloc(count); ei = (int32_t *) td->data; ei[0] = htonl(ril); ei[1] = htonl(rdl); pe = (entryInfo) memcpy(ei + 2, pe, (ril * sizeof(*pe))); dataStart = (unsigned char *) memcpy(pe + ril, dataStart, rdl); rc = regionSwab(NULL, ril, 0, pe, dataStart, dataStart + rdl, 0, 0); /* don't return data on failure */ if (rc < 0) { td->data = _free(td->data); } /* XXX 1 on success. */ rc = (rc < 0) ? 0 : 1; } else { td->data = (!minMem ? memcpy(xmalloc(count), entry->data, count) : entry->data); } break; case RPM_STRING_TYPE: /* simple string, but fallthrough if its actually an array */ if (count == 1 && !argvArray) { td->data = allocMem ? xstrdup(entry->data) : entry->data; break; } case RPM_STRING_ARRAY_TYPE: case RPM_I18NSTRING_TYPE: { const char ** ptrEntry; int tableSize = (count + argvArray) * sizeof(char *); char * t; int i; if (minMem) { td->data = xmalloc(tableSize); ptrEntry = (const char **) td->data; t = entry->data; } else { t = xmalloc(tableSize + entry->length); td->data = (void *)t; ptrEntry = (const char **) td->data; t += tableSize; memcpy(t, entry->data, entry->length); } for (i = 0; i < count; i++) { *ptrEntry++ = t; t = strchr(t, 0); t++; } if (argvArray) { *ptrEntry = NULL; td->flags |= RPMTD_ARGV; } } break; case RPM_CHAR_TYPE: case RPM_INT8_TYPE: case RPM_INT16_TYPE: case RPM_INT32_TYPE: case RPM_INT64_TYPE: if (allocMem) { td->data = xmalloc(entry->length); memcpy(td->data, entry->data, entry->length); } else { td->data = entry->data; } break; default: /* WTH? Don't mess with unknown data types... */ rc = 0; td->data = NULL; break; } td->type = entry->info.type; td->count = count; td->size = entry->length; if (td->data && entry->data != td->data) { td->flags |= RPMTD_ALLOCED; } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211135, "input": "static struct kobject *cdev_get(struct cdev *p) { struct module *owner = p->owner; struct kobject *kobj; if (owner && !try_module_get(owner)) return NULL; kobj = kobject_get(&p->kobj); if (!kobj) module_put(owner); return kobj; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"], "explanation": "In cdev_get of char_dev.c, there is a possible use-after-free due to a race condition. This could lead to local escalation of privilege with System execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android-10Android ID: A-153467744", "severity_level": "NoInfo", "cwe": "CWE-362", "cve": "CVE-2020-0305"}} -{"idx": 411961, "input": "parselet(struct scanner *s, struct evalstring **val) { scanchar(s, '='); *val = scanstring(s, false); scannewline(s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497555, "input": "ms_escher_clientanchor (GString *buf, SheetObjectAnchor const *anchor) { guint8 tmp[26] = { 0, 0, 0x10, 0xf0, 0xde, 0xad, 0xbe, 0xef, 0, 0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 }; guint8 *p = tmp + 10; GSF_LE_SET_GUINT32 (tmp + 4, sizeof (tmp) - 8); GSF_LE_SET_GUINT16 (p + 0, anchor->cell_bound.start.col); GSF_LE_SET_GUINT16 (p + 2, (guint16)(anchor->offset[0]*1024. + .5)); GSF_LE_SET_GUINT16 (p + 4, anchor->cell_bound.start.row); GSF_LE_SET_GUINT16 (p + 6, (guint16)(anchor->offset[1]*256. + .5)); GSF_LE_SET_GUINT16 (p + 8, anchor->cell_bound.end.col); GSF_LE_SET_GUINT16 (p + 10, (guint16)(anchor->offset[2]*1024. + .5)); GSF_LE_SET_GUINT16 (p + 12, anchor->cell_bound.end.row); GSF_LE_SET_GUINT16 (p + 14, (guint16)(anchor->offset[3]*256. + .5)); g_string_append_len (buf, tmp, sizeof tmp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 404510, "input": "RSAES_Decode( TPM2B *message, // OUT: the recovered message TPM2B *coded // IN: the encoded message ) { BOOL fail = FALSE; UINT16 pSize; fail = (coded->size < 11); fail = (coded->buffer[0] != 0x00) | fail; fail = (coded->buffer[1] != 0x02) | fail; for(pSize = 2; pSize < coded->size; pSize++) { if(coded->buffer[pSize] == 0) break; } pSize++; // Make sure that pSize has not gone over the end and that there are at least 8 // bytes of pad data. fail = (pSize >= coded->size) | fail; fail = ((pSize - 2) < 8) | fail; if((message->size < (UINT16)(coded->size - pSize)) || fail) return TPM_RC_VALUE; message->size = coded->size - pSize; memcpy(message->buffer, &coded->buffer[pSize], coded->size - pSize); return TPM_RC_SUCCESS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246197, "input": "static void explainSimpleCount( Parse *pParse, /* Parse context */ Table *pTab, /* Table being queried */ Index *pIdx /* Index used to optimize scan, or NULL */ ){ if( pParse->explain==2 ){ int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx))); sqlite3VdbeExplain(pParse, 0, \"SCAN TABLE %s%s%s\", pTab->zName, bCover ? \" USING COVERING INDEX \" : \"\", bCover ? pIdx->zName : \"\" ); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202898, "input": "static struct kvm_vcpu_hv_synic *synic_get(struct kvm *kvm, u32 vpidx) { struct kvm_vcpu *vcpu; struct kvm_vcpu_hv_synic *synic; vcpu = get_vcpu_by_vpidx(kvm, vpidx); if (!vcpu) return NULL; synic = to_hv_synic(vcpu); return (synic->active) ? synic : NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "An issue was discovered in the Linux kernel through 5.11.11. synic_get in arch/x86/kvm/hyperv.c has a NULL pointer dereference for certain accesses to the SynIC Hyper-V context, aka CID-919f4ebc5987.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-30178"}} -{"idx": 399271, "input": "void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata) { if (!adata || !mdata) return; if (mdata->hcache) return; struct HeaderCache *hc = NULL; struct Buffer *mbox = mutt_buffer_pool_get(); struct Buffer *cachepath = mutt_buffer_pool_get(); imap_cachepath(adata->delim, mdata->name, mbox); if (strstr(mutt_buffer_string(mbox), \"/../\") || mutt_str_equal(mutt_buffer_string(mbox), \"..\") || mutt_strn_equal(mutt_buffer_string(mbox), \"../\", 3)) { goto cleanup; } size_t len = mutt_buffer_len(mbox); if ((len > 3) && (strcmp(mutt_buffer_string(mbox) + len - 3, \"/..\") == 0)) goto cleanup; struct Url url = { 0 }; mutt_account_tourl(&adata->conn->account, &url); url.path = mbox->data; url_tobuffer(&url, cachepath, U_PATH); const char *const c_header_cache = cs_subset_path(NeoMutt->sub, \"header_cache\"); hc = mutt_hcache_open(c_header_cache, mutt_buffer_string(cachepath), imap_hcache_namer); cleanup: mutt_buffer_pool_release(&mbox); mutt_buffer_pool_release(&cachepath); mdata->hcache = hc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431962, "input": "static void hci_cc_read_local_oob_data(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_rp_read_local_oob_data *rp = (void *) skb->data; BT_DBG(\"%s status 0x%2.2x\", hdev->name, rp->status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280678, "input": "ofpacts_parse__(char *str, const struct ofpact_parse_params *pp, bool allow_instructions, enum ofpact_type outer_action) { int prev_inst = -1; enum ofperr retval; char *key, *value; bool drop = false; char *pos; pos = str; while (ofputil_parse_key_value(&pos, &key, &value)) { enum ovs_instruction_type inst = OVSINST_OFPIT11_APPLY_ACTIONS; enum ofpact_type type; char *error = NULL; ofp_port_t port; if (ofpact_type_from_name(key, &type)) { error = ofpact_parse(type, value, pp); inst = ovs_instruction_type_from_ofpact_type(type); } else if (!strcasecmp(key, \"mod_vlan_vid\")) { error = parse_set_vlan_vid(value, true, pp); } else if (!strcasecmp(key, \"mod_vlan_pcp\")) { error = parse_set_vlan_pcp(value, true, pp); } else if (!strcasecmp(key, \"set_nw_ttl\")) { error = parse_SET_IP_TTL(value, pp); } else if (!strcasecmp(key, \"pop_vlan\")) { error = parse_pop_vlan(pp); } else if (!strcasecmp(key, \"set_tunnel64\")) { error = parse_set_tunnel(value, NXAST_RAW_SET_TUNNEL64, pp); } else if (!strcasecmp(key, \"load\")) { error = parse_reg_load(value, pp); } else if (!strcasecmp(key, \"bundle_load\")) { error = parse_bundle_load(value, pp); } else if (!strcasecmp(key, \"drop\")) { drop = true; } else if (!strcasecmp(key, \"apply_actions\")) { return xstrdup(\"apply_actions is the default instruction\"); } else if (ofputil_port_from_string(key, pp->port_map, &port)) { ofpact_put_OUTPUT(pp->ofpacts)->port = port; } else { return xasprintf(\"unknown action %s\", key); } if (error) { return error; } if (inst != OVSINST_OFPIT11_APPLY_ACTIONS) { if (!allow_instructions) { return xasprintf(\"only actions are allowed here (not \" \"instruction %s)\", ovs_instruction_name_from_type(inst)); } if (inst == prev_inst) { return xasprintf(\"instruction %s may be specified only once\", ovs_instruction_name_from_type(inst)); } } if (prev_inst != -1 && inst < prev_inst) { return xasprintf(\"instruction %s must be specified before %s\", ovs_instruction_name_from_type(inst), ovs_instruction_name_from_type(prev_inst)); } prev_inst = inst; } if (drop && pp->ofpacts->size) { return xstrdup(\"\\\"drop\\\" must not be accompanied by any other action \" \"or instruction\"); } retval = ofpacts_verify(pp->ofpacts->data, pp->ofpacts->size, (allow_instructions ? (1u << N_OVS_INSTRUCTIONS) - 1 : 1u << OVSINST_OFPIT11_APPLY_ACTIONS), outer_action); if (retval) { return xstrdup(\"Incorrect instruction ordering\"); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431401, "input": "int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_exception *exception) { struct nfs_client *clp = server->nfs_client; int ret; ret = nfs4_do_handle_exception(server, errorcode, exception); if (exception->delay) { ret = nfs4_delay(&exception->timeout, exception->interruptible); goto out_retry; } if (exception->recovering) { ret = nfs4_wait_clnt_recover(clp); if (test_bit(NFS_MIG_FAILED, &server->mig_status)) return -EIO; goto out_retry; } return ret; out_retry: if (ret == 0) exception->retry = 1; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409960, "input": "static int tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr *th) { const __be32 *ptr = (const __be32 *)(th + 1); if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { tp->rx_opt.saw_tstamp = 1; ++ptr; tp->rx_opt.rcv_tsval = ntohl(*ptr); ++ptr; tp->rx_opt.rcv_tsecr = ntohl(*ptr); return 1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 384509, "input": "static u32 iwl_dump_ini_rxf_get_size(struct iwl_fw_runtime *fwrt, struct iwl_fw_ini_region_cfg *reg) { struct iwl_ini_rxf_data rx_data; u32 size = sizeof(struct iwl_fw_ini_error_dump) + sizeof(struct iwl_fw_ini_error_dump_range) + le32_to_cpu(reg->fifos.num_of_registers) * sizeof(struct iwl_fw_ini_error_dump_register); if (reg->fifos.header_only) return size; iwl_ini_get_rxf_data(fwrt, reg, &rx_data); size += rx_data.size; return size; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382775, "input": "static php_iconv_err_t php_iconv_stream_filter_ctor(php_iconv_stream_filter *self, const char *to_charset, size_t to_charset_len, const char *from_charset, size_t from_charset_len, int persistent) { if (NULL == (self->to_charset = pemalloc(to_charset_len + 1, persistent))) { return PHP_ICONV_ERR_ALLOC; } self->to_charset_len = to_charset_len; if (NULL == (self->from_charset = pemalloc(from_charset_len + 1, persistent))) { pefree(self->to_charset, persistent); return PHP_ICONV_ERR_ALLOC; } self->from_charset_len = from_charset_len; memcpy(self->to_charset, to_charset, to_charset_len); self->to_charset[to_charset_len] = '\\0'; memcpy(self->from_charset, from_charset, from_charset_len); self->from_charset[from_charset_len] = '\\0'; if ((iconv_t)-1 == (self->cd = iconv_open(self->to_charset, self->from_charset))) { pefree(self->from_charset, persistent); pefree(self->to_charset, persistent); return PHP_ICONV_ERR_UNKNOWN; } self->persistent = persistent; self->stub_len = 0; return PHP_ICONV_ERR_SUCCESS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195727, "input": "R_API void r_core_fini(RCore *c) { if (!c) { return; } r_core_task_break_all (&c->tasks); r_core_task_join (&c->tasks, NULL, -1); r_core_wait (c); /* TODO: it leaks as shit */ //update_sdb (c); // avoid double free r_list_free (c->ropchain); r_event_free (c->ev); free (c->cmdlog); free (c->lastsearch); R_FREE (c->cons->pager); free (c->cmdqueue); free (c->lastcmd); free (c->stkcmd); r_list_free (c->visual.tabs); free (c->block); r_core_autocomplete_free (c->autocomplete); r_list_free (c->gadgets); r_list_free (c->undos); r_num_free (c->num); // TODO: sync or not? sdb_sync (c->sdb); // TODO: sync all dbs? //r_core_file_free (c->file); //c->file = NULL; free (c->table_query); r_list_free (c->files); r_list_free (c->watchers); r_list_free (c->scriptstack); r_core_task_scheduler_fini (&c->tasks); c->rcmd = r_cmd_free (c->rcmd); r_list_free (c->cmd_descriptors); c->anal = r_anal_free (c->anal); r_asm_free (c->assembler); c->assembler = NULL; c->print = r_print_free (c->print); c->bin = (r_bin_free (c->bin), NULL); c->lang = (r_lang_free (c->lang), NULL); c->dbg = (r_debug_free (c->dbg), NULL); r_io_free (c->io); r_config_free (c->config); /* after r_config_free, the value of I.teefile is trashed */ /* rconfig doesnt knows how to deinitialize vars, so we should probably need to add a r_config_free_payload callback */ r_cons_free (); r_cons_singleton ()->teefile = NULL; // HACK r_search_free (c->search); r_flag_free (c->flags); r_fs_free (c->fs); r_egg_free (c->egg); r_lib_free (c->lib); r_buf_free (c->yank_buf); r_agraph_free (c->graph); free (c->asmqjmps); sdb_free (c->sdb); r_core_log_free (c->log); r_parse_free (c->parser); free (c->times); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "A double free issue was discovered in radare2 in cmd_info.c:cmd_info(). Successful exploitation could lead to modification of unexpected memory locations and potentially causing a crash.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2020-27794"}} -{"idx": 280485, "input": "encode_CLONE(const struct ofpact_nest *clone, enum ofp_version ofp_version, struct ofpbuf *out) { size_t len; const size_t ofs = out->size; struct ext_action_header *eah; put_NXAST_CLONE(out); len = ofpacts_put_openflow_actions(clone->actions, ofpact_nest_get_action_len(clone), out, ofp_version); len += sizeof *eah; eah = ofpbuf_at(out, ofs, sizeof *eah); eah->len = htons(len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382004, "input": "void CServer::PumpNetwork() { CNetChunk Packet; TOKEN ResponseToken; m_NetServer.Update(); // process packets while(m_NetServer.Recv(&Packet, &ResponseToken)) { if(Packet.m_Flags&NETSENDFLAG_CONNLESS) { if(m_Register.RegisterProcessPacket(&Packet, ResponseToken)) continue; if(Packet.m_DataSize >= int(sizeof(SERVERBROWSE_GETINFO)) && mem_comp(Packet.m_pData, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO)) == 0) { CUnpacker Unpacker; Unpacker.Reset((unsigned char*)Packet.m_pData+sizeof(SERVERBROWSE_GETINFO), Packet.m_DataSize-sizeof(SERVERBROWSE_GETINFO)); int SrvBrwsToken = Unpacker.GetInt(); if(Unpacker.Error()) continue; CPacker Packer; CNetChunk Response; GenerateServerInfo(&Packer, SrvBrwsToken); Response.m_ClientID = -1; Response.m_Address = Packet.m_Address; Response.m_Flags = NETSENDFLAG_CONNLESS; Response.m_pData = Packer.Data(); Response.m_DataSize = Packer.Size(); m_NetServer.Send(&Response, ResponseToken); } } else ProcessClientPacket(&Packet); } m_ServerBan.Update(); m_Econ.Update(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499709, "input": "inode_val_hasher (const void *val, size_t n_buckets) { const struct inode_val *ival = val; return ival->inode % n_buckets; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246051, "input": "int DeliverSignal(int linux_signum, int linux_sigcode) { int signum = FromkLinuxSignalNumber(linux_signum); if (signum < 0) { return 1; } siginfo_t info; info.si_signo = signum; info.si_code = linux_sigcode; SignalManager *signal_manager = SignalManager::GetInstance(); const sigset_t mask = signal_manager->GetSignalMask(); // If the signal is blocked and still passed into the enclave. The signal // masks inside the enclave is out of sync with the untrusted signal mask. if (sigismember(&mask, signum)) { return -1; } signal_manager->HandleSignal(signum, &info, /*ucontext=*/nullptr); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 403803, "input": "static bool torture_smb2_notify_tree_disconnect( struct torture_context *torture, struct smb2_tree *tree) { bool ret = true; NTSTATUS status; union smb_notify notify; union smb_open io; struct smb2_handle h1; struct smb2_request *req; smb2_deltree(tree, BASEDIR_TD); smb2_util_rmdir(tree, BASEDIR_TD); torture_comment(torture, \"TESTING CHANGE NOTIFY+CANCEL FOLLOWED BY \" \"TREE-DISCONNECT\\n\"); /* get a handle on the directory */ ZERO_STRUCT(io.smb2); io.generic.level = RAW_OPEN_SMB2; io.smb2.in.create_flags = 0; io.smb2.in.desired_access = SEC_FILE_ALL; io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL; io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE; io.smb2.in.alloc_size = 0; io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE; io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS; io.smb2.in.security_flags = 0; io.smb2.in.fname = BASEDIR_TD; status = smb2_create(tree, torture, &(io.smb2)); CHECK_STATUS(status, NT_STATUS_OK); h1 = io.smb2.out.file.handle; /* ask for a change notify, on file or directory name changes */ ZERO_STRUCT(notify.smb2); notify.smb2.level = RAW_NOTIFY_SMB2; notify.smb2.in.buffer_size = 1000; notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME; notify.smb2.in.file.handle = h1; notify.smb2.in.recursive = true; req = smb2_notify_send(tree, &(notify.smb2)); smb2_cancel(req); status = smb2_notify_recv(req, torture, &(notify.smb2)); status = smb2_tdis(tree); CHECK_STATUS(status, NT_STATUS_OK); req = smb2_notify_send(tree, &(notify.smb2)); smb2_notify_recv(req, torture, &(notify.smb2)); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(notify.smb2.out.num_changes, 0); done: smb2_deltree(tree, BASEDIR_TD); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453410, "input": "*/ static void bfq_handle_burst(struct bfq_data *bfqd, struct bfq_queue *bfqq) { /* * If bfqq is already in the burst list or is part of a large * burst, or finally has just been split, then there is * nothing else to do. */ if (!hlist_unhashed(&bfqq->burst_list_node) || bfq_bfqq_in_large_burst(bfqq) || time_is_after_eq_jiffies(bfqq->split_time + msecs_to_jiffies(10))) return; /* * If bfqq's creation happens late enough, or bfqq belongs to * a different group than the burst group, then the current * burst is finished, and related data structures must be * reset. * * In this respect, consider the special case where bfqq is * the very first queue created after BFQ is selected for this * device. In this case, last_ins_in_burst and * burst_parent_entity are not yet significant when we get * here. But it is easy to verify that, whether or not the * following condition is true, bfqq will end up being * inserted into the burst list. In particular the list will * happen to contain only bfqq. And this is exactly what has * to happen, as bfqq may be the first queue of the first * burst. */ if (time_is_before_jiffies(bfqd->last_ins_in_burst + bfqd->bfq_burst_interval) || bfqq->entity.parent != bfqd->burst_parent_entity) { bfqd->large_burst = false; bfq_reset_burst_list(bfqd, bfqq); goto end; } /* * If we get here, then bfqq is being activated shortly after the * last queue. So, if the current burst is also large, we can mark * bfqq as belonging to this large burst immediately. */ if (bfqd->large_burst) { bfq_mark_bfqq_in_large_burst(bfqq); goto end; } /* * If we get here, then a large-burst state has not yet been * reached, but bfqq is being activated shortly after the last * queue. Then we add bfqq to the burst. */ bfq_add_to_burst(bfqd, bfqq); end: /* * At this point, bfqq either has been added to the current * burst or has caused the current burst to terminate and a * possible new burst to start. In particular, in the second * case, bfqq has become the first queue in the possible new * burst. In both cases last_ins_in_burst needs to be moved * forward. */ bfqd->last_ins_in_burst = jiffies;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267229, "input": "GF_Err gf_isom_set_alternate_group_id(GF_ISOFile *movie, u32 trackNumber, u32 groupId) { GF_TrackBox *trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak) return GF_BAD_PARAM; trak->Header->alternate_group = groupId; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195755, "input": "Status PyArrayDescr_to_TF_DataType(PyArray_Descr* descr, TF_DataType* out_tf_datatype) { PyObject* key; PyObject* value; Py_ssize_t pos = 0; if (PyDict_Next(descr->fields, &pos, &key, &value)) { // In Python 3, the keys of numpy custom struct types are unicode, unlike // Python 2, where the keys are bytes. const char* key_string = PyBytes_Check(key) ? PyBytes_AsString(key) : PyBytes_AsString(PyUnicode_AsASCIIString(key)); if (!key_string) { return errors::Internal(\"Corrupt numpy type descriptor\"); } tensorflow::string key = key_string; // The typenames here should match the field names in the custom struct // types constructed in test_util.py. // TODO(mrry,keveman): Investigate Numpy type registration to replace this // hard-coding of names. if (key == \"quint8\") { *out_tf_datatype = TF_QUINT8; } else if (key == \"qint8\") { *out_tf_datatype = TF_QINT8; } else if (key == \"qint16\") { *out_tf_datatype = TF_QINT16; } else if (key == \"quint16\") { *out_tf_datatype = TF_QUINT16; } else if (key == \"qint32\") { *out_tf_datatype = TF_QINT32; } else if (key == \"resource\") { *out_tf_datatype = TF_RESOURCE; } else { return errors::Internal(\"Unsupported numpy data type\"); } return Status::OK(); } return errors::Internal(\"Unsupported numpy data type\"); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. Calling TF operations with tensors of non-numeric types when the operations expect numeric tensors result in null pointer dereferences. The conversion from Python array to C++ array(https://github.com/tensorflow/tensorflow/blob/ff70c47a396ef1e3cb73c90513da4f5cb71bebba/tensorflow/python/lib/core/ndarray_tensor.cc#L113-L169) is vulnerable to a type confusion. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-29513"}} -{"idx": 230259, "input": "CallResult> JSObject::getComputedPropertyValue_RJS( Handle selfHandle, Runtime *runtime, Handle propObj, ComputedPropertyDescriptor desc, Handle<> nameValHandle) { if (!propObj) { return createPseudoHandle(HermesValue::encodeEmptyValue()); } if (LLVM_LIKELY(!desc.flags.proxyObject)) { return JSObject::getComputedPropertyValue_RJS( selfHandle, runtime, propObj, desc); } CallResult> keyRes = toPropertyKey(runtime, nameValHandle); if (LLVM_UNLIKELY(keyRes == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } CallResult hasRes = JSProxy::hasComputed(propObj, runtime, *keyRes); if (LLVM_UNLIKELY(hasRes == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } if (!*hasRes) { return createPseudoHandle(HermesValue::encodeEmptyValue()); } return JSProxy::getComputed(propObj, runtime, *keyRes, selfHandle); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506502, "input": "raise_command(void) { raise_lower_command(0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 227355, "input": "void LanLinkProvider::addLink(const QString& deviceId, QSslSocket* socket, NetworkPacket* receivedPacket, LanDeviceLink::ConnectionStarted connectionOrigin) { // Socket disconnection will now be handled by LanDeviceLink disconnect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); LanDeviceLink* deviceLink; //Do we have a link for this device already? QMap< QString, LanDeviceLink* >::iterator linkIterator = m_links.find(deviceId); if (linkIterator != m_links.end()) { //qCDebug(KDECONNECT_CORE) << \"Reusing link to\" << deviceId; deviceLink = linkIterator.value(); deviceLink->reset(socket, connectionOrigin); } else { deviceLink = new LanDeviceLink(deviceId, this, socket, connectionOrigin); // Socket disconnection will now be handled by LanDeviceLink disconnect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); bool isDeviceTrusted = KdeConnectConfig::instance().trustedDevices().contains(deviceId); if (!isDeviceTrusted && m_links.size() > MAX_UNPAIRED_CONNECTIONS) { qCWarning(KDECONNECT_CORE) << \"Too many unpaired devices to remember them all. Ignoring \" << deviceId; socket->disconnectFromHost(); socket->deleteLater(); return; } connect(deviceLink, &QObject::destroyed, this, &LanLinkProvider::deviceLinkDestroyed); m_links[deviceId] = deviceLink; if (m_pairingHandlers.contains(deviceId)) { //We shouldn't have a pairinghandler if we didn't have a link. //Crash if debug, recover if release (by setting the new devicelink to the old pairinghandler) Q_ASSERT(m_pairingHandlers.contains(deviceId)); m_pairingHandlers[deviceId]->setDeviceLink(deviceLink); } } Q_EMIT onConnectionReceived(*receivedPacket, deviceLink); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346383, "input": "evbuffer_find_eol_char(struct evbuffer_ptr *it) { struct evbuffer_chain *chain = it->_internal.chain; size_t i = it->_internal.pos_in_chain; while (chain != NULL) { char *buffer = (char *)chain->buffer + chain->misalign; char *cp = find_eol_char(buffer+i, chain->off-i); if (cp) { it->_internal.chain = chain; it->_internal.pos_in_chain = cp - buffer; it->pos += (cp - buffer) - i; return it->pos; } it->pos += chain->off - i; i = 0; chain = chain->next; } return (-1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281477, "input": "static int gen8_emit_flush(struct i915_request *request, u32 mode) { u32 cmd, *cs; cs = intel_ring_begin(request, 4); if (IS_ERR(cs)) return PTR_ERR(cs); cmd = MI_FLUSH_DW + 1; /* We always require a command barrier so that subsequent * commands, such as breadcrumb interrupts, are strictly ordered * wrt the contents of the write cache being flushed to memory * (and thus being coherent from the CPU). */ cmd |= MI_FLUSH_DW_STORE_INDEX | MI_FLUSH_DW_OP_STOREDW; if (mode & EMIT_INVALIDATE) { cmd |= MI_INVALIDATE_TLB; if (request->engine->class == VIDEO_DECODE_CLASS) cmd |= MI_INVALIDATE_BSD; } *cs++ = cmd; *cs++ = LRC_PPHWSP_SCRATCH_ADDR; *cs++ = 0; /* upper addr */ *cs++ = 0; /* value */ intel_ring_advance(request, cs); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402475, "input": "static void hci_req_clear_event_filter(struct hci_request *req) { struct hci_cp_set_event_filter f; memset(&f, 0, sizeof(f)); f.flt_type = HCI_FLT_CLEAR_ALL; hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &f); /* Update page scan state (since we may have modified it when setting * the event filter). */ __hci_req_update_scan(req); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422688, "input": "TEST_F(QueryPlannerTest, NegatedElemMatchValueInArray) { addIndex(BSON(\"i\" << 1)); runQuery(fromjson(\"{i: {$not: {$elemMatch: {$in: [[1]]}}}}\")); assertHasOnlyCollscan(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 455275, "input": "GetArrayData ( IN VOID *Array, IN UINT8 Type, IN UINTN Index ) { UINT64 Data; ASSERT (Array != NULL); Data = 0; switch (Type) { case EFI_IFR_TYPE_NUM_SIZE_8: Data = (UINT64) *(((UINT8 *) Array) + Index); break; case EFI_IFR_TYPE_NUM_SIZE_16: Data = (UINT64) *(((UINT16 *) Array) + Index); break; case EFI_IFR_TYPE_NUM_SIZE_32: Data = (UINT64) *(((UINT32 *) Array) + Index); break; case EFI_IFR_TYPE_NUM_SIZE_64: Data = (UINT64) *(((UINT64 *) Array) + Index); break; default: break; } return Data; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380024, "input": "} EXPORT_SYMBOL_GPL(iscsi_conn_login_event); void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport, enum iscsi_host_event_code code, uint32_t data_size, uint8_t *data) { struct nlmsghdr *nlh; struct sk_buff *skb; struct iscsi_uevent *ev; int len = nlmsg_total_size(sizeof(*ev) + data_size); skb = alloc_skb(len, GFP_NOIO); if (!skb) { printk(KERN_ERR \"gracefully ignored host event (%d):%d OOM\\n\", host_no, code); return; } nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); ev = nlmsg_data(nlh); ev->transport_handle = iscsi_handle(transport); ev->type = ISCSI_KEVENT_HOST_EVENT; ev->r.host_event.host_no = host_no; ev->r.host_event.code = code; ev->r.host_event.data_size = data_size; if (data_size) memcpy((char *)ev + sizeof(*ev), data, data_size);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409869, "input": "static inline u32 tcp_cwnd_min(const struct sock *sk) { const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; return ca_ops->min_cwnd ? ca_ops->min_cwnd(sk) : tcp_sk(sk)->snd_ssthresh; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393622, "input": "lr_copy_metalink_content(LrHandle *handle, LrYumRepo *repo, GError **err) { int fd; int rc; if (handle->metalink_fd != -1) { char *ml_file_path = lr_pathconcat(handle->destdir, \"metalink.xml\", NULL); fd = open(ml_file_path, O_CREAT|O_TRUNC|O_RDWR, 0666); if (fd < 0) { g_debug(\"%s: Cannot create: %s\", __func__, ml_file_path); g_set_error(err, LR_YUM_ERROR, LRE_IO, \"Cannot create %s: %s\", ml_file_path, g_strerror(errno)); lr_free(ml_file_path); return FALSE; } rc = lr_copy_content(handle->metalink_fd, fd); close(fd); if (rc != 0) { g_debug(\"%s: Cannot copy content of metalink file\", __func__); g_set_error(err, LR_YUM_ERROR, LRE_IO, \"Cannot copy content of metalink file %s: %s\", ml_file_path, g_strerror(errno)); lr_free(ml_file_path); return FALSE; } repo->metalink = ml_file_path; } return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336881, "input": "rb_str_format_m(VALUE str, VALUE arg) { volatile VALUE tmp = rb_check_array_type(arg); if (!NIL_P(tmp)) { return rb_str_format(RARRAY_LENINT(tmp), RARRAY_PTR(tmp), str); } return rb_str_format(1, &arg, str); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 349495, "input": "p11_rpc_buffer_decode_uint32 (unsigned char* ptr) { uint32_t val = (uint32_t) ptr[0] << 24 | ptr[1] << 16 | ptr[2] << 8 | ptr[3]; return val; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514764, "input": "int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr) { unsigned access_size_max = mr->ops->valid.max_access_size; /* Regions are assumed to support 1-4 byte accesses unless otherwise specified. */ if (access_size_max == 0) { access_size_max = 4; } /* Bound the maximum access by the alignment of the address. */ if (!mr->ops->impl.unaligned) { unsigned align_size_max = addr & -addr; if (align_size_max != 0 && align_size_max < access_size_max) { access_size_max = align_size_max; } } /* Don't attempt accesses larger than the maximum. */ if (l > access_size_max) { l = access_size_max; } l = pow2floor(l); return l; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506612, "input": "LINETYPE_null(int t) { (void) t; /* avoid -Wunused warning */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445554, "input": "void trace_dump_stack(int skip) { unsigned long flags; if (tracing_disabled || tracing_selftest_running) return; local_save_flags(flags); /* * Skip 3 more, seems to get us at the caller of * this function. */ skip += 3; __ftrace_trace_stack(global_trace.trace_buffer.buffer, flags, skip, preempt_count(), NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 481051, "input": "static unsigned int xdr_set_page_base(struct xdr_stream *xdr, unsigned int base, unsigned int len) { unsigned int pgnr; unsigned int maxlen; unsigned int pgoff; unsigned int pgend; void *kaddr; maxlen = xdr->buf->page_len; if (base >= maxlen) return 0; else maxlen -= base; if (len > maxlen) len = maxlen; xdr_stream_page_set_pos(xdr, base); base += xdr->buf->page_base; pgnr = base >> PAGE_SHIFT; xdr->page_ptr = &xdr->buf->pages[pgnr]; kaddr = page_address(*xdr->page_ptr); pgoff = base & ~PAGE_MASK; xdr->p = (__be32*)(kaddr + pgoff); pgend = pgoff + len; if (pgend > PAGE_SIZE) pgend = PAGE_SIZE; xdr->end = (__be32*)(kaddr + pgend); xdr->iov = NULL; return len; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385617, "input": "bool LineTerminator::Is(uchar c) { int chunk_index = c >> 13; switch (chunk_index) { case 0: return LookupPredicate(kLineTerminatorTable0, kLineTerminatorTable0Size, c); case 1: return LookupPredicate(kLineTerminatorTable1, kLineTerminatorTable1Size, c); default: return false; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514773, "input": "static void ram_block_add(RAMBlock *new_block, Error **errp) { const bool noreserve = qemu_ram_is_noreserve(new_block); const bool shared = qemu_ram_is_shared(new_block); RAMBlock *block; RAMBlock *last_block = NULL; ram_addr_t old_ram_size, new_ram_size; Error *err = NULL; old_ram_size = last_ram_page(); qemu_mutex_lock_ramlist(); new_block->offset = find_ram_offset(new_block->max_length); if (!new_block->host) { if (xen_enabled()) { xen_ram_alloc(new_block->offset, new_block->max_length, new_block->mr, &err); if (err) { error_propagate(errp, err); qemu_mutex_unlock_ramlist(); return; } } else { new_block->host = qemu_anon_ram_alloc(new_block->max_length, &new_block->mr->align, shared, noreserve); if (!new_block->host) { error_setg_errno(errp, errno, \"cannot set up guest memory '%s'\", memory_region_name(new_block->mr)); qemu_mutex_unlock_ramlist(); return; } memory_try_enable_merging(new_block->host, new_block->max_length); } } new_ram_size = MAX(old_ram_size, (new_block->offset + new_block->max_length) >> TARGET_PAGE_BITS); if (new_ram_size > old_ram_size) { dirty_memory_extend(old_ram_size, new_ram_size); } /* Keep the list sorted from biggest to smallest block. Unlike QTAILQ, * QLIST (which has an RCU-friendly variant) does not have insertion at * tail, so save the last element in last_block. */ RAMBLOCK_FOREACH(block) { last_block = block; if (block->max_length < new_block->max_length) { break; } } if (block) { QLIST_INSERT_BEFORE_RCU(block, new_block, next); } else if (last_block) { QLIST_INSERT_AFTER_RCU(last_block, new_block, next); } else { /* list is empty */ QLIST_INSERT_HEAD_RCU(&ram_list.blocks, new_block, next); } ram_list.mru_block = NULL; /* Write list before version */ smp_wmb(); ram_list.version++; qemu_mutex_unlock_ramlist(); cpu_physical_memory_set_dirty_range(new_block->offset, new_block->used_length, DIRTY_CLIENTS_ALL); if (new_block->host) { qemu_ram_setup_dump(new_block->host, new_block->max_length); qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE); /* * MADV_DONTFORK is also needed by KVM in absence of synchronous MMU * Configure it unless the machine is a qtest server, in which case * KVM is not used and it may be forked (eg for fuzzing purposes). */ if (!qtest_enabled()) { qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK); } ram_block_notify_add(new_block->host, new_block->used_length, new_block->max_length); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232135, "input": "static bool r_core_anal_log(struct r_anal_t *anal, const char *msg) { RCore *core = anal->user; if (core->cfglog) { r_core_log_add (core, msg); } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453412, "input": "*/ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) { struct bfq_queue *bfqq; struct request *next_rq; enum bfqq_expiration reason = BFQQE_BUDGET_TIMEOUT; bfqq = bfqd->in_service_queue; if (!bfqq) goto new_queue; bfq_log_bfqq(bfqd, bfqq, \"select_queue: already in-service queue\"); /* * Do not expire bfqq for budget timeout if bfqq may be about * to enjoy device idling. The reason why, in this case, we * prevent bfqq from expiring is the same as in the comments * on the case where bfq_bfqq_must_idle() returns true, in * bfq_completed_request(). */ if (bfq_may_expire_for_budg_timeout(bfqq) && !bfq_bfqq_must_idle(bfqq)) goto expire; check_queue: /* * This loop is rarely executed more than once. Even when it * happens, it is much more convenient to re-execute this loop * than to return NULL and trigger a new dispatch to get a * request served. */ next_rq = bfqq->next_rq; /* * If bfqq has requests queued and it has enough budget left to * serve them, keep the queue, otherwise expire it. */ if (next_rq) { if (bfq_serv_to_charge(next_rq, bfqq) > bfq_bfqq_budget_left(bfqq)) { /* * Expire the queue for budget exhaustion, * which makes sure that the next budget is * enough to serve the next request, even if * it comes from the fifo expired path. */ reason = BFQQE_BUDGET_EXHAUSTED; goto expire; } else { /* * The idle timer may be pending because we may * not disable disk idling even when a new request * arrives. */ if (bfq_bfqq_wait_request(bfqq)) { /* * If we get here: 1) at least a new request * has arrived but we have not disabled the * timer because the request was too small, * 2) then the block layer has unplugged * the device, causing the dispatch to be * invoked. * * Since the device is unplugged, now the * requests are probably large enough to * provide a reasonable throughput. * So we disable idling. */ bfq_clear_bfqq_wait_request(bfqq); hrtimer_try_to_cancel(&bfqd->idle_slice_timer); } goto keep_queue; } } /* * No requests pending. However, if the in-service queue is idling * for a new request, or has requests waiting for a completion and * may idle after their completion, then keep it anyway. * * Yet, inject service from other queues if it boosts * throughput and is possible. */ if (bfq_bfqq_wait_request(bfqq) || (bfqq->dispatched != 0 && bfq_better_to_idle(bfqq))) { struct bfq_queue *async_bfqq = bfqq->bic && bfqq->bic->bfqq[0] && bfq_bfqq_busy(bfqq->bic->bfqq[0]) && bfqq->bic->bfqq[0]->next_rq ? bfqq->bic->bfqq[0] : NULL; /* * The next three mutually-exclusive ifs decide * whether to try injection, and choose the queue to * pick an I/O request from. * * The first if checks whether the process associated * with bfqq has also async I/O pending. If so, it * injects such I/O unconditionally. Injecting async * I/O from the same process can cause no harm to the * process. On the contrary, it can only increase * bandwidth and reduce latency for the process. * * The second if checks whether there happens to be a * non-empty waker queue for bfqq, i.e., a queue whose * I/O needs to be completed for bfqq to receive new * I/O. This happens, e.g., if bfqq is associated with * a process that does some sync. A sync generates * extra blocking I/O, which must be completed before * the process associated with bfqq can go on with its * I/O. If the I/O of the waker queue is not served, * then bfqq remains empty, and no I/O is dispatched, * until the idle timeout fires for bfqq. This is * likely to result in lower bandwidth and higher * latencies for bfqq, and in a severe loss of total * throughput. The best action to take is therefore to * serve the waker queue as soon as possible. So do it * (without relying on the third alternative below for * eventually serving waker_bfqq's I/O; see the last * paragraph for further details). This systematic * injection of I/O from the waker queue does not * cause any delay to bfqq's I/O. On the contrary, * next bfqq's I/O is brought forward dramatically, * for it is not blocked for milliseconds. * * The third if checks whether bfqq is a queue for * which it is better to avoid injection. It is so if * bfqq delivers more throughput when served without * any further I/O from other queues in the middle, or * if the service times of bfqq's I/O requests both * count more than overall throughput, and may be * easily increased by injection (this happens if bfqq * has a short think time). If none of these * conditions holds, then a candidate queue for * injection is looked for through * bfq_choose_bfqq_for_injection(). Note that the * latter may return NULL (for example if the inject * limit for bfqq is currently 0). * * NOTE: motivation for the second alternative * * Thanks to the way the inject limit is updated in * bfq_update_has_short_ttime(), it is rather likely * that, if I/O is being plugged for bfqq and the * waker queue has pending I/O requests that are * blocking bfqq's I/O, then the third alternative * above lets the waker queue get served before the * I/O-plugging timeout fires. So one may deem the * second alternative superfluous. It is not, because * the third alternative may be way less effective in * case of a synchronization. For two main * reasons. First, throughput may be low because the * inject limit may be too low to guarantee the same * amount of injected I/O, from the waker queue or * other queues, that the second alternative * guarantees (the second alternative unconditionally * injects a pending I/O request of the waker queue * for each bfq_dispatch_request()). Second, with the * third alternative, the duration of the plugging, * i.e., the time before bfqq finally receives new I/O, * may not be minimized, because the waker queue may * happen to be served only after other queues. */ if (async_bfqq && icq_to_bic(async_bfqq->next_rq->elv.icq) == bfqq->bic && bfq_serv_to_charge(async_bfqq->next_rq, async_bfqq) <= bfq_bfqq_budget_left(async_bfqq)) bfqq = bfqq->bic->bfqq[0]; else if (bfq_bfqq_has_waker(bfqq) && bfq_bfqq_busy(bfqq->waker_bfqq) && bfqq->next_rq && bfq_serv_to_charge(bfqq->waker_bfqq->next_rq, bfqq->waker_bfqq) <= bfq_bfqq_budget_left(bfqq->waker_bfqq) ) bfqq = bfqq->waker_bfqq; else if (!idling_boosts_thr_without_issues(bfqd, bfqq) && (bfqq->wr_coeff == 1 || bfqd->wr_busy_queues > 1 || !bfq_bfqq_has_short_ttime(bfqq))) bfqq = bfq_choose_bfqq_for_injection(bfqd); else bfqq = NULL; goto keep_queue; } reason = BFQQE_NO_MORE_REQUESTS; expire: bfq_bfqq_expire(bfqd, bfqq, false, reason); new_queue: bfqq = bfq_set_in_service_queue(bfqd); if (bfqq) { bfq_log_bfqq(bfqd, bfqq, \"select_queue: checking new queue\"); goto check_queue; } keep_queue: if (bfqq) bfq_log_bfqq(bfqd, bfqq, \"select_queue: returned this queue\"); else bfq_log(bfqd, \"select_queue: no queue returned\"); return bfqq;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230084, "input": "void WriteOutputSlice(int64 begin, int64 end) override { std::vector combination(features_.size(), 0); for (int64 b = begin; b < end; ++b) { auto row_start = splits_out_(b); auto row_limit = splits_out_(b + 1); for (auto i = row_start; i < row_limit; ++i) { WriteCombination(b, combination, &values_out_(i)); NextCombination(b, &combination); } combination.assign(features_.size(), 0); // reset for next batch. } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 414524, "input": "rndr_paragraph(struct buf *ob, const struct buf *text, void *opaque) { struct html_renderopt *options = opaque; size_t i = 0; if (ob->size) bufputc(ob, '\\n'); if (!text || !text->size) return; while (i < text->size && isspace(text->data[i])) i++; if (i == text->size) return; BUFPUTSL(ob, \"

\"); if (options->flags & HTML_HARD_WRAP) { size_t org; while (i < text->size) { org = i; while (i < text->size && text->data[i] != '\\n') i++; if (i > org) bufput(ob, text->data + org, i - org); /* * do not insert a line break if this newline * is the last character on the paragraph */ if (i >= text->size - 1) break; rndr_linebreak(ob, opaque); i++; } } else { bufput(ob, &text->data[i], text->size - i); } BUFPUTSL(ob, \"

\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431168, "input": "nfs41_same_server_scope(struct nfs41_server_scope *a, struct nfs41_server_scope *b) { if (a->server_scope_sz != b->server_scope_sz) return false; return memcmp(a->server_scope, b->server_scope, a->server_scope_sz) == 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430754, "input": "UnicodeStringTest::TestStringEnumeration() { UnicodeString s; TestEnumeration ten; int32_t i, length; UErrorCode status; const UChar *pu; const char *pc; // test the next() default implementation and ensureCharsCapacity() for(i=0; ipool, \"{ \\\"keys\\\" : [\"); int i = 0; apr_byte_t first = TRUE; oidc_jose_error_t err; if (c->public_keys != NULL) { /* loop over the RSA public keys */ for (i = 0; i < c->public_keys->nelts; i++) { const oidc_jwk_t *jwk = ((const oidc_jwk_t**) c->public_keys->elts)[i]; char *s_json = NULL; if (oidc_jwk_to_json(r->pool, jwk, &s_json, &err) == TRUE) { jwks = apr_psprintf(r->pool, \"%s%s %s \", jwks, first ? \"\" : \",\", s_json); first = FALSE; } else { oidc_error(r, \"could not convert RSA JWK to JSON using oidc_jwk_to_json: %s\", oidc_jose_e2s(r->pool, err)); } } } // TODO: send stuff if first == FALSE? jwks = apr_psprintf(r->pool, \"%s ] }\", jwks); return oidc_util_http_send(r, jwks, strlen(jwks), OIDC_CONTENT_TYPE_JSON, OK); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399237, "input": "void license_free_binary_blob(LICENSE_BLOB* blob) { if (blob) { free(blob->data); free(blob); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410400, "input": "static int evaluate_permissions(struct libmnt_context *cxt) { struct libmnt_table *fstab; unsigned long u_flags = 0; const char *tgt, *src, *optstr; int rc = 0, ok = 0; struct libmnt_fs *fs; assert(cxt); assert(cxt->fs); assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); if (!mnt_context_is_restricted(cxt)) return 0; /* superuser mount */ DBG(CXT, ul_debugobj(cxt, \"umount: evaluating permissions\")); if (!mnt_context_tab_applied(cxt)) { DBG(CXT, ul_debugobj(cxt, \"cannot find %s in mtab and you are not root\", mnt_fs_get_target(cxt->fs))); goto eperm; } if (cxt->user_mountflags & MNT_MS_UHELPER) { /* on uhelper= mount option based helper */ rc = prepare_helper_from_options(cxt, \"uhelper\"); if (rc) return rc; if (cxt->helper) return 0; /* we'll call /sbin/umount. */ } /* * Check if this is a fuse mount for the current user, * if so then unmounting is allowed */ if (is_fuse_usermount(cxt, &rc)) { DBG(CXT, ul_debugobj(cxt, \"fuse user mount, umount is allowed\")); return 0; } if (rc) return rc; /* * User mounts have to be in /etc/fstab */ rc = mnt_context_get_fstab(cxt, &fstab); if (rc) return rc; tgt = mnt_fs_get_target(cxt->fs); src = mnt_fs_get_source(cxt->fs); if (mnt_fs_get_bindsrc(cxt->fs)) { src = mnt_fs_get_bindsrc(cxt->fs); DBG(CXT, ul_debugobj(cxt, \"umount: using bind source: %s\", src)); } /* If fstab contains the two lines * /dev/sda1 /mnt/zip auto user,noauto 0 0 * /dev/sda4 /mnt/zip auto user,noauto 0 0 * then \"mount /dev/sda4\" followed by \"umount /mnt/zip\" used to fail. * So, we must not look for the file, but for the pair (dev,file) in fstab. */ fs = mnt_table_find_pair(fstab, src, tgt, MNT_ITER_FORWARD); if (!fs) { /* * It's possible that there is /path/file.img in fstab and * /dev/loop0 in mtab -- then we have to check the relation * between loopdev and the file. */ fs = mnt_table_find_target(fstab, tgt, MNT_ITER_FORWARD); if (fs) { struct libmnt_cache *cache = mnt_context_get_cache(cxt); const char *sp = mnt_fs_get_srcpath(cxt->fs); /* devname from mtab */ const char *dev = sp && cache ? mnt_resolve_path(sp, cache) : sp; if (!dev || !is_associated_fs(dev, fs)) fs = NULL; } if (!fs) { DBG(CXT, ul_debugobj(cxt, \"umount %s: mtab disagrees with fstab\", tgt)); goto eperm; } } /* * User mounting and unmounting is allowed only if fstab contains one * of the options `user', `users' or `owner' or `group'. * * The option `users' allows arbitrary users to mount and unmount - * this may be a security risk. * * The options `user', `owner' and `group' only allow unmounting by the * user that mounted (visible in mtab). */ optstr = mnt_fs_get_user_options(fs); /* FSTAB mount options! */ if (!optstr) goto eperm; if (mnt_optstr_get_flags(optstr, &u_flags, mnt_get_builtin_optmap(MNT_USERSPACE_MAP))) goto eperm; if (u_flags & MNT_MS_USERS) { DBG(CXT, ul_debugobj(cxt, \"umount: promiscuous setting ('users') in fstab\")); return 0; } /* * Check user= setting from mtab if there is a user, owner or * group option in /etc/fstab */ if (u_flags & (MNT_MS_USER | MNT_MS_OWNER | MNT_MS_GROUP)) { char *curr_user; char *mtab_user = NULL; size_t sz; struct libmnt_ns *ns_old; DBG(CXT, ul_debugobj(cxt, \"umount: checking user= from mtab\")); ns_old = mnt_context_switch_origin_ns(cxt); if (!ns_old) return -MNT_ERR_NAMESPACE; curr_user = mnt_get_username(getuid()); if (!mnt_context_switch_ns(cxt, ns_old)) { free(curr_user); return -MNT_ERR_NAMESPACE; } if (!curr_user) { DBG(CXT, ul_debugobj(cxt, \"umount %s: cannot \" \"convert %d to username\", tgt, getuid())); goto eperm; } /* get options from mtab */ optstr = mnt_fs_get_user_options(cxt->fs); if (optstr && !mnt_optstr_get_option(optstr, \"user\", &mtab_user, &sz) && sz) ok = !strncmp(curr_user, mtab_user, sz); free(curr_user); } if (ok) { DBG(CXT, ul_debugobj(cxt, \"umount %s is allowed\", tgt)); return 0; } eperm: DBG(CXT, ul_debugobj(cxt, \"umount is not allowed for you\")); return -EPERM; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195217, "input": "mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b) { if (a->body.irep) { /* already initialized proc */ return; } a->flags = b->flags; a->body = b->body; a->upper = b->upper; if (!MRB_PROC_CFUNC_P(a) && a->body.irep) { mrb_irep_incref(mrb, (mrb_irep*)a->body.irep); } a->e.env = b->e.env; /* a->e.target_class = a->e.target_class; */ }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Heap-based Buffer Overflow"], "explanation": "mruby is vulnerable to Heap-based Buffer Overflow", "severity_level": "NoInfo", "cwe": "CWE-122", "cve": "CVE-2022-0080"}} -{"idx": 274265, "input": "static void ldapsrv_call_writev_start(struct ldapsrv_call *call) { struct ldapsrv_connection *conn = call->conn; struct ldapsrv_reply *reply = NULL; struct tevent_req *subreq = NULL; size_t length = 0; size_t i; call->iov_count = 0; /* build all the replies into an IOV (no copy) */ for (reply = call->replies; reply != NULL; reply = reply->next) { /* Cap output at 25MB per writev() */ if (length > length + reply->blob.length || length + reply->blob.length > LDAP_SERVER_MAX_CHUNK_SIZE) { break; } /* * Overflow is harmless here, just used below to * decide if to read or write, but checked above anyway */ length += reply->blob.length; /* * At worst an overflow would mean we send less * replies */ call->iov_count++; } if (length == 0) { if (!call->notification.busy) { TALLOC_FREE(call); } ldapsrv_call_read_next(conn); return; } /* Cap call->iov_count at IOV_MAX */ call->iov_count = MIN(call->iov_count, IOV_MAX); call->out_iov = talloc_array(call, struct iovec, call->iov_count); if (!call->out_iov) { /* This is not ideal */ ldapsrv_terminate_connection(conn, \"failed to allocate \" \"iovec array\"); return; } /* We may have had to cap the number of replies at IOV_MAX */ for (i = 0; i < call->iov_count && call->replies != NULL; i++) { reply = call->replies; call->out_iov[i].iov_base = reply->blob.data; call->out_iov[i].iov_len = reply->blob.length; /* Keep only the ASN.1 encoded data */ talloc_steal(call->out_iov, reply->blob.data); DLIST_REMOVE(call->replies, reply); TALLOC_FREE(reply); } if (i > call->iov_count) { /* This is not ideal, but also (essentially) impossible */ ldapsrv_terminate_connection(conn, \"call list ended\" \"before iov_count\"); return; } subreq = tstream_writev_queue_send(call, conn->connection->event.ctx, conn->sockets.active, conn->sockets.send_queue, call->out_iov, call->iov_count); if (subreq == NULL) { ldapsrv_terminate_connection(conn, \"stream_writev_queue_send failed\"); return; } tevent_req_set_callback(subreq, ldapsrv_call_writev_done, call); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219768, "input": "explicit MemoProfiler(int /*flags*/) : Profiler(true) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198559, "input": "file_continue(i_ctx_t *i_ctx_p) { os_ptr op = osp; es_ptr pscratch = esp - 2; file_enum *pfen = r_ptr(esp - 1, file_enum); int devlen = esp[-3].value.intval; gx_io_device *iodev = r_ptr(esp - 4, gx_io_device); uint len = r_size(pscratch); uint code; if (len < devlen) return_error(gs_error_rangecheck); /* not even room for device len */ memcpy((char *)pscratch->value.bytes, iodev->dname, devlen); code = iodev->procs.enumerate_next(pfen, (char *)pscratch->value.bytes + devlen, len - devlen); if (code == ~(uint) 0) { /* all done */ esp -= 5; /* pop proc, pfen, devlen, iodev , mark */ return o_pop_estack; } else if (code > len) /* overran string */ return_error(gs_error_rangecheck); else { push(1); ref_assign(op, pscratch); r_set_size(op, code + devlen); push_op_estack(file_continue); /* come again */ *++esp = pscratch[2]; /* proc */ return o_push_estack; } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "The getenv and filenameforall functions in Ghostscript 9.10 ignore the \"-dSAFER\" argument, which allows remote attackers to read data via a crafted postscript file.", "severity_level": "Medium", "cwe": "CWE-200", "cve": "CVE-2013-5653"}} -{"idx": 198370, "input": "Pong(const std::string& cookie, const std::string& server = \"\") : ClientProtocol::Message(\"PONG\", ServerInstance->Config->GetServerName()) { PushParamRef(ServerInstance->Config->GetServerName()); if (!server.empty()) PushParamRef(server); PushParamRef(cookie); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "InspIRCd 3.8.0 through 3.9.x before 3.10.0 allows any user (able to connect to the server) to access recently deallocated memory, aka the \"malformed PONG\" issue.", "severity_level": "NoInfo", "cwe": "CWE-200", "cve": "CVE-2021-33586"}} -{"idx": 323087, "input": "const char *x11_flags2str(uint16_t flags) { if (flags & X11_FORWARD_ALL) return \"all\"; if (flags & X11_FORWARD_BATCH) return \"batch\"; if (flags & X11_FORWARD_FIRST) return \"first\"; if (flags & X11_FORWARD_LAST) return \"last\"; return \"unset\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376814, "input": "static void avifDecoderDataResetCodec(avifDecoderData * data) { for (unsigned int i = 0; i < data->tiles.count; ++i) { avifTile * tile = &data->tiles.tile[i]; if (tile->image) { avifImageFreePlanes(tile->image, AVIF_PLANES_ALL); // forget any pointers into codec image buffers } if (tile->codec) { avifCodecDestroy(tile->codec); tile->codec = NULL; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 102026, "input": "ContentSettingsStore::~ContentSettingsStore() { STLDeleteValues(&entries_); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453322, "input": "static int __init bfq_init(void) { int ret; #ifdef CONFIG_BFQ_GROUP_IOSCHED ret = blkcg_policy_register(&blkcg_policy_bfq); if (ret) return ret; #endif ret = -ENOMEM; if (bfq_slab_setup()) goto err_pol_unreg; /* * Times to load large popular applications for the typical * systems installed on the reference devices (see the * comments before the definition of the next * array). Actually, we use slightly lower values, as the * estimated peak rate tends to be smaller than the actual * peak rate. The reason for this last fact is that estimates * are computed over much shorter time intervals than the long * intervals typically used for benchmarking. Why? First, to * adapt more quickly to variations. Second, because an I/O * scheduler cannot rely on a peak-rate-evaluation workload to * be run for a long time. */ ref_wr_duration[0] = msecs_to_jiffies(7000); /* actually 8 sec */ ref_wr_duration[1] = msecs_to_jiffies(2500); /* actually 3 sec */ ret = elv_register(&iosched_bfq_mq); if (ret) goto slab_kill; return 0; slab_kill: bfq_slab_kill(); err_pol_unreg: #ifdef CONFIG_BFQ_GROUP_IOSCHED blkcg_policy_unregister(&blkcg_policy_bfq); #endif return ret;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206998, "input": "static int xar_hash_check(int hash, const void * result, const void * expected) { int len; if (!result || !expected) return 1; switch (hash) { case XAR_CKSUM_SHA1: len = SHA1_HASH_SIZE; break; case XAR_CKSUM_MD5: len = CLI_HASH_MD5; break; case XAR_CKSUM_OTHER: case XAR_CKSUM_NONE: default: return 1; } return memcmp(result, expected, len); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "ClamAV version version 0.99.3 contains a Out of bounds heap memory read vulnerability in XAR parser, function xar_hash_check() that can result in Leaking of memory, may help in developing exploit chains.. This attack appear to be exploitable via The victim must scan a crafted XAR file. This vulnerability appears to have been fixed in after commit d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6.", "severity_level": "Medium", "cwe": "CWE-125", "cve": "CVE-2018-1000085"}} -{"idx": 240822, "input": "match(uid_t uid, gid_t *groups, int ngroups, uid_t target, const char *cmd, const char **cmdargs, struct rule *r) { int i; if (r->ident[0] == ':') { gid_t rgid; if (parsegid(r->ident + 1, &rgid) == -1) return 0; for (i = 0; i < ngroups; i++) { if (rgid == groups[i]) break; } if (i == ngroups) return 0; } else { if (uidcheck(r->ident, uid) != 0) return 0; } if (r->target && uidcheck(r->target, target) != 0) return 0; if (r->cmd) { if (strcmp(r->cmd, cmd)) return 0; if (r->cmdargs) { /* if arguments were given, they should match explicitly */ for (i = 0; r->cmdargs[i]; i++) { if (!cmdargs[i]) return 0; if (strcmp(r->cmdargs[i], cmdargs[i])) return 0; } if (cmdargs[i]) return 0; } } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230229, "input": "CallResult> JSObject::getComputedPropertyValue_RJS( Handle selfHandle, Runtime *runtime, Handle propObj, ComputedPropertyDescriptor desc) { assert( !selfHandle->flags_.proxyObject && !propObj->flags_.proxyObject && \"getComputedPropertyValue_RJS cannot be used with proxy objects\"); if (LLVM_LIKELY(!desc.flags.accessor)) return createPseudoHandle( getComputedSlotValue(propObj.get(), runtime, desc)); auto *accessor = vmcast( getComputedSlotValue(propObj.get(), runtime, desc)); if (!accessor->getter) return createPseudoHandle(HermesValue::encodeUndefinedValue()); // Execute the accessor on this object. return accessor->getter.get(runtime)->executeCall0( runtime->makeHandle(accessor->getter), runtime, selfHandle); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393071, "input": "TEST_F(QueryPlannerTest, CoveredSkipWithIndex) { addIndex(fromjson(\"{a: 1, b: 1}\")); runQuerySortProjSkipNToReturn( fromjson(\"{a: 5}\"), BSONObj(), fromjson(\"{_id: 0, a: 1, b: 1}\"), 8, 0); ASSERT_EQUALS(getNumSolutions(), 2U); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \" \"{skip: {n: 8, node: {cscan: {dir: 1, filter: {a: 5}}}}}}}\"); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1, b: 1}, \" \"node: {skip: {n: 8, node: {ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219507, "input": "Variant HHVM_FUNCTION(getimagesize, const String& filename, Array& imageinfo) { if (auto stream = File::Open(filename, \"rb\")) { return getImageSize(stream, imageinfo); } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364162, "input": "static inline int hugepage_init_sysfs(struct kobject **hugepage_kobj) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398147, "input": "static int sctp_setsockopt_maxburst(struct sock *sk, struct sctp_assoc_value *params, unsigned int optlen) { struct sctp_sock *sp = sctp_sk(sk); struct sctp_association *asoc; sctp_assoc_t assoc_id; u32 assoc_value; if (optlen == sizeof(int)) { pr_warn_ratelimited(DEPRECATED \"%s (pid %d) \" \"Use of int in max_burst socket option deprecated.\\n\" \"Use struct sctp_assoc_value instead\\n\", current->comm, task_pid_nr(current)); assoc_id = SCTP_FUTURE_ASSOC; assoc_value = *((int *)params); } else if (optlen == sizeof(struct sctp_assoc_value)) { assoc_id = params->assoc_id; assoc_value = params->assoc_value; } else return -EINVAL; asoc = sctp_id2assoc(sk, assoc_id); if (!asoc && assoc_id > SCTP_ALL_ASSOC && sctp_style(sk, UDP)) return -EINVAL; if (asoc) { asoc->max_burst = assoc_value; return 0; } if (sctp_style(sk, TCP)) assoc_id = SCTP_FUTURE_ASSOC; if (assoc_id == SCTP_FUTURE_ASSOC || assoc_id == SCTP_ALL_ASSOC) sp->max_burst = assoc_value; if (assoc_id == SCTP_CURRENT_ASSOC || assoc_id == SCTP_ALL_ASSOC) list_for_each_entry(asoc, &sp->ep->asocs, asocs) asoc->max_burst = assoc_value; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269051, "input": "R_API int r_sys_cmd_str_full(const char *cmd, const char *input, char **output, int *len, char **sterr) { char *mysterr = NULL; if (!sterr) { sterr = &mysterr; } char buffer[1024], *outputptr = NULL; char *inputptr = (char *)input; int pid, bytes = 0, status; int sh_in[2], sh_out[2], sh_err[2]; if (len) { *len = 0; } if (pipe (sh_in)) { return false; } if (output) { if (pipe (sh_out)) { close (sh_in[0]); close (sh_in[1]); close (sh_out[0]); close (sh_out[1]); return false; } } if (pipe (sh_err)) { close (sh_in[0]); close (sh_in[1]); return false; } switch ((pid = r_sys_fork ())) { case -1: return false; case 0: dup2 (sh_in[0], 0); close (sh_in[0]); close (sh_in[1]); if (output) { dup2 (sh_out[1], 1); close (sh_out[0]); close (sh_out[1]); } if (sterr) { dup2 (sh_err[1], 2); } else { close (2); } close (sh_err[0]); close (sh_err[1]); exit (r_sandbox_system (cmd, 0)); default: outputptr = strdup (\"\"); if (!outputptr) { return false; } if (sterr) { *sterr = strdup (\"\"); if (!*sterr) { free (outputptr); return false; } } if (output) { close (sh_out[1]); } close (sh_err[1]); close (sh_in[0]); if (!inputptr || !*inputptr) { close (sh_in[1]); } // we should handle broken pipes somehow better r_sys_signal (SIGPIPE, SIG_IGN); size_t err_len = 0, out_len = 0; for (;;) { fd_set rfds, wfds; int nfd; FD_ZERO (&rfds); FD_ZERO (&wfds); if (output) { FD_SET (sh_out[0], &rfds); } if (sterr) { FD_SET (sh_err[0], &rfds); } if (inputptr && *inputptr) { FD_SET (sh_in[1], &wfds); } memset (buffer, 0, sizeof (buffer)); nfd = select (sh_err[0] + 1, &rfds, &wfds, NULL, NULL); if (nfd < 0) { break; } if (output && FD_ISSET (sh_out[0], &rfds)) { if ((bytes = read (sh_out[0], buffer, sizeof (buffer))) < 1) { break; } char *tmp = realloc (outputptr, out_len + bytes + 1); if (!tmp) { R_FREE (outputptr); break; } outputptr = tmp; memcpy (outputptr + out_len, buffer, bytes); out_len += bytes; } else if (FD_ISSET (sh_err[0], &rfds) && sterr) { if ((bytes = read (sh_err[0], buffer, sizeof (buffer))) < 1) { break; } char *tmp = realloc (*sterr, err_len + bytes + 1); if (!tmp) { R_FREE (*sterr); break; } *sterr = tmp; memcpy (*sterr + err_len, buffer, bytes); err_len += bytes; } else if (FD_ISSET (sh_in[1], &wfds) && inputptr && *inputptr) { int inputptr_len = strlen (inputptr); bytes = write (sh_in[1], inputptr, inputptr_len); if (bytes != inputptr_len) { break; } inputptr += bytes; if (!*inputptr) { close (sh_in[1]); /* If neither stdout nor stderr should be captured, * abort now - nothing more to do for select(). */ if (!output && !sterr) { break; } } } } if (output) { close (sh_out[0]); } close (sh_err[0]); close (sh_in[1]); waitpid (pid, &status, 0); bool ret = true; if (status) { // char *escmd = r_str_escape (cmd); // eprintf (\"error code %d (%s): %s\\n\", WEXITSTATUS (status), escmd, *sterr); // eprintf (\"(%s)\\n\", output); // eprintf (\"%s: failed command '%s'\\n\", __func__, escmd); // free (escmd); ret = false; } if (len) { *len = out_len; } if (*sterr) { (*sterr)[err_len] = 0; } if (outputptr) { outputptr[out_len] = 0; } if (output) { *output = outputptr; } else { free (outputptr); } return ret; } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219174, "input": "Variant HHVM_FUNCTION(imagecreatefromgd2part, const String& filename, int64_t srcx, int64_t srcy, int64_t width, int64_t height) { gdImagePtr im = _php_image_create_from(filename, srcx, srcy, width, height, PHP_GDIMG_TYPE_GD2PART, \"GD2\", (gdImagePtr(*)())gdImageCreateFromGd2Part, (gdImagePtr(*)())gdImageCreateFromGd2PartCtx); if (im == nullptr) { return false; } return Variant(req::make(im)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 341887, "input": "static inline unsigned int fuse_wr_pages(loff_t pos, size_t len, unsigned int max_pages) { return min_t(unsigned int, ((pos + len - 1) >> PAGE_SHIFT) - (pos >> PAGE_SHIFT) + 1, max_pages); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378643, "input": "int sqlite3VdbeTransferError(Vdbe *p){ sqlite3 *db = p->db; int rc = p->rc; if( p->zErrMsg ){ db->bBenignMalloc++; sqlite3BeginBenignMalloc(); if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db); sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); sqlite3EndBenignMalloc(); db->bBenignMalloc--; }else if( db->pErr ){ sqlite3ValueSetNull(db->pErr); } db->errCode = rc; return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338692, "input": "static void io_req_free_batch(struct req_batch *rb, struct io_kiocb *req, struct io_submit_state *state) { io_queue_next(req); io_dismantle_req(req); if (req->task != rb->task) { if (rb->task) io_put_task(rb->task, rb->task_refs); rb->task = req->task; rb->task_refs = 0; } rb->task_refs++; rb->ctx_refs++; if (state->free_reqs != ARRAY_SIZE(state->reqs)) state->reqs[state->free_reqs++] = req; else list_add(&req->compl.list, &state->comp.free_list); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 483007, "input": "struct dpp *dcn20_dpp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dpp *dpp = kzalloc(sizeof(struct dcn20_dpp), GFP_KERNEL); if (!dpp) return NULL; if (dpp2_construct(dpp, ctx, inst, &tf_regs[inst], &tf_shift, &tf_mask)) return &dpp->base; BREAK_TO_DEBUGGER(); kfree(dpp); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461665, "input": "static int rsi_mac80211_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_channel *chan, int duration, enum ieee80211_roc_type type) { struct rsi_hw *adapter = (struct rsi_hw *)hw->priv; struct rsi_common *common = (struct rsi_common *)adapter->priv; int status = 0; rsi_dbg(INFO_ZONE, \"***** Remain on channel *****\\n\"); mutex_lock(&common->mutex); rsi_dbg(INFO_ZONE, \"%s: channel: %d duration: %dms\\n\", __func__, chan->hw_value, duration); if (timer_pending(&common->roc_timer)) { rsi_dbg(INFO_ZONE, \"Stop on-going ROC\\n\"); del_timer(&common->roc_timer); } common->roc_timer.expires = msecs_to_jiffies(duration) + jiffies; add_timer(&common->roc_timer); /* Configure band */ if (rsi_band_check(common, chan)) { rsi_dbg(ERR_ZONE, \"Failed to set band\\n\"); status = -EINVAL; goto out; } /* Configure channel */ if (rsi_set_channel(common, chan)) { rsi_dbg(ERR_ZONE, \"Failed to set the channel\\n\"); status = -EINVAL; goto out; } common->roc_vif = vif; ieee80211_ready_on_channel(hw); rsi_dbg(INFO_ZONE, \"%s: Ready on channel :%d\\n\", __func__, chan->hw_value); out: mutex_unlock(&common->mutex); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422600, "input": "TEST(EqOp, MatchesReferencedObjectValue) { BSONObj operand = BSON(\"a.b\" << 5); EqualityMatchExpression eq(\"a.b\", operand[\"a.b\"]); ASSERT(eq.matchesBSON(BSON(\"a\" << BSON(\"b\" << 5)), NULL)); ASSERT(eq.matchesBSON(BSON(\"a\" << BSON(\"b\" << BSON_ARRAY(5))), NULL)); ASSERT(eq.matchesBSON(BSON(\"a\" << BSON_ARRAY(BSON(\"b\" << 5))), NULL)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 473425, "input": "void crypto_reverse(BYTE* data, int length) { int i, j; BYTE temp; for (i = 0, j = length - 1; i < j; i++, j--) { temp = data[i]; data[i] = data[j]; data[j] = temp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508587, "input": "end_write_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), bool end_of_records) { TABLE *table= join_tab->table; int idx= -1; DBUG_ENTER(\"end_write_group\"); if (!join->first_record || end_of_records || (idx=test_if_group_changed(join->group_fields)) >= 0) { if (join->first_record || (end_of_records && !join->group)) { if (join->procedure) join->procedure->end_group(); int send_group_parts= join->send_group_parts; if (idx < send_group_parts) { if (!join->first_record) { /* No matching rows for group function */ join->clear(); } copy_sum_funcs(join->sum_funcs, join->sum_funcs_end[send_group_parts]); if (!join_tab->having || join_tab->having->val_int()) { int error= table->file->ha_write_tmp_row(table->record[0]); if (unlikely(error) && create_internal_tmp_table_from_heap(join->thd, table, join_tab->tmp_table_param->start_recinfo, &join_tab->tmp_table_param->recinfo, error, 0, NULL)) DBUG_RETURN(NESTED_LOOP_ERROR); } if (unlikely(join->rollup.state != ROLLUP::STATE_NONE)) { if (unlikely(join->rollup_write_data((uint) (idx+1), join_tab->tmp_table_param, table))) { DBUG_RETURN(NESTED_LOOP_ERROR); } } if (end_of_records) goto end; } } else { if (end_of_records) goto end; join->first_record=1; (void) test_if_group_changed(join->group_fields); } if (idx < (int) join->send_group_parts) { copy_fields(join_tab->tmp_table_param); if (unlikely(copy_funcs(join_tab->tmp_table_param->items_to_copy, join->thd))) DBUG_RETURN(NESTED_LOOP_ERROR); if (unlikely(init_sum_functions(join->sum_funcs, join->sum_funcs_end[idx+1]))) DBUG_RETURN(NESTED_LOOP_ERROR); if (unlikely(join->procedure)) join->procedure->add(); goto end; } } if (unlikely(update_sum_func(join->sum_funcs))) DBUG_RETURN(NESTED_LOOP_ERROR); if (unlikely(join->procedure)) join->procedure->add(); end: if (unlikely(join->thd->check_killed())) { DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ } DBUG_RETURN(NESTED_LOOP_OK); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506608, "input": "MOVE_null(unsigned int x, unsigned int y) { (void) x; /* avoid -Wunused warning */ (void) y; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 199993, "input": "void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0) { int x,y,w,v,z; int x1, y1, w1, h1; int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2; unsigned char *srcptr, *dstptr; /* Nothing to do!!! */ if (screen==ptr) return; x1 = x0; y1 = y0; w1 = w0; h1 = h0; rfbScaledCorrection(screen, ptr, &x1, &y1, &w1, &h1, \"rfbScaledScreenUpdateRect\"); x0 = ScaleX(ptr, screen, x1); y0 = ScaleY(ptr, screen, y1); w0 = ScaleX(ptr, screen, w1); h0 = ScaleY(ptr, screen, h1); bitsPerPixel = screen->bitsPerPixel; bytesPerPixel = bitsPerPixel / 8; bytesPerLine = w1 * bytesPerPixel; srcptr = (unsigned char *)(screen->frameBuffer + (y0 * screen->paddedWidthInBytes + x0 * bytesPerPixel)); dstptr = (unsigned char *)(ptr->frameBuffer + ( y1 * ptr->paddedWidthInBytes + x1 * bytesPerPixel)); /* The area of the source framebuffer for each destination pixel */ areaX = ScaleX(ptr,screen,1); areaY = ScaleY(ptr,screen,1); area2 = areaX*areaY; /* Ensure that we do not go out of bounds */ if ((x1+w1) > (ptr->width)) { if (x1==0) w1=ptr->width; else x1 = ptr->width - w1; } if ((y1+h1) > (ptr->height)) { if (y1==0) h1=ptr->height; else y1 = ptr->height - h1; } /* * rfbLog(\"rfbScaledScreenUpdateRect(%dXx%dY-%dWx%dH -> %dXx%dY-%dWx%dH <%dx%d>) {%dWx%dH -> %dWx%dH} 0x%p\\n\", * x0, y0, w0, h0, x1, y1, w1, h1, areaX, areaY, * screen->width, screen->height, ptr->width, ptr->height, ptr->frameBuffer); */ if (screen->serverFormat.trueColour) { /* Blend neighbouring pixels together */ unsigned char *srcptr2; unsigned long pixel_value, red, green, blue; unsigned int redShift = screen->serverFormat.redShift; unsigned int greenShift = screen->serverFormat.greenShift; unsigned int blueShift = screen->serverFormat.blueShift; unsigned long redMax = screen->serverFormat.redMax; unsigned long greenMax = screen->serverFormat.greenMax; unsigned long blueMax = screen->serverFormat.blueMax; /* for each *destination* pixel... */ for (y = 0; y < h1; y++) { for (x = 0; x < w1; x++) { red = green = blue = 0; /* Get the totals for rgb from the source grid... */ for (w = 0; w < areaX; w++) { for (v = 0; v < areaY; v++) { srcptr2 = &srcptr[(((x * areaX) + w) * bytesPerPixel) + (v * screen->paddedWidthInBytes)]; pixel_value = 0; switch (bytesPerPixel) { case 4: pixel_value = *((unsigned int *)srcptr2); break; case 2: pixel_value = *((unsigned short *)srcptr2); break; case 1: pixel_value = *((unsigned char *)srcptr2); break; default: /* fixme: endianness problem? */ for (z = 0; z < bytesPerPixel; z++) pixel_value += (srcptr2[z] << (8 * z)); break; } /* srcptr2 += bytesPerPixel; */ red += ((pixel_value >> redShift) & redMax); green += ((pixel_value >> greenShift) & greenMax); blue += ((pixel_value >> blueShift) & blueMax); } } /* We now have a total for all of the colors, find the average! */ red /= area2; green /= area2; blue /= area2; /* Stuff the new value back into memory */ pixel_value = ((red & redMax) << redShift) | ((green & greenMax) << greenShift) | ((blue & blueMax) << blueShift); switch (bytesPerPixel) { case 4: *((unsigned int *)dstptr) = (unsigned int) pixel_value; break; case 2: *((unsigned short *)dstptr) = (unsigned short) pixel_value; break; case 1: *((unsigned char *)dstptr) = (unsigned char) pixel_value; break; default: /* fixme: endianness problem? */ for (z = 0; z < bytesPerPixel; z++) dstptr[z]=(pixel_value >> (8 * z)) & 0xff; break; } dstptr += bytesPerPixel; } srcptr += (screen->paddedWidthInBytes * areaY); dstptr += (ptr->paddedWidthInBytes - bytesPerLine); } } else { /* Not truecolour, so we can't blend. Just use the top-left pixel instead */ for (y = y1; y < (y1+h1); y++) { for (x = x1; x < (x1+w1); x++) memcpy (&ptr->frameBuffer[(y *ptr->paddedWidthInBytes) + (x * bytesPerPixel)], &screen->frameBuffer[(y * areaY * screen->paddedWidthInBytes) + (x *areaX * bytesPerPixel)], bytesPerPixel); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "An issue was discovered in LibVNCServer before 0.9.13. libvncserver/scale.c has a pixel_value integer overflow.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-14401"}} -{"idx": 219148, "input": "static bool string_substr_check(int len, int& f, int& l) { assertx(len >= 0); if (l < 0 && -l > len) { return false; } if (f >= len) { return false; } if (l > len) { l = len; } if (f < 0 && -f > len) { f = 0; if (len == 0) { return false; } } if (l < 0 && l + len < f) { return false; } // If \"from\" position is negative, count start position from the end. if (f < 0) { f += len; } assertx(f >= 0); // If \"length\" position is negative, set it to the length needed to stop that // many chars from the end of the string. if (l < 0) { l += len - f; if (l < 0) { l = 0; } } assertx(l >= 0); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269196, "input": "BITMAP_UPDATE* copy_bitmap_update(rdpContext* context, const BITMAP_UPDATE* pointer) { BITMAP_UPDATE* dst = calloc(1, sizeof(BITMAP_UPDATE)); if (!dst || !pointer) goto fail; *dst = *pointer; dst->rectangles = copy_bitmap_data(pointer->rectangles, pointer->number); if (!dst->rectangles) goto fail; return dst; fail: free_bitmap_update(context, dst); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208276, "input": "static int flattenSubquery( Parse *pParse, /* Parsing context */ Select *p, /* The parent or outer SELECT statement */ int iFrom, /* Index in p->pSrc->a[] of the inner subquery */ int isAgg /* True if outer SELECT uses aggregate functions */ ){ const char *zSavedAuthContext = pParse->zAuthContext; Select *pParent; /* Current UNION ALL term of the other query */ Select *pSub; /* The inner query or \"subquery\" */ Select *pSub1; /* Pointer to the rightmost select in sub-query */ SrcList *pSrc; /* The FROM clause of the outer query */ SrcList *pSubSrc; /* The FROM clause of the subquery */ int iParent; /* VDBE cursor number of the pSub result set temp table */ int iNewParent = -1;/* Replacement table for iParent */ int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */ int i; /* Loop counter */ Expr *pWhere; /* The WHERE clause */ struct SrcList_item *pSubitem; /* The subquery */ sqlite3 *db = pParse->db; /* Check to see if flattening is permitted. Return 0 if not. */ assert( p!=0 ); assert( p->pPrior==0 ); if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0; pSrc = p->pSrc; assert( pSrc && iFrom>=0 && iFromnSrc ); pSubitem = &pSrc->a[iFrom]; iParent = pSubitem->iCursor; pSub = pSubitem->pSelect; assert( pSub!=0 ); #ifndef SQLITE_OMIT_WINDOWFUNC if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */ #endif pSubSrc = pSub->pSrc; assert( pSubSrc ); /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET ** became arbitrary expressions, we were forced to add restrictions (13) ** and (14). */ if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */ if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */ if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){ return 0; /* Restriction (15) */ } if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */ if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */ if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){ return 0; /* Restrictions (8)(9) */ } if( p->pOrderBy && pSub->pOrderBy ){ return 0; /* Restriction (11) */ } if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */ if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */ if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){ return 0; /* Restriction (21) */ } if( pSub->selFlags & (SF_Recursive) ){ return 0; /* Restrictions (22) */ } /* ** If the subquery is the right operand of a LEFT JOIN, then the ** subquery may not be a join itself (3a). Example of why this is not ** allowed: ** ** t1 LEFT OUTER JOIN (t2 JOIN t3) ** ** If we flatten the above, we would get ** ** (t1 LEFT OUTER JOIN t2) JOIN t3 ** ** which is not at all the same thing. ** ** If the subquery is the right operand of a LEFT JOIN, then the outer ** query cannot be an aggregate. (3c) This is an artifact of the way ** aggregates are processed - there is no mechanism to determine if ** the LEFT JOIN table should be all-NULL. ** ** See also tickets #306, #350, and #3300. */ if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){ isLeftJoin = 1; if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){ /* (3a) (3c) (3b) */ return 0; } } #ifdef SQLITE_EXTRA_IFNULLROW else if( iFrom>0 && !isAgg ){ /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for ** every reference to any result column from subquery in a join, even ** though they are not necessary. This will stress-test the OP_IfNullRow ** opcode. */ isLeftJoin = -1; } #endif /* Restriction (17): If the sub-query is a compound SELECT, then it must ** use only the UNION ALL operator. And none of the simple select queries ** that make up the compound SELECT are allowed to be aggregate or distinct ** queries. */ if( pSub->pPrior ){ if( pSub->pOrderBy ){ return 0; /* Restriction (20) */ } if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){ return 0; /* (17d1), (17d2), or (17d3) */ } for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){ testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct ); testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate ); assert( pSub->pSrc!=0 ); assert( pSub->pEList->nExpr==pSub1->pEList->nExpr ); if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */ || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */ || pSub1->pSrc->nSrc<1 /* (17c) */ ){ return 0; } testcase( pSub1->pSrc->nSrc>1 ); } /* Restriction (18). */ if( p->pOrderBy ){ int ii; for(ii=0; iipOrderBy->nExpr; ii++){ if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0; } } } /* Ex-restriction (23): ** The only way that the recursive part of a CTE can contain a compound ** subquery is for the subquery to be one term of a join. But if the ** subquery is a join, then the flattening has already been stopped by ** restriction (17d3) */ assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 ); /***** If we reach this point, flattening is permitted. *****/ SELECTTRACE(1,pParse,p,(\"flatten %u.%p from term %d\\n\", pSub->selId, pSub, iFrom)); /* Authorize the subquery */ pParse->zAuthContext = pSubitem->zName; TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0); testcase( i==SQLITE_DENY ); pParse->zAuthContext = zSavedAuthContext; /* If the sub-query is a compound SELECT statement, then (by restrictions ** 17 and 18 above) it must be a UNION ALL and the parent query must ** be of the form: ** ** SELECT FROM () ** ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or ** OFFSET clauses and joins them to the left-hand-side of the original ** using UNION ALL operators. In this case N is the number of simple ** select statements in the compound sub-query. ** ** Example: ** ** SELECT a+1 FROM ( ** SELECT x FROM tab ** UNION ALL ** SELECT y FROM tab ** UNION ALL ** SELECT abs(z*2) FROM tab2 ** ) WHERE a!=5 ORDER BY 1 ** ** Transformed into: ** ** SELECT x+1 FROM tab WHERE x+1!=5 ** UNION ALL ** SELECT y+1 FROM tab WHERE y+1!=5 ** UNION ALL ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5 ** ORDER BY 1 ** ** We call this the \"compound-subquery flattening\". */ for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){ Select *pNew; ExprList *pOrderBy = p->pOrderBy; Expr *pLimit = p->pLimit; Select *pPrior = p->pPrior; p->pOrderBy = 0; p->pSrc = 0; p->pPrior = 0; p->pLimit = 0; pNew = sqlite3SelectDup(db, p, 0); p->pLimit = pLimit; p->pOrderBy = pOrderBy; p->pSrc = pSrc; p->op = TK_ALL; if( pNew==0 ){ p->pPrior = pPrior; }else{ pNew->pPrior = pPrior; if( pPrior ) pPrior->pNext = pNew; pNew->pNext = p; p->pPrior = pNew; SELECTTRACE(2,pParse,p,(\"compound-subquery flattener\" \" creates %u as peer\\n\",pNew->selId)); } if( db->mallocFailed ) return 1; } /* Begin flattening the iFrom-th entry of the FROM clause ** in the outer query. */ pSub = pSub1 = pSubitem->pSelect; /* Delete the transient table structure associated with the ** subquery */ sqlite3DbFree(db, pSubitem->zDatabase); sqlite3DbFree(db, pSubitem->zName); sqlite3DbFree(db, pSubitem->zAlias); pSubitem->zDatabase = 0; pSubitem->zName = 0; pSubitem->zAlias = 0; pSubitem->pSelect = 0; /* Defer deleting the Table object associated with the ** subquery until code generation is ** complete, since there may still exist Expr.pTab entries that ** refer to the subquery even after flattening. Ticket #3346. ** ** pSubitem->pTab is always non-NULL by test restrictions and tests above. */ if( ALWAYS(pSubitem->pTab!=0) ){ Table *pTabToDel = pSubitem->pTab; if( pTabToDel->nTabRef==1 ){ Parse *pToplevel = sqlite3ParseToplevel(pParse); pTabToDel->pNextZombie = pToplevel->pZombieTab; pToplevel->pZombieTab = pTabToDel; }else{ pTabToDel->nTabRef--; } pSubitem->pTab = 0; } /* The following loop runs once for each term in a compound-subquery ** flattening (as described above). If we are doing a different kind ** of flattening - a flattening other than a compound-subquery flattening - ** then this loop only runs once. ** ** This loop moves all of the FROM elements of the subquery into the ** the FROM clause of the outer query. Before doing this, remember ** the cursor number for the original outer query FROM element in ** iParent. The iParent cursor will never be used. Subsequent code ** will scan expressions looking for iParent references and replace ** those references with expressions that resolve to the subquery FROM ** elements we are now copying in. */ for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){ int nSubSrc; u8 jointype = 0; assert( pSub!=0 ); pSubSrc = pSub->pSrc; /* FROM clause of subquery */ nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */ pSrc = pParent->pSrc; /* FROM clause of the outer query */ if( pSrc ){ assert( pParent==p ); /* First time through the loop */ jointype = pSubitem->fg.jointype; }else{ assert( pParent!=p ); /* 2nd and subsequent times through the loop */ pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); if( pSrc==0 ) break; pParent->pSrc = pSrc; } /* The subquery uses a single slot of the FROM clause of the outer ** query. If the subquery has more than one element in its FROM clause, ** then expand the outer query to make space for it to hold all elements ** of the subquery. ** ** Example: ** ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB; ** ** The outer query has 3 slots in its FROM clause. One slot of the ** outer query (the middle slot) is used by the subquery. The next ** block of code will expand the outer query FROM clause to 4 slots. ** The middle slot is expanded to two slots in order to make space ** for the two elements in the FROM clause of the subquery. */ if( nSubSrc>1 ){ pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1); if( pSrc==0 ) break; pParent->pSrc = pSrc; } /* Transfer the FROM clause terms from the subquery into the ** outer query. */ for(i=0; ia[i+iFrom].pUsing); assert( pSrc->a[i+iFrom].fg.isTabFunc==0 ); pSrc->a[i+iFrom] = pSubSrc->a[i]; iNewParent = pSubSrc->a[i].iCursor; memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i])); } pSrc->a[iFrom].fg.jointype = jointype; /* Now begin substituting subquery result set expressions for ** references to the iParent in the outer query. ** ** Example: ** ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b; ** \\ \\_____________ subquery __________/ / ** \\_____________________ outer query ______________________________/ ** ** We look at every expression in the outer query and every place we see ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\". */ if( pSub->pOrderBy ){ /* At this point, any non-zero iOrderByCol values indicate that the ** ORDER BY column expression is identical to the iOrderByCol'th ** expression returned by SELECT statement pSub. Since these values ** do not necessarily correspond to columns in SELECT statement pParent, ** zero them before transfering the ORDER BY clause. ** ** Not doing this may cause an error if a subsequent call to this ** function attempts to flatten a compound sub-query into pParent ** (the only way this can happen is if the compound sub-query is ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */ ExprList *pOrderBy = pSub->pOrderBy; for(i=0; inExpr; i++){ pOrderBy->a[i].u.x.iOrderByCol = 0; } assert( pParent->pOrderBy==0 ); pParent->pOrderBy = pOrderBy; pSub->pOrderBy = 0; } pWhere = pSub->pWhere; pSub->pWhere = 0; if( isLeftJoin>0 ){ sqlite3SetJoinExpr(pWhere, iNewParent); } pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere); if( db->mallocFailed==0 ){ SubstContext x; x.pParse = pParse; x.iTable = iParent; x.iNewTable = iNewParent; x.isLeftJoin = isLeftJoin; x.pEList = pSub->pEList; substSelect(&x, pParent, 0); } /* The flattened query is a compound if either the inner or the ** outer query is a compound. */ pParent->selFlags |= pSub->selFlags & SF_Compound; assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */ /* ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; ** ** One is tempted to try to add a and b to combine the limits. But this ** does not work if either limit is negative. */ if( pSub->pLimit ){ pParent->pLimit = pSub->pLimit; pSub->pLimit = 0; } } /* Finially, delete what is left of the subquery and return ** success. */ sqlite3SelectDelete(db, pSub1); #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\")); sqlite3TreeViewSelect(0, p, 0); } #endif return 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "flattenSubquery in select.c in SQLite 3.30.1 mishandles certain uses of SELECT DISTINCT involving a LEFT JOIN in which the right-hand side is a view. This can cause a NULL pointer dereference (or incorrect results).", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2019-19923"}} -{"idx": 267193, "input": "GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, const GF_SLConfig *slConfig) { GF_TrackBox *trak; GF_SampleEntryBox *entry; GF_Err e; GF_SLConfig **slc; GF_ESDBox *esds; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak) return GF_BAD_PARAM; e = Media_GetSampleDesc(trak->Media, StreamDescriptionIndex, &entry, NULL); if (e) return e; //we must be sure we are not using a remote ESD switch (entry->type) { case GF_ISOM_BOX_TYPE_MP4S: esds = ((GF_MPEGSampleEntryBox *)entry)->esd; if (!esds || !esds->desc || !esds->desc->slConfig || (esds->desc->slConfig->predefined != SLPredef_MP4)) return GF_ISOM_INVALID_FILE; slc = & ((GF_MPEGSampleEntryBox *)entry)->slc; break; case GF_ISOM_BOX_TYPE_MP4A: esds = ((GF_MPEGAudioSampleEntryBox *)entry)->esd; if (!esds || !esds->desc || !esds->desc->slConfig || (esds->desc->slConfig->predefined != SLPredef_MP4)) return GF_ISOM_INVALID_FILE; slc = & ((GF_MPEGAudioSampleEntryBox *)entry)->slc; break; case GF_ISOM_BOX_TYPE_MP4V: esds = ((GF_MPEGVisualSampleEntryBox *)entry)->esd; if (!esds || !esds->desc || !esds->desc->slConfig || (esds->desc->slConfig->predefined != SLPredef_MP4)) return GF_ISOM_INVALID_FILE; slc = & ((GF_MPEGVisualSampleEntryBox *)entry)->slc; break; default: return GF_BAD_PARAM; } if (*slc) { gf_odf_desc_del((GF_Descriptor *)*slc); *slc = NULL; } if (!slConfig) return GF_OK; //finally duplicate the SL return gf_odf_desc_copy((GF_Descriptor *) slConfig, (GF_Descriptor **) slc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 205872, "input": "GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n, size_t lb, GC_descr d) { word *op; size_t lg; GC_descr simple_descr; complex_descriptor *complex_descr; int descr_type; struct LeafDescriptor leaf; GC_ASSERT(GC_explicit_typing_initialized); descr_type = GC_make_array_descriptor((word)n, (word)lb, d, &simple_descr, &complex_descr, &leaf); switch(descr_type) { case NO_MEM: return(0); case SIMPLE: return(GC_malloc_explicitly_typed(n*lb, simple_descr)); case LEAF: lb *= n; lb += sizeof(struct LeafDescriptor) + TYPD_EXTRA_BYTES; break; case COMPLEX: lb *= n; lb += TYPD_EXTRA_BYTES; break; } op = GC_malloc_kind(lb, GC_array_kind); if (EXPECT(NULL == op, FALSE)) return NULL; lg = SMALL_OBJ(lb) ? GC_size_map[lb] : BYTES_TO_GRANULES(GC_size(op)); if (descr_type == LEAF) { /* Set up the descriptor inside the object itself. */ volatile struct LeafDescriptor * lp = (struct LeafDescriptor *) (op + GRANULES_TO_WORDS(lg) - (BYTES_TO_WORDS(sizeof(struct LeafDescriptor)) + 1)); lp -> ld_tag = LEAF_TAG; lp -> ld_size = leaf.ld_size; lp -> ld_nelements = leaf.ld_nelements; lp -> ld_descriptor = leaf.ld_descriptor; ((volatile word *)op)[GRANULES_TO_WORDS(lg) - 1] = (word)lp; } else { # ifndef GC_NO_FINALIZATION size_t lw = GRANULES_TO_WORDS(lg); op[lw - 1] = (word)complex_descr; /* Make sure the descriptor is cleared once there is any danger */ /* it may have been collected. */ if (EXPECT(GC_general_register_disappearing_link( (void **)(op + lw - 1), op) == GC_NO_MEMORY, FALSE)) # endif { /* Couldn't register it due to lack of memory. Punt. */ /* This will probably fail too, but gives the recovery code */ /* a chance. */ return GC_malloc(lb); } } return op; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "Integer overflow vulnerability in bdwgc before 2016-09-27 allows attackers to cause client of bdwgc denial of service (heap buffer overflow crash) and possibly execute arbitrary code via huge allocation.", "severity_level": "NoInfo", "cwe": "CWE-119", "cve": "CVE-2016-9427"}} -{"idx": 270130, "input": "static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) { H264Context *h = dst->priv_data, *h1 = src->priv_data; int inited = h->context_initialized, err = 0; int context_reinitialized = 0; int i, ret; if (dst == src) return 0; if (inited && (h->width != h1->width || h->height != h1->height || h->mb_width != h1->mb_width || h->mb_height != h1->mb_height || h->sps.bit_depth_luma != h1->sps.bit_depth_luma || h->sps.chroma_format_idc != h1->sps.chroma_format_idc || h->sps.colorspace != h1->sps.colorspace)) { /* set bits_per_raw_sample to the previous value. the check for changed * bit depth in h264_set_parameter_from_sps() uses it and sets it to * the current value */ h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma; av_freep(&h->bipred_scratchpad); h->width = h1->width; h->height = h1->height; h->mb_height = h1->mb_height; h->mb_width = h1->mb_width; h->mb_num = h1->mb_num; h->mb_stride = h1->mb_stride; h->b_stride = h1->b_stride; // SPS/PPS if ((ret = copy_parameter_set((void **)h->sps_buffers, (void **)h1->sps_buffers, MAX_SPS_COUNT, sizeof(SPS))) < 0) return ret; h->sps = h1->sps; if ((ret = copy_parameter_set((void **)h->pps_buffers, (void **)h1->pps_buffers, MAX_PPS_COUNT, sizeof(PPS))) < 0) return ret; h->pps = h1->pps; if ((err = h264_slice_header_init(h, 1)) < 0) { av_log(h->avctx, AV_LOG_ERROR, \"h264_slice_header_init() failed\"); return err; } context_reinitialized = 1; #if 0 h264_set_parameter_from_sps(h); //Note we set context_reinitialized which will cause h264_set_parameter_from_sps to be reexecuted h->cur_chroma_format_idc = h1->cur_chroma_format_idc; #endif } /* update linesize on resize for h264. The h264 decoder doesn't * necessarily call ff_MPV_frame_start in the new thread */ h->linesize = h1->linesize; h->uvlinesize = h1->uvlinesize; /* copy block_offset since frame_start may not be called */ memcpy(h->block_offset, h1->block_offset, sizeof(h->block_offset)); if (!inited) { for (i = 0; i < MAX_SPS_COUNT; i++) av_freep(h->sps_buffers + i); for (i = 0; i < MAX_PPS_COUNT; i++) av_freep(h->pps_buffers + i); av_freep(&h->rbsp_buffer[0]); av_freep(&h->rbsp_buffer[1]); memcpy(h, h1, offsetof(H264Context, intra_pcm_ptr)); memcpy(&h->cabac, &h1->cabac, sizeof(H264Context) - offsetof(H264Context, cabac)); av_assert0((void*)&h->cabac == &h->mb_padding + 1); memset(h->sps_buffers, 0, sizeof(h->sps_buffers)); memset(h->pps_buffers, 0, sizeof(h->pps_buffers)); memset(&h->er, 0, sizeof(h->er)); memset(&h->me, 0, sizeof(h->me)); memset(&h->mb, 0, sizeof(h->mb)); memset(&h->mb_luma_dc, 0, sizeof(h->mb_luma_dc)); memset(&h->mb_padding, 0, sizeof(h->mb_padding)); h->avctx = dst; h->DPB = NULL; h->qscale_table_pool = NULL; h->mb_type_pool = NULL; h->ref_index_pool = NULL; h->motion_val_pool = NULL; for (i = 0; i < 2; i++) { h->rbsp_buffer[i] = NULL; h->rbsp_buffer_size[i] = 0; } if (h1->context_initialized) { h->context_initialized = 0; memset(&h->cur_pic, 0, sizeof(h->cur_pic)); av_frame_unref(&h->cur_pic.f); h->cur_pic.tf.f = &h->cur_pic.f; ret = ff_h264_alloc_tables(h); if (ret < 0) { av_log(dst, AV_LOG_ERROR, \"Could not allocate memory for h264\\n\"); return ret; } ret = context_init(h); if (ret < 0) { av_log(dst, AV_LOG_ERROR, \"context_init() failed.\\n\"); return ret; } } h->bipred_scratchpad = NULL; h->edge_emu_buffer = NULL; h->thread_context[0] = h; h->context_initialized = h1->context_initialized; } h->avctx->coded_height = h1->avctx->coded_height; h->avctx->coded_width = h1->avctx->coded_width; h->avctx->width = h1->avctx->width; h->avctx->height = h1->avctx->height; h->coded_picture_number = h1->coded_picture_number; h->first_field = h1->first_field; h->picture_structure = h1->picture_structure; h->qscale = h1->qscale; h->droppable = h1->droppable; h->data_partitioning = h1->data_partitioning; h->low_delay = h1->low_delay; for (i = 0; h->DPB && i < MAX_PICTURE_COUNT; i++) { unref_picture(h, &h->DPB[i]); if (h1->DPB && h1->DPB[i].f.buf[0] && (ret = ref_picture(h, &h->DPB[i], &h1->DPB[i])) < 0) return ret; } h->cur_pic_ptr = REBASE_PICTURE(h1->cur_pic_ptr, h, h1); unref_picture(h, &h->cur_pic); if (h1->cur_pic.f.buf[0] && (ret = ref_picture(h, &h->cur_pic, &h1->cur_pic)) < 0) return ret; h->workaround_bugs = h1->workaround_bugs; h->low_delay = h1->low_delay; h->droppable = h1->droppable; // extradata/NAL handling h->is_avc = h1->is_avc; // SPS/PPS if ((ret = copy_parameter_set((void **)h->sps_buffers, (void **)h1->sps_buffers, MAX_SPS_COUNT, sizeof(SPS))) < 0) return ret; h->sps = h1->sps; if ((ret = copy_parameter_set((void **)h->pps_buffers, (void **)h1->pps_buffers, MAX_PPS_COUNT, sizeof(PPS))) < 0) return ret; h->pps = h1->pps; // Dequantization matrices // FIXME these are big - can they be only copied when PPS changes? copy_fields(h, h1, dequant4_buffer, dequant4_coeff); for (i = 0; i < 6; i++) h->dequant4_coeff[i] = h->dequant4_buffer[0] + (h1->dequant4_coeff[i] - h1->dequant4_buffer[0]); for (i = 0; i < 6; i++) h->dequant8_coeff[i] = h->dequant8_buffer[0] + (h1->dequant8_coeff[i] - h1->dequant8_buffer[0]); h->dequant_coeff_pps = h1->dequant_coeff_pps; // POC timing copy_fields(h, h1, poc_lsb, redundant_pic_count); // reference lists copy_fields(h, h1, short_ref, cabac_init_idc); copy_picture_range(h->short_ref, h1->short_ref, 32, h, h1); copy_picture_range(h->long_ref, h1->long_ref, 32, h, h1); copy_picture_range(h->delayed_pic, h1->delayed_pic, MAX_DELAYED_PIC_COUNT + 2, h, h1); h->frame_recovered = h1->frame_recovered; if (context_reinitialized) h264_set_parameter_from_sps(h); if (!h->cur_pic_ptr) return 0; if (!h->droppable) { err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); h->prev_poc_msb = h->poc_msb; h->prev_poc_lsb = h->poc_lsb; } h->prev_frame_num_offset = h->frame_num_offset; h->prev_frame_num = h->frame_num; h->outputed_poc = h->next_outputed_poc; h->recovery_frame = h1->recovery_frame; return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385373, "input": "*/ static xmlNodePtr xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, xmlNodePtr contextNode) { if (cur == NULL) { if (contextNode == NULL) return(NULL); switch (contextNode->type) { case XML_ELEMENT_NODE: case XML_XINCLUDE_START: case XML_DOCUMENT_FRAG_NODE: case XML_DOCUMENT_NODE: #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif case XML_HTML_DOCUMENT_NODE: return(contextNode); default: return(NULL); } return(NULL); } else { xmlNodePtr start = cur; while (cur != NULL) { switch (cur->type) { case XML_ELEMENT_NODE: /* TODO: OK to have XInclude here? */ case XML_XINCLUDE_START: case XML_DOCUMENT_FRAG_NODE: if (cur != start) return(cur); if (cur->children != NULL) { cur = cur->children; continue; } break; /* Not sure if we need those here. */ case XML_DOCUMENT_NODE: #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif case XML_HTML_DOCUMENT_NODE: if (cur != start) return(cur); return(xmlDocGetRootElement((xmlDocPtr) cur)); default: break; } next_sibling: if ((cur == NULL) || (cur == contextNode)) return(NULL); if (cur->next != NULL) { cur = cur->next; } else { cur = cur->parent; goto next_sibling; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 199894, "input": "BOOL update_recv(rdpUpdate* update, wStream* s) { BOOL rc = FALSE; UINT16 updateType; rdpContext* context = update->context; if (Stream_GetRemainingLength(s) < 2) { WLog_ERR(TAG, \"Stream_GetRemainingLength(s) < 2\"); return FALSE; } Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */ WLog_Print(update->log, WLOG_TRACE, \"%s Update Data PDU\", UPDATE_TYPE_STRINGS[updateType]); if (!update_begin_paint(update)) goto fail; switch (updateType) { case UPDATE_TYPE_ORDERS: rc = update_recv_orders(update, s); break; case UPDATE_TYPE_BITMAP: { BITMAP_UPDATE* bitmap_update = update_read_bitmap_update(update, s); if (!bitmap_update) { WLog_ERR(TAG, \"UPDATE_TYPE_BITMAP - update_read_bitmap_update() failed\"); goto fail; } rc = IFCALLRESULT(FALSE, update->BitmapUpdate, context, bitmap_update); free_bitmap_update(update->context, bitmap_update); } break; case UPDATE_TYPE_PALETTE: { PALETTE_UPDATE* palette_update = update_read_palette(update, s); if (!palette_update) { WLog_ERR(TAG, \"UPDATE_TYPE_PALETTE - update_read_palette() failed\"); goto fail; } rc = IFCALLRESULT(FALSE, update->Palette, context, palette_update); free_palette_update(context, palette_update); } break; case UPDATE_TYPE_SYNCHRONIZE: if (!update_read_synchronize(update, s)) goto fail; rc = IFCALLRESULT(TRUE, update->Synchronize, context); break; default: break; } fail: if (!update_end_paint(update)) rc = FALSE; if (!rc) { WLog_ERR(TAG, \"UPDATE_TYPE %s [%\" PRIu16 \"] failed\", update_type_to_string(updateType), updateType); return FALSE; } return TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In FreeRDP less than or equal to 2.0.0, when running with logger set to \"WLOG_TRACE\", a possible crash of application could occur due to a read of an invalid array index. Data could be printed as string to local terminal. This has been fixed in 2.1.0.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-11019"}} -{"idx": 431561, "input": "int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res) { if (!nfs41_sequence_process(task, res)) return 0; if (res->sr_slot != NULL) nfs41_sequence_free_slot(res); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398107, "input": "static int sctp_getsockopt_enable_strreset(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_assoc_value params; struct sctp_association *asoc; int retval = -EFAULT; if (len < sizeof(params)) { retval = -EINVAL; goto out; } len = sizeof(params); if (copy_from_user(¶ms, optval, len)) goto out; asoc = sctp_id2assoc(sk, params.assoc_id); if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && sctp_style(sk, UDP)) { retval = -EINVAL; goto out; } params.assoc_value = asoc ? asoc->strreset_enable : sctp_sk(sk)->ep->strreset_enable; if (put_user(len, optlen)) goto out; if (copy_to_user(optval, ¶ms, len)) goto out; retval = 0; out: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430294, "input": "virSecuritySELinuxTransactionCommit(virSecurityManager *mgr G_GNUC_UNUSED, pid_t pid, bool lock) { virSecuritySELinuxContextList *list; int rc; int ret = -1; list = virThreadLocalGet(&contextList); if (!list) { virReportError(VIR_ERR_INTERNAL_ERROR, \"%s\", _(\"No transaction is set\")); return -1; } if (virThreadLocalSet(&contextList, NULL) < 0) { virReportSystemError(errno, \"%s\", _(\"Unable to clear thread local variable\")); goto cleanup; } list->lock = lock; if (pid != -1) { rc = virProcessRunInMountNamespace(pid, virSecuritySELinuxTransactionRun, list); if (rc < 0) { if (virGetLastErrorCode() == VIR_ERR_SYSTEM_ERROR) pid = -1; else goto cleanup; } } if (pid == -1) { if (lock) rc = virProcessRunInFork(virSecuritySELinuxTransactionRun, list); else rc = virSecuritySELinuxTransactionRun(pid, list); } if (rc < 0) goto cleanup; ret = 0; cleanup: virSecuritySELinuxContextListFree(list); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280272, "input": "static int __init setup_slub_min_objects(char *str) { get_option(&str, (int *)&slub_min_objects); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 249543, "input": "#ifndef GPAC_DISABLE_ISOM_DUMP void dump_isom_ismacryp(GF_ISOFile *file, char *inName, Bool is_final_name) { u32 i, j; FILE *dump; if (inName) { char szBuf[1024]; strcpy(szBuf, inName); if (!is_final_name) strcat(szBuf, \"_ismacryp.xml\"); dump = gf_fopen(szBuf, \"wt\"); if (!dump) { fprintf(stderr, \"Failed to open %s for dumping\\n\", szBuf); return; } } else { dump = stdout; } fprintf(dump, \"\\n\"); fprintf(dump, \"\\n\"); fprintf(dump, \"\\n\"); for (i=0; i\\n\", gf_isom_get_track_id(file, i+1)); for (j=0; j\\n\"); } fprintf(dump, \"\\n\");", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382872, "input": "static void gp_handle_reply(verto_ctx *vctx, verto_ev *ev) { struct gp_workers *w; struct gp_query *q = NULL; char dummy; int ret; w = verto_get_private(ev); /* first read out the dummy so the pipe doesn't get clogged */ ret = read(w->sig_pipe[0], &dummy, 1); if (ret) { /* ignore errors */ } /* grab a query reply if any */ if (w->reply_list) { /* ======> POOL LOCK */ pthread_mutex_lock(&w->lock); if (w->reply_list != NULL) { q = w->reply_list; w->reply_list = q->next; } /* <====== POOL LOCK */ pthread_mutex_unlock(&w->lock); } if (q) { switch (q->status) { case GP_QUERY_IN: /* ?! fallback and kill client conn */ case GP_QUERY_ERR: GPDEBUGN(3, \"[status] Handling query error, terminating CID %d.\\n\", gp_conn_get_cid(q->conn)); gp_conn_free(q->conn); gp_query_free(q, true); break; case GP_QUERY_OUT: GPDEBUGN(3, \"[status] Handling query reply: %p (%zu)\\n\", q->buffer, q->buflen); gp_socket_send_data(vctx, q->conn, q->buffer, q->buflen); gp_query_free(q, false); break; } } /* while we are at it, check if there is anything in the wait list * we need to process, as one thread just got free :-) */ q = NULL; if (w->wait_list) { /* only the dispatcher handles wait_list * so we do not need to lock around it */ if (w->wait_list) { q = w->wait_list; w->wait_list = q->next; q->next = NULL; } } if (q) { gp_query_assign(w, q); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219307, "input": "Variant sockopen_impl(const HostURL &hosturl, Variant& errnum, Variant& errstr, double timeout, bool persistent, const Variant& context) { errnum = 0; errstr = empty_string(); std::string key; if (persistent) { key = hosturl.getHostURL() + \":\" + folly::to(hosturl.getPort()); // Check our persistent storage and determine if it's an SSLSocket // or just a regular socket. auto sockItr = s_sockets->find(key); if (sockItr != s_sockets->end()) { req::ptr sock; if (auto sslSocketData = std::dynamic_pointer_cast(sockItr->second)) { sock = req::make(sslSocketData); } else { sock = req::make(sockItr->second); } if (sock->getError() == 0 && sock->checkLiveness()) { return Variant(sock); } // socket had an error earlier, we need to close it, remove it from // persistent storage, and create a new one (in that order) sock->close(); s_sockets->erase(sockItr); } } if (timeout < 0) { timeout = RequestInfo::s_requestInfo.getNoCheck()-> m_reqInjectionData.getSocketDefaultTimeout(); } req::ptr streamctx; if (context.isResource()) { streamctx = cast(context.toResource()); } auto socket = new_socket_connect(hosturl, timeout, streamctx, errnum, errstr); if (!socket.isResource()) { return false; } if (persistent) { assertx(!key.empty()); (*s_sockets)[key] = cast(socket)->getData(); assertx((*s_sockets)[key]); } return socket; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269162, "input": "bool operator==(const RuntimeShape& comp) const { return this->size_ == comp.size_ && std::memcmp(DimsData(), comp.DimsData(), size_ * sizeof(int32_t)) == 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431198, "input": "static int decode_attr_exclcreat_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *bitmask) { if (likely(bitmap[2] & FATTR4_WORD2_SUPPATTR_EXCLCREAT)) { int ret; ret = decode_attr_bitmap(xdr, bitmask); if (unlikely(ret < 0)) return ret; bitmap[2] &= ~FATTR4_WORD2_SUPPATTR_EXCLCREAT; } else bitmask[0] = bitmask[1] = bitmask[2] = 0; dprintk(\"%s: bitmask=%08x:%08x:%08x\\n\", __func__, bitmask[0], bitmask[1], bitmask[2]); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333154, "input": "dataiterator_init(Dataiterator *di, Pool *pool, Repo *repo, Id p, Id keyname, const char *match, int flags) { memset(di, 0, sizeof(*di)); di->pool = pool; di->flags = flags & ~SEARCH_THISSOLVID; if (!pool || (repo && repo->pool != pool)) { di->state = di_bye; return -1; } if (match) { int error; if ((error = datamatcher_init(&di->matcher, match, flags)) != 0) { di->state = di_bye; return error; } } di->keyname = keyname; di->keynames[0] = keyname; dataiterator_set_search(di, repo, p); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399239, "input": "static BOOL license_decrypt_and_check_MAC(rdpLicense* license, const BYTE* input, size_t len, LICENSE_BLOB* target, const BYTE* packetMac) { BYTE macData[16]; return license_rc4_with_licenseKey(license, input, len, target) && security_mac_data(license->MacSaltKey, target->data, len, macData) && (memcmp(packetMac, macData, sizeof(macData)) == 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 349464, "input": "p11_rpc_message_verify_part (p11_rpc_message *msg, const char* part) { int len; bool ok; if (!msg->sigverify) return true; len = strlen (part); ok = (strncmp (msg->sigverify, part, len) == 0); if (ok) msg->sigverify += len; return ok; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462709, "input": "int _gnutls_x509_encode_string(unsigned int etype, const void *input_data, size_t input_size, gnutls_datum_t * output) { uint8_t tl[ASN1_MAX_TL_SIZE]; unsigned int tl_size; int ret; tl_size = sizeof(tl); ret = asn1_encode_simple_der(etype, input_data, input_size, tl, &tl_size); if (ret != ASN1_SUCCESS) { gnutls_assert(); ret = _gnutls_asn2err(ret); return ret; } output->data = gnutls_malloc(tl_size + input_size); if (output->data == NULL) return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); memcpy(output->data, tl, tl_size); memcpy(output->data + tl_size, input_data, input_size); output->size = tl_size + input_size; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207567, "input": "BOOL license_read_new_or_upgrade_license_packet(rdpLicense* license, wStream* s) { UINT32 os_major; UINT32 os_minor; UINT32 cbScope, cbCompanyName, cbProductId, cbLicenseInfo; wStream* licenseStream = NULL; BOOL ret = FALSE; BYTE computedMac[16]; LICENSE_BLOB* calBlob; DEBUG_LICENSE(\"Receiving Server New/Upgrade License Packet\"); calBlob = license_new_binary_blob(BB_DATA_BLOB); if (!calBlob) return FALSE; /* EncryptedLicenseInfo */ if (!license_read_encrypted_blob(license, s, calBlob)) goto out_free_blob; /* compute MAC and check it */ if (Stream_GetRemainingLength(s) < 16) goto out_free_blob; if (!security_mac_data(license->MacSaltKey, calBlob->data, calBlob->length, computedMac)) goto out_free_blob; if (memcmp(computedMac, Stream_Pointer(s), sizeof(computedMac)) != 0) { WLog_ERR(TAG, \"new or upgrade license MAC mismatch\"); goto out_free_blob; } if (!Stream_SafeSeek(s, 16)) goto out_free_blob; licenseStream = Stream_New(calBlob->data, calBlob->length); if (!licenseStream) goto out_free_blob; Stream_Read_UINT16(licenseStream, os_minor); Stream_Read_UINT16(licenseStream, os_major); /* Scope */ Stream_Read_UINT32(licenseStream, cbScope); if (Stream_GetRemainingLength(licenseStream) < cbScope) goto out_free_stream; #ifdef WITH_DEBUG_LICENSE WLog_DBG(TAG, \"Scope:\"); winpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbScope); #endif Stream_Seek(licenseStream, cbScope); /* CompanyName */ Stream_Read_UINT32(licenseStream, cbCompanyName); if (Stream_GetRemainingLength(licenseStream) < cbCompanyName) goto out_free_stream; #ifdef WITH_DEBUG_LICENSE WLog_DBG(TAG, \"Company name:\"); winpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbCompanyName); #endif Stream_Seek(licenseStream, cbCompanyName); /* productId */ Stream_Read_UINT32(licenseStream, cbProductId); if (Stream_GetRemainingLength(licenseStream) < cbProductId) goto out_free_stream; #ifdef WITH_DEBUG_LICENSE WLog_DBG(TAG, \"Product id:\"); winpr_HexDump(TAG, WLOG_DEBUG, Stream_Pointer(licenseStream), cbProductId); #endif Stream_Seek(licenseStream, cbProductId); /* licenseInfo */ Stream_Read_UINT32(licenseStream, cbLicenseInfo); if (Stream_GetRemainingLength(licenseStream) < cbLicenseInfo) goto out_free_stream; license->state = LICENSE_STATE_COMPLETED; ret = TRUE; if (!license->rdp->settings->OldLicenseBehaviour) ret = saveCal(license->rdp->settings, Stream_Pointer(licenseStream), cbLicenseInfo, license->rdp->settings->ClientHostname); out_free_stream: Stream_Free(licenseStream, FALSE); out_free_blob: license_free_binary_blob(calBlob); return ret; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In FreeRDP before version 2.1.2, there is an out of bounds read in license_read_new_or_upgrade_license_packet. A manipulated license packet can lead to out of bound reads to an internal buffer. This is fixed in version 2.1.2.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-11099"}} -{"idx": 246249, "input": "static const char *set_default_type(cmd_parms *cmd, void *d_, const char *arg) { if (ap_cstr_casecmp(arg, \"off\") != 0 && ap_cstr_casecmp(arg, \"none\") != 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00117) \"Ignoring deprecated use of DefaultType in line %d of %s.\", cmd->directive->line_num, cmd->directive->filename); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432556, "input": "static int rdpru_interception(struct vcpu_svm *svm) { kvm_queue_exception(&svm->vcpu, UD_VECTOR); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 101619, "input": "void Stop() { EXPECT_CALL(*vc_impl_, StopCapture(capture_client())) .Times(1) .WillOnce(CaptureStopped(capture_client(), vc_impl_.get())); EXPECT_CALL(*vc_manager_, RemoveDevice(_, _)) .WillOnce(Return()); decoder_->Stop(media::NewExpectedClosure()); message_loop_->RunAllPending(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509410, "input": "Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a) :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, (const char *)NULL), arg(a), cached_field(NULL) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430760, "input": "void moveFrom(UnicodeString &dest, UnicodeString &src) { dest = std::move(src); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230105, "input": "sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path, unsigned char **out, size_t *out_len, int verify_pin) { struct sc_context *ctx = p15card->card->ctx; struct sc_card *card = p15card->card; struct sc_file *file = NULL; struct sc_path path; size_t sz; int rv; LOG_FUNC_CALLED(ctx); if (!in_path || !out || !out_len) LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Cannot read oberthur file\"); sc_log(ctx, \"read file '%s'; verify_pin:%i\", in_path, verify_pin); *out = NULL; *out_len = 0; sc_format_path(in_path, &path); rv = sc_select_file(card, &path, &file); if (rv != SC_SUCCESS) { sc_file_free(file); LOG_TEST_RET(ctx, rv, \"Cannot select oberthur file to read\"); } if (file->ef_structure == SC_FILE_EF_TRANSPARENT) sz = file->size; else sz = (file->record_length + 2) * file->record_count; *out = calloc(sz, 1); if (*out == NULL) { sc_file_free(file); LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot read oberthur file\"); } if (file->ef_structure == SC_FILE_EF_TRANSPARENT) { rv = sc_read_binary(card, 0, *out, sz, 0); } else { size_t rec; size_t offs = 0; size_t rec_len = file->record_length; for (rec = 1; ; rec++) { if (rec > file->record_count) { rv = 0; break; } rv = sc_read_record(card, rec, *out + offs + 2, rec_len, SC_RECORD_BY_REC_NR); if (rv == SC_ERROR_RECORD_NOT_FOUND) { rv = 0; break; } else if (rv < 0) { break; } rec_len = rv; *(*out + offs) = 'R'; *(*out + offs + 1) = rv; offs += rv + 2; } sz = offs; } sc_log(ctx, \"read oberthur file result %i\", rv); if (verify_pin && rv == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) { struct sc_pkcs15_object *objs[0x10], *pin_obj = NULL; const struct sc_acl_entry *acl = sc_file_get_acl_entry(file, SC_AC_OP_READ); int ii, nobjs; if (acl == NULL) { sc_file_free(file); free(*out); *out = NULL; LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA); } nobjs = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH_PIN, objs, 0x10); if (nobjs < 1) { sc_file_free(file); free(*out); *out = NULL; LOG_TEST_RET(ctx, SC_ERROR_DATA_OBJECT_NOT_FOUND, \"Cannot read oberthur file: get AUTH objects error\"); } for (ii = 0; ii < nobjs; ii++) { struct sc_pkcs15_auth_info *auth_info = (struct sc_pkcs15_auth_info *) objs[ii]->data; sc_log(ctx, \"compare PIN/ACL refs:%i/%i, method:%i/%i\", auth_info->attrs.pin.reference, acl->key_ref, auth_info->auth_method, acl->method); if (auth_info->attrs.pin.reference == (int)acl->key_ref && auth_info->auth_method == (unsigned)acl->method) { pin_obj = objs[ii]; break; } } if (!pin_obj || !pin_obj->content.value) { rv = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED; } else { rv = sc_pkcs15_verify_pin(p15card, pin_obj, pin_obj->content.value, pin_obj->content.len); if (!rv) rv = sc_oberthur_read_file(p15card, in_path, out, out_len, 0); } } sc_file_free(file); if (rv < 0) { free(*out); *out = NULL; *out_len = 0; } *out_len = sz; LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204059, "input": "pixReadFromTiffStream(TIFF *tif) { char *text; l_uint8 *linebuf, *data, *rowptr; l_uint16 spp, bps, photometry, tiffcomp, orientation, sample_fmt; l_uint16 *redmap, *greenmap, *bluemap; l_int32 d, wpl, bpl, comptype, i, j, k, ncolors, rval, gval, bval, aval; l_int32 xres, yres, tiffbpl, packedbpl, halfsize; l_uint32 w, h, tiffword, read_oriented; l_uint32 *line, *ppixel, *tiffdata, *pixdata; PIX *pix, *pix1; PIXCMAP *cmap; PROCNAME(\"pixReadFromTiffStream\"); if (!tif) return (PIX *)ERROR_PTR(\"tif not defined\", procName, NULL); read_oriented = 0; /* Only accept uint image data: * SAMPLEFORMAT_UINT = 1; * SAMPLEFORMAT_INT = 2; * SAMPLEFORMAT_IEEEFP = 3; * SAMPLEFORMAT_VOID = 4; */ TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLEFORMAT, &sample_fmt); if (sample_fmt != SAMPLEFORMAT_UINT) { L_ERROR(\"sample format = %d is not uint\\n\", procName, sample_fmt); return NULL; } /* Can't read tiff in tiled format. For what is involved, see, e.g: * https://www.cs.rochester.edu/~nelson/courses/vision/\\ * resources/tiff/libtiff.html#Tiles * A tiled tiff can be converted to a normal (strip) tif: * tiffcp -s */ if (TIFFIsTiled(tif)) { L_ERROR(\"tiled format is not supported\\n\", procName); return NULL; } /* Old style jpeg is not supported. We tried supporting 8 bpp. * TIFFReadScanline() fails on this format, so we used RGBA * reading, which generates a 4 spp image, and pulled out the * red component. However, there were problems with double-frees * in cleanup. For RGB, tiffbpl is exactly half the size that * you would expect for the raster data in a scanline, which * is 3 * w. */ TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &tiffcomp); if (tiffcomp == COMPRESSION_OJPEG) { L_ERROR(\"old style jpeg format is not supported\\n\", procName); return NULL; } /* Use default fields for bps and spp */ TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bps); TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp); if (bps != 1 && bps != 2 && bps != 4 && bps != 8 && bps != 16) { L_ERROR(\"invalid bps = %d\\n\", procName, bps); return NULL; } if (spp == 2 && bps != 8) { L_WARNING(\"for 2 spp, only handle 8 bps\\n\", procName); return NULL; } if (spp == 1) d = bps; else if (spp == 2) /* gray plus alpha */ d = 32; /* will convert to RGBA */ else if (spp == 3 || spp == 4) d = 32; else return (PIX *)ERROR_PTR(\"spp not in set {1,2,3,4}\", procName, NULL); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); if (w > MaxTiffWidth) { L_ERROR(\"width = %d pixels; too large\\n\", procName, w); return NULL; } if (h > MaxTiffHeight) { L_ERROR(\"height = %d pixels; too large\\n\", procName, h); return NULL; } /* The relation between the size of a byte buffer required to hold a raster of image pixels (packedbpl) and the size of the tiff buffer (tiffbuf) is either 1:1 or approximately 2:1, depending on how the data is stored and subsampled. Allow some slop when validating the relation between buffer size and the image parameters w, spp and bps. */ tiffbpl = TIFFScanlineSize(tif); packedbpl = (bps * spp * w + 7) / 8; halfsize = L_ABS(2 * tiffbpl - packedbpl) <= 8; #if 0 if (halfsize) L_INFO(\"packedbpl = %d is approx. twice tiffbpl = %d\\n\", procName, packedbpl, tiffbpl); #endif if (tiffbpl != packedbpl && !halfsize) { L_ERROR(\"invalid tiffbpl: tiffbpl = %d, packedbpl = %d, \" \"bps = %d, spp = %d, w = %d\\n\", procName, tiffbpl, packedbpl, bps, spp, w); return NULL; } if ((pix = pixCreate(w, h, d)) == NULL) return (PIX *)ERROR_PTR(\"pix not made\", procName, NULL); pixSetInputFormat(pix, IFF_TIFF); data = (l_uint8 *)pixGetData(pix); wpl = pixGetWpl(pix); bpl = 4 * wpl; if (spp == 1) { linebuf = (l_uint8 *)LEPT_CALLOC(tiffbpl + 1, sizeof(l_uint8)); for (i = 0; i < h; i++) { if (TIFFReadScanline(tif, linebuf, i, 0) < 0) { LEPT_FREE(linebuf); pixDestroy(&pix); return (PIX *)ERROR_PTR(\"line read fail\", procName, NULL); } memcpy(data, linebuf, tiffbpl); data += bpl; } if (bps <= 8) pixEndianByteSwap(pix); else /* bps == 16 */ pixEndianTwoByteSwap(pix); LEPT_FREE(linebuf); } else if (spp == 2 && bps == 8) { /* gray plus alpha */ L_INFO(\"gray+alpha is not supported; converting to RGBA\\n\", procName); pixSetSpp(pix, 4); linebuf = (l_uint8 *)LEPT_CALLOC(tiffbpl + 1, sizeof(l_uint8)); pixdata = pixGetData(pix); for (i = 0; i < h; i++) { if (TIFFReadScanline(tif, linebuf, i, 0) < 0) { LEPT_FREE(linebuf); pixDestroy(&pix); return (PIX *)ERROR_PTR(\"line read fail\", procName, NULL); } rowptr = linebuf; ppixel = pixdata + i * wpl; for (j = k = 0; j < w; j++) { /* Copy gray value into r, g and b */ SET_DATA_BYTE(ppixel, COLOR_RED, rowptr[k]); SET_DATA_BYTE(ppixel, COLOR_GREEN, rowptr[k]); SET_DATA_BYTE(ppixel, COLOR_BLUE, rowptr[k++]); SET_DATA_BYTE(ppixel, L_ALPHA_CHANNEL, rowptr[k++]); ppixel++; } } LEPT_FREE(linebuf); } else { /* rgb and rgba */ if ((tiffdata = (l_uint32 *)LEPT_CALLOC((size_t)w * h, sizeof(l_uint32))) == NULL) { pixDestroy(&pix); return (PIX *)ERROR_PTR(\"calloc fail for tiffdata\", procName, NULL); } /* TIFFReadRGBAImageOriented() converts to 8 bps */ if (!TIFFReadRGBAImageOriented(tif, w, h, tiffdata, ORIENTATION_TOPLEFT, 0)) { LEPT_FREE(tiffdata); pixDestroy(&pix); return (PIX *)ERROR_PTR(\"failed to read tiffdata\", procName, NULL); } else { read_oriented = 1; } if (spp == 4) pixSetSpp(pix, 4); line = pixGetData(pix); for (i = 0; i < h; i++, line += wpl) { for (j = 0, ppixel = line; j < w; j++) { /* TIFFGet* are macros */ tiffword = tiffdata[i * w + j]; rval = TIFFGetR(tiffword); gval = TIFFGetG(tiffword); bval = TIFFGetB(tiffword); if (spp == 3) { composeRGBPixel(rval, gval, bval, ppixel); } else { /* spp == 4 */ aval = TIFFGetA(tiffword); composeRGBAPixel(rval, gval, bval, aval, ppixel); } ppixel++; } } LEPT_FREE(tiffdata); } if (getTiffStreamResolution(tif, &xres, &yres) == 0) { pixSetXRes(pix, xres); pixSetYRes(pix, yres); } /* Find and save the compression type */ comptype = getTiffCompressedFormat(tiffcomp); pixSetInputFormat(pix, comptype); if (TIFFGetField(tif, TIFFTAG_COLORMAP, &redmap, &greenmap, &bluemap)) { /* Save the colormap as a pix cmap. Because the * tiff colormap components are 16 bit unsigned, * and go from black (0) to white (0xffff), the * the pix cmap takes the most significant byte. */ if (bps > 8) { pixDestroy(&pix); return (PIX *)ERROR_PTR(\"colormap size > 256\", procName, NULL); } if ((cmap = pixcmapCreate(bps)) == NULL) { pixDestroy(&pix); return (PIX *)ERROR_PTR(\"colormap not made\", procName, NULL); } ncolors = 1 << bps; for (i = 0; i < ncolors; i++) pixcmapAddColor(cmap, redmap[i] >> 8, greenmap[i] >> 8, bluemap[i] >> 8); if (pixSetColormap(pix, cmap)) { pixDestroy(&pix); return (PIX *)ERROR_PTR(\"invalid colormap\", procName, NULL); } /* Remove the colormap for 1 bpp. */ if (bps == 1) { pix1 = pixRemoveColormap(pix, REMOVE_CMAP_BASED_ON_SRC); pixDestroy(&pix); pix = pix1; } } else { /* No colormap: check photometry and invert if necessary */ if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometry)) { /* Guess default photometry setting. Assume min_is_white * if compressed 1 bpp; min_is_black otherwise. */ if (tiffcomp == COMPRESSION_CCITTFAX3 || tiffcomp == COMPRESSION_CCITTFAX4 || tiffcomp == COMPRESSION_CCITTRLE || tiffcomp == COMPRESSION_CCITTRLEW) { photometry = PHOTOMETRIC_MINISWHITE; } else { photometry = PHOTOMETRIC_MINISBLACK; } } if ((d == 1 && photometry == PHOTOMETRIC_MINISBLACK) || (d == 8 && photometry == PHOTOMETRIC_MINISWHITE)) pixInvert(pix, pix); } if (TIFFGetField(tif, TIFFTAG_ORIENTATION, &orientation)) { if (orientation >= 1 && orientation <= 8) { struct tiff_transform *transform = (read_oriented) ? &tiff_partial_orientation_transforms[orientation - 1] : &tiff_orientation_transforms[orientation - 1]; if (transform->vflip) pixFlipTB(pix, pix); if (transform->hflip) pixFlipLR(pix, pix); if (transform->rotate) { PIX *oldpix = pix; pix = pixRotate90(oldpix, transform->rotate); pixDestroy(&oldpix); } } } text = NULL; TIFFGetField(tif, TIFFTAG_IMAGEDESCRIPTION, &text); if (text) pixSetText(pix, text); return pix; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "Leptonica before 1.80.0 allows a heap-based buffer over-read in pixReadFromTiffStream, related to tiffio.c.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-36280"}} -{"idx": 262895, "input": "static int32_t register_hrhd_units(void) { struct dmar_drhd_rt *drhd_rt; uint32_t i; int32_t ret = 0; for (i = 0U; i < platform_dmar_info->drhd_count; i++) { drhd_rt = &dmar_drhd_units[i]; drhd_rt->index = i; drhd_rt->drhd = &platform_dmar_info->drhd_units[i]; drhd_rt->dmar_irq = IRQ_INVALID; set_paging_supervisor(drhd_rt->drhd->reg_base_addr, PAGE_SIZE); ret = dmar_register_hrhd(drhd_rt); if (ret != 0) { break; } if ((iommu_cap_pi(drhd_rt->cap) == 0U) || (!is_apicv_advanced_feature_supported())) { platform_caps.pi = false; } } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295146, "input": "void gdImageColorDeallocate (gdImagePtr im, int color) { if (im->trueColor) { return; } /* Mark it open. */ im->open[color] = 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 350352, "input": "pixaWriteMemMultipageTiff(l_uint8 **pdata, size_t *psize, PIXA *pixa) { const char *modestr; l_int32 i, n; FILE *fp; PIX *pix1; PROCNAME(\"pixaWriteMemMultipageTiff\"); if (pdata) *pdata = NULL; if (!pdata) return ERROR_INT(\"pdata not defined\", procName, 1); if (!pixa) return ERROR_INT(\"pixa not defined\", procName, 1); #ifdef _WIN32 if ((fp = fopenWriteWinTempfile()) == NULL) return ERROR_INT(\"tmpfile stream not opened\", procName, 1); #else if ((fp = tmpfile()) == NULL) return ERROR_INT(\"tmpfile stream not opened\", procName, 1); #endif /* _WIN32 */ n = pixaGetCount(pixa); for (i = 0; i < n; i++) { modestr = (i == 0) ? \"w\" : \"a\"; pix1 = pixaGetPix(pixa, i, L_CLONE); if (pixGetDepth(pix1) == 1) pixWriteStreamTiffWA(fp, pix1, IFF_TIFF_G4, modestr); else pixWriteStreamTiffWA(fp, pix1, IFF_TIFF_ZIP, modestr); pixDestroy(&pix1); } rewind(fp); *pdata = l_binaryReadStream(fp, psize); fclose(fp); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417021, "input": "void APar_Print_TrackDetails(TrackInfo *track_info) { if (track_info->max_bitrate > 0 && track_info->avg_bitrate > 0) { fprintf(stdout, \" %.2f kbp/s\", (float)track_info->avg_bitrate / 1000.0); } else { // some ffmpeg encodings have avg_bitrate set to 0, but an inexact // max_bitrate - actually, their esds seems a mess to me #if defined(_MSC_VER) fprintf(stdout, \" %.2lf* kbp/s\", ((double)((__int64)track_info->sample_aggregate) / ((double)((__int64)track_info->duration) / (double)((__int64)movie_info.timescale))) / 1000.0 * 8); fprintf(stdout, \" %.3f sec\", (float)track_info->duration / (float)movie_info.timescale); #else fprintf(stdout, \" %.2lf* kbp/s\", ((double)track_info->sample_aggregate / ((double)track_info->duration / (double)movie_info.timescale)) / 1000.0 * 8); fprintf(stdout, \" %.3f sec\", (float)track_info->duration / (float)movie_info.timescale); #endif } if (track_info->track_codec == 0x6D703476) { // mp4v profile APar_ShowObjectProfileInfo(MP4V_TRACK, track_info); } else if (track_info->track_codec == 0x6D703461 || track_info->protected_codec == 0x6D703461) { // mp4a profile APar_ShowObjectProfileInfo(AUDIO_TRACK, track_info); } else if (track_info->track_codec == 0x616C6163) { // alac - can't figure out a hardcoded bitrate either fprintf( stdout, \" Apple Lossless channels: [%u]\\n\", track_info->channels); } else if (track_info->track_codec == 0x61766331 || track_info->protected_codec == 0x61766331) { if (track_info->avc_version == 1) { // avc profile & level APar_ShowObjectProfileInfo(AVC1_TRACK, track_info); } } else if (track_info->track_codec == 0x73323633) { // s263 in 3gp APar_ShowObjectProfileInfo(S263_TRACK, track_info); } else if (track_info->track_codec == 0x73616D72 || track_info->track_codec == 0x73617762 || track_info->track_codec == 0x73617770 || track_info->track_codec == 0x73766D72) { // samr,sawb,sawp & svmr in 3gp track_info->type_of_track = S_AMR_TRACK; APar_ShowObjectProfileInfo(track_info->type_of_track, track_info); } else if (track_info->track_codec == 0x73657663) { // evrc in 3gp track_info->type_of_track = EVRC_TRACK; APar_ShowObjectProfileInfo(track_info->type_of_track, track_info); } else if (track_info->track_codec == 0x73716370) { // qcelp in 3gp track_info->type_of_track = QCELP_TRACK; APar_ShowObjectProfileInfo(track_info->type_of_track, track_info); } else if (track_info->track_codec == 0x73736D76) { // smv in 3gp track_info->type_of_track = SMV_TRACK; APar_ShowObjectProfileInfo(track_info->type_of_track, track_info); } else { // unknown everything, 0 hardcoded bitrate APar_ShowObjectProfileInfo(track_info->type_of_track, track_info); fprintf(stdout, \"\\n\"); } if (track_info->type_of_track & VIDEO_TRACK && ((track_info->max_bitrate > 0 && track_info->ObjectTypeIndication == 0x20) || track_info->avc_version == 1 || track_info->protected_codec != 0)) { fprintf(stdout, \" %ux%u (%\" PRIu32 \" macroblocks)\\n\", track_info->video_width, track_info->video_height, track_info->macroblocks); } else if (track_info->type_of_track & VIDEO_TRACK) { fprintf(stdout, \"\\n\"); } return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 217240, "input": "bool read(ReadonlyBytes buffer) { auto fields_size = sizeof(CentralDirectoryRecord) - (sizeof(u8*) * 3); if (buffer.size() < fields_size) return false; if (memcmp(buffer.data(), central_directory_record_signature, sizeof(central_directory_record_signature)) != 0) return false; memcpy(reinterpret_cast(&made_by_version), buffer.data() + sizeof(central_directory_record_signature), fields_size); name = buffer.data() + sizeof(central_directory_record_signature) + fields_size; extra_data = name + name_length; comment = extra_data + extra_data_length; return true; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')"], "explanation": "SerenityOS 2021-03-27 contains a buffer overflow vulnerability in the EndOfCentralDirectory::read() function.", "severity_level": "NoInfo", "cwe": "CWE-120", "cve": "CVE-2021-30045"}} -{"idx": 378682, "input": "void sqlite3VdbeScanStatus( Vdbe *p, /* VM to add scanstatus() to */ int addrExplain, /* Address of OP_Explain (or 0) */ int addrLoop, /* Address of loop counter */ int addrVisit, /* Address of rows visited counter */ LogEst nEst, /* Estimated number of output rows */ const char *zName /* Name of table or index being scanned */ ){ sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); ScanStatus *aNew; aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); if( aNew ){ ScanStatus *pNew = &aNew[p->nScan++]; pNew->addrExplain = addrExplain; pNew->addrLoop = addrLoop; pNew->addrVisit = addrVisit; pNew->nEst = nEst; pNew->zName = sqlite3DbStrDup(p->db, zName); p->aScan = aNew; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281486, "input": "static inline bool need_preempt(const struct intel_engine_cs *engine, const struct i915_request *rq, struct rb_node *rb) { int last_prio; if (!intel_engine_has_semaphores(engine)) return false; /* * Check if the current priority hint merits a preemption attempt. * * We record the highest value priority we saw during rescheduling * prior to this dequeue, therefore we know that if it is strictly * less than the current tail of ESLP[0], we do not need to force * a preempt-to-idle cycle. * * However, the priority hint is a mere hint that we may need to * preempt. If that hint is stale or we may be trying to preempt * ourselves, ignore the request. * * More naturally we would write * prio >= max(0, last); * except that we wish to prevent triggering preemption at the same * priority level: the task that is running should remain running * to preserve FIFO ordering of dependencies. */ last_prio = max(effective_prio(rq), I915_PRIORITY_NORMAL - 1); if (engine->execlists.queue_priority_hint <= last_prio) return false; /* * Check against the first request in ELSP[1], it will, thanks to the * power of PI, be the highest priority of that context. */ if (!list_is_last(&rq->sched.link, &engine->active.requests) && rq_prio(list_next_entry(rq, sched.link)) > last_prio) return true; if (rb) { struct virtual_engine *ve = rb_entry(rb, typeof(*ve), nodes[engine->id].rb); bool preempt = false; if (engine == ve->siblings[0]) { /* only preempt one sibling */ struct i915_request *next; rcu_read_lock(); next = READ_ONCE(ve->request); if (next) preempt = rq_prio(next) > last_prio; rcu_read_unlock(); } if (preempt) return preempt; } /* * If the inflight context did not trigger the preemption, then maybe * it was the set of queued requests? Pick the highest priority in * the queue (the first active priolist) and see if it deserves to be * running instead of ELSP[0]. * * The highest priority request in the queue can not be either * ELSP[0] or ELSP[1] as, thanks again to PI, if it was the same * context, it's priority would not exceed ELSP[0] aka last_prio. */ return queue_prio(&engine->execlists) > last_prio; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255188, "input": "void CSoundFile::HandlePatternTransitionEvents() { // MPT sequence override if(m_PlayState.m_nSeqOverride != ORDERINDEX_INVALID && m_PlayState.m_nSeqOverride < Order().size()) { if(m_SongFlags[SONG_PATTERNLOOP]) { m_PlayState.m_nPattern = Order()[m_PlayState.m_nSeqOverride]; } m_PlayState.m_nCurrentOrder = m_PlayState.m_nSeqOverride; m_PlayState.m_nSeqOverride = ORDERINDEX_INVALID; } // Channel mutes for (CHANNELINDEX chan = 0; chan < GetNumChannels(); chan++) { if (m_bChannelMuteTogglePending[chan]) { if(GetpModDoc()) { GetpModDoc()->MuteChannel(chan, !GetpModDoc()->IsChannelMuted(chan)); } m_bChannelMuteTogglePending[chan] = false; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 456522, "input": "static int fixup_call_args(struct bpf_verifier_env *env) { #ifndef CONFIG_BPF_JIT_ALWAYS_ON struct bpf_prog *prog = env->prog; struct bpf_insn *insn = prog->insnsi; int i, depth; #endif int err = 0; if (env->prog->jit_requested && !bpf_prog_is_dev_bound(env->prog->aux)) { err = jit_subprogs(env); if (err == 0) return 0; if (err == -EFAULT) return err; } #ifndef CONFIG_BPF_JIT_ALWAYS_ON if (env->subprog_cnt > 1 && env->prog->aux->tail_call_reachable) { /* When JIT fails the progs with bpf2bpf calls and tail_calls * have to be rejected, since interpreter doesn't support them yet. */ verbose(env, \"tail_calls are not allowed in non-JITed programs with bpf-to-bpf calls\\n\"); return -EINVAL; } for (i = 0; i < prog->len; i++, insn++) { if (insn->code != (BPF_JMP | BPF_CALL) || insn->src_reg != BPF_PSEUDO_CALL) continue; depth = get_callee_stack_depth(env, insn, i); if (depth < 0) return depth; bpf_patch_call_args(insn, depth); } err = 0; #endif return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 505491, "input": "void agdelcb(Agraph_t * g, void *obj, Agcbstack_t * cbstack) { agobjfn_t fn; if (cbstack == NIL(Agcbstack_t *)) return; agdelcb(g, obj, cbstack->prev); fn = NIL(agobjfn_t); switch (AGTYPE(obj)) { case AGRAPH: fn = cbstack->f->graph.del; break; case AGNODE: fn = cbstack->f->node.del; break; case AGEDGE: fn = cbstack->f->edge.del; break; } if (fn) fn(g, obj, cbstack->state); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338702, "input": "static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, int sync, void *key) { struct io_kiocb *req = wait->private; struct io_poll_iocb *poll = io_poll_get_single(req); __poll_t mask = key_to_poll(key); /* for instances that support it check for an event match first: */ if (mask && !(mask & poll->events)) return 0; if (!(poll->events & EPOLLONESHOT)) return poll->wait.func(&poll->wait, mode, sync, key); list_del_init(&wait->entry); if (poll && poll->head) { bool done; spin_lock(&poll->head->lock); done = list_empty(&poll->wait.entry); if (!done) list_del_init(&poll->wait.entry); /* make sure double remove sees this as being gone */ wait->private = NULL; spin_unlock(&poll->head->lock); if (!done) { /* use wait func handler, so it matches the rq type */ poll->wait.func(&poll->wait, mode, sync, key); } } req_ref_put(req); return 1;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431964, "input": "static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) { __u8 status = *((__u8 *) skb->data); __u8 param; void *sent; BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); if (status) return; sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_ENCRYPT_MODE); if (!sent) return; param = *((__u8 *) sent); if (param) set_bit(HCI_ENCRYPT, &hdev->flags); else clear_bit(HCI_ENCRYPT, &hdev->flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238760, "input": "ecma_op_container_free_map_entries (ecma_collection_t *container_p) { JERRY_ASSERT (container_p != NULL); uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p); ecma_value_t *start_p = ECMA_CONTAINER_START (container_p); for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE) { ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i); if (ecma_is_value_empty (entry_p->key)) { continue; } ecma_free_value_if_not_object (entry_p->key); ecma_free_value_if_not_object (entry_p->value); entry_p->key = ECMA_VALUE_EMPTY; entry_p->value = ECMA_VALUE_EMPTY; } } /* ecma_op_container_free_map_entries */", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318161, "input": "hdrblob hdrblobFree(hdrblob blob) { if (blob) { free(blob->ei); free(blob); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 441971, "input": "static int vhost_net_buf_peek_len(void *ptr) { if (tun_is_xdp_frame(ptr)) { struct xdp_frame *xdpf = tun_ptr_to_xdp(ptr); return xdpf->len; } return __skb_array_len_with_tag(ptr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197972, "input": "GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, const GF_SLConfig *slConfig) { GF_TrackBox *trak; GF_SampleEntryBox *entry; GF_Err e; GF_SLConfig **slc; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak) return GF_BAD_PARAM; e = Media_GetSampleDesc(trak->Media, StreamDescriptionIndex, &entry, NULL); if (e) return e; //we must be sure we are not using a remote ESD switch (entry->type) { case GF_ISOM_BOX_TYPE_MP4S: if (((GF_MPEGSampleEntryBox *)entry)->esd->desc->slConfig->predefined != SLPredef_MP4) return GF_BAD_PARAM; slc = & ((GF_MPEGSampleEntryBox *)entry)->slc; break; case GF_ISOM_BOX_TYPE_MP4A: if (((GF_MPEGAudioSampleEntryBox *)entry)->esd->desc->slConfig->predefined != SLPredef_MP4) return GF_BAD_PARAM; slc = & ((GF_MPEGAudioSampleEntryBox *)entry)->slc; break; case GF_ISOM_BOX_TYPE_MP4V: if (((GF_MPEGVisualSampleEntryBox *)entry)->esd->desc->slConfig->predefined != SLPredef_MP4) return GF_BAD_PARAM; slc = & ((GF_MPEGVisualSampleEntryBox *)entry)->slc; break; default: return GF_BAD_PARAM; } if (*slc) { gf_odf_desc_del((GF_Descriptor *)*slc); *slc = NULL; } if (!slConfig) return GF_OK; //finally duplicate the SL return gf_odf_desc_copy((GF_Descriptor *) slConfig, (GF_Descriptor **) slc); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "The gf_isom_set_extraction_slc function in GPAC 1.0.1 allows attackers to cause a denial of service (NULL pointer dereference) via a crafted file in the MP4Box command.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-31258"}} -{"idx": 219727, "input": "int64_t HHVM_FUNCTION(ord, const String& str) { return (int64_t)(unsigned char)str[0]; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268081, "input": "static int ipsecrequests_to_migrate(struct sadb_x_ipsecrequest *rq1, int len, struct xfrm_migrate *m) { int err; struct sadb_x_ipsecrequest *rq2; int mode; if (len < sizeof(*rq1) || len < rq1->sadb_x_ipsecrequest_len || rq1->sadb_x_ipsecrequest_len < sizeof(*rq1)) return -EINVAL; /* old endoints */ err = parse_sockaddr_pair((struct sockaddr *)(rq1 + 1), rq1->sadb_x_ipsecrequest_len - sizeof(*rq1), &m->old_saddr, &m->old_daddr, &m->old_family); if (err) return err; rq2 = (struct sadb_x_ipsecrequest *)((u8 *)rq1 + rq1->sadb_x_ipsecrequest_len); len -= rq1->sadb_x_ipsecrequest_len; if (len <= sizeof(*rq2) || len < rq2->sadb_x_ipsecrequest_len || rq2->sadb_x_ipsecrequest_len < sizeof(*rq2)) return -EINVAL; /* new endpoints */ err = parse_sockaddr_pair((struct sockaddr *)(rq2 + 1), rq2->sadb_x_ipsecrequest_len - sizeof(*rq2), &m->new_saddr, &m->new_daddr, &m->new_family); if (err) return err; if (rq1->sadb_x_ipsecrequest_proto != rq2->sadb_x_ipsecrequest_proto || rq1->sadb_x_ipsecrequest_mode != rq2->sadb_x_ipsecrequest_mode || rq1->sadb_x_ipsecrequest_reqid != rq2->sadb_x_ipsecrequest_reqid) return -EINVAL; m->proto = rq1->sadb_x_ipsecrequest_proto; if ((mode = pfkey_mode_to_xfrm(rq1->sadb_x_ipsecrequest_mode)) < 0) return -EINVAL; m->mode = mode; m->reqid = rq1->sadb_x_ipsecrequest_reqid; return ((int)(rq1->sadb_x_ipsecrequest_len + rq2->sadb_x_ipsecrequest_len)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393172, "input": "TEST_F(QueryPlannerTest, IntersectBasicTwoPred) { params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION; addIndex(BSON(\"a\" << 1)); addIndex(BSON(\"b\" << 1)); runQuery(fromjson(\"{a:1, b:{$gt: 1}}\")); assertSolutionExists( \"{fetch: {filter: null, node: {andHash: {nodes: [\" \"{ixscan: {filter: null, pattern: {a:1}}},\" \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230498, "input": "void CLua::init_lua() { if (_state) return; #ifdef NO_CUSTOM_ALLOCATOR // If this is likely to be used as a server, warn the builder. // NOTE: #warning doesn't work on MSVC, so this will be fatal there // (not that webtiles or dgamelaunch are supported on Windows anyway). # if defined(USE_TILE_WEB) || defined(DGAMELAUNCH) # warning Detected 64-bit Luajit, disabling CLua memory throttling. # endif _state = luaL_newstate(); #else // Throttle memory usage in managed (clua) VMs _state = managed_vm? lua_newstate(_clua_allocator, this) : luaL_newstate(); #endif if (!_state) end(1, false, \"Unable to create Lua state.\"); lua_stack_cleaner clean(_state); lua_atpanic(_state, _clua_panic); #ifdef CLUA_UNRESTRICTED_LIBS // open all libs -- this is not safe for public servers or releases! // Intended for people writing bots and the like. luaL_openlibs(_state); #else // Selectively load some, but not all Lua core libraries. // // In Lua 5.1, these library setup calls are not supposed to be called // directly from C. If the lua version changes, this may need to be changed: // recommended practice is (apparently) checking the lua version's linit.cc // and seeing how that does the full library setup. // // This doesn't seem to *obviously* impact the libraries we use by default, // but some of the libraries we don't use will panic if not called // correctly; since someone writing a bot (for example) might want to // expand this, do things \"correctly\". The core lua libraries in 5.1 we are // not loading are: // // {LUA_LOADLIBNAME, luaopen_package}, // (require etc) // {LUA_IOLIBNAME, luaopen_io}, // // {LUA_OSLIBNAME, luaopen_os}, // {LUA_DBLIBNAME, luaopen_debug}, const vector> lua_core_libs = { {\"\", luaopen_base}, // XX: why no name? but this is how linit.cc does it {LUA_TABLIBNAME, luaopen_table}, {LUA_STRLIBNAME, luaopen_string}, {LUA_MATHLIBNAME, luaopen_math}, }; for (auto l : lua_core_libs) { lua_pushcfunction(_state, l.second); lua_pushstring(_state, l.first.c_str()); lua_call(_state, 1, 0); } #endif lua_pushboolean(_state, managed_vm); setregistry(\"lua_vm_is_managed\"); lua_pushlightuserdata(_state, this); setregistry(\"__clua\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357366, "input": "static void opj_j2k_read_float32_to_float(const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem) { OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data; OPJ_FLOAT32 * l_dest_data = (OPJ_FLOAT32 *) p_dest_data; OPJ_UINT32 i; OPJ_FLOAT32 l_temp; for (i = 0; i < p_nb_elem; ++i) { opj_read_float(l_src_data, &l_temp); l_src_data += sizeof(OPJ_FLOAT32); *(l_dest_data++) = l_temp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206867, "input": "void get_cmdln_options(int argc, char *argv[]) { int o; #if CONFIG_FILE && HAVE_GETPWUID static struct passwd *pwd_entry; char *str; #endif #ifdef LONG_OPTIONS int option_index = 0; static struct option long_options[] = { {\"timeout\", 1, 0, 't'}, #ifdef PROC_NET_DEV {\"procfile\",1,0,'f'}, #endif #ifdef PROC_DISKSTATS {\"diskstatsfile\",1,0,1000}, {\"partitionsfile\",1,0,1001}, #endif #if NETSTAT && ALLOW_NETSTATPATH {\"netstat\",1,0,'n'}, #endif #if IOSERVICE_IN {\"longdisknames\",0,0,1002}, #endif {\"input\",1,0,'i'}, {\"dynamic\",1,0,'d'}, {\"help\", 0, 0, 'h'}, {\"version\",0,0,'V'}, {\"allif\",1,0,'a'}, {\"unit\",1,0,'u'}, {\"ansiout\",0,0,'N'}, #if EXTENDED_STATS {\"type\",1,0,'T'}, {\"avglength\",1,0,'A'}, #endif {\"interfaces\",1,0,'I'}, {\"sumhidden\",1,0,'S'}, {\"output\",1,0,'o'}, #ifdef CSV {\"csvchar\",1,0,'C'}, {\"csvfile\",1,0,'F'}, #endif {\"count\",1,0,'c'}, {\"daemon\",1,0,'D'}, #ifdef HTML {\"htmlrefresh\",1,0,'R'}, {\"htmlheader\",1,0,'H'}, #endif {0,0,0,0} }; #endif #ifdef CONFIG_FILE /* loop till first non option argument */ opterr=0; while (1) { #ifdef LONG_OPTIONS o=getopt_long (argc,argv,SHORT_OPTIONS,long_options, &option_index); #else o=getopt (argc,argv,SHORT_OPTIONS); #endif if (o==-1) break; } opterr=1; if (optind < argc) { read_config(argv[optind]); } else { read_config(\"/etc/bwm-ng.conf\"); #ifdef HAVE_GETPWUID pwd_entry=getpwuid(getuid()); if (pwd_entry!=NULL) { str=(char*)malloc(strlen(pwd_entry->pw_dir)+14); snprintf(str,strlen(pwd_entry->pw_dir)+14,\"%s/.bwm-ng.conf\",pwd_entry->pw_dir); read_config(str); free(str); } #endif } /* reset getopt again */ optind=1; #endif /* get command line arguments, kinda ugly, wanna rewrite it? */ while (1) { #ifdef LONG_OPTIONS o=getopt_long (argc,argv,SHORT_OPTIONS,long_options, &option_index); #else o=getopt (argc,argv,SHORT_OPTIONS); #endif if (o==-1) break; switch (o) { case '?': printf(\"unknown option: %s\\n\",argv[optind-1]); exit(EXIT_FAILURE); break; /* ugly workaround to handle optional arguments for all platforms */ case ':': if (!strcmp(argv[optind-1],\"-a\") || !strcasecmp(argv[optind-1],\"--allif\")) show_all_if=1; else if (!strcmp(argv[optind-1],\"-d\") || !strcasecmp(argv[optind-1],\"--dynamic\")) dynamic=1; else if (!strcmp(argv[optind-1],\"-D\") || !strcasecmp(argv[optind-1],\"--daemon\")) daemonize=1; #ifdef HTML else if (!strcmp(argv[optind-1],\"-H\") || !strcasecmp(argv[optind-1],\"--htmlheader\")) html_header=1; #endif else if (!strcmp(argv[optind-1],\"-S\") || !strcasecmp(argv[optind-1],\"--sumhidden\")) sumhidden=1; else { printf(\"%s requires an argument!\\n\",argv[optind-1]); exit(EXIT_FAILURE); } break; #ifdef PROC_DISKSTATS case 1000: if (strlen(optarg)0) { html_refresh=atol(optarg); } break; case 'H': if (optarg) html_header=atoi(optarg); break; #endif case 'c': if (optarg) output_count=atol(optarg); break; #if CSV || HTML case 'F': if (optarg) { if (out_file) fclose(out_file); out_file=fopen(optarg,\"a\"); if (!out_file) deinit(1, \"failed to open outfile\\n\"); if (out_file_path) free(out_file_path); out_file_path=(char *)strdup(optarg); } break; #endif #ifdef CSV case 'C': if (optarg) csv_char=optarg[0]; break; #endif case 'h': cmdln_printhelp(); break; #ifdef PROC_NET_DEV case 'f': if (optarg && (strlen(optarg)0) { delay=atol(optarg); } break; #if EXTENDED_STATS case 'T': output_type=str2output_type(optarg); break; case 'A': if (optarg) avg_length=atoi(optarg)*1000; break; #endif case 'd': if (optarg) dynamic=atoi(optarg); break; case 'u': output_unit=str2output_unit(optarg); break; #if NETSTAT && ALLOW_NETSTATPATH case 'n': if (optarg && (strlen(optarg)=avg_length) deinit(1, \"avglength needs to be a least twice the value of timeout\\n\"); #endif if ((output_unit==ERRORS_OUT && !net_input_method(input_method)) || (output_unit==PACKETS_OUT && input_method==LIBSTATDISK_IN)) output_unit=BYTES_OUT; return; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "An issue was discovered in in bwm-ng v0.6.2. An arbitrary null write exists in get_cmdln_options() function in src/options.c.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2022-1341"}} -{"idx": 342011, "input": "static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len, struct inode *parent) { int len = parent ? 6 : 3; u64 nodeid; u32 generation; if (*max_len < len) { *max_len = len; return FILEID_INVALID; } nodeid = get_fuse_inode(inode)->nodeid; generation = inode->i_generation; fh[0] = (u32)(nodeid >> 32); fh[1] = (u32)(nodeid & 0xffffffff); fh[2] = generation; if (parent) { nodeid = get_fuse_inode(parent)->nodeid; generation = parent->i_generation; fh[3] = (u32)(nodeid >> 32); fh[4] = (u32)(nodeid & 0xffffffff); fh[5] = generation; } *max_len = len; return parent ? 0x82 : 0x81; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 356315, "input": "static void selectInnerLoop( Parse *pParse, /* The parser context */ Select *p, /* The complete select statement being coded */ int srcTab, /* Pull data from this table if non-negative */ SortCtx *pSort, /* If not NULL, info on how to process ORDER BY */ DistinctCtx *pDistinct, /* If not NULL, info on how to process DISTINCT */ SelectDest *pDest, /* How to dispose of the results */ int iContinue, /* Jump here to continue with next row */ int iBreak /* Jump here to break out of the inner loop */ ){ Vdbe *v = pParse->pVdbe; int i; int hasDistinct; /* True if the DISTINCT keyword is present */ int eDest = pDest->eDest; /* How to dispose of results */ int iParm = pDest->iSDParm; /* First argument to disposal method */ int nResultCol; /* Number of result columns */ int nPrefixReg = 0; /* Number of extra registers before regResult */ RowLoadInfo sRowLoadInfo; /* Info for deferred row loading */ /* Usually, regResult is the first cell in an array of memory cells ** containing the current result row. In this case regOrig is set to the ** same value. However, if the results are being sent to the sorter, the ** values for any expressions that are also part of the sort-key are omitted ** from this array. In this case regOrig is set to zero. */ int regResult; /* Start of memory holding current results */ int regOrig; /* Start of memory holding full result (or 0) */ assert( v ); assert( p->pEList!=0 ); hasDistinct = pDistinct ? pDistinct->eTnctType : WHERE_DISTINCT_NOOP; if( pSort && pSort->pOrderBy==0 ) pSort = 0; if( pSort==0 && !hasDistinct ){ assert( iContinue!=0 ); codeOffset(v, p->iOffset, iContinue); } /* Pull the requested columns. */ nResultCol = p->pEList->nExpr; if( pDest->iSdst==0 ){ if( pSort ){ nPrefixReg = pSort->pOrderBy->nExpr; if( !(pSort->sortFlags & SORTFLAG_UseSorter) ) nPrefixReg++; pParse->nMem += nPrefixReg; } pDest->iSdst = pParse->nMem+1; pParse->nMem += nResultCol; }else if( pDest->iSdst+nResultCol > pParse->nMem ){ /* This is an error condition that can result, for example, when a SELECT ** on the right-hand side of an INSERT contains more result columns than ** there are columns in the table on the left. The error will be caught ** and reported later. But we need to make sure enough memory is allocated ** to avoid other spurious errors in the meantime. */ pParse->nMem += nResultCol; } pDest->nSdst = nResultCol; regOrig = regResult = pDest->iSdst; if( srcTab>=0 ){ for(i=0; ipEList->a[i].zName)); } }else if( eDest!=SRT_Exists ){ #ifdef SQLITE_ENABLE_SORTER_REFERENCES ExprList *pExtra = 0; #endif /* If the destination is an EXISTS(...) expression, the actual ** values returned by the SELECT are not required. */ u8 ecelFlags; /* \"ecel\" is an abbreviation of \"ExprCodeExprList\" */ ExprList *pEList; if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){ ecelFlags = SQLITE_ECEL_DUP; }else{ ecelFlags = 0; } if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){ /* For each expression in p->pEList that is a copy of an expression in ** the ORDER BY clause (pSort->pOrderBy), set the associated ** iOrderByCol value to one more than the index of the ORDER BY ** expression within the sort-key that pushOntoSorter() will generate. ** This allows the p->pEList field to be omitted from the sorted record, ** saving space and CPU cycles. */ ecelFlags |= (SQLITE_ECEL_OMITREF|SQLITE_ECEL_REF); for(i=pSort->nOBSat; ipOrderBy->nExpr; i++){ int j; if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){ p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat; } } #ifdef SQLITE_ENABLE_SORTER_REFERENCES selectExprDefer(pParse, pSort, p->pEList, &pExtra); if( pExtra && pParse->db->mallocFailed==0 ){ /* If there are any extra PK columns to add to the sorter records, ** allocate extra memory cells and adjust the OpenEphemeral ** instruction to account for the larger records. This is only ** required if there are one or more WITHOUT ROWID tables with ** composite primary keys in the SortCtx.aDefer[] array. */ VdbeOp *pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex); pOp->p2 += (pExtra->nExpr - pSort->nDefer); pOp->p4.pKeyInfo->nAllField += (pExtra->nExpr - pSort->nDefer); pParse->nMem += pExtra->nExpr; } #endif /* Adjust nResultCol to account for columns that are omitted ** from the sorter by the optimizations in this branch */ pEList = p->pEList; for(i=0; inExpr; i++){ if( pEList->a[i].u.x.iOrderByCol>0 #ifdef SQLITE_ENABLE_SORTER_REFERENCES || pEList->a[i].bSorterRef #endif ){ nResultCol--; regOrig = 0; } } testcase( regOrig ); testcase( eDest==SRT_Set ); testcase( eDest==SRT_Mem ); testcase( eDest==SRT_Coroutine ); testcase( eDest==SRT_Output ); assert( eDest==SRT_Set || eDest==SRT_Mem || eDest==SRT_Coroutine || eDest==SRT_Output ); } sRowLoadInfo.regResult = regResult; sRowLoadInfo.ecelFlags = ecelFlags; #ifdef SQLITE_ENABLE_SORTER_REFERENCES sRowLoadInfo.pExtra = pExtra; sRowLoadInfo.regExtraResult = regResult + nResultCol; if( pExtra ) nResultCol += pExtra->nExpr; #endif if( p->iLimit && (ecelFlags & SQLITE_ECEL_OMITREF)!=0 && nPrefixReg>0 ){ assert( pSort!=0 ); assert( hasDistinct==0 ); pSort->pDeferredRowLoad = &sRowLoadInfo; regOrig = 0; }else{ innerLoopLoadRow(pParse, p, &sRowLoadInfo); } } /* If the DISTINCT keyword was present on the SELECT statement ** and this row has been seen before, then do not make this row ** part of the result. */ if( hasDistinct ){ switch( pDistinct->eTnctType ){ case WHERE_DISTINCT_ORDERED: { VdbeOp *pOp; /* No longer required OpenEphemeral instr. */ int iJump; /* Jump destination */ int regPrev; /* Previous row content */ /* Allocate space for the previous row */ regPrev = pParse->nMem+1; pParse->nMem += nResultCol; /* Change the OP_OpenEphemeral coded earlier to an OP_Null ** sets the MEM_Cleared bit on the first register of the ** previous value. This will cause the OP_Ne below to always ** fail on the first iteration of the loop even if the first ** row is all NULLs. */ sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); pOp = sqlite3VdbeGetOp(v, pDistinct->addrTnct); pOp->opcode = OP_Null; pOp->p1 = 1; pOp->p2 = regPrev; pOp = 0; /* Ensure pOp is not used after sqlite3VdbeAddOp() */ iJump = sqlite3VdbeCurrentAddr(v) + nResultCol; for(i=0; ipEList->a[i].pExpr); if( idb->mallocFailed ); sqlite3VdbeAddOp3(v, OP_Copy, regResult, regPrev, nResultCol-1); break; } case WHERE_DISTINCT_UNIQUE: { sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); break; } default: { assert( pDistinct->eTnctType==WHERE_DISTINCT_UNORDERED ); codeDistinct(pParse, pDistinct->tabTnct, iContinue, nResultCol, regResult); break; } } if( pSort==0 ){ codeOffset(v, p->iOffset, iContinue); } } switch( eDest ){ /* In this mode, write each query result to the key of the temporary ** table iParm. */ #ifndef SQLITE_OMIT_COMPOUND_SELECT case SRT_Union: { int r1; r1 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); sqlite3ReleaseTempReg(pParse, r1); break; } /* Construct a record from the query result, but instead of ** saving that record, use it as a key to delete elements from ** the temporary table iParm. */ case SRT_Except: { sqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nResultCol); break; } #endif /* SQLITE_OMIT_COMPOUND_SELECT */ /* Store the result as data using a unique key. */ case SRT_Fifo: case SRT_DistFifo: case SRT_Table: case SRT_EphemTab: { int r1 = sqlite3GetTempRange(pParse, nPrefixReg+1); testcase( eDest==SRT_Table ); testcase( eDest==SRT_EphemTab ); testcase( eDest==SRT_Fifo ); testcase( eDest==SRT_DistFifo ); sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1+nPrefixReg); #ifndef SQLITE_OMIT_CTE if( eDest==SRT_DistFifo ){ /* If the destination is DistFifo, then cursor (iParm+1) is open ** on an ephemeral index. If the current row is already present ** in the index, do not write it to the output. If not, add the ** current row to the index and proceed with writing it to the ** output table as well. */ int addr = sqlite3VdbeCurrentAddr(v) + 4; sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, addr, r1, 0); VdbeCoverage(v); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm+1, r1,regResult,nResultCol); assert( pSort==0 ); } #endif if( pSort ){ assert( regResult==regOrig ); pushOntoSorter(pParse, pSort, p, r1+nPrefixReg, regOrig, 1, nPrefixReg); }else{ int r2 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2); sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2); sqlite3VdbeChangeP5(v, OPFLAG_APPEND); sqlite3ReleaseTempReg(pParse, r2); } sqlite3ReleaseTempRange(pParse, r1, nPrefixReg+1); break; } #ifndef SQLITE_OMIT_SUBQUERY /* If we are creating a set for an \"expr IN (SELECT ...)\" construct, ** then there should be a single item on the stack. Write this ** item into the set table with bogus data. */ case SRT_Set: { if( pSort ){ /* At first glance you would think we could optimize out the ** ORDER BY in this case since the order of entries in the set ** does not matter. But there might be a LIMIT clause, in which ** case the order does matter */ pushOntoSorter( pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else{ int r1 = sqlite3GetTempReg(pParse); assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, r1, pDest->zAffSdst, nResultCol); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); sqlite3ReleaseTempReg(pParse, r1); } break; } /* If any row exist in the result set, record that fact and abort. */ case SRT_Exists: { sqlite3VdbeAddOp2(v, OP_Integer, 1, iParm); /* The LIMIT clause will terminate the loop for us */ break; } /* If this is a scalar select that is part of an expression, then ** store the results in the appropriate memory cell or array of ** memory cells and break out of the scan loop. */ case SRT_Mem: { if( pSort ){ assert( nResultCol<=pDest->nSdst ); pushOntoSorter( pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else{ assert( nResultCol==pDest->nSdst ); assert( regResult==iParm ); /* The LIMIT clause will jump out of the loop for us */ } break; } #endif /* #ifndef SQLITE_OMIT_SUBQUERY */ case SRT_Coroutine: /* Send data to a co-routine */ case SRT_Output: { /* Return the results */ testcase( eDest==SRT_Coroutine ); testcase( eDest==SRT_Output ); if( pSort ){ pushOntoSorter(pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else if( eDest==SRT_Coroutine ){ sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); }else{ sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol); } break; } #ifndef SQLITE_OMIT_CTE /* Write the results into a priority queue that is order according to ** pDest->pOrderBy (in pSO). pDest->iSDParm (in iParm) is the cursor for an ** index with pSO->nExpr+2 columns. Build a key using pSO for the first ** pSO->nExpr columns, then make sure all keys are unique by adding a ** final OP_Sequence column. The last column is the record as a blob. */ case SRT_DistQueue: case SRT_Queue: { int nKey; int r1, r2, r3; int addrTest = 0; ExprList *pSO; pSO = pDest->pOrderBy; assert( pSO ); nKey = pSO->nExpr; r1 = sqlite3GetTempReg(pParse); r2 = sqlite3GetTempRange(pParse, nKey+2); r3 = r2+nKey+1; if( eDest==SRT_DistQueue ){ /* If the destination is DistQueue, then cursor (iParm+1) is open ** on a second ephemeral index that holds all values every previously ** added to the queue. */ addrTest = sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, 0, regResult, nResultCol); VdbeCoverage(v); } sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r3); if( eDest==SRT_DistQueue ){ sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r3); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); } for(i=0; ia[i].u.x.iOrderByCol - 1, r2+i); } sqlite3VdbeAddOp2(v, OP_Sequence, iParm, r2+nKey); sqlite3VdbeAddOp3(v, OP_MakeRecord, r2, nKey+2, r1); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, r2, nKey+2); if( addrTest ) sqlite3VdbeJumpHere(v, addrTest); sqlite3ReleaseTempReg(pParse, r1); sqlite3ReleaseTempRange(pParse, r2, nKey+2); break; } #endif /* SQLITE_OMIT_CTE */ #if !defined(SQLITE_OMIT_TRIGGER) /* Discard the results. This is used for SELECT statements inside ** the body of a TRIGGER. The purpose of such selects is to call ** user-defined functions that have side effects. We do not care ** about the actual results of the select. */ default: { assert( eDest==SRT_Discard ); break; } #endif } /* Jump to the end of the loop if the LIMIT is reached. Except, if ** there is a sorter, in which case the sorter has already limited ** the output for us. */ if( pSort==0 && p->iLimit ){ sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376252, "input": "static int git_use_proxy(const char *host) { git_proxy_command = getenv(\"GIT_PROXY_COMMAND\"); git_config(git_proxy_command_options, (void*)host); return (git_proxy_command && *git_proxy_command); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330260, "input": "ex_mode(exarg_T *eap) { if (*eap->arg == NUL) shell_resized(); else emsg(_(e_screenmode)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402512, "input": "static int update_bg_scan(struct hci_request *req, unsigned long opt) { hci_dev_lock(req->hdev); __hci_update_background_scan(req); hci_dev_unlock(req->hdev); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255343, "input": "bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest) { uint8_t byte; uint8_t bitpos = 0; uint64_t result = 0; do { if (bitpos >= 64) PB_RETURN_ERROR(stream, \"varint overflow\"); if (!pb_readbyte(stream, &byte)) return false; result |= (uint64_t)(byte & 0x7F) << bitpos; bitpos = (uint8_t)(bitpos + 7); } while (byte & 0x80); *dest = result; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195387, "input": "int64_t OpLevelCostEstimator::CalculateTensorSize( const OpInfo::TensorProperties& tensor, bool* found_unknown_shapes) { int64_t count = CalculateTensorElementCount(tensor, found_unknown_shapes); int size = DataTypeSize(BaseType(tensor.dtype())); VLOG(2) << \"Count: \" << count << \" DataTypeSize: \" << size; return count * size; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "Tensorflow is an Open Source Machine Learning Framework. The implementation of `OpLevelCostEstimator::CalculateTensorSize` is vulnerable to an integer overflow if an attacker can create an operation which would involve a tensor with large enough number of elements. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2022-23575"}} -{"idx": 409677, "input": "static BOOL rdp_write_sound_capability_set(wStream* s, const rdpSettings* settings) { size_t header; UINT16 soundFlags; if (!Stream_EnsureRemainingCapacity(s, 32)) return FALSE; header = rdp_capability_set_start(s); if (header > UINT16_MAX) return FALSE; soundFlags = (settings->SoundBeepsEnabled) ? SOUND_BEEPS_FLAG : 0; Stream_Write_UINT16(s, soundFlags); /* soundFlags (2 bytes) */ Stream_Write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */ rdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_SOUND); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277010, "input": "VarDimArray shape() const { return shape_; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421798, "input": "lan_set_arp_generate(struct ipmi_intf * intf, uint8_t chan, uint8_t ctl) { struct lan_param *lp; uint8_t data; lp = get_lan_param(intf, chan, IPMI_LANP_BMC_ARP); if (!lp) return -1; if (!lp->data) return -1; data = lp->data[0]; /* set arp generate bitflag */ if (ctl == 0) data &= ~0x1; else data |= 0x1; printf(\"%sabling BMC-generated Gratuitous ARPs\\n\", ctl ? \"En\" : \"Dis\"); return set_lan_param(intf, chan, IPMI_LANP_BMC_ARP, &data, 1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458356, "input": "static unsigned find_battery_quirk(struct hid_device *hdev) { unsigned quirks = 0; const struct hid_device_id *match; match = hid_match_id(hdev, hid_battery_quirks); if (match != NULL) quirks = match->driver_data; return quirks; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224921, "input": "u32 gf_isom_get_supported_box_type(u32 idx) { return box_registry[idx].box_4cc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431066, "input": "static void nfs4_xdr_enc_setacl(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs_setaclargs *args = data; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_setacl(xdr, args, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519078, "input": "void ecall_non_oblivious_aggregate_step1( uint8_t *agg_op, size_t agg_op_length, uint8_t *input_rows, size_t input_rows_length, uint8_t **first_row, size_t *first_row_length, uint8_t **last_group, size_t *last_group_length, uint8_t **last_row, size_t *last_row_length) { // Guard against operating on arbitrary enclave memory assert(sgx_is_outside_enclave(input_rows, input_rows_length) == 1); sgx_lfence(); try { non_oblivious_aggregate_step1( agg_op, agg_op_length, input_rows, input_rows_length, first_row, first_row_length, last_group, last_group_length, last_row, last_row_length); } catch (const std::runtime_error &e) { ocall_throw(e.what()); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230491, "input": "void CLua::print_stack() { struct lua_Debug dbg; int i = 0; lua_State *L = state(); fprintf(stderr, \"\\n\"); while (lua_getstack(L, i++, &dbg) == 1) { lua_getinfo(L, \"lnuS\", &dbg); char* file = strrchr(dbg.short_src, '/'); if (file == nullptr) file = dbg.short_src; else file++; fprintf(stderr, \"%s, function %s, line %d\\n\", file, dbg.name, dbg.currentline); } fprintf(stderr, \"\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232437, "input": "static const char *ltrim(const char *s) { while (isspace(*s)) s++; return s; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215361, "input": "static int dccp_setsockopt_change(struct sock *sk, int type, struct dccp_so_feat __user *optval) { struct dccp_so_feat opt; u8 *val; int rc; if (copy_from_user(&opt, optval, sizeof(opt))) return -EFAULT; val = kmalloc(opt.dccpsf_len, GFP_KERNEL); if (!val) return -ENOMEM; if (copy_from_user(val, opt.dccpsf_val, opt.dccpsf_len)) { rc = -EFAULT; goto out_free_val; } rc = dccp_feat_change(dccp_msk(sk), type, opt.dccpsf_feat, val, opt.dccpsf_len, GFP_KERNEL); if (rc) goto out_free_val; out: return rc; out_free_val: kfree(val); goto out; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "Integer overflow in the dccp_setsockopt_change function in net/dccp/proto.c in the Datagram Congestion Control Protocol (DCCP) subsystem in the Linux kernel 2.6.17-rc1 through 2.6.26.2 allows remote attackers to cause a denial of service (panic) via a crafted integer value, related to Change L and Change R options without at least one byte in the dccpsf_val field.", "severity_level": "High", "cwe": "CWE-189", "cve": "CVE-2008-3276"}} -{"idx": 265781, "input": "void CWebSessionMap::FinishUserSessions(const CUser& User) { iterator it = m_mItems.begin(); while (it != m_mItems.end()) { if (it->second.second->GetUser() == &User) { m_mItems.erase(it++); } else { ++it; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 477992, "input": "sug_write(spellinfo_T *spin, char_u *fname) { FILE *fd; wordnode_T *tree; int nodecount; int wcount; char_u *line; linenr_T lnum; int len; /* Create the file. Note that an existing file is silently overwritten! */ fd = mch_fopen((char *)fname, \"w\"); if (fd == NULL) { EMSG2(_(e_notopen), fname); return; } vim_snprintf((char *)IObuff, IOSIZE, _(\"Writing suggestion file %s ...\"), fname); spell_message(spin, IObuff); /* * : */ if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) /* */ { EMSG(_(e_write)); goto theend; } putc(VIMSUGVERSION, fd); /* */ /* Write si_sugtime to the file. */ put_time(fd, spin->si_sugtime); /* */ /* * */ spin->si_memtot = 0; tree = spin->si_foldroot->wn_sibling; /* Clear the index and wnode fields in the tree. */ clear_node(tree); /* Count the number of nodes. Needed to be able to allocate the * memory when reading the nodes. Also fills in index for shared * nodes. */ nodecount = put_node(NULL, tree, 0, 0, FALSE); /* number of nodes in 4 bytes */ put_bytes(fd, (long_u)nodecount, 4); /* */ spin->si_memtot += nodecount + nodecount * sizeof(int); /* Write the nodes. */ (void)put_node(fd, tree, 0, 0, FALSE); /* * : ... */ wcount = spin->si_spellbuf->b_ml.ml_line_count; put_bytes(fd, (long_u)wcount, 4); /* */ for (lnum = 1; lnum <= (linenr_T)wcount; ++lnum) { /* : ... NUL */ line = ml_get_buf(spin->si_spellbuf, lnum, FALSE); len = (int)STRLEN(line) + 1; if (fwrite(line, (size_t)len, (size_t)1, fd) == 0) { EMSG(_(e_write)); goto theend; } spin->si_memtot += len; } /* Write another byte to check for errors. */ if (putc(0, fd) == EOF) EMSG(_(e_write)); vim_snprintf((char *)IObuff, IOSIZE, _(\"Estimated runtime memory use: %d bytes\"), spin->si_memtot); spell_message(spin, IObuff); theend: /* close the file */ fclose(fd); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398162, "input": "static int sctp_setsockopt_auth_key(struct sock *sk, struct sctp_authkey *authkey, unsigned int optlen) { struct sctp_endpoint *ep = sctp_sk(sk)->ep; struct sctp_association *asoc; int ret = -EINVAL; if (optlen <= sizeof(struct sctp_authkey)) return -EINVAL; /* authkey->sca_keylength is u16, so optlen can't be bigger than * this. */ optlen = min_t(unsigned int, optlen, USHRT_MAX + sizeof(*authkey)); if (authkey->sca_keylength > optlen - sizeof(*authkey)) goto out; asoc = sctp_id2assoc(sk, authkey->sca_assoc_id); if (!asoc && authkey->sca_assoc_id > SCTP_ALL_ASSOC && sctp_style(sk, UDP)) goto out; if (asoc) { ret = sctp_auth_set_key(ep, asoc, authkey); goto out; } if (sctp_style(sk, TCP)) authkey->sca_assoc_id = SCTP_FUTURE_ASSOC; if (authkey->sca_assoc_id == SCTP_FUTURE_ASSOC || authkey->sca_assoc_id == SCTP_ALL_ASSOC) { ret = sctp_auth_set_key(ep, asoc, authkey); if (ret) goto out; } ret = 0; if (authkey->sca_assoc_id == SCTP_CURRENT_ASSOC || authkey->sca_assoc_id == SCTP_ALL_ASSOC) { list_for_each_entry(asoc, &ep->asocs, asocs) { int res = sctp_auth_set_key(ep, asoc, authkey); if (res && !ret) ret = res; } } out: memzero_explicit(authkey, optlen); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293701, "input": "int ksys_unshare(unsigned long unshare_flags) { struct fs_struct *fs, *new_fs = NULL; struct files_struct *fd, *new_fd = NULL; struct cred *new_cred = NULL; struct nsproxy *new_nsproxy = NULL; int do_sysvsem = 0; int err; /* * If unsharing a user namespace must also unshare the thread group * and unshare the filesystem root and working directories. */ if (unshare_flags & CLONE_NEWUSER) unshare_flags |= CLONE_THREAD | CLONE_FS; /* * If unsharing vm, must also unshare signal handlers. */ if (unshare_flags & CLONE_VM) unshare_flags |= CLONE_SIGHAND; /* * If unsharing a signal handlers, must also unshare the signal queues. */ if (unshare_flags & CLONE_SIGHAND) unshare_flags |= CLONE_THREAD; /* * If unsharing namespace, must also unshare filesystem information. */ if (unshare_flags & CLONE_NEWNS) unshare_flags |= CLONE_FS; err = check_unshare_flags(unshare_flags); if (err) goto bad_unshare_out; /* * CLONE_NEWIPC must also detach from the undolist: after switching * to a new ipc namespace, the semaphore arrays from the old * namespace are unreachable. */ if (unshare_flags & (CLONE_NEWIPC|CLONE_SYSVSEM)) do_sysvsem = 1; err = unshare_fs(unshare_flags, &new_fs); if (err) goto bad_unshare_out; err = unshare_fd(unshare_flags, NR_OPEN_MAX, &new_fd); if (err) goto bad_unshare_cleanup_fs; err = unshare_userns(unshare_flags, &new_cred); if (err) goto bad_unshare_cleanup_fd; err = unshare_nsproxy_namespaces(unshare_flags, &new_nsproxy, new_cred, new_fs); if (err) goto bad_unshare_cleanup_cred; if (new_fs || new_fd || do_sysvsem || new_cred || new_nsproxy) { if (do_sysvsem) { /* * CLONE_SYSVSEM is equivalent to sys_exit(). */ exit_sem(current); } if (unshare_flags & CLONE_NEWIPC) { /* Orphan segments in old ns (see sem above). */ exit_shm(current); shm_init_task(current); } if (new_nsproxy) switch_task_namespaces(current, new_nsproxy); task_lock(current); if (new_fs) { fs = current->fs; spin_lock(&fs->lock); current->fs = new_fs; if (--fs->users) new_fs = NULL; else new_fs = fs; spin_unlock(&fs->lock); } if (new_fd) { fd = current->files; current->files = new_fd; new_fd = fd; } task_unlock(current); if (new_cred) { /* Install the new user namespace */ commit_creds(new_cred); new_cred = NULL; } } perf_event_namespaces(current); bad_unshare_cleanup_cred: if (new_cred) put_cred(new_cred); bad_unshare_cleanup_fd: if (new_fd) put_files_struct(new_fd); bad_unshare_cleanup_fs: if (new_fs) free_fs_struct(new_fs); bad_unshare_out: return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219235, "input": "bool HHVM_FUNCTION(socket_shutdown, const Resource& socket, int how /* = 0 */) { /* For some operations that are conceptually a socket operation * (eg fopen('http://...)) we actually complete it and store the result in * a memfile. As the fact that it's not really a socket is an implementation * detail, user code needs to be able to call shutdown on it. */ if (socket->instanceof()) { return true; } auto sock = cast(socket); if (shutdown(sock->fd(), how) != 0) { SOCKET_ERROR(sock, \"unable to shutdown socket\", errno); return false; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246255, "input": "static const char *set_limit_req_body(cmd_parms *cmd, void *conf_, const char *arg) { core_dir_config *conf = conf_; char *errp; if (APR_SUCCESS != apr_strtoff(&conf->limit_req_body, arg, &errp, 10)) { return \"LimitRequestBody argument is not parsable.\"; } if (*errp || conf->limit_req_body < 0) { return \"LimitRequestBody requires a non-negative integer.\"; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 291472, "input": "static void php_openssl_load_cipher_mode(struct php_openssl_cipher_mode *mode, const EVP_CIPHER *cipher_type) /* {{{ */ { switch (EVP_CIPHER_mode(cipher_type)) { #ifdef EVP_CIPH_GCM_MODE case EVP_CIPH_GCM_MODE: mode->is_aead = 1; mode->is_single_run_aead = 0; mode->aead_get_tag_flag = EVP_CTRL_GCM_GET_TAG; mode->aead_set_tag_flag = EVP_CTRL_GCM_SET_TAG; mode->aead_ivlen_flag = EVP_CTRL_GCM_SET_IVLEN; break; #endif #ifdef EVP_CIPH_CCM_MODE case EVP_CIPH_CCM_MODE: mode->is_aead = 1; mode->is_single_run_aead = 1; mode->aead_get_tag_flag = EVP_CTRL_CCM_GET_TAG; mode->aead_set_tag_flag = EVP_CTRL_CCM_SET_TAG; mode->aead_ivlen_flag = EVP_CTRL_CCM_SET_IVLEN; break; #endif default: memset(mode, 0, sizeof(struct php_openssl_cipher_mode)); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269172, "input": "inline int MatchingFlatSize(const Dims& dims, const Dims& check_dims_0) { for (int i = 0; i < N; ++i) { TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); } return FlatSize(dims); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 251471, "input": "connection_state_machine (connection * const con) { request_st * const r = &con->request; if (r->http_version == HTTP_VERSION_2) connection_state_machine_h2(r, con); else /* if (r->http_version <= HTTP_VERSION_1_1) */ connection_state_machine_h1(r, con); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232453, "input": "static int check_ptr_alignment(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int off, int size, bool strict_alignment_once) { bool strict = env->strict_alignment || strict_alignment_once; const char *pointer_desc = \"\"; switch (reg->type) { case PTR_TO_PACKET: case PTR_TO_PACKET_META: /* Special case, because of NET_IP_ALIGN. Given metadata sits * right in front, treat it the very same way. */ return check_pkt_ptr_alignment(env, reg, off, size, strict); case PTR_TO_FLOW_KEYS: pointer_desc = \"flow keys \"; break; case PTR_TO_MAP_VALUE: pointer_desc = \"value \"; break; case PTR_TO_CTX: pointer_desc = \"context \"; break; case PTR_TO_STACK: pointer_desc = \"stack \"; /* The stack spill tracking logic in check_stack_write() * and check_stack_read() relies on stack accesses being * aligned. */ strict = true; break; case PTR_TO_SOCKET: pointer_desc = \"sock \"; break; case PTR_TO_SOCK_COMMON: pointer_desc = \"sock_common \"; break; case PTR_TO_TCP_SOCK: pointer_desc = \"tcp_sock \"; break; case PTR_TO_XDP_SOCK: pointer_desc = \"xdp_sock \"; break; default: break; } return check_generic_ptr_alignment(env, reg, pointer_desc, off, size, strict); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429631, "input": "mysql_dump_debug_info(MYSQL *mysql) { return(ma_simple_command(mysql, COM_DEBUG,0,0,0,0)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197290, "input": "GF_Err gf_hinter_track_process(GF_RTPHinter *tkHint) { GF_Err e; u32 i, descIndex, duration; u64 ts; u8 PadBits; GF_Fraction ft; GF_ISOSample *samp; tkHint->HintSample = tkHint->RTPTime = 0; tkHint->TotalSample = gf_isom_get_sample_count(tkHint->file, tkHint->TrackNum); ft.num = tkHint->rtp_p->sl_config.timestampResolution; ft.den = tkHint->OrigTimeScale; e = GF_OK; for (i=0; iTotalSample; i++) { samp = gf_isom_get_sample(tkHint->file, tkHint->TrackNum, i+1, &descIndex); if (!samp) return gf_isom_last_error(tkHint->file); //setup SL tkHint->CurrentSample = i + 1; /*keep same AU indicator if sync shadow - TODO FIXME: this assumes shadows are placed interleaved with the track content which is the case for GPAC scene carousel generation, but may not always be true*/ if (samp->IsRAP==RAP_REDUNDANT) { tkHint->rtp_p->sl_header.AU_sequenceNumber -= 1; samp->IsRAP = RAP; } ts = ft.num * (samp->DTS+samp->CTS_Offset) / ft.den; tkHint->rtp_p->sl_header.compositionTimeStamp = ts; ts = ft.num * samp->DTS / ft.den; tkHint->rtp_p->sl_header.decodingTimeStamp = ts; tkHint->rtp_p->sl_header.randomAccessPointFlag = samp->IsRAP; tkHint->base_offset_in_sample = 0; /*crypted*/ if (tkHint->rtp_p->slMap.IV_length) { GF_ISMASample *s = gf_isom_get_ismacryp_sample(tkHint->file, tkHint->TrackNum, samp, descIndex); /*one byte take for selective_enc flag*/ if (s->flags & GF_ISOM_ISMA_USE_SEL_ENC) tkHint->base_offset_in_sample += 1; if (s->flags & GF_ISOM_ISMA_IS_ENCRYPTED) tkHint->base_offset_in_sample += s->IV_length + s->KI_length; gf_free(samp->data); samp->data = s->data; samp->dataLength = s->dataLength; gf_rtp_builder_set_cryp_info(tkHint->rtp_p, s->IV, (char*)s->key_indicator, (s->flags & GF_ISOM_ISMA_IS_ENCRYPTED) ? 1 : 0); s->data = NULL; s->dataLength = 0; gf_isom_ismacryp_delete_sample(s); } if (tkHint->rtp_p->sl_config.usePaddingFlag) { gf_isom_get_sample_padding_bits(tkHint->file, tkHint->TrackNum, i+1, &PadBits); tkHint->rtp_p->sl_header.paddingBits = PadBits; } else { tkHint->rtp_p->sl_header.paddingBits = 0; } duration = gf_isom_get_sample_duration(tkHint->file, tkHint->TrackNum, i+1); // ts = (u32) (ft * (s64) (duration)); /*unpack nal units*/ if (tkHint->avc_nalu_size) { u32 v, size; u32 remain = samp->dataLength; char *ptr = samp->data; tkHint->rtp_p->sl_header.accessUnitStartFlag = 1; tkHint->rtp_p->sl_header.accessUnitEndFlag = 0; while (remain) { size = 0; v = tkHint->avc_nalu_size; if (v>remain) { GF_LOG(GF_LOG_ERROR, GF_LOG_RTP, (\"[rtp hinter] Broken AVC nalu encapsulation: NALU size length is %d but only %d bytes left in sample %d\\n\", v, remain, tkHint->CurrentSample)); break; } while (v) { size |= (u8) *ptr; ptr++; remain--; v-=1; if (v) size<<=8; } tkHint->base_offset_in_sample = samp->dataLength-remain; if (remain < size) { GF_LOG(GF_LOG_ERROR, GF_LOG_RTP, (\"[rtp hinter] Broken AVC nalu encapsulation: NALU size is %d but only %d bytes left in sample %d\\n\", size, remain, tkHint->CurrentSample)); break; } remain -= size; tkHint->rtp_p->sl_header.accessUnitEndFlag = remain ? 0 : 1; e = gf_rtp_builder_process(tkHint->rtp_p, ptr, size, (u8) !remain, samp->dataLength, duration, (u8) (descIndex + GF_RTP_TX3G_SIDX_OFFSET) ); ptr += size; tkHint->rtp_p->sl_header.accessUnitStartFlag = 0; } } else { e = gf_rtp_builder_process(tkHint->rtp_p, samp->data, samp->dataLength, 1, samp->dataLength, duration, (u8) (descIndex + GF_RTP_TX3G_SIDX_OFFSET) ); } tkHint->rtp_p->sl_header.packetSequenceNumber += 1; //signal some progress gf_set_progress(\"Hinting\", tkHint->CurrentSample, tkHint->TotalSample); tkHint->rtp_p->sl_header.AU_sequenceNumber += 1; gf_isom_sample_del(&samp); if (e) return e; } //flush gf_rtp_builder_process(tkHint->rtp_p, NULL, 0, 1, 0, 0, 0); gf_isom_end_hint_sample(tkHint->file, tkHint->HintTrack, (u8) tkHint->SampleIsRAP); return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "An issue was discovered in GPAC version 0.8.0 and 1.0.1. There is heap-based buffer overflow in the function gp_rtp_builder_do_avc() in ietf/rtp_pck_mpeg4.c.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-35979"}} -{"idx": 229853, "input": "_libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, size_t datalen, int macstate) { int rc = 0; unsigned char *message = NULL; unsigned char *language = NULL; size_t message_len = 0; size_t language_len = 0; LIBSSH2_CHANNEL *channelp = NULL; size_t data_head = 0; unsigned char msg = data[0]; switch(session->packAdd_state) { case libssh2_NB_state_idle: _libssh2_debug(session, LIBSSH2_TRACE_TRANS, \"Packet type %d received, length=%d\", (int) msg, (int) datalen); if((macstate == LIBSSH2_MAC_INVALID) && (!session->macerror || LIBSSH2_MACERROR(session, (char *) data, datalen))) { /* Bad MAC input, but no callback set or non-zero return from the callback */ LIBSSH2_FREE(session, data); return _libssh2_error(session, LIBSSH2_ERROR_INVALID_MAC, \"Invalid MAC received\"); } session->packAdd_state = libssh2_NB_state_allocated; break; case libssh2_NB_state_jump1: goto libssh2_packet_add_jump_point1; case libssh2_NB_state_jump2: goto libssh2_packet_add_jump_point2; case libssh2_NB_state_jump3: goto libssh2_packet_add_jump_point3; case libssh2_NB_state_jump4: goto libssh2_packet_add_jump_point4; case libssh2_NB_state_jump5: goto libssh2_packet_add_jump_point5; default: /* nothing to do */ break; } if(session->packAdd_state == libssh2_NB_state_allocated) { /* A couple exceptions to the packet adding rule: */ switch(msg) { /* byte SSH_MSG_DISCONNECT uint32 reason code string description in ISO-10646 UTF-8 encoding [RFC3629] string language tag [RFC3066] */ case SSH_MSG_DISCONNECT: if(datalen >= 5) { uint32_t reason = 0; struct string_buf buf; buf.data = (unsigned char *)data; buf.dataptr = buf.data; buf.len = datalen; buf.dataptr++; /* advance past type */ _libssh2_get_u32(&buf, &reason); _libssh2_get_string(&buf, &message, &message_len); _libssh2_get_string(&buf, &language, &language_len); if(session->ssh_msg_disconnect) { LIBSSH2_DISCONNECT(session, reason, (const char *)message, message_len, (const char *)language, language_len); } _libssh2_debug(session, LIBSSH2_TRACE_TRANS, \"Disconnect(%d): %s(%s)\", reason, message, language); } LIBSSH2_FREE(session, data); session->socket_state = LIBSSH2_SOCKET_DISCONNECTED; session->packAdd_state = libssh2_NB_state_idle; return _libssh2_error(session, LIBSSH2_ERROR_SOCKET_DISCONNECT, \"socket disconnect\"); /* byte SSH_MSG_IGNORE string data */ case SSH_MSG_IGNORE: if(datalen >= 2) { if(session->ssh_msg_ignore) { LIBSSH2_IGNORE(session, (char *) data + 1, datalen - 1); } } else if(session->ssh_msg_ignore) { LIBSSH2_IGNORE(session, \"\", 0); } LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; /* byte SSH_MSG_DEBUG boolean always_display string message in ISO-10646 UTF-8 encoding [RFC3629] string language tag [RFC3066] */ case SSH_MSG_DEBUG: if(datalen >= 2) { int always_display = data[1]; if(datalen >= 6) { struct string_buf buf; buf.data = (unsigned char *)data; buf.dataptr = buf.data; buf.len = datalen; buf.dataptr += 2; /* advance past type & always display */ _libssh2_get_string(&buf, &message, &message_len); _libssh2_get_string(&buf, &language, &language_len); } if(session->ssh_msg_debug) { LIBSSH2_DEBUG(session, always_display, (const char *)message, message_len, (const char *)language, language_len); } } /* * _libssh2_debug will actually truncate this for us so * that it's not an inordinate about of data */ _libssh2_debug(session, LIBSSH2_TRACE_TRANS, \"Debug Packet: %s\", message); LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; /* byte SSH_MSG_GLOBAL_REQUEST string request name in US-ASCII only boolean want reply .... request-specific data follows */ case SSH_MSG_GLOBAL_REQUEST: if(datalen >= 5) { uint32_t len = 0; unsigned char want_reply = 0; len = _libssh2_ntohu32(data + 1); if((len <= (UINT_MAX - 6)) && (datalen >= (6 + len))) { want_reply = data[5 + len]; _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Received global request type %.*s (wr %X)\", len, data + 5, want_reply); } if(want_reply) { static const unsigned char packet = SSH_MSG_REQUEST_FAILURE; libssh2_packet_add_jump_point5: session->packAdd_state = libssh2_NB_state_jump5; rc = _libssh2_transport_send(session, &packet, 1, NULL, 0); if(rc == LIBSSH2_ERROR_EAGAIN) return rc; } } LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; /* byte SSH_MSG_CHANNEL_EXTENDED_DATA uint32 recipient channel uint32 data_type_code string data */ case SSH_MSG_CHANNEL_EXTENDED_DATA: /* streamid(4) */ data_head += 4; /* fall-through */ /* byte SSH_MSG_CHANNEL_DATA uint32 recipient channel string data */ case SSH_MSG_CHANNEL_DATA: /* packet_type(1) + channelno(4) + datalen(4) */ data_head += 9; if(datalen >= data_head) channelp = _libssh2_channel_locate(session, _libssh2_ntohu32(data + 1)); if(!channelp) { _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_UNKNOWN, \"Packet received for unknown channel\"); LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; } #ifdef LIBSSH2DEBUG { uint32_t stream_id = 0; if(msg == SSH_MSG_CHANNEL_EXTENDED_DATA) stream_id = _libssh2_ntohu32(data + 5); _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"%d bytes packet_add() for %lu/%lu/%lu\", (int) (datalen - data_head), channelp->local.id, channelp->remote.id, stream_id); } #endif if((channelp->remote.extended_data_ignore_mode == LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE) && (msg == SSH_MSG_CHANNEL_EXTENDED_DATA)) { /* Pretend we didn't receive this */ LIBSSH2_FREE(session, data); _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Ignoring extended data and refunding %d bytes\", (int) (datalen - 13)); if(channelp->read_avail + datalen - data_head >= channelp->remote.window_size) datalen = channelp->remote.window_size - channelp->read_avail + data_head; channelp->remote.window_size -= datalen - data_head; _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"shrinking window size by %lu bytes to %lu, \" \"read_avail %lu\", datalen - data_head, channelp->remote.window_size, channelp->read_avail); session->packAdd_channelp = channelp; /* Adjust the window based on the block we just freed */ libssh2_packet_add_jump_point1: session->packAdd_state = libssh2_NB_state_jump1; rc = _libssh2_channel_receive_window_adjust(session-> packAdd_channelp, datalen - 13, 1, NULL); if(rc == LIBSSH2_ERROR_EAGAIN) return rc; session->packAdd_state = libssh2_NB_state_idle; return 0; } /* * REMEMBER! remote means remote as source of data, * NOT remote window! */ if(channelp->remote.packet_size < (datalen - data_head)) { /* * Spec says we MAY ignore bytes sent beyond * packet_size */ _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED, \"Packet contains more data than we offered\" \" to receive, truncating\"); datalen = channelp->remote.packet_size + data_head; } if(channelp->remote.window_size <= channelp->read_avail) { /* * Spec says we MAY ignore bytes sent beyond * window_size */ _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED, \"The current receive window is full,\" \" data ignored\"); LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; } /* Reset EOF status */ channelp->remote.eof = 0; if(channelp->read_avail + datalen - data_head > channelp->remote.window_size) { _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED, \"Remote sent more data than current \" \"window allows, truncating\"); datalen = channelp->remote.window_size - channelp->read_avail + data_head; } /* Update the read_avail counter. The window size will be * updated once the data is actually read from the queue * from an upper layer */ channelp->read_avail += datalen - data_head; _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"increasing read_avail by %lu bytes to %lu/%lu\", (long)(datalen - data_head), (long)channelp->read_avail, (long)channelp->remote.window_size); break; /* byte SSH_MSG_CHANNEL_EOF uint32 recipient channel */ case SSH_MSG_CHANNEL_EOF: if(datalen >= 5) channelp = _libssh2_channel_locate(session, _libssh2_ntohu32(data + 1)); if(!channelp) /* We may have freed already, just quietly ignore this... */ ; else { _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"EOF received for channel %lu/%lu\", channelp->local.id, channelp->remote.id); channelp->remote.eof = 1; } LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; /* byte SSH_MSG_CHANNEL_REQUEST uint32 recipient channel string request type in US-ASCII characters only boolean want reply .... type-specific data follows */ case SSH_MSG_CHANNEL_REQUEST: if(datalen >= 9) { uint32_t channel = _libssh2_ntohu32(data + 1); uint32_t len = _libssh2_ntohu32(data + 5); unsigned char want_reply = 1; if((len + 9) < datalen) want_reply = data[len + 9]; _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Channel %d received request type %.*s (wr %X)\", channel, len, data + 9, want_reply); if(len == sizeof(\"exit-status\") - 1 && (sizeof(\"exit-status\") - 1 + 9) <= datalen && !memcmp(\"exit-status\", data + 9, sizeof(\"exit-status\") - 1)) { /* we've got \"exit-status\" packet. Set the session value */ if(datalen >= 20) channelp = _libssh2_channel_locate(session, channel); if(channelp && (sizeof(\"exit-status\") + 13) <= datalen) { channelp->exit_status = _libssh2_ntohu32(data + 9 + sizeof(\"exit-status\")); _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Exit status %lu received for \" \"channel %lu/%lu\", channelp->exit_status, channelp->local.id, channelp->remote.id); } } else if(len == sizeof(\"exit-signal\") - 1 && (sizeof(\"exit-signal\") - 1 + 9) <= datalen && !memcmp(\"exit-signal\", data + 9, sizeof(\"exit-signal\") - 1)) { /* command terminated due to signal */ if(datalen >= 20) channelp = _libssh2_channel_locate(session, channel); if(channelp && (sizeof(\"exit-signal\") + 13) <= datalen) { /* set signal name (without SIG prefix) */ uint32_t namelen = _libssh2_ntohu32(data + 9 + sizeof(\"exit-signal\")); if(namelen <= UINT_MAX - 1) { channelp->exit_signal = LIBSSH2_ALLOC(session, namelen + 1); } else { channelp->exit_signal = NULL; } if(!channelp->exit_signal) rc = _libssh2_error(session, LIBSSH2_ERROR_ALLOC, \"memory for signal name\"); else if((sizeof(\"exit-signal\") + 13 + namelen <= datalen)) { memcpy(channelp->exit_signal, data + 13 + sizeof(\"exit-signal\"), namelen); channelp->exit_signal[namelen] = '\\0'; /* TODO: save error message and language tag */ _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Exit signal %s received for \" \"channel %lu/%lu\", channelp->exit_signal, channelp->local.id, channelp->remote.id); } } } if(want_reply) { unsigned char packet[5]; libssh2_packet_add_jump_point4: session->packAdd_state = libssh2_NB_state_jump4; packet[0] = SSH_MSG_CHANNEL_FAILURE; memcpy(&packet[1], data + 1, 4); rc = _libssh2_transport_send(session, packet, 5, NULL, 0); if(rc == LIBSSH2_ERROR_EAGAIN) return rc; } } LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return rc; /* byte SSH_MSG_CHANNEL_CLOSE uint32 recipient channel */ case SSH_MSG_CHANNEL_CLOSE: if(datalen >= 5) channelp = _libssh2_channel_locate(session, _libssh2_ntohu32(data + 1)); if(!channelp) { /* We may have freed already, just quietly ignore this... */ LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; } _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Close received for channel %lu/%lu\", channelp->local.id, channelp->remote.id); channelp->remote.close = 1; channelp->remote.eof = 1; LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; /* byte SSH_MSG_CHANNEL_OPEN string \"session\" uint32 sender channel uint32 initial window size uint32 maximum packet size */ case SSH_MSG_CHANNEL_OPEN: if(datalen < 17) ; else if((datalen >= (sizeof(\"forwarded-tcpip\") + 4)) && ((sizeof(\"forwarded-tcpip\") - 1) == _libssh2_ntohu32(data + 1)) && (memcmp(data + 5, \"forwarded-tcpip\", sizeof(\"forwarded-tcpip\") - 1) == 0)) { /* init the state struct */ memset(&session->packAdd_Qlstn_state, 0, sizeof(session->packAdd_Qlstn_state)); libssh2_packet_add_jump_point2: session->packAdd_state = libssh2_NB_state_jump2; rc = packet_queue_listener(session, data, datalen, &session->packAdd_Qlstn_state); } else if((datalen >= (sizeof(\"x11\") + 4)) && ((sizeof(\"x11\") - 1) == _libssh2_ntohu32(data + 1)) && (memcmp(data + 5, \"x11\", sizeof(\"x11\") - 1) == 0)) { /* init the state struct */ memset(&session->packAdd_x11open_state, 0, sizeof(session->packAdd_x11open_state)); libssh2_packet_add_jump_point3: session->packAdd_state = libssh2_NB_state_jump3; rc = packet_x11_open(session, data, datalen, &session->packAdd_x11open_state); } if(rc == LIBSSH2_ERROR_EAGAIN) return rc; LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return rc; /* byte SSH_MSG_CHANNEL_WINDOW_ADJUST uint32 recipient channel uint32 bytes to add */ case SSH_MSG_CHANNEL_WINDOW_ADJUST: if(datalen < 9) ; else { uint32_t bytestoadd = _libssh2_ntohu32(data + 5); channelp = _libssh2_channel_locate(session, _libssh2_ntohu32(data + 1)); if(channelp) { channelp->local.window_size += bytestoadd; _libssh2_debug(session, LIBSSH2_TRACE_CONN, \"Window adjust for channel %lu/%lu, \" \"adding %lu bytes, new window_size=%lu\", channelp->local.id, channelp->remote.id, bytestoadd, channelp->local.window_size); } } LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; default: break; } session->packAdd_state = libssh2_NB_state_sent; } if(session->packAdd_state == libssh2_NB_state_sent) { LIBSSH2_PACKET *packetp = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_PACKET)); if(!packetp) { _libssh2_debug(session, LIBSSH2_ERROR_ALLOC, \"memory for packet\"); LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return LIBSSH2_ERROR_ALLOC; } packetp->data = data; packetp->data_len = datalen; packetp->data_head = data_head; _libssh2_list_add(&session->packets, &packetp->node); session->packAdd_state = libssh2_NB_state_sent1; } if((msg == SSH_MSG_KEXINIT && !(session->state & LIBSSH2_STATE_EXCHANGING_KEYS)) || (session->packAdd_state == libssh2_NB_state_sent2)) { if(session->packAdd_state == libssh2_NB_state_sent1) { /* * Remote wants new keys * Well, it's already in the brigade, * let's just call back into ourselves */ _libssh2_debug(session, LIBSSH2_TRACE_TRANS, \"Renegotiating Keys\"); session->packAdd_state = libssh2_NB_state_sent2; } /* * The KEXINIT message has been added to the queue. The packAdd and * readPack states need to be reset because _libssh2_kex_exchange * (eventually) calls upon _libssh2_transport_read to read the rest of * the key exchange conversation. */ session->readPack_state = libssh2_NB_state_idle; session->packet.total_num = 0; session->packAdd_state = libssh2_NB_state_idle; session->fullpacket_state = libssh2_NB_state_idle; memset(&session->startup_key_state, 0, sizeof(key_exchange_state_t)); /* * If there was a key reexchange failure, let's just hope we didn't * send NEWKEYS yet, otherwise remote will drop us like a rock */ rc = _libssh2_kex_exchange(session, 1, &session->startup_key_state); if(rc == LIBSSH2_ERROR_EAGAIN) return rc; } session->packAdd_state = libssh2_NB_state_idle; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 451265, "input": "static int ext4_add_entry(handle_t *handle, struct dentry *dentry, struct inode *inode) { struct inode *dir = d_inode(dentry->d_parent); struct buffer_head *bh = NULL; struct ext4_dir_entry_2 *de; struct super_block *sb; #ifdef CONFIG_UNICODE struct ext4_sb_info *sbi; #endif struct ext4_filename fname; int retval; int dx_fallback=0; unsigned blocksize; ext4_lblk_t block, blocks; int csum_size = 0; if (ext4_has_metadata_csum(inode->i_sb)) csum_size = sizeof(struct ext4_dir_entry_tail); sb = dir->i_sb; blocksize = sb->s_blocksize; if (!dentry->d_name.len) return -EINVAL; #ifdef CONFIG_UNICODE sbi = EXT4_SB(sb); if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) && sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name)) return -EINVAL; #endif retval = ext4_fname_setup_filename(dir, &dentry->d_name, 0, &fname); if (retval) return retval; if (ext4_has_inline_data(dir)) { retval = ext4_try_add_inline_entry(handle, &fname, dir, inode); if (retval < 0) goto out; if (retval == 1) { retval = 0; goto out; } } if (is_dx(dir)) { retval = ext4_dx_add_entry(handle, &fname, dir, inode); if (!retval || (retval != ERR_BAD_DX_DIR)) goto out; /* Can we just ignore htree data? */ if (ext4_has_metadata_csum(sb)) { EXT4_ERROR_INODE(dir, \"Directory has corrupted htree index.\"); retval = -EFSCORRUPTED; goto out; } ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); dx_fallback++; retval = ext4_mark_inode_dirty(handle, dir); if (unlikely(retval)) goto out; } blocks = dir->i_size >> sb->s_blocksize_bits; for (block = 0; block < blocks; block++) { bh = ext4_read_dirblock(dir, block, DIRENT); if (bh == NULL) { bh = ext4_bread(handle, dir, block, EXT4_GET_BLOCKS_CREATE); goto add_to_new_block; } if (IS_ERR(bh)) { retval = PTR_ERR(bh); bh = NULL; goto out; } retval = add_dirent_to_buf(handle, &fname, dir, inode, NULL, bh); if (retval != -ENOSPC) goto out; if (blocks == 1 && !dx_fallback && ext4_has_feature_dir_index(sb)) { retval = make_indexed_dir(handle, &fname, dir, inode, bh); bh = NULL; /* make_indexed_dir releases bh */ goto out; } brelse(bh); } bh = ext4_append(handle, dir, &block); add_to_new_block: if (IS_ERR(bh)) { retval = PTR_ERR(bh); bh = NULL; goto out; } de = (struct ext4_dir_entry_2 *) bh->b_data; de->inode = 0; de->rec_len = ext4_rec_len_to_disk(blocksize - csum_size, blocksize); if (csum_size) ext4_initialize_dirent_tail(bh, blocksize); retval = add_dirent_to_buf(handle, &fname, dir, inode, de, bh); out: ext4_fname_free_filename(&fname); brelse(bh); if (retval == 0) ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY); return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 233120, "input": "void Compute(OpKernelContext* context) override { bool done = false; std::vector split_sizes_vec; Base::ComputeEasyCases(context, &done, &split_sizes_vec); if (!context->status().ok() || done) { return; } const int32_t num_split = Base::num_outputs(); const Tensor& input = context->input(0); const TensorShape& input_shape = input.shape(); const int32_t split_dim_orig = context->input(2).flat()(0); const int32_t split_dim = split_dim_orig < 0 ? split_dim_orig + input.dims() : split_dim_orig; // Android also uses int32 indexing, so check here also. OP_REQUIRES( context, FastBoundsCheck(input.NumElements(), std::numeric_limits::max()), errors::InvalidArgument(\"Split requires input size < \", std::numeric_limits::max())); Eigen::DenseIndex prefix_dim_size; Eigen::DenseIndex split_dim_size; Eigen::DenseIndex suffix_dim_size; std::tie(prefix_dim_size, split_dim_size, suffix_dim_size) = Base::template SetDims(input_shape, split_dim); std::vector split_start_points(num_split); for (int i = 0; i < num_split; ++i) { if (i == 0) { split_start_points[i] = 0; } else { split_start_points[i] = split_start_points[i - 1] + split_sizes_vec[i - 1]; } } if (prefix_dim_size == 1) { auto input_reshaped = input.shaped({split_dim_size, suffix_dim_size}); auto make_sizes = [&](Eigen::DenseIndex split_size) { return Eigen::DSizes{split_size, suffix_dim_size}; }; auto reshape_result = [&](Tensor* result, Tlen split_size) { return result->shaped({split_size, suffix_dim_size}); }; SplitVOpCPUImpl{}( context, input_reshaped, split_start_points, input_shape, split_dim, prefix_dim_size, split_dim_size, suffix_dim_size, split_sizes_vec, make_sizes, reshape_result); } else { auto input_reshaped = input.shaped( {prefix_dim_size, split_dim_size, suffix_dim_size}); auto make_sizes = [&](Eigen::DenseIndex split_size) { return Eigen::DSizes{prefix_dim_size, split_size, suffix_dim_size}; }; auto reshape_result = [&](Tensor* result, Tlen split_size) { return result->shaped( {prefix_dim_size, split_size, suffix_dim_size}); }; SplitVOpCPUImpl{}( context, input_reshaped, split_start_points, input_shape, split_dim, prefix_dim_size, split_dim_size, suffix_dim_size, split_sizes_vec, make_sizes, reshape_result); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431125, "input": "static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) { struct nfs_server *server = NFS_SERVER(state->inode); struct nfs4_exception exception = { .inode = state->inode, }; int err; err = nfs4_set_lock_state(state, request); if (err != 0) return err; if (!recover_lost_locks) { set_bit(NFS_LOCK_LOST, &request->fl_u.nfs4_fl.owner->ls_flags); return 0; } do { if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) return 0; err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_EXPIRED); switch (err) { default: goto out; case -NFS4ERR_GRACE: case -NFS4ERR_DELAY: nfs4_handle_exception(server, err, &exception); err = 0; } } while (exception.retry); out: return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421518, "input": "lka_report_smtp_tx_commit(const char *direction, struct timeval *tv, uint64_t reqid, uint32_t msgid, size_t msgsz) { report_smtp_broadcast(reqid, direction, tv, \"tx-commit\", \"%08x|%zd\\n\", msgid, msgsz); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 521441, "input": "ngx_http_auth_spnego_headers_basic_only( ngx_http_request_t *r, ngx_http_auth_spnego_ctx_t *ctx, ngx_http_auth_spnego_loc_conf_t *alcf) { ngx_str_t value = ngx_null_string; value.len = sizeof(\"Basic realm=\\\"\\\"\") - 1 + alcf->realm.len; value.data = ngx_pcalloc(r->pool, value.len); if (NULL == value.data) { return NGX_ERROR; } ngx_snprintf(value.data, value.len, \"Basic realm=\\\"%V\\\"\", &alcf->realm); r->headers_out.www_authenticate = ngx_list_push(&r->headers_out.headers); if (NULL == r->headers_out.www_authenticate) { return NGX_ERROR; } r->headers_out.www_authenticate->hash = 1; r->headers_out.www_authenticate->key.len = sizeof(\"WWW-Authenticate\") - 1; r->headers_out.www_authenticate->key.data = (u_char *) \"WWW-Authenticate\"; r->headers_out.www_authenticate->value.len = value.len; r->headers_out.www_authenticate->value.data = value.data; ctx->head = 1; return NGX_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 440929, "input": "static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct stub_device *sdev = dev_get_drvdata(dev); int sockfd = 0; struct socket *socket; int rv; struct task_struct *tcp_rx = NULL; struct task_struct *tcp_tx = NULL; if (!sdev) { dev_err(dev, \"sdev is null\\n\"); return -ENODEV; } rv = sscanf(buf, \"%d\", &sockfd); if (rv != 1) return -EINVAL; if (sockfd != -1) { int err; dev_info(dev, \"stub up\\n\"); spin_lock_irq(&sdev->ud.lock); if (sdev->ud.status != SDEV_ST_AVAILABLE) { dev_err(dev, \"not ready\\n\"); goto err; } socket = sockfd_lookup(sockfd, &err); if (!socket) { dev_err(dev, \"failed to lookup sock\"); goto err; } if (socket->type != SOCK_STREAM) { dev_err(dev, \"Expecting SOCK_STREAM - found %d\", socket->type); goto sock_err; } /* unlock and create threads and get tasks */ spin_unlock_irq(&sdev->ud.lock); tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, \"stub_rx\"); if (IS_ERR(tcp_rx)) { sockfd_put(socket); return -EINVAL; } tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, \"stub_tx\"); if (IS_ERR(tcp_tx)) { kthread_stop(tcp_rx); sockfd_put(socket); return -EINVAL; } /* get task structs now */ get_task_struct(tcp_rx); get_task_struct(tcp_tx); /* lock and update sdev->ud state */ spin_lock_irq(&sdev->ud.lock); sdev->ud.tcp_socket = socket; sdev->ud.sockfd = sockfd; sdev->ud.tcp_rx = tcp_rx; sdev->ud.tcp_tx = tcp_tx; sdev->ud.status = SDEV_ST_USED; spin_unlock_irq(&sdev->ud.lock); wake_up_process(sdev->ud.tcp_rx); wake_up_process(sdev->ud.tcp_tx); } else { dev_info(dev, \"stub down\\n\"); spin_lock_irq(&sdev->ud.lock); if (sdev->ud.status != SDEV_ST_USED) goto err; spin_unlock_irq(&sdev->ud.lock); usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); } return count; sock_err: sockfd_put(socket); err: spin_unlock_irq(&sdev->ud.lock); return -EINVAL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195486, "input": "bool handleBackslash(signed char& out) { char ch = *p++; switch (ch) { case 0: return false; case '\"': out = ch; return true; case '\\\\': out = ch; return true; case '/': out = ch; return true; case 'b': out = '\\b'; return true; case 'f': out = '\\f'; return true; case 'n': out = '\\n'; return true; case 'r': out = '\\r'; return true; case 't': out = '\\t'; return true; case 'u': { if (UNLIKELY(is_tsimplejson)) { auto const ch1 = *p++; auto const ch2 = *p++; auto const dch3 = dehexchar(*p++); auto const dch4 = dehexchar(*p++); if (UNLIKELY(ch1 != '0' || ch2 != '0' || dch3 < 0 || dch4 < 0)) { return false; } out = (dch3 << 4) | dch4; return true; } else { uint16_t u16cp = 0; for (int i = 0; i < 4; i++) { auto const hexv = dehexchar(*p++); if (hexv < 0) return false; // includes check for end of string u16cp <<= 4; u16cp |= hexv; } if (u16cp > 0x7f) { return false; } else { out = u16cp; return true; } } } default: return false; } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "Insufficient boundary checks when decoding JSON in handleBackslash reads out of bounds memory, potentially leading to DOS. This issue affects HHVM 4.45.0, 4.44.0, 4.43.0, 4.42.0, 4.41.0, 4.40.0, 4.39.0, versions between 4.33.0 and 4.38.0 (inclusive), versions between 4.9.0 and 4.32.0 (inclusive), and versions prior to 4.8.7.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-1888"}} -{"idx": 263083, "input": "iasecc_read_public_key(struct sc_card *card, unsigned type, struct sc_path *key_path, unsigned ref, unsigned size, unsigned char **out, size_t *out_len) { struct sc_context *ctx = card->ctx; struct iasecc_sdo sdo; struct sc_pkcs15_bignum bn[2]; struct sc_pkcs15_pubkey_rsa rsa_key; int rv; LOG_FUNC_CALLED(ctx); if (type != SC_ALGORITHM_RSA) LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED); sc_log(ctx, \"read public kay(ref:%i;size:%i)\", ref, size); memset(&bn, 0, sizeof bn); memset(&sdo, 0, sizeof(sdo)); sdo.sdo_class = IASECC_SDO_CLASS_RSA_PUBLIC; sdo.sdo_ref = ref & ~IASECC_OBJECT_REF_LOCAL; rv = iasecc_sdo_get_data(card, &sdo); LOG_TEST_GOTO_ERR(ctx, rv, \"failed to read public key: cannot get RSA SDO data\"); if (out) *out = NULL; if (out_len) *out_len = 0; bn[0].data = (unsigned char *) malloc(sdo.data.pub_key.n.size); if (!bn[0].data) LOG_TEST_GOTO_ERR(ctx, SC_ERROR_OUT_OF_MEMORY, \"failed to read public key: cannot allocate modulus\"); bn[0].len = sdo.data.pub_key.n.size; memcpy(bn[0].data, sdo.data.pub_key.n.value, sdo.data.pub_key.n.size); bn[1].data = (unsigned char *) malloc(sdo.data.pub_key.e.size); if (!bn[1].data) LOG_TEST_GOTO_ERR(ctx, SC_ERROR_OUT_OF_MEMORY, \"failed to read public key: cannot allocate exponent\"); bn[1].len = sdo.data.pub_key.e.size; memcpy(bn[1].data, sdo.data.pub_key.e.value, sdo.data.pub_key.e.size); rsa_key.modulus = bn[0]; rsa_key.exponent = bn[1]; rv = sc_pkcs15_encode_pubkey_rsa(ctx, &rsa_key, out, out_len); LOG_TEST_GOTO_ERR(ctx, rv, \"failed to read public key: cannot encode RSA public key\"); if (out && out_len) sc_log(ctx, \"encoded public key: %s\", sc_dump_hex(*out, *out_len)); err: if (bn[0].data) free(bn[0].data); if (bn[1].data) free(bn[1].data); iasecc_sdo_free_fields(card, &sdo); LOG_FUNC_RETURN(ctx, SC_SUCCESS); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219460, "input": "~StaticString() { // prevent ~req::ptr from destroying contents. detach(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273227, "input": "Modes::ChangeList::List::const_iterator GetBeginIterator() const { return beginit; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 272990, "input": "SWFInput_buffer_getChar(SWFInput input) { if ( input->offset >= input->length ) return EOF; else return ((unsigned char *)input->data)[input->offset++]; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338604, "input": "static int __init io_uring_init(void) { #define __BUILD_BUG_VERIFY_ELEMENT(stype, eoffset, etype, ename) do { \\ BUILD_BUG_ON(offsetof(stype, ename) != eoffset); \\ BUILD_BUG_ON(sizeof(etype) != sizeof_field(stype, ename)); \\ } while (0) #define BUILD_BUG_SQE_ELEM(eoffset, etype, ename) \\ __BUILD_BUG_VERIFY_ELEMENT(struct io_uring_sqe, eoffset, etype, ename) BUILD_BUG_ON(sizeof(struct io_uring_sqe) != 64); BUILD_BUG_SQE_ELEM(0, __u8, opcode); BUILD_BUG_SQE_ELEM(1, __u8, flags); BUILD_BUG_SQE_ELEM(2, __u16, ioprio); BUILD_BUG_SQE_ELEM(4, __s32, fd); BUILD_BUG_SQE_ELEM(8, __u64, off); BUILD_BUG_SQE_ELEM(8, __u64, addr2); BUILD_BUG_SQE_ELEM(16, __u64, addr); BUILD_BUG_SQE_ELEM(16, __u64, splice_off_in); BUILD_BUG_SQE_ELEM(24, __u32, len); BUILD_BUG_SQE_ELEM(28, __kernel_rwf_t, rw_flags); BUILD_BUG_SQE_ELEM(28, /* compat */ int, rw_flags); BUILD_BUG_SQE_ELEM(28, /* compat */ __u32, rw_flags); BUILD_BUG_SQE_ELEM(28, __u32, fsync_flags); BUILD_BUG_SQE_ELEM(28, /* compat */ __u16, poll_events); BUILD_BUG_SQE_ELEM(28, __u32, poll32_events); BUILD_BUG_SQE_ELEM(28, __u32, sync_range_flags); BUILD_BUG_SQE_ELEM(28, __u32, msg_flags); BUILD_BUG_SQE_ELEM(28, __u32, timeout_flags); BUILD_BUG_SQE_ELEM(28, __u32, accept_flags); BUILD_BUG_SQE_ELEM(28, __u32, cancel_flags); BUILD_BUG_SQE_ELEM(28, __u32, open_flags); BUILD_BUG_SQE_ELEM(28, __u32, statx_flags); BUILD_BUG_SQE_ELEM(28, __u32, fadvise_advice); BUILD_BUG_SQE_ELEM(28, __u32, splice_flags); BUILD_BUG_SQE_ELEM(32, __u64, user_data); BUILD_BUG_SQE_ELEM(40, __u16, buf_index); BUILD_BUG_SQE_ELEM(42, __u16, personality); BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in); BUILD_BUG_ON(sizeof(struct io_uring_files_update) != sizeof(struct io_uring_rsrc_update)); BUILD_BUG_ON(sizeof(struct io_uring_rsrc_update) > sizeof(struct io_uring_rsrc_update2)); /* should fit into one byte */ BUILD_BUG_ON(SQE_VALID_FLAGS >= (1 << 8)); BUILD_BUG_ON(ARRAY_SIZE(io_op_defs) != IORING_OP_LAST); BUILD_BUG_ON(__REQ_F_LAST_BIT >= 8 * sizeof(int)); req_cachep = KMEM_CACHE(io_kiocb, SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT); return 0;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354814, "input": "void kvm_s390_sync_request(int req, struct kvm_vcpu *vcpu) { kvm_make_request(req, vcpu); kvm_s390_vcpu_request(vcpu); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212425, "input": "static MagickBooleanType ReadHEICImageByID(const ImageInfo *image_info, Image *image,struct heif_context *heif_context,heif_item_id image_id, ExceptionInfo *exception) { const char *option; int stride_y, stride_cb, stride_cr; MagickBooleanType status; ssize_t y; struct heif_decoding_options *decode_options; struct heif_error error; struct heif_image *heif_image; struct heif_image_handle *image_handle; const uint8_t *p_y, *p_cb, *p_cr; error=heif_context_get_image_handle(heif_context,image_id,&image_handle); if (IsHeifSuccess(&error,image,exception) == MagickFalse) return(MagickFalse); if (ReadHEICColorProfile(image,image_handle,exception) == MagickFalse) { heif_image_handle_release(image_handle); return(MagickFalse); } if (ReadHEICExifProfile(image,image_handle,exception) == MagickFalse) { heif_image_handle_release(image_handle); return(MagickFalse); } /* Set image size. */ image->depth=8; image->columns=(size_t) heif_image_handle_get_width(image_handle); image->rows=(size_t) heif_image_handle_get_height(image_handle); if (image_info->ping != MagickFalse) { image->colorspace=YCbCrColorspace; heif_image_handle_release(image_handle); return(MagickTrue); } if (HEICSkipImage(image_info,image) != MagickFalse) { heif_image_handle_release(image_handle); return(MagickTrue); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { heif_image_handle_release(image_handle); return(MagickFalse); } /* Copy HEIF image into ImageMagick data structures. */ (void) SetImageColorspace(image,YCbCrColorspace,exception); decode_options=(struct heif_decoding_options *) NULL; option=GetImageOption(image_info,\"heic:preserve-orientation\"); if (IsStringTrue(option) == MagickTrue) { decode_options=heif_decoding_options_alloc(); decode_options->ignore_transformations=1; } else (void) SetImageProperty(image,\"exif:Orientation\",\"1\",exception); error=heif_decode_image(image_handle,&heif_image,heif_colorspace_YCbCr, heif_chroma_420,decode_options); if (IsHeifSuccess(&error,image,exception) == MagickFalse) { heif_image_handle_release(image_handle); return(MagickFalse); } if (decode_options != (struct heif_decoding_options *) NULL) { /* Correct the width and height of the image. */ image->columns=(size_t) heif_image_get_width(heif_image,heif_channel_Y); image->rows=(size_t) heif_image_get_height(heif_image,heif_channel_Y); status=SetImageExtent(image,image->columns,image->rows,exception); heif_decoding_options_free(decode_options); if (status == MagickFalse) { heif_image_release(heif_image); heif_image_handle_release(image_handle); return(MagickFalse); } } p_y=heif_image_get_plane_readonly(heif_image,heif_channel_Y,&stride_y); p_cb=heif_image_get_plane_readonly(heif_image,heif_channel_Cb,&stride_cb); p_cr=heif_image_get_plane_readonly(heif_image,heif_channel_Cr,&stride_cr); for (y=0; y < (ssize_t) image->rows; y++) { Quantum *q; register ssize_t x; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) p_y[y* stride_y+x]),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) p_cb[(y/2)* stride_cb+x/2]),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) p_cr[(y/2)* stride_cr+x/2]),q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } heif_image_release(heif_image); heif_image_handle_release(image_handle); return(MagickTrue); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In ImageMagick 7.0.9, an out-of-bounds read vulnerability exists within the ReadHEICImageByID function in coders\\heic.c. It can be triggered via an image with a width or height value that exceeds the actual size of the image.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-10251"}} -{"idx": 299118, "input": "yaffs2_open(TSK_IMG_INFO * img_info, TSK_OFF_T offset, TSK_FS_TYPE_ENUM ftype, uint8_t test) { YAFFSFS_INFO *yaffsfs = NULL; TSK_FS_INFO *fs = NULL; const unsigned int psize = img_info->page_size; const unsigned int ssize = img_info->spare_size; YaffsHeader * first_header = NULL; TSK_FS_DIR *test_dir; std::map configParams; YAFFS_CONFIG_STATUS config_file_status; // clean up any error messages that are lying around tsk_error_reset(); if (TSK_FS_TYPE_ISYAFFS2(ftype) == 0) { tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS_ARG); tsk_error_set_errstr(\"Invalid FS Type in yaffsfs_open\"); return NULL; } if (img_info->sector_size == 0) { tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS_ARG); tsk_error_set_errstr(\"yaffs2_open: sector size is 0\"); return NULL; } if ((yaffsfs = (YAFFSFS_INFO *) tsk_fs_malloc(sizeof(YAFFSFS_INFO))) == NULL) return NULL; yaffsfs->cache_objects = NULL; yaffsfs->chunkMap = NULL; fs = &(yaffsfs->fs_info); fs->tag = TSK_FS_INFO_TAG; fs->ftype = ftype; fs->flags = (TSK_FS_INFO_FLAG_ENUM)0; fs->img_info = img_info; fs->offset = offset; fs->endian = TSK_LIT_ENDIAN; // Read config file (if it exists) config_file_status = yaffs_load_config_file(img_info, configParams); // BL-6929(JTS): When using external readers, this call will fail. // Not having a config should not be a fatal error. /*if(config_file_status == YAFFS_CONFIG_ERROR){ // tsk_error was set by yaffs_load_config goto on_error; } else*/ if(config_file_status == YAFFS_CONFIG_OK){ // Validate the input // If it fails validation, return (tsk_error will be set up already) if(1 == yaffs_validate_config_file(configParams)){ goto on_error; } } // If we read these fields from the config file, use those values. Otherwise use the defaults if(configParams.find(YAFFS_CONFIG_PAGE_SIZE_STR) != configParams.end()){ yaffsfs->page_size = atoi(configParams[YAFFS_CONFIG_PAGE_SIZE_STR].c_str()); } else{ yaffsfs->page_size = psize == 0 ? YAFFS_DEFAULT_PAGE_SIZE : psize; } if(configParams.find(YAFFS_CONFIG_SPARE_SIZE_STR) != configParams.end()){ yaffsfs->spare_size = atoi(configParams[YAFFS_CONFIG_SPARE_SIZE_STR].c_str()); } else{ yaffsfs->spare_size = ssize == 0 ? YAFFS_DEFAULT_SPARE_SIZE : ssize; } if(configParams.find(YAFFS_CONFIG_CHUNKS_PER_BLOCK_STR) != configParams.end()){ yaffsfs->chunks_per_block = atoi(configParams[YAFFS_CONFIG_CHUNKS_PER_BLOCK_STR].c_str()); } else{ yaffsfs->chunks_per_block = 64; } // TODO: Why are 2 different memory allocation methods used in the same code? // This makes things unnecessary complex. yaffsfs->max_obj_id = 1; yaffsfs->max_version = 0; // Keep track of whether we're doing auto-detection of the file system if(test){ yaffsfs->autoDetect = 1; } else{ yaffsfs->autoDetect = 0; } // Determine the layout of the spare area // If it was specified in the config file, use those values. Otherwise do the auto-detection if(configParams.find(YAFFS_CONFIG_SEQ_NUM_STR) != configParams.end()){ // In the validation step, we ensured that if one of the offsets was set, we have all of them yaffsfs->spare_seq_offset = atoi(configParams[YAFFS_CONFIG_SEQ_NUM_STR].c_str()); yaffsfs->spare_obj_id_offset = atoi(configParams[YAFFS_CONFIG_OBJ_ID_STR].c_str()); yaffsfs->spare_chunk_id_offset = atoi(configParams[YAFFS_CONFIG_CHUNK_ID_STR].c_str()); // Check that the offsets are valid for the given spare area size (fields are 4 bytes long) if((yaffsfs->spare_seq_offset + 4 > yaffsfs->spare_size) || (yaffsfs->spare_obj_id_offset + 4 > yaffsfs->spare_size) || (yaffsfs->spare_chunk_id_offset + 4 > yaffsfs->spare_size)){ tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS); tsk_error_set_errstr(\"yaffs2_open: Offset(s) in config file too large for spare area (size %d). %s\", yaffsfs->spare_size, YAFFS_HELP_MESSAGE); goto on_error; } // nBytes isn't currently used, so just set to zero yaffsfs->spare_nbytes_offset = 0; } else{ // Decide how many blocks to test. If we're not doing auto-detection, set to zero (no limit) unsigned int maxBlocksToTest; if(yaffsfs->autoDetect){ maxBlocksToTest = YAFFS_DEFAULT_MAX_TEST_BLOCKS; } else{ maxBlocksToTest = 0; } if(yaffs_initialize_spare_format(yaffsfs, maxBlocksToTest) != TSK_OK){ tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS_MAGIC); tsk_error_set_errstr(\"not a YAFFS file system (bad spare format). %s\", YAFFS_HELP_MESSAGE); if (tsk_verbose) fprintf(stderr, \"yaffsfs_open: could not find valid spare area format\\n%s\\n\", YAFFS_HELP_MESSAGE); goto on_error; } } /* * Read the first record, make sure it's a valid header... * * Used for verification and autodetection of * the FS type. */ if (yaffsfs_read_header(yaffsfs, &first_header, 0)) { tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS_MAGIC); tsk_error_set_errstr(\"not a YAFFS file system (first record). %s\", YAFFS_HELP_MESSAGE); if (tsk_verbose) fprintf(stderr, \"yaffsfs_open: invalid first record\\n%s\\n\", YAFFS_HELP_MESSAGE); goto on_error; } free(first_header); first_header = NULL; fs->duname = \"Chunk\"; /* * Calculate the meta data info */ //fs->last_inum = 0xffffffff; // Will update this as we go fs->last_inum = 0; fs->root_inum = YAFFS_OBJECT_ROOT; fs->first_inum = YAFFS_OBJECT_FIRST; //fs->inum_count = fs->last_inum; // For now this will be the last_inum - 1 (after we calculate it) /* * Calculate the block info */ fs->dev_bsize = img_info->sector_size; fs->block_size = yaffsfs->page_size; fs->block_pre_size = 0; fs->block_post_size = yaffsfs->spare_size; fs->block_count = img_info->size / (fs->block_pre_size + fs->block_size + fs->block_post_size); fs->first_block = 0; fs->last_block_act = fs->last_block = fs->block_count ? fs->block_count - 1 : 0; /* Set the generic function pointers */ fs->inode_walk = yaffsfs_inode_walk; fs->block_walk = yaffsfs_block_walk; fs->block_getflags = yaffsfs_block_getflags; fs->get_default_attr_type = yaffsfs_get_default_attr_type; fs->load_attrs = yaffsfs_load_attrs; fs->file_add_meta = yaffs_inode_lookup; fs->dir_open_meta = yaffsfs_dir_open_meta; fs->fsstat = yaffsfs_fsstat; fs->fscheck = yaffsfs_fscheck; fs->istat = yaffsfs_istat; fs->name_cmp = tsk_fs_unix_name_cmp; fs->close = yaffsfs_close; /* Journal */ fs->jblk_walk = yaffsfs_jblk_walk; fs->jentry_walk = yaffsfs_jentry_walk; fs->jopen = yaffsfs_jopen; /* Initialize the caches */ if (tsk_verbose) fprintf(stderr, \"yaffsfs_open: building cache...\\n\"); /* Build cache */ /* NOTE: The only modifications to the cache happen here, during at * the open. Should be fine with no lock, even if access to the * cache is shared among threads. */ //tsk_init_lock(&yaffsfs->lock); yaffsfs->chunkMap = new std::map; if (TSK_OK != yaffsfs_parse_image_load_cache(yaffsfs)) { goto on_error; } if (tsk_verbose) { fprintf(stderr, \"yaffsfs_open: done building cache!\\n\"); //yaffscache_objects_dump(yaffsfs, stderr); } // Update the number of inums now that we've read in the file system fs->inum_count = fs->last_inum - 1; test_dir = tsk_fs_dir_open_meta(fs, fs->root_inum); if (test_dir == NULL) { tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS_MAGIC); tsk_error_set_errstr(\"not a YAFFS file system (no root directory). %s\", YAFFS_HELP_MESSAGE); if (tsk_verbose) fprintf(stderr, \"yaffsfs_open: invalid file system\\n%s\\n\", YAFFS_HELP_MESSAGE); goto on_error; } tsk_fs_dir_close(test_dir); return fs; on_error: // yaffsfs_close frees all the cache objects yaffsfs_close(fs); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269872, "input": "void Commissioner::ClearJoiners(void) { for (Joiner *joiner = &mJoiners[0]; joiner < OT_ARRAY_END(mJoiners); joiner++) { joiner->mValid = false; } SendCommissionerSet(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211936, "input": "crypt_pw_cmp(const char *userpwd, const char *dbpwd) { int rc; char *cp; struct crypt_data data; data.initialized = 0; /* we use salt (first 2 chars) of encoded password in call to crypt_r() */ cp = crypt_r(userpwd, dbpwd, &data); if (cp) { rc = slapi_ct_memcmp(dbpwd, cp, strlen(dbpwd)); } else { rc = -1; } return rc; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Access Control"], "explanation": "A flaw was found in 389-ds-base. If an asterisk is imported as password hashes, either accidentally or maliciously, then instead of being inactive, any password will successfully match during authentication. This flaw allows an attacker to successfully authenticate as a user whose password was disabled.", "severity_level": "NoInfo", "cwe": "CWE-284", "cve": "CVE-2021-3652"}} -{"idx": 431181, "input": "static int decode_getfattr_label(struct xdr_stream *xdr, struct nfs_fattr *fattr, struct nfs4_label *label, const struct nfs_server *server) { return decode_getfattr_generic(xdr, fattr, NULL, NULL, label, server); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277921, "input": "int ctrl_x_mode_cmdline(void) { return ctrl_x_mode == CTRL_X_CMDLINE || ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 481488, "input": "static CURLcode telnet_do(struct Curl_easy *data, bool *done) { CURLcode result; struct connectdata *conn = data->conn; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; #ifdef USE_WINSOCK WSAEVENT event_handle; WSANETWORKEVENTS events; HANDLE stdin_handle; HANDLE objs[2]; DWORD obj_count; DWORD wait_timeout; DWORD readfile_read; int err; #else timediff_t interval_ms; struct pollfd pfd[2]; int poll_cnt; curl_off_t total_dl = 0; curl_off_t total_ul = 0; #endif ssize_t nread; struct curltime now; bool keepon = TRUE; char *buf = data->state.buffer; struct TELNET *tn; *done = TRUE; /* unconditionally */ result = init_telnet(data); if(result) return result; tn = data->req.p.telnet; result = check_telnet_options(data); if(result) return result; #ifdef USE_WINSOCK /* We want to wait for both stdin and the socket. Since ** the select() function in winsock only works on sockets ** we have to use the WaitForMultipleObjects() call. */ /* First, create a sockets event object */ event_handle = WSACreateEvent(); if(event_handle == WSA_INVALID_EVENT) { failf(data, \"WSACreateEvent failed (%d)\", SOCKERRNO); return CURLE_FAILED_INIT; } /* Tell winsock what events we want to listen to */ if(WSAEventSelect(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) { WSACloseEvent(event_handle); return CURLE_OK; } /* The get the Windows file handle for stdin */ stdin_handle = GetStdHandle(STD_INPUT_HANDLE); /* Create the list of objects to wait for */ objs[0] = event_handle; objs[1] = stdin_handle; /* If stdin_handle is a pipe, use PeekNamedPipe() method to check it, else use the old WaitForMultipleObjects() way */ if(GetFileType(stdin_handle) == FILE_TYPE_PIPE || data->set.is_fread_set) { /* Don't wait for stdin_handle, just wait for event_handle */ obj_count = 1; /* Check stdin_handle per 100 milliseconds */ wait_timeout = 100; } else { obj_count = 2; wait_timeout = 1000; } /* Keep on listening and act on events */ while(keepon) { const DWORD buf_size = (DWORD)data->set.buffer_size; DWORD waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout); switch(waitret) { case WAIT_TIMEOUT: { for(;;) { if(data->set.is_fread_set) { size_t n; /* read from user-supplied method */ n = data->state.fread_func(buf, 1, buf_size, data->state.in); if(n == CURL_READFUNC_ABORT) { keepon = FALSE; result = CURLE_READ_ERROR; break; } if(n == CURL_READFUNC_PAUSE) break; if(n == 0) /* no bytes */ break; /* fall through with number of bytes read */ readfile_read = (DWORD)n; } else { /* read from stdin */ if(!PeekNamedPipe(stdin_handle, NULL, 0, NULL, &readfile_read, NULL)) { keepon = FALSE; result = CURLE_READ_ERROR; break; } if(!readfile_read) break; if(!ReadFile(stdin_handle, buf, buf_size, &readfile_read, NULL)) { keepon = FALSE; result = CURLE_READ_ERROR; break; } } result = send_telnet_data(data, buf, readfile_read); if(result) { keepon = FALSE; break; } } } break; case WAIT_OBJECT_0 + 1: { if(!ReadFile(stdin_handle, buf, buf_size, &readfile_read, NULL)) { keepon = FALSE; result = CURLE_READ_ERROR; break; } result = send_telnet_data(data, buf, readfile_read); if(result) { keepon = FALSE; break; } } break; case WAIT_OBJECT_0: { events.lNetworkEvents = 0; if(WSAEnumNetworkEvents(sockfd, event_handle, &events) == SOCKET_ERROR) { err = SOCKERRNO; if(err != EINPROGRESS) { infof(data, \"WSAEnumNetworkEvents failed (%d)\", err); keepon = FALSE; result = CURLE_READ_ERROR; } break; } if(events.lNetworkEvents & FD_READ) { /* read data from network */ result = Curl_read(data, sockfd, buf, data->set.buffer_size, &nread); /* read would've blocked. Loop again */ if(result == CURLE_AGAIN) break; /* returned not-zero, this an error */ else if(result) { keepon = FALSE; break; } /* returned zero but actually received 0 or less here, the server closed the connection and we bail out */ else if(nread <= 0) { keepon = FALSE; break; } result = telrcv(data, (unsigned char *) buf, nread); if(result) { keepon = FALSE; break; } /* Negotiate if the peer has started negotiating, otherwise don't. We don't want to speak telnet with non-telnet servers, like POP or SMTP. */ if(tn->please_negotiate && !tn->already_negotiated) { negotiate(data); tn->already_negotiated = 1; } } if(events.lNetworkEvents & FD_CLOSE) { keepon = FALSE; } } break; } if(data->set.timeout) { now = Curl_now(); if(Curl_timediff(now, conn->created) >= data->set.timeout) { failf(data, \"Time-out\"); result = CURLE_OPERATION_TIMEDOUT; keepon = FALSE; } } } /* We called WSACreateEvent, so call WSACloseEvent */ if(!WSACloseEvent(event_handle)) { infof(data, \"WSACloseEvent failed (%d)\", SOCKERRNO); } #else pfd[0].fd = sockfd; pfd[0].events = POLLIN; if(data->set.is_fread_set) { poll_cnt = 1; interval_ms = 100; /* poll user-supplied read function */ } else { /* really using fread, so infile is a FILE* */ pfd[1].fd = fileno((FILE *)data->state.in); pfd[1].events = POLLIN; poll_cnt = 2; interval_ms = 1 * 1000; } while(keepon) { switch(Curl_poll(pfd, poll_cnt, interval_ms)) { case -1: /* error, stop reading */ keepon = FALSE; continue; case 0: /* timeout */ pfd[0].revents = 0; pfd[1].revents = 0; /* FALLTHROUGH */ default: /* read! */ if(pfd[0].revents & POLLIN) { /* read data from network */ result = Curl_read(data, sockfd, buf, data->set.buffer_size, &nread); /* read would've blocked. Loop again */ if(result == CURLE_AGAIN) break; /* returned not-zero, this an error */ if(result) { keepon = FALSE; break; } /* returned zero but actually received 0 or less here, the server closed the connection and we bail out */ else if(nread <= 0) { keepon = FALSE; break; } total_dl += nread; Curl_pgrsSetDownloadCounter(data, total_dl); result = telrcv(data, (unsigned char *)buf, nread); if(result) { keepon = FALSE; break; } /* Negotiate if the peer has started negotiating, otherwise don't. We don't want to speak telnet with non-telnet servers, like POP or SMTP. */ if(tn->please_negotiate && !tn->already_negotiated) { negotiate(data); tn->already_negotiated = 1; } } nread = 0; if(poll_cnt == 2) { if(pfd[1].revents & POLLIN) { /* read from in file */ nread = read(pfd[1].fd, buf, data->set.buffer_size); } } else { /* read from user-supplied method */ nread = (int)data->state.fread_func(buf, 1, data->set.buffer_size, data->state.in); if(nread == CURL_READFUNC_ABORT) { keepon = FALSE; break; } if(nread == CURL_READFUNC_PAUSE) break; } if(nread > 0) { result = send_telnet_data(data, buf, nread); if(result) { keepon = FALSE; break; } total_ul += nread; Curl_pgrsSetUploadCounter(data, total_ul); } else if(nread < 0) keepon = FALSE; break; } /* poll switch statement */ if(data->set.timeout) { now = Curl_now(); if(Curl_timediff(now, conn->created) >= data->set.timeout) { failf(data, \"Time-out\"); result = CURLE_OPERATION_TIMEDOUT; keepon = FALSE; } } if(Curl_pgrsUpdate(data)) { result = CURLE_ABORTED_BY_CALLBACK; break; } } #endif /* mark this as \"no further transfer wanted\" */ Curl_setup_transfer(data, -1, -1, FALSE, -1); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246296, "input": "static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg) { const char *errmsg; const char *endp = ap_strrchr_c(arg, '>'); int old_overrides = cmd->override; char *old_path = cmd->path; core_dir_config *conf; ap_regex_t *r = NULL; const command_rec *thiscmd = cmd->cmd; ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool); const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE); if (err != NULL) { return err; } if (endp == NULL) { return unclosed_directive(cmd); } arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg); if (!arg[0]) { return missing_container_arg(cmd); } cmd->path = ap_getword_conf(cmd->pool, &arg); cmd->override = OR_ALL|ACCESS_CONF; if (thiscmd->cmd_data) { /* */ r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED); if (!r) { return \"Regex could not be compiled\"; } } else if (!strcmp(cmd->path, \"~\")) { cmd->path = ap_getword_conf(cmd->pool, &arg); r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED); if (!r) { return \"Regex could not be compiled\"; } } /* initialize our config and fetch it */ conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path, &core_module, cmd->pool); errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_url_conf); if (errmsg != NULL) return errmsg; conf->d = apr_pstrdup(cmd->pool, cmd->path); /* No mangling, please */ conf->d_is_fnmatch = apr_fnmatch_test(conf->d) != 0; conf->r = r; if (r) { conf->refs = apr_array_make(cmd->pool, 8, sizeof(char *)); ap_regname(r, conf->refs, AP_REG_MATCH, 1); } ap_add_per_url_conf(cmd->server, new_url_conf); if (*arg != '\\0') { return apr_pstrcat(cmd->pool, \"Multiple \", thiscmd->name, \"> arguments not (yet) supported.\", NULL); } cmd->path = old_path; cmd->override = old_overrides; return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 424848, "input": "static int ntlm_generate_signing_key(BYTE* exported_session_key, PSecBuffer sign_magic, BYTE* signing_key) { int length; BYTE* value; length = WINPR_MD5_DIGEST_LENGTH + sign_magic->cbBuffer; value = (BYTE*)malloc(length); if (!value) return -1; /* Concatenate ExportedSessionKey with sign magic */ CopyMemory(value, exported_session_key, WINPR_MD5_DIGEST_LENGTH); CopyMemory(&value[WINPR_MD5_DIGEST_LENGTH], sign_magic->pvBuffer, sign_magic->cbBuffer); if (!winpr_Digest(WINPR_MD_MD5, value, length, signing_key, WINPR_MD5_DIGEST_LENGTH)) { free(value); return -1; } free(value); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431244, "input": "static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, struct nfs_open_context *ctx, struct nfs4_label *ilabel, struct nfs4_label *olabel) { struct nfs_server *server = NFS_SERVER(inode); __u32 bitmask[NFS4_BITMASK_SZ]; struct nfs4_state *state = ctx ? ctx->state : NULL; struct nfs_setattrargs arg = { .fh = NFS_FH(inode), .iap = sattr, .server = server, .bitmask = bitmask, .label = ilabel, }; struct nfs_setattrres res = { .fattr = fattr, .label = olabel, .server = server, }; struct nfs4_exception exception = { .state = state, .inode = inode, .stateid = &arg.stateid, }; int err; do { nfs4_bitmap_copy_adjust_setattr(bitmask, nfs4_bitmask(server, olabel), inode); err = _nfs4_do_setattr(inode, &arg, &res, cred, ctx); switch (err) { case -NFS4ERR_OPENMODE: if (!(sattr->ia_valid & ATTR_SIZE)) { pr_warn_once(\"NFSv4: server %s is incorrectly \" \"applying open mode checks to \" \"a SETATTR that is not \" \"changing file size.\\n\", server->nfs_client->cl_hostname); } if (state && !(state->state & FMODE_WRITE)) { err = -EBADF; if (sattr->ia_valid & ATTR_OPEN) err = -EACCES; goto out; } } err = nfs4_handle_exception(server, err, &exception); } while (exception.retry); out: return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446312, "input": "ScanLineInputFile::version () const { return _data->version; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437628, "input": "static int wrmsr_interception(struct vcpu_svm *svm) { struct msr_data msr; u32 ecx = svm->vcpu.arch.regs[VCPU_REGS_RCX]; u64 data = (svm->vcpu.arch.regs[VCPU_REGS_RAX] & -1u) | ((u64)(svm->vcpu.arch.regs[VCPU_REGS_RDX] & -1u) << 32); msr.data = data; msr.index = ecx; msr.host_initiated = false; svm->next_rip = kvm_rip_read(&svm->vcpu) + 2; if (kvm_set_msr(&svm->vcpu, &msr)) { trace_kvm_msr_write_ex(ecx, data); kvm_inject_gp(&svm->vcpu, 0); } else { trace_kvm_msr_write(ecx, data); skip_emulated_instruction(&svm->vcpu); } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219254, "input": "static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement) { int de, section_index = SECTION_MAKERNOTE; int NumDirEntries, old_motorola_intel, offset_diff; const maker_note_type *maker_note; char *dir_start; char *value_end = value_ptr + value_len; for (unsigned int i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) return 0; maker_note = maker_note_array+i; if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) { continue; } if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) { continue; } if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, (maker_note->id_string_len < value_len ? maker_note->id_string_len : value_len))) { continue; } break; } if (value_len < 2 || maker_note->offset >= value_len - 1) { raise_warning(\"IFD data too short: 0x%04X offset 0x%04X\", value_len, maker_note->offset); return 0; } dir_start = value_ptr + maker_note->offset; ImageInfo->sections_found |= FOUND_MAKERNOTE; old_motorola_intel = ImageInfo->motorola_intel; switch (maker_note->byte_order) { case MN_ORDER_INTEL: ImageInfo->motorola_intel = 0; break; case MN_ORDER_MOTOROLA: ImageInfo->motorola_intel = 1; break; default: case MN_ORDER_NORMAL: break; } if (value_end - dir_start < 2) return 0; NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); switch (maker_note->offset_mode) { case MN_OFFSET_MAKER: offset_base = value_ptr; break; case MN_OFFSET_GUESS: if (value_end - (dir_start+10) < 4) return 0; offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel); if (offset_diff < 0 || offset_diff >= value_len) return 0; offset_base = value_ptr + offset_diff; break; default: case MN_OFFSET_NORMAL: break; } if ((2+NumDirEntries*12) > value_len) { raise_warning(\"Illegal IFD size: 2 + x%04X*12 = x%04X > x%04X\", NumDirEntries, 2+NumDirEntries*12, value_len); return 0; } if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) { raise_warning(\"Illegal IFD size: 0x%04lX > 0x%04X\", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len); return 0; } for (de=0;detag_table)) { return 0; } } ImageInfo->motorola_intel = old_motorola_intel; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197433, "input": "GF_Err stbl_GetSampleInfos(GF_SampleTableBox *stbl, u32 sampleNumber, u64 *offset, u32 *chunkNumber, u32 *descIndex, GF_StscEntry **out_ent) { GF_Err e; u32 i, k, offsetInChunk, size, chunk_num; GF_ChunkOffsetBox *stco; GF_ChunkLargeOffsetBox *co64; GF_StscEntry *ent; (*offset) = 0; (*chunkNumber) = (*descIndex) = 0; if (out_ent) (*out_ent) = NULL; if (!stbl || !sampleNumber) return GF_BAD_PARAM; if (!stbl->ChunkOffset || !stbl->SampleToChunk || !stbl->SampleSize) return GF_ISOM_INVALID_FILE; if (stbl->SampleSize && stbl->SampleToChunk->nb_entries == stbl->SampleSize->sampleCount) { ent = &stbl->SampleToChunk->entries[sampleNumber-1]; if (!ent) return GF_BAD_PARAM; (*descIndex) = ent->sampleDescriptionIndex; (*chunkNumber) = sampleNumber; if (out_ent) *out_ent = ent; if ( stbl->ChunkOffset->type == GF_ISOM_BOX_TYPE_STCO) { stco = (GF_ChunkOffsetBox *)stbl->ChunkOffset; if (!stco->offsets) return GF_ISOM_INVALID_FILE; (*offset) = (u64) stco->offsets[sampleNumber - 1]; } else { co64 = (GF_ChunkLargeOffsetBox *)stbl->ChunkOffset; if (!co64->offsets) return GF_ISOM_INVALID_FILE; (*offset) = co64->offsets[sampleNumber - 1]; } return GF_OK; } //check our cache: if desired sample is at or above current cache entry, start from here if (stbl->SampleToChunk->firstSampleInCurrentChunk && (stbl->SampleToChunk->firstSampleInCurrentChunk <= sampleNumber)) { i = stbl->SampleToChunk->currentIndex; ent = &stbl->SampleToChunk->entries[stbl->SampleToChunk->currentIndex]; GetGhostNum(ent, i, stbl->SampleToChunk->nb_entries, stbl); k = stbl->SampleToChunk->currentChunk; } //otherwise start from first entry else { i = 0; stbl->SampleToChunk->currentIndex = 0; stbl->SampleToChunk->currentChunk = 1; stbl->SampleToChunk->ghostNumber = 1; stbl->SampleToChunk->firstSampleInCurrentChunk = 1; ent = &stbl->SampleToChunk->entries[0]; GetGhostNum(ent, 0, stbl->SampleToChunk->nb_entries, stbl); k = stbl->SampleToChunk->currentChunk; } //first get the chunk for (; i < stbl->SampleToChunk->nb_entries; i++) { assert(stbl->SampleToChunk->firstSampleInCurrentChunk <= sampleNumber); //corrupted file (less sample2chunk info than sample count if (k > stbl->SampleToChunk->ghostNumber) { return GF_ISOM_INVALID_FILE; } //check if sample is in current chunk u32 max_chunks_in_entry = stbl->SampleToChunk->ghostNumber - k; u32 nb_chunks_for_sample = sampleNumber - stbl->SampleToChunk->firstSampleInCurrentChunk; if (ent->samplesPerChunk) nb_chunks_for_sample /= ent->samplesPerChunk; if ( (nb_chunks_for_sample <= max_chunks_in_entry) && (stbl->SampleToChunk->firstSampleInCurrentChunk + (nb_chunks_for_sample+1) * ent->samplesPerChunk > sampleNumber) ) { stbl->SampleToChunk->firstSampleInCurrentChunk += nb_chunks_for_sample * ent->samplesPerChunk; stbl->SampleToChunk->currentChunk += nb_chunks_for_sample; goto sample_found; } max_chunks_in_entry += 1; stbl->SampleToChunk->firstSampleInCurrentChunk += max_chunks_in_entry * ent->samplesPerChunk; stbl->SampleToChunk->currentChunk += max_chunks_in_entry; //not in this entry, get the next entry if not the last one if (i+1 != stbl->SampleToChunk->nb_entries) { ent = &stbl->SampleToChunk->entries[i+1]; //update the GhostNumber GetGhostNum(ent, i+1, stbl->SampleToChunk->nb_entries, stbl); //update the entry in our cache stbl->SampleToChunk->currentIndex = i+1; stbl->SampleToChunk->currentChunk = 1; k = 1; } } //if we get here, gasp, the sample was not found return GF_ISOM_INVALID_FILE; sample_found: (*descIndex) = ent->sampleDescriptionIndex; (*chunkNumber) = chunk_num = ent->firstChunk + stbl->SampleToChunk->currentChunk - 1; if (out_ent) *out_ent = ent; if (! *chunkNumber) return GF_ISOM_INVALID_FILE; //ok, get the size of all the previous samples in the chunk offsetInChunk = 0; //constant size if (stbl->SampleSize && stbl->SampleSize->sampleSize) { u32 diff = sampleNumber - stbl->SampleToChunk->firstSampleInCurrentChunk; offsetInChunk += diff * stbl->SampleSize->sampleSize; } else if ((stbl->r_last_chunk_num == chunk_num) && (stbl->r_last_sample_num == sampleNumber)) { offsetInChunk = stbl->r_last_offset_in_chunk; } else if ((stbl->r_last_chunk_num == chunk_num) && (stbl->r_last_sample_num + 1 == sampleNumber)) { e = stbl_GetSampleSize(stbl->SampleSize, stbl->r_last_sample_num, &size); if (e) return e; stbl->r_last_offset_in_chunk += size; stbl->r_last_sample_num = sampleNumber; offsetInChunk = stbl->r_last_offset_in_chunk; } else { //warning, firstSampleInChunk is at least 1 - not 0 for (i = stbl->SampleToChunk->firstSampleInCurrentChunk; i < sampleNumber; i++) { e = stbl_GetSampleSize(stbl->SampleSize, i, &size); if (e) return e; offsetInChunk += size; } stbl->r_last_chunk_num = chunk_num; stbl->r_last_sample_num = sampleNumber; stbl->r_last_offset_in_chunk = offsetInChunk; } //OK, that's the size of our offset in the chunk //now get the chunk if ( stbl->ChunkOffset->type == GF_ISOM_BOX_TYPE_STCO) { stco = (GF_ChunkOffsetBox *)stbl->ChunkOffset; if (stco->nb_entries < (*chunkNumber) ) return GF_ISOM_INVALID_FILE; (*offset) = (u64) stco->offsets[(*chunkNumber) - 1] + (u64) offsetInChunk; } else { co64 = (GF_ChunkLargeOffsetBox *)stbl->ChunkOffset; if (co64->nb_entries < (*chunkNumber) ) return GF_ISOM_INVALID_FILE; (*offset) = co64->offsets[(*chunkNumber) - 1] + (u64) offsetInChunk; } return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "Memory leak in the stbl_GetSampleInfos function in MP4Box in GPAC 1.0.1 allows attackers to read memory via a crafted file.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2021-31256"}} -{"idx": 374061, "input": "STATIC GC_descr GC_double_descr(GC_descr descriptor, word nwords) { if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) { descriptor = GC_bm_table[BYTES_TO_WORDS((word)descriptor)]; }; descriptor |= (descriptor & ~GC_DS_TAGS) >> nwords; return(descriptor); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393220, "input": "TEST_F(QueryPlannerTest, IdCovering) { runQuerySortProj(fromjson(\"{_id: {$gt: 10}}\"), BSONObj(), fromjson(\"{_id: 1}\")); ASSERT_EQUALS(getNumSolutions(), 2U); assertSolutionExists( \"{proj: {spec: {_id: 1}, node: \" \"{cscan: {dir: 1, filter: {_id: {$gt: 10}}}}}}\"); assertSolutionExists( \"{proj: {spec: {_id: 1}, node: {ixscan: \" \"{filter: null, pattern: {_id: 1}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219847, "input": "static inline uint16_t strtr_hash(const char *str, int len) { uint16_t res = 0; for (int i = 0; i < len; i++) { res = res * 33 + (unsigned char)str[i]; } return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 223156, "input": "void SetAttrValue(const TensorShapeProto& value, AttrValue* out) { *out->mutable_shape() = value; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 291367, "input": "static X509_STORE *php_openssl_setup_verify(zval *calist) { X509_STORE *store; X509_LOOKUP * dir_lookup, * file_lookup; int ndirs = 0, nfiles = 0; zval * item; zend_stat_t sb; store = X509_STORE_new(); if (store == NULL) { php_openssl_store_errors(); return NULL; } if (calist && (Z_TYPE_P(calist) == IS_ARRAY)) { ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(calist), item) { convert_to_string_ex(item); if (VCWD_STAT(Z_STRVAL_P(item), &sb) == -1) { php_error_docref(NULL, E_WARNING, \"unable to stat %s\", Z_STRVAL_P(item)); continue; } if ((sb.st_mode & S_IFREG) == S_IFREG) { file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, Z_STRVAL_P(item), X509_FILETYPE_PEM)) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, \"error loading file %s\", Z_STRVAL_P(item)); } else { nfiles++; } file_lookup = NULL; } else { dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, Z_STRVAL_P(item), X509_FILETYPE_PEM)) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, \"error loading directory %s\", Z_STRVAL_P(item)); } else { ndirs++; } dir_lookup = NULL; } } ZEND_HASH_FOREACH_END(); } if (nfiles == 0) { file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT)) { php_openssl_store_errors(); } } if (ndirs == 0) { dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, NULL, X509_FILETYPE_DEFAULT)) { php_openssl_store_errors(); } } return store; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399938, "input": "virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint32_t count) { uint32_t pkt_idx = 0; uint32_t remained = count; do { rte_prefetch0(&vq->desc_packed[vq->last_avail_idx]); if (remained >= PACKED_BATCH_SIZE) { if (!virtio_dev_tx_batch_packed(dev, vq, mbuf_pool, &pkts[pkt_idx])) { pkt_idx += PACKED_BATCH_SIZE; remained -= PACKED_BATCH_SIZE; continue; } } if (virtio_dev_tx_single_packed(dev, vq, mbuf_pool, &pkts[pkt_idx])) break; pkt_idx++; remained--; } while (remained); if (vq->shadow_used_idx) { do_data_copy_dequeue(vq); vhost_flush_dequeue_shadow_packed(dev, vq); vhost_vring_call_packed(dev, vq); } return pkt_idx; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269606, "input": "TEST(BasicFlatBufferModel, TestHandleModelWithWhileOpContainsForwardingInput) { const auto model_path = \"tensorflow/lite/testdata/while_op_with_forwarding_input.bin\"; std::unique_ptr model = FlatBufferModel::BuildFromFile(model_path); ASSERT_NE(model, nullptr); tflite::ops::builtin::BuiltinOpResolver resolver; InterpreterBuilder builder(*model, resolver); std::unique_ptr interpreter; ASSERT_EQ(builder(&interpreter), kTfLiteOk); ASSERT_NE(interpreter, nullptr); ASSERT_EQ(interpreter->AllocateTensors(), kTfLiteOk); int32_t* tensor_data = interpreter->typed_tensor(0); tensor_data[0] = 20; auto tensor = interpreter->tensor(1); DynamicBuffer buf; buf.AddString(\"a\", 1); buf.WriteToTensor(tensor, /*new_shape=*/nullptr); ASSERT_EQ(interpreter->Invoke(), kTfLiteOk); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215064, "input": "struct clock_source *dcn20_clock_source_create( struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) { struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); if (!clk_src) return NULL; if (dcn20_clk_src_construct(clk_src, ctx, bios, id, regs, &cs_shift, &cs_mask)) { clk_src->base.dp_clk_src = dp_clk_src; return &clk_src->base; } BREAK_TO_DEBUGGER(); return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "Memory leaks in *clock_source_create() functions under drivers/gpu/drm/amd/display/dc in the Linux kernel before 5.3.8 allow attackers to cause a denial of service (memory consumption). This affects the dce112_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c, the dce100_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c, the dcn10_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c, the dcn20_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c, the dce120_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c, the dce110_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c, and the dce80_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c, aka CID-055e547478a1.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2019-19083"}} -{"idx": 197296, "input": "GF_Err tenc_box_read(GF_Box *s, GF_BitStream *bs) { u8 iv_size; GF_TrackEncryptionBox *ptr = (GF_TrackEncryptionBox*)s; ISOM_DECREASE_SIZE(ptr, 3); gf_bs_read_u8(bs); //reserved if (!ptr->version) { gf_bs_read_u8(bs); //reserved } else { ptr->crypt_byte_block = gf_bs_read_int(bs, 4); ptr->skip_byte_block = gf_bs_read_int(bs, 4); } ptr->isProtected = gf_bs_read_u8(bs); ISOM_DECREASE_SIZE(ptr, 17); ptr->key_info[0] = 0; ptr->key_info[1] = 0; ptr->key_info[2] = 0; ptr->key_info[3] = iv_size = gf_bs_read_u8(bs); gf_bs_read_data(bs, ptr->key_info+4, 16); if (!iv_size && ptr->isProtected) { ISOM_DECREASE_SIZE(ptr, 1); iv_size = ptr->key_info[20] = gf_bs_read_u8(bs); ISOM_DECREASE_SIZE(ptr, ptr->key_info[20]); gf_bs_read_data(bs, ptr->key_info+21, iv_size); } return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "Buffer overflow in the tenc_box_read function in MP4Box in GPAC 1.0.1 allows attackers to cause a denial of service or execute arbitrary code via a crafted file, related invalid IV sizes.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-31254"}} -{"idx": 453385, "input": "static void bfq_arm_slice_timer(struct bfq_data *bfqd) { struct bfq_queue *bfqq = bfqd->in_service_queue; u32 sl; bfq_mark_bfqq_wait_request(bfqq); /* * We don't want to idle for seeks, but we do want to allow * fair distribution of slice time for a process doing back-to-back * seeks. So allow a little bit of time for him to submit a new rq. */ sl = bfqd->bfq_slice_idle; /* * Unless the queue is being weight-raised or the scenario is * asymmetric, grant only minimum idle time if the queue * is seeky. A long idling is preserved for a weight-raised * queue, or, more in general, in an asymmetric scenario, * because a long idling is needed for guaranteeing to a queue * its reserved share of the throughput (in particular, it is * needed if the queue has a higher weight than some other * queue). */ if (BFQQ_SEEKY(bfqq) && bfqq->wr_coeff == 1 && !bfq_asymmetric_scenario(bfqd, bfqq)) sl = min_t(u64, sl, BFQ_MIN_TT); else if (bfqq->wr_coeff > 1) sl = max_t(u32, sl, 20ULL * NSEC_PER_MSEC); bfqd->last_idling_start = ktime_get(); bfqd->last_idling_start_jiffies = jiffies; hrtimer_start(&bfqd->idle_slice_timer, ns_to_ktime(sl), HRTIMER_MODE_REL); bfqg_stats_set_start_idle_time(bfqq_group(bfqq));", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385237, "input": "process_tcp_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo, proto_tree *tree, proto_tree *tcp_tree, int src_port, int dst_port, guint32 seq, guint32 nxtseq, gboolean is_tcp_segment, struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo) { pinfo->want_pdu_tracking=0; TRY { if(is_tcp_segment) { /*qqq see if it is an unaligned PDU */ if(tcpd && tcp_analyze_seq && (!tcp_desegment)) { if(seq || nxtseq) { offset=scan_for_next_pdu(tvb, tcp_tree, pinfo, offset, seq, nxtseq, tcpd->fwd->multisegment_pdus); } } } /* if offset is -1 this means that this segment is known * to be fully inside a previously detected pdu * so we don't even need to try to dissect it either. */ if( (offset!=-1) && decode_tcp_ports(tvb, offset, pinfo, tree, src_port, dst_port, tcpd, tcpinfo) ) { /* * We succeeded in handing off to a subdissector. * * Is this a TCP segment or a reassembled chunk of * TCP payload? */ if(is_tcp_segment) { /* if !visited, check want_pdu_tracking and store it in table */ if(tcpd && (!pinfo->fd->visited) && tcp_analyze_seq && pinfo->want_pdu_tracking) { if(seq || nxtseq) { pdu_store_sequencenumber_of_next_pdu( pinfo, seq, nxtseq+pinfo->bytes_until_next_pdu, tcpd->fwd->multisegment_pdus); } } } } } CATCH_ALL { /* We got an exception. At this point the dissection is * completely aborted and execution will be transferred back * to (probably) the frame dissector. * Here we have to place whatever we want the dissector * to do before aborting the tcp dissection. */ /* * Is this a TCP segment or a reassembled chunk of TCP * payload? */ if(is_tcp_segment) { /* * It's from a TCP segment. * * if !visited, check want_pdu_tracking and store it * in table */ if(tcpd && (!pinfo->fd->visited) && tcp_analyze_seq && pinfo->want_pdu_tracking) { if(seq || nxtseq) { pdu_store_sequencenumber_of_next_pdu(pinfo, seq, nxtseq+pinfo->bytes_until_next_pdu, tcpd->fwd->multisegment_pdus); } } } RETHROW; } ENDTRY; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234494, "input": "static void ff_layout_commit_prepare_common(struct rpc_task *task, struct nfs_commit_data *cdata) { ff_layout_commit_record_layoutstats_start(task, cdata); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 451251, "input": "static inline bool ext4_match(const struct inode *parent, const struct ext4_filename *fname, const struct ext4_dir_entry_2 *de) { struct fscrypt_name f; #ifdef CONFIG_UNICODE const struct qstr entry = {.name = de->name, .len = de->name_len}; #endif if (!de->inode) return false; f.usr_fname = fname->usr_fname; f.disk_name = fname->disk_name; #ifdef CONFIG_FS_ENCRYPTION f.crypto_buf = fname->crypto_buf; #endif #ifdef CONFIG_UNICODE if (EXT4_SB(parent->i_sb)->s_encoding && IS_CASEFOLDED(parent)) { if (fname->cf_name.name) { struct qstr cf = {.name = fname->cf_name.name, .len = fname->cf_name.len}; return !ext4_ci_compare(parent, &cf, &entry, true); } return !ext4_ci_compare(parent, fname->usr_fname, &entry, false); } #endif return fscrypt_match_name(&f, de->name, de->name_len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281397, "input": "AWSGeneralBoto2Abstractor::get_v4_canonical_headers( const req_info& info, const boost::string_view& signedheaders, const bool using_qs) const { return rgw::auth::s3::get_v4_canonical_headers(info, signedheaders, using_qs, true); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431894, "input": "static void hci_cs_read_remote_ext_features(struct hci_dev *hdev, __u8 status) { struct hci_cp_read_remote_ext_features *cp; struct hci_conn *conn; BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); if (!status) return; cp = hci_sent_cmd_data(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES); if (!cp) return; hci_dev_lock(hdev); conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle)); if (conn) { if (conn->state == BT_CONFIG) { hci_connect_cfm(conn, status); hci_conn_drop(conn); } } hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208718, "input": "rndr_quote(struct buf *ob, const struct buf *text, void *opaque) { if (!text || !text->size) return 0; BUFPUTSL(ob, \"\"); bufput(ob, text->data, text->size); BUFPUTSL(ob, \"\"); return 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"], "explanation": "Redcarpet is a Ruby library for Markdown processing. In Redcarpet before version 3.5.1, there is an injection vulnerability which can enable a cross-site scripting attack. In affected versions no HTML escaping was being performed when processing quotes. This applies even when the `:escape_html` option was being used. This is fixed in version 3.5.1 by the referenced commit.", "severity_level": "NoInfo", "cwe": "CWE-79", "cve": "CVE-2020-26298"}} -{"idx": 421787, "input": "set_lan_param_wait(struct ipmi_intf * intf, uint8_t chan, int param, uint8_t * data, int len) { struct lan_param * p; int retry = 10; /* 10 retries */ lprintf(LOG_DEBUG, \"Waiting for Set LAN Parameter to complete...\"); if (verbose > 1) printbuf(data, len, \"SET DATA\"); for (;;) { p = get_lan_param(intf, chan, param); if (!p) { sleep(IPMI_LANP_TIMEOUT); if (retry-- == 0) return -1; continue; } if (verbose > 1) printbuf(p->data, p->data_len, \"READ DATA\"); if (p->data_len != len) { sleep(IPMI_LANP_TIMEOUT); if (retry-- == 0) { lprintf(LOG_WARNING, \"Mismatched data lengths: %d != %d\", p->data_len, len); return -1; } continue; } if (memcmp(data, p->data, len) != 0) { sleep(IPMI_LANP_TIMEOUT); if (retry-- == 0) { lprintf(LOG_WARNING, \"LAN Parameter Data does not match! \" \"Write may have failed.\"); return -1; } continue; } break; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379507, "input": "execute_builtin_or_function (words, builtin, var, redirects, fds_to_close, flags) WORD_LIST *words; sh_builtin_func_t *builtin; SHELL_VAR *var; REDIRECT *redirects; struct fd_bitmap *fds_to_close; int flags; { int result; REDIRECT *saved_undo_list; #if defined (PROCESS_SUBSTITUTION) int ofifo, nfifo, osize; char *ofifo_list; #endif #if defined (PROCESS_SUBSTITUTION) ofifo = num_fifos (); ofifo_list = copy_fifo_list (&osize); #endif if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0) { cleanup_redirects (redirection_undo_list); redirection_undo_list = (REDIRECT *)NULL; dispose_exec_redirects (); #if defined (PROCESS_SUBSTITUTION) free (ofifo_list); #endif return (EX_REDIRFAIL); /* was EXECUTION_FAILURE */ } saved_undo_list = redirection_undo_list; /* Calling the \"exec\" builtin changes redirections forever. */ if (builtin == exec_builtin) { dispose_redirects (saved_undo_list); saved_undo_list = exec_redirection_undo_list; exec_redirection_undo_list = (REDIRECT *)NULL; } else dispose_exec_redirects (); if (saved_undo_list) { begin_unwind_frame (\"saved redirects\"); add_unwind_protect (cleanup_redirects, (char *)saved_undo_list); } redirection_undo_list = (REDIRECT *)NULL; if (builtin) result = execute_builtin (builtin, words, flags, 0); else result = execute_function (var, words, flags, fds_to_close, 0, 0); /* We do this before undoing the effects of any redirections. */ fflush (stdout); fpurge (stdout); if (ferror (stdout)) clearerr (stdout); /* If we are executing the `command' builtin, but this_shell_builtin is set to `exec_builtin', we know that we have something like `command exec [redirection]', since otherwise `exec' would have overwritten the shell and we wouldn't get here. In this case, we want to behave as if the `command' builtin had not been specified and preserve the redirections. */ if (builtin == command_builtin && this_shell_builtin == exec_builtin) { int discard; discard = 0; if (saved_undo_list) { dispose_redirects (saved_undo_list); discard = 1; } redirection_undo_list = exec_redirection_undo_list; saved_undo_list = exec_redirection_undo_list = (REDIRECT *)NULL; if (discard) discard_unwind_frame (\"saved redirects\"); } if (saved_undo_list) { redirection_undo_list = saved_undo_list; discard_unwind_frame (\"saved redirects\"); } if (redirection_undo_list) { cleanup_redirects (redirection_undo_list); redirection_undo_list = (REDIRECT *)NULL; } #if defined (PROCESS_SUBSTITUTION) /* Close any FIFOs created by this builtin or function. */ nfifo = num_fifos (); if (nfifo > ofifo) close_new_fifos (ofifo_list, osize); free (ofifo_list); #endif return (result); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379460, "input": "new_fd_bitmap (size) int size; { struct fd_bitmap *ret; ret = (struct fd_bitmap *)xmalloc (sizeof (struct fd_bitmap)); ret->size = size; if (size) { ret->bitmap = (char *)xmalloc (size); memset (ret->bitmap, '\\0', size); } else ret->bitmap = (char *)NULL; return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267248, "input": "GF_Err gf_isom_add_user_data_boxes(GF_ISOFile *movie, u32 trackNumber, u8 *data, u32 DataLength) { GF_Err e; GF_TrackBox *trak; GF_UserDataBox *udta; GF_BitStream *bs; e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE); if (e) return e; if (trackNumber) { trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak) return GF_BAD_PARAM; if (!trak->udta) trak_on_child_box((GF_Box*)trak, gf_isom_box_new_parent(&trak->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE); udta = trak->udta; } else { if (!movie->moov) return GF_BAD_PARAM; if (!movie->moov->udta) moov_on_child_box((GF_Box*)movie->moov, gf_isom_box_new_parent(&movie->moov->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE); udta = movie->moov->udta; } if (!udta) return GF_OUT_OF_MEM; bs = gf_bs_new(data, DataLength, GF_BITSTREAM_READ); while (gf_bs_available(bs)) { GF_Box *a; e = gf_isom_box_parse(&a, bs); if (e) break; e = udta_on_child_box((GF_Box *)udta, a, GF_FALSE); if (e) break; } gf_bs_del(bs); return e; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410808, "input": "static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops, const struct sock *sk, struct sk_buff *skb, __u16 *mss) { tcp_synq_overflow(sk); __NET_INC_STATS(sock_net(sk), LINUX_MIB_SYNCOOKIESSENT); return ops->cookie_init_seq(skb, mss); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215060, "input": "struct clock_source *dce80_clock_source_create( struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) { struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); if (!clk_src) return NULL; if (dce110_clk_src_construct(clk_src, ctx, bios, id, regs, &cs_shift, &cs_mask)) { clk_src->base.dp_clk_src = dp_clk_src; return &clk_src->base; } BREAK_TO_DEBUGGER(); return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "Memory leaks in *clock_source_create() functions under drivers/gpu/drm/amd/display/dc in the Linux kernel before 5.3.8 allow attackers to cause a denial of service (memory consumption). This affects the dce112_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c, the dce100_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c, the dcn10_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c, the dcn20_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c, the dce120_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c, the dce110_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c, and the dce80_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c, aka CID-055e547478a1.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2019-19083"}} -{"idx": 280581, "input": "check_set_ip(struct ofpact_check_params *cp) { if (!is_ip_any(&cp->match->flow)) { inconsistent_match(&cp->usable_protocols); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 404088, "input": "void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode) { struct kvm *kvm = me->kvm; struct kvm_vcpu *vcpu; int last_boosted_vcpu = me->kvm->last_boosted_vcpu; int yielded = 0; int try = 3; int pass; int i; kvm_vcpu_set_in_spin_loop(me, true); /* * We boost the priority of a VCPU that is runnable but not * currently running, because it got preempted by something * else and called schedule in __vcpu_run. Hopefully that * VCPU is holding the lock that we need and will release it. * We approximate round-robin by starting at the last boosted VCPU. */ for (pass = 0; pass < 2 && !yielded && try; pass++) { kvm_for_each_vcpu(i, vcpu, kvm) { if (!pass && i <= last_boosted_vcpu) { i = last_boosted_vcpu; continue; } else if (pass && i > last_boosted_vcpu) break; if (!READ_ONCE(vcpu->ready)) continue; if (vcpu == me) continue; if (rcuwait_active(&vcpu->wait) && !vcpu_dy_runnable(vcpu)) continue; if (READ_ONCE(vcpu->preempted) && yield_to_kernel_mode && !kvm_arch_dy_has_pending_interrupt(vcpu) && !kvm_arch_vcpu_in_kernel(vcpu)) continue; if (!kvm_vcpu_eligible_for_directed_yield(vcpu)) continue; yielded = kvm_vcpu_yield_to(vcpu); if (yielded > 0) { kvm->last_boosted_vcpu = i; break; } else if (yielded < 0) { try--; if (!try) break; } } } kvm_vcpu_set_in_spin_loop(me, false); /* Ensure vcpu is not eligible during next spinloop */ kvm_vcpu_set_dy_eligible(me, false); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402190, "input": "bcf_fmt_t *bcf_get_fmt_id(bcf1_t *line, const int id) { int i; if ( !(line->unpacked & BCF_UN_FMT) ) bcf_unpack(line, BCF_UN_FMT); for (i=0; in_fmt; i++) { if ( line->d.fmt[i].id==id ) return &line->d.fmt[i]; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196871, "input": "PackLinuxElf32::invert_pt_dynamic(Elf32_Dyn const *dynp) { if (dt_table[Elf32_Dyn::DT_NULL]) { return; // not 1st time; do not change upx_dt_init } Elf32_Dyn const *const dynp0 = dynp; unsigned ndx = 1+ 0; if (dynp) for (; ; ++ndx, ++dynp) { unsigned const d_tag = get_te32(&dynp->d_tag); if (d_tag < DT_NUM) { if (Elf32_Dyn::DT_NEEDED != d_tag && dt_table[d_tag] && get_te32(&dynp->d_val) != get_te32(&dynp0[-1+ dt_table[d_tag]].d_val)) { char msg[50]; snprintf(msg, sizeof(msg), \"duplicate DT_%#x: [%#x] [%#x]\", d_tag, -1+ dt_table[d_tag], -1+ ndx); throwCantPack(msg); } dt_table[d_tag] = ndx; } if (Elf32_Dyn::DT_NULL == d_tag) { break; // check here so that dt_table[DT_NULL] is set } } upx_dt_init = 0; if (dt_table[Elf32_Dyn::DT_INIT]) upx_dt_init = Elf32_Dyn::DT_INIT; else if (dt_table[Elf32_Dyn::DT_PREINIT_ARRAY]) upx_dt_init = Elf32_Dyn::DT_PREINIT_ARRAY; else if (dt_table[Elf32_Dyn::DT_INIT_ARRAY]) upx_dt_init = Elf32_Dyn::DT_INIT_ARRAY; unsigned const z_str = dt_table[Elf32_Dyn::DT_STRSZ]; if (z_str) { strtab_end = get_te32(&dynp0[-1+ z_str].d_val); if ((u32_t)file_size <= strtab_end) { // FIXME: weak char msg[50]; snprintf(msg, sizeof(msg), \"bad DT_STRSZ %#x\", strtab_end); throwCantPack(msg); } } unsigned const x_sym = dt_table[Elf32_Dyn::DT_SYMTAB]; unsigned const x_str = dt_table[Elf32_Dyn::DT_STRTAB]; if (x_sym && x_str) { upx_uint32_t const v_sym = get_te32(&dynp0[-1+ x_sym].d_val); upx_uint32_t const v_str = get_te32(&dynp0[-1+ x_str].d_val); unsigned const z_sym = dt_table[Elf32_Dyn::DT_SYMENT]; unsigned const sz_sym = !z_sym ? sizeof(Elf32_Sym) : get_te32(&dynp0[-1+ z_sym].d_val); if (v_sym < v_str) { symnum_end = (v_str - v_sym) / sz_sym; } } // DT_HASH often ends at DT_SYMTAB unsigned const v_hsh = elf_unsigned_dynamic(Elf32_Dyn::DT_HASH); if (v_hsh && file_image) { hashtab = (unsigned const *)elf_find_dynamic(Elf32_Dyn::DT_HASH); if (!hashtab) { char msg[40]; snprintf(msg, sizeof(msg), \"bad DT_HASH %#x\", v_hsh); throwCantPack(msg); } unsigned const nbucket = get_te32(&hashtab[0]); unsigned const *const buckets = &hashtab[2]; unsigned const *const chains = &buckets[nbucket]; (void)chains; unsigned const v_sym = get_te32(&dynp0[-1+ x_sym].d_val); if (!nbucket || (nbucket>>31) || (file_size/sizeof(unsigned)) <= (2*nbucket) // FIXME: weak || ((v_hsh < v_sym) && (v_sym - v_hsh) < (sizeof(unsigned)*2 // headers + sizeof(*buckets)*nbucket // buckets + sizeof(*chains) *nbucket // chains )) ) { char msg[90]; snprintf(msg, sizeof(msg), \"bad DT_HASH nbucket=%#x len=%#x\", nbucket, (v_sym - v_hsh)); throwCantPack(msg); } } // DT_GNU_HASH often ends at DT_SYMTAB; FIXME: not for Android? unsigned const v_gsh = elf_unsigned_dynamic(Elf32_Dyn::DT_GNU_HASH); if (v_gsh && file_image) { gashtab = (unsigned const *)elf_find_dynamic(Elf32_Dyn::DT_GNU_HASH); if (!gashtab) { char msg[40]; snprintf(msg, sizeof(msg), \"bad DT_GNU_HASH %#x\", v_gsh); throwCantPack(msg); } unsigned const n_bucket = get_te32(&gashtab[0]); unsigned const n_bitmask = get_te32(&gashtab[2]); unsigned const gnu_shift = get_te32(&gashtab[3]); unsigned const *const bitmask = (unsigned const *)(void const *)&gashtab[4]; unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask]; unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; //unsigned const *const gashend = &hasharr[n_bucket]; // minimum unsigned const v_sym = get_te32(&dynp0[-1+ x_sym].d_val); if (!n_bucket || !n_bitmask || (-1+ n_bitmask) & n_bitmask // not a power of 2 || 8*sizeof(unsigned) <= gnu_shift // shifted result always == 0 || (n_bucket>>30) // fie on fuzzers || (n_bitmask>>30) || (file_size / sizeof(unsigned)) <= (n_bitmask + 2*n_bucket) // FIXME: weak // FIXME: next test does work for Android? || ((v_gsh < v_sym) && (v_sym - v_gsh) < (sizeof(unsigned)*4 // headers + sizeof(*bitmask)*n_bitmask // bitmask + sizeof(*buckets)*n_bucket // buckets + sizeof(*hasharr)*n_bucket // hasharr )) ) { char msg[90]; snprintf(msg, sizeof(msg), \"bad DT_GNU_HASH n_bucket=%#x n_bitmask=%#x len=%#x\", n_bucket, n_bitmask, v_sym - v_gsh); throwCantPack(msg); } } unsigned const e_shstrndx = get_te16(&ehdri.e_shstrndx); if (e_shnum <= e_shstrndx && !(0==e_shnum && 0==e_shstrndx) ) { char msg[40]; snprintf(msg, sizeof(msg), \"bad .e_shstrndx %d >= .e_shnum %d\", e_shstrndx, e_shnum); throwCantPack(msg); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "A floating point exception issue was discovered in UPX in PackLinuxElf64::invert_pt_dynamic() function of p_lx_elf.cpp file. An attacker with a crafted input file could trigger this issue that could cause a crash leading to a denial of service. The highest impact is to Availability.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2020-27790"}} -{"idx": 509367, "input": "Item_bool(THD *thd, const char *str_arg, longlong i): Item_int(thd, str_arg, i, 1) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246376, "input": "static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, const char *arg) { void *sconf = cmd->server->module_config; core_server_config *conf = ap_get_core_module_config(sconf); const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE); if (err != NULL) { return err; } conf->gprof_dir = arg; return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268024, "input": "static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct net *net = sock_net(sk); int err; struct sadb_address *sa; struct sadb_x_policy *pol; struct xfrm_policy *xp; struct xfrm_selector sel; struct km_event c; struct sadb_x_sec_ctx *sec_ctx; struct xfrm_sec_ctx *pol_ctx = NULL; if (!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1], ext_hdrs[SADB_EXT_ADDRESS_DST-1]) || !ext_hdrs[SADB_X_EXT_POLICY-1]) return -EINVAL; pol = ext_hdrs[SADB_X_EXT_POLICY-1]; if (!pol->sadb_x_policy_dir || pol->sadb_x_policy_dir >= IPSEC_DIR_MAX) return -EINVAL; memset(&sel, 0, sizeof(sel)); sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1]; sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr); sel.prefixlen_s = sa->sadb_address_prefixlen; sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); sel.sport = ((struct sockaddr_in *)(sa+1))->sin_port; if (sel.sport) sel.sport_mask = htons(0xffff); sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1]; pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); sel.prefixlen_d = sa->sadb_address_prefixlen; sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); sel.dport = ((struct sockaddr_in *)(sa+1))->sin_port; if (sel.dport) sel.dport_mask = htons(0xffff); sec_ctx = ext_hdrs[SADB_X_EXT_SEC_CTX - 1]; if (sec_ctx != NULL) { struct xfrm_user_sec_ctx *uctx = pfkey_sadb2xfrm_user_sec_ctx(sec_ctx, GFP_KERNEL); if (!uctx) return -ENOMEM; err = security_xfrm_policy_alloc(&pol_ctx, uctx, GFP_KERNEL); kfree(uctx); if (err) return err; } xp = xfrm_policy_bysel_ctx(net, &dummy_mark, 0, XFRM_POLICY_TYPE_MAIN, pol->sadb_x_policy_dir - 1, &sel, pol_ctx, 1, &err); security_xfrm_policy_free(pol_ctx); if (xp == NULL) return -ENOENT; xfrm_audit_policy_delete(xp, err ? 0 : 1, true); if (err) goto out; c.seq = hdr->sadb_msg_seq; c.portid = hdr->sadb_msg_pid; c.data.byid = 0; c.event = XFRM_MSG_DELPOLICY; km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); out: xfrm_pol_put(xp); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 384504, "input": "static int iwl_dump_ini_rxf_iter(struct iwl_fw_runtime *fwrt, struct iwl_fw_ini_region_cfg *reg, void *range_ptr, int idx) { struct iwl_fw_ini_error_dump_range *range = range_ptr; struct iwl_ini_rxf_data rxf_data; struct iwl_fw_ini_error_dump_register *reg_dump = (void *)range->data; u32 offs = le32_to_cpu(reg->offset), addr; u32 registers_size = le32_to_cpu(reg->fifos.num_of_registers) * sizeof(*reg_dump); __le32 *data; unsigned long flags; int i; iwl_ini_get_rxf_data(fwrt, reg, &rxf_data); if (!rxf_data.size) return -EIO; if (!iwl_trans_grab_nic_access(fwrt->trans, &flags)) return -EBUSY; range->fifo_hdr.fifo_num = cpu_to_le32(rxf_data.fifo_num); range->fifo_hdr.num_of_registers = reg->fifos.num_of_registers; range->range_data_size = cpu_to_le32(rxf_data.size + registers_size); /* * read rxf registers. for each register, write to the dump the * register address and its value */ for (i = 0; i < le32_to_cpu(reg->fifos.num_of_registers); i++) { addr = le32_to_cpu(reg->start_addr[i]) + offs; reg_dump->addr = cpu_to_le32(addr); reg_dump->data = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr)); reg_dump++; } if (reg->fifos.header_only) { range->range_data_size = cpu_to_le32(registers_size); goto out; } /* * region register have absolute value so apply rxf offset after * reading the registers */ offs += rxf_data.offset; /* Lock fence */ iwl_write_prph_no_grab(fwrt->trans, RXF_SET_FENCE_MODE + offs, 0x1); /* Set fence pointer to the same place like WR pointer */ iwl_write_prph_no_grab(fwrt->trans, RXF_LD_WR2FENCE + offs, 0x1); /* Set fence offset */ iwl_write_prph_no_grab(fwrt->trans, RXF_LD_FENCE_OFFSET_ADDR + offs, 0x0); /* Read FIFO */ addr = RXF_FIFO_RD_FENCE_INC + offs; data = (void *)reg_dump; for (i = 0; i < rxf_data.size; i += sizeof(*data)) *data++ = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr)); out: iwl_trans_release_nic_access(fwrt->trans, &flags); return sizeof(*range) + le32_to_cpu(range->range_data_size); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281330, "input": "RGWOp *RGWHandler_REST_Obj_S3::op_options() { return new RGWOptionsCORS_ObjStore_S3; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 209003, "input": "_gnutls_ciphertext2compressed (gnutls_session_t session, opaque * compress_data, int compress_size, gnutls_datum_t ciphertext, uint8_t type) { uint8_t MAC[MAX_HASH_SIZE]; uint16_t c_length; uint8_t pad; int length; digest_hd_st td; uint16_t blocksize; int ret, i, pad_failed = 0; uint8_t major, minor; gnutls_protocol_t ver; int hash_size = _gnutls_hash_get_algo_len (session->security_parameters. read_mac_algorithm); ver = gnutls_protocol_get_version (session); minor = _gnutls_version_get_minor (ver); major = _gnutls_version_get_major (ver); blocksize = _gnutls_cipher_get_block_size (session->security_parameters. read_bulk_cipher_algorithm); /* initialize MAC */ ret = mac_init (&td, session->security_parameters.read_mac_algorithm, session->connection_state.read_mac_secret.data, session->connection_state.read_mac_secret.size, ver); if (ret < 0 && session->security_parameters.read_mac_algorithm != GNUTLS_MAC_NULL) { gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } if (ciphertext.size < (unsigned) blocksize + hash_size) { _gnutls_record_log (\"REC[%x]: Short record length %d < %d + %d (under attack?)\\n\", session, ciphertext.size, blocksize, hash_size); gnutls_assert (); return GNUTLS_E_DECRYPTION_FAILED; } /* actual decryption (inplace) */ switch (_gnutls_cipher_is_block (session->security_parameters.read_bulk_cipher_algorithm)) { case CIPHER_STREAM: if ((ret = _gnutls_cipher_decrypt (&session->connection_state. read_cipher_state, ciphertext.data, ciphertext.size)) < 0) { gnutls_assert (); return ret; } length = ciphertext.size - hash_size; break; case CIPHER_BLOCK: if ((ciphertext.size < blocksize) || (ciphertext.size % blocksize != 0)) { gnutls_assert (); return GNUTLS_E_DECRYPTION_FAILED; } if ((ret = _gnutls_cipher_decrypt (&session->connection_state. read_cipher_state, ciphertext.data, ciphertext.size)) < 0) { gnutls_assert (); return ret; } /* ignore the IV in TLS 1.1. */ if (session->security_parameters.version >= GNUTLS_TLS1_1) { ciphertext.size -= blocksize; ciphertext.data += blocksize; if (ciphertext.size == 0) { gnutls_assert (); return GNUTLS_E_DECRYPTION_FAILED; } } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int)pad > (int)ciphertext.size - hash_size) { gnutls_assert (); /* We do not fail here. We check below for the * the pad_failed. If zero means success. */ pad_failed = GNUTLS_E_DECRYPTION_FAILED; } length = ciphertext.size - hash_size - pad; /* Check the pading bytes (TLS 1.x) */ if (ver >= GNUTLS_TLS1 && pad_failed == 0) for (i = 2; i < pad; i++) { if (ciphertext.data[ciphertext.size - i] != ciphertext.data[ciphertext.size - 1]) pad_failed = GNUTLS_E_DECRYPTION_FAILED; } break; default: gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } if (length < 0) length = 0; c_length = _gnutls_conv_uint16 ((uint16_t) length); /* Pass the type, version, length and compressed through * MAC. */ if (session->security_parameters.read_mac_algorithm != GNUTLS_MAC_NULL) { _gnutls_hmac (&td, UINT64DATA (session->connection_state. read_sequence_number), 8); _gnutls_hmac (&td, &type, 1); if (ver >= GNUTLS_TLS1) { /* TLS 1.x */ _gnutls_hmac (&td, &major, 1); _gnutls_hmac (&td, &minor, 1); } _gnutls_hmac (&td, &c_length, 2); if (length > 0) _gnutls_hmac (&td, ciphertext.data, length); mac_deinit (&td, MAC, ver); } /* This one was introduced to avoid a timing attack against the TLS * 1.0 protocol. */ if (pad_failed != 0) return pad_failed; /* HMAC was not the same. */ if (memcmp (MAC, &ciphertext.data[length], hash_size) != 0) { gnutls_assert (); return GNUTLS_E_DECRYPTION_FAILED; } /* copy the decrypted stuff to compress_data. */ if (compress_size < length) { gnutls_assert (); return GNUTLS_E_DECOMPRESSION_FAILED; } memcpy (compress_data, ciphertext.data, length); return length; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "The _gnutls_server_name_recv_params function in lib/ext_server_name.c in libgnutls in gnutls-serv in GnuTLS before 2.2.4 does not properly calculate the number of Server Names in a TLS 1.0 Client Hello message during extension handling, which allows remote attackers to cause a denial of service (crash) or possibly execute arbitrary code via a zero value for the length of Server Names, which leads to a buffer overflow in session resumption data in the pack_security_parameters function, aka GNUTLS-SA-2008-1-1.", "severity_level": "High", "cwe": "CWE-189", "cve": "CVE-2008-1948"}} -{"idx": 402304, "input": "ClientHttpRequest::logRequest() { if (!out.size && logType.oldType == LOG_TAG_NONE) debugs(33, 5, \"logging half-baked transaction: \" << log_uri); al->icp.opcode = ICP_INVALID; al->url = log_uri; debugs(33, 9, \"clientLogRequest: al.url='\" << al->url << \"'\"); if (al->reply) { al->http.code = al->reply->sline.status(); al->http.content_type = al->reply->content_type.termedBuf(); } else if (loggingEntry() && loggingEntry()->mem_obj) { al->http.code = loggingEntry()->mem_obj->getReply()->sline.status(); al->http.content_type = loggingEntry()->mem_obj->getReply()->content_type.termedBuf(); } debugs(33, 9, \"clientLogRequest: http.code='\" << al->http.code << \"'\"); if (loggingEntry() && loggingEntry()->mem_obj && loggingEntry()->objectLen() >= 0) al->cache.objectSize = loggingEntry()->contentLen(); // payload duplicate ?? with or without TE ? al->http.clientRequestSz.header = req_sz; // the virgin request is saved to al->request if (al->request && al->request->body_pipe) al->http.clientRequestSz.payloadData = al->request->body_pipe->producedSize(); al->http.clientReplySz.header = out.headers_sz; // XXX: calculate without payload encoding or headers !! al->http.clientReplySz.payloadData = out.size - out.headers_sz; // pretend its all un-encoded data for now. al->cache.highOffset = out.offset; al->cache.code = logType; tvSub(al->cache.trTime, al->cache.start_time, current_time); if (request) prepareLogWithRequestDetails(request, al); #if USE_OPENSSL && 0 /* This is broken. Fails if the connection has been closed. Needs * to snarf the ssl details some place earlier.. */ if (getConn() != NULL) al->cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl); #endif /* Add notes (if we have a request to annotate) */ if (request) { // The al->notes and request->notes must point to the same object. (void)SyncNotes(*al, *request); for (auto i = Config.notes.begin(); i != Config.notes.end(); ++i) { if (const char *value = (*i)->match(request, al->reply, al)) { NotePairs ¬es = SyncNotes(*al, *request); notes.add((*i)->key.termedBuf(), value); debugs(33, 3, (*i)->key.termedBuf() << \" \" << value); } } } ACLFilledChecklist checklist(NULL, request, NULL); if (al->reply) { checklist.reply = al->reply; HTTPMSGLOCK(checklist.reply); } if (request) { HTTPMSGUNLOCK(al->adapted_request); al->adapted_request = request; HTTPMSGLOCK(al->adapted_request); } // no need checklist.syncAle(): already synced checklist.al = al; accessLogLog(al, &checklist); bool updatePerformanceCounters = true; if (Config.accessList.stats_collection) { ACLFilledChecklist statsCheck(Config.accessList.stats_collection, request, NULL); statsCheck.al = al; if (al->reply) { statsCheck.reply = al->reply; HTTPMSGLOCK(statsCheck.reply); } updatePerformanceCounters = statsCheck.fastCheck().allowed(); } if (updatePerformanceCounters) { if (request) updateCounters(); if (getConn() != NULL && getConn()->clientConnection != NULL) clientdbUpdate(getConn()->clientConnection->remote, logType, AnyP::PROTO_HTTP, out.size); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445544, "input": "static enum print_line_t print_raw_fmt(struct trace_iterator *iter) { struct trace_array *tr = iter->tr; struct trace_seq *s = &iter->seq; struct trace_entry *entry; struct trace_event *event; entry = iter->ent; if (tr->trace_flags & TRACE_ITER_CONTEXT_INFO) trace_seq_printf(s, \"%d %d %llu \", entry->pid, iter->cpu, iter->ts); if (trace_seq_has_overflowed(s)) return TRACE_TYPE_PARTIAL_LINE; event = ftrace_find_event(entry->type); if (event) return event->funcs->raw(iter, 0, event); trace_seq_printf(s, \"%d ?\\n\", entry->type); return trace_handle_return(s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437574, "input": "static int svm_cpu_init(int cpu) { struct svm_cpu_data *sd; int r; sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); if (!sd) return -ENOMEM; sd->cpu = cpu; sd->save_area = alloc_page(GFP_KERNEL); r = -ENOMEM; if (!sd->save_area) goto err_1; per_cpu(svm_data, cpu) = sd; return 0; err_1: kfree(sd); return r; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280141, "input": "static void setup_object_debug(struct kmem_cache *s, struct page *page, void *object) { if (!(s->flags & (SLAB_STORE_USER|SLAB_RED_ZONE|__OBJECT_POISON))) return; init_object(s, object, SLUB_RED_INACTIVE); init_tracking(s, object); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379401, "input": "fix_assignment_words (words) WORD_LIST *words; { WORD_LIST *w, *wcmd; struct builtin *b; int assoc; if (words == 0) return; b = 0; assoc = 0; wcmd = words; for (w = words; w; w = w->next) if (w->word->flags & W_ASSIGNMENT) { if (b == 0) { /* Posix (post-2008) says that `command' doesn't change whether or not the builtin it shadows is a `declaration command', even though it removes other special builtin properties. In Posix mode, we skip over one or more instances of `command' and deal with the next word as the assignment builtin. */ while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, \"command\")) wcmd = wcmd->next; b = builtin_address_internal (wcmd->word->word, 0); if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0) return; else if (b && (b->flags & ASSIGNMENT_BUILTIN)) wcmd->word->flags |= W_ASSNBLTIN; } w->word->flags |= (W_NOSPLIT|W_NOGLOB|W_TILDEEXP|W_ASSIGNARG); #if defined (ARRAY_VARS) if (assoc) w->word->flags |= W_ASSIGNASSOC; #endif } #if defined (ARRAY_VARS) /* Note that we saw an associative array option to a builtin that takes assignment statements. This is a bit of a kludge. */ else if (w->word->word[0] == '-' && strchr (w->word->word, 'A')) { if (b == 0) { while (posixly_correct && wcmd && wcmd->word && wcmd->word->word && STREQ (wcmd->word->word, \"command\")) wcmd = wcmd->next; b = builtin_address_internal (wcmd->word->word, 0); if (b == 0 || (b->flags & ASSIGNMENT_BUILTIN) == 0) return; else if (b && (b->flags & ASSIGNMENT_BUILTIN)) wcmd->word->flags |= W_ASSNBLTIN; } if (wcmd->word->flags & W_ASSNBLTIN) assoc = 1; } #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354831, "input": "static inline void kvm_arch_end_assignment(struct kvm *kvm) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364158, "input": "void vma_adjust_trans_huge(struct vm_area_struct *vma, unsigned long start, unsigned long end, long adjust_next) { /* * If the new start address isn't hpage aligned and it could * previously contain an hugepage: check if we need to split * an huge pmd. */ if (start & ~HPAGE_PMD_MASK && (start & HPAGE_PMD_MASK) >= vma->vm_start && (start & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE <= vma->vm_end) split_huge_pmd_address(vma, start, false, NULL); /* * If the new end address isn't hpage aligned and it could * previously contain an hugepage: check if we need to split * an huge pmd. */ if (end & ~HPAGE_PMD_MASK && (end & HPAGE_PMD_MASK) >= vma->vm_start && (end & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE <= vma->vm_end) split_huge_pmd_address(vma, end, false, NULL); /* * If we're also updating the vma->vm_next->vm_start, if the new * vm_next->vm_start isn't page aligned and it could previously * contain an hugepage: check if we need to split an huge pmd. */ if (adjust_next > 0) { struct vm_area_struct *next = vma->vm_next; unsigned long nstart = next->vm_start; nstart += adjust_next << PAGE_SHIFT; if (nstart & ~HPAGE_PMD_MASK && (nstart & HPAGE_PMD_MASK) >= next->vm_start && (nstart & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE <= next->vm_end) split_huge_pmd_address(next, nstart, false, NULL); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506574, "input": "toggle_command() { int plotno = -1; char *plottitle = NULL; TBOOLEAN foundit = FALSE; c_token++; if (equals(c_token, \"all\")) { c_token++; } else if ((plottitle = try_to_get_string()) != NULL) { struct curve_points *plot; int length = strlen(plottitle); if (refresh_ok == E_REFRESH_OK_2D) plot = first_plot; else if (refresh_ok == E_REFRESH_OK_3D) plot = (struct curve_points *)first_3dplot; else plot = NULL; for (plotno = 0; plot != NULL; plot = plot->next, plotno++) { if (plot->title) if (!strcmp(plot->title, plottitle) || (plottitle[length-1] == '*' && !strncmp(plot->title, plottitle, length-1))) { foundit = TRUE; break; } } free(plottitle); if (!foundit) { int_warn(NO_CARET,\"Did not find a plot with that title\"); return; } } else { plotno = int_expression() - 1; } if (term->modify_plots) term->modify_plots(MODPLOTS_INVERT_VISIBILITIES, plotno); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499693, "input": "read_in_header (struct cpio_file_stat *file_hdr, int in_des) { union { char str[6]; unsigned short num; struct old_cpio_header old_header; } magic; long bytes_skipped = 0; /* Bytes of junk found before magic number. */ /* Search for a valid magic number. */ if (archive_format == arf_unknown) { union { char s[512]; unsigned short us; } tmpbuf; int check_tar; int peeked_bytes; while (archive_format == arf_unknown) { peeked_bytes = tape_buffered_peek (tmpbuf.s, in_des, 512); if (peeked_bytes < 6) error (PAXEXIT_FAILURE, 0, _(\"premature end of archive\")); if (!strncmp (tmpbuf.s, \"070701\", 6)) archive_format = arf_newascii; else if (!strncmp (tmpbuf.s, \"070707\", 6)) archive_format = arf_oldascii; else if (!strncmp (tmpbuf.s, \"070702\", 6)) { archive_format = arf_crcascii; crc_i_flag = true; } else if (tmpbuf.us == 070707 || tmpbuf.us == swab_short ((unsigned short) 070707)) archive_format = arf_binary; else if (peeked_bytes >= 512 && (check_tar = is_tar_header (tmpbuf.s))) { if (check_tar == 2) archive_format = arf_ustar; else archive_format = arf_tar; } else { tape_buffered_read (tmpbuf.s, in_des, 1L); ++bytes_skipped; } } } if (archive_format == arf_tar || archive_format == arf_ustar) { if (append_flag) last_header_start = input_bytes - io_block_size + (in_buff - input_buffer); if (bytes_skipped > 0) warn_junk_bytes (bytes_skipped); read_in_tar_header (file_hdr, in_des); return; } file_hdr->c_tar_linkname = NULL; tape_buffered_read (magic.str, in_des, sizeof (magic.str)); while (1) { if (append_flag) last_header_start = input_bytes - io_block_size + (in_buff - input_buffer) - 6; if (archive_format == arf_newascii && !strncmp (magic.str, \"070701\", 6)) { if (bytes_skipped > 0) warn_junk_bytes (bytes_skipped); file_hdr->c_magic = 070701; read_in_new_ascii (file_hdr, in_des); break; } if (archive_format == arf_crcascii && !strncmp (magic.str, \"070702\", 6)) { if (bytes_skipped > 0) warn_junk_bytes (bytes_skipped); file_hdr->c_magic = 070702; read_in_new_ascii (file_hdr, in_des); break; } if ( (archive_format == arf_oldascii || archive_format == arf_hpoldascii) && !strncmp (magic.str, \"070707\", 6)) { if (bytes_skipped > 0) warn_junk_bytes (bytes_skipped); file_hdr->c_magic = 070707; read_in_old_ascii (file_hdr, in_des); break; } if ( (archive_format == arf_binary || archive_format == arf_hpbinary) && (magic.num == 070707 || magic.num == swab_short ((unsigned short) 070707))) { /* Having to skip 1 byte because of word alignment is normal. */ if (bytes_skipped > 0) warn_junk_bytes (bytes_skipped); file_hdr->c_magic = 070707; read_in_binary (file_hdr, &magic.old_header, in_des); break; } bytes_skipped++; memmove (magic.str, magic.str + 1, sizeof (magic.str) - 1); tape_buffered_read (magic.str + sizeof (magic.str) - 1, in_des, 1L); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509066, "input": "virtual bool is_subquery_processor(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490169, "input": "int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat) { char *full_alg_name; int rc = -EINVAL; if (!crypt_stat->cipher) { ecryptfs_printk(KERN_ERR, \"No cipher specified\\n\"); goto out; } ecryptfs_printk(KERN_DEBUG, \"Initializing cipher [%s]; strlen = [%d]; \" \"key_size_bits = [%d]\\n\", crypt_stat->cipher, (int)strlen(crypt_stat->cipher), crypt_stat->key_size << 3); if (crypt_stat->tfm) { rc = 0; goto out; } mutex_lock(&crypt_stat->cs_tfm_mutex); rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name, crypt_stat->cipher, \"cbc\"); if (rc) goto out_unlock; crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC); kfree(full_alg_name); if (IS_ERR(crypt_stat->tfm)) { rc = PTR_ERR(crypt_stat->tfm); ecryptfs_printk(KERN_ERR, \"cryptfs: init_crypt_ctx(): \" \"Error initializing cipher [%s]\\n\", crypt_stat->cipher); goto out_unlock; } crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY); rc = 0; out_unlock: mutex_unlock(&crypt_stat->cs_tfm_mutex); out: return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232632, "input": "static bool is_tracing_prog_type(enum bpf_prog_type type) { switch (type) { case BPF_PROG_TYPE_KPROBE: case BPF_PROG_TYPE_TRACEPOINT: case BPF_PROG_TYPE_PERF_EVENT: case BPF_PROG_TYPE_RAW_TRACEPOINT: return true; default: return false; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 438545, "input": "MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info) { ImageInfo *clone_info; clone_info=AcquireImageInfo(); if (image_info == (ImageInfo *) NULL) return(clone_info); clone_info->compression=image_info->compression; clone_info->temporary=image_info->temporary; clone_info->adjoin=image_info->adjoin; clone_info->antialias=image_info->antialias; clone_info->scene=image_info->scene; clone_info->number_scenes=image_info->number_scenes; clone_info->depth=image_info->depth; if (image_info->size != (char *) NULL) (void) CloneString(&clone_info->size,image_info->size); if (image_info->extract != (char *) NULL) (void) CloneString(&clone_info->extract,image_info->extract); if (image_info->scenes != (char *) NULL) (void) CloneString(&clone_info->scenes,image_info->scenes); if (image_info->page != (char *) NULL) (void) CloneString(&clone_info->page,image_info->page); clone_info->interlace=image_info->interlace; clone_info->endian=image_info->endian; clone_info->units=image_info->units; clone_info->quality=image_info->quality; if (image_info->sampling_factor != (char *) NULL) (void) CloneString(&clone_info->sampling_factor, image_info->sampling_factor); if (image_info->server_name != (char *) NULL) (void) CloneString(&clone_info->server_name,image_info->server_name); if (image_info->font != (char *) NULL) (void) CloneString(&clone_info->font,image_info->font); if (image_info->texture != (char *) NULL) (void) CloneString(&clone_info->texture,image_info->texture); if (image_info->density != (char *) NULL) (void) CloneString(&clone_info->density,image_info->density); clone_info->pointsize=image_info->pointsize; clone_info->fuzz=image_info->fuzz; clone_info->pen=image_info->pen; clone_info->background_color=image_info->background_color; clone_info->border_color=image_info->border_color; clone_info->matte_color=image_info->matte_color; clone_info->transparent_color=image_info->transparent_color; clone_info->dither=image_info->dither; clone_info->monochrome=image_info->monochrome; clone_info->colors=image_info->colors; clone_info->colorspace=image_info->colorspace; clone_info->type=image_info->type; clone_info->orientation=image_info->orientation; clone_info->preview_type=image_info->preview_type; clone_info->group=image_info->group; clone_info->ping=image_info->ping; clone_info->verbose=image_info->verbose; if (image_info->view != (char *) NULL) (void) CloneString(&clone_info->view,image_info->view); if (image_info->authenticate != (char *) NULL) (void) CloneString(&clone_info->authenticate,image_info->authenticate); (void) CloneImageOptions(clone_info,image_info); clone_info->progress_monitor=image_info->progress_monitor; clone_info->client_data=image_info->client_data; clone_info->cache=image_info->cache; if (image_info->cache != (void *) NULL) clone_info->cache=ReferencePixelCache(image_info->cache); if (image_info->profile != (void *) NULL) clone_info->profile=(void *) CloneStringInfo((StringInfo *) image_info->profile); SetImageInfoFile(clone_info,image_info->file); SetImageInfoBlob(clone_info,image_info->blob,image_info->length); clone_info->stream=image_info->stream; clone_info->virtual_pixel_method=image_info->virtual_pixel_method; (void) CopyMagickString(clone_info->magick,image_info->magick,MaxTextExtent); (void) CopyMagickString(clone_info->unique,image_info->unique,MaxTextExtent); (void) CopyMagickString(clone_info->zero,image_info->zero,MaxTextExtent); (void) CopyMagickString(clone_info->filename,image_info->filename, MaxTextExtent); clone_info->subimage=image_info->scene; /* deprecated */ clone_info->subrange=image_info->number_scenes; /* deprecated */ clone_info->channel=image_info->channel; clone_info->debug=IsEventLogging(); clone_info->signature=image_info->signature; return(clone_info); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429660, "input": "int STDCALL mysql_next_result(MYSQL *mysql) { /* make sure communication is not blocking */ if (mysql->status != MYSQL_STATUS_READY) { SET_CLIENT_ERROR(mysql, CR_COMMANDS_OUT_OF_SYNC, SQLSTATE_UNKNOWN, 0); return(1); } /* clear error, and mysql status variables */ CLEAR_CLIENT_ERROR(mysql); mysql->affected_rows = (ulonglong) ~0; if (mysql->server_status & SERVER_MORE_RESULTS_EXIST) { return(mysql->methods->db_read_query_result(mysql)); } return(-1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230203, "input": "CallResult PropertyAccessor::create( Runtime *runtime, Handle getter, Handle setter) { void *mem = runtime->alloc(cellSize()); return HermesValue::encodeObjectValue( new (mem) PropertyAccessor(runtime, *getter, *setter)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514749, "input": "bool ram_block_discard_is_disabled(void) { return qatomic_read(&ram_block_discard_disabled_cnt) || qatomic_read(&ram_block_uncoordinated_discard_disabled_cnt); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422583, "input": "TEST(EqOp, ElemMatchKey) { BSONObj operand = BSON(\"a\" << 5); EqualityMatchExpression eq(\"a\", operand[\"a\"]); MatchDetails details; details.requestElemMatchKey(); ASSERT(!eq.matchesBSON(BSON(\"a\" << 4), &details)); ASSERT(!details.hasElemMatchKey()); ASSERT(eq.matchesBSON(BSON(\"a\" << 5), &details)); ASSERT(!details.hasElemMatchKey()); ASSERT(eq.matchesBSON(BSON(\"a\" << BSON_ARRAY(1 << 2 << 5)), &details)); ASSERT(details.hasElemMatchKey()); ASSERT_EQUALS(\"2\", details.elemMatchKey()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378633, "input": "void sqlite3VdbeJumpHere(Vdbe *p, int addr){ sqlite3VdbeChangeP2(p, addr, p->nOp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 251474, "input": "connection_discard_blank_line (chunkqueue * const cq, uint32_t header_len) { /*(separate func only to be able to mark with compiler hint as cold)*/ chunkqueue_mark_written(cq, header_len); return cq->first; /* refresh c after chunkqueue_mark_written() */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402525, "input": "static void hci_req_add_set_adv_filter_enable(struct hci_request *req, bool enable) { struct hci_dev *hdev = req->hdev; switch (hci_get_adv_monitor_offload_ext(hdev)) { case HCI_ADV_MONITOR_EXT_MSFT: msft_req_add_set_filter_enable(req, enable); break; default: return; } /* No need to block when enabling since it's on resume path */ if (hdev->suspended && !enable) set_bit(SUSPEND_SET_ADV_FILTER, hdev->suspend_tasks); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 306328, "input": "static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 *data, /* isoc packet */ int len) /* iso packet length */ { struct sd *sd = (struct sd *) gspca_dev; switch (sd->bridge) { case BRIDGE_OV511: case BRIDGE_OV511PLUS: ov511_pkt_scan(gspca_dev, data, len); break; case BRIDGE_OV518: case BRIDGE_OV518PLUS: ov518_pkt_scan(gspca_dev, data, len); break; case BRIDGE_OV519: ov519_pkt_scan(gspca_dev, data, len); break; case BRIDGE_OVFX2: ovfx2_pkt_scan(gspca_dev, data, len); break; case BRIDGE_W9968CF: w9968cf_pkt_scan(gspca_dev, data, len); break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 231545, "input": "TEST_F(ZNCTest, AwayNotify) { auto znc = Run(); auto ircd = ConnectIRCd(); auto client = ConnectClient(); client.Write(\"CAP LS\"); client.Write(\"PASS :hunter2\"); client.Write(\"NICK nick\"); client.Write(\"USER user/test x x :x\"); QByteArray cap_ls; client.ReadUntilAndGet(\" LS :\", cap_ls); ASSERT_THAT(cap_ls.toStdString(), AllOf(HasSubstr(\"cap-notify\"), Not(HasSubstr(\"away-notify\")))); client.Write(\"CAP REQ :cap-notify\"); client.ReadUntil(\"ACK :cap-notify\"); client.Write(\"CAP END\"); client.ReadUntil(\" 001 \"); ircd.ReadUntil(\"USER\"); ircd.Write(\"CAP user LS :away-notify\"); ircd.ReadUntil(\"CAP REQ :away-notify\"); ircd.Write(\"CAP user ACK :away-notify\"); ircd.ReadUntil(\"CAP END\"); ircd.Write(\":server 001 user :welcome\"); client.ReadUntil(\"CAP user NEW :away-notify\"); client.Write(\"CAP REQ :away-notify\"); client.ReadUntil(\"ACK :away-notify\"); ircd.Write(\":x!y@z AWAY :reason\"); client.ReadUntil(\":x!y@z AWAY :reason\"); ircd.Close(); client.ReadUntil(\"DEL :away-notify\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385622, "input": "template bool Predicate::CalculateValue( uchar code_point) { bool result = T::Is(code_point); entries_[code_point & kMask] = CacheEntry(code_point, result); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431251, "input": "static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res) { int status; status = decode_op_hdr(xdr, OP_LOCKU); if (status != -EIO) nfs_increment_lock_seqid(status, res->seqid); if (status == 0) status = decode_lock_stateid(xdr, &res->stateid); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295139, "input": "long lsqrt (long n) { long result = (long) sqrt ((double) n); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211795, "input": "static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block, opj_event_mgr_t* manager) { OPJ_UINT32(*l_gain_ptr)(OPJ_UINT32) = 00; OPJ_UINT32 compno, resno, bandno, precno, cblkno; opj_tcp_t * l_tcp = 00; opj_cp_t * l_cp = 00; opj_tcd_tile_t * l_tile = 00; opj_tccp_t *l_tccp = 00; opj_tcd_tilecomp_t *l_tilec = 00; opj_image_comp_t * l_image_comp = 00; opj_tcd_resolution_t *l_res = 00; opj_tcd_band_t *l_band = 00; opj_stepsize_t * l_step_size = 00; opj_tcd_precinct_t *l_current_precinct = 00; opj_image_t *l_image = 00; OPJ_UINT32 p, q; OPJ_UINT32 l_level_no; OPJ_UINT32 l_pdx, l_pdy; OPJ_UINT32 l_gain; OPJ_INT32 l_x0b, l_y0b; OPJ_UINT32 l_tx0, l_ty0; /* extent of precincts , top left, bottom right**/ OPJ_INT32 l_tl_prc_x_start, l_tl_prc_y_start, l_br_prc_x_end, l_br_prc_y_end; /* number of precinct for a resolution */ OPJ_UINT32 l_nb_precincts; /* room needed to store l_nb_precinct precinct for a resolution */ OPJ_UINT32 l_nb_precinct_size; /* number of code blocks for a precinct*/ OPJ_UINT32 l_nb_code_blocks; /* room needed to store l_nb_code_blocks code blocks for a precinct*/ OPJ_UINT32 l_nb_code_blocks_size; /* size of data for a tile */ OPJ_UINT32 l_data_size; l_cp = p_tcd->cp; l_tcp = &(l_cp->tcps[p_tile_no]); l_tile = p_tcd->tcd_image->tiles; l_tccp = l_tcp->tccps; l_tilec = l_tile->comps; l_image = p_tcd->image; l_image_comp = p_tcd->image->comps; p = p_tile_no % l_cp->tw; /* tile coordinates */ q = p_tile_no / l_cp->tw; /*fprintf(stderr, \"Tile coordinate = %d,%d\\n\", p, q);*/ /* 4 borders of the tile rescale on the image if necessary */ l_tx0 = l_cp->tx0 + p * l_cp->tdx; /* can't be greater than l_image->x1 so won't overflow */ l_tile->x0 = (OPJ_INT32)opj_uint_max(l_tx0, l_image->x0); l_tile->x1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, l_cp->tdx), l_image->x1); /* all those OPJ_UINT32 are casted to OPJ_INT32, let's do some sanity check */ if ((l_tile->x0 < 0) || (l_tile->x1 <= l_tile->x0)) { opj_event_msg(manager, EVT_ERROR, \"Tile X coordinates are not supported\\n\"); return OPJ_FALSE; } l_ty0 = l_cp->ty0 + q * l_cp->tdy; /* can't be greater than l_image->y1 so won't overflow */ l_tile->y0 = (OPJ_INT32)opj_uint_max(l_ty0, l_image->y0); l_tile->y1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, l_cp->tdy), l_image->y1); /* all those OPJ_UINT32 are casted to OPJ_INT32, let's do some sanity check */ if ((l_tile->y0 < 0) || (l_tile->y1 <= l_tile->y0)) { opj_event_msg(manager, EVT_ERROR, \"Tile Y coordinates are not supported\\n\"); return OPJ_FALSE; } /* testcase 1888.pdf.asan.35.988 */ if (l_tccp->numresolutions == 0) { opj_event_msg(manager, EVT_ERROR, \"tiles require at least one resolution\\n\"); return OPJ_FALSE; } /*fprintf(stderr, \"Tile border = %d,%d,%d,%d\\n\", l_tile->x0, l_tile->y0,l_tile->x1,l_tile->y1);*/ /*tile->numcomps = image->numcomps; */ for (compno = 0; compno < l_tile->numcomps; ++compno) { /*fprintf(stderr, \"compno = %d/%d\\n\", compno, l_tile->numcomps);*/ l_image_comp->resno_decoded = 0; /* border of each l_tile component (global) */ l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_comp->dx); l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_comp->dy); l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_comp->dx); l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_comp->dy); l_tilec->compno = compno; /*fprintf(stderr, \"\\tTile compo border = %d,%d,%d,%d\\n\", l_tilec->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/ l_tilec->numresolutions = l_tccp->numresolutions; if (l_tccp->numresolutions < l_cp->m_specific_param.m_dec.m_reduce) { l_tilec->minimum_num_resolutions = 1; } else { l_tilec->minimum_num_resolutions = l_tccp->numresolutions - l_cp->m_specific_param.m_dec.m_reduce; } if (isEncoder) { OPJ_SIZE_T l_tile_data_size; /* compute l_data_size with overflow check */ OPJ_SIZE_T w = (OPJ_SIZE_T)(l_tilec->x1 - l_tilec->x0); OPJ_SIZE_T h = (OPJ_SIZE_T)(l_tilec->y1 - l_tilec->y0); /* issue 733, l_data_size == 0U, probably something wrong should be checked before getting here */ if (h > 0 && w > SIZE_MAX / h) { opj_event_msg(manager, EVT_ERROR, \"Size of tile data exceeds system limits\\n\"); return OPJ_FALSE; } l_tile_data_size = w * h; if (SIZE_MAX / sizeof(OPJ_UINT32) < l_tile_data_size) { opj_event_msg(manager, EVT_ERROR, \"Size of tile data exceeds system limits\\n\"); return OPJ_FALSE; } l_tile_data_size = l_tile_data_size * sizeof(OPJ_UINT32); l_tilec->data_size_needed = l_tile_data_size; } l_data_size = l_tilec->numresolutions * (OPJ_UINT32)sizeof( opj_tcd_resolution_t); opj_image_data_free(l_tilec->data_win); l_tilec->data_win = NULL; l_tilec->win_x0 = 0; l_tilec->win_y0 = 0; l_tilec->win_x1 = 0; l_tilec->win_y1 = 0; if (l_tilec->resolutions == 00) { l_tilec->resolutions = (opj_tcd_resolution_t *) opj_malloc(l_data_size); if (! l_tilec->resolutions) { return OPJ_FALSE; } /*fprintf(stderr, \"\\tAllocate resolutions of tilec (opj_tcd_resolution_t): %d\\n\",l_data_size);*/ l_tilec->resolutions_size = l_data_size; memset(l_tilec->resolutions, 0, l_data_size); } else if (l_data_size > l_tilec->resolutions_size) { opj_tcd_resolution_t* new_resolutions = (opj_tcd_resolution_t *) opj_realloc( l_tilec->resolutions, l_data_size); if (! new_resolutions) { opj_event_msg(manager, EVT_ERROR, \"Not enough memory for tile resolutions\\n\"); opj_free(l_tilec->resolutions); l_tilec->resolutions = NULL; l_tilec->resolutions_size = 0; return OPJ_FALSE; } l_tilec->resolutions = new_resolutions; /*fprintf(stderr, \"\\tReallocate data of tilec (int): from %d to %d x OPJ_UINT32\\n\", l_tilec->resolutions_size, l_data_size);*/ memset(((OPJ_BYTE*) l_tilec->resolutions) + l_tilec->resolutions_size, 0, l_data_size - l_tilec->resolutions_size); l_tilec->resolutions_size = l_data_size; } l_level_no = l_tilec->numresolutions; l_res = l_tilec->resolutions; l_step_size = l_tccp->stepsizes; if (l_tccp->qmfbid == 0) { l_gain_ptr = &opj_dwt_getgain_real; } else { l_gain_ptr = &opj_dwt_getgain; } /*fprintf(stderr, \"\\tlevel_no=%d\\n\",l_level_no);*/ for (resno = 0; resno < l_tilec->numresolutions; ++resno) { /*fprintf(stderr, \"\\t\\tresno = %d/%d\\n\", resno, l_tilec->numresolutions);*/ OPJ_INT32 tlcbgxstart, tlcbgystart /*, brcbgxend, brcbgyend*/; OPJ_UINT32 cbgwidthexpn, cbgheightexpn; OPJ_UINT32 cblkwidthexpn, cblkheightexpn; --l_level_no; /* border for each resolution level (global) */ l_res->x0 = opj_int_ceildivpow2(l_tilec->x0, (OPJ_INT32)l_level_no); l_res->y0 = opj_int_ceildivpow2(l_tilec->y0, (OPJ_INT32)l_level_no); l_res->x1 = opj_int_ceildivpow2(l_tilec->x1, (OPJ_INT32)l_level_no); l_res->y1 = opj_int_ceildivpow2(l_tilec->y1, (OPJ_INT32)l_level_no); /*fprintf(stderr, \"\\t\\t\\tres_x0= %d, res_y0 =%d, res_x1=%d, res_y1=%d\\n\", l_res->x0, l_res->y0, l_res->x1, l_res->y1);*/ /* p. 35, table A-23, ISO/IEC FDIS154444-1 : 2000 (18 august 2000) */ l_pdx = l_tccp->prcw[resno]; l_pdy = l_tccp->prch[resno]; /*fprintf(stderr, \"\\t\\t\\tpdx=%d, pdy=%d\\n\", l_pdx, l_pdy);*/ /* p. 64, B.6, ISO/IEC FDIS15444-1 : 2000 (18 august 2000) */ l_tl_prc_x_start = opj_int_floordivpow2(l_res->x0, (OPJ_INT32)l_pdx) << l_pdx; l_tl_prc_y_start = opj_int_floordivpow2(l_res->y0, (OPJ_INT32)l_pdy) << l_pdy; l_br_prc_x_end = opj_int_ceildivpow2(l_res->x1, (OPJ_INT32)l_pdx) << l_pdx; l_br_prc_y_end = opj_int_ceildivpow2(l_res->y1, (OPJ_INT32)l_pdy) << l_pdy; /*fprintf(stderr, \"\\t\\t\\tprc_x_start=%d, prc_y_start=%d, br_prc_x_end=%d, br_prc_y_end=%d \\n\", l_tl_prc_x_start, l_tl_prc_y_start, l_br_prc_x_end ,l_br_prc_y_end );*/ l_res->pw = (l_res->x0 == l_res->x1) ? 0U : (OPJ_UINT32)(( l_br_prc_x_end - l_tl_prc_x_start) >> l_pdx); l_res->ph = (l_res->y0 == l_res->y1) ? 0U : (OPJ_UINT32)(( l_br_prc_y_end - l_tl_prc_y_start) >> l_pdy); /*fprintf(stderr, \"\\t\\t\\tres_pw=%d, res_ph=%d\\n\", l_res->pw, l_res->ph );*/ if ((l_res->pw != 0U) && ((((OPJ_UINT32) - 1) / l_res->pw) < l_res->ph)) { opj_event_msg(manager, EVT_ERROR, \"Size of tile data exceeds system limits\\n\"); return OPJ_FALSE; } l_nb_precincts = l_res->pw * l_res->ph; if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof(opj_tcd_precinct_t)) < l_nb_precincts) { opj_event_msg(manager, EVT_ERROR, \"Size of tile data exceeds system limits\\n\"); return OPJ_FALSE; } l_nb_precinct_size = l_nb_precincts * (OPJ_UINT32)sizeof(opj_tcd_precinct_t); if (resno == 0) { tlcbgxstart = l_tl_prc_x_start; tlcbgystart = l_tl_prc_y_start; /*brcbgxend = l_br_prc_x_end;*/ /* brcbgyend = l_br_prc_y_end;*/ cbgwidthexpn = l_pdx; cbgheightexpn = l_pdy; l_res->numbands = 1; } else { tlcbgxstart = opj_int_ceildivpow2(l_tl_prc_x_start, 1); tlcbgystart = opj_int_ceildivpow2(l_tl_prc_y_start, 1); /*brcbgxend = opj_int_ceildivpow2(l_br_prc_x_end, 1);*/ /*brcbgyend = opj_int_ceildivpow2(l_br_prc_y_end, 1);*/ cbgwidthexpn = l_pdx - 1; cbgheightexpn = l_pdy - 1; l_res->numbands = 3; } cblkwidthexpn = opj_uint_min(l_tccp->cblkw, cbgwidthexpn); cblkheightexpn = opj_uint_min(l_tccp->cblkh, cbgheightexpn); l_band = l_res->bands; for (bandno = 0; bandno < l_res->numbands; ++bandno, ++l_band, ++l_step_size) { OPJ_INT32 numbps; /*fprintf(stderr, \"\\t\\t\\tband_no=%d/%d\\n\", bandno, l_res->numbands );*/ if (resno == 0) { l_band->bandno = 0 ; l_band->x0 = opj_int_ceildivpow2(l_tilec->x0, (OPJ_INT32)l_level_no); l_band->y0 = opj_int_ceildivpow2(l_tilec->y0, (OPJ_INT32)l_level_no); l_band->x1 = opj_int_ceildivpow2(l_tilec->x1, (OPJ_INT32)l_level_no); l_band->y1 = opj_int_ceildivpow2(l_tilec->y1, (OPJ_INT32)l_level_no); } else { l_band->bandno = bandno + 1; /* x0b = 1 if bandno = 1 or 3 */ l_x0b = l_band->bandno & 1; /* y0b = 1 if bandno = 2 or 3 */ l_y0b = (OPJ_INT32)((l_band->bandno) >> 1); /* l_band border (global) */ l_band->x0 = opj_int64_ceildivpow2(l_tilec->x0 - ((OPJ_INT64)l_x0b << l_level_no), (OPJ_INT32)(l_level_no + 1)); l_band->y0 = opj_int64_ceildivpow2(l_tilec->y0 - ((OPJ_INT64)l_y0b << l_level_no), (OPJ_INT32)(l_level_no + 1)); l_band->x1 = opj_int64_ceildivpow2(l_tilec->x1 - ((OPJ_INT64)l_x0b << l_level_no), (OPJ_INT32)(l_level_no + 1)); l_band->y1 = opj_int64_ceildivpow2(l_tilec->y1 - ((OPJ_INT64)l_y0b << l_level_no), (OPJ_INT32)(l_level_no + 1)); } if (isEncoder) { /* Skip empty bands */ if (opj_tcd_is_band_empty(l_band)) { /* Do not zero l_band->precints to avoid leaks */ /* but make sure we don't use it later, since */ /* it will point to precincts of previous bands... */ continue; } } /** avoid an if with storing function pointer */ l_gain = (*l_gain_ptr)(l_band->bandno); numbps = (OPJ_INT32)(l_image_comp->prec + l_gain); l_band->stepsize = (OPJ_FLOAT32)(((1.0 + l_step_size->mant / 2048.0) * pow(2.0, (OPJ_INT32)(numbps - l_step_size->expn)))) * fraction; /* Mb value of Equation E-2 in \"E.1 Inverse quantization * procedure\" of the standard */ l_band->numbps = l_step_size->expn + (OPJ_INT32)l_tccp->numgbits - 1; if (!l_band->precincts && (l_nb_precincts > 0U)) { l_band->precincts = (opj_tcd_precinct_t *) opj_malloc(/*3 * */ l_nb_precinct_size); if (! l_band->precincts) { opj_event_msg(manager, EVT_ERROR, \"Not enough memory to handle band precints\\n\"); return OPJ_FALSE; } /*fprintf(stderr, \"\\t\\t\\t\\tAllocate precincts of a band (opj_tcd_precinct_t): %d\\n\",l_nb_precinct_size); */ memset(l_band->precincts, 0, l_nb_precinct_size); l_band->precincts_data_size = l_nb_precinct_size; } else if (l_band->precincts_data_size < l_nb_precinct_size) { opj_tcd_precinct_t * new_precincts = (opj_tcd_precinct_t *) opj_realloc( l_band->precincts,/*3 * */ l_nb_precinct_size); if (! new_precincts) { opj_event_msg(manager, EVT_ERROR, \"Not enough memory to handle band precints\\n\"); opj_free(l_band->precincts); l_band->precincts = NULL; l_band->precincts_data_size = 0; return OPJ_FALSE; } l_band->precincts = new_precincts; /*fprintf(stderr, \"\\t\\t\\t\\tReallocate precincts of a band (opj_tcd_precinct_t): from %d to %d\\n\",l_band->precincts_data_size, l_nb_precinct_size);*/ memset(((OPJ_BYTE *) l_band->precincts) + l_band->precincts_data_size, 0, l_nb_precinct_size - l_band->precincts_data_size); l_band->precincts_data_size = l_nb_precinct_size; } l_current_precinct = l_band->precincts; for (precno = 0; precno < l_nb_precincts; ++precno) { OPJ_INT32 tlcblkxstart, tlcblkystart, brcblkxend, brcblkyend; OPJ_INT32 cbgxstart = tlcbgxstart + (OPJ_INT32)(precno % l_res->pw) * (1 << cbgwidthexpn); OPJ_INT32 cbgystart = tlcbgystart + (OPJ_INT32)(precno / l_res->pw) * (1 << cbgheightexpn); OPJ_INT32 cbgxend = cbgxstart + (1 << cbgwidthexpn); OPJ_INT32 cbgyend = cbgystart + (1 << cbgheightexpn); /*fprintf(stderr, \"\\t precno=%d; bandno=%d, resno=%d; compno=%d\\n\", precno, bandno , resno, compno);*/ /*fprintf(stderr, \"\\t tlcbgxstart(=%d) + (precno(=%d) percent res->pw(=%d)) * (1 << cbgwidthexpn(=%d)) \\n\",tlcbgxstart,precno,l_res->pw,cbgwidthexpn);*/ /* precinct size (global) */ /*fprintf(stderr, \"\\t cbgxstart=%d, l_band->x0 = %d \\n\",cbgxstart, l_band->x0);*/ l_current_precinct->x0 = opj_int_max(cbgxstart, l_band->x0); l_current_precinct->y0 = opj_int_max(cbgystart, l_band->y0); l_current_precinct->x1 = opj_int_min(cbgxend, l_band->x1); l_current_precinct->y1 = opj_int_min(cbgyend, l_band->y1); /*fprintf(stderr, \"\\t prc_x0=%d; prc_y0=%d, prc_x1=%d; prc_y1=%d\\n\",l_current_precinct->x0, l_current_precinct->y0 ,l_current_precinct->x1, l_current_precinct->y1);*/ tlcblkxstart = opj_int_floordivpow2(l_current_precinct->x0, (OPJ_INT32)cblkwidthexpn) << cblkwidthexpn; /*fprintf(stderr, \"\\t tlcblkxstart =%d\\n\",tlcblkxstart );*/ tlcblkystart = opj_int_floordivpow2(l_current_precinct->y0, (OPJ_INT32)cblkheightexpn) << cblkheightexpn; /*fprintf(stderr, \"\\t tlcblkystart =%d\\n\",tlcblkystart );*/ brcblkxend = opj_int_ceildivpow2(l_current_precinct->x1, (OPJ_INT32)cblkwidthexpn) << cblkwidthexpn; /*fprintf(stderr, \"\\t brcblkxend =%d\\n\",brcblkxend );*/ brcblkyend = opj_int_ceildivpow2(l_current_precinct->y1, (OPJ_INT32)cblkheightexpn) << cblkheightexpn; /*fprintf(stderr, \"\\t brcblkyend =%d\\n\",brcblkyend );*/ l_current_precinct->cw = (OPJ_UINT32)((brcblkxend - tlcblkxstart) >> cblkwidthexpn); l_current_precinct->ch = (OPJ_UINT32)((brcblkyend - tlcblkystart) >> cblkheightexpn); l_nb_code_blocks = l_current_precinct->cw * l_current_precinct->ch; /*fprintf(stderr, \"\\t\\t\\t\\t precinct_cw = %d x recinct_ch = %d\\n\",l_current_precinct->cw, l_current_precinct->ch); */ if ((((OPJ_UINT32) - 1) / (OPJ_UINT32)sizeof_block) < l_nb_code_blocks) { opj_event_msg(manager, EVT_ERROR, \"Size of code block data exceeds system limits\\n\"); return OPJ_FALSE; } l_nb_code_blocks_size = l_nb_code_blocks * (OPJ_UINT32)sizeof_block; if (!l_current_precinct->cblks.blocks && (l_nb_code_blocks > 0U)) { l_current_precinct->cblks.blocks = opj_malloc(l_nb_code_blocks_size); if (! l_current_precinct->cblks.blocks) { return OPJ_FALSE; } /*fprintf(stderr, \"\\t\\t\\t\\tAllocate cblks of a precinct (opj_tcd_cblk_dec_t): %d\\n\",l_nb_code_blocks_size);*/ memset(l_current_precinct->cblks.blocks, 0, l_nb_code_blocks_size); l_current_precinct->block_size = l_nb_code_blocks_size; } else if (l_nb_code_blocks_size > l_current_precinct->block_size) { void *new_blocks = opj_realloc(l_current_precinct->cblks.blocks, l_nb_code_blocks_size); if (! new_blocks) { opj_free(l_current_precinct->cblks.blocks); l_current_precinct->cblks.blocks = NULL; l_current_precinct->block_size = 0; opj_event_msg(manager, EVT_ERROR, \"Not enough memory for current precinct codeblock element\\n\"); return OPJ_FALSE; } l_current_precinct->cblks.blocks = new_blocks; /*fprintf(stderr, \"\\t\\t\\t\\tReallocate cblks of a precinct (opj_tcd_cblk_dec_t): from %d to %d\\n\",l_current_precinct->block_size, l_nb_code_blocks_size); */ memset(((OPJ_BYTE *) l_current_precinct->cblks.blocks) + l_current_precinct->block_size , 0 , l_nb_code_blocks_size - l_current_precinct->block_size); l_current_precinct->block_size = l_nb_code_blocks_size; } if (! l_current_precinct->incltree) { l_current_precinct->incltree = opj_tgt_create(l_current_precinct->cw, l_current_precinct->ch, manager); } else { l_current_precinct->incltree = opj_tgt_init(l_current_precinct->incltree, l_current_precinct->cw, l_current_precinct->ch, manager); } if (! l_current_precinct->imsbtree) { l_current_precinct->imsbtree = opj_tgt_create(l_current_precinct->cw, l_current_precinct->ch, manager); } else { l_current_precinct->imsbtree = opj_tgt_init(l_current_precinct->imsbtree, l_current_precinct->cw, l_current_precinct->ch, manager); } for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) { OPJ_INT32 cblkxstart = tlcblkxstart + (OPJ_INT32)(cblkno % l_current_precinct->cw) * (1 << cblkwidthexpn); OPJ_INT32 cblkystart = tlcblkystart + (OPJ_INT32)(cblkno / l_current_precinct->cw) * (1 << cblkheightexpn); OPJ_INT32 cblkxend = cblkxstart + (1 << cblkwidthexpn); OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn); if (isEncoder) { opj_tcd_cblk_enc_t* l_code_block = l_current_precinct->cblks.enc + cblkno; if (! opj_tcd_code_block_enc_allocate(l_code_block)) { return OPJ_FALSE; } /* code-block size (global) */ l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0); l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0); l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1); l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1); if (! opj_tcd_code_block_enc_allocate_data(l_code_block)) { return OPJ_FALSE; } } else { opj_tcd_cblk_dec_t* l_code_block = l_current_precinct->cblks.dec + cblkno; if (! opj_tcd_code_block_dec_allocate(l_code_block)) { return OPJ_FALSE; } /* code-block size (global) */ l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0); l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0); l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1); l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1); } } ++l_current_precinct; } /* precno */ } /* bandno */ ++l_res; } /* resno */ ++l_tccp; ++l_tilec; ++l_image_comp; } /* compno */ return OPJ_TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "opj_t1_clbl_decode_processor in openjp2/t1.c in OpenJPEG 2.3.1 through 2020-01-28 has a heap-based buffer overflow in the qmfbid==1 case, a different issue than CVE-2020-6851.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-8112"}} -{"idx": 417832, "input": "static void SFDParseLookup(FILE *sfd,OTLookup *otl) { int ch; struct lookup_subtable *sub, *lastsub; FeatureScriptLangList *fl, *lastfl; struct scriptlanglist *sl, *lastsl; int i, lcnt, lmax=0; uint32 *langs=NULL; char *subname; while ( (ch=nlgetc(sfd))==' ' ); if ( ch=='{' ) { lastsub = NULL; while ( (subname = SFDReadUTF7Str(sfd))!=NULL ) { while ( (ch=nlgetc(sfd))==' ' ); ungetc(ch,sfd); sub = chunkalloc(sizeof(struct lookup_subtable)); sub->subtable_name = subname; sub->lookup = otl; switch ( otl->lookup_type ) { case gsub_single: while ( (ch=nlgetc(sfd))==' ' ); if ( ch=='(' ) { sub->suffix = SFDReadUTF7Str(sfd); while ( (ch=nlgetc(sfd))==' ' ); /* slurp final paren */ } else ungetc(ch,sfd); sub->per_glyph_pst_or_kern = true; break; case gsub_multiple: case gsub_alternate: case gsub_ligature: case gpos_single: sub->per_glyph_pst_or_kern = true; break; case gpos_pair: if ( (ch=nlgetc(sfd))=='(' ) { ch = nlgetc(sfd); sub->vertical_kerning = (ch=='1'); nlgetc(sfd); /* slurp final paren */ ch=nlgetc(sfd); } if ( ch=='[' ) { getsint(sfd,&sub->separation); nlgetc(sfd); /* slurp comma */ getsint(sfd,&sub->minkern); nlgetc(sfd); /* slurp comma */ ch = nlgetc(sfd); sub->kerning_by_touch = ((ch-'0')&1)?1:0; sub->onlyCloser = ((ch-'0')&2)?1:0; sub->dontautokern = ((ch-'0')&4)?1:0; nlgetc(sfd); /* slurp final bracket */ } else { ungetc(ch,sfd); } sub->per_glyph_pst_or_kern = true; break; case gpos_cursive: case gpos_mark2base: case gpos_mark2ligature: case gpos_mark2mark: sub->anchor_classes = true; break; default: break; } if ( lastsub==NULL ) otl->subtables = sub; else lastsub->next = sub; lastsub = sub; } while ( (ch=nlgetc(sfd))==' ' ); if ( ch=='}' ) ch = nlgetc(sfd); } while ( ch==' ' ) ch = nlgetc(sfd); if ( ch=='[' ) { lastfl = NULL; for (;;) { while ( (ch=nlgetc(sfd))==' ' ); if ( ch==']' ) break; fl = chunkalloc(sizeof(FeatureScriptLangList)); if ( lastfl==NULL ) otl->features = fl; else lastfl->next = fl; lastfl = fl; if ( ch=='<' ) { int ft=0,fs=0; fscanf(sfd,\"%d,%d>\", &ft, &fs ); fl->ismac = true; fl->featuretag = (ft<<16) | fs; } else if ( ch=='\\'' ) { ungetc(ch,sfd); fl->featuretag = gettag(sfd); } while ( (ch=nlgetc(sfd))==' ' ); if ( ch=='(' ) { lastsl = NULL; for (;;) { while ( (ch=nlgetc(sfd))==' ' ); if ( ch==')' ) break; sl = chunkalloc(sizeof(struct scriptlanglist)); if ( lastsl==NULL ) fl->scripts = sl; else lastsl->next = sl; lastsl = sl; if ( ch=='\\'' ) { ungetc(ch,sfd); sl->script = gettag(sfd); } while ( (ch=nlgetc(sfd))==' ' ); if ( ch=='<' ) { lcnt = 0; for (;;) { while ( (ch=nlgetc(sfd))==' ' ); if ( ch=='>' ) break; if ( ch=='\\'' ) { ungetc(ch,sfd); if ( lcnt>=lmax ) langs = realloc(langs,(lmax+=10)*sizeof(uint32)); langs[lcnt++] = gettag(sfd); } } sl->lang_cnt = lcnt; if ( lcnt>MAX_LANG ) sl->morelangs = malloc((lcnt-MAX_LANG)*sizeof(uint32)); for ( i=0; ilangs[i] = langs[i]; else sl->morelangs[i-MAX_LANG] = langs[i]; } } } } } } free(langs); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 481112, "input": "static unsigned int xdr_buf_pages_fill_sparse(const struct xdr_buf *buf, unsigned int buflen, gfp_t gfp) { unsigned int i, npages, pagelen; if (!(buf->flags & XDRBUF_SPARSE_PAGES)) return buflen; if (buflen <= buf->head->iov_len) return buflen; pagelen = buflen - buf->head->iov_len; if (pagelen > buf->page_len) pagelen = buf->page_len; npages = (pagelen + buf->page_base + PAGE_SIZE - 1) >> PAGE_SHIFT; for (i = 0; i < npages; i++) { if (!buf->pages[i]) continue; buf->pages[i] = alloc_page(gfp); if (likely(buf->pages[i])) continue; buflen -= pagelen; pagelen = i << PAGE_SHIFT; if (pagelen > buf->page_base) buflen += pagelen - buf->page_base; break; } return buflen; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 311105, "input": "DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp) { int pw, nc, retval=0; if(width<1 || subsamp<0 || subsamp>=TJ_NUMSAMP) _throw(\"tjPlaneWidth(): Invalid argument\"); nc=(subsamp==TJSAMP_GRAY? 1:3); if(componentID<0 || componentID>=nc) _throw(\"tjPlaneWidth(): Invalid argument\"); pw=PAD(width, tjMCUWidth[subsamp]/8); if(componentID==0) retval=pw; else retval=pw*8/tjMCUWidth[subsamp]; bailout: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431965, "input": "static void hci_cc_le_del_from_resolv_list(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_cp_le_del_from_resolv_list *sent; __u8 status = *((__u8 *) skb->data); BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); if (status) return; sent = hci_sent_cmd_data(hdev, HCI_OP_LE_DEL_FROM_RESOLV_LIST); if (!sent) return; hci_bdaddr_list_del_with_irk(&hdev->le_resolv_list, &sent->bdaddr, sent->bdaddr_type); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219459, "input": "inline StringData* StringData::Make(char* data, AttachStringMode) { SCOPE_EXIT { free(data); }; return Make(data, CopyString); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 474543, "input": "dyn_destroy_function(struct CRYPTO_dynlock_value *l, const char *file, int line) { MUTEX_FREE(l->mutex); free(l); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263365, "input": "void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow) { u_int32_t a; struct ndpi_packet_struct *packet = &flow->packet; if((packet->payload_packet_len < 3) || (packet->payload == NULL)) return; if(packet->packet_lines_parsed_complete != 0) return; packet->packet_lines_parsed_complete = 1; ndpi_reset_packet_line_info(packet); packet->line[packet->parsed_lines].ptr = packet->payload; packet->line[packet->parsed_lines].len = 0; for (a = 0; ((a+1) < packet->payload_packet_len) && (packet->parsed_lines < NDPI_MAX_PARSE_LINES_PER_PACKET); a++) { if((packet->payload[a] == 0x0d) && (packet->payload[a+1] == 0x0a)) { /* If end of line char sequence CR+NL \"\\r\\n\", process line */ if(((a + 3) < packet->payload_packet_len) && (packet->payload[a+2] == 0x0d) && (packet->payload[a+3] == 0x0a)) { /* \\r\\n\\r\\n */ int diff; /* No unsigned ! */ u_int32_t a1 = a + 4; diff = packet->payload_packet_len - a1; if(diff > 0) { diff = ndpi_min(diff, sizeof(flow->initial_binary_bytes)); memcpy(&flow->initial_binary_bytes, &packet->payload[a1], diff); flow->initial_binary_bytes_len = diff; } } packet->line[packet->parsed_lines].len = (u_int16_t)(((unsigned long) &packet->payload[a]) - ((unsigned long) packet->line[packet->parsed_lines].ptr)); /* First line of a HTTP response parsing. Expected a \"HTTP/1.? ???\" */ if(packet->parsed_lines == 0 && packet->line[0].len >= NDPI_STATICSTRING_LEN(\"HTTP/1.X 200 \") && strncasecmp((const char *) packet->line[0].ptr, \"HTTP/1.\", NDPI_STATICSTRING_LEN(\"HTTP/1.\")) == 0 && packet->line[0].ptr[NDPI_STATICSTRING_LEN(\"HTTP/1.X \")] > '0' && /* response code between 000 and 699 */ packet->line[0].ptr[NDPI_STATICSTRING_LEN(\"HTTP/1.X \")] < '6') { packet->http_response.ptr = &packet->line[0].ptr[NDPI_STATICSTRING_LEN(\"HTTP/1.1 \")]; packet->http_response.len = packet->line[0].len - NDPI_STATICSTRING_LEN(\"HTTP/1.1 \"); packet->http_num_headers++; /* Set server HTTP response code */ if(packet->payload_packet_len >= 12) { char buf[4]; /* Set server HTTP response code */ strncpy(buf, (char *) &packet->payload[9], 3); buf[3] = '\\0'; flow->http.response_status_code = atoi(buf); /* https://en.wikipedia.org/wiki/List_of_HTTP_status_codes */ if((flow->http.response_status_code < 100) || (flow->http.response_status_code > 509)) flow->http.response_status_code = 0; /* Out of range */ } } /* \"Server:\" header line in HTTP response */ if(packet->line[packet->parsed_lines].len > NDPI_STATICSTRING_LEN(\"Server:\") + 1 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Server:\", NDPI_STATICSTRING_LEN(\"Server:\")) == 0) { // some stupid clients omit a space and place the servername directly after the colon if(packet->line[packet->parsed_lines].ptr[NDPI_STATICSTRING_LEN(\"Server:\")] == ' ') { packet->server_line.ptr = &packet->line[packet->parsed_lines].ptr[NDPI_STATICSTRING_LEN(\"Server:\") + 1]; packet->server_line.len = packet->line[packet->parsed_lines].len - (NDPI_STATICSTRING_LEN(\"Server:\") + 1); } else { packet->server_line.ptr = &packet->line[packet->parsed_lines].ptr[NDPI_STATICSTRING_LEN(\"Server:\")]; packet->server_line.len = packet->line[packet->parsed_lines].len - NDPI_STATICSTRING_LEN(\"Server:\"); } packet->http_num_headers++; } /* \"Host:\" header line in HTTP request */ if(packet->line[packet->parsed_lines].len > 6 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Host:\", 5) == 0) { // some stupid clients omit a space and place the hostname directly after the colon if(packet->line[packet->parsed_lines].ptr[5] == ' ') { packet->host_line.ptr = &packet->line[packet->parsed_lines].ptr[6]; packet->host_line.len = packet->line[packet->parsed_lines].len - 6; } else { packet->host_line.ptr = &packet->line[packet->parsed_lines].ptr[5]; packet->host_line.len = packet->line[packet->parsed_lines].len - 5; } packet->http_num_headers++; } /* \"X-Forwarded-For:\" header line in HTTP request. Commonly used for HTTP proxies. */ if(packet->line[packet->parsed_lines].len > 17 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"X-Forwarded-For:\", 16) == 0) { // some stupid clients omit a space and place the hostname directly after the colon if(packet->line[packet->parsed_lines].ptr[16] == ' ') { packet->forwarded_line.ptr = &packet->line[packet->parsed_lines].ptr[17]; packet->forwarded_line.len = packet->line[packet->parsed_lines].len - 17; } else { packet->forwarded_line.ptr = &packet->line[packet->parsed_lines].ptr[16]; packet->forwarded_line.len = packet->line[packet->parsed_lines].len - 16; } packet->http_num_headers++; } /* \"Content-Type:\" header line in HTTP. */ if(packet->line[packet->parsed_lines].len > 14 && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Content-Type: \", 14) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Content-type: \", 14) == 0)) { packet->content_line.ptr = &packet->line[packet->parsed_lines].ptr[14]; packet->content_line.len = packet->line[packet->parsed_lines].len - 14; while ((packet->content_line.len > 0) && (packet->content_line.ptr[0] == ' ')) packet->content_line.len--, packet->content_line.ptr++; packet->http_num_headers++; } /* \"Content-Type:\" header line in HTTP AGAIN. Probably a bogus response without space after \":\" */ if((packet->content_line.len == 0) && (packet->line[packet->parsed_lines].len > 13) && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Content-type:\", 13) == 0)) { packet->content_line.ptr = &packet->line[packet->parsed_lines].ptr[13]; packet->content_line.len = packet->line[packet->parsed_lines].len - 13; packet->http_num_headers++; } if(packet->content_line.len > 0) { /* application/json; charset=utf-8 */ char separator[] = {';', '\\r', '\\0'}; int i; for (i = 0; separator[i] != '\\0'; i++) { char *c = memchr((char *) packet->content_line.ptr, separator[i], packet->content_line.len); if(c != NULL) packet->content_line.len = c - (char *) packet->content_line.ptr; } } /* \"Accept:\" header line in HTTP request. */ if(packet->line[packet->parsed_lines].len > 8 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Accept: \", 8) == 0) { packet->accept_line.ptr = &packet->line[packet->parsed_lines].ptr[8]; packet->accept_line.len = packet->line[packet->parsed_lines].len - 8; packet->http_num_headers++; } /* \"Referer:\" header line in HTTP request. */ if(packet->line[packet->parsed_lines].len > 9 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Referer: \", 9) == 0) { packet->referer_line.ptr = &packet->line[packet->parsed_lines].ptr[9]; packet->referer_line.len = packet->line[packet->parsed_lines].len - 9; packet->http_num_headers++; } /* \"User-Agent:\" header line in HTTP request. */ if(packet->line[packet->parsed_lines].len > 12 && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"User-Agent: \", 12) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"User-agent: \", 12) == 0)) { packet->user_agent_line.ptr = &packet->line[packet->parsed_lines].ptr[12]; packet->user_agent_line.len = packet->line[packet->parsed_lines].len - 12; packet->http_num_headers++; } /* \"Content-Encoding:\" header line in HTTP response (and request?). */ if(packet->line[packet->parsed_lines].len > 18 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Content-Encoding: \", 18) == 0) { packet->http_encoding.ptr = &packet->line[packet->parsed_lines].ptr[18]; packet->http_encoding.len = packet->line[packet->parsed_lines].len - 18; packet->http_num_headers++; } /* \"Transfer-Encoding:\" header line in HTTP. */ if(packet->line[packet->parsed_lines].len > 19 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Transfer-Encoding: \", 19) == 0) { packet->http_transfer_encoding.ptr = &packet->line[packet->parsed_lines].ptr[19]; packet->http_transfer_encoding.len = packet->line[packet->parsed_lines].len - 19; packet->http_num_headers++; } /* \"Content-Length:\" header line in HTTP. */ if(packet->line[packet->parsed_lines].len > 16 && ((strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Content-Length: \", 16) == 0) || (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"content-length: \", 16) == 0))) { packet->http_contentlen.ptr = &packet->line[packet->parsed_lines].ptr[16]; packet->http_contentlen.len = packet->line[packet->parsed_lines].len - 16; packet->http_num_headers++; } /* \"Content-Disposition\"*/ if(packet->line[packet->parsed_lines].len > 21 && ((strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Content-Disposition: \", 21) == 0))) { packet->content_disposition_line.ptr = &packet->line[packet->parsed_lines].ptr[21]; packet->content_disposition_line.len = packet->line[packet->parsed_lines].len - 21; packet->http_num_headers++; } /* \"Cookie:\" header line in HTTP. */ if(packet->line[packet->parsed_lines].len > 8 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Cookie: \", 8) == 0) { packet->http_cookie.ptr = &packet->line[packet->parsed_lines].ptr[8]; packet->http_cookie.len = packet->line[packet->parsed_lines].len - 8; packet->http_num_headers++; } /* \"Origin:\" header line in HTTP. */ if(packet->line[packet->parsed_lines].len > 8 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Origin: \", 8) == 0) { packet->http_origin.ptr = &packet->line[packet->parsed_lines].ptr[8]; packet->http_origin.len = packet->line[packet->parsed_lines].len - 8; packet->http_num_headers++; } /* \"X-Session-Type:\" header line in HTTP. */ if(packet->line[packet->parsed_lines].len > 16 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"X-Session-Type: \", 16) == 0) { packet->http_x_session_type.ptr = &packet->line[packet->parsed_lines].ptr[16]; packet->http_x_session_type.len = packet->line[packet->parsed_lines].len - 16; packet->http_num_headers++; } /* Identification and counting of other HTTP headers. * We consider the most common headers, but there are many others, * which can be seen at references below: * - https://tools.ietf.org/html/rfc7230 * - https://en.wikipedia.org/wiki/List_of_HTTP_header_fields */ if((packet->line[packet->parsed_lines].len > 6 && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Date: \", 6) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Vary: \", 6) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"ETag: \", 6) == 0)) || (packet->line[packet->parsed_lines].len > 8 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Pragma: \", 8) == 0) || (packet->line[packet->parsed_lines].len > 9 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Expires: \", 9) == 0) || (packet->line[packet->parsed_lines].len > 12 && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Set-Cookie: \", 12) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Keep-Alive: \", 12) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Connection: \", 12) == 0)) || (packet->line[packet->parsed_lines].len > 15 && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Last-Modified: \", 15) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Accept-Ranges: \", 15) == 0)) || (packet->line[packet->parsed_lines].len > 17 && (strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Accept-Language: \", 17) == 0 || strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Accept-Encoding: \", 17) == 0)) || (packet->line[packet->parsed_lines].len > 27 && strncasecmp((const char *) packet->line[packet->parsed_lines].ptr, \"Upgrade-Insecure-Requests: \", 27) == 0)) { /* Just count. In the future, if needed, this if can be splited to parse these headers */ packet->http_num_headers++; } if(packet->line[packet->parsed_lines].len == 0) { packet->empty_line_position = a; packet->empty_line_position_set = 1; } if(packet->parsed_lines >= (NDPI_MAX_PARSE_LINES_PER_PACKET - 1)) return; packet->parsed_lines++; packet->line[packet->parsed_lines].ptr = &packet->payload[a + 2]; packet->line[packet->parsed_lines].len = 0; a++; /* next char in the payload */ } } if(packet->parsed_lines >= 1) { packet->line[packet->parsed_lines].len = (u_int16_t)(((unsigned long) &packet->payload[packet->payload_packet_len]) - ((unsigned long) packet->line[packet->parsed_lines].ptr)); packet->parsed_lines++; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508427, "input": "bool skip_setup_conds(THD *thd) { return (!thd->stmt_arena->is_conventional() && !thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) || thd->lex->is_view_context_analysis(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214120, "input": "static void inline ConvertXYZToJzazbz(const double X,const double Y, const double Z,const double white_luminance,double *Jz,double *az,double *bz) { #define Jzazbz_b 1.15 /* https://observablehq.com/@jrus/jzazbz */ #define Jzazbz_g 0.66 #define Jzazbz_c1 (3424.0/4096.0) #define Jzazbz_c2 (2413.0/128.0) #define Jzazbz_c3 (2392.0/128.0) #define Jzazbz_n (2610.0/16384.0) #define Jzazbz_p (1.7*2523.0/32.0) #define Jzazbz_d (-0.56) #define Jzazbz_d0 (1.6295499532821566e-11) double gamma, Iz, L, Lp, M, Mp, S, Sp, Xp, Yp, Zp; Xp=(Jzazbz_b*X-Z*(Jzazbz_b-1)); Yp=(Jzazbz_g*Y-X*(Jzazbz_g-1)); Zp=Z; L=0.41478972*Xp+0.579999*Yp+0.0146480*Zp; M=(-0.2015100)*Xp+1.120649*Yp+0.0531008*Zp; S=(-0.0166008)*Xp+0.264800*Yp+0.6684799*Zp; gamma=pow(L/white_luminance,Jzazbz_n); Lp=pow((Jzazbz_c1+Jzazbz_c2*gamma)/(1.0+Jzazbz_c3*gamma),Jzazbz_p); gamma=pow(M/white_luminance,Jzazbz_n); Mp=pow((Jzazbz_c1+Jzazbz_c2*gamma)/(1.0+Jzazbz_c3*gamma),Jzazbz_p); gamma=pow(S/white_luminance,Jzazbz_n); Sp=pow((Jzazbz_c1+Jzazbz_c2*gamma)/(1.0+Jzazbz_c3*gamma),Jzazbz_p); Iz=0.5*Lp+0.5*Mp; *az=3.52400*Lp-4.066708*Mp+0.542708*Sp+0.5; *bz=0.199076*Lp+1.096799*Mp-1.295875*Sp+0.5; *Jz=((Jzazbz_d+1.0)*Iz)/(Jzazbz_d*Iz+1.0)-Jzazbz_d0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "A flaw was found in ImageMagick in versions before 7.0.11, where a division by zero ConvertXYZToJzazbz() of MagickCore/colorspace.c may trigger undefined behavior via a crafted image file that is submitted by an attacker and processed by an application using ImageMagick. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-20310"}} -{"idx": 268993, "input": "static char *strchr_skip_color_codes(const char *s, int c) { int i = 0; for (i = 0; s[i]; i++) { while (s[i] && s[i] == 0x1b) { while (s[i] && s[i] != 'm') { i++; } if (s[i]) { i++; } } if (!s[i] || s[i] == (char)c) { return (char*)s + i; } } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212155, "input": "void stralgoLCS(client *c) { uint32_t i, j; long long minmatchlen = 0; sds a = NULL, b = NULL; int getlen = 0, getidx = 0, withmatchlen = 0; robj *obja = NULL, *objb = NULL; for (j = 2; j < (uint32_t)c->argc; j++) { char *opt = c->argv[j]->ptr; int moreargs = (c->argc-1) - j; if (!strcasecmp(opt,\"IDX\")) { getidx = 1; } else if (!strcasecmp(opt,\"LEN\")) { getlen = 1; } else if (!strcasecmp(opt,\"WITHMATCHLEN\")) { withmatchlen = 1; } else if (!strcasecmp(opt,\"MINMATCHLEN\") && moreargs) { if (getLongLongFromObjectOrReply(c,c->argv[j+1],&minmatchlen,NULL) != C_OK) goto cleanup; if (minmatchlen < 0) minmatchlen = 0; j++; } else if (!strcasecmp(opt,\"STRINGS\") && moreargs > 1) { if (a != NULL) { addReplyError(c,\"Either use STRINGS or KEYS\"); goto cleanup; } a = c->argv[j+1]->ptr; b = c->argv[j+2]->ptr; j += 2; } else if (!strcasecmp(opt,\"KEYS\") && moreargs > 1) { if (a != NULL) { addReplyError(c,\"Either use STRINGS or KEYS\"); goto cleanup; } obja = lookupKeyRead(c->db,c->argv[j+1]); objb = lookupKeyRead(c->db,c->argv[j+2]); if ((obja && obja->type != OBJ_STRING) || (objb && objb->type != OBJ_STRING)) { addReplyError(c, \"The specified keys must contain string values\"); /* Don't cleanup the objects, we need to do that * only after calling getDecodedObject(). */ obja = NULL; objb = NULL; goto cleanup; } obja = obja ? getDecodedObject(obja) : createStringObject(\"\",0); objb = objb ? getDecodedObject(objb) : createStringObject(\"\",0); a = obja->ptr; b = objb->ptr; j += 2; } else { addReplyErrorObject(c,shared.syntaxerr); goto cleanup; } } /* Complain if the user passed ambiguous parameters. */ if (a == NULL) { addReplyError(c,\"Please specify two strings: \" \"STRINGS or KEYS options are mandatory\"); goto cleanup; } else if (getlen && getidx) { addReplyError(c, \"If you want both the length and indexes, please \" \"just use IDX.\"); goto cleanup; } /* Compute the LCS using the vanilla dynamic programming technique of * building a table of LCS(x,y) substrings. */ uint32_t alen = sdslen(a); uint32_t blen = sdslen(b); /* Setup an uint32_t array to store at LCS[i,j] the length of the * LCS A0..i-1, B0..j-1. Note that we have a linear array here, so * we index it as LCS[j+(blen+1)*j] */ uint32_t *lcs = zmalloc((alen+1)*(blen+1)*sizeof(uint32_t)); #define LCS(A,B) lcs[(B)+((A)*(blen+1))] /* Start building the LCS table. */ for (uint32_t i = 0; i <= alen; i++) { for (uint32_t j = 0; j <= blen; j++) { if (i == 0 || j == 0) { /* If one substring has length of zero, the * LCS length is zero. */ LCS(i,j) = 0; } else if (a[i-1] == b[j-1]) { /* The len LCS (and the LCS itself) of two * sequences with the same final character, is the * LCS of the two sequences without the last char * plus that last char. */ LCS(i,j) = LCS(i-1,j-1)+1; } else { /* If the last character is different, take the longest * between the LCS of the first string and the second * minus the last char, and the reverse. */ uint32_t lcs1 = LCS(i-1,j); uint32_t lcs2 = LCS(i,j-1); LCS(i,j) = lcs1 > lcs2 ? lcs1 : lcs2; } } } /* Store the actual LCS string in \"result\" if needed. We create * it backward, but the length is already known, we store it into idx. */ uint32_t idx = LCS(alen,blen); sds result = NULL; /* Resulting LCS string. */ void *arraylenptr = NULL; /* Deffered length of the array for IDX. */ uint32_t arange_start = alen, /* alen signals that values are not set. */ arange_end = 0, brange_start = 0, brange_end = 0; /* Do we need to compute the actual LCS string? Allocate it in that case. */ int computelcs = getidx || !getlen; if (computelcs) result = sdsnewlen(SDS_NOINIT,idx); /* Start with a deferred array if we have to emit the ranges. */ uint32_t arraylen = 0; /* Number of ranges emitted in the array. */ if (getidx) { addReplyMapLen(c,2); addReplyBulkCString(c,\"matches\"); arraylenptr = addReplyDeferredLen(c); } i = alen, j = blen; while (computelcs && i > 0 && j > 0) { int emit_range = 0; if (a[i-1] == b[j-1]) { /* If there is a match, store the character and reduce * the indexes to look for a new match. */ result[idx-1] = a[i-1]; /* Track the current range. */ if (arange_start == alen) { arange_start = i-1; arange_end = i-1; brange_start = j-1; brange_end = j-1; } else { /* Let's see if we can extend the range backward since * it is contiguous. */ if (arange_start == i && brange_start == j) { arange_start--; brange_start--; } else { emit_range = 1; } } /* Emit the range if we matched with the first byte of * one of the two strings. We'll exit the loop ASAP. */ if (arange_start == 0 || brange_start == 0) emit_range = 1; idx--; i--; j--; } else { /* Otherwise reduce i and j depending on the largest * LCS between, to understand what direction we need to go. */ uint32_t lcs1 = LCS(i-1,j); uint32_t lcs2 = LCS(i,j-1); if (lcs1 > lcs2) i--; else j--; if (arange_start != alen) emit_range = 1; } /* Emit the current range if needed. */ uint32_t match_len = arange_end - arange_start + 1; if (emit_range) { if (minmatchlen == 0 || match_len >= minmatchlen) { if (arraylenptr) { addReplyArrayLen(c,2+withmatchlen); addReplyArrayLen(c,2); addReplyLongLong(c,arange_start); addReplyLongLong(c,arange_end); addReplyArrayLen(c,2); addReplyLongLong(c,brange_start); addReplyLongLong(c,brange_end); if (withmatchlen) addReplyLongLong(c,match_len); arraylen++; } } arange_start = alen; /* Restart at the next match. */ } } /* Signal modified key, increment dirty, ... */ /* Reply depending on the given options. */ if (arraylenptr) { addReplyBulkCString(c,\"len\"); addReplyLongLong(c,LCS(alen,blen)); setDeferredArrayLen(c,arraylenptr,arraylen); } else if (getlen) { addReplyLongLong(c,LCS(alen,blen)); } else { addReplyBulkSds(c,result); result = NULL; } /* Cleanup. */ sdsfree(result); zfree(lcs); cleanup: if (obja) decrRefCount(obja); if (objb) decrRefCount(objb); return; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. An integer overflow bug in Redis version 6.0 or newer could be exploited using the `STRALGO LCS` command to corrupt the heap and potentially result with remote code execution. The problem is fixed in version 6.2.3 and 6.0.13. An additional workaround to mitigate the problem without patching the redis-server executable is to use ACL configuration to prevent clients from using the `STRALGO LCS` command.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2021-29477"}} -{"idx": 481041, "input": "ssize_t xdr_stream_decode_string(struct xdr_stream *xdr, char *str, size_t size) { ssize_t ret; void *p; ret = xdr_stream_decode_opaque_inline(xdr, &p, size); if (ret > 0) { memcpy(str, p, ret); str[ret] = '\\0'; return strlen(str); } *str = '\\0'; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 272237, "input": "multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags) { bool ret = true; #ifdef MULTI_DEBUG_EVENT_LOOP printf(\"%s -> TIMEOUT\\n\", id(m->earliest_wakeup)); #endif /* instance marked for wakeup? */ if (m->earliest_wakeup) { if (m->earliest_wakeup == (struct multi_instance *)&m->deferred_shutdown_signal) { schedule_remove_entry(m->schedule, (struct schedule_entry *) &m->deferred_shutdown_signal); throw_signal(m->deferred_shutdown_signal.signal_received); } else { set_prefix(m->earliest_wakeup); ret = multi_process_post(m, m->earliest_wakeup, mpp_flags); clear_prefix(); } m->earliest_wakeup = NULL; } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208933, "input": "enum_func_status php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zval ** fields, unsigned int field_count, const MYSQLND_FIELD * fields_metadata, zend_bool as_int_or_float, zend_bool copy_data, MYSQLND_STATS * stats TSRMLS_DC) { unsigned int i; zend_bool last_field_was_string = FALSE; zval **current_field, **end_field, **start_field; zend_uchar * p = row_buffer->ptr; size_t data_size = row_buffer->app; zend_uchar * bit_area = (zend_uchar*) row_buffer->ptr + data_size + 1; /* we allocate from here */ DBG_ENTER(\"php_mysqlnd_rowp_read_text_protocol_aux\"); if (!fields) { DBG_RETURN(FAIL); } end_field = (start_field = fields) + field_count; for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) { DBG_INF(\"Directly creating zval\"); MAKE_STD_ZVAL(*current_field); if (!*current_field) { DBG_RETURN(FAIL); } } for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) { /* Don't reverse the order. It is significant!*/ zend_uchar *this_field_len_pos = p; /* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */ unsigned long len = php_mysqlnd_net_field_length(&p); if (copy_data == FALSE && current_field > start_field && last_field_was_string) { /* Normal queries: We have to put \\0 now to the end of the previous field, if it was a string. IS_NULL doesn't matter. Because we have already read our length, then we can overwrite it in the row buffer. This statement terminates the previous field, not the current one. NULL_LENGTH is encoded in one byte, so we can stick a \\0 there. Any string's length is encoded in at least one byte, so we can stick a \\0 there. */ *this_field_len_pos = '\\0'; } /* NULL or NOT NULL, this is the question! */ if (len == MYSQLND_NULL_LENGTH) { ZVAL_NULL(*current_field); last_field_was_string = FALSE; } else { #if defined(MYSQLND_STRING_TO_INT_CONVERSION) struct st_mysqlnd_perm_bind perm_bind = mysqlnd_ps_fetch_functions[fields_metadata[i].type]; #endif if (MYSQLND_G(collect_statistics)) { enum_mysqlnd_collected_stats statistic; switch (fields_metadata[i].type) { case MYSQL_TYPE_DECIMAL: statistic = STAT_TEXT_TYPE_FETCHED_DECIMAL; break; case MYSQL_TYPE_TINY: statistic = STAT_TEXT_TYPE_FETCHED_INT8; break; case MYSQL_TYPE_SHORT: statistic = STAT_TEXT_TYPE_FETCHED_INT16; break; case MYSQL_TYPE_LONG: statistic = STAT_TEXT_TYPE_FETCHED_INT32; break; case MYSQL_TYPE_FLOAT: statistic = STAT_TEXT_TYPE_FETCHED_FLOAT; break; case MYSQL_TYPE_DOUBLE: statistic = STAT_TEXT_TYPE_FETCHED_DOUBLE; break; case MYSQL_TYPE_NULL: statistic = STAT_TEXT_TYPE_FETCHED_NULL; break; case MYSQL_TYPE_TIMESTAMP: statistic = STAT_TEXT_TYPE_FETCHED_TIMESTAMP; break; case MYSQL_TYPE_LONGLONG: statistic = STAT_TEXT_TYPE_FETCHED_INT64; break; case MYSQL_TYPE_INT24: statistic = STAT_TEXT_TYPE_FETCHED_INT24; break; case MYSQL_TYPE_DATE: statistic = STAT_TEXT_TYPE_FETCHED_DATE; break; case MYSQL_TYPE_TIME: statistic = STAT_TEXT_TYPE_FETCHED_TIME; break; case MYSQL_TYPE_DATETIME: statistic = STAT_TEXT_TYPE_FETCHED_DATETIME; break; case MYSQL_TYPE_YEAR: statistic = STAT_TEXT_TYPE_FETCHED_YEAR; break; case MYSQL_TYPE_NEWDATE: statistic = STAT_TEXT_TYPE_FETCHED_DATE; break; case MYSQL_TYPE_VARCHAR: statistic = STAT_TEXT_TYPE_FETCHED_STRING; break; case MYSQL_TYPE_BIT: statistic = STAT_TEXT_TYPE_FETCHED_BIT; break; case MYSQL_TYPE_NEWDECIMAL: statistic = STAT_TEXT_TYPE_FETCHED_DECIMAL; break; case MYSQL_TYPE_ENUM: statistic = STAT_TEXT_TYPE_FETCHED_ENUM; break; case MYSQL_TYPE_SET: statistic = STAT_TEXT_TYPE_FETCHED_SET; break; case MYSQL_TYPE_JSON: statistic = STAT_TEXT_TYPE_FETCHED_JSON; break; case MYSQL_TYPE_TINY_BLOB: statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break; case MYSQL_TYPE_MEDIUM_BLOB:statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break; case MYSQL_TYPE_LONG_BLOB: statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break; case MYSQL_TYPE_BLOB: statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break; case MYSQL_TYPE_VAR_STRING: statistic = STAT_TEXT_TYPE_FETCHED_STRING; break; case MYSQL_TYPE_STRING: statistic = STAT_TEXT_TYPE_FETCHED_STRING; break; case MYSQL_TYPE_GEOMETRY: statistic = STAT_TEXT_TYPE_FETCHED_GEOMETRY; break; default: statistic = STAT_TEXT_TYPE_FETCHED_OTHER; break; } MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len); } #ifdef MYSQLND_STRING_TO_INT_CONVERSION if (as_int_or_float && perm_bind.php_type == IS_LONG) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\\0'; if (perm_bind.pack_len < SIZEOF_LONG) { /* direct conversion */ int64_t v = #ifndef PHP_WIN32 atoll((char *) p); #else _atoi64((char *) p); #endif ZVAL_LONG(*current_field, (long) v); /* the cast is safe */ } else { uint64_t v = #ifndef PHP_WIN32 (uint64_t) atoll((char *) p); #else (uint64_t) _atoi64((char *) p); #endif zend_bool uns = fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE; /* We have to make it ASCIIZ temporarily */ #if SIZEOF_LONG==8 if (uns == TRUE && v > 9223372036854775807L) #elif SIZEOF_LONG==4 if ((uns == TRUE && v > L64(2147483647)) || (uns == FALSE && (( L64(2147483647) < (int64_t) v) || (L64(-2147483648) > (int64_t) v)))) #else #error Need fix for this architecture #endif /* SIZEOF */ { ZVAL_STRINGL(*current_field, (char *)p, len, 0); } else { ZVAL_LONG(*current_field, (long) v); /* the cast is safe */ } } *(p + len) = save; } else if (as_int_or_float && perm_bind.php_type == IS_DOUBLE) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\\0'; ZVAL_DOUBLE(*current_field, atof((char *) p)); *(p + len) = save; } else #endif /* MYSQLND_STRING_TO_INT_CONVERSION */ if (fields_metadata[i].type == MYSQL_TYPE_BIT) { /* BIT fields are specially handled. As they come as bit mask, we have to convert it to human-readable representation. As the bits take less space in the protocol than the numbers they represent, we don't have enough space in the packet buffer to overwrite inside. Thus, a bit more space is pre-allocated at the end of the buffer, see php_mysqlnd_rowp_read(). And we add the strings at the end. Definitely not nice, _hackish_ :(, but works. */ zend_uchar *start = bit_area; ps_fetch_from_1_to_8_bytes(*current_field, &(fields_metadata[i]), 0, &p, len TSRMLS_CC); /* We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because later in this function there will be an advancement. */ p -= len; if (Z_TYPE_PP(current_field) == IS_LONG) { bit_area += 1 + sprintf((char *)start, \"%ld\", Z_LVAL_PP(current_field)); ZVAL_STRINGL(*current_field, (char *) start, bit_area - start - 1, copy_data); } else if (Z_TYPE_PP(current_field) == IS_STRING){ memcpy(bit_area, Z_STRVAL_PP(current_field), Z_STRLEN_PP(current_field)); bit_area += Z_STRLEN_PP(current_field); *bit_area++ = '\\0'; zval_dtor(*current_field); ZVAL_STRINGL(*current_field, (char *) start, bit_area - start - 1, copy_data); } } else { ZVAL_STRINGL(*current_field, (char *)p, len, copy_data); } p += len; last_field_was_string = TRUE; } } if (copy_data == FALSE && last_field_was_string) { /* Normal queries: The buffer has one more byte at the end, because we need it */ row_buffer->ptr[data_size] = '\\0'; } DBG_RETURN(PASS);", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "ext/mysqlnd/mysqlnd_wireprotocol.c in PHP before 5.6.26 and 7.x before 7.0.11 does not verify that a BIT field has the UNSIGNED_FLAG flag, which allows remote MySQL servers to cause a denial of service (heap-based buffer overflow) or possibly have unspecified other impact via crafted field metadata.", "severity_level": "Medium", "cwe": "CWE-119", "cve": "CVE-2016-7412"}} -{"idx": 378650, "input": "static u32 serialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ Mem *pMem /* Memory cell to write value into */ ){ u64 x = FOUR_BYTE_UINT(buf); u32 y = FOUR_BYTE_UINT(buf+4); x = (x<<32) + y; if( serial_type==6 ){ /* EVIDENCE-OF: R-29851-52272 Value is a big-endian 64-bit ** twos-complement integer. */ pMem->u.i = *(i64*)&x; pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); }else{ /* EVIDENCE-OF: R-57343-49114 Value is a big-endian IEEE 754-2008 64-bit ** floating point number. */ #if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT) /* Verify that integers and floating point values use the same ** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is ** defined that 64-bit floating point values really are mixed ** endian. */ static const u64 t1 = ((u64)0x3ff00000)<<32; static const double r1 = 1.0; u64 t2 = t1; swapMixedEndianFloat(t2); assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 ); #endif assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 ); swapMixedEndianFloat(x); memcpy(&pMem->u.r, &x, sizeof(x)); pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; } return 8; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 477987, "input": "spell_print_node(wordnode_T *node, int depth) { if (node->wn_u1.index) { /* Done this node before, print the reference. */ PRINTSOME(line1, depth, \"(%d)\", node->wn_nr, 0); PRINTSOME(line2, depth, \" \", 0, 0); PRINTSOME(line3, depth, \" \", 0, 0); msg((char_u *)line1); msg((char_u *)line2); msg((char_u *)line3); } else { node->wn_u1.index = TRUE; if (node->wn_byte != NUL) { if (node->wn_child != NULL) PRINTSOME(line1, depth, \" %c -> \", node->wn_byte, 0); else /* Cannot happen? */ PRINTSOME(line1, depth, \" %c ???\", node->wn_byte, 0); } else PRINTSOME(line1, depth, \" $ \", 0, 0); PRINTSOME(line2, depth, \"%d/%d \", node->wn_nr, node->wn_refs); if (node->wn_sibling != NULL) PRINTSOME(line3, depth, \" | \", 0, 0); else PRINTSOME(line3, depth, \" \", 0, 0); if (node->wn_byte == NUL) { msg((char_u *)line1); msg((char_u *)line2); msg((char_u *)line3); } /* do the children */ if (node->wn_byte != NUL && node->wn_child != NULL) spell_print_node(node->wn_child, depth + 1); /* do the siblings */ if (node->wn_sibling != NULL) { /* get rid of all parent details except | */ STRCPY(line1, line3); STRCPY(line2, line3); spell_print_node(node->wn_sibling, depth); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295416, "input": "struct dentry *lookup_one_len_unlocked(const char *name, struct dentry *base, int len) { struct qstr this; int err; struct dentry *ret; err = lookup_one_len_common(name, base, len, &this); if (err) return ERR_PTR(err); ret = lookup_dcache(&this, base, 0); if (!ret) ret = lookup_slow(&this, base, 0); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 290627, "input": "static void checkConsistency(intset *is) { for (uint32_t i = 0; i < (intrev32ifbe(is->length)-1); i++) { uint32_t encoding = intrev32ifbe(is->encoding); if (encoding == INTSET_ENC_INT16) { int16_t *i16 = (int16_t*)is->contents; assert(i16[i] < i16[i+1]); } else if (encoding == INTSET_ENC_INT32) { int32_t *i32 = (int32_t*)is->contents; assert(i32[i] < i32[i+1]); } else { int64_t *i64 = (int64_t*)is->contents; assert(i64[i] < i64[i+1]); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295098, "input": "static int update_prepare_bounds(rdpContext* context, ORDER_INFO* orderInfo) { int length = 0; rdpUpdate* update = context->update; orderInfo->boundsFlags = 0; if (update_bounds_is_null(&update->currentBounds)) return 0; orderInfo->controlFlags |= ORDER_BOUNDS; if (update_bounds_equals(&update->previousBounds, &update->currentBounds)) { orderInfo->controlFlags |= ORDER_ZERO_BOUNDS_DELTAS; return 0; } else { length += 1; if (update->previousBounds.left != update->currentBounds.left) { orderInfo->bounds.left = update->currentBounds.left; orderInfo->boundsFlags |= BOUND_LEFT; length += 2; } if (update->previousBounds.top != update->currentBounds.top) { orderInfo->bounds.top = update->currentBounds.top; orderInfo->boundsFlags |= BOUND_TOP; length += 2; } if (update->previousBounds.right != update->currentBounds.right) { orderInfo->bounds.right = update->currentBounds.right; orderInfo->boundsFlags |= BOUND_RIGHT; length += 2; } if (update->previousBounds.bottom != update->currentBounds.bottom) { orderInfo->bounds.bottom = update->currentBounds.bottom; orderInfo->boundsFlags |= BOUND_BOTTOM; length += 2; } } return length; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 299140, "input": "yaffsfs_load_attrs(TSK_FS_FILE *file) { TSK_FS_ATTR *attr; TSK_FS_META *meta; TSK_FS_INFO *fs; YAFFSFS_INFO *yfs; TSK_FS_ATTR_RUN *data_run; TSK_DADDR_T file_block_count; YaffsCacheObject *obj; YaffsCacheVersion *version; TSK_RETVAL_ENUM result; TSK_LIST *chunks_seen = NULL; YaffsCacheChunk *curr; TSK_FS_ATTR_RUN *data_run_new; if (file == NULL || file->meta == NULL || file->fs_info == NULL) { tsk_error_set_errno(TSK_ERR_FS_ARG); tsk_error_set_errstr (\"yaffsfs_load_attrs: called with NULL pointers\"); return 1; } meta = file->meta; yfs = (YAFFSFS_INFO *)file->fs_info; fs = &yfs->fs_info; // see if we have already loaded the runs if ((meta->attr != NULL) && (meta->attr_state == TSK_FS_META_ATTR_STUDIED)) { return 0; } else if (meta->attr_state == TSK_FS_META_ATTR_ERROR) { return 1; } // not sure why this would ever happen, but... else if (meta->attr != NULL) { tsk_fs_attrlist_markunused(meta->attr); } else if (meta->attr == NULL) { meta->attr = tsk_fs_attrlist_alloc(); } attr = tsk_fs_attrlist_getnew(meta->attr, TSK_FS_ATTR_NONRES); if (attr == NULL) { meta->attr_state = TSK_FS_META_ATTR_ERROR; return 1; } if (meta->size == 0) { data_run = NULL; } else { /* BC: I'm not entirely sure this is needed. My guess is that * this was done instead of maintaining the head of the list of * runs. In theory, the tsk_fs_attr_add_run() method should handle * the fillers. */ data_run = tsk_fs_attr_run_alloc(); if (data_run == NULL) { tsk_fs_attr_run_free(data_run); meta->attr_state = TSK_FS_META_ATTR_ERROR; return 1; } data_run->offset = 0; data_run->addr = 0; data_run->len = (meta->size + fs->block_size - 1) / fs->block_size; data_run->flags = TSK_FS_ATTR_RUN_FLAG_FILLER; } // initialize the data run if (tsk_fs_attr_set_run(file, attr, data_run, NULL, TSK_FS_ATTR_TYPE_DEFAULT, TSK_FS_ATTR_ID_DEFAULT, meta->size, meta->size, roundup(meta->size, fs->block_size), (TSK_FS_ATTR_FLAG_ENUM)0, 0)) { meta->attr_state = TSK_FS_META_ATTR_ERROR; return 1; } // If the file has size zero, return now if(meta->size == 0){ meta->attr_state = TSK_FS_META_ATTR_STUDIED; return 0; } /* Get the version for the given object. */ result = yaffscache_version_find_by_inode(yfs, meta->addr, &version, &obj); if (result != TSK_OK || version == NULL) { if (tsk_verbose) tsk_fprintf(stderr, \"yaffsfs_load_attrs: yaffscache_version_find_by_inode failed!\\n\"); meta->attr_state = TSK_FS_META_ATTR_ERROR; return 1; } if (tsk_verbose) yaffscache_object_dump(stderr, obj); file_block_count = data_run->len; /* Cycle through the chunks for this version of this object */ curr = version->ycv_last_chunk; while (curr != NULL && curr->ycc_obj_id == obj->yco_obj_id) { if (curr->ycc_chunk_id == 0) { if (tsk_verbose) tsk_fprintf(stderr, \"yaffsfs_load_attrs: skipping header chunk\\n\"); } else if (tsk_list_find(chunks_seen, curr->ycc_chunk_id)) { if (tsk_verbose) tsk_fprintf(stderr, \"yaffsfs_load_attrs: skipping duplicate chunk\\n\"); } else if (curr->ycc_chunk_id > file_block_count) { if (tsk_verbose) tsk_fprintf(stderr, \"yaffsfs_load_attrs: skipping chunk past end\\n\"); } /* We like this chunk */ else { // add it to our internal list if (tsk_list_add(&chunks_seen, curr->ycc_chunk_id)) { meta->attr_state = TSK_FS_META_ATTR_ERROR; tsk_list_free(chunks_seen); chunks_seen = NULL; return 1; } data_run_new = tsk_fs_attr_run_alloc(); if (data_run_new == NULL) { tsk_fs_attr_run_free(data_run_new); meta->attr_state = TSK_FS_META_ATTR_ERROR; return 1; } data_run_new->offset = (curr->ycc_chunk_id - 1); data_run_new->addr = curr->ycc_offset / (fs->block_pre_size + fs->block_size + fs->block_post_size); data_run_new->len = 1; data_run_new->flags = TSK_FS_ATTR_RUN_FLAG_NONE; if (tsk_verbose) tsk_fprintf(stderr, \"yaffsfs_load_attrs: @@@ Chunk %d : %08x is at offset 0x%016llx\\n\", curr->ycc_chunk_id, curr->ycc_seq_number, curr->ycc_offset); tsk_fs_attr_add_run(fs, attr, data_run_new); } curr = curr->ycc_prev; } tsk_list_free(chunks_seen); meta->attr_state = TSK_FS_META_ATTR_STUDIED; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506558, "input": "if_command() { if_else_command(IF_INITIAL); return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376263, "input": "int server_supports(const char *feature) { return !!server_feature_value(feature, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417793, "input": "static int SLContains(struct script_record *sr, uint32 script, uint32 lang) { int i, j; if ( script==DEFAULT_SCRIPT || script == 0 ) return( true ); for ( i=0; sr[i].script!=0; ++i ) { if ( sr[i].script==script ) { if ( lang==0 ) return( true ); for ( j=0; sr[i].langs[j]!=0; ++j ) if ( sr[i].langs[j]==lang ) return( true ); return( false ); /* this script entry didn't contain the language. won't be any other scripts to check */ } } return( false ); /* Never found script */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 243185, "input": "} void print_udta(GF_ISOFile *file, u32 track_number, Bool has_itags) { u32 i, count; count = gf_isom_get_udta_count(file, track_number); if (!count) return; if (has_itags) { for (i=0; iarg_size[i]), BPF_REG_FP, i == 5 ? X86_REG_R9 : BPF_REG_1 + i, -(stack_size - i * 8)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 194999, "input": "String preg_quote(const String& str, const String& delimiter /* = null_string */) { const char* in_str = str.data(); const char* in_str_end = in_str + str.size(); /* Nothing to do if we got an empty string */ if (in_str == in_str_end) { return str; } char delim_char = 0; /* Delimiter character to be quoted */ bool quote_delim = false; /* Whether to quote additional delim char */ if (!delimiter.empty()) { delim_char = delimiter.charAt(0); quote_delim = true; } /* Allocate enough memory so that even if each character is quoted, we won't run out of room */ String ret(4 * str.size() + 1, ReserveString); char* out_str = ret.mutableData(); /* Go through the string and quote necessary characters */ const char* p; char* q; for (p = in_str, q = out_str; p != in_str_end; p++) { char c = *p; switch (c) { case '.': case '\\\\': case '+': case '*': case '?': case '[': case '^': case ']': case '$': case '(': case ')': case '{': case '}': case '=': case '!': case '>': case '<': case '|': case ':': case '-': case '#': *q++ = '\\\\'; *q++ = c; break; case '\\0': *q++ = '\\\\'; *q++ = '0'; *q++ = '0'; *q++ = '0'; break; default: if (quote_delim && c == delim_char) *q++ = '\\\\'; *q++ = c; break; } } *q = '\\0'; return ret.setSize(q - out_str); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "In-memory file operations (ie: using fopen on a data URI) did not properly restrict negative seeking, allowing for the reading of memory prior to the in-memory buffer. This issue affects HHVM versions prior to 4.56.3, all versions between 4.57.0 and 4.80.1, all versions between 4.81.0 and 4.93.1, and versions 4.94.0, 4.95.0, 4.96.0, 4.97.0, 4.98.0.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-1918"}} -{"idx": 393613, "input": "lr_yum_perform(LrHandle *handle, LrResult *result, GError **err) { int ret = TRUE; LrYumRepo *repo; LrYumRepoMd *repomd; assert(handle); assert(!err || *err == NULL); if (!result) { g_set_error(err, LR_YUM_ERROR, LRE_BADFUNCARG, \"Missing result parameter\"); return FALSE; } if (!handle->urls && !handle->mirrorlisturl && !handle->metalinkurl) { g_set_error(err, LR_YUM_ERROR, LRE_NOURL, \"No LRO_URLS, LRO_MIRRORLISTURL nor LRO_METALINKURL specified\"); return FALSE; } if (handle->local && (!handle->urls || !handle->urls[0])) { g_set_error(err, LR_YUM_ERROR, LRE_NOURL, \"Localrepo specified, but no LRO_URLS set\"); return FALSE; } if (handle->update) { // Download/Locate only specified files if (!result->yum_repo || !result->yum_repomd) { g_set_error(err, LR_YUM_ERROR, LRE_INCOMPLETERESULT, \"Incomplete result object - \" \"Cannot update on this result object\"); return FALSE; } } else { // Download/Locate from scratch if (result->yum_repo || result->yum_repomd) { g_set_error(err, LR_YUM_ERROR, LRE_ALREADYUSEDRESULT, \"This result object is not clear - \" \"Already used result object\"); return FALSE; } result->yum_repo = lr_yum_repo_init(); result->yum_repomd = lr_yum_repomd_init(); } repo = result->yum_repo; repomd = result->yum_repomd; if (handle->local) { // Do not duplicate repository, just use the existing local one ret = lr_yum_use_local(handle, result, err); if (!ret) return FALSE; if (handle->checks & LR_CHECK_CHECKSUM) ret = lr_yum_check_repo_checksums(repo, repomd, err); } else { // Download remote/Duplicate local repository // Note: All checksums are checked while downloading ret = lr_yum_download_remote(handle, result, err); } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268921, "input": "R_API const char *r_str_casestr(const char *a, const char *b) { // That's a GNUism that works in many places.. but we don't want it // return strcasestr (a, b); size_t hay_len = strlen (a); size_t needle_len = strlen (b); if (!hay_len || !needle_len) { return NULL; } while (hay_len >= needle_len) { if (!r_str_ncasecmp (a, b, needle_len)) { return (const char *) a; } a++; hay_len--; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431460, "input": "nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags, struct iattr *attr, int *opened) { struct nfs4_state *state; struct nfs4_label l = {0, 0, 0, NULL}, *label = NULL; label = nfs4_label_init_security(dir, ctx->dentry, attr, &l); /* Protect against concurrent sillydeletes */ state = nfs4_do_open(dir, ctx, open_flags, attr, label, opened); nfs4_label_release_security(label); if (IS_ERR(state)) return ERR_CAST(state); return state->inode; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 124797, "input": "ScriptProcessorNode* AudioContext::createScriptProcessor(size_t bufferSize, ExceptionState& exceptionState) { return createScriptProcessor(bufferSize, 2, 2, exceptionState); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514779, "input": "static MemTxResult flatview_read(FlatView *fv, hwaddr addr, MemTxAttrs attrs, void *buf, hwaddr len) { hwaddr l; hwaddr addr1; MemoryRegion *mr; l = len; mr = flatview_translate(fv, addr, &addr1, &l, false, attrs); if (!flatview_access_allowed(mr, attrs, addr, len)) { return MEMTX_ACCESS_ERROR; } return flatview_read_continue(fv, addr, attrs, buf, len, addr1, l, mr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277007, "input": "inline SparseTensor SparseTensor::Concat( const gtl::ArraySlice& tensors) { DCHECK_GE(tensors.size(), size_t{1}) << \"Cannot concat 0 SparseTensors\"; const int dims = tensors[0].dims_; DCHECK_GE(dims, 1) << \"Cannot concat 0-dimensional SparseTensors\"; auto order_0 = tensors[0].order(); const int primary_dim = order_0[0]; ShapeArray final_order(order_0.begin(), order_0.end()); ShapeArray final_shape(tensors[0].shape().begin(), tensors[0].shape().end()); final_shape[primary_dim] = 0; // We'll build this up as we go along. int num_entries = 0; bool fully_ordered = true; for (const SparseTensor& st : tensors) { DCHECK_EQ(st.dims_, dims) << \"All SparseTensors must have the same rank.\"; DCHECK_EQ(DataTypeToEnum::v(), st.dtype()) << \"Concat requested with the wrong data type\"; DCHECK_GE(st.order()[0], 0) << \"SparseTensor must be ordered\"; DCHECK_EQ(st.order()[0], primary_dim) << \"All SparseTensors' order[0] must match. This is the concat dim.\"; if (st.order() != final_order) fully_ordered = false; const VarDimArray& st_shape = st.shape(); for (int d = 0; d < dims - 1; ++d) { const int cdim = (d < primary_dim) ? d : d + 1; DCHECK_EQ(final_shape[cdim], st_shape[cdim]) << \"All SparseTensors' shapes must match except on the concat dim. \" << \"Concat dim: \" << primary_dim << \", mismatched shape at dim: \" << cdim << \". Expecting shape like: [\" << str_util::Join(final_shape, \",\") << \"] but saw shape: [\" << str_util::Join(st_shape, \",\") << \"]\"; } // Update dimension of final shape final_shape[primary_dim] = (final_shape[primary_dim] + st_shape[primary_dim]); num_entries += st.num_entries(); // Update number of entries } // If nonconsistent ordering among inputs, set final order to -1s. if (!fully_ordered) { final_order = UndefinedOrder(final_shape); } Tensor output_ix(DT_INT64, TensorShape({num_entries, dims})); Tensor output_vals(DataTypeToEnum::v(), TensorShape({num_entries})); TTypes::Matrix ix_t = output_ix.matrix(); typename TTypes::Vec vals_t = output_vals.vec(); Eigen::DenseIndex offset = 0; int64 shape_offset = 0; for (const SparseTensor& st : tensors) { const int st_num_entries = st.num_entries(); // Fill in indices & values. if (st_num_entries > 0) { std::copy_n(&st.vals_.vec()(0), st_num_entries, &vals_t(offset)); const auto* st_ix = &st.ix_.matrix()(0, 0); auto* ix_out = &ix_t(offset, 0); for (std::size_t i = 0; i < st_num_entries * dims; ++i) { *ix_out++ = *st_ix++ + ((i % dims == primary_dim) ? shape_offset : 0); } } offset += st_num_entries; shape_offset += st.shape()[primary_dim]; } return SparseTensor(output_ix, output_vals, final_shape, final_order); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 360774, "input": "void shm_delete(XShmSegmentInfo *shm) { #if HAVE_XSHM if (getenv(\"X11VNC_SHM_DEBUG\")) fprintf(stderr, \"shm_delete: %p\\n\", (void *) shm); if (shm != NULL && shm->shmaddr != (char *) -1) { shmdt(shm->shmaddr); } if (shm != NULL && shm->shmid != -1) { shmctl(shm->shmid, IPC_RMID, 0); } if (shm != NULL) { shm->shmaddr = (char *) -1; shm->shmid = -1; } #else if (!shm) {} #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 275421, "input": "static GF_Err isom_cenc_get_sai_by_saiz_saio(GF_MediaBox *mdia, u32 sampleNumber, u32 scheme_type, u8 **out_buffer, u32 *out_size) { u32 prev_sai_size, size, i, j, nb_saio; u64 cur_position, offset; GF_Err e = GF_OK; GF_SampleAuxiliaryInfoOffsetBox *saio_cenc=NULL; GF_SampleAuxiliaryInfoSizeBox *saiz_cenc=NULL; nb_saio = size = prev_sai_size = 0; offset = 0; if (! out_buffer || !out_size) return GF_BAD_PARAM; for (i = 0; i < gf_list_count(mdia->information->sampleTable->sai_offsets); i++) { GF_SampleAuxiliaryInfoOffsetBox *saio = (GF_SampleAuxiliaryInfoOffsetBox *)gf_list_get(mdia->information->sampleTable->sai_offsets, i); u32 aux_info_type = saio->aux_info_type; if (!aux_info_type) aux_info_type = scheme_type; switch (aux_info_type) { case GF_ISOM_CENC_SCHEME: case GF_ISOM_CBC_SCHEME: case GF_ISOM_CENS_SCHEME: case GF_ISOM_CBCS_SCHEME: case GF_ISOM_PIFF_SCHEME: break; default: continue; } if (saio->entry_count == 1) offset = saio->offsets[0]; else offset = saio->offsets[sampleNumber-1]; nb_saio = saio->entry_count; saio_cenc = saio; break; } if (!saio_cenc) return GF_ISOM_INVALID_FILE; for (i = 0; i < gf_list_count(mdia->information->sampleTable->sai_sizes); i++) { GF_SampleAuxiliaryInfoSizeBox *saiz = (GF_SampleAuxiliaryInfoSizeBox *)gf_list_get(mdia->information->sampleTable->sai_sizes, i); u32 aux_info_type = saiz->aux_info_type; if (!aux_info_type) aux_info_type = scheme_type; switch (aux_info_type) { case GF_ISOM_CENC_SCHEME: case GF_ISOM_CBC_SCHEME: case GF_ISOM_CENS_SCHEME: case GF_ISOM_CBCS_SCHEME: case GF_ISOM_PIFF_SCHEME: break; default: continue; } if (sampleNumber>saiz->sample_count) { return GF_NON_COMPLIANT_BITSTREAM; } if ((nb_saio==1) && !saio_cenc->total_size) { for (j = 0; j < saiz->sample_count; j++) { saio_cenc->total_size += saiz->default_sample_info_size ? saiz->default_sample_info_size : saiz->sample_info_size[j]; } } if (saiz->cached_sample_num+1== sampleNumber) { prev_sai_size = saiz->cached_prev_size; } else { for (j = 0; j < sampleNumber-1; j++) prev_sai_size += saiz->default_sample_info_size ? saiz->default_sample_info_size : saiz->sample_info_size[j]; } size = saiz->default_sample_info_size ? saiz->default_sample_info_size : saiz->sample_info_size[sampleNumber-1]; saiz_cenc=saiz; break; } if (!saiz_cenc) return GF_BAD_PARAM; saiz_cenc->cached_sample_num = sampleNumber; saiz_cenc->cached_prev_size = prev_sai_size + size; if (saio_cenc->total_size) { if (!saio_cenc->cached_data) { saio_cenc->cached_data = gf_malloc(sizeof(u8)*saio_cenc->total_size); if (!saio_cenc->cached_data) return GF_OUT_OF_MEM; cur_position = gf_bs_get_position(mdia->information->dataHandler->bs); gf_bs_seek(mdia->information->dataHandler->bs, offset); gf_bs_read_data(mdia->information->dataHandler->bs, saio_cenc->cached_data, saio_cenc->total_size); gf_bs_seek(mdia->information->dataHandler->bs, cur_position); } if (out_size) { if (out_buffer) { if ((*out_size) < size) { (*out_buffer) = gf_realloc((*out_buffer), sizeof(char)*(size) ); if (! *out_buffer) return GF_OUT_OF_MEM; } memcpy((*out_buffer), saio_cenc->cached_data + prev_sai_size, size); } (*out_size) = size; } return GF_OK; } offset += (nb_saio == 1) ? prev_sai_size : 0; cur_position = gf_bs_get_position(mdia->information->dataHandler->bs); gf_bs_seek(mdia->information->dataHandler->bs, offset); if (out_buffer) { if ((*out_size) < size) { (*out_buffer) = gf_realloc((*out_buffer), sizeof(char)*(size) ); if (! *out_buffer) return GF_OUT_OF_MEM; } gf_bs_read_data(mdia->information->dataHandler->bs, (*out_buffer), size); } (*out_size) = size; gf_bs_seek(mdia->information->dataHandler->bs, cur_position); return e; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280055, "input": "*/ static char *create_unique_id(struct kmem_cache *s) { char *name = kmalloc(ID_STR_LENGTH, GFP_KERNEL); char *p = name; BUG_ON(!name); *p++ = ':'; /* * First flags affecting slabcache operations. We will only * get here for aliasable slabs so we do not need to support * too many flags. The flags here must cover all flags that * are matched during merging to guarantee that the id is * unique. */ if (s->flags & SLAB_CACHE_DMA) *p++ = 'd'; if (s->flags & SLAB_CACHE_DMA32) *p++ = 'D'; if (s->flags & SLAB_RECLAIM_ACCOUNT) *p++ = 'a'; if (s->flags & SLAB_CONSISTENCY_CHECKS) *p++ = 'F'; if (s->flags & SLAB_ACCOUNT) *p++ = 'A'; if (p != name + 1) *p++ = '-'; p += sprintf(p, \"%07u\", s->size); BUG_ON(p > name + ID_STR_LENGTH - 1); return name;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393029, "input": "TEST_F(QueryPlannerTest, OrEnumerationLimit) { params.options = QueryPlannerParams::NO_TABLE_SCAN; addIndex(BSON(\"a\" << 1)); addIndex(BSON(\"b\" << 1)); // 6 $or clauses, each with 2 indexed predicates // means 2^6 = 64 possibilities. We should hit the limit. runQuery( fromjson(\"{$or: [{a: 1, b: 1},\" \"{a: 2, b: 2},\" \"{a: 3, b: 3},\" \"{a: 4, b: 4},\" \"{a: 5, b: 5},\" \"{a: 6, b: 6}]}\")); assertNumSolutions(internalQueryEnumerationMaxOrSolutions.load()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380799, "input": "static void vga_set_palette(struct vc_data *vc, const unsigned char *table) { int i, j; vga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff); for (i = j = 0; i < 16; i++) { vga_w(vgastate.vgabase, VGA_PEL_IW, table[i]); vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437632, "input": "static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK)) return; if (!is_cr_intercept(svm, INTERCEPT_CR8_WRITE)) { int cr8 = svm->vmcb->control.int_ctl & V_TPR_MASK; kvm_set_cr8(vcpu, cr8); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 483018, "input": "static struct _vcs_dpi_ip_params_st *get_asic_rev_ip_params( uint32_t hw_internal_rev) { /* NV12 and NV10 */ return &dcn2_0_ip; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279685, "input": "void remove_pending_change_notify_requests_by_fid(files_struct *fsp, NTSTATUS status) { if (fsp->notify == NULL) { return; } while (fsp->notify->requests != NULL) { change_notify_reply(fsp->notify->requests->req, status, 0, NULL, fsp->notify->requests->reply_fn); change_notify_remove_request(fsp->conn->sconn, fsp->notify->requests); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 301234, "input": "string_base62(unsigned long int value) { static uschar yield[7]; uschar *p = yield + sizeof(yield) - 1; *p = 0; while (p > yield) { *(--p) = base62_chars[value % BASE_62]; value /= BASE_62; } return yield; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394241, "input": "dump_counters(struct sk_buff *skb, struct nf_conn_acct *acct, enum ip_conntrack_dir dir, int type) { enum ctattr_type attr = dir ? CTA_COUNTERS_REPLY: CTA_COUNTERS_ORIG; struct nf_conn_counter *counter = acct->counter; struct nlattr *nest_count; u64 pkts, bytes; if (type == IPCTNL_MSG_CT_GET_CTRZERO) { pkts = atomic64_xchg(&counter[dir].packets, 0); bytes = atomic64_xchg(&counter[dir].bytes, 0); } else { pkts = atomic64_read(&counter[dir].packets); bytes = atomic64_read(&counter[dir].bytes); } nest_count = nla_nest_start(skb, attr); if (!nest_count) goto nla_put_failure; if (nla_put_be64(skb, CTA_COUNTERS_PACKETS, cpu_to_be64(pkts), CTA_COUNTERS_PAD) || nla_put_be64(skb, CTA_COUNTERS_BYTES, cpu_to_be64(bytes), CTA_COUNTERS_PAD)) goto nla_put_failure; nla_nest_end(skb, nest_count); return 0; nla_put_failure: return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468947, "input": "struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, __be32 daddr, __be16 dport, int dif) { struct sock *sk; sk = __udp4_lib_lookup(net, saddr, sport, daddr, dport, dif, &udp_table, NULL); if (sk && !refcount_inc_not_zero(&sk->sk_refcnt)) sk = NULL; return sk; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508933, "input": "virtual bool check_field_expression_processor(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429630, "input": "static void mysql_close_options(MYSQL *mysql) { if (mysql->options.init_command) { char **begin= (char **)mysql->options.init_command->buffer; char **end= begin + mysql->options.init_command->elements; for (;begin < end; begin++) free(*begin); ma_delete_dynamic(mysql->options.init_command); free(mysql->options.init_command); } free(mysql->options.user); free(mysql->options.host); free(mysql->options.password); free(mysql->options.unix_socket); free(mysql->options.db); free(mysql->options.my_cnf_file); free(mysql->options.my_cnf_group); free(mysql->options.charset_dir); free(mysql->options.charset_name); free(mysql->options.bind_address); free(mysql->options.ssl_key); free(mysql->options.ssl_cert); free(mysql->options.ssl_ca); free(mysql->options.ssl_capath); free(mysql->options.ssl_cipher); if (mysql->options.extension) { struct mysql_async_context *ctxt; if ((ctxt = mysql->options.extension->async_context)) { my_context_destroy(&ctxt->async_context); free(ctxt); mysql->options.extension->async_context= 0; } free(mysql->options.extension->plugin_dir); free(mysql->options.extension->default_auth); free(mysql->options.extension->db_driver); free(mysql->options.extension->ssl_crl); free(mysql->options.extension->ssl_crlpath); free(mysql->options.extension->tls_fp); free(mysql->options.extension->tls_fp_list); free(mysql->options.extension->tls_pw); free(mysql->options.extension->tls_version); free(mysql->options.extension->url); free(mysql->options.extension->connection_handler); if(hash_inited(&mysql->options.extension->connect_attrs)) hash_free(&mysql->options.extension->connect_attrs); if (hash_inited(&mysql->options.extension->userdata)) hash_free(&mysql->options.extension->userdata); } free(mysql->options.extension); /* clear all pointer */ memset(&mysql->options, 0, sizeof(mysql->options)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 388312, "input": "wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen) { wStream* s; s = Stream_New(NULL, dataLen + 8); if (!s) { WLog_ERR(TAG, \"Stream_New failed!\"); return NULL; } Stream_Write_UINT16(s, msgType); Stream_Write_UINT16(s, msgFlags); /* Write actual length after the entire packet has been constructed. */ Stream_Seek(s, 4); return s; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232391, "input": "inline void OutputLerpForChannels(const InterpolationCache& xs, const int64 x, const T_SCALE ys_ilerp, const int channels, const float min, const float max, const T* ys_input_lower_ptr, const T* ys_input_upper_ptr, T* output_y_ptr) { const int64 xs_lower = xs.lower[x]; const int64 xs_upper = xs.upper[x]; const T_SCALE xs_ilerp = xs.ilerp[x]; for (int c = 0; c < channels; ++c) { const T top_left = ys_input_lower_ptr[xs_lower + c]; const T top_right = ys_input_lower_ptr[xs_upper + c]; const T bottom_left = ys_input_upper_ptr[xs_lower + c]; const T bottom_right = ys_input_upper_ptr[xs_upper + c]; const T val = ComputeLerp( top_left, top_right, bottom_left, bottom_right, xs_ilerp, ys_ilerp); output_y_ptr[x * channels + c] = val; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393081, "input": "TEST_F(QueryPlannerTest, EquivalentAndsOne) { addIndex(BSON(\"a\" << 1 << \"b\" << 1)); runQuery(fromjson(\"{$and: [{a: 1}, {b: {$all: [10, 20]}}]}\")); ASSERT_EQUALS(getNumSolutions(), 2U); assertSolutionExists(\"{cscan: {dir: 1, filter: {$and:[{a:1},{b:10},{b:20}]}}}\"); assertSolutionExists( \"{fetch: {filter: null, node: {ixscan: \" \"{filter: null, pattern: {a: 1, b: 1}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232594, "input": "static int verifier_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt) { struct bpf_insn_aux_data *aux_data = env->insn_aux_data; unsigned int orig_prog_len = env->prog->len; int err; if (bpf_prog_is_dev_bound(env->prog->aux)) bpf_prog_offload_remove_insns(env, off, cnt); err = bpf_remove_insns(env->prog, off, cnt); if (err) return err; err = adjust_subprog_starts_after_remove(env, off, cnt); if (err) return err; err = bpf_adj_linfo_after_remove(env, off, cnt); if (err) return err; memmove(aux_data + off, aux_data + off + cnt, sizeof(*aux_data) * (orig_prog_len - off - cnt)); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212837, "input": "static int dw_spi_transfer_one(struct spi_controller *master, struct spi_device *spi, struct spi_transfer *transfer) { struct dw_spi *dws = spi_controller_get_devdata(master); struct chip_data *chip = spi_get_ctldata(spi); u8 imask = 0; u16 txlevel = 0; u32 cr0; int ret; dws->dma_mapped = 0; dws->tx = (void *)transfer->tx_buf; dws->tx_end = dws->tx + transfer->len; dws->rx = transfer->rx_buf; dws->rx_end = dws->rx + transfer->len; dws->len = transfer->len; spi_enable_chip(dws, 0); /* Handle per transfer options for bpw and speed */ if (transfer->speed_hz != dws->current_freq) { if (transfer->speed_hz != chip->speed_hz) { /* clk_div doesn't support odd number */ chip->clk_div = (DIV_ROUND_UP(dws->max_freq, transfer->speed_hz) + 1) & 0xfffe; chip->speed_hz = transfer->speed_hz; } dws->current_freq = transfer->speed_hz; spi_set_clk(dws, chip->clk_div); } dws->n_bytes = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE); dws->dma_width = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE); /* Default SPI mode is SCPOL = 0, SCPH = 0 */ cr0 = (transfer->bits_per_word - 1) | (chip->type << SPI_FRF_OFFSET) | ((((spi->mode & SPI_CPOL) ? 1 : 0) << SPI_SCOL_OFFSET) | (((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET)) | (chip->tmode << SPI_TMOD_OFFSET); /* * Adjust transfer mode if necessary. Requires platform dependent * chipselect mechanism. */ if (chip->cs_control) { if (dws->rx && dws->tx) chip->tmode = SPI_TMOD_TR; else if (dws->rx) chip->tmode = SPI_TMOD_RO; else chip->tmode = SPI_TMOD_TO; cr0 &= ~SPI_TMOD_MASK; cr0 |= (chip->tmode << SPI_TMOD_OFFSET); } dw_writel(dws, DW_SPI_CTRL0, cr0); /* Check if current transfer is a DMA transaction */ if (master->can_dma && master->can_dma(master, spi, transfer)) dws->dma_mapped = master->cur_msg_mapped; /* For poll mode just disable all interrupts */ spi_mask_intr(dws, 0xff); /* * Interrupt mode * we only need set the TXEI IRQ, as TX/RX always happen syncronizely */ if (dws->dma_mapped) { ret = dws->dma_ops->dma_setup(dws, transfer); if (ret < 0) { spi_enable_chip(dws, 1); return ret; } } else if (!chip->poll_mode) { txlevel = min_t(u16, dws->fifo_len / 2, dws->len / dws->n_bytes); dw_writel(dws, DW_SPI_TXFLTR, txlevel); /* Set the interrupt mask */ imask |= SPI_INT_TXEI | SPI_INT_TXOI | SPI_INT_RXUI | SPI_INT_RXOI; spi_umask_intr(dws, imask); dws->transfer_handler = interrupt_transfer; } spi_enable_chip(dws, 1); if (dws->dma_mapped) { ret = dws->dma_ops->dma_transfer(dws, transfer); if (ret < 0) return ret; } if (chip->poll_mode) return poll_transfer(dws); return 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Synchronization"], "explanation": "An issue was discovered in the Linux kernel before 5.4.17. drivers/spi/spi-dw.c allows attackers to cause a panic via concurrent calls to dw_spi_irq and dw_spi_transfer_one, aka CID-19b61392c5a8.", "severity_level": "NoInfo", "cwe": "CWE-662", "cve": "CVE-2020-12769"}} -{"idx": 447677, "input": "static char *oidc_get_state_cookie_name(request_rec *r, const char *state) { return apr_psprintf(r->pool, \"%s%s\", OIDC_STATE_COOKIE_PREFIX, state); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 291417, "input": "PHP_FUNCTION(openssl_pkey_new) { struct php_x509_request req; zval * args = NULL; zval *data; if (zend_parse_parameters(ZEND_NUM_ARGS(), \"|a!\", &args) == FAILURE) { return; } RETVAL_FALSE; if (args && Z_TYPE_P(args) == IS_ARRAY) { EVP_PKEY *pkey; if ((data = zend_hash_str_find(Z_ARRVAL_P(args), \"rsa\", sizeof(\"rsa\")-1)) != NULL && Z_TYPE_P(data) == IS_ARRAY) { pkey = EVP_PKEY_new(); if (pkey) { RSA *rsa = RSA_new(); if (rsa) { if (php_openssl_pkey_init_and_assign_rsa(pkey, rsa, data)) { RETURN_RES(zend_register_resource(pkey, le_key)); } RSA_free(rsa); } else { php_openssl_store_errors(); } EVP_PKEY_free(pkey); } else { php_openssl_store_errors(); } RETURN_FALSE; } else if ((data = zend_hash_str_find(Z_ARRVAL_P(args), \"dsa\", sizeof(\"dsa\") - 1)) != NULL && Z_TYPE_P(data) == IS_ARRAY) { pkey = EVP_PKEY_new(); if (pkey) { DSA *dsa = DSA_new(); if (dsa) { if (php_openssl_pkey_init_dsa(dsa, data)) { if (EVP_PKEY_assign_DSA(pkey, dsa)) { RETURN_RES(zend_register_resource(pkey, le_key)); } else { php_openssl_store_errors(); } } DSA_free(dsa); } else { php_openssl_store_errors(); } EVP_PKEY_free(pkey); } else { php_openssl_store_errors(); } RETURN_FALSE; } else if ((data = zend_hash_str_find(Z_ARRVAL_P(args), \"dh\", sizeof(\"dh\") - 1)) != NULL && Z_TYPE_P(data) == IS_ARRAY) { pkey = EVP_PKEY_new(); if (pkey) { DH *dh = DH_new(); if (dh) { if (php_openssl_pkey_init_dh(dh, data)) { if (EVP_PKEY_assign_DH(pkey, dh)) { ZVAL_COPY_VALUE(return_value, zend_list_insert(pkey, le_key)); return; } else { php_openssl_store_errors(); } } DH_free(dh); } else { php_openssl_store_errors(); } EVP_PKEY_free(pkey); } else { php_openssl_store_errors(); } RETURN_FALSE; #ifdef HAVE_EVP_PKEY_EC } else if ((data = zend_hash_str_find(Z_ARRVAL_P(args), \"ec\", sizeof(\"ec\") - 1)) != NULL && Z_TYPE_P(data) == IS_ARRAY) { EC_KEY *eckey = NULL; EC_GROUP *group = NULL; EC_POINT *pnt = NULL; BIGNUM *d = NULL; pkey = EVP_PKEY_new(); if (pkey) { eckey = EC_KEY_new(); if (eckey) { EC_GROUP *group = NULL; zval *bn; zval *x; zval *y; if ((bn = zend_hash_str_find(Z_ARRVAL_P(data), \"curve_name\", sizeof(\"curve_name\") - 1)) != NULL && Z_TYPE_P(bn) == IS_STRING) { int nid = OBJ_sn2nid(Z_STRVAL_P(bn)); if (nid != NID_undef) { group = EC_GROUP_new_by_curve_name(nid); if (!group) { php_openssl_store_errors(); goto clean_exit; } EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE); EC_GROUP_set_point_conversion_form(group, POINT_CONVERSION_UNCOMPRESSED); if (!EC_KEY_set_group(eckey, group)) { php_openssl_store_errors(); goto clean_exit; } } } if (group == NULL) { php_error_docref(NULL, E_WARNING, \"Unknown curve_name\"); goto clean_exit; } // The public key 'pnt' can be calculated from 'd' or is defined by 'x' and 'y' if ((bn = zend_hash_str_find(Z_ARRVAL_P(data), \"d\", sizeof(\"d\") - 1)) != NULL && Z_TYPE_P(bn) == IS_STRING) { d = BN_bin2bn((unsigned char*) Z_STRVAL_P(bn), Z_STRLEN_P(bn), NULL); if (!EC_KEY_set_private_key(eckey, d)) { php_openssl_store_errors(); goto clean_exit; } // Calculate the public key by multiplying the Point Q with the public key // P = d * Q pnt = EC_POINT_new(group); if (!pnt || !EC_POINT_mul(group, pnt, d, NULL, NULL, NULL)) { php_openssl_store_errors(); goto clean_exit; } BN_free(d); } else if ((x = zend_hash_str_find(Z_ARRVAL_P(data), \"x\", sizeof(\"x\") - 1)) != NULL && Z_TYPE_P(x) == IS_STRING && (y = zend_hash_str_find(Z_ARRVAL_P(data), \"y\", sizeof(\"y\") - 1)) != NULL && Z_TYPE_P(y) == IS_STRING) { pnt = EC_POINT_new(group); if (pnt == NULL) { php_openssl_store_errors(); goto clean_exit; } if (!EC_POINT_set_affine_coordinates_GFp( group, pnt, BN_bin2bn((unsigned char*) Z_STRVAL_P(x), Z_STRLEN_P(x), NULL), BN_bin2bn((unsigned char*) Z_STRVAL_P(y), Z_STRLEN_P(y), NULL), NULL)) { php_openssl_store_errors(); goto clean_exit; } } if (pnt != NULL) { if (!EC_KEY_set_public_key(eckey, pnt)) { php_openssl_store_errors(); goto clean_exit; } EC_POINT_free(pnt); pnt = NULL; } if (!EC_KEY_check_key(eckey)) { PHP_OPENSSL_RAND_ADD_TIME(); EC_KEY_generate_key(eckey); php_openssl_store_errors(); } if (EC_KEY_check_key(eckey) && EVP_PKEY_assign_EC_KEY(pkey, eckey)) { EC_GROUP_free(group); RETURN_RES(zend_register_resource(pkey, le_key)); } else { php_openssl_store_errors(); } } else { php_openssl_store_errors(); } } else { php_openssl_store_errors(); } clean_exit: if (d != NULL) { BN_free(d); } if (pnt != NULL) { EC_POINT_free(pnt); } if (group != NULL) { EC_GROUP_free(group); } if (eckey != NULL) { EC_KEY_free(eckey); } if (pkey != NULL) { EVP_PKEY_free(pkey); } RETURN_FALSE; #endif } } PHP_SSL_REQ_INIT(&req); if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) { if (php_openssl_generate_private_key(&req)) { /* pass back a key resource */ RETVAL_RES(zend_register_resource(req.priv_key, le_key)); /* make sure the cleanup code doesn't zap it! */ req.priv_key = NULL; } } PHP_SSL_REQ_DISPOSE(&req); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328346, "input": "static int nf_tables_newsetelem(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr * const nla[]) { struct nftables_pernet *nft_net = nft_pernet(info->net); struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_next(info->net); struct net *net = info->net; const struct nlattr *attr; struct nft_set *set; struct nft_ctx ctx; int rem, err; if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) return -EINVAL; err = nft_ctx_init_from_elemattr(&ctx, net, skb, info->nlh, nla, extack, genmask, NETLINK_CB(skb).portid); if (err < 0) return err; set = nft_set_lookup_global(net, ctx.table, nla[NFTA_SET_ELEM_LIST_SET], nla[NFTA_SET_ELEM_LIST_SET_ID], genmask); if (IS_ERR(set)) return PTR_ERR(set); if (!list_empty(&set->bindings) && set->flags & NFT_SET_CONSTANT) return -EBUSY; nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) { err = nft_add_set_elem(&ctx, set, attr, info->nlh->nlmsg_flags); if (err < 0) return err; } if (nft_net->validate_state == NFT_VALIDATE_DO) return nft_table_validate(net, ctx.table); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514782, "input": "static inline MemTxResult address_space_write_rom_internal(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, const void *ptr, hwaddr len, enum write_rom_type type) { hwaddr l; uint8_t *ram_ptr; hwaddr addr1; MemoryRegion *mr; const uint8_t *buf = ptr; RCU_READ_LOCK_GUARD(); while (len > 0) { l = len; mr = address_space_translate(as, addr, &addr1, &l, true, attrs); if (!(memory_region_is_ram(mr) || memory_region_is_romd(mr))) { l = memory_access_size(mr, l, addr1); } else { /* ROM/RAM case */ ram_ptr = qemu_map_ram_ptr(mr->ram_block, addr1); switch (type) { case WRITE_DATA: memcpy(ram_ptr, buf, l); invalidate_and_set_dirty(mr, addr1, l); break; case FLUSH_CACHE: flush_idcache_range((uintptr_t)ram_ptr, (uintptr_t)ram_ptr, l); break; } } len -= l; buf += l; addr += l; } return MEMTX_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342106, "input": "static int fuse_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { struct inode *inode = page->mapping->host; /* Haven't copied anything? Skip zeroing, size extending, dirtying. */ if (!copied) goto unlock; if (!PageUptodate(page)) { /* Zero any unwritten bytes at the end of the page */ size_t endoff = (pos + copied) & ~PAGE_MASK; if (endoff) zero_user_segment(page, endoff, PAGE_SIZE); SetPageUptodate(page); } fuse_write_update_size(inode, pos + copied); set_page_dirty(page); unlock: unlock_page(page); put_page(page); return copied; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430966, "input": "xdr_decode_nfstime4(__be32 *p, struct timespec64 *t) { __u64 sec; p = xdr_decode_hyper(p, &sec); t-> tv_sec = sec; t->tv_nsec = be32_to_cpup(p++); return p; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 520912, "input": "static Jsi_RC jsi_csSBitGetSet(Jsi_Interp *interp, void *vrec, Jsi_Wide* vPtr, Jsi_OptionSpec *spec, int idx, bool isSet) { Jsi_Wide *valPtr = (typeof(valPtr))vPtr; int bits = spec->bits; int boffs = spec->boffset; if (bits<1 || bits>=64) return JSI_ERROR; int ofs = (boffs/8); int bo = (boffs%8); // 0 if byte-aligned int Bsz = ((bits+bo+7)/8); uchar *rec = (uchar*)vrec; #ifdef __SIZEOF_INT128__ typedef __int128 stvalType; #else typedef Jsi_Wide stvalType; #endif stvalType tbuf[2] = {}; uchar sbuf[20], *bptr = (uchar*)tbuf; memcpy(tbuf, rec+ofs, Bsz); Jsi_Wide mval = *valPtr; Jsi_Wide amask = ((1LL<<(bits-1))-1LL); stvalType tval = 0, kval = 0, lmask; if (bo) { // If not byte aligned, get tval and shift bptr = sbuf; kval = tval = *(typeof(tval)*)tbuf; tval >>= bo; if (!isSet) { mval = (Jsi_Wide)tval; *(Jsi_Wide*)bptr = mval; } } if (!isSet) { // Get value. if (!jsi_csSBitSetGet(0, bptr, bits, &mval)) return JSI_ERROR; *valPtr = mval; return JSI_OK; } if (!jsi_csSBitSetGet(1, bptr, bits, &mval)) return JSI_ERROR; if (bo) { tval = (typeof(tval))mval; lmask=(amask<machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); alternative_instructions(); fpu__init_check_bugs(); #else /* CONFIG_X86_64 */ alternative_instructions(); /* * Make sure the first 2MB area is not mapped by huge pages * There are typically fixed size MTRRs in there and overlapping * MTRRs into large pages causes slow downs. * * Right now we don't do that with gbpages because there seems * very little benefit for that case. */ if (!direct_gbpages) set_memory_4k((unsigned long)__va(0), 1); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437595, "input": "static void init_vmcb(struct vcpu_svm *svm) { struct vmcb_control_area *control = &svm->vmcb->control; struct vmcb_save_area *save = &svm->vmcb->save; svm->vcpu.fpu_active = 1; svm->vcpu.arch.hflags = 0; set_cr_intercept(svm, INTERCEPT_CR0_READ); set_cr_intercept(svm, INTERCEPT_CR3_READ); set_cr_intercept(svm, INTERCEPT_CR4_READ); set_cr_intercept(svm, INTERCEPT_CR0_WRITE); set_cr_intercept(svm, INTERCEPT_CR3_WRITE); set_cr_intercept(svm, INTERCEPT_CR4_WRITE); set_cr_intercept(svm, INTERCEPT_CR8_WRITE); set_dr_intercepts(svm); set_exception_intercept(svm, PF_VECTOR); set_exception_intercept(svm, UD_VECTOR); set_exception_intercept(svm, MC_VECTOR); set_intercept(svm, INTERCEPT_INTR); set_intercept(svm, INTERCEPT_NMI); set_intercept(svm, INTERCEPT_SMI); set_intercept(svm, INTERCEPT_SELECTIVE_CR0); set_intercept(svm, INTERCEPT_RDPMC); set_intercept(svm, INTERCEPT_CPUID); set_intercept(svm, INTERCEPT_INVD); set_intercept(svm, INTERCEPT_HLT); set_intercept(svm, INTERCEPT_INVLPG); set_intercept(svm, INTERCEPT_INVLPGA); set_intercept(svm, INTERCEPT_IOIO_PROT); set_intercept(svm, INTERCEPT_MSR_PROT); set_intercept(svm, INTERCEPT_TASK_SWITCH); set_intercept(svm, INTERCEPT_SHUTDOWN); set_intercept(svm, INTERCEPT_VMRUN); set_intercept(svm, INTERCEPT_VMMCALL); set_intercept(svm, INTERCEPT_VMLOAD); set_intercept(svm, INTERCEPT_VMSAVE); set_intercept(svm, INTERCEPT_STGI); set_intercept(svm, INTERCEPT_CLGI); set_intercept(svm, INTERCEPT_SKINIT); set_intercept(svm, INTERCEPT_WBINVD); set_intercept(svm, INTERCEPT_MONITOR); set_intercept(svm, INTERCEPT_MWAIT); set_intercept(svm, INTERCEPT_XSETBV); control->iopm_base_pa = iopm_base; control->msrpm_base_pa = __pa(svm->msrpm); control->int_ctl = V_INTR_MASKING_MASK; init_seg(&save->es); init_seg(&save->ss); init_seg(&save->ds); init_seg(&save->fs); init_seg(&save->gs); save->cs.selector = 0xf000; save->cs.base = 0xffff0000; /* Executable/Readable Code Segment */ save->cs.attrib = SVM_SELECTOR_READ_MASK | SVM_SELECTOR_P_MASK | SVM_SELECTOR_S_MASK | SVM_SELECTOR_CODE_MASK; save->cs.limit = 0xffff; save->gdtr.limit = 0xffff; save->idtr.limit = 0xffff; init_sys_seg(&save->ldtr, SEG_TYPE_LDT); init_sys_seg(&save->tr, SEG_TYPE_BUSY_TSS16); svm_set_efer(&svm->vcpu, 0); save->dr6 = 0xffff0ff0; kvm_set_rflags(&svm->vcpu, 2); save->rip = 0x0000fff0; svm->vcpu.arch.regs[VCPU_REGS_RIP] = save->rip; /* * This is the guest-visible cr0 value. * svm_set_cr0() sets PG and WP and clears NW and CD on save->cr0. */ svm->vcpu.arch.cr0 = 0; (void)kvm_set_cr0(&svm->vcpu, X86_CR0_NW | X86_CR0_CD | X86_CR0_ET); save->cr4 = X86_CR4_PAE; /* rdx = ?? */ if (npt_enabled) { /* Setup VMCB for Nested Paging */ control->nested_ctl = 1; clr_intercept(svm, INTERCEPT_INVLPG); clr_exception_intercept(svm, PF_VECTOR); clr_cr_intercept(svm, INTERCEPT_CR3_READ); clr_cr_intercept(svm, INTERCEPT_CR3_WRITE); save->g_pat = 0x0007040600070406ULL; save->cr3 = 0; save->cr4 = 0; } svm->asid_generation = 0; svm->nested.vmcb = 0; svm->vcpu.arch.hflags = 0; if (boot_cpu_has(X86_FEATURE_PAUSEFILTER)) { control->pause_filter_count = 3000; set_intercept(svm, INTERCEPT_PAUSE); } mark_all_dirty(svm->vmcb); enable_gif(svm); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202140, "input": "MagickExport Image *WaveImage(const Image *image,const double amplitude, const double wave_length,const PixelInterpolateMethod method, ExceptionInfo *exception) { #define WaveImageTag \"Wave/Image\" CacheView *canvas_image_view, *wave_view; float *sine_map; Image *canvas_image, *wave_image; MagickBooleanType status; MagickOffsetType progress; ssize_t i; ssize_t y; /* Initialize wave image attributes. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); canvas_image=CloneImage(image,0,0,MagickTrue,exception); if (canvas_image == (Image *) NULL) return((Image *) NULL); if ((canvas_image->alpha_trait == UndefinedPixelTrait) && (canvas_image->background_color.alpha != OpaqueAlpha)) (void) SetImageAlpha(canvas_image,OpaqueAlpha,exception); wave_image=CloneImage(canvas_image,canvas_image->columns,(size_t) (canvas_image->rows+2.0*fabs(amplitude)),MagickTrue,exception); if (wave_image == (Image *) NULL) { canvas_image=DestroyImage(canvas_image); return((Image *) NULL); } if (SetImageStorageClass(wave_image,DirectClass,exception) == MagickFalse) { canvas_image=DestroyImage(canvas_image); wave_image=DestroyImage(wave_image); return((Image *) NULL); } /* Allocate sine map. */ sine_map=(float *) AcquireQuantumMemory((size_t) wave_image->columns, sizeof(*sine_map)); if (sine_map == (float *) NULL) { canvas_image=DestroyImage(canvas_image); wave_image=DestroyImage(wave_image); ThrowImageException(ResourceLimitError,\"MemoryAllocationFailed\"); } for (i=0; i < (ssize_t) wave_image->columns; i++) sine_map[i]=(float) fabs(amplitude)+amplitude*sin((double) ((2.0*MagickPI*i)/wave_length)); /* Wave image. */ status=MagickTrue; progress=0; canvas_image_view=AcquireVirtualCacheView(canvas_image,exception); wave_view=AcquireAuthenticCacheView(wave_image,exception); (void) SetCacheViewVirtualPixelMethod(canvas_image_view, BackgroundVirtualPixelMethod); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \\ magick_number_threads(canvas_image,wave_image,wave_image->rows,1) #endif for (y=0; y < (ssize_t) wave_image->rows; y++) { const Quantum *magick_restrict p; Quantum *magick_restrict q; ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(canvas_image_view,0,y,canvas_image->columns,1, exception); q=QueueCacheViewAuthenticPixels(wave_view,0,y,wave_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) wave_image->columns; x++) { status=InterpolatePixelChannels(canvas_image,canvas_image_view, wave_image,method,(double) x,(double) (y-sine_map[x]),q,exception); if (status == MagickFalse) break; p+=GetPixelChannels(canvas_image); q+=GetPixelChannels(wave_image); } if (SyncCacheViewAuthenticPixels(wave_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(canvas_image,WaveImageTag,progress, canvas_image->rows); if (proceed == MagickFalse) status=MagickFalse; } } wave_view=DestroyCacheView(wave_view); canvas_image_view=DestroyCacheView(canvas_image_view); canvas_image=DestroyImage(canvas_image); sine_map=(float *) RelinquishMagickMemory(sine_map); if (status == MagickFalse) wave_image=DestroyImage(wave_image); return(wave_image); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "A flaw was found in ImageMagick in versions before 7.0.11 and before 6.9.12, where a division by zero in WaveImage() of MagickCore/visual-effects.c may trigger undefined behavior via a crafted image file submitted to an application using ImageMagick. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-20309"}} -{"idx": 481069, "input": "xdr_free_bvec(struct xdr_buf *buf) { kfree(buf->bvec); buf->bvec = NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 460788, "input": "au_exists(char_u *arg) { char_u *arg_save; char_u *pattern = NULL; char_u *event_name; char_u *p; event_T event; AutoPat *ap; buf_T *buflocal_buf = NULL; int group; int retval = FALSE; /* Make a copy so that we can change the '#' chars to a NUL. */ arg_save = vim_strsave(arg); if (arg_save == NULL) return FALSE; p = vim_strchr(arg_save, '#'); if (p != NULL) *p++ = NUL; /* First, look for an autocmd group name */ group = au_find_group(arg_save); if (group == AUGROUP_ERROR) { /* Didn't match a group name, assume the first argument is an event. */ group = AUGROUP_ALL; event_name = arg_save; } else { if (p == NULL) { /* \"Group\": group name is present and it's recognized */ retval = TRUE; goto theend; } /* Must be \"Group#Event\" or \"Group#Event#pat\". */ event_name = p; p = vim_strchr(event_name, '#'); if (p != NULL) *p++ = NUL; /* \"Group#Event#pat\" */ } pattern = p; /* \"pattern\" is NULL when there is no pattern */ /* find the index (enum) for the event name */ event = event_name2nr(event_name, &p); /* return FALSE if the event name is not recognized */ if (event == NUM_EVENTS) goto theend; /* Find the first autocommand for this event. * If there isn't any, return FALSE; * If there is one and no pattern given, return TRUE; */ ap = first_autopat[(int)event]; if (ap == NULL) goto theend; /* if pattern is \"\", special handling is needed which uses curbuf */ /* for pattern \", fnamecmp() will work fine */ if (pattern != NULL && STRICMP(pattern, \"\") == 0) buflocal_buf = curbuf; /* Check if there is an autocommand with the given pattern. */ for ( ; ap != NULL; ap = ap->next) /* only use a pattern when it has not been removed and has commands. */ /* For buffer-local autocommands, fnamecmp() works fine. */ if (ap->pat != NULL && ap->cmds != NULL && (group == AUGROUP_ALL || ap->group == group) && (pattern == NULL || (buflocal_buf == NULL ? fnamecmp(ap->pat, pattern) == 0 : ap->buflocal_nr == buflocal_buf->b_fnum))) { retval = TRUE; break; } theend: vim_free(arg_save); return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394648, "input": "void LJ_FASTCALL lj_trace_free(global_State *g, GCtrace *T) { jit_State *J = G2J(g); if (T->traceno) { lj_gdbjit_deltrace(J, T); if (T->traceno < J->freetrace) J->freetrace = T->traceno; setgcrefnull(J->trace[T->traceno]); } lj_mem_free(g, T, ((sizeof(GCtrace)+7)&~7) + (T->nins-T->nk)*sizeof(IRIns) + T->nsnap*sizeof(SnapShot) + T->nsnapmap*sizeof(SnapEntry)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379422, "input": "get_groupset (self) SHELL_VAR *self; { register int i; int ng; ARRAY *a; static char **group_set = (char **)NULL; if (group_set == 0) { group_set = get_group_list (&ng); a = array_cell (self); for (i = 0; i < ng; i++) array_insert (a, i, group_set[i]); } return (self); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417778, "input": "SplineFont *_SFDRead(char *filename,FILE *sfd) { return( SFD_Read(filename,sfd,false)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281372, "input": "void RGWListBucket_ObjStore_S3::send_response() { if (op_ret < 0) set_req_state_err(s, op_ret); dump_errno(s); // Explicitly use chunked transfer encoding so that we can stream the result // to the user without having to wait for the full length of it. end_header(s, this, \"application/xml\", CHUNKED_TRANSFER_ENCODING); dump_start(s); if (op_ret < 0) return; if (list_versions) { send_versioned_response(); return; } s->formatter->open_object_section_in_ns(\"ListBucketResult\", XMLNS_AWS_S3); if (!s->bucket_tenant.empty()) s->formatter->dump_string(\"Tenant\", s->bucket_tenant); s->formatter->dump_string(\"Name\", s->bucket_name); s->formatter->dump_string(\"Prefix\", prefix); s->formatter->dump_string(\"Marker\", marker.name); if (is_truncated && !next_marker.empty()) s->formatter->dump_string(\"NextMarker\", next_marker.name); s->formatter->dump_int(\"MaxKeys\", max); if (!delimiter.empty()) s->formatter->dump_string(\"Delimiter\", delimiter); s->formatter->dump_string(\"IsTruncated\", (max && is_truncated ? \"true\" : \"false\")); bool encode_key = false; if (strcasecmp(encoding_type.c_str(), \"url\") == 0) { s->formatter->dump_string(\"EncodingType\", \"url\"); encode_key = true; } if (op_ret >= 0) { vector::iterator iter; for (iter = objs.begin(); iter != objs.end(); ++iter) { rgw_obj_key key(iter->key); s->formatter->open_array_section(\"Contents\"); if (encode_key) { string key_name; url_encode(key.name, key_name); s->formatter->dump_string(\"Key\", key_name); } else { s->formatter->dump_string(\"Key\", key.name); } dump_time(s, \"LastModified\", &iter->meta.mtime); s->formatter->dump_format(\"ETag\", \"\\\"%s\\\"\", iter->meta.etag.c_str()); s->formatter->dump_int(\"Size\", iter->meta.accounted_size); s->formatter->dump_string(\"StorageClass\", \"STANDARD\"); dump_owner(s, iter->meta.owner, iter->meta.owner_display_name); if (s->system_request) { s->formatter->dump_string(\"RgwxTag\", iter->tag); } s->formatter->close_section(); } if (!common_prefixes.empty()) { map::iterator pref_iter; for (pref_iter = common_prefixes.begin(); pref_iter != common_prefixes.end(); ++pref_iter) { s->formatter->open_array_section(\"CommonPrefixes\"); s->formatter->dump_string(\"Prefix\", pref_iter->first); s->formatter->close_section(); } } } s->formatter->close_section(); rgw_flush_formatter_and_reset(s, s->formatter); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230186, "input": "bool JSObject::isSealed(PseudoHandle self, Runtime *runtime) { if (self->flags_.sealed) return true; if (!self->flags_.noExtend) return false; auto selfHandle = runtime->makeHandle(std::move(self)); if (!HiddenClass::areAllNonConfigurable( runtime->makeHandle(selfHandle->clazz_), runtime)) { return false; } if (!checkAllOwnIndexed( *selfHandle, runtime, ObjectVTable::CheckAllOwnIndexedMode::NonConfigurable)) { return false; } // Now that we know we are sealed, set the flag. selfHandle->flags_.sealed = true; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 375286, "input": "void setup_new_exec(struct linux_binprm * bprm) { /* * Once here, prepare_binrpm() will not be called any more, so * the final state of setuid/setgid/fscaps can be merged into the * secureexec flag. */ bprm->secureexec |= bprm->cap_elevated; if (bprm->secureexec) { /* Make sure parent cannot signal privileged process. */ current->pdeath_signal = 0; /* * For secureexec, reset the stack limit to sane default to * avoid bad behavior from the prior rlimits. This has to * happen before arch_pick_mmap_layout(), which examines * RLIMIT_STACK, but after the point of no return to avoid * needing to clean up the change on failure. */ if (bprm->rlim_stack.rlim_cur > _STK_LIM) bprm->rlim_stack.rlim_cur = _STK_LIM; } arch_pick_mmap_layout(current->mm, &bprm->rlim_stack); current->sas_ss_sp = current->sas_ss_size = 0; /* * Figure out dumpability. Note that this checking only of current * is wrong, but userspace depends on it. This should be testing * bprm->secureexec instead. */ if (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP || !(uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid()))) set_dumpable(current->mm, suid_dumpable); else set_dumpable(current->mm, SUID_DUMP_USER); arch_setup_new_exec(); perf_event_exec(); __set_task_comm(current, kbasename(bprm->filename), true); /* Set the new mm task size. We have to do that late because it may * depend on TIF_32BIT which is only updated in flush_thread() on * some architectures like powerpc */ current->mm->task_size = TASK_SIZE; /* An exec changes our domain. We are no longer part of the thread group */ WRITE_ONCE(current->self_exec_id, current->self_exec_id + 1); flush_signal_handlers(current, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270285, "input": "void Compute(OpKernelContext* context) override { SparseTensorsMap* map = nullptr; OP_REQUIRES_OK(context, GetMap(context, false /* is_writing */, &map)); const Tensor& sparse_handles = context->input(0); OP_REQUIRES(context, TensorShapeUtils::IsVector(sparse_handles.shape()), errors::InvalidArgument( \"sparse_handles should be a vector but received shape \", sparse_handles.shape().DebugString())); int64 N = sparse_handles.shape().dim_size(0); OP_REQUIRES( context, N > 0, errors::InvalidArgument(\"Must have at least 1 serialized SparseTensor, \" \"but input matrix has 0 rows\")); std::vector indices_to_concat; std::vector values_to_concat; std::vector shapes_to_concat; const auto& sparse_handles_t = sparse_handles.vec(); std::vector sparse_tensors; OP_REQUIRES_OK(context, map->RetrieveAndClearSparseTensors( context, sparse_handles_t, &sparse_tensors)); for (int64 i = 0; i < N; ++i) { const SparseTensor& st = sparse_tensors[i]; const Tensor& output_indices = st.indices(); const Tensor& output_values = st.values(); const auto output_shape = st.shape(); OP_REQUIRES(context, TensorShapeUtils::IsMatrix(output_indices.shape()), errors::InvalidArgument( \"Expected sparse_handles[\", i, \"] to represent an index matrix but received shape \", output_indices.shape().DebugString())); OP_REQUIRES(context, TensorShapeUtils::IsVector(output_values.shape()), errors::InvalidArgument( \"Expected sparse_handles[\", i, \"] to represent a values vector but received shape \", output_values.shape().DebugString())); OP_REQUIRES( context, DataTypeToEnum::value == output_values.dtype(), errors::InvalidArgument( \"Requested SparseTensor of type \", DataTypeString(DataTypeToEnum::value), \" but SparseTensor[\", i, \"].values.dtype() == \", DataTypeString(output_values.dtype()))); int64 num_entries = output_indices.dim_size(0); OP_REQUIRES(context, num_entries == output_values.dim_size(0), errors::InvalidArgument( \"Expected row counts of SparseTensor[\", i, \"].indices and SparseTensor[\", i, \"].values to match but they do not: \", num_entries, \" vs. \", output_values.dim_size(0))); int rank = output_indices.dim_size(1); OP_REQUIRES( context, rank == output_shape.size(), errors::InvalidArgument(\"Expected column counts of SparseTensor[\", i, \"].indices to match size of SparseTensor[\", i, \"].shape \" \"but they do not: \", rank, \" vs. \", output_shape.size())); // Now we expand each SparseTensors' indices and shape by // prefixing a dimension Tensor expanded_indices( DT_INT64, TensorShape({num_entries, 1 + output_indices.dim_size(1)})); Tensor expanded_shape(DT_INT64, TensorShape({1 + rank})); const auto& output_indices_t = output_indices.matrix(); auto expanded_indices_t = expanded_indices.matrix(); auto expanded_shape_t = expanded_shape.vec(); expanded_indices_t.chip<1>(0).setZero(); Eigen::DSizes indices_start(0, 1); Eigen::DSizes indices_sizes(num_entries, rank); expanded_indices_t.slice(indices_start, indices_sizes) = output_indices_t; expanded_shape_t(0) = 1; // TODO: copy shape from TensorShape to &expanded_shape_t(1) // std::copy_n(&output_shape_t(0), rank, &expanded_shape_t(1)); for (int i = 0; i < rank; ++i) { expanded_shape_t(i + 1) = output_shape[i]; } TensorShape expanded_tensor_shape(expanded_shape_t); indices_to_concat.push_back(std::move(expanded_indices)); values_to_concat.push_back(output_values); shapes_to_concat.push_back(std::move(expanded_tensor_shape)); } int rank = -1; for (int i = 0; i < N; ++i) { if (rank < 0) rank = shapes_to_concat[i].dims(); OP_REQUIRES(context, rank == shapes_to_concat[i].dims(), errors::InvalidArgument( \"Inconsistent rank across SparseTensors: rank prior to \" \"SparseTensor[\", i, \"] was: \", rank, \" but rank of SparseTensor[\", i, \"] is: \", shapes_to_concat[i].dims())); } // SparseTensor::Concat requires consistent shape for all but the // primary order dimension (dimension 0 in this case). So we get // the maximum value across all the input SparseTensors for each // dimension and use that. TensorShape preconcat_shape(shapes_to_concat[0]); for (int i = 0; i < N; ++i) { for (int d = 0; d < rank; ++d) { preconcat_shape.set_dim(d, std::max(preconcat_shape.dim_size(d), shapes_to_concat[i].dim_size(d))); } } // Dimension 0 is the primary dimension. gtl::InlinedVector std_order(rank); std::iota(std_order.begin(), std_order.end(), 0); std::vector tensors_to_concat; tensors_to_concat.reserve(N); for (int i = 0; i < N; ++i) { SparseTensor tensor; OP_REQUIRES_OK(context, SparseTensor::Create(std::move(indices_to_concat[i]), std::move(values_to_concat[i]), preconcat_shape, std_order, &tensor)); tensors_to_concat.push_back(std::move(tensor)); } auto output = SparseTensor::Concat(tensors_to_concat); Tensor final_output_shape(DT_INT64, TensorShape({output.dims()})); std::copy_n(output.shape().data(), output.dims(), final_output_shape.vec().data()); context->set_output(0, output.indices()); context->set_output(1, output.values()); context->set_output(2, final_output_shape); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 451911, "input": "static void news2mail(message_data_t *msg) { struct buf attrib = BUF_INITIALIZER; int n, r; FILE *sm; static strarray_t smbuf = STRARRAY_INITIALIZER; static int smbuf_basic_count; int sm_stat; pid_t sm_pid; char buf[4096], to[1024] = \"\"; if (!smbuf.count) { strarray_append(&smbuf, \"sendmail\"); strarray_append(&smbuf, \"-i\"); /* ignore dots */ strarray_append(&smbuf, \"-f\"); strarray_append(&smbuf, \"<>\"); strarray_append(&smbuf, \"--\"); smbuf_basic_count = smbuf.count; } for (n = 0; n < msg->rcpt.count ; n++) { /* see if we want to send this to a mailing list */ buf_free(&attrib); r = annotatemore_lookup(msg->rcpt.data[n], \"/vendor/cmu/cyrus-imapd/news2mail\", \"\", &attrib); if (r) continue; /* add the email address to our argv[] and to our To: header */ if (attrib.s) { strarray_append(&smbuf, buf_cstring(&attrib)); if (to[0]) strlcat(to, \", \", sizeof(to)); strlcat(to, buf_cstring(&attrib), sizeof(to)); } } buf_free(&attrib); /* send the message */ if (smbuf.count > smbuf_basic_count) { sm_pid = open_sendmail((const char **)smbuf.data, &sm); if (!sm) syslog(LOG_ERR, \"news2mail: could not spawn sendmail process\"); else { int body = 0, skip, found_to = 0; rewind(msg->f); while (fgets(buf, sizeof(buf), msg->f)) { if (!body && buf[0] == '\\r' && buf[1] == '\\n') { /* blank line between header and body */ body = 1; /* insert a To: header if the message doesn't have one */ if (!found_to) fprintf(sm, \"To: %s\\r\\n\", to); } skip = 0; if (!body) { /* munge various news-specific headers */ if (!strncasecmp(buf, \"Newsgroups:\", 11)) { /* rename Newsgroups: to X-Newsgroups: */ fprintf(sm, \"X-\"); } else if (!strncasecmp(buf, \"Xref:\", 5) || !strncasecmp(buf, \"Path:\", 5) || !strncasecmp(buf, \"NNTP-Posting-\", 13)) { /* skip these (for now) */ skip = 1; } else if (!strncasecmp(buf, \"To:\", 3)) { /* insert our mailing list RCPTs first, and then fold the header to accomodate the original RCPTs */ fprintf(sm, \"To: %s,\\r\\n\", to); /* overwrite the original \"To:\" with spaces */ memset(buf, ' ', 3); found_to = 1; } else if (!strncasecmp(buf, \"Reply-To:\", 9)) { /* strip any post addresses, skip if becomes empty */ if (!strip_post_addresses(buf+9)) skip = 1; } } do { if (!skip) fprintf(sm, \"%s\", buf); } while (buf[strlen(buf)-1] != '\\n' && fgets(buf, sizeof(buf), msg->f)); } /* Protect against messages not ending in CRLF */ if (buf[strlen(buf)-1] != '\\n') fprintf(sm, \"\\r\\n\"); fclose(sm); while (waitpid(sm_pid, &sm_stat, 0) < 0); if (sm_stat) /* sendmail exit value */ syslog(LOG_ERR, \"news2mail failed: %s\", sendmail_errstr(sm_stat)); } /* free the RCPTs */ strarray_truncate(&smbuf, smbuf_basic_count); } return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 254699, "input": "static bool pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *field) { pb_field_iter_t old_field = *field; pb_size_t old_tag = *(pb_size_t*)field->pSize; /* Previous which_ value */ pb_size_t new_tag = field->tag; /* New which_ value */ if (old_tag == 0) return true; /* Ok, no old data in union */ if (old_tag == new_tag) return true; /* Ok, old data is of same type => merge */ /* Release old data. The find can fail if the message struct contains * invalid data. */ if (!pb_field_iter_find(&old_field, old_tag)) PB_RETURN_ERROR(stream, \"invalid union tag\"); pb_release_single_field(&old_field); if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) { /* Initialize the pointer to NULL to make sure it is valid * even in case of error return. */ *(void**)field->pField = NULL; field->pData = NULL; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267315, "input": "Bool sg_rap_compare_entry(void *udta, void *entry) { u32 *num_leading_samples = (u32 *) udta; if (*num_leading_samples == ((GF_VisualRandomAccessEntry *)entry)->num_leading_samples) return GF_TRUE; return GF_FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279701, "input": "static void smbd_notify_cancel_by_map(struct notify_mid_map *map) { struct smb_request *smbreq = map->req->req; struct smbd_server_connection *sconn = smbreq->sconn; struct smbd_smb2_request *smb2req = smbreq->smb2req; NTSTATUS notify_status = NT_STATUS_CANCELLED; if (smb2req != NULL) { NTSTATUS sstatus; if (smb2req->session == NULL) { sstatus = NT_STATUS_USER_SESSION_DELETED; } else { sstatus = smb2req->session->status; } if (NT_STATUS_EQUAL(sstatus, NT_STATUS_NETWORK_SESSION_EXPIRED)) { sstatus = NT_STATUS_OK; } if (!NT_STATUS_IS_OK(sstatus)) { notify_status = STATUS_NOTIFY_CLEANUP; } else if (smb2req->tcon == NULL) { notify_status = STATUS_NOTIFY_CLEANUP; } else if (!NT_STATUS_IS_OK(smb2req->tcon->status)) { notify_status = STATUS_NOTIFY_CLEANUP; } } change_notify_reply(smbreq, notify_status, 0, NULL, map->req->reply_fn); change_notify_remove_request(sconn, map->req); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379989, "input": "static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, NULL); static ssize_t show_priv_session_creator(struct device *dev, struct device_attribute *attr, char *buf) {", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490152, "input": "int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) { struct ecryptfs_crypt_stat *crypt_stat = &ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->crypt_stat; unsigned int order; char *virt; size_t virt_len; size_t size = 0; int rc = 0; if (likely(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { if (!(crypt_stat->flags & ECRYPTFS_KEY_VALID)) { printk(KERN_ERR \"Key is invalid; bailing out\\n\"); rc = -EINVAL; goto out; } } else { printk(KERN_WARNING \"%s: Encrypted flag not set\\n\", __func__); rc = -EINVAL; goto out; } virt_len = crypt_stat->num_header_bytes_at_front; order = get_order(virt_len); /* Released in this function */ virt = (char *)ecryptfs_get_zeroed_pages(GFP_KERNEL, order); if (!virt) { printk(KERN_ERR \"%s: Out of memory\\n\", __func__); rc = -ENOMEM; goto out; } rc = ecryptfs_write_headers_virt(virt, virt_len, &size, crypt_stat, ecryptfs_dentry); if (unlikely(rc)) { printk(KERN_ERR \"%s: Error whilst writing headers; rc = [%d]\\n\", __func__, rc); goto out_free; } if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, virt, size); else rc = ecryptfs_write_metadata_to_contents(ecryptfs_dentry, virt, virt_len); if (rc) { printk(KERN_ERR \"%s: Error writing metadata out to lower file; \" \"rc = [%d]\\n\", __func__, rc); goto out_free; } out_free: free_pages((unsigned long)virt, order); out: return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412637, "input": "HRESULT Http::HrGetDestination(std::string *strDestination) { std::string strHost, strDest; // example: Host: server:port auto hr = HrGetHeaderValue(\"Host\", &strHost); if(hr != hrSuccess) { ec_log_debug(\"Http::HrGetDestination host header missing\"); return hr; } // example: Destination: http://server:port/caldav/username/folderid/entry.ics hr = HrGetHeaderValue(\"Destination\", &strDest); if (hr != hrSuccess) { ec_log_debug(\"Http::HrGetDestination destination header missing\"); return hr; } auto pos = strDest.find(strHost); if (pos == std::string::npos) { ec_log_err(\"Refusing to move calendar item from %s to different host on url %s\", strHost.c_str(), strDest.c_str()); return MAPI_E_CALL_FAILED; } strDest.erase(0, pos + strHost.length()); *strDestination = std::move(strDest); return hrSuccess; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215059, "input": "struct clock_source *dce100_clock_source_create( struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) { struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); if (!clk_src) return NULL; if (dce110_clk_src_construct(clk_src, ctx, bios, id, regs, &cs_shift, &cs_mask)) { clk_src->base.dp_clk_src = dp_clk_src; return &clk_src->base; } BREAK_TO_DEBUGGER(); return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "Memory leaks in *clock_source_create() functions under drivers/gpu/drm/amd/display/dc in the Linux kernel before 5.3.8 allow attackers to cause a denial of service (memory consumption). This affects the dce112_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c, the dce100_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c, the dcn10_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c, the dcn20_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c, the dce120_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c, the dce110_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c, and the dce80_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c, aka CID-055e547478a1.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2019-19083"}} -{"idx": 514555, "input": "bool setup_tables(THD *thd, Name_resolution_context *context, List *from_clause, TABLE_LIST *tables, List &leaves, bool select_insert, bool full_table_list) { uint tablenr= 0; List_iterator ti(leaves); TABLE_LIST *table_list; DBUG_ENTER(\"setup_tables\"); DBUG_ASSERT ((select_insert && !tables->next_name_resolution_table) || !tables || (context->table_list && context->first_name_resolution_table)); /* this is used for INSERT ... SELECT. For select we setup tables except first (and its underlying tables) */ TABLE_LIST *first_select_table= (select_insert ? tables->next_local: 0); SELECT_LEX *select_lex= select_insert ? thd->lex->first_select_lex() : thd->lex->current_select; if (select_lex->first_cond_optimization) { leaves.empty(); if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) { make_leaves_list(thd, leaves, tables, full_table_list, first_select_table); select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->leaf_tables_exec.empty(); } else { List_iterator_fast ti(select_lex->leaf_tables_prep); while ((table_list= ti++)) leaves.push_back(table_list, thd->mem_root); } while ((table_list= ti++)) { TABLE *table= table_list->table; if (table) table->pos_in_table_list= table_list; if (first_select_table && table_list->top_table() == first_select_table) { /* new counting for SELECT of INSERT ... SELECT command */ first_select_table= 0; thd->lex->first_select_lex()->insert_tables= tablenr; tablenr= 0; } if(table_list->jtbm_subselect) { table_list->jtbm_table_no= tablenr; } else if (table) { table->pos_in_table_list= table_list; setup_table_map(table, table_list, tablenr); if (table_list->process_index_hints(table)) DBUG_RETURN(1); } tablenr++; /* We test the max tables here as we setup_table_map() should not be called with tablenr >= 64 */ if (tablenr > MAX_TABLES) { my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); DBUG_RETURN(1); } } } else { List_iterator_fast ti(select_lex->leaf_tables_exec); select_lex->leaf_tables.empty(); while ((table_list= ti++)) { if(table_list->jtbm_subselect) { table_list->jtbm_table_no= table_list->tablenr_exec; } else { table_list->table->tablenr= table_list->tablenr_exec; table_list->table->map= table_list->map_exec; table_list->table->maybe_null= table_list->maybe_null_exec; table_list->table->pos_in_table_list= table_list; if (table_list->process_index_hints(table_list->table)) DBUG_RETURN(1); } select_lex->leaf_tables.push_back(table_list); } } for (table_list= tables; table_list; table_list= table_list->next_local) { if (table_list->merge_underlying_list) { DBUG_ASSERT(table_list->is_merged_derived()); Query_arena *arena, backup; arena= thd->activate_stmt_arena_if_needed(&backup); bool res; res= table_list->setup_underlying(thd); if (arena) thd->restore_active_arena(arena, &backup); if (res) DBUG_RETURN(1); } if (table_list->jtbm_subselect) { Item *item= table_list->jtbm_subselect->optimizer; if (!table_list->jtbm_subselect->optimizer->fixed && table_list->jtbm_subselect->optimizer->fix_fields(thd, &item)) { my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); /* psergey-todo: WHY ER_TOO_MANY_TABLES ???*/ DBUG_RETURN(1); } DBUG_ASSERT(item == table_list->jtbm_subselect->optimizer); } } /* Precompute and store the row types of NATURAL/USING joins. */ if (setup_natural_join_row_types(thd, from_clause, context)) DBUG_RETURN(1); DBUG_RETURN(0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394248, "input": "static int ctnetlink_dump_zone_id(struct sk_buff *skb, int attrtype, const struct nf_conntrack_zone *zone, int dir) { if (zone->id == NF_CT_DEFAULT_ZONE_ID || zone->dir != dir) return 0; if (nla_put_be16(skb, attrtype, htons(zone->id))) goto nla_put_failure; return 0; nla_put_failure: return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219053, "input": "ALWAYS_INLINE String serialize_impl(const Variant& value, const SerializeOptions& opts) { switch (value.getType()) { case KindOfClass: case KindOfLazyClass: case KindOfPersistentString: case KindOfString: { auto const str = isStringType(value.getType()) ? value.getStringData() : isClassType(value.getType()) ? classToStringHelper(value.toClassVal()) : lazyClassToStringHelper(value.toLazyClassVal()); auto const size = str->size(); if (size >= RuntimeOption::MaxSerializedStringSize) { throw Exception(\"Size of serialized string (%ld) exceeds max\", size); } StringBuffer sb; sb.append(\"s:\"); sb.append(size); sb.append(\":\\\"\"); sb.append(str->data(), size); sb.append(\"\\\";\"); return sb.detach(); } case KindOfResource: return s_Res; case KindOfUninit: case KindOfNull: case KindOfBoolean: case KindOfInt64: case KindOfFunc: case KindOfPersistentVec: case KindOfVec: case KindOfPersistentDict: case KindOfDict: case KindOfPersistentKeyset: case KindOfKeyset: case KindOfPersistentDArray: case KindOfDArray: case KindOfPersistentVArray: case KindOfVArray: case KindOfDouble: case KindOfObject: case KindOfClsMeth: case KindOfRClsMeth: case KindOfRFunc: case KindOfRecord: break; } VariableSerializer vs(VariableSerializer::Type::Serialize); if (opts.keepDVArrays) vs.keepDVArrays(); if (opts.forcePHPArrays) vs.setForcePHPArrays(); if (opts.warnOnHackArrays) vs.setHackWarn(); if (opts.warnOnPHPArrays) vs.setPHPWarn(); if (opts.ignoreLateInit) vs.setIgnoreLateInit(); if (opts.serializeProvenanceAndLegacy) vs.setSerializeProvenanceAndLegacy(); // Keep the count so recursive calls to serialize() embed references properly. return vs.serialize(value, true, true); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448700, "input": "BOOL clear_context_reset(CLEAR_CONTEXT* clear) { if (!clear) return FALSE; clear->seqNumber = 0; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330515, "input": "ssize_t vnc_tls_push(const char *buf, size_t len, void *opaque) { VncState *vs = opaque; ssize_t ret; retry: ret = send(vs->csock, buf, len, 0); if (ret < 0) { if (errno == EINTR) { goto retry; } return -1; } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 386449, "input": "_dwarf_print_lines(Dwarf_Die die, Dwarf_Error * error) { int only_line_header = 0; int err_count = 0; int res = _dwarf_internal_printlines(die, &err_count, only_line_header,error); /* No way to get error count back in this interface */ return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383694, "input": "spnego_gss_process_context_token( OM_uint32 *minor_status, const gss_ctx_id_t context_handle, const gss_buffer_t token_buffer) { OM_uint32 ret; ret = gss_process_context_token(minor_status, context_handle, token_buffer); return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280580, "input": "decode_NXAST_RAW_LEARN2(const struct nx_action_learn2 *nal, enum ofp_version ofp_version OVS_UNUSED, const struct vl_mff_map *vl_mff_map, uint64_t *tlv_bitmap, struct ofpbuf *ofpacts) { struct ofpbuf b = ofpbuf_const_initializer(nal, ntohs(nal->up.len)); struct ofpact_learn *learn; enum ofperr error; if (nal->pad2) { return OFPERR_NXBAC_MUST_BE_ZERO; } learn = ofpact_put_LEARN(ofpacts); error = decode_LEARN_common(&nal->up, NXAST_RAW_LEARN2, learn); if (error) { return error; } learn->limit = ntohl(nal->limit); if (learn->flags & ~(NX_LEARN_F_SEND_FLOW_REM | NX_LEARN_F_DELETE_LEARNED | NX_LEARN_F_WRITE_RESULT)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } ofpbuf_pull(&b, sizeof *nal); if (learn->flags & NX_LEARN_F_WRITE_RESULT) { error = nx_pull_header(&b, vl_mff_map, &learn->result_dst.field, NULL); if (error) { return error; } if (!learn->result_dst.field->writable) { return OFPERR_OFPBAC_BAD_SET_ARGUMENT; } learn->result_dst.ofs = ntohs(nal->result_dst_ofs); learn->result_dst.n_bits = 1; } else if (nal->result_dst_ofs) { return OFPERR_OFPBAC_BAD_ARGUMENT; } return decode_LEARN_specs(b.data, (char *) nal + ntohs(nal->up.len), vl_mff_map, tlv_bitmap, ofpacts); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458381, "input": "static void hidinput_led_worker(struct work_struct *work) { struct hid_device *hid = container_of(work, struct hid_device, led_work); struct hid_field *field; struct hid_report *report; int ret; u32 len; __u8 *buf; field = hidinput_get_led_field(hid); if (!field) return; /* * field->report is accessed unlocked regarding HID core. So there might * be another incoming SET-LED request from user-space, which changes * the LED state while we assemble our outgoing buffer. However, this * doesn't matter as hid_output_report() correctly converts it into a * boolean value no matter what information is currently set on the LED * field (even garbage). So the remote device will always get a valid * request. * And in case we send a wrong value, a next led worker is spawned * for every SET-LED request so the following worker will send the * correct value, guaranteed! */ report = field->report; /* use custom SET_REPORT request if possible (asynchronous) */ if (hid->ll_driver->request) return hid->ll_driver->request(hid, report, HID_REQ_SET_REPORT); /* fall back to generic raw-output-report */ len = hid_report_len(report); buf = hid_alloc_report_buf(report, GFP_KERNEL); if (!buf) return; hid_output_report(report, buf); /* synchronous output report */ ret = hid_hw_output_report(hid, buf, len); if (ret == -ENOSYS) hid_hw_raw_request(hid, report->id, buf, len, HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); kfree(buf); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379351, "input": "assign_seconds (self, value, unused, key) SHELL_VAR *self; char *value; arrayind_t unused; char *key; { if (legal_number (value, &seconds_value_assigned) == 0) seconds_value_assigned = 0; shell_start_time = NOW; return (self); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 282824, "input": "int unzzip_extract (int argc, char ** argv) { return unzzip_cat(argc, argv, 1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295878, "input": "rfbClientConnectionGone(rfbClientPtr cl) { #if defined(LIBVNCSERVER_HAVE_LIBZ) && defined(LIBVNCSERVER_HAVE_LIBJPEG) int i; #endif LOCK(rfbClientListMutex); if (cl->prev) cl->prev->next = cl->next; else cl->screen->clientHead = cl->next; if (cl->next) cl->next->prev = cl->prev; UNLOCK(rfbClientListMutex); #if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS) if(cl->screen->backgroundLoop != FALSE) { int i; do { LOCK(cl->refCountMutex); i=cl->refCount; if(i>0) WAIT(cl->deleteCond,cl->refCountMutex); UNLOCK(cl->refCountMutex); } while(i>0); } #endif if(cl->sock != RFB_INVALID_SOCKET) rfbCloseSocket(cl->sock); if (cl->scaledScreen!=NULL) cl->scaledScreen->scaledScreenRefCount--; #ifdef LIBVNCSERVER_HAVE_LIBZ rfbFreeZrleData(cl); #endif rfbFreeUltraData(cl); /* free buffers holding pixel data before and after encoding */ free(cl->beforeEncBuf); free(cl->afterEncBuf); if(cl->sock != RFB_INVALID_SOCKET) FD_CLR(cl->sock,&(cl->screen->allFds)); cl->clientGoneHook(cl); rfbLog(\"Client %s gone\\n\",cl->host); free(cl->host); #ifdef LIBVNCSERVER_HAVE_LIBZ /* Release the compression state structures if any. */ if ( cl->compStreamInited ) { deflateEnd( &(cl->compStream) ); } #ifdef LIBVNCSERVER_HAVE_LIBJPEG for (i = 0; i < 4; i++) { if (cl->zsActive[i]) deflateEnd(&cl->zsStruct[i]); } #endif #endif if (cl->screen->pointerClient == cl) cl->screen->pointerClient = NULL; sraRgnDestroy(cl->modifiedRegion); sraRgnDestroy(cl->requestedRegion); sraRgnDestroy(cl->copyRegion); if (cl->translateLookupTable) free(cl->translateLookupTable); TINI_COND(cl->updateCond); TINI_MUTEX(cl->updateMutex); /* make sure outputMutex is unlocked before destroying */ LOCK(cl->outputMutex); UNLOCK(cl->outputMutex); TINI_MUTEX(cl->outputMutex); LOCK(cl->sendMutex); UNLOCK(cl->sendMutex); TINI_MUTEX(cl->sendMutex); #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD close(cl->pipe_notify_client_thread[0]); close(cl->pipe_notify_client_thread[1]); #endif rfbPrintStats(cl); rfbResetStats(cl); free(cl); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381989, "input": "int CServer::Run() { // m_PrintCBIndex = Console()->RegisterPrintCallback(Config()->m_ConsoleOutputLevel, SendRconLineAuthed, this); // list maps m_pMapListHeap = new CHeap(); CSubdirCallbackUserdata Userdata; Userdata.m_pServer = this; str_copy(Userdata.m_aName, \"\", sizeof(Userdata.m_aName)); m_pStorage->ListDirectory(IStorage::TYPE_ALL, \"maps/\", MapListEntryCallback, &Userdata); // load map if(!LoadMap(Config()->m_SvMap)) { dbg_msg(\"server\", \"failed to load map. mapname='%s'\", Config()->m_SvMap); return -1; } m_MapChunksPerRequest = Config()->m_SvMapDownloadSpeed; // start server NETADDR BindAddr; if(Config()->m_Bindaddr[0] && net_host_lookup(Config()->m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0) { // sweet! BindAddr.type = NETTYPE_ALL; BindAddr.port = Config()->m_SvPort; } else { mem_zero(&BindAddr, sizeof(BindAddr)); BindAddr.type = NETTYPE_ALL; BindAddr.port = Config()->m_SvPort; } if(!m_NetServer.Open(BindAddr, Config(), Console(), Kernel()->RequestInterface(), &m_ServerBan, Config()->m_SvMaxClients, Config()->m_SvMaxClientsPerIP, NewClientCallback, DelClientCallback, this)) { dbg_msg(\"server\", \"couldn't open socket. port %d might already be in use\", Config()->m_SvPort); return -1; } m_Econ.Init(Config(), Console(), &m_ServerBan); char aBuf[256]; str_format(aBuf, sizeof(aBuf), \"server name is '%s'\", Config()->m_SvName); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, \"server\", aBuf); GameServer()->OnInit(); str_format(aBuf, sizeof(aBuf), \"version %s\", GameServer()->NetVersion()); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, \"server\", aBuf); if(str_comp(GameServer()->NetVersionHashUsed(), GameServer()->NetVersionHashReal())) { m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, \"server\", \"WARNING: netversion hash differs\"); } // process pending commands m_pConsole->StoreCommands(false); if(m_GeneratedRconPassword) { dbg_msg(\"server\", \"+-------------------------+\"); dbg_msg(\"server\", \"| rcon password: '%s' |\", Config()->m_SvRconPassword); dbg_msg(\"server\", \"+-------------------------+\"); } // start game { int64 ReportTime = time_get(); int ReportInterval = 3; m_Lastheartbeat = 0; m_GameStartTime = time_get(); while(m_RunServer) { int64 t = time_get(); int NewTicks = 0; // load new map TODO: don't poll this if(str_comp(Config()->m_SvMap, m_aCurrentMap) != 0 || m_MapReload || m_CurrentGameTick >= 0x6FFFFFFF) // force reload to make sure the ticks stay within a valid range { m_MapReload = 0; // load map if(LoadMap(Config()->m_SvMap)) { // new map loaded bool aSpecs[MAX_CLIENTS]; for(int c = 0; c < MAX_CLIENTS; c++) aSpecs[c] = GameServer()->IsClientSpectator(c); GameServer()->OnShutdown(); for(int c = 0; c < MAX_CLIENTS; c++) { if(m_aClients[c].m_State <= CClient::STATE_AUTH) continue; SendMap(c); m_aClients[c].Reset(); m_aClients[c].m_State = aSpecs[c] ? CClient::STATE_CONNECTING_AS_SPEC : CClient::STATE_CONNECTING; } m_GameStartTime = time_get(); m_CurrentGameTick = 0; Kernel()->ReregisterInterface(GameServer()); GameServer()->OnInit(); } else { str_format(aBuf, sizeof(aBuf), \"failed to load map. mapname='%s'\", Config()->m_SvMap); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, \"server\", aBuf); str_copy(Config()->m_SvMap, m_aCurrentMap, sizeof(Config()->m_SvMap)); } } while(t > TickStartTime(m_CurrentGameTick+1)) { m_CurrentGameTick++; NewTicks++; // apply new input for(int c = 0; c < MAX_CLIENTS; c++) { if(m_aClients[c].m_State == CClient::STATE_EMPTY) continue; for(int i = 0; i < 200; i++) { if(m_aClients[c].m_aInputs[i].m_GameTick == Tick()) { if(m_aClients[c].m_State == CClient::STATE_INGAME) GameServer()->OnClientPredictedInput(c, m_aClients[c].m_aInputs[i].m_aData); break; } } } GameServer()->OnTick(); } // snap game if(NewTicks) { if(Config()->m_SvHighBandwidth || (m_CurrentGameTick%2) == 0) DoSnapshot(); UpdateClientRconCommands(); UpdateClientMapListEntries(); } // master server stuff m_Register.RegisterUpdate(m_NetServer.NetType()); PumpNetwork(); if(ReportTime < time_get()) { if(Config()->m_Debug) { /* static NETSTATS prev_stats; NETSTATS stats; netserver_stats(net, &stats); perf_next(); if(config.dbg_pref) perf_dump(&rootscope); dbg_msg(\"server\", \"send=%8d recv=%8d\", (stats.send_bytes - prev_stats.send_bytes)/reportinterval, (stats.recv_bytes - prev_stats.recv_bytes)/reportinterval); prev_stats = stats; */ } ReportTime += time_freq()*ReportInterval; } // wait for incomming data m_NetServer.Wait(5); } } // disconnect all clients on shutdown m_NetServer.Close(); m_Econ.Shutdown(); GameServer()->OnShutdown(); m_pMap->Unload(); if(m_pCurrentMapData) { mem_free(m_pCurrentMapData); m_pCurrentMapData = 0; } if(m_pMapListHeap) { delete m_pMapListHeap; m_pMapListHeap = 0; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462289, "input": "detach(void) { #if defined(HAVE_DAEMON) && !defined(DEPRECATED_DAEMON) /* use POSIX daemon(3) function */ if(daemon(1, 0) != 0) fatal_exit(\"daemon failed: %s\", strerror(errno)); #else /* no HAVE_DAEMON */ #ifdef HAVE_FORK int fd; /* Take off... */ switch (fork()) { case 0: break; case -1: fatal_exit(\"fork failed: %s\", strerror(errno)); default: /* exit interactive session */ exit(0); } /* detach */ #ifdef HAVE_SETSID if(setsid() == -1) fatal_exit(\"setsid() failed: %s\", strerror(errno)); #endif if ((fd = open(\"/dev/null\", O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); if (fd > 2) (void)close(fd); } #endif /* HAVE_FORK */ #endif /* HAVE_DAEMON */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 311113, "input": "DLLEXPORT unsigned long DLLCALL tjPlaneSizeYUV(int componentID, int width, int stride, int height, int subsamp) { unsigned long retval=0; int pw, ph; if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT) _throw(\"tjPlaneSizeYUV(): Invalid argument\"); pw=tjPlaneWidth(componentID, width, subsamp); ph=tjPlaneHeight(componentID, height, subsamp); if(pw<0 || ph<0) return -1; if(stride==0) stride=pw; else stride=abs(stride); retval=stride*(ph-1)+pw; bailout: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458375, "input": "int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field) { struct hid_report *report; int i, j; list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list) { for (i = 0; i < report->maxfield; i++) { *field = report->field[i]; for (j = 0; j < (*field)->maxusage; j++) if ((*field)->usage[j].type == type && (*field)->usage[j].code == code) return j; } } return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 355590, "input": "static void load_creator_from_old_format( FILE *fp, xref_t *xref, const char *buf, size_t buf_size) { int i, n_eles, length, is_escaped, obj_id; char *c, *ascii, *start, *s, *saved_buf_search, *obj; size_t obj_size; pdf_creator_t *info; info = new_creator(&n_eles); /* Mark the end of buf, so that we do not crawl past it */ if (buf_size < 1) return; const char *buf_end = buf + buf_size - 1; /* Treat 'end' as either the end of 'buf' or the end of 'obj'. Obj is if * the creator element (e.g., ModDate, Producer, etc) is an object and not * part of 'buf'. */ const char *end = buf_end; for (i=0; i= buf_end) { FAIL(\"Failed to locate space, likely a corrupt PDF.\"); } /* If looking at the start of a pdf token, we have gone too far */ if (*c == '/') continue; /* If the value is a number and not a '(' then the data is located in * an object we need to fetch, and not inline */ obj = saved_buf_search = NULL; obj_size = 0; end = buf_end; /* Init to be the buffer, this might not be an obj. */ if (isdigit(*c)) { obj_id = atoi(c); saved_buf_search = c; s = saved_buf_search; obj = get_object(fp, obj_id, xref, &obj_size, NULL); end = obj + obj_size; c = obj; /* Iterate to '(' */ while (c && (*c != '(') && (c < end)) ++c; if (c >= end) { FAIL(\"Failed to locate a '(' character. \" \"This might be a corrupt PDF.\\n\"); } /* Advance the search to the next token */ while (s && (*s == '/') && (s < buf_end)) ++s; if (s >= buf_end) { FAIL(\"Failed to locate a '/' character. \" \"This might be a corrupt PDF.\\n\"); } saved_buf_search = s; } /* Find the end of the value */ start = c; length = is_escaped = 0; while (c && ((*c != '\\r') && (*c != '\\n') && (*c != '<'))) { /* Bail out if we see an un-escaped ')' closing character */ if (!is_escaped && (*c == ')')) break; else if (*c == '\\\\') is_escaped = 1; else is_escaped = 0; ++c; ++length; if (c > end) { FAIL(\"Failed to locate the end of a value. \" \"This might be a corrupt PDF.\\n\"); } } if (length == 0) continue; /* Add 1 to length so it gets the closing ')' when we copy */ if (length) length += 1; length = (length > KV_MAX_VALUE_LENGTH) ? KV_MAX_VALUE_LENGTH : length; strncpy(info[i].value, start, length); info[i].value[KV_MAX_VALUE_LENGTH - 1] = '\\0'; /* Restore where we were searching from */ if (saved_buf_search) { /* Release memory from get_object() called earlier */ free(obj); c = saved_buf_search; } } /* For all creation information tags */ /* Go through the values and convert if encoded */ for (i = 0; i < n_eles; ++i) { const size_t val_str_len = strnlen(info[i].value, KV_MAX_VALUE_LENGTH); if ((ascii = decode_text_string(info[i].value, val_str_len))) { strncpy(info[i].value, ascii, val_str_len); free(ascii); } } xref->creator = info; xref->n_creator_entries = n_eles; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206235, "input": "static int codeCompare( Parse *pParse, /* The parsing (and code generating) context */ Expr *pLeft, /* The left operand */ Expr *pRight, /* The right operand */ int opcode, /* The comparison opcode */ int in1, int in2, /* Register holding operands */ int dest, /* Jump here if true. */ int jumpIfNull, /* If true, jump if either operand is NULL */ int isCommuted /* The comparison has been commuted */ ){ int p5; int addr; CollSeq *p4; if( isCommuted ){ p4 = sqlite3BinaryCompareCollSeq(pParse, pRight, pLeft); }else{ p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); } p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, (void*)p4, P4_COLLSEQ); sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); return addr; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Handling of Exceptional Conditions"], "explanation": "SQLite 3.30.1 mishandles certain parser-tree rewriting, related to expr.c, vdbeaux.c, and window.c. This is caused by incorrect sqlite3WindowRewrite() error handling.", "severity_level": "NoInfo", "cwe": "CWE-755", "cve": "CVE-2019-19924"}} -{"idx": 328362, "input": "static struct nft_table *nft_table_lookup_byhandle(const struct net *net, const struct nlattr *nla, u8 genmask) { struct nftables_pernet *nft_net; struct nft_table *table; nft_net = nft_pernet(net); list_for_each_entry(table, &nft_net->tables, list) { if (be64_to_cpu(nla_get_be64(nla)) == table->handle && nft_active_genmask(table, genmask)) return table; } return ERR_PTR(-ENOENT); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 451296, "input": "static __le32 ext4_dx_csum(struct inode *inode, struct ext4_dir_entry *dirent, int count_offset, int count, struct dx_tail *t) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_inode_info *ei = EXT4_I(inode); __u32 csum; int size; __u32 dummy_csum = 0; int offset = offsetof(struct dx_tail, dt_checksum); size = count_offset + (count * sizeof(struct dx_entry)); csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)dirent, size); csum = ext4_chksum(sbi, csum, (__u8 *)t, offset); csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum, sizeof(dummy_csum)); return cpu_to_le32(csum); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293603, "input": "resolve_fstab_device_cciss (guestfs_h *g, const char *disk, const char *part, char **device_ret) { char *device; CLEANUP_FREE_STRING_LIST char **devices = NULL; size_t i; struct drive *drv; /* disk: (cciss/c\\d+d\\d+) * part: (\\d+)? */ devices = guestfs_list_devices (g); if (devices == NULL) return -1; /* Check any hints we were passed for a non-heuristic mapping */ ITER_DRIVES (g, i, drv) { if (drv->name && STREQ (drv->name, disk)) { if (part) { device = safe_asprintf (g, \"%s%s\", devices[i], part); if (!is_partition (g, device)) { free (device); return 0; } *device_ret = device; } else *device_ret = safe_strdup (g, devices[i]); break; } } /* We don't try to guess mappings for cciss devices */ return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 454799, "input": "bool wsrep_sst_donor_update (sys_var *self, THD* thd, enum_var_type type) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417826, "input": "static int SFDDump(FILE *sfd,SplineFont *sf,EncMap *map,EncMap *normal, int todir, char *dirname) { int i, realcnt; BDFFont *bdf; int err = false; realcnt = sf->glyphcnt; if ( sf->subfontcnt!=0 ) { for ( i=0; isubfontcnt; ++i ) if ( realcntsubfonts[i]->glyphcnt ) realcnt = sf->subfonts[i]->glyphcnt; } for ( i=0, bdf = sf->bitmaps; bdf!=NULL; bdf=bdf->next, ++i ); ff_progress_start_indicator(10,_(\"Saving...\"),_(\"Saving Spline Font Database\"),_(\"Saving Outlines\"), realcnt,i+1); ff_progress_enable_stop(false); #ifndef _NO_LIBPNG double version = 3.2; if (!WritePNGInSFD) version = 3.1; #else double version = 3.1; #endif if (!UndoRedoLimitToSave && version == 3.1) { version = 3.0; } fprintf(sfd, \"SplineFontDB: %.1f\\n\", version ); if ( sf->mm != NULL ) err = SFD_MMDump(sfd,sf->mm->normal,map,normal,todir,dirname); else err = SFD_Dump(sfd,sf,map,normal,todir,dirname); ff_progress_end_indicator(); return( err ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381480, "input": "static int v4l_streamon(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { return ops->vidioc_streamon(file, fh, *(unsigned int *)arg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303122, "input": "static int lz4_wrap_compress(const char* input, size_t input_length, char* output, size_t maxout, int accel, void* hash_table) { BLOSC_UNUSED_PARAM(accel); int cbytes; #ifdef HAVE_IPP if (hash_table == NULL) { return -1; // the hash table should always be initialized } int outlen = (int)maxout; int inlen = (int)input_length; // I have not found any function that uses `accel` like in `LZ4_compress_fast`, but // the IPP LZ4Safe call does a pretty good job on compressing well, so let's use it IppStatus status = ippsEncodeLZ4Safe_8u((const Ipp8u*)input, &inlen, (Ipp8u*)output, &outlen, (Ipp8u*)hash_table); if (status == ippStsDstSizeLessExpected) { return 0; // we cannot compress in required outlen } else if (status != ippStsNoErr) { return -1; // an unexpected error happened } cbytes = outlen; #else BLOSC_UNUSED_PARAM(hash_table); accel = 1; // deactivate acceleration to match IPP behaviour cbytes = LZ4_compress_fast(input, output, (int)input_length, (int)maxout, accel); #endif return cbytes; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 102021, "input": "void ContentSettingsStore::RemoveObserver(Observer* observer) { DCHECK(OnCorrectThread()); observers_.RemoveObserver(observer); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246049, "input": "int asylo_enclave_call(uint64_t selector, void *buffer) { SgxParams *const sgx_params = reinterpret_cast(buffer); if (!IsValidUntrustedAddress(sgx_params)) { PrimitiveStatus status{error::GoogleError::INVALID_ARGUMENT, \"input should lie within untrusted memory.\"}; return status.error_code(); } const void *input = sgx_params->input; size_t input_size = sgx_params->input_size; size_t output_size = 0; MessageReader in; MessageWriter out; // Copy untrusted input to a trusted buffer before deserializing to prevent // TOC/TOU attacks. auto trusted_input = CopyFromUntrusted(input, input_size); if (trusted_input) { in.Deserialize(trusted_input.get(), input_size); } PrimitiveStatus status = InvokeEntryHandler(selector, &in, &out); // Serialize |out| to untrusted memory and pass that as output. The untrusted // caller is still responsible for freeing |*output|, which now points to // untrusted memory. output_size = out.MessageSize(); if (out.MessageSize() > 0) { // Serialize to a trusted output buffer first to prevent TOC/TOU attacks. std::unique_ptr trusted_output(new char[output_size]); out.Serialize(trusted_output.get()); sgx_params->output = CopyToUntrusted(trusted_output.get(), output_size); } sgx_params->output_size = static_cast(output_size); return status.error_code(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468915, "input": "static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { int rc; if (inet_sk(sk)->inet_daddr) { sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); sk_incoming_cpu_update(sk); } else { sk_mark_napi_id_once(sk, skb); } /* At recvmsg() time we may access skb->dst or skb->sp depending on * the IP options and the cmsg flags, elsewhere can we clear all * pending head states while they are hot in the cache */ if (likely(IPCB(skb)->opt.optlen == 0 && !skb_sec_path(skb))) skb_release_head_state(skb); rc = __udp_enqueue_schedule_skb(sk, skb); if (rc < 0) { int is_udplite = IS_UDPLITE(sk); /* Note that an ENOMEM error is charged twice */ if (rc == -ENOMEM) UDP_INC_STATS(sock_net(sk), UDP_MIB_RCVBUFERRORS, is_udplite); UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite); kfree_skb(skb); trace_udp_fail_queue_rcv_skb(rc, sk); return -1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295381, "input": "SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag) { if ((flag & ~AT_REMOVEDIR) != 0) return -EINVAL; if (flag & AT_REMOVEDIR) return do_rmdir(dfd, pathname); return do_unlinkat(dfd, getname(pathname)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204867, "input": "static void sm501_2d_operation(SM501State *s) { int cmd = (s->twoD_control >> 16) & 0x1F; int rtl = s->twoD_control & BIT(27); int format = (s->twoD_stretch >> 20) & 0x3; int rop_mode = (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else rop3 */ /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */ int rop2_source_is_pattern = (s->twoD_control >> 14) & 0x1; int rop = s->twoD_control & 0xFF; int dst_x = (s->twoD_destination >> 16) & 0x01FFF; int dst_y = s->twoD_destination & 0xFFFF; int width = (s->twoD_dimension >> 16) & 0x1FFF; int height = s->twoD_dimension & 0xFFFF; uint32_t dst_base = s->twoD_destination_base & 0x03FFFFFF; uint8_t *dst = s->local_mem + dst_base; int dst_pitch = (s->twoD_pitch >> 16) & 0x1FFF; int crt = (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0; int fb_len = get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt); if ((s->twoD_stretch >> 16) & 0xF) { qemu_log_mask(LOG_UNIMP, \"sm501: only XY addressing is supported.\\n\"); return; } if (rop_mode == 0) { if (rop != 0xcc) { /* Anything other than plain copies are not supported */ qemu_log_mask(LOG_UNIMP, \"sm501: rop3 mode with rop %x is not \" \"supported.\\n\", rop); } } else { if (rop2_source_is_pattern && rop != 0x5) { /* For pattern source, we support only inverse dest */ qemu_log_mask(LOG_UNIMP, \"sm501: rop2 source being the pattern and \" \"rop %x is not supported.\\n\", rop); } else { if (rop != 0x5 && rop != 0xc) { /* Anything other than plain copies or inverse dest is not * supported */ qemu_log_mask(LOG_UNIMP, \"sm501: rop mode %x is not \" \"supported.\\n\", rop); } } } if (s->twoD_source_base & BIT(27) || s->twoD_destination_base & BIT(27)) { qemu_log_mask(LOG_UNIMP, \"sm501: only local memory is supported.\\n\"); return; } switch (cmd) { case 0x00: /* copy area */ { int src_x = (s->twoD_source >> 16) & 0x01FFF; int src_y = s->twoD_source & 0xFFFF; uint32_t src_base = s->twoD_source_base & 0x03FFFFFF; uint8_t *src = s->local_mem + src_base; int src_pitch = s->twoD_pitch & 0x1FFF; #define COPY_AREA(_bpp, _pixel_type, rtl) { \\ int y, x, index_d, index_s; \\ for (y = 0; y < height; y++) { \\ for (x = 0; x < width; x++) { \\ _pixel_type val; \\ \\ if (rtl) { \\ index_s = ((src_y - y) * src_pitch + src_x - x) * _bpp; \\ index_d = ((dst_y - y) * dst_pitch + dst_x - x) * _bpp; \\ } else { \\ index_s = ((src_y + y) * src_pitch + src_x + x) * _bpp; \\ index_d = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \\ } \\ if (rop_mode == 1 && rop == 5) { \\ /* Invert dest */ \\ val = ~*(_pixel_type *)&dst[index_d]; \\ } else { \\ val = *(_pixel_type *)&src[index_s]; \\ } \\ *(_pixel_type *)&dst[index_d] = val; \\ } \\ } \\ } switch (format) { case 0: COPY_AREA(1, uint8_t, rtl); break; case 1: COPY_AREA(2, uint16_t, rtl); break; case 2: COPY_AREA(4, uint32_t, rtl); break; } break; } case 0x01: /* fill rectangle */ { uint32_t color = s->twoD_foreground; #define FILL_RECT(_bpp, _pixel_type) { \\ int y, x; \\ for (y = 0; y < height; y++) { \\ for (x = 0; x < width; x++) { \\ int index = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \\ *(_pixel_type *)&dst[index] = (_pixel_type)color; \\ } \\ } \\ } switch (format) { case 0: FILL_RECT(1, uint8_t); break; case 1: color = cpu_to_le16(color); FILL_RECT(2, uint16_t); break; case 2: color = cpu_to_le32(color); FILL_RECT(4, uint32_t); break; } break; } default: qemu_log_mask(LOG_UNIMP, \"sm501: not implemented 2D operation: %d\\n\", cmd); return; } if (dst_base >= get_fb_addr(s, crt) && dst_base <= get_fb_addr(s, crt) + fb_len) { int dst_len = MIN(fb_len, ((dst_y + height - 1) * dst_pitch + dst_x + width) * (1 << format)); if (dst_len) { memory_region_set_dirty(&s->local_mem_region, dst_base, dst_len); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "In QEMU through 5.0.0, an integer overflow was found in the SM501 display driver implementation. This flaw occurs in the COPY_AREA macro while handling MMIO write operations through the sm501_2d_engine_write() callback. A local attacker could abuse this flaw to crash the QEMU process in sm501_2d_operation() in hw/display/sm501.c on the host, resulting in a denial of service.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-12829"}} -{"idx": 268306, "input": "/* static */ Status GraphConstructor::Construct( const Options& opts, NodeDefSlice node_defs, const VersionDef* versions, const FunctionDefLibrary* library, Graph* g, ShapeRefiner* refiner, std::vector>* return_tensors, std::vector* return_nodes, std::vector* missing_unused_input_map_keys) { if (versions) { TF_RETURN_IF_ERROR(CheckVersions(*versions, TF_GRAPH_DEF_VERSION, TF_GRAPH_DEF_VERSION_MIN_PRODUCER, \"GraphDef\", \"graph\")); } NodeDefCopyingGraphConstructor c(opts, node_defs, versions, library, g, refiner, return_tensors, return_nodes, missing_unused_input_map_keys); Status s = c.TryImport(); if (!s.ok()) { c.Undo(); s = MaybeAppendVersionWarning(versions, s); } return s; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346342, "input": "PRESERVE_PINNED(struct evbuffer *src, struct evbuffer_chain **first, struct evbuffer_chain **last) { struct evbuffer_chain *chain, **pinned; ASSERT_EVBUFFER_LOCKED(src); if (!HAS_PINNED_R(src)) { *first = *last = NULL; return 0; } pinned = src->last_with_datap; if (!CHAIN_PINNED_R(*pinned)) pinned = &(*pinned)->next; EVUTIL_ASSERT(CHAIN_PINNED_R(*pinned)); chain = *first = *pinned; *last = src->last; /* If there's data in the first pinned chain, we need to allocate * a new chain and copy the data over. */ if (chain->off) { struct evbuffer_chain *tmp; EVUTIL_ASSERT(pinned == src->last_with_datap); tmp = evbuffer_chain_new(chain->off); if (!tmp) return -1; memcpy(tmp->buffer, chain->buffer + chain->misalign, chain->off); tmp->off = chain->off; *src->last_with_datap = tmp; src->last = tmp; chain->misalign += chain->off; chain->off = 0; } else { src->last = *src->last_with_datap; *pinned = NULL; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318259, "input": "static int rtnl_dump_done(struct nlmsghdr *h) { int len = *(int *)NLMSG_DATA(h); if (h->nlmsg_len < NLMSG_LENGTH(sizeof(int))) { fprintf(stderr, \"DONE truncated\\n\"); return -1; } if (len < 0) { errno = -len; switch (errno) { case ENOENT: case EOPNOTSUPP: return -1; case EMSGSIZE: fprintf(stderr, \"Error: Buffer too small for object.\\n\"); break; default: perror(\"RTNETLINK answers\"); } return len; } /* check for any messages returned from kernel */ nl_dump_ext_ack(h, NULL); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519674, "input": "XMLNode::remove_property(const string& name) { XMLPropertyIterator iter = _proplist.begin(); while (iter != _proplist.end()) { if ((*iter)->name() == name) { XMLProperty* property = *iter; _proplist.erase (iter); delete property; break; } ++iter; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273279, "input": "static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header) { AVBufferRef *data_ref; uint8_t *data; size_t data_size; int unit, start, end, marker, next_start, next_marker; int err, i, j, length; if (frag->data_size < 4) { // Definitely too short to be meaningful. return AVERROR_INVALIDDATA; } for (i = 0; i + 1 < frag->data_size && frag->data[i] != 0xff; i++); if (i > 0) { av_log(ctx->log_ctx, AV_LOG_WARNING, \"Discarding %d bytes at \" \"beginning of image.\\n\", i); } for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++); if (i + 1 >= frag->data_size && frag->data[i]) { av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \" \"no SOI marker found.\\n\"); return AVERROR_INVALIDDATA; } marker = frag->data[i]; if (marker != JPEG_MARKER_SOI) { av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: first \" \"marker is %02x, should be SOI.\\n\", marker); return AVERROR_INVALIDDATA; } for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++); if (i + 1 >= frag->data_size) { av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \" \"no image content found.\\n\"); return AVERROR_INVALIDDATA; } marker = frag->data[i]; start = i + 1; for (unit = 0;; unit++) { if (marker == JPEG_MARKER_EOI) { break; } else if (marker == JPEG_MARKER_SOS) { for (i = start; i + 1 < frag->data_size; i++) { if (frag->data[i] != 0xff) continue; end = i; for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++); if (i + 1 >= frag->data_size) { next_marker = -1; } else { if (frag->data[i] == 0x00) continue; next_marker = frag->data[i]; next_start = i + 1; } break; } } else { i = start; if (i + 2 > frag->data_size) { av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \" \"truncated at %02x marker.\\n\", marker); return AVERROR_INVALIDDATA; } length = AV_RB16(frag->data + i); if (i + length > frag->data_size) { av_log(ctx->log_ctx, AV_LOG_ERROR, \"Invalid JPEG image: \" \"truncated at %02x marker segment.\\n\", marker); return AVERROR_INVALIDDATA; } end = start + length; i = end; if (frag->data[i] != 0xff) { next_marker = -1; } else { for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++); if (i + 1 >= frag->data_size) { next_marker = -1; } else { next_marker = frag->data[i]; next_start = i + 1; } } } if (marker == JPEG_MARKER_SOS) { length = AV_RB16(frag->data + start); if (length > end - start) return AVERROR_INVALIDDATA; data_ref = NULL; data = av_malloc(end - start + AV_INPUT_BUFFER_PADDING_SIZE); if (!data) return AVERROR(ENOMEM); memcpy(data, frag->data + start, length); for (i = start + length, j = length; i < end; i++, j++) { if (frag->data[i] == 0xff) { while (frag->data[i] == 0xff) ++i; data[j] = 0xff; } else { data[j] = frag->data[i]; } } data_size = j; memset(data + data_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); } else { data = frag->data + start; data_size = end - start; data_ref = frag->data_ref; } err = ff_cbs_insert_unit_data(ctx, frag, unit, marker, data, data_size, data_ref); if (err < 0) { if (!data_ref) av_freep(&data); return err; } if (next_marker == -1) break; marker = next_marker; start = next_start; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295838, "input": "rfbBool rfbSendDirContent(rfbClientPtr cl, int length, char *buffer) { char retfilename[MAX_PATH]; char path[MAX_PATH]; struct stat statbuf; RFB_FIND_DATA win32filename; int nOptLen = 0, retval=0; #ifdef WIN32 WIN32_FIND_DATAA winFindData; HANDLE findHandle; int pathLen, basePathLength; char *basePath; #else DIR *dirp=NULL; struct dirent *direntp=NULL; #endif FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN(\"\", cl, FALSE); /* Client thinks we are Winblows */ if (!rfbFilenameTranslate2UNIX(cl, buffer, path, sizeof(path))) return FALSE; if (DB) rfbLog(\"rfbProcessFileTransfer() rfbDirContentRequest: rfbRDirContent: \\\"%s\\\"->\\\"%s\\\"\\n\",buffer, path); #ifdef WIN32 // Create a search string, like C:\\folder\\* pathLen = strlen(path); basePath = malloc(pathLen + 3); memcpy(basePath, path, pathLen); basePathLength = pathLen; basePath[basePathLength] = '\\\\'; basePath[basePathLength + 1] = '*'; basePath[basePathLength + 2] = '\\0'; // Start a search memset(&winFindData, 0, sizeof(winFindData)); findHandle = FindFirstFileA(path, &winFindData); free(basePath); if (findHandle == INVALID_HANDLE_VALUE) #else dirp=opendir(path); if (dirp==NULL) #endif return rfbSendFileTransferMessage(cl, rfbDirPacket, rfbADirectory, 0, 0, NULL); /* send back the path name (necessary for links) */ if (rfbSendFileTransferMessage(cl, rfbDirPacket, rfbADirectory, 0, length, buffer)==FALSE) return FALSE; #ifdef WIN32 while (findHandle != INVALID_HANDLE_VALUE) #else for (direntp=readdir(dirp); direntp!=NULL; direntp=readdir(dirp)) #endif { /* get stats */ #ifdef WIN32 snprintf(retfilename,sizeof(retfilename),\"%s/%s\", path, winFindData.cFileName); #else snprintf(retfilename,sizeof(retfilename),\"%s/%s\", path, direntp->d_name); #endif retval = stat(retfilename, &statbuf); if (retval==0) { memset((char *)&win32filename, 0, sizeof(win32filename)); #ifdef WIN32 win32filename.dwFileAttributes = winFindData.dwFileAttributes; win32filename.ftCreationTime.dwLowDateTime = winFindData.ftCreationTime.dwLowDateTime; win32filename.ftCreationTime.dwHighDateTime = winFindData.ftCreationTime.dwHighDateTime; win32filename.ftLastAccessTime.dwLowDateTime = winFindData.ftLastAccessTime.dwLowDateTime; win32filename.ftLastAccessTime.dwHighDateTime = winFindData.ftLastAccessTime.dwHighDateTime; win32filename.ftLastWriteTime.dwLowDateTime = winFindData.ftLastWriteTime.dwLowDateTime; win32filename.ftLastWriteTime.dwHighDateTime = winFindData.ftLastWriteTime.dwHighDateTime; win32filename.nFileSizeLow = winFindData.nFileSizeLow; win32filename.nFileSizeHigh = winFindData.nFileSizeHigh; win32filename.dwReserved0 = winFindData.dwReserved0; win32filename.dwReserved1 = winFindData.dwReserved1; strcpy((char *)win32filename.cFileName, winFindData.cFileName); strcpy((char *)win32filename.cAlternateFileName, winFindData.cAlternateFileName); #else win32filename.dwFileAttributes = Swap32IfBE(RFB_FILE_ATTRIBUTE_NORMAL); if (S_ISDIR(statbuf.st_mode)) win32filename.dwFileAttributes = Swap32IfBE(RFB_FILE_ATTRIBUTE_DIRECTORY); win32filename.ftCreationTime.dwLowDateTime = Swap32IfBE(statbuf.st_ctime); /* Intel Order */ win32filename.ftCreationTime.dwHighDateTime = 0; win32filename.ftLastAccessTime.dwLowDateTime = Swap32IfBE(statbuf.st_atime); /* Intel Order */ win32filename.ftLastAccessTime.dwHighDateTime = 0; win32filename.ftLastWriteTime.dwLowDateTime = Swap32IfBE(statbuf.st_mtime); /* Intel Order */ win32filename.ftLastWriteTime.dwHighDateTime = 0; win32filename.nFileSizeLow = Swap32IfBE(statbuf.st_size); /* Intel Order */ win32filename.nFileSizeHigh = 0; win32filename.dwReserved0 = 0; win32filename.dwReserved1 = 0; /* If this had the full path, we would need to translate to DOS format (\"C:\\\") */ /* rfbFilenameTranslate2DOS(cl, retfilename, win32filename.cFileName); */ strcpy((char *)win32filename.cFileName, direntp->d_name); #endif /* Do not show hidden files (but show how to move up the tree) */ if ((strcmp((char *)win32filename.cFileName, \"..\")==0) || (win32filename.cFileName[0]!='.')) { nOptLen = sizeof(RFB_FIND_DATA) - MAX_PATH - 14 + strlen((char *)win32filename.cFileName); /* rfbLog(\"rfbProcessFileTransfer() rfbDirContentRequest: rfbRDirContent: Sending \\\"%s\\\"\\n\", (char *)win32filename.cFileName); */ if (rfbSendFileTransferMessage(cl, rfbDirPacket, rfbADirectory, 0, nOptLen, (char *)&win32filename)==FALSE) { #ifdef WIN32 FindClose(findHandle); #else closedir(dirp); #endif return FALSE; } } } #ifdef WIN32 if (FindNextFileA(findHandle, &winFindData) == 0) { FindClose(findHandle); findHandle = INVALID_HANDLE_VALUE; } #endif } #ifdef WIN32 if (findHandle != INVALID_HANDLE_VALUE) { FindClose(findHandle); } #else closedir(dirp); #endif /* End of the transfer */ return rfbSendFileTransferMessage(cl, rfbDirPacket, 0, 0, 0, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 302159, "input": "xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input) { return xmlEncodeEntitiesInternal(doc, input, 1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244422, "input": "static uint8_t *read_vblock(AVIOContext *src, uint32_t *size, uint32_t key, uint32_t *k2, int align) { uint8_t tmp[4]; uint8_t *buf; unsigned n; if (avio_read(src, tmp, 4) != 4) return NULL; decode_block(tmp, tmp, 4, key, k2, align); n = get_v(tmp, 4); if (n < 4) return NULL; buf = av_malloc(n); if (!buf) return NULL; *size = n; n -= 4; memcpy(buf, tmp, 4); if (avio_read(src, buf + 4, n) == n) { decode_block(buf + 4, buf + 4, n, key, k2, align); } else { av_free(buf); buf = NULL; } return buf; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509174, "input": "void split_sum_func2_example(THD *thd, Ref_ptr_array ref_pointer_array, List &fields, uint flags) { example->split_sum_func2(thd, ref_pointer_array, fields, &example, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385328, "input": "xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, int hasNullEntries) { if ((set1 == NULL) && (hasNullEntries == 0)) { /* * Note that doing a memcpy of the list, namespace nodes are * just assigned to set1, since set2 is cleared anyway. */ set1 = xmlXPathNodeSetCreateSize(set2->nodeNr); if (set1 == NULL) return(NULL); if (set2->nodeNr != 0) { memcpy(set1->nodeTab, set2->nodeTab, set2->nodeNr * sizeof(xmlNodePtr)); set1->nodeNr = set2->nodeNr; } } else { int i, j, initNbSet1; xmlNodePtr n1, n2; if (set1 == NULL) set1 = xmlXPathNodeSetCreate(NULL); if (set1 == NULL) return (NULL); initNbSet1 = set1->nodeNr; for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; /* * Skip NULLed entries. */ if (n2 == NULL) continue; /* * Skip duplicates. */ for (j = 0; j < initNbSet1; j++) { n1 = set1->nodeTab[j]; if (n1 == n2) { goto skip_node; } else if ((n1->type == XML_NAMESPACE_DECL) && (n2->type == XML_NAMESPACE_DECL)) { if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && (xmlStrEqual(((xmlNsPtr) n1)->prefix, ((xmlNsPtr) n2)->prefix))) { /* * Free the namespace node. */ set2->nodeTab[i] = NULL; xmlXPathNodeSetFreeNs((xmlNsPtr) n2); goto skip_node; } } } /* * grow the nodeTab if needed */ if (set1->nodeMax == 0) { set1->nodeTab = (xmlNodePtr *) xmlMalloc( XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); if (set1->nodeTab == NULL) { xmlXPathErrMemory(NULL, \"merging nodeset\\n\"); return(NULL); } memset(set1->nodeTab, 0, XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); set1->nodeMax = XML_NODESET_DEFAULT; } else if (set1->nodeNr >= set1->nodeMax) { xmlNodePtr *temp; if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) { xmlXPathErrMemory(NULL, \"merging nodeset hit limit\\n\"); return(NULL); } temp = (xmlNodePtr *) xmlRealloc( set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, \"merging nodeset\\n\"); return(NULL); } set1->nodeTab = temp; set1->nodeMax *= 2; } set1->nodeTab[set1->nodeNr++] = n2; skip_node: {} } } set2->nodeNr = 0; return(set1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382780, "input": "static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode) { php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); const char *p1; size_t str_left; unsigned int scan_stat = 0; const char *csname = NULL; size_t csname_len; const char *encoded_text = NULL; size_t encoded_text_len = 0; const char *encoded_word = NULL; const char *spaces = NULL; php_iconv_enc_scheme_t enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; if (next_pos != NULL) { *next_pos = NULL; } cd_pl = iconv_open(enc, ICONV_ASCII_ENCODING); if (cd_pl == (iconv_t)(-1)) { #if ICONV_SUPPORTS_ERRNO if (errno == EINVAL) { err = PHP_ICONV_ERR_WRONG_CHARSET; } else { err = PHP_ICONV_ERR_CONVERTER; } #else err = PHP_ICONV_ERR_UNKNOWN; #endif goto out; } p1 = str; for (str_left = str_nbytes; str_left > 0; str_left--, p1++) { int eos = 0; switch (scan_stat) { case 0: /* expecting any character */ switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ encoded_word = p1; scan_stat = 1; break; case ' ': case '\\t': /* a chunk of whitespaces */ spaces = p1; scan_stat = 11; break; default: /* first letter of a non-encoded word */ err = _php_iconv_appendc(pretval, *p1, cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { if (mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR) { err = PHP_ICONV_ERR_SUCCESS; } else { goto out; } } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } break; } break; case 1: /* expecting a delimiter */ if (*p1 != '?') { if (*p1 == '\\r' || *p1 == '\\n') { --p1; } err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } csname = p1 + 1; scan_stat = 2; break; case 2: /* expecting a charset name */ switch (*p1) { case '?': /* normal delimiter: encoding scheme follows */ scan_stat = 3; break; case '*': /* new style delimiter: locale id follows */ scan_stat = 10; break; case '\\r': case '\\n': /* not an encoded-word */ --p1; _php_iconv_appendc(pretval, '=', cd_pl); _php_iconv_appendc(pretval, '?', cd_pl); err = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } csname = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } continue; } if (scan_stat != 2) { char tmpbuf[80]; if (csname == NULL) { err = PHP_ICONV_ERR_MALFORMED; goto out; } csname_len = (size_t)(p1 - csname); if (csname_len > sizeof(tmpbuf) - 1) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } memcpy(tmpbuf, csname, csname_len); tmpbuf[csname_len] = '\\0'; if (cd != (iconv_t)(-1)) { iconv_close(cd); } cd = iconv_open(enc, tmpbuf); if (cd == (iconv_t)(-1)) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* Bad character set, but the user wants us to * press on. In this case, we'll just insert the * undecoded encoded word, since there isn't really * a more sensible behaviour available; the only * other options are to swallow the encoded word * entirely or decode it with an arbitrarily chosen * single byte encoding, both of which seem to have * a higher WTF factor than leaving it undecoded. * * Given this approach, we need to skip ahead to * the end of the encoded word. */ int qmarks = 2; while (qmarks > 0 && str_left > 1) { if (*(++p1) == '?') { --qmarks; } --str_left; } /* Look ahead to check for the terminating = that * should be there as well; if it's there, we'll * also include that. If it's not, there isn't much * we can do at this point. */ if (*(p1 + 1) == '=') { ++p1; if (str_left > 1) { --str_left; } } err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } /* Let's go back and see if there are further * encoded words or bare content, and hope they * might actually have a valid character set. */ scan_stat = 12; break; } else { #if ICONV_SUPPORTS_ERRNO if (errno == EINVAL) { err = PHP_ICONV_ERR_WRONG_CHARSET; } else { err = PHP_ICONV_ERR_CONVERTER; } #else err = PHP_ICONV_ERR_UNKNOWN; #endif goto out; } } } break; case 3: /* expecting a encoding scheme specifier */ switch (*p1) { case 'b': case 'B': enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; scan_stat = 4; break; case 'q': case 'Q': enc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT; scan_stat = 4; break; default: if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } break; case 4: /* expecting a delimiter */ if (*p1 != '?') { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } encoded_text = p1 + 1; scan_stat = 5; break; case 5: /* expecting an encoded portion */ if (*p1 == '?') { encoded_text_len = (size_t)(p1 - encoded_text); scan_stat = 6; } break; case 7: /* expecting a \"\\n\" character */ if (*p1 == '\\n') { scan_stat = 8; } else { /* bare CR */ _php_iconv_appendc(pretval, '\\r', cd_pl); _php_iconv_appendc(pretval, *p1, cd_pl); scan_stat = 0; } break; case 8: /* checking whether the following line is part of a folded header */ if (*p1 != ' ' && *p1 != '\\t') { --p1; str_left = 1; /* quit_loop */ break; } if (encoded_word == NULL) { _php_iconv_appendc(pretval, ' ', cd_pl); } spaces = NULL; scan_stat = 11; break; case 6: /* expecting a End-Of-Chunk character \"=\" */ if (*p1 != '=') { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } scan_stat = 9; if (str_left == 1) { eos = 1; } else { break; } case 9: /* choice point, seeing what to do next.*/ switch (*p1) { default: /* Handle non-RFC-compliant formats * * RFC2047 requires the character that comes right * after an encoded word (chunk) to be a whitespace, * while there are lots of broken implementations that * generate such malformed headers that don't fulfill * that requirement. */ if (!eos) { if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } scan_stat = 12; break; } } /* break is omitted intentionally */ case '\\r': case '\\n': case ' ': case '\\t': { zend_string *decoded_text; switch (enc_scheme) { case PHP_ICONV_ENC_SCHEME_BASE64: decoded_text = php_base64_decode((unsigned char*)encoded_text, encoded_text_len); break; case PHP_ICONV_ENC_SCHEME_QPRINT: decoded_text = php_quot_print_decode((unsigned char*)encoded_text, encoded_text_len, 1); break; default: decoded_text = NULL; break; } if (decoded_text == NULL) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl); if (err != PHP_ICONV_ERR_SUCCESS) { goto out; } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } else { err = PHP_ICONV_ERR_UNKNOWN; goto out; } } err = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd); zend_string_release(decoded_text); if (err != PHP_ICONV_ERR_SUCCESS) { if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { /* pass the entire chunk through the converter */ err = _php_iconv_appendl(pretval, encoded_word, (size_t)(p1 - encoded_word), cd_pl); encoded_word = NULL; if (err != PHP_ICONV_ERR_SUCCESS) { break; } } else { goto out; } } if (eos) { /* reached end-of-string. done. */ scan_stat = 0; break; } switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ scan_stat = 1; break; case ' ': case '\\t': /* medial whitespaces */ spaces = p1; scan_stat = 11; break; default: /* first letter of a non-encoded word */ _php_iconv_appendc(pretval, *p1, cd_pl); scan_stat = 12; break; } } break; } break; case 10: /* expects a language specifier. dismiss it for now */ if (*p1 == '?') { scan_stat = 3; } break; case 11: /* expecting a chunk of whitespaces */ switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case '=': /* first letter of an encoded chunk */ if (spaces != NULL && encoded_word == NULL) { _php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl); spaces = NULL; } encoded_word = p1; scan_stat = 1; break; case ' ': case '\\t': break; default: /* first letter of a non-encoded word */ if (spaces != NULL) { _php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl); spaces = NULL; } _php_iconv_appendc(pretval, *p1, cd_pl); encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; } else { scan_stat = 0; } break; } break; case 12: /* expecting a non-encoded word */ switch (*p1) { case '\\r': /* part of an EOL sequence? */ scan_stat = 7; break; case '\\n': scan_stat = 8; break; case ' ': case '\\t': spaces = p1; scan_stat = 11; break; case '=': /* first letter of an encoded chunk */ if (!(mode & PHP_ICONV_MIME_DECODE_STRICT)) { encoded_word = p1; scan_stat = 1; break; } /* break is omitted intentionally */ default: _php_iconv_appendc(pretval, *p1, cd_pl); break; } break; } } switch (scan_stat) { case 0: case 8: case 11: case 12: break; default: if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { if (scan_stat == 1) { _php_iconv_appendc(pretval, '=', cd_pl); } err = PHP_ICONV_ERR_SUCCESS; } else { err = PHP_ICONV_ERR_MALFORMED; goto out; } } if (next_pos != NULL) { *next_pos = p1; } smart_str_0(pretval); out: if (cd != (iconv_t)(-1)) { iconv_close(cd); } if (cd_pl != (iconv_t)(-1)) { iconv_close(cd_pl); } return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431873, "input": "static void hci_cs_le_ext_create_conn(struct hci_dev *hdev, u8 status) { struct hci_cp_le_ext_create_conn *cp; BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); /* All connection failure handling is taken care of by the * hci_le_conn_failed function which is triggered by the HCI * request completion callbacks used for connecting. */ if (status) return; cp = hci_sent_cmd_data(hdev, HCI_OP_LE_EXT_CREATE_CONN); if (!cp) return; hci_dev_lock(hdev); cs_le_create_conn(hdev, &cp->peer_addr, cp->peer_addr_type, cp->own_addr_type, cp->filter_policy); hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318258, "input": "int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int len) { int i = 0; memset(tb, 0, sizeof(struct rtattr *) * max); while (RTA_OK(rta, len)) { if (rta->rta_type <= max && i < max) tb[i++] = rta; rta = RTA_NEXT(rta, len); } if (len) fprintf(stderr, \"!!!Deficit %d, rta_len=%d\\n\", len, rta->rta_len); return i; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354636, "input": "int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, void *data, unsigned int offset, unsigned long len) { struct kvm_memslots *slots = kvm_memslots(kvm); int r; gpa_t gpa = ghc->gpa + offset; BUG_ON(len + offset > ghc->len); if (slots->generation != ghc->generation) { if (__kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len)) return -EFAULT; } if (kvm_is_error_hva(ghc->hva)) return -EFAULT; if (unlikely(!ghc->memslot)) return kvm_write_guest(kvm, gpa, data, len); r = __copy_to_user((void __user *)ghc->hva + offset, data, len); if (r) return -EFAULT; mark_page_dirty_in_slot(ghc->memslot, gpa >> PAGE_SHIFT); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214025, "input": "open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS, rfbCredential *cred) { SSL_CTX *ssl_ctx = NULL; SSL *ssl = NULL; int n, finished = 0; X509_VERIFY_PARAM *param; uint8_t verify_crls = cred->x509Credential.x509CrlVerifyMode; if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method()))) { rfbClientLog(\"Could not create new SSL context.\\n\"); return NULL; } param = X509_VERIFY_PARAM_new(); /* Setup verification if not anonymous */ if (!anonTLS) { if (cred->x509Credential.x509CACertFile) { if (!SSL_CTX_load_verify_locations(ssl_ctx, cred->x509Credential.x509CACertFile, NULL)) { rfbClientLog(\"Failed to load CA certificate from %s.\\n\", cred->x509Credential.x509CACertFile); goto error_free_ctx; } } else { rfbClientLog(\"Using default paths for certificate verification.\\n\"); SSL_CTX_set_default_verify_paths (ssl_ctx); } if (cred->x509Credential.x509CACrlFile) { if (!load_crls_from_file(cred->x509Credential.x509CACrlFile, ssl_ctx)) { rfbClientLog(\"CRLs could not be loaded.\\n\"); goto error_free_ctx; } if (verify_crls == rfbX509CrlVerifyNone) verify_crls = rfbX509CrlVerifyAll; } if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile) { if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cred->x509Credential.x509ClientCertFile) != 1) { rfbClientLog(\"Client certificate could not be loaded.\\n\"); goto error_free_ctx; } if (SSL_CTX_use_PrivateKey_file(ssl_ctx, cred->x509Credential.x509ClientKeyFile, SSL_FILETYPE_PEM) != 1) { rfbClientLog(\"Client private key could not be loaded.\\n\"); goto error_free_ctx; } if (SSL_CTX_check_private_key(ssl_ctx) == 0) { rfbClientLog(\"Client certificate and private key do not match.\\n\"); goto error_free_ctx; } } SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL); if (verify_crls == rfbX509CrlVerifyClient) X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); else if (verify_crls == rfbX509CrlVerifyAll) X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); if(!X509_VERIFY_PARAM_set1_host(param, client->serverHost, strlen(client->serverHost))) { rfbClientLog(\"Could not set server name for verification.\\n\"); goto error_free_ctx; } SSL_CTX_set1_param(ssl_ctx, param); } if (!(ssl = SSL_new (ssl_ctx))) { rfbClientLog(\"Could not create a new SSL session.\\n\"); goto error_free_ctx; } /* TODO: finetune this list, take into account anonTLS bool */ SSL_set_cipher_list(ssl, \"ALL\"); SSL_set_fd (ssl, sockfd); SSL_CTX_set_app_data (ssl_ctx, client); do { n = SSL_connect(ssl); if (n != 1) { if (wait_for_data(ssl, n, 1) != 1) { finished = 1; SSL_shutdown(ssl); goto error_free_ssl; } } } while( n != 1 && finished != 1 ); X509_VERIFY_PARAM_free(param); return ssl; error_free_ssl: SSL_free(ssl); error_free_ctx: X509_VERIFY_PARAM_free(param); SSL_CTX_free(ssl_ctx); return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "An issue was discovered in LibVNCServer before 0.9.13. libvncclient/tls_openssl.c has a NULL pointer dereference.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2020-14396"}} -{"idx": 212839, "input": "INLINE void gdi_RectToCRgn(const HGDI_RECT rect, INT32* x, INT32* y, INT32* w, INT32* h) { *x = rect->left; *y = rect->top; *w = rect->right - rect->left + 1; *h = rect->bottom - rect->top + 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "libfreerdp/gdi/region.c in FreeRDP versions > 1.0 through 2.0.0-rc4 has an Integer Overflow.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-11523"}} -{"idx": 341917, "input": "static int fuse_access(struct inode *inode, int mask) { struct fuse_mount *fm = get_fuse_mount(inode); FUSE_ARGS(args); struct fuse_access_in inarg; int err; BUG_ON(mask & MAY_NOT_BLOCK); if (fm->fc->no_access) return 0; memset(&inarg, 0, sizeof(inarg)); inarg.mask = mask & (MAY_READ | MAY_WRITE | MAY_EXEC); args.opcode = FUSE_ACCESS; args.nodeid = get_node_id(inode); args.in_numargs = 1; args.in_args[0].size = sizeof(inarg); args.in_args[0].value = &inarg; err = fuse_simple_request(fm, &args); if (err == -ENOSYS) { fm->fc->no_access = 1; err = 0; } return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206874, "input": "UINT cliprdr_read_format_list(wStream* s, CLIPRDR_FORMAT_LIST* formatList, BOOL useLongFormatNames) { UINT32 index; size_t position; BOOL asciiNames; int formatNameLength; char* szFormatName; WCHAR* wszFormatName; UINT32 dataLen = formatList->dataLen; CLIPRDR_FORMAT* formats = NULL; UINT error = CHANNEL_RC_OK; asciiNames = (formatList->msgFlags & CB_ASCII_NAMES) ? TRUE : FALSE; index = 0; formatList->numFormats = 0; position = Stream_GetPosition(s); if (!formatList->dataLen) { /* empty format list */ formatList->formats = NULL; formatList->numFormats = 0; } else if (!useLongFormatNames) { formatList->numFormats = (dataLen / 36); if ((formatList->numFormats * 36) != dataLen) { WLog_ERR(TAG, \"Invalid short format list length: %\" PRIu32 \"\", dataLen); return ERROR_INTERNAL_ERROR; } if (formatList->numFormats) formats = (CLIPRDR_FORMAT*)calloc(formatList->numFormats, sizeof(CLIPRDR_FORMAT)); if (!formats) { WLog_ERR(TAG, \"calloc failed!\"); return CHANNEL_RC_NO_MEMORY; } formatList->formats = formats; while (dataLen) { Stream_Read_UINT32(s, formats[index].formatId); /* formatId (4 bytes) */ dataLen -= 4; formats[index].formatName = NULL; /* According to MS-RDPECLIP 2.2.3.1.1.1 formatName is \"a 32-byte block containing * the *null-terminated* name assigned to the Clipboard Format: (32 ASCII 8 characters * or 16 Unicode characters)\" * However, both Windows RDSH and mstsc violate this specs as seen in the following * example of a transferred short format name string: [R.i.c.h. .T.e.x.t. .F.o.r.m.a.t.] * These are 16 unicode charaters - *without* terminating null ! */ if (asciiNames) { szFormatName = (char*)Stream_Pointer(s); if (szFormatName[0]) { /* ensure null termination */ formats[index].formatName = (char*)malloc(32 + 1); if (!formats[index].formatName) { WLog_ERR(TAG, \"malloc failed!\"); error = CHANNEL_RC_NO_MEMORY; goto error_out; } CopyMemory(formats[index].formatName, szFormatName, 32); formats[index].formatName[32] = '\\0'; } } else { wszFormatName = (WCHAR*)Stream_Pointer(s); if (wszFormatName[0]) { /* ConvertFromUnicode always returns a null-terminated * string on success, even if the source string isn't. */ if (ConvertFromUnicode(CP_UTF8, 0, wszFormatName, 16, &(formats[index].formatName), 0, NULL, NULL) < 1) { WLog_ERR(TAG, \"failed to convert short clipboard format name\"); error = ERROR_INTERNAL_ERROR; goto error_out; } } } Stream_Seek(s, 32); dataLen -= 32; index++; } } else { while (dataLen) { Stream_Seek(s, 4); /* formatId (4 bytes) */ dataLen -= 4; wszFormatName = (WCHAR*)Stream_Pointer(s); if (!wszFormatName[0]) formatNameLength = 0; else formatNameLength = _wcslen(wszFormatName); Stream_Seek(s, (formatNameLength + 1) * 2); dataLen -= ((formatNameLength + 1) * 2); formatList->numFormats++; } dataLen = formatList->dataLen; Stream_SetPosition(s, position); if (formatList->numFormats) formats = (CLIPRDR_FORMAT*)calloc(formatList->numFormats, sizeof(CLIPRDR_FORMAT)); if (!formats) { WLog_ERR(TAG, \"calloc failed!\"); return CHANNEL_RC_NO_MEMORY; } formatList->formats = formats; while (dataLen) { Stream_Read_UINT32(s, formats[index].formatId); /* formatId (4 bytes) */ dataLen -= 4; formats[index].formatName = NULL; wszFormatName = (WCHAR*)Stream_Pointer(s); if (!wszFormatName[0]) formatNameLength = 0; else formatNameLength = _wcslen(wszFormatName); if (formatNameLength) { if (ConvertFromUnicode(CP_UTF8, 0, wszFormatName, -1, &(formats[index].formatName), 0, NULL, NULL) < 1) { WLog_ERR(TAG, \"failed to convert long clipboard format name\"); error = ERROR_INTERNAL_ERROR; goto error_out; } } Stream_Seek(s, (formatNameLength + 1) * 2); dataLen -= ((formatNameLength + 1) * 2); index++; } } return error; error_out: cliprdr_free_format_list(formatList); return error; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In FreeRDP before 2.1.0, there is an out-of-bounds read in cliprdr_read_format_list. Clipboard format data read (by client or server) might read data out-of-bounds. This has been fixed in 2.1.0.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-11085"}} -{"idx": 205956, "input": "bool do_notify_parent(struct task_struct *tsk, int sig) { struct kernel_siginfo info; unsigned long flags; struct sighand_struct *psig; bool autoreap = false; u64 utime, stime; BUG_ON(sig == -1); /* do_notify_parent_cldstop should have been called instead. */ BUG_ON(task_is_stopped_or_traced(tsk)); BUG_ON(!tsk->ptrace && (tsk->group_leader != tsk || !thread_group_empty(tsk))); /* Wake up all pidfd waiters */ do_notify_pidfd(tsk); if (sig != SIGCHLD) { /* * This is only possible if parent == real_parent. * Check if it has changed security domain. */ if (tsk->parent_exec_id != tsk->parent->self_exec_id) sig = SIGCHLD; } clear_siginfo(&info); info.si_signo = sig; info.si_errno = 0; /* * We are under tasklist_lock here so our parent is tied to * us and cannot change. * * task_active_pid_ns will always return the same pid namespace * until a task passes through release_task. * * write_lock() currently calls preempt_disable() which is the * same as rcu_read_lock(), but according to Oleg, this is not * correct to rely on this */ rcu_read_lock(); info.si_pid = task_pid_nr_ns(tsk, task_active_pid_ns(tsk->parent)); info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns), task_uid(tsk)); rcu_read_unlock(); task_cputime(tsk, &utime, &stime); info.si_utime = nsec_to_clock_t(utime + tsk->signal->utime); info.si_stime = nsec_to_clock_t(stime + tsk->signal->stime); info.si_status = tsk->exit_code & 0x7f; if (tsk->exit_code & 0x80) info.si_code = CLD_DUMPED; else if (tsk->exit_code & 0x7f) info.si_code = CLD_KILLED; else { info.si_code = CLD_EXITED; info.si_status = tsk->exit_code >> 8; } psig = tsk->parent->sighand; spin_lock_irqsave(&psig->siglock, flags); if (!tsk->ptrace && sig == SIGCHLD && (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN || (psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT))) { /* * We are exiting and our parent doesn't care. POSIX.1 * defines special semantics for setting SIGCHLD to SIG_IGN * or setting the SA_NOCLDWAIT flag: we should be reaped * automatically and not left for our parent's wait4 call. * Rather than having the parent do it as a magic kind of * signal handler, we just set this to tell do_exit that we * can be cleaned up without becoming a zombie. Note that * we still call __wake_up_parent in this case, because a * blocked sys_wait4 might now return -ECHILD. * * Whether we send SIGCHLD or not for SA_NOCLDWAIT * is implementation-defined: we do (if you don't want * it, just use SIG_IGN instead). */ autoreap = true; if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) sig = 0; } if (valid_signal(sig) && sig) __group_send_sig_info(sig, &info, tsk->parent); __wake_up_parent(tsk, tsk->parent); spin_unlock_irqrestore(&psig->siglock, flags); return autoreap; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "A signal access-control issue was discovered in the Linux kernel before 5.6.5, aka CID-7395ea4e65c2. Because exec_id in include/linux/sched.h is only 32 bits, an integer overflow can interfere with a do_notify_parent protection mechanism. A child process can send an arbitrary signal to a parent process in a different security domain. Exploitation limitations include the amount of elapsed time before an integer overflow occurs, and the lack of scenarios where signals to a parent process present a substantial operational threat.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-12826"}} -{"idx": 272983, "input": "SWFInput_stream_getChar(SWFInput input) { struct SWFInputStreamData *data = (struct SWFInputStreamData *) input->data; if (input->offset >= MAX_INPUTSTREAM) return EOF; if ( input->offset == input->length ) { /* fetch from stream, save in buffer */ FILE *f = data->file; int c = fgetc(f); ++input->offset; if ( c != EOF ) { if ( input->length % INPUTSTREAM_INCREMENT == 0 ) { data->buffer = (unsigned char*) realloc(data->buffer, sizeof(unsigned char) * (input->length + INPUTSTREAM_INCREMENT)); } data->buffer[input->length] = c; ++input->length; } return c; } else if ( input->offset < input->length ) { /* fetch from buffer */ return data->buffer[input->offset++]; } else return EOF; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431135, "input": "static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) { __be32 *p; int status = 0; *maxname = 1024; if (unlikely(bitmap[0] & (FATTR4_WORD0_MAXNAME - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) { p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) return -EIO; *maxname = be32_to_cpup(p); bitmap[0] &= ~FATTR4_WORD0_MAXNAME; } dprintk(\"%s: maxname=%u\\n\", __func__, *maxname); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381443, "input": "static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct video_device *vdev = video_devdata(file); struct v4l2_fmtdesc *p = arg; int ret = check_fmt(file, p->type); u32 mbus_code; u32 cap_mask; if (ret) return ret; ret = -EINVAL; if (!(vdev->device_caps & V4L2_CAP_IO_MC)) p->mbus_code = 0; mbus_code = p->mbus_code; CLEAR_AFTER_FIELD(p, type); p->mbus_code = mbus_code; switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: cap_mask = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE; if (!!(vdev->device_caps & cap_mask) != (p->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) break; if (unlikely(!ops->vidioc_enum_fmt_vid_cap)) break; ret = ops->vidioc_enum_fmt_vid_cap(file, fh, arg); break; case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (unlikely(!ops->vidioc_enum_fmt_vid_overlay)) break; ret = ops->vidioc_enum_fmt_vid_overlay(file, fh, arg); break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: cap_mask = V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE; if (!!(vdev->device_caps & cap_mask) != (p->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)) break; if (unlikely(!ops->vidioc_enum_fmt_vid_out)) break; ret = ops->vidioc_enum_fmt_vid_out(file, fh, arg); break; case V4L2_BUF_TYPE_SDR_CAPTURE: if (unlikely(!ops->vidioc_enum_fmt_sdr_cap)) break; ret = ops->vidioc_enum_fmt_sdr_cap(file, fh, arg); break; case V4L2_BUF_TYPE_SDR_OUTPUT: if (unlikely(!ops->vidioc_enum_fmt_sdr_out)) break; ret = ops->vidioc_enum_fmt_sdr_out(file, fh, arg); break; case V4L2_BUF_TYPE_META_CAPTURE: if (unlikely(!ops->vidioc_enum_fmt_meta_cap)) break; ret = ops->vidioc_enum_fmt_meta_cap(file, fh, arg); break; case V4L2_BUF_TYPE_META_OUTPUT: if (unlikely(!ops->vidioc_enum_fmt_meta_out)) break; ret = ops->vidioc_enum_fmt_meta_out(file, fh, arg); break; } if (ret == 0) v4l_fill_fmtdesc(p); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453319, "input": "static bool bfq_allow_bio_merge(struct request_queue *q, struct request *rq, struct bio *bio) { struct bfq_data *bfqd = q->elevator->elevator_data; bool is_sync = op_is_sync(bio->bi_opf); struct bfq_queue *bfqq = bfqd->bio_bfqq, *new_bfqq; /* * Disallow merge of a sync bio into an async request. */ if (is_sync && !rq_is_sync(rq)) return false; /* * Lookup the bfqq that this bio will be queued with. Allow * merge only if rq is queued there. */ if (!bfqq) return false; /* * We take advantage of this function to perform an early merge * of the queues of possible cooperating processes. */ new_bfqq = bfq_setup_cooperator(bfqd, bfqq, bio, false); if (new_bfqq) { /* * bic still points to bfqq, then it has not yet been * redirected to some other bfq_queue, and a queue * merge between bfqq and new_bfqq can be safely * fulfilled, i.e., bic can be redirected to new_bfqq * and bfqq can be put. */ bfq_merge_bfqqs(bfqd, bfqd->bio_bic, bfqq, new_bfqq); /* * If we get here, bio will be queued into new_queue, * so use new_bfqq to decide whether bio and rq can be * merged. */ bfqq = new_bfqq; /* * Change also bqfd->bio_bfqq, as * bfqd->bio_bic now points to new_bfqq, and * this function may be invoked again (and then may * use again bqfd->bio_bfqq). */ bfqd->bio_bfqq = bfqq; } return bfqq == RQ_BFQQ(rq);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246161, "input": "static int tableAndColumnIndex( SrcList *pSrc, /* Array of tables to search */ int N, /* Number of tables in pSrc->a[] to search */ const char *zCol, /* Name of the column we are looking for */ int *piTab, /* Write index of pSrc->a[] here */ int *piCol, /* Write index of pSrc->a[*piTab].pTab->aCol[] here */ int bIgnoreHidden /* True to ignore hidden columns */ ){ int i; /* For looping over tables in pSrc */ int iCol; /* Index of column matching zCol */ assert( (piTab==0)==(piCol==0) ); /* Both or neither are NULL */ for(i=0; ia[i].pTab, zCol); if( iCol>=0 && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0) ){ if( piTab ){ *piTab = i; *piCol = iCol; } return 1; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357397, "input": "static OPJ_BOOL opj_j2k_write_updated_tlm(opj_j2k_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager) { OPJ_UINT32 l_tlm_size; OPJ_OFF_T l_tlm_position, l_current_position; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); l_tlm_size = 5 * p_j2k->m_specific_param.m_encoder.m_total_tile_parts; l_tlm_position = 6 + p_j2k->m_specific_param.m_encoder.m_tlm_start; l_current_position = opj_stream_tell(p_stream); if (! opj_stream_seek(p_stream, l_tlm_position, p_manager)) { return OPJ_FALSE; } if (opj_stream_write_data(p_stream, p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer, l_tlm_size, p_manager) != l_tlm_size) { return OPJ_FALSE; } if (! opj_stream_seek(p_stream, l_current_position, p_manager)) { return OPJ_FALSE; } return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364906, "input": "int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info) { int err; char *link_name; unsigned int bearer_id; struct tipc_link *link; struct tipc_node *node; struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; struct net *net = sock_net(skb->sk); struct tipc_net *tn = tipc_net(net); struct tipc_link_entry *le; if (!info->attrs[TIPC_NLA_LINK]) return -EINVAL; err = nla_parse_nested_deprecated(attrs, TIPC_NLA_LINK_MAX, info->attrs[TIPC_NLA_LINK], tipc_nl_link_policy, info->extack); if (err) return err; if (!attrs[TIPC_NLA_LINK_NAME]) return -EINVAL; link_name = nla_data(attrs[TIPC_NLA_LINK_NAME]); err = -EINVAL; if (!strcmp(link_name, tipc_bclink_name)) { err = tipc_bclink_reset_stats(net, tipc_bc_sndlink(net)); if (err) return err; return 0; } else if (strstr(link_name, tipc_bclink_name)) { rcu_read_lock(); list_for_each_entry_rcu(node, &tn->node_list, list) { tipc_node_read_lock(node); link = node->bc_entry.link; if (link && !strcmp(link_name, tipc_link_name(link))) { err = tipc_bclink_reset_stats(net, link); tipc_node_read_unlock(node); break; } tipc_node_read_unlock(node); } rcu_read_unlock(); return err; } node = tipc_node_find_by_name(net, link_name, &bearer_id); if (!node) return -EINVAL; le = &node->links[bearer_id]; tipc_node_read_lock(node); spin_lock_bh(&le->lock); link = node->links[bearer_id].link; if (!link) { spin_unlock_bh(&le->lock); tipc_node_read_unlock(node); return -EINVAL; } tipc_link_reset_stats(link); spin_unlock_bh(&le->lock); tipc_node_read_unlock(node); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430255, "input": "virSecuritySELinuxContextListFree(void *opaque) { virSecuritySELinuxContextList *list = opaque; size_t i; if (!list) return; for (i = 0; i < list->nItems; i++) virSecuritySELinuxContextItemFree(list->items[i]); g_free(list->items); virObjectUnref(list->manager); g_free(list); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382018, "input": "int CServer::ClientCountry(int ClientID) const { if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State == CServer::CClient::STATE_EMPTY) return -1; if(m_aClients[ClientID].m_State == CServer::CClient::STATE_INGAME) return m_aClients[ClientID].m_Country; else return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366734, "input": "static int mpol_new_bind(struct mempolicy *pol, const nodemask_t *nodes) { if (nodes_empty(*nodes)) return -EINVAL; pol->v.nodes = *nodes; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 313000, "input": "unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info) { unserialize_pos(bi, &info->vi_start); unserialize_pos(bi, &info->vi_end); info->vi_mode = undo_read_4c(bi); info->vi_curswant = undo_read_4c(bi); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 375217, "input": "int group_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p, enum pid_type type) { int ret; rcu_read_lock(); ret = check_kill_permission(sig, info, p); rcu_read_unlock(); if (!ret && sig) ret = do_send_sig_info(sig, info, p, type); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445804, "input": "static inline void __ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags, int skip, int pc, struct pt_regs *regs) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354440, "input": "static inline struct swait_queue_head *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) { #ifdef __KVM_HAVE_ARCH_WQP return vcpu->arch.wqp; #else return &vcpu->wq; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509392, "input": "bool update_vcol_processor(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204285, "input": "static int selectExpander(Walker *pWalker, Select *p){ Parse *pParse = pWalker->pParse; int i, j, k; SrcList *pTabList; ExprList *pEList; struct SrcList_item *pFrom; sqlite3 *db = pParse->db; Expr *pE, *pRight, *pExpr; u16 selFlags = p->selFlags; u32 elistFlags = 0; p->selFlags |= SF_Expanded; if( db->mallocFailed ){ return WRC_Abort; } assert( p->pSrc!=0 ); if( (selFlags & SF_Expanded)!=0 ){ return WRC_Prune; } if( pWalker->eCode ){ /* Renumber selId because it has been copied from a view */ p->selId = ++pParse->nSelect; } pTabList = p->pSrc; pEList = p->pEList; sqlite3WithPush(pParse, p->pWith, 0); /* Make sure cursor numbers have been assigned to all entries in ** the FROM clause of the SELECT statement. */ sqlite3SrcListAssignCursors(pParse, pTabList); /* Look up every table named in the FROM clause of the select. If ** an entry of the FROM clause is a subquery instead of a table or view, ** then create a transient table structure to describe the subquery. */ for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ Table *pTab; assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 ); if( pFrom->fg.isRecursive ) continue; assert( pFrom->pTab==0 ); #ifndef SQLITE_OMIT_CTE if( withExpand(pWalker, pFrom) ) return WRC_Abort; if( pFrom->pTab ) {} else #endif if( pFrom->zName==0 ){ #ifndef SQLITE_OMIT_SUBQUERY Select *pSel = pFrom->pSelect; /* A sub-query in the FROM clause of a SELECT */ assert( pSel!=0 ); assert( pFrom->pTab==0 ); if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort; if( sqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort; #endif }else{ /* An ordinary table or view name in the FROM clause */ assert( pFrom->pTab==0 ); pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom); if( pTab==0 ) return WRC_Abort; if( pTab->nTabRef>=0xffff ){ sqlite3ErrorMsg(pParse, \"too many references to \\\"%s\\\": max 65535\", pTab->zName); pFrom->pTab = 0; return WRC_Abort; } pTab->nTabRef++; if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){ return WRC_Abort; } #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE) if( IsVirtual(pTab) || pTab->pSelect ){ i16 nCol; u8 eCodeOrig = pWalker->eCode; if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; assert( pFrom->pSelect==0 ); if( pTab->pSelect && (db->flags & SQLITE_EnableView)==0 ){ sqlite3ErrorMsg(pParse, \"access to view \\\"%s\\\" prohibited\", pTab->zName); } pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); nCol = pTab->nCol; pTab->nCol = -1; pWalker->eCode = 1; /* Turn on Select.selId renumbering */ sqlite3WalkSelect(pWalker, pFrom->pSelect); pWalker->eCode = eCodeOrig; pTab->nCol = nCol; } #endif } /* Locate the index named by the INDEXED BY clause, if any. */ if( sqlite3IndexedByLookup(pParse, pFrom) ){ return WRC_Abort; } } /* Process NATURAL keywords, and ON and USING clauses of joins. */ if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){ return WRC_Abort; } /* For every \"*\" that occurs in the column list, insert the names of ** all columns in all tables. And for every TABLE.* insert the names ** of all columns in TABLE. The parser inserted a special expression ** with the TK_ASTERISK operator for each \"*\" that it found in the column ** list. The following code just has to locate the TK_ASTERISK ** expressions and expand each one to the list of all columns in ** all tables. ** ** The first loop just checks to see if there are any \"*\" operators ** that need expanding. */ for(k=0; knExpr; k++){ pE = pEList->a[k].pExpr; if( pE->op==TK_ASTERISK ) break; assert( pE->op!=TK_DOT || pE->pRight!=0 ); assert( pE->op!=TK_DOT || (pE->pLeft!=0 && pE->pLeft->op==TK_ID) ); if( pE->op==TK_DOT && pE->pRight->op==TK_ASTERISK ) break; elistFlags |= pE->flags; } if( knExpr ){ /* ** If we get here it means the result set contains one or more \"*\" ** operators that need to be expanded. Loop through each expression ** in the result set and expand them one by one. */ struct ExprList_item *a = pEList->a; ExprList *pNew = 0; int flags = pParse->db->flags; int longNames = (flags & SQLITE_FullColNames)!=0 && (flags & SQLITE_ShortColNames)==0; for(k=0; knExpr; k++){ pE = a[k].pExpr; elistFlags |= pE->flags; pRight = pE->pRight; assert( pE->op!=TK_DOT || pRight!=0 ); if( pE->op!=TK_ASTERISK && (pE->op!=TK_DOT || pRight->op!=TK_ASTERISK) ){ /* This particular expression does not need to be expanded. */ pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr); if( pNew ){ pNew->a[pNew->nExpr-1].zName = a[k].zName; pNew->a[pNew->nExpr-1].zSpan = a[k].zSpan; a[k].zName = 0; a[k].zSpan = 0; } a[k].pExpr = 0; }else{ /* This expression is a \"*\" or a \"TABLE.*\" and needs to be ** expanded. */ int tableSeen = 0; /* Set to 1 when TABLE matches */ char *zTName = 0; /* text of name of TABLE */ if( pE->op==TK_DOT ){ assert( pE->pLeft!=0 ); assert( !ExprHasProperty(pE->pLeft, EP_IntValue) ); zTName = pE->pLeft->u.zToken; } for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; Select *pSub = pFrom->pSelect; char *zTabName = pFrom->zAlias; const char *zSchemaName = 0; int iDb; if( zTabName==0 ){ zTabName = pTab->zName; } if( db->mallocFailed ) break; if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){ pSub = 0; if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ continue; } iDb = sqlite3SchemaToIndex(db, pTab->pSchema); zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : \"*\"; } for(j=0; jnCol; j++){ char *zName = pTab->aCol[j].zName; char *zColname; /* The computed column name */ char *zToFree; /* Malloced string that needs to be freed */ Token sColname; /* Computed column name as a token */ assert( zName ); if( zTName && pSub && sqlite3MatchSpanName(pSub->pEList->a[j].zSpan, 0, zTName, 0)==0 ){ continue; } /* If a column is marked as 'hidden', omit it from the expanded ** result-set list unless the SELECT has the SF_IncludeHidden ** bit set. */ if( (p->selFlags & SF_IncludeHidden)==0 && IsHiddenColumn(&pTab->aCol[j]) ){ continue; } tableSeen = 1; if( i>0 && zTName==0 ){ if( (pFrom->fg.jointype & JT_NATURAL)!=0 && tableAndColumnIndex(pTabList, i, zName, 0, 0) ){ /* In a NATURAL join, omit the join columns from the ** table to the right of the join */ continue; } if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){ /* In a join with a USING clause, omit columns in the ** using clause from the table on the right. */ continue; } } pRight = sqlite3Expr(db, TK_ID, zName); zColname = zName; zToFree = 0; if( longNames || pTabList->nSrc>1 ){ Expr *pLeft; pLeft = sqlite3Expr(db, TK_ID, zTabName); pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); if( zSchemaName ){ pLeft = sqlite3Expr(db, TK_ID, zSchemaName); pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pExpr); } if( longNames ){ zColname = sqlite3MPrintf(db, \"%s.%s\", zTabName, zName); zToFree = zColname; } }else{ pExpr = pRight; } pNew = sqlite3ExprListAppend(pParse, pNew, pExpr); sqlite3TokenInit(&sColname, zColname); sqlite3ExprListSetName(pParse, pNew, &sColname, 0); if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){ struct ExprList_item *pX = &pNew->a[pNew->nExpr-1]; if( pSub ){ pX->zSpan = sqlite3DbStrDup(db, pSub->pEList->a[j].zSpan); testcase( pX->zSpan==0 ); }else{ pX->zSpan = sqlite3MPrintf(db, \"%s.%s.%s\", zSchemaName, zTabName, zColname); testcase( pX->zSpan==0 ); } pX->bSpanIsTab = 1; } sqlite3DbFree(db, zToFree); } } if( !tableSeen ){ if( zTName ){ sqlite3ErrorMsg(pParse, \"no such table: %s\", zTName); }else{ sqlite3ErrorMsg(pParse, \"no tables specified\"); } } } } sqlite3ExprListDelete(db, pEList); p->pEList = pNew; } if( p->pEList ){ if( p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ sqlite3ErrorMsg(pParse, \"too many columns in result set\"); return WRC_Abort; } if( (elistFlags & (EP_HasFunc|EP_Subquery))!=0 ){ p->selFlags |= SF_ComplexResult; } } return WRC_Continue; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Handling of Exceptional Conditions"], "explanation": "selectExpander in select.c in SQLite 3.30.1 proceeds with WITH stack unwinding even after a parsing error.", "severity_level": "NoInfo", "cwe": "CWE-755", "cve": "CVE-2019-20218"}} -{"idx": 295144, "input": "void gdImageAABlend (gdImagePtr im) { float p_alpha, old_alpha; int color = im->AA_color, color_red, color_green, color_blue; int old_color, old_red, old_green, old_blue; int p_color, p_red, p_green, p_blue; int px, py; color_red = gdImageRed(im, color); color_green = gdImageGreen(im, color); color_blue = gdImageBlue(im, color); /* Impose the anti-aliased drawing on the image. */ for (py = 0; py < im->sy; py++) { for (px = 0; px < im->sx; px++) { if (im->AA_opacity[py][px] != 0) { old_color = gdImageGetPixel(im, px, py); if ((old_color != color) && ((old_color != im->AA_dont_blend) || (im->AA_opacity[py][px] == 255))) { /* Only blend with different colors that aren't the dont_blend color. */ p_alpha = (float) (im->AA_opacity[py][px]) / 255.0; old_alpha = 1.0 - p_alpha; if (p_alpha >= 1.0) { p_color = color; } else { old_red = gdImageRed(im, old_color); old_green = gdImageGreen(im, old_color); old_blue = gdImageBlue(im, old_color); p_red = (int) (((float) color_red * p_alpha) + ((float) old_red * old_alpha)); p_green = (int) (((float) color_green * p_alpha) + ((float) old_green * old_alpha)); p_blue = (int) (((float) color_blue * p_alpha) + ((float) old_blue * old_alpha)); p_color = gdImageColorResolve(im, p_red, p_green, p_blue); } gdImageSetPixel(im, px, py, p_color); } } } /* Clear the AA_opacity array behind us. */ memset(im->AA_opacity[py], 0, im->sx); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509289, "input": "bool copy_up_to(size_t bytes) { DBUG_ASSERT(bytes >= from); return dst->append(src + from, uint32(bytes - from)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357427, "input": "static void opj_j2k_write_float_to_int16(const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem) { OPJ_BYTE * l_dest_data = (OPJ_BYTE *) p_dest_data; OPJ_FLOAT32 * l_src_data = (OPJ_FLOAT32 *) p_src_data; OPJ_UINT32 i; OPJ_UINT32 l_temp; for (i = 0; i < p_nb_elem; ++i) { l_temp = (OPJ_UINT32) * (l_src_data++); opj_write_bytes(l_dest_data, l_temp, sizeof(OPJ_INT16)); l_dest_data += sizeof(OPJ_INT16); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 236223, "input": "const GF_FilterRegister *av1dmx_register(GF_FilterSession *session) { return &AV1DmxRegister; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246313, "input": "static void core_dump_config(apr_pool_t *p, server_rec *s) { core_server_config *sconf = ap_get_core_module_config(s->module_config); apr_file_t *out = NULL; const char *tmp; const char **defines; int i; if (!ap_exists_config_define(\"DUMP_RUN_CFG\")) return; apr_file_open_stdout(&out, p); apr_file_printf(out, \"ServerRoot: \\\"%s\\\"\\n\", ap_server_root); tmp = ap_server_root_relative(p, sconf->ap_document_root); apr_file_printf(out, \"Main DocumentRoot: \\\"%s\\\"\\n\", tmp); if (s->error_fname[0] != '|' && s->errorlog_provider == NULL) tmp = ap_server_root_relative(p, s->error_fname); else tmp = s->error_fname; apr_file_printf(out, \"Main ErrorLog: \\\"%s\\\"\\n\", tmp); if (ap_scoreboard_fname) { tmp = ap_runtime_dir_relative(p, ap_scoreboard_fname); apr_file_printf(out, \"ScoreBoardFile: \\\"%s\\\"\\n\", tmp); } ap_dump_mutexes(p, s, out); ap_mpm_dump_pidfile(p, out); defines = (const char **)ap_server_config_defines->elts; for (i = 0; i < ap_server_config_defines->nelts; i++) { const char *name = defines[i]; const char *val = NULL; if (server_config_defined_vars) val = apr_table_get(server_config_defined_vars, name); if (val) apr_file_printf(out, \"Define: %s=%s\\n\", name, val); else apr_file_printf(out, \"Define: %s\\n\", name); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382044, "input": "int CServerBan::BanRange(const CNetRange *pRange, int Seconds, const char *pReason) { if(pRange->IsValid()) return BanExt(&m_BanRangePool, pRange, Seconds, pReason); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, \"net_ban\", \"ban failed (invalid range)\"); return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 284270, "input": "static int table_check_val_len(void *baton, const char *key, const char *value) { val_len_check_ctx *ctx = baton; if (strlen(value) <= ctx->maxlen) return 1; ctx->failed_key = key; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232574, "input": "static void free_func_state(struct bpf_func_state *state) { if (!state) return; kfree(state->refs); kfree(state->stack); kfree(state); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 220479, "input": "SparseHybridFullyConnectedTask( TfLiteContext* context, TfLiteNode* node, TfLiteFullyConnectedParams* params, OpData* data, const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* bias, const int thread_start, const int thread_end, TfLiteTensor* input_quantized, TfLiteTensor* scaling_factors, TfLiteTensor* accum_scratch, TfLiteTensor* row_sums, TfLiteTensor* input_offsets, TfLiteTensor* output) : context(context), node(node), params(params), data(data), input(input), filter(filter), bias(bias), thread_start(thread_start), thread_end(thread_end), input_quantized(input_quantized), scaling_factors(scaling_factors), accum_scratch(accum_scratch), row_sums(row_sums), input_offsets(input_offsets), output(output) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 337026, "input": "rb_obj_as_string(VALUE obj) { VALUE str; if (TYPE(obj) == T_STRING) { return obj; } str = rb_funcall(obj, id_to_s, 0); if (TYPE(str) != T_STRING) return rb_any_to_s(obj); if (OBJ_TAINTED(obj)) OBJ_TAINT(str); return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263478, "input": "bool FromkLinuxStat(const struct klinux_stat *input, struct stat *output) { if (!input || !output) return false; output->st_atime = input->klinux_st_atime; output->st_blksize = input->klinux_st_blksize; output->st_blocks = input->klinux_st_blocks; output->st_mtime = input->klinux_st_mtime; output->st_dev = input->klinux_st_dev; output->st_gid = input->klinux_st_gid; output->st_ino = input->klinux_st_ino; output->st_mode = input->klinux_st_mode; output->st_ctime = input->klinux_st_ctime; output->st_nlink = input->klinux_st_nlink; output->st_rdev = input->klinux_st_rdev; output->st_size = input->klinux_st_size; output->st_uid = input->klinux_st_uid; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197051, "input": "ModuleExport MagickBooleanType ReadPSDLayers(Image *image, const ImageInfo *image_info,const PSDInfo *psd_info, const MagickBooleanType skip_layers,ExceptionInfo *exception) { char type[4]; LayerInfo *layer_info; MagickSizeType size; MagickBooleanType status; register ssize_t i; ssize_t count, j, number_layers; size=GetPSDSize(psd_info,image); if (size == 0) { /* Skip layers & masks. */ (void) ReadBlobLong(image); count=ReadBlob(image,4,(unsigned char *) type); ReversePSDString(image,type,4); status=MagickFalse; if ((count == 0) || (LocaleNCompare(type,\"8BIM\",4) != 0)) return(MagickTrue); else { count=ReadBlob(image,4,(unsigned char *) type); ReversePSDString(image,type,4); if ((count != 0) && (LocaleNCompare(type,\"Lr16\",4) == 0)) size=GetPSDSize(psd_info,image); else return(MagickTrue); } } status=MagickTrue; if (size != 0) { layer_info=(LayerInfo *) NULL; number_layers=(short) ReadBlobShort(image); if (number_layers < 0) { /* The first alpha channel in the merged result contains the transparency data for the merged result. */ number_layers=MagickAbsoluteValue(number_layers); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" negative layer count corrected for\"); image->alpha_trait=BlendPixelTrait; } /* We only need to know if the image has an alpha channel */ if (skip_layers != MagickFalse) return(MagickTrue); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" image contains %.20g layers\",(double) number_layers); if (number_layers == 0) ThrowBinaryException(CorruptImageError,\"InvalidNumberOfLayers\", image->filename); layer_info=(LayerInfo *) AcquireQuantumMemory((size_t) number_layers, sizeof(*layer_info)); if (layer_info == (LayerInfo *) NULL) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" allocation of LayerInfo failed\"); ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\", image->filename); } (void) ResetMagickMemory(layer_info,0,(size_t) number_layers* sizeof(*layer_info)); for (i=0; i < number_layers; i++) { ssize_t x, y; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" reading layer #%.20g\",(double) i+1); layer_info[i].page.y=ReadBlobSignedLong(image); layer_info[i].page.x=ReadBlobSignedLong(image); y=ReadBlobSignedLong(image); x=ReadBlobSignedLong(image); layer_info[i].page.width=(size_t) (x-layer_info[i].page.x); layer_info[i].page.height=(size_t) (y-layer_info[i].page.y); layer_info[i].channels=ReadBlobShort(image); if (layer_info[i].channels > MaxPSDChannels) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,\"MaximumChannelsExceeded\", image->filename); } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" offset(%.20g,%.20g), size(%.20g,%.20g), channels=%.20g\", (double) layer_info[i].page.x,(double) layer_info[i].page.y, (double) layer_info[i].page.height,(double) layer_info[i].page.width,(double) layer_info[i].channels); for (j=0; j < (ssize_t) layer_info[i].channels; j++) { layer_info[i].channel_info[j].type=(short) ReadBlobShort(image); layer_info[i].channel_info[j].size=(size_t) GetPSDSize(psd_info, image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" channel[%.20g]: type=%.20g, size=%.20g\",(double) j, (double) layer_info[i].channel_info[j].type, (double) layer_info[i].channel_info[j].size); } count=ReadBlob(image,4,(unsigned char *) type); ReversePSDString(image,type,4); if ((count == 0) || (LocaleNCompare(type,\"8BIM\",4) != 0)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer type was %.4s instead of 8BIM\", type); layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,\"ImproperImageHeader\", image->filename); } count=ReadBlob(image,4,(unsigned char *) layer_info[i].blendkey); ReversePSDString(image,layer_info[i].blendkey,4); layer_info[i].opacity=(Quantum) ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); layer_info[i].clipping=(unsigned char) ReadBlobByte(image); layer_info[i].flags=(unsigned char) ReadBlobByte(image); layer_info[i].visible=!(layer_info[i].flags & 0x02); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" blend=%.4s, opacity=%.20g, clipping=%s, flags=%d, visible=%s\", layer_info[i].blendkey,(double) layer_info[i].opacity, layer_info[i].clipping ? \"true\" : \"false\",layer_info[i].flags, layer_info[i].visible ? \"true\" : \"false\"); (void) ReadBlobByte(image); /* filler */ size=ReadBlobLong(image); if (size != 0) { MagickSizeType combined_length, length; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer contains additional info\"); length=ReadBlobLong(image); combined_length=length+4; if (length != 0) { /* Layer mask info. */ layer_info[i].mask.page.y=ReadBlobSignedLong(image); layer_info[i].mask.page.x=ReadBlobSignedLong(image); layer_info[i].mask.page.height=(size_t) (ReadBlobLong(image)- layer_info[i].mask.page.y); layer_info[i].mask.page.width=(size_t) (ReadBlobLong(image)- layer_info[i].mask.page.x); layer_info[i].mask.background=(unsigned char) ReadBlobByte( image); layer_info[i].mask.flags=(unsigned char) ReadBlobByte(image); if (!(layer_info[i].mask.flags & 0x01)) { layer_info[i].mask.page.y=layer_info[i].mask.page.y- layer_info[i].page.y; layer_info[i].mask.page.x=layer_info[i].mask.page.x- layer_info[i].page.x; } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer mask: offset(%.20g,%.20g), size(%.20g,%.20g), length=%.20g\", (double) layer_info[i].mask.page.x,(double) layer_info[i].mask.page.y,(double) layer_info[i].mask.page.width, (double) layer_info[i].mask.page.height,(double) ((MagickOffsetType) length)-18); /* Skip over the rest of the layer mask information. */ if (DiscardBlobBytes(image,(MagickSizeType) (length-18)) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,\"UnexpectedEndOfFile\", image->filename); } } length=ReadBlobLong(image); combined_length+=length+4; if (length != 0) { /* Layer blending ranges info. */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer blending ranges: length=%.20g\",(double) ((MagickOffsetType) length)); /* We read it, but don't use it... */ for (j=0; j < (ssize_t) length; j+=8) { size_t blend_source=ReadBlobLong(image); size_t blend_dest=ReadBlobLong(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" source(%x), dest(%x)\",(unsigned int) blend_source,(unsigned int) blend_dest); } } /* Layer name. */ length=(MagickSizeType) ReadBlobByte(image); combined_length+=length+1; if (length > 0) (void) ReadBlob(image,(size_t) length++,layer_info[i].name); layer_info[i].name[length]='\\0'; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer name: %s\",layer_info[i].name); if ((length % 4) != 0) { length=4-(length % 4); combined_length+=length; /* Skip over the padding of the layer name */ if (DiscardBlobBytes(image,length) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, \"UnexpectedEndOfFile\",image->filename); } } length=(MagickSizeType) size-combined_length; if (length > 0) { unsigned char *info; layer_info[i].info=AcquireStringInfo((const size_t) length); info=GetStringInfoDatum(layer_info[i].info); (void) ReadBlob(image,(const size_t) length,info); } } } for (i=0; i < number_layers; i++) { if ((layer_info[i].page.width == 0) || (layer_info[i].page.height == 0)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" layer data is empty\"); continue; } /* Allocate layered image. */ layer_info[i].image=CloneImage(image,layer_info[i].page.width, layer_info[i].page.height,MagickFalse,exception); if (layer_info[i].image == (Image *) NULL) { layer_info=DestroyLayerInfo(layer_info,number_layers); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" allocation of image for layer %.20g failed\",(double) i); ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\", image->filename); } if (layer_info[i].info != (StringInfo *) NULL) { (void) SetImageProfile(layer_info[i].image,\"psd:additional-info\", layer_info[i].info,exception); layer_info[i].info=DestroyStringInfo(layer_info[i].info); } } if (image_info->ping == MagickFalse) { for (i=0; i < number_layers; i++) { if (layer_info[i].image == (Image *) NULL) { for (j=0; j < layer_info[i].channels; j++) { if (DiscardBlobBytes(image,(MagickSizeType) layer_info[i].channel_info[j].size) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, \"UnexpectedEndOfFile\",image->filename); } } continue; } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" reading data for layer %.20g\",(double) i); status=ReadPSDLayer(image,image_info,psd_info,&layer_info[i], exception); if (status == MagickFalse) break; status=SetImageProgress(image,LoadImagesTag,i,(MagickSizeType) number_layers); if (status == MagickFalse) break; } } if (status != MagickFalse) { for (i=0; i < number_layers; i++) { if (layer_info[i].image == (Image *) NULL) { for (j=i; j < number_layers - 1; j++) layer_info[j] = layer_info[j+1]; number_layers--; i--; } } if (number_layers > 0) { for (i=0; i < number_layers; i++) { if (i > 0) layer_info[i].image->previous=layer_info[i-1].image; if (i < (number_layers-1)) layer_info[i].image->next=layer_info[i+1].image; layer_info[i].image->page=layer_info[i].page; } image->next=layer_info[0].image; layer_info[0].image->previous=image; } layer_info=(LayerInfo *) RelinquishMagickMemory(layer_info); } else layer_info=DestroyLayerInfo(layer_info,number_layers); } return(status); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "Memory leak in the ReadPSDLayers function in coders/psd.c in ImageMagick before 6.9.6-3 allows remote attackers to cause a denial of service (memory consumption) via a crafted image file.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2016-10058"}} -{"idx": 413217, "input": "mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid, struct sk_buff *skb, u32 tx_info) { struct mt76_queue *q = dev->q_tx[qid].q; struct mt76_queue_buf buf; dma_addr_t addr; addr = dma_map_single(dev->dev, skb->data, skb->len, DMA_TO_DEVICE); if (unlikely(dma_mapping_error(dev->dev, addr))) return -ENOMEM; buf.addr = addr; buf.len = skb->len; spin_lock_bh(&q->lock); mt76_dma_add_buf(dev, q, &buf, 1, tx_info, skb, NULL); mt76_dma_kick_queue(dev, q); spin_unlock_bh(&q->lock); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230480, "input": "static int _clua_dofile(lua_State *ls) { const char *file = luaL_checkstring(ls, 1); if (!file) return 0; const int err = CLua::loadfile(ls, file, !CLua::is_managed_vm(ls)); if (err) return lua_error(ls); lua_call(ls, 0, LUA_MULTRET); return lua_gettop(ls); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 411777, "input": "static INLINE void write_pixel_24(BYTE* _buf, UINT32 _pix) { (_buf)[0] = (BYTE)(_pix); (_buf)[1] = (BYTE)((_pix) >> 8); (_buf)[2] = (BYTE)((_pix) >> 16); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325884, "input": "archive_mstring_get_mbs(struct archive *a, struct archive_mstring *aes, const char **p) { int r, ret = 0; (void)a; /* UNUSED */ /* If we already have an MBS form, return that immediately. */ if (aes->aes_set & AES_SET_MBS) { *p = aes->aes_mbs.s; return (ret); } *p = NULL; /* If there's a WCS form, try converting with the native locale. */ if (aes->aes_set & AES_SET_WCS) { archive_string_empty(&(aes->aes_mbs)); r = archive_string_append_from_wcs(&(aes->aes_mbs), aes->aes_wcs.s, aes->aes_wcs.length); *p = aes->aes_mbs.s; if (r == 0) { aes->aes_set |= AES_SET_MBS; return (ret); } else ret = -1; } /* * Only a UTF-8 form cannot avail because its conversion already * failed at archive_mstring_update_utf8(). */ return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 310353, "input": "static ssize_t name_show(struct device *dev, struct device_attribute *attr, char *buf) { struct powercap_zone *power_zone = to_powercap_zone(dev); return sprintf(buf, \"%s\\n\", power_zone->name); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293577, "input": "mdadm_app_cmp(const void *x, const void *y) { const mdadm_app *a = x; const mdadm_app *b = y; return STREQ (a->mdadm, b->mdadm); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 359162, "input": "void opj_tcd_marker_info_destroy(opj_tcd_marker_info_t *p_tcd_marker_info) { if (p_tcd_marker_info) { opj_free(p_tcd_marker_info->p_packet_size); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280490, "input": "format_DECAP(const struct ofpact_decap *a, const struct ofpact_format_params *fp) { ds_put_format(fp->s, \"%sdecap(%s\", colors.paren, colors.end); if (a->new_pkt_type != htonl(PT_USE_NEXT_PROTO)) { ds_put_format(fp->s, \"packet_type(ns=%\"PRIu16\",id=%#\"PRIx16\")\", pt_ns(a->new_pkt_type), pt_ns_type(a->new_pkt_type)); } ds_put_format(fp->s, \"%s)%s\", colors.paren, colors.end); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385209, "input": "static const char* tcp_conv_get_filter_type(conv_item_t* conv, conv_filter_type_e filter) { if (filter == CONV_FT_SRC_PORT) return \"tcp.srcport\"; if (filter == CONV_FT_DST_PORT) return \"tcp.dstport\"; if (filter == CONV_FT_ANY_PORT) return \"tcp.port\"; if(!conv) { return CONV_FILTER_INVALID; } if (filter == CONV_FT_SRC_ADDRESS) { if (conv->src_address.type == AT_IPv4) return \"ip.src\"; if (conv->src_address.type == AT_IPv6) return \"ipv6.src\"; } if (filter == CONV_FT_DST_ADDRESS) { if (conv->dst_address.type == AT_IPv4) return \"ip.dst\"; if (conv->dst_address.type == AT_IPv6) return \"ipv6.dst\"; } if (filter == CONV_FT_ANY_ADDRESS) { if (conv->src_address.type == AT_IPv4) return \"ip.addr\"; if (conv->src_address.type == AT_IPv6) return \"ipv6.addr\"; } return CONV_FILTER_INVALID; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269886, "input": "void Commissioner::HandleRelayReceive(Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { OT_UNUSED_VARIABLE(aMessageInfo); otError error; JoinerUdpPortTlv joinerPort; JoinerIidTlv joinerIid; JoinerRouterLocatorTlv joinerRloc; Ip6::MessageInfo joinerMessageInfo; uint16_t offset; uint16_t length; bool enableJoiner = false; Mac::ExtAddress receivedId; Mac::ExtAddress joinerId; VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE); VerifyOrExit(aMessage.GetType() == OT_COAP_TYPE_NON_CONFIRMABLE && aMessage.GetCode() == OT_COAP_CODE_POST); SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kJoinerUdpPort, sizeof(joinerPort), joinerPort)); VerifyOrExit(joinerPort.IsValid(), error = OT_ERROR_PARSE); SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kJoinerIid, sizeof(joinerIid), joinerIid)); VerifyOrExit(joinerIid.IsValid(), error = OT_ERROR_PARSE); SuccessOrExit(error = Tlv::GetTlv(aMessage, Tlv::kJoinerRouterLocator, sizeof(joinerRloc), joinerRloc)); VerifyOrExit(joinerRloc.IsValid(), error = OT_ERROR_PARSE); SuccessOrExit(error = Tlv::GetValueOffset(aMessage, Tlv::kJoinerDtlsEncapsulation, offset, length)); VerifyOrExit(length <= aMessage.GetLength() - offset, error = OT_ERROR_PARSE); if (!Get().IsConnectionActive()) { memcpy(mJoinerIid, joinerIid.GetIid(), sizeof(mJoinerIid)); receivedId.Set(mJoinerIid); receivedId.ToggleLocal(); for (Joiner *joiner = &mJoiners[0]; joiner < OT_ARRAY_END(mJoiners); joiner++) { if (!joiner->mValid) { continue; } ComputeJoinerId(joiner->mEui64, joinerId); if (joiner->mAny || (joinerId == receivedId)) { error = Get().SetPsk(reinterpret_cast(joiner->mPsk), static_cast(strlen(joiner->mPsk))); SuccessOrExit(error); mJoinerIndex = static_cast(joiner - mJoiners); enableJoiner = true; otLogInfoMeshCoP(\"found joiner, starting new session\"); SignalJoinerEvent(OT_COMMISSIONER_JOINER_START, joinerId); break; } } } else { enableJoiner = (memcmp(mJoinerIid, joinerIid.GetIid(), sizeof(mJoinerIid)) == 0); } VerifyOrExit(enableJoiner); mJoinerPort = joinerPort.GetUdpPort(); mJoinerRloc = joinerRloc.GetJoinerRouterLocator(); otLogInfoMeshCoP(\"Remove Relay Receive (%02x%02x%02x%02x%02x%02x%02x%02x, 0x%04x)\", mJoinerIid[0], mJoinerIid[1], mJoinerIid[2], mJoinerIid[3], mJoinerIid[4], mJoinerIid[5], mJoinerIid[6], mJoinerIid[7], mJoinerRloc); aMessage.SetOffset(offset); SuccessOrExit(error = aMessage.SetLength(offset + length)); joinerMessageInfo.SetPeerAddr(Get().GetMeshLocal64()); joinerMessageInfo.GetPeerAddr().SetIid(mJoinerIid); joinerMessageInfo.SetPeerPort(mJoinerPort); Get().HandleUdpReceive(aMessage, joinerMessageInfo); exit: return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453703, "input": "struct sc_card_driver * sc_get_tcos_driver(void) { struct sc_card_driver *iso_drv = sc_get_iso7816_driver(); if (iso_ops == NULL) iso_ops = iso_drv->ops; tcos_ops = *iso_drv->ops; tcos_ops.match_card = tcos_match_card; tcos_ops.init = tcos_init; tcos_ops.finish = tcos_finish; tcos_ops.create_file = tcos_create_file; tcos_ops.set_security_env = tcos_set_security_env; tcos_ops.select_file = tcos_select_file; tcos_ops.list_files = tcos_list_files; tcos_ops.delete_file = tcos_delete_file; tcos_ops.compute_signature = tcos_compute_signature; tcos_ops.decipher = tcos_decipher; tcos_ops.restore_security_env = tcos_restore_security_env; tcos_ops.card_ctl = tcos_card_ctl; return &tcos_drv; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421885, "input": "CairoFontEngine::~CairoFontEngine() { int i; for (i = 0; i < cairoFontCacheSize; ++i) { if (fontCache[i]) delete fontCache[i]; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432867, "input": "static BOOL update_process_glyph(rdpContext* context, const BYTE* data, UINT32 cacheIndex, INT32* x, INT32* y, UINT32 cacheId, UINT32 flAccel, BOOL fOpRedundant, const RDP_RECT* bound) { INT32 sx = 0, sy = 0; INT32 dx, dy; rdpGlyph* glyph; rdpGlyphCache* glyph_cache; if (!context || !data || !x || !y || !context->graphics || !context->cache || !context->cache->glyph) return FALSE; glyph_cache = context->cache->glyph; glyph = glyph_cache_get(glyph_cache, cacheId, cacheIndex); if (!glyph) return FALSE; dx = glyph->x + *x; dy = glyph->y + *y; if (dx < bound->x) { sx = bound->x - dx; dx = bound->x; } if (dy < bound->y) { sy = bound->y - dy; dy = bound->y; } if ((dx <= (bound->x + bound->width)) && (dy <= (bound->y + bound->height))) { INT32 dw = glyph->cx - sx; INT32 dh = glyph->cy - sy; if ((dw + dx) > (bound->x + bound->width)) dw = (bound->x + bound->width) - (dw + dx); if ((dh + dy) > (bound->y + bound->height)) dh = (bound->y + bound->height) - (dh + dy); if ((dh > 0) && (dw > 0)) { if (!glyph->Draw(context, glyph, dx, dy, dw, dh, sx, sy, fOpRedundant)) return FALSE; } } if (flAccel & SO_CHAR_INC_EQUAL_BM_BASE) *x += glyph->cx; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499695, "input": "set_new_media_message (char *message) { char *p; int prev_was_percent; p = message; prev_was_percent = 0; while (*p != '\\0') { if (*p == 'd' && prev_was_percent) break; prev_was_percent = (*p == '%'); ++p; } if (*p == '\\0') { new_media_message = xstrdup (message); } else { int length = p - message - 1; new_media_message_with_number = xmalloc (length + 1); strncpy (new_media_message_with_number, message, length); new_media_message_with_number[length] = '\\0'; length = strlen (p + 1); new_media_message_after_number = xmalloc (length + 1); strcpy (new_media_message_after_number, p + 1); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370051, "input": "ExpressionDateFromParts::ExpressionDateFromParts(ExpressionContext* const expCtx, intrusive_ptr year, intrusive_ptr month, intrusive_ptr day, intrusive_ptr hour, intrusive_ptr minute, intrusive_ptr second, intrusive_ptr millisecond, intrusive_ptr isoWeekYear, intrusive_ptr isoWeek, intrusive_ptr isoDayOfWeek, intrusive_ptr timeZone) : Expression(expCtx, {std::move(year), std::move(month), std::move(day), std::move(hour), std::move(minute), std::move(second), std::move(millisecond), std::move(isoWeekYear), std::move(isoWeek), std::move(isoDayOfWeek), std::move(timeZone)}), _year(_children[0]), _month(_children[1]), _day(_children[2]), _hour(_children[3]), _minute(_children[4]), _second(_children[5]), _millisecond(_children[6]), _isoWeekYear(_children[7]), _isoWeek(_children[8]), _isoDayOfWeek(_children[9]), _timeZone(_children[10]) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280085, "input": "int __kmem_cache_create(struct kmem_cache *s, slab_flags_t flags) { int err; err = kmem_cache_open(s, flags); if (err) return err; /* Mutex is not taken during early boot */ if (slab_state <= UP) return 0; memcg_propagate_slab_attrs(s); err = sysfs_slab_add(s); if (err) __kmem_cache_release(s); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 411769, "input": "BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, const BYTE* pSrcData, UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, UINT32 bpp, BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette* palette) { UINT32 scanline; UINT32 SrcFormat; UINT32 BufferSize; if (!interleaved || !pSrcData || !pDstData) return FALSE; switch (bpp) { case 24: scanline = nSrcWidth * 3; SrcFormat = PIXEL_FORMAT_BGR24; break; case 16: scanline = nSrcWidth * 2; SrcFormat = PIXEL_FORMAT_RGB16; break; case 15: scanline = nSrcWidth * 2; SrcFormat = PIXEL_FORMAT_RGB15; break; case 8: scanline = nSrcWidth; SrcFormat = PIXEL_FORMAT_RGB8; break; default: WLog_ERR(TAG, \"Invalid color depth %\" PRIu32 \"\", bpp); return FALSE; } BufferSize = scanline * nSrcHeight; if (BufferSize > interleaved->TempSize) { interleaved->TempBuffer = _aligned_realloc(interleaved->TempBuffer, BufferSize, 16); interleaved->TempSize = BufferSize; } if (!interleaved->TempBuffer) return FALSE; switch (bpp) { case 24: if (!RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nSrcWidth, nSrcHeight)) return FALSE; break; case 16: case 15: if (!RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nSrcWidth, nSrcHeight)) return FALSE; break; case 8: if (!RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nSrcWidth, nSrcHeight)) return FALSE; break; default: return FALSE; } return freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, nDstWidth, nDstHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette, FREERDP_FLIP_VERTICAL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453362, "input": "*/ static struct request *bfq_check_fifo(struct bfq_queue *bfqq, struct request *last) { struct request *rq; if (bfq_bfqq_fifo_expire(bfqq)) return NULL; bfq_mark_bfqq_fifo_expire(bfqq); rq = rq_entry_fifo(bfqq->fifo.next); if (rq == last || ktime_get_ns() < rq->fifo_time) return NULL; bfq_log_bfqq(bfqq->bfqd, bfqq, \"check_fifo: returned %p\", rq); return rq;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 272293, "input": "multi_create_instance(struct multi_context *m, const struct mroute_addr *real) { struct gc_arena gc = gc_new(); struct multi_instance *mi; perf_push(PERF_MULTI_CREATE_INSTANCE); msg(D_MULTI_MEDIUM, \"MULTI: multi_create_instance called\"); ALLOC_OBJ_CLEAR(mi, struct multi_instance); mi->gc = gc_new(); multi_instance_inc_refcount(mi); mi->vaddr_handle = -1; mi->created = now; mroute_addr_init(&mi->real); if (real) { mi->real = *real; generate_prefix(mi); } mi->did_open_context = true; inherit_context_child(&mi->context, &m->top); if (IS_SIG(&mi->context)) { goto err; } mi->context.c2.context_auth = CAS_PENDING; if (hash_n_elements(m->hash) >= m->max_clients) { msg(D_MULTI_ERRORS, \"MULTI: new incoming connection would exceed maximum number of clients (%d)\", m->max_clients); goto err; } if (!real) /* TCP mode? */ { if (!multi_tcp_instance_specific_init(m, mi)) { goto err; } generate_prefix(mi); } if (!hash_add(m->iter, &mi->real, mi, false)) { msg(D_MULTI_LOW, \"MULTI: unable to add real address [%s] to iterator hash table\", mroute_addr_print(&mi->real, &gc)); goto err; } mi->did_iter = true; #ifdef MANAGEMENT_DEF_AUTH do { mi->context.c2.mda_context.cid = m->cid_counter++; } while (!hash_add(m->cid_hash, &mi->context.c2.mda_context.cid, mi, false)); mi->did_cid_hash = true; #endif mi->context.c2.push_reply_deferred = true; #ifdef ENABLE_ASYNC_PUSH mi->context.c2.push_request_received = false; mi->inotify_watch = -1; #endif if (!multi_process_post(m, mi, MPP_PRE_SELECT)) { msg(D_MULTI_ERRORS, \"MULTI: signal occurred during client instance initialization\"); goto err; } perf_pop(); gc_free(&gc); return mi; err: multi_close_instance(m, mi, false); perf_pop(); gc_free(&gc); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234412, "input": "static void ff_layout_write_release(void *data) { struct nfs_pgio_header *hdr = data; ff_layout_write_record_layoutstats_done(&hdr->task, hdr); if (test_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags)) { ff_layout_send_layouterror(hdr->lseg); ff_layout_reset_write(hdr, true); } else if (test_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags)) ff_layout_reset_write(hdr, false); pnfs_generic_rw_release(data); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383742, "input": "g_verify_neg_token_init(unsigned char **buf_in, unsigned int cur_size) { unsigned char *buf = *buf_in; unsigned char *endptr = buf + cur_size; int seqsize; int ret = 0; unsigned int bytes; /* * Verify this is a NegotiationToken type token * - check for a0(context specific identifier) * - get length and verify that enoughd ata exists */ if (g_get_tag_and_length(&buf, CONTEXT, cur_size, &bytes) < 0) return (G_BAD_TOK_HEADER); cur_size = bytes; /* should indicate bytes remaining */ /* * Verify the next piece, it should identify this as * a strucure of type NegTokenInit. */ if (*buf++ == SEQUENCE) { if ((seqsize = gssint_get_der_length(&buf, cur_size, &bytes)) < 0) return (G_BAD_TOK_HEADER); /* * Make sure we have the entire buffer as described */ if (seqsize > endptr - buf) return (G_BAD_TOK_HEADER); } else { return (G_BAD_TOK_HEADER); } cur_size = seqsize; /* should indicate bytes remaining */ /* * Verify that the first blob is a sequence of mechTypes */ if (*buf++ == CONTEXT) { if ((seqsize = gssint_get_der_length(&buf, cur_size, &bytes)) < 0) return (G_BAD_TOK_HEADER); /* * Make sure we have the entire buffer as described */ if (seqsize > endptr - buf) return (G_BAD_TOK_HEADER); } else { return (G_BAD_TOK_HEADER); } /* * At this point, *buf should be at the beginning of the * DER encoded list of mech types that are to be negotiated. */ *buf_in = buf; return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381530, "input": "static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct video_device *vfd = video_devdata(file); struct v4l2_ext_controls *p = arg; struct v4l2_fh *vfh = test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; p->error_idx = p->count; if (vfh && vfh->ctrl_handler) return v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, vfd, vfd->v4l2_dev->mdev, p); if (vfd->ctrl_handler) return v4l2_s_ext_ctrls(NULL, vfd->ctrl_handler, vfd, vfd->v4l2_dev->mdev, p); if (ops->vidioc_s_ext_ctrls == NULL) return -ENOTTY; return check_ext_ctrls(p, 0) ? ops->vidioc_s_ext_ctrls(file, fh, p) : -EINVAL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393012, "input": "TEST_F(QueryPlannerTest, MergeSortReverseScanOneIndex) { addIndex(BSON(\"a\" << 1 << \"c\" << 1)); addIndex(BSON(\"b\" << 1 << \"c\" << -1)); runQueryAsCommand(fromjson(\"{find: 'testns', filter: {$or: [{a: 1}, {b: 1}]}, sort: {c: 1}}\")); assertNumSolutions(2U); assertSolutionExists( \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \" \"{cscan: {dir: 1}}}}}}\"); assertSolutionExists( \"{fetch: {node: {mergeSort: {nodes: \" \"[{ixscan: {pattern: {a: 1, c: 1}, dir: 1}}, {ixscan: {pattern: {b: 1, c: -1}, dir: \" \"-1}}]}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432866, "input": "const void* glyph_cache_fragment_get(rdpGlyphCache* glyphCache, UINT32 index, UINT32* size) { void* fragment; if (index > 255) { WLog_ERR(TAG, \"invalid glyph cache fragment index: %\" PRIu32 \"\", index); return NULL; } fragment = glyphCache->fragCache.entries[index].fragment; *size = (BYTE)glyphCache->fragCache.entries[index].size; WLog_Print(glyphCache->log, WLOG_DEBUG, \"GlyphCacheFragmentGet: index: %\" PRIu32 \" size: %\" PRIu32 \"\", index, *size); if (!fragment) WLog_ERR(TAG, \"invalid glyph fragment at index:%\" PRIu32 \"\", index); return fragment; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 454795, "input": "bool wsrep_sst_receive_address_update (sys_var *self, THD* thd, enum_var_type type) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 200109, "input": "xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst, int recover) { xmlParserCtxtPtr ctxt; xmlDocPtr newDoc; xmlSAXHandlerPtr oldsax = NULL; xmlNodePtr content, newRoot; int size; int ret = 0; if (depth > 40) { return(XML_ERR_ENTITY_LOOP); } if (lst != NULL) *lst = NULL; if (string == NULL) return(-1); size = xmlStrlen(string); ctxt = xmlCreateMemoryParserCtxt((char *) string, size); if (ctxt == NULL) return(-1); ctxt->userData = ctxt; if (sax != NULL) { oldsax = ctxt->sax; ctxt->sax = sax; if (user_data != NULL) ctxt->userData = user_data; } newDoc = xmlNewDoc(BAD_CAST \"1.0\"); if (newDoc == NULL) { xmlFreeParserCtxt(ctxt); return(-1); } newDoc->properties = XML_DOC_INTERNAL; if ((doc != NULL) && (doc->dict != NULL)) { xmlDictFree(ctxt->dict); ctxt->dict = doc->dict; xmlDictReference(ctxt->dict); ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST \"xml\", 3); ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST \"xmlns\", 5); ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); ctxt->dictNames = 1; } else { xmlCtxtUseOptionsInternal(ctxt, XML_PARSE_NODICT, NULL); } if (doc != NULL) { newDoc->intSubset = doc->intSubset; newDoc->extSubset = doc->extSubset; } newRoot = xmlNewDocNode(newDoc, NULL, BAD_CAST \"pseudoroot\", NULL); if (newRoot == NULL) { if (sax != NULL) ctxt->sax = oldsax; xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; xmlFreeDoc(newDoc); return(-1); } xmlAddChild((xmlNodePtr) newDoc, newRoot); nodePush(ctxt, newRoot); if (doc == NULL) { ctxt->myDoc = newDoc; } else { ctxt->myDoc = newDoc; newDoc->children->doc = doc; /* Ensure that doc has XML spec namespace */ xmlSearchNsByHref(doc, (xmlNodePtr)doc, XML_XML_NAMESPACE); newDoc->oldNs = doc->oldNs; } ctxt->instate = XML_PARSER_CONTENT; ctxt->input_id = 2; ctxt->depth = depth; /* * Doing validity checking on chunk doesn't make sense */ ctxt->validate = 0; ctxt->loadsubset = 0; xmlDetectSAX2(ctxt); if ( doc != NULL ){ content = doc->children; doc->children = NULL; xmlParseContent(ctxt); doc->children = content; } else { xmlParseContent(ctxt); } if ((RAW == '<') && (NXT(1) == '/')) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); } else if (RAW != 0) { xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL); } if (ctxt->node != newDoc->children) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); } if (!ctxt->wellFormed) { if (ctxt->errNo == 0) ret = 1; else ret = ctxt->errNo; } else { ret = 0; } if ((lst != NULL) && ((ret == 0) || (recover == 1))) { xmlNodePtr cur; /* * Return the newly created nodeset after unlinking it from * they pseudo parent. */ cur = newDoc->children->children; *lst = cur; while (cur != NULL) { xmlSetTreeDoc(cur, doc); cur->parent = NULL; cur = cur->next; } newDoc->children->children = NULL; } if (sax != NULL) ctxt->sax = oldsax; xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; newDoc->oldNs = NULL; xmlFreeDoc(newDoc); return(ret); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Missing Release of Memory after Effective Lifetime"], "explanation": "xmlParseBalancedChunkMemoryRecover in parser.c in libxml2 before 2.9.10 has a memory leak related to newDoc->oldNs.", "severity_level": "NoInfo", "cwe": "CWE-401", "cve": "CVE-2019-19956"}} -{"idx": 404073, "input": "static void kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) { #ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS struct dentry *debugfs_dentry; char dir_name[ITOA_MAX_LEN * 2]; if (!debugfs_initialized()) return; snprintf(dir_name, sizeof(dir_name), \"vcpu%d\", vcpu->vcpu_id); debugfs_dentry = debugfs_create_dir(dir_name, vcpu->kvm->debugfs_dentry); kvm_arch_create_vcpu_debugfs(vcpu, debugfs_dentry); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232052, "input": "PrimitiveStatus DonateThread(void *context, MessageReader *in, MessageWriter *out) { if (in) { ASYLO_RETURN_IF_INCORRECT_READER_ARGUMENTS(*in, 1); } int result = 0; try { ThreadManager *thread_manager = ThreadManager::GetInstance(); result = thread_manager->StartThread(in->next()); } catch (...) { TrustedPrimitives::BestEffortAbort( \"Uncaught exception in enclave entry handler: DonateThread. Failed to \" \"get ThreadManager instance or start the thread.\"); } return PrimitiveStatus(result); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215063, "input": "struct clock_source *dce110_clock_source_create( struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) { struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); if (!clk_src) return NULL; if (dce110_clk_src_construct(clk_src, ctx, bios, id, regs, &cs_shift, &cs_mask)) { clk_src->base.dp_clk_src = dp_clk_src; return &clk_src->base; } BREAK_TO_DEBUGGER(); return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "Memory leaks in *clock_source_create() functions under drivers/gpu/drm/amd/display/dc in the Linux kernel before 5.3.8 allow attackers to cause a denial of service (memory consumption). This affects the dce112_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c, the dce100_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c, the dcn10_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c, the dcn20_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c, the dce120_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c, the dce110_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c, and the dce80_clock_source_create() function in drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c, aka CID-055e547478a1.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2019-19083"}} -{"idx": 262856, "input": "static void ptirq_free_irte(const struct ptirq_remapping_info *entry) { struct intr_source intr_src; if (entry->intr_type == PTDEV_INTR_MSI) { intr_src.is_msi = true; intr_src.src.msi.value = entry->phys_sid.msi_id.bdf; } else { intr_src.is_msi = false; intr_src.src.ioapic_id = ioapic_irq_to_ioapic_id(entry->allocated_pirq); } dmar_free_irte(&intr_src, entry->irte_idx); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409908, "input": "static void tcp_mark_lost_retrans(struct sock *sk) { const struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *skb; int cnt = 0; u32 new_low_seq = tp->snd_nxt; u32 received_upto = tcp_highest_sack_seq(tp); if (!tcp_is_fack(tp) || !tp->retrans_out || !after(received_upto, tp->lost_retrans_low) || icsk->icsk_ca_state != TCP_CA_Recovery) return; tcp_for_write_queue(skb, sk) { u32 ack_seq = TCP_SKB_CB(skb)->ack_seq; if (skb == tcp_send_head(sk)) break; if (cnt == tp->retrans_out) break; if (!after(TCP_SKB_CB(skb)->end_seq, tp->snd_una)) continue; if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS)) continue; /* TODO: We would like to get rid of tcp_is_fack(tp) only * constraint here (see above) but figuring out that at * least tp->reordering SACK blocks reside between ack_seq * and received_upto is not easy task to do cheaply with * the available datastructures. * * Whether FACK should check here for tp->reordering segs * in-between one could argue for either way (it would be * rather simple to implement as we could count fack_count * during the walk and do tp->fackets_out - fack_count). */ if (after(received_upto, ack_seq)) { TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS; tp->retrans_out -= tcp_skb_pcount(skb); tcp_skb_mark_lost_uncond_verify(tp, skb); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPLOSTRETRANSMIT); } else { if (before(ack_seq, new_low_seq)) new_low_seq = ack_seq; cnt += tcp_skb_pcount(skb); } } if (tp->retrans_out) tp->lost_retrans_low = new_low_seq; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453696, "input": "static int tcos_delete_file(sc_card_t *card, const sc_path_t *path) { int r; u8 sbuf[2]; sc_apdu_t apdu; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (path->type != SC_PATH_TYPE_FILE_ID && path->len != 2) { sc_log(card->ctx, \"File type has to be SC_PATH_TYPE_FILE_ID\\n\"); LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS); } sbuf[0] = path->value[0]; sbuf[1] = path->value[1]; sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE4, 0x00, 0x00); apdu.cla |= 0x80; apdu.lc = 2; apdu.datalen = 2; apdu.data = sbuf; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, \"APDU transmit failed\"); return sc_check_sw(card, apdu.sw1, apdu.sw2); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357376, "input": "static OPJ_UINT32 opj_j2k_get_specific_header_sizes(opj_j2k_t *p_j2k) { OPJ_UINT32 l_nb_bytes = 0; OPJ_UINT32 l_nb_comps; OPJ_UINT32 l_coc_bytes, l_qcc_bytes; l_nb_comps = p_j2k->m_private_image->numcomps - 1; l_nb_bytes += opj_j2k_get_max_toc_size(p_j2k); if (!(OPJ_IS_CINEMA(p_j2k->m_cp.rsiz))) { l_coc_bytes = opj_j2k_get_max_coc_size(p_j2k); l_nb_bytes += l_nb_comps * l_coc_bytes; l_qcc_bytes = opj_j2k_get_max_qcc_size(p_j2k); l_nb_bytes += l_nb_comps * l_qcc_bytes; } l_nb_bytes += opj_j2k_get_max_poc_size(p_j2k); if (p_j2k->m_specific_param.m_encoder.m_PLT) { /* Reserve space for PLT markers */ OPJ_UINT32 i; const opj_cp_t * l_cp = &(p_j2k->m_cp); OPJ_UINT32 l_max_packet_count = 0; for (i = 0; i < l_cp->th * l_cp->tw; ++i) { l_max_packet_count = opj_uint_max(l_max_packet_count, opj_get_encoding_packet_count(p_j2k->m_private_image, l_cp, i)); } /* Minimum 6 bytes per PLT marker, and at a minimum (taking a pessimistic */ /* estimate of 4 bytes for a packet size), one can write */ /* (65536-6) / 4 = 16382 paquet sizes per PLT marker */ p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT = 6 * opj_uint_ceildiv(l_max_packet_count, 16382); /* Maximum 5 bytes per packet to encode a full UINT32 */ p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT += l_nb_bytes += 5 * l_max_packet_count; p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT += 1; l_nb_bytes += p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT; } /*** DEVELOPER CORNER, Add room for your headers ***/ return l_nb_bytes; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398125, "input": "static inline void sctp_set_owner_w(struct sctp_chunk *chunk) { struct sctp_association *asoc = chunk->asoc; struct sock *sk = asoc->base.sk; /* The sndbuf space is tracked per association. */ sctp_association_hold(asoc); if (chunk->shkey) sctp_auth_shkey_hold(chunk->shkey); skb_set_owner_w(chunk->skb, sk); chunk->skb->destructor = sctp_wfree; /* Save the chunk pointer in skb for sctp_wfree to use later. */ skb_shinfo(chunk->skb)->destructor_arg = chunk; refcount_add(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc); asoc->sndbuf_used += chunk->skb->truesize + sizeof(struct sctp_chunk); sk->sk_wmem_queued += chunk->skb->truesize + sizeof(struct sctp_chunk); sk_mem_charge(sk, chunk->skb->truesize); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 447631, "input": "static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { const char *mode, *option; CompressionType compression; EndianType endian_type; MagickBooleanType adjoin, debug, preserve_compression, status; MagickOffsetType scene; QuantumInfo *quantum_info; QuantumType quantum_type; register ssize_t i; size_t imageListLength, length; ssize_t y; TIFF *tiff; TIFFInfo tiff_info; uint16 bits_per_sample, compress_tag, endian, photometric, predictor; unsigned char *pixels; void *sans[2] = { NULL, NULL }; /* Open TIFF file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); (void) SetMagickThreadValue(tiff_exception,exception); endian_type=(HOST_FILLORDER == FILLORDER_LSB2MSB) ? LSBEndian : MSBEndian; option=GetImageOption(image_info,\"tiff:endian\"); if (option != (const char *) NULL) { if (LocaleNCompare(option,\"msb\",3) == 0) endian_type=MSBEndian; if (LocaleNCompare(option,\"lsb\",3) == 0) endian_type=LSBEndian; } mode=endian_type == LSBEndian ? \"wl\" : \"wb\"; #if defined(TIFF_VERSION_BIG) if (LocaleCompare(image_info->magick,\"TIFF64\") == 0) mode=endian_type == LSBEndian ? \"wl8\" : \"wb8\"; #endif tiff=TIFFClientOpen(image->filename,mode,(thandle_t) image,TIFFReadBlob, TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob, TIFFUnmapBlob); if (tiff == (TIFF *) NULL) return(MagickFalse); if (exception->severity > ErrorException) { TIFFClose(tiff); return(MagickFalse); } (void) DeleteImageProfile(image,\"tiff:37724\"); scene=0; debug=IsEventLogging(); (void) debug; adjoin=image_info->adjoin; imageListLength=GetImageListLength(image); option=GetImageOption(image_info,\"tiff:preserve-compression\"); preserve_compression=IsStringTrue(option); do { /* Initialize TIFF fields. */ (void) IsImageMonochrome(image); if ((image_info->type != UndefinedType) && (image_info->type != OptimizeType)) (void) SetImageType(image,image_info->type,exception); compression=image_info->compression; if (preserve_compression != MagickFalse) compression=image->compression; switch (compression) { case FaxCompression: case Group4Compression: { if (IsImageMonochrome(image) == MagickFalse) { if (IsImageGray(image) == MagickFalse) (void) SetImageType(image,BilevelType,exception); else (void) SetImageDepth(image,1,exception); } image->depth=1; break; } case JPEGCompression: { (void) SetImageStorageClass(image,DirectClass,exception); (void) SetImageDepth(image,8,exception); break; } default: break; } quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\"); if ((image->storage_class != PseudoClass) && (image->depth >= 32) && (quantum_info->format == UndefinedQuantumFormat) && (IsHighDynamicRangeImage(image,exception) != MagickFalse)) { status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); if (status == MagickFalse) { quantum_info=DestroyQuantumInfo(quantum_info); ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\"); } } if ((LocaleCompare(image_info->magick,\"PTIF\") == 0) && (GetPreviousImageInList(image) != (Image *) NULL)) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE); if ((image->columns != (uint32) image->columns) || (image->rows != (uint32) image->rows)) ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\"); (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows); (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns); switch (compression) { case FaxCompression: { compress_tag=COMPRESSION_CCITTFAX3; option=GetImageOption(image_info,\"quantum:polarity\"); if (option == (const char *) NULL) SetQuantumMinIsWhite(quantum_info,MagickTrue); break; } case Group4Compression: { compress_tag=COMPRESSION_CCITTFAX4; option=GetImageOption(image_info,\"quantum:polarity\"); if (option == (const char *) NULL) SetQuantumMinIsWhite(quantum_info,MagickTrue); break; } #if defined(COMPRESSION_JBIG) case JBIG1Compression: { compress_tag=COMPRESSION_JBIG; break; } #endif case JPEGCompression: { compress_tag=COMPRESSION_JPEG; break; } #if defined(COMPRESSION_LZMA) case LZMACompression: { compress_tag=COMPRESSION_LZMA; break; } #endif case LZWCompression: { compress_tag=COMPRESSION_LZW; break; } case RLECompression: { compress_tag=COMPRESSION_PACKBITS; break; } case ZipCompression: { compress_tag=COMPRESSION_ADOBE_DEFLATE; break; } #if defined(COMPRESSION_ZSTD) case ZstdCompression: { compress_tag=COMPRESSION_ZSTD; break; } #endif case NoCompression: default: { compress_tag=COMPRESSION_NONE; break; } } #if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919) if ((compress_tag != COMPRESSION_NONE) && (TIFFIsCODECConfigured(compress_tag) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),CoderError, \"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic( MagickCompressOptions,(ssize_t) compression)); compress_tag=COMPRESSION_NONE; compression=NoCompression; } #else switch (compress_tag) { #if defined(CCITT_SUPPORT) case COMPRESSION_CCITTFAX3: case COMPRESSION_CCITTFAX4: #endif #if defined(YCBCR_SUPPORT) && defined(JPEG_SUPPORT) case COMPRESSION_JPEG: #endif #if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA) case COMPRESSION_LZMA: #endif #if defined(LZW_SUPPORT) case COMPRESSION_LZW: #endif #if defined(PACKBITS_SUPPORT) case COMPRESSION_PACKBITS: #endif #if defined(ZIP_SUPPORT) case COMPRESSION_ADOBE_DEFLATE: #endif case COMPRESSION_NONE: break; default: { (void) ThrowMagickException(exception,GetMagickModule(),CoderError, \"CompressionNotSupported\",\"`%s'\",CommandOptionToMnemonic( MagickCompressOptions,(ssize_t) compression)); compress_tag=COMPRESSION_NONE; compression=NoCompression; break; } } #endif if (image->colorspace == CMYKColorspace) { photometric=PHOTOMETRIC_SEPARATED; (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,4); (void) TIFFSetField(tiff,TIFFTAG_INKSET,INKSET_CMYK); } else { /* Full color TIFF raster. */ if (image->colorspace == LabColorspace) { photometric=PHOTOMETRIC_CIELAB; EncodeLabImage(image,exception); } else if (IsYCbCrCompatibleColorspace(image->colorspace) != MagickFalse) { photometric=PHOTOMETRIC_YCBCR; (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,1,1); (void) SetImageStorageClass(image,DirectClass,exception); status=SetQuantumDepth(image,quantum_info,8); if (status == MagickFalse) ThrowWriterException(ResourceLimitError, \"MemoryAllocationFailed\"); } else photometric=PHOTOMETRIC_RGB; (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,3); if ((image_info->type != TrueColorType) && (image_info->type != TrueColorAlphaType)) { if ((image_info->type != PaletteType) && (SetImageGray(image,exception) != MagickFalse)) { photometric=(uint16) (quantum_info->min_is_white != MagickFalse ? PHOTOMETRIC_MINISWHITE : PHOTOMETRIC_MINISBLACK); (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1); if ((image->depth == 1) && (image->alpha_trait == UndefinedPixelTrait)) SetImageMonochrome(image,exception); } else if (image->storage_class == PseudoClass) { size_t depth; /* Colormapped TIFF raster. */ (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,1); photometric=PHOTOMETRIC_PALETTE; depth=1; while ((GetQuantumRange(depth)+1) < image->colors) depth<<=1; status=SetQuantumDepth(image,quantum_info,depth); if (status == MagickFalse) ThrowWriterException(ResourceLimitError, \"MemoryAllocationFailed\"); } } } (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian,sans); if ((compress_tag == COMPRESSION_CCITTFAX3) || (compress_tag == COMPRESSION_CCITTFAX4)) { if ((photometric != PHOTOMETRIC_MINISWHITE) && (photometric != PHOTOMETRIC_MINISBLACK)) { compress_tag=COMPRESSION_NONE; endian=FILLORDER_MSB2LSB; } } option=GetImageOption(image_info,\"tiff:fill-order\"); if (option != (const char *) NULL) { if (LocaleNCompare(option,\"msb\",3) == 0) endian=FILLORDER_MSB2LSB; if (LocaleNCompare(option,\"lsb\",3) == 0) endian=FILLORDER_LSB2MSB; } (void) TIFFSetField(tiff,TIFFTAG_COMPRESSION,compress_tag); (void) TIFFSetField(tiff,TIFFTAG_FILLORDER,endian); (void) TIFFSetField(tiff,TIFFTAG_BITSPERSAMPLE,quantum_info->depth); if (image->alpha_trait != UndefinedPixelTrait) { uint16 extra_samples, sample_info[1], samples_per_pixel; /* TIFF has a matte channel. */ extra_samples=1; sample_info[0]=EXTRASAMPLE_UNASSALPHA; option=GetImageOption(image_info,\"tiff:alpha\"); if (option != (const char *) NULL) { if (LocaleCompare(option,\"associated\") == 0) sample_info[0]=EXTRASAMPLE_ASSOCALPHA; else if (LocaleCompare(option,\"unspecified\") == 0) sample_info[0]=EXTRASAMPLE_UNSPECIFIED; } (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel,sans); (void) TIFFSetField(tiff,TIFFTAG_SAMPLESPERPIXEL,samples_per_pixel+1); (void) TIFFSetField(tiff,TIFFTAG_EXTRASAMPLES,extra_samples, &sample_info); if (sample_info[0] == EXTRASAMPLE_ASSOCALPHA) SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha); } (void) TIFFSetField(tiff,TIFFTAG_PHOTOMETRIC,photometric); switch (quantum_info->format) { case FloatingPointQuantumFormat: { (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_IEEEFP); (void) TIFFSetField(tiff,TIFFTAG_SMINSAMPLEVALUE,quantum_info->minimum); (void) TIFFSetField(tiff,TIFFTAG_SMAXSAMPLEVALUE,quantum_info->maximum); break; } case SignedQuantumFormat: { (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_INT); break; } case UnsignedQuantumFormat: { (void) TIFFSetField(tiff,TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_UINT); break; } default: break; } (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG); if (photometric == PHOTOMETRIC_RGB) if ((image_info->interlace == PlaneInterlace) || (image_info->interlace == PartitionInterlace)) (void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_SEPARATE); predictor=0; switch (compress_tag) { case COMPRESSION_JPEG: { #if defined(JPEG_SUPPORT) if (image_info->quality != UndefinedCompressionQuality) (void) TIFFSetField(tiff,TIFFTAG_JPEGQUALITY,image_info->quality); (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RAW); if (IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) { const char *value; (void) TIFFSetField(tiff,TIFFTAG_JPEGCOLORMODE,JPEGCOLORMODE_RGB); if (IsYCbCrCompatibleColorspace(image->colorspace) != MagickFalse) { const char *sampling_factor; GeometryInfo geometry_info; MagickStatusType flags; sampling_factor=(const char *) NULL; value=GetImageProperty(image,\"jpeg:sampling-factor\",exception); if (value != (char *) NULL) { sampling_factor=value; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \" Input sampling-factors=%s\",sampling_factor); } if (image_info->sampling_factor != (char *) NULL) sampling_factor=image_info->sampling_factor; if (sampling_factor != (const char *) NULL) { flags=ParseGeometry(sampling_factor,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; (void) TIFFSetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,(uint16) geometry_info.rho,(uint16) geometry_info.sigma); } } } (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE, &bits_per_sample,sans); if (bits_per_sample == 12) (void) TIFFSetField(tiff,TIFFTAG_JPEGTABLESMODE,JPEGTABLESMODE_QUANT); #endif break; } case COMPRESSION_ADOBE_DEFLATE: { (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE, &bits_per_sample,sans); if (((photometric == PHOTOMETRIC_RGB) || (photometric == PHOTOMETRIC_SEPARATED) || (photometric == PHOTOMETRIC_MINISBLACK)) && ((bits_per_sample == 8) || (bits_per_sample == 16))) predictor=PREDICTOR_HORIZONTAL; (void) TIFFSetField(tiff,TIFFTAG_ZIPQUALITY,(long) ( image_info->quality == UndefinedCompressionQuality ? 7 : MagickMin((ssize_t) image_info->quality/10,9))); break; } case COMPRESSION_CCITTFAX3: { /* Byte-aligned EOL. */ (void) TIFFSetField(tiff,TIFFTAG_GROUP3OPTIONS,4); break; } case COMPRESSION_CCITTFAX4: break; #if defined(LZMA_SUPPORT) && defined(COMPRESSION_LZMA) case COMPRESSION_LZMA: { if (((photometric == PHOTOMETRIC_RGB) || (photometric == PHOTOMETRIC_SEPARATED) || (photometric == PHOTOMETRIC_MINISBLACK)) && ((bits_per_sample == 8) || (bits_per_sample == 16))) predictor=PREDICTOR_HORIZONTAL; (void) TIFFSetField(tiff,TIFFTAG_LZMAPRESET,(long) ( image_info->quality == UndefinedCompressionQuality ? 7 : MagickMin((ssize_t) image_info->quality/10,9))); break; } #endif case COMPRESSION_LZW: { (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE, &bits_per_sample,sans); if (((photometric == PHOTOMETRIC_RGB) || (photometric == PHOTOMETRIC_SEPARATED) || (photometric == PHOTOMETRIC_MINISBLACK)) && ((bits_per_sample == 8) || (bits_per_sample == 16))) predictor=PREDICTOR_HORIZONTAL; break; } #if defined(WEBP_SUPPORT) && defined(COMPRESSION_WEBP) case COMPRESSION_WEBP: { (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE, &bits_per_sample,sans); if (((photometric == PHOTOMETRIC_RGB) || (photometric == PHOTOMETRIC_SEPARATED) || (photometric == PHOTOMETRIC_MINISBLACK)) && ((bits_per_sample == 8) || (bits_per_sample == 16))) predictor=PREDICTOR_HORIZONTAL; (void) TIFFSetField(tiff,TIFFTAG_WEBP_LEVEL,image_info->quality); if (image_info->quality >= 100) (void) TIFFSetField(tiff,TIFFTAG_WEBP_LOSSLESS,1); break; } #endif #if defined(ZSTD_SUPPORT) && defined(COMPRESSION_ZSTD) case COMPRESSION_ZSTD: { (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE, &bits_per_sample,sans); if (((photometric == PHOTOMETRIC_RGB) || (photometric == PHOTOMETRIC_SEPARATED) || (photometric == PHOTOMETRIC_MINISBLACK)) && ((bits_per_sample == 8) || (bits_per_sample == 16))) predictor=PREDICTOR_HORIZONTAL; (void) TIFFSetField(tiff,TIFFTAG_ZSTD_LEVEL,22*image_info->quality/ 100.0); break; } #endif default: break; } if (quantum_info->format == FloatingPointQuantumFormat) predictor=PREDICTOR_FLOATINGPOINT; option=GetImageOption(image_info,\"tiff:predictor\"); if (option != (const char * ) NULL) predictor=(uint16) strtol(option,(char **) NULL,10); if (predictor != 0) (void) TIFFSetField(tiff,TIFFTAG_PREDICTOR,predictor); if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0)) { unsigned short units; /* Set image resolution. */ units=RESUNIT_NONE; if (image->units == PixelsPerInchResolution) units=RESUNIT_INCH; if (image->units == PixelsPerCentimeterResolution) units=RESUNIT_CENTIMETER; (void) TIFFSetField(tiff,TIFFTAG_RESOLUTIONUNIT,(uint16) units); (void) TIFFSetField(tiff,TIFFTAG_XRESOLUTION,image->resolution.x); (void) TIFFSetField(tiff,TIFFTAG_YRESOLUTION,image->resolution.y); if ((image->page.x < 0) || (image->page.y < 0)) (void) ThrowMagickException(exception,GetMagickModule(),CoderError, \"TIFF: negative image positions unsupported\",\"%s\",image->filename); if ((image->page.x > 0) && (image->resolution.x > 0.0)) { /* Set horizontal image position. */ (void) TIFFSetField(tiff,TIFFTAG_XPOSITION,(float) image->page.x/ image->resolution.x); } if ((image->page.y > 0) && (image->resolution.y > 0.0)) { /* Set vertical image position. */ (void) TIFFSetField(tiff,TIFFTAG_YPOSITION,(float) image->page.y/ image->resolution.y); } } if (image->chromaticity.white_point.x != 0.0) { float chromaticity[6]; /* Set image chromaticity. */ chromaticity[0]=(float) image->chromaticity.red_primary.x; chromaticity[1]=(float) image->chromaticity.red_primary.y; chromaticity[2]=(float) image->chromaticity.green_primary.x; chromaticity[3]=(float) image->chromaticity.green_primary.y; chromaticity[4]=(float) image->chromaticity.blue_primary.x; chromaticity[5]=(float) image->chromaticity.blue_primary.y; (void) TIFFSetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,chromaticity); chromaticity[0]=(float) image->chromaticity.white_point.x; chromaticity[1]=(float) image->chromaticity.white_point.y; (void) TIFFSetField(tiff,TIFFTAG_WHITEPOINT,chromaticity); } option=GetImageOption(image_info,\"tiff:write-layers\"); if (IsStringTrue(option) != MagickFalse) { (void) TIFFWritePhotoshopLayers(image,image_info,endian_type,exception); adjoin=MagickFalse; } if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) && (adjoin != MagickFalse) && (imageListLength > 1)) { (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE); if (image->scene != 0) (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,(uint16) image->scene, imageListLength); } if (image->orientation != UndefinedOrientation) (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,(uint16) image->orientation); else (void) TIFFSetField(tiff,TIFFTAG_ORIENTATION,ORIENTATION_TOPLEFT); TIFFSetProfiles(tiff,image); { uint16 page, pages; page=(uint16) scene; pages=(uint16) imageListLength; if ((LocaleCompare(image_info->magick,\"PTIF\") != 0) && (adjoin != MagickFalse) && (pages > 1)) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE); (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages); } (void) TIFFSetProperties(tiff,adjoin,image,exception); DisableMSCWarning(4127) if (0) RestoreMSCWarning (void) TIFFSetEXIFProperties(tiff,image,exception); /* Write image scanlines. */ if (GetTIFFInfo(image_info,tiff,&tiff_info) == MagickFalse) ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\"); if (compress_tag == COMPRESSION_CCITTFAX4) (void) TIFFSetField(tiff,TIFFTAG_ROWSPERSTRIP,(uint32) image->rows); quantum_info->endian=LSBEndian; pixels=(unsigned char *) GetQuantumPixels(quantum_info); tiff_info.scanline=(unsigned char *) GetQuantumPixels(quantum_info); switch (photometric) { case PHOTOMETRIC_CIELAB: case PHOTOMETRIC_YCBCR: case PHOTOMETRIC_RGB: { /* RGB TIFF image. */ switch (image_info->interlace) { case NoInterlace: default: { quantum_type=RGBQuantum; if (image->alpha_trait != UndefinedPixelTrait) quantum_type=RGBAQuantum; for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); (void) length; if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } break; } case PlaneInterlace: case PartitionInterlace: { /* Plane interlacing: RRRRRR...GGGGGG...BBBBBB... */ for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, RedQuantum,pixels,exception); if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,100,400); if (status == MagickFalse) break; } for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, GreenQuantum,pixels,exception); if (TIFFWritePixels(tiff,&tiff_info,y,1,image) == -1) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,200,400); if (status == MagickFalse) break; } for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, BlueQuantum,pixels,exception); if (TIFFWritePixels(tiff,&tiff_info,y,2,image) == -1) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,300,400); if (status == MagickFalse) break; } if (image->alpha_trait != UndefinedPixelTrait) for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL, quantum_info,AlphaQuantum,pixels,exception); if (TIFFWritePixels(tiff,&tiff_info,y,3,image) == -1) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,400,400); if (status == MagickFalse) break; } break; } } break; } case PHOTOMETRIC_SEPARATED: { /* CMYK TIFF image. */ quantum_type=CMYKQuantum; if (image->alpha_trait != UndefinedPixelTrait) quantum_type=CMYKAQuantum; if (image->colorspace != CMYKColorspace) (void) TransformImageColorspace(image,CMYKColorspace,exception); for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case PHOTOMETRIC_PALETTE: { uint16 *blue, *green, *red; /* Colormapped TIFF image. */ red=(uint16 *) AcquireQuantumMemory(65536,sizeof(*red)); green=(uint16 *) AcquireQuantumMemory(65536,sizeof(*green)); blue=(uint16 *) AcquireQuantumMemory(65536,sizeof(*blue)); if ((red == (uint16 *) NULL) || (green == (uint16 *) NULL) || (blue == (uint16 *) NULL)) { if (red != (uint16 *) NULL) red=(uint16 *) RelinquishMagickMemory(red); if (green != (uint16 *) NULL) green=(uint16 *) RelinquishMagickMemory(green); if (blue != (uint16 *) NULL) blue=(uint16 *) RelinquishMagickMemory(blue); ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\"); } /* Initialize TIFF colormap. */ (void) memset(red,0,65536*sizeof(*red)); (void) memset(green,0,65536*sizeof(*green)); (void) memset(blue,0,65536*sizeof(*blue)); for (i=0; i < (ssize_t) image->colors; i++) { red[i]=ScaleQuantumToShort(image->colormap[i].red); green[i]=ScaleQuantumToShort(image->colormap[i].green); blue[i]=ScaleQuantumToShort(image->colormap[i].blue); } (void) TIFFSetField(tiff,TIFFTAG_COLORMAP,red,green,blue); red=(uint16 *) RelinquishMagickMemory(red); green=(uint16 *) RelinquishMagickMemory(green); blue=(uint16 *) RelinquishMagickMemory(blue); } default: { /* Convert PseudoClass packets to contiguous grayscale scanlines. */ quantum_type=IndexQuantum; if (image->alpha_trait != UndefinedPixelTrait) { if (photometric != PHOTOMETRIC_PALETTE) quantum_type=GrayAlphaQuantum; else quantum_type=IndexAlphaQuantum; } else if (photometric != PHOTOMETRIC_PALETTE) quantum_type=GrayQuantum; for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *magick_restrict p; p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); if (TIFFWritePixels(tiff,&tiff_info,y,0,image) == -1) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } } quantum_info=DestroyQuantumInfo(quantum_info); if (image->colorspace == LabColorspace) DecodeLabImage(image,exception); DestroyTIFFInfo(&tiff_info); /* TIFFPrintDirectory(tiff,stdout,MagickFalse); */ if (TIFFWriteDirectory(tiff) == 0) { status=MagickFalse; break; } image=SyncNextImageInList(image); if (image == (Image *) NULL) break; status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); if (status == MagickFalse) break; } while (adjoin != MagickFalse); TIFFClose(tiff); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370808, "input": "static Image *ReadWEBPImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowWEBPException(severity,tag) \\ { \\ if (stream != (unsigned char *) NULL) \\ stream=(unsigned char*) RelinquishMagickMemory(stream); \\ if (webp_image != (WebPDecBuffer *) NULL) \\ WebPFreeDecBuffer(webp_image); \\ ThrowReaderException(severity,tag); \\ } Image *image; int webp_status; MagickBooleanType status; size_t length; ssize_t count; unsigned char header[12], *stream; WebPDecoderConfig configure; WebPDecBuffer *magick_restrict webp_image = &configure.output; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } stream=(unsigned char *) NULL; if (WebPInitDecoderConfig(&configure) == 0) ThrowReaderException(ResourceLimitError,\"UnableToDecodeImageFile\"); webp_image->colorspace=MODE_RGBA; count=ReadBlob(image,12,header); if (count != 12) ThrowWEBPException(CorruptImageError,\"InsufficientImageDataInFile\"); status=IsWEBP(header,count); if (status == MagickFalse) ThrowWEBPException(CorruptImageError,\"CorruptImage\"); length=(size_t) (ReadWebPLSBWord(header+4)+8); if (length < 12) ThrowWEBPException(CorruptImageError,\"CorruptImage\"); if (length > GetBlobSize(image)) ThrowWEBPException(CorruptImageError,\"InsufficientImageDataInFile\"); stream=(unsigned char *) AcquireQuantumMemory(length,sizeof(*stream)); if (stream == (unsigned char *) NULL) ThrowWEBPException(ResourceLimitError,\"MemoryAllocationFailed\"); (void) memcpy(stream,header,12); count=ReadBlob(image,length-12,stream+12); if (count != (ssize_t) (length-12)) ThrowWEBPException(CorruptImageError,\"InsufficientImageDataInFile\"); webp_status=FillBasicWEBPInfo(image,stream,length,&configure); if (webp_status == VP8_STATUS_OK) { if (configure.input.has_animation) { #if defined(MAGICKCORE_WEBPMUX_DELEGATE) webp_status=ReadAnimatedWEBPImage(image_info,image,stream,length, &configure,exception); #else webp_status=VP8_STATUS_UNSUPPORTED_FEATURE; #endif } else { webp_status=ReadSingleWEBPImage(image,stream,length,&configure,exception,MagickFalse); } } if (webp_status != VP8_STATUS_OK) switch (webp_status) { case VP8_STATUS_OUT_OF_MEMORY: { ThrowWEBPException(ResourceLimitError,\"MemoryAllocationFailed\"); break; } case VP8_STATUS_INVALID_PARAM: { ThrowWEBPException(CorruptImageError,\"invalid parameter\"); break; } case VP8_STATUS_BITSTREAM_ERROR: { ThrowWEBPException(CorruptImageError,\"CorruptImage\"); break; } case VP8_STATUS_UNSUPPORTED_FEATURE: { ThrowWEBPException(CoderError,\"DataEncodingSchemeIsNotSupported\"); break; } case VP8_STATUS_SUSPENDED: { ThrowWEBPException(CorruptImageError,\"decoder suspended\"); break; } case VP8_STATUS_USER_ABORT: { ThrowWEBPException(CorruptImageError,\"user abort\"); break; } case VP8_STATUS_NOT_ENOUGH_DATA: { ThrowWEBPException(CorruptImageError,\"InsufficientImageDataInFile\"); break; } default: ThrowWEBPException(CorruptImageError,\"CorruptImage\"); } stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318187, "input": "static int intAddEntry(Header h, rpmtd td) { indexEntry entry; rpm_data_t data; int length = 0; /* Count must always be >= 1 for headerAddEntry. */ if (td->count <= 0) return 0; if (hdrchkType(td->type)) return 0; if (hdrchkData(td->count)) return 0; data = grabData(td->type, td->data, td->count, &length); if (data == NULL) return 0; /* Allocate more index space if necessary */ if (h->indexUsed == h->indexAlloced) { h->indexAlloced += INDEX_MALLOC_SIZE; h->index = xrealloc(h->index, h->indexAlloced * sizeof(*h->index)); } /* Fill in the index */ entry = h->index + h->indexUsed; entry->info.tag = td->tag; entry->info.type = td->type; entry->info.count = td->count; entry->info.offset = 0; entry->data = data; entry->length = length; if (h->indexUsed > 0 && td->tag < h->index[h->indexUsed-1].info.tag) h->sorted = 0; h->indexUsed++; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 384558, "input": "int RGWAsioFrontend::run() { return impl->run(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 473435, "input": "char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths) { return crypto_cert_get_dns_names(xcert, count, lengths); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508580, "input": "setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps, uint field_count) { uint bitmap_size= bitmap_buffer_size(field_count); DBUG_ASSERT(table->s->virtual_fields == 0 && table->def_vcol_set == 0); my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count, FALSE); bitmaps+= bitmap_size; my_bitmap_init(&table->tmp_set, (my_bitmap_map*) bitmaps, field_count, FALSE); bitmaps+= bitmap_size; my_bitmap_init(&table->eq_join_set, (my_bitmap_map*) bitmaps, field_count, FALSE); bitmaps+= bitmap_size; my_bitmap_init(&table->cond_set, (my_bitmap_map*) bitmaps, field_count, FALSE); bitmaps+= bitmap_size; my_bitmap_init(&table->has_value_set, (my_bitmap_map*) bitmaps, field_count, FALSE); /* write_set and all_set are copies of read_set */ table->def_write_set= table->def_read_set; table->s->all_set= table->def_read_set; bitmap_set_all(&table->s->all_set); table->default_column_bitmaps(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333806, "input": "AWSGeneralAbstractor::get_auth_data_v4(const req_state* const s, const bool using_qs) const { boost::string_view access_key_id; boost::string_view signed_hdrs; boost::string_view date; boost::string_view credential_scope; boost::string_view client_signature; boost::string_view session_token; int ret = rgw::auth::s3::parse_v4_credentials(s->info, access_key_id, credential_scope, signed_hdrs, client_signature, date, session_token, using_qs); if (ret < 0) { throw ret; } /* craft canonical headers */ boost::optional canonical_headers = \\ get_v4_canonical_headers(s->info, signed_hdrs, using_qs); if (canonical_headers) { using sanitize = rgw::crypt_sanitize::log_content; ldout(s->cct, 10) << \"canonical headers format = \" << sanitize{*canonical_headers} << dendl; } else { throw -EPERM; } bool is_non_s3_op = false; if (s->op_type == RGW_STS_GET_SESSION_TOKEN || s->op_type == RGW_STS_ASSUME_ROLE || s->op_type == RGW_STS_ASSUME_ROLE_WEB_IDENTITY || s->op_type == RGW_OP_CREATE_ROLE || s->op_type == RGW_OP_DELETE_ROLE || s->op_type == RGW_OP_GET_ROLE || s->op_type == RGW_OP_MODIFY_ROLE || s->op_type == RGW_OP_LIST_ROLES || s->op_type == RGW_OP_PUT_ROLE_POLICY || s->op_type == RGW_OP_GET_ROLE_POLICY || s->op_type == RGW_OP_LIST_ROLE_POLICIES || s->op_type == RGW_OP_DELETE_ROLE_POLICY || s->op_type == RGW_OP_PUT_USER_POLICY || s->op_type == RGW_OP_GET_USER_POLICY || s->op_type == RGW_OP_LIST_USER_POLICIES || s->op_type == RGW_OP_DELETE_USER_POLICY) { is_non_s3_op = true; } const char* exp_payload_hash = nullptr; string payload_hash; if (is_non_s3_op) { //For non s3 ops, we need to calculate the payload hash payload_hash = s->info.args.get(\"PayloadHash\"); exp_payload_hash = payload_hash.c_str(); } else { /* Get the expected hash. */ exp_payload_hash = rgw::auth::s3::get_v4_exp_payload_hash(s->info); } /* Craft canonical URI. Using std::move later so let it be non-const. */ auto canonical_uri = rgw::auth::s3::get_v4_canonical_uri(s->info); /* Craft canonical query string. std::moving later so non-const here. */ auto canonical_qs = rgw::auth::s3::get_v4_canonical_qs(s->info, using_qs); /* Craft canonical request. */ auto canonical_req_hash = \\ rgw::auth::s3::get_v4_canon_req_hash(s->cct, s->info.method, std::move(canonical_uri), std::move(canonical_qs), std::move(*canonical_headers), signed_hdrs, exp_payload_hash); auto string_to_sign = \\ rgw::auth::s3::get_v4_string_to_sign(s->cct, AWS4_HMAC_SHA256_STR, date, credential_scope, std::move(canonical_req_hash)); const auto sig_factory = std::bind(rgw::auth::s3::get_v4_signature, credential_scope, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); /* Requests authenticated with the Query Parameters are treated as unsigned. * From \"Authenticating Requests: Using Query Parameters (AWS Signature * Version 4)\": * * You don't include a payload hash in the Canonical Request, because * when you create a presigned URL, you don't know the payload content * because the URL is used to upload an arbitrary payload. Instead, you * use a constant string UNSIGNED-PAYLOAD. * * This means we have absolutely no business in spawning completer. Both * aws4_auth_needs_complete and aws4_auth_streaming_mode are set to false * by default. We don't need to change that. */ if (is_v4_payload_unsigned(exp_payload_hash) || is_v4_payload_empty(s) || is_non_s3_op) { return { access_key_id, client_signature, session_token, std::move(string_to_sign), sig_factory, null_completer_factory }; } else { /* We're going to handle a signed payload. Be aware that even empty HTTP * body (no payload) requires verification: * * The x-amz-content-sha256 header is required for all AWS Signature * Version 4 requests. It provides a hash of the request payload. If * there is no payload, you must provide the hash of an empty string. */ if (!is_v4_payload_streamed(exp_payload_hash)) { ldout(s->cct, 10) << \"delaying v4 auth\" << dendl; /* payload in a single chunk */ switch (s->op_type) { case RGW_OP_CREATE_BUCKET: case RGW_OP_PUT_OBJ: case RGW_OP_PUT_ACLS: case RGW_OP_PUT_CORS: case RGW_OP_INIT_MULTIPART: // in case that Init Multipart uses CHUNK encoding case RGW_OP_COMPLETE_MULTIPART: case RGW_OP_SET_BUCKET_VERSIONING: case RGW_OP_DELETE_MULTI_OBJ: case RGW_OP_ADMIN_SET_METADATA: case RGW_OP_SET_BUCKET_WEBSITE: case RGW_OP_PUT_BUCKET_POLICY: case RGW_OP_PUT_OBJ_TAGGING: case RGW_OP_PUT_LC: case RGW_OP_SET_REQUEST_PAYMENT: case RGW_OP_PUBSUB_NOTIF_CREATE: case RGW_OP_PUT_BUCKET_OBJ_LOCK: case RGW_OP_PUT_OBJ_RETENTION: case RGW_OP_PUT_OBJ_LEGAL_HOLD: case RGW_STS_GET_SESSION_TOKEN: case RGW_STS_ASSUME_ROLE: break; default: dout(10) << \"ERROR: AWS4 completion for this operation NOT IMPLEMENTED\" << dendl; throw -ERR_NOT_IMPLEMENTED; } const auto cmpl_factory = std::bind(AWSv4ComplSingle::create, s, std::placeholders::_1); return { access_key_id, client_signature, session_token, std::move(string_to_sign), sig_factory, cmpl_factory }; } else { /* IMHO \"streamed\" doesn't fit too good here. I would prefer to call * it \"chunked\" but let's be coherent with Amazon's terminology. */ dout(10) << \"body content detected in multiple chunks\" << dendl; /* payload in multiple chunks */ switch(s->op_type) { case RGW_OP_PUT_OBJ: break; default: dout(10) << \"ERROR: AWS4 completion for this operation NOT IMPLEMENTED (streaming mode)\" << dendl; throw -ERR_NOT_IMPLEMENTED; } dout(10) << \"aws4 seed signature ok... delaying v4 auth\" << dendl; /* In the case of streamed payload client sets the x-amz-content-sha256 * to \"STREAMING-AWS4-HMAC-SHA256-PAYLOAD\" but uses \"UNSIGNED-PAYLOAD\" * when constructing the Canonical Request. */ /* In the case of single-chunk upload client set the header's value is * coherent with the one used for Canonical Request crafting. */ /* In the case of query string-based authentication there should be no * x-amz-content-sha256 header and the value \"UNSIGNED-PAYLOAD\" is used * for CanonReq. */ const auto cmpl_factory = std::bind(AWSv4ComplMulti::create, s, date, credential_scope, client_signature, std::placeholders::_1); return { access_key_id, client_signature, session_token, std::move(string_to_sign), sig_factory, cmpl_factory }; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509013, "input": "table_map used_tables() const { return used_tables_cache; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219365, "input": "gdImagePtr get_valid_image_resource(const Resource& image) { auto img_res = dyn_cast_or_null(image); if (!img_res || !img_res->get()) { raise_warning(\"supplied resource is not a valid Image resource\"); return nullptr; } return img_res->get(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263074, "input": "_iasecc_sm_update_binary(struct sc_card *card, unsigned int offs, const unsigned char *buff, size_t count) { struct sc_context *ctx = card->ctx; const struct sc_acl_entry *entry = NULL; int rv; if (count == 0) return SC_SUCCESS; LOG_FUNC_CALLED(ctx); sc_log(ctx, \"iasecc_sm_read_binary() card:%p offs:%i count:%\"SC_FORMAT_LEN_SIZE_T\"u \", card, offs, count); sc_print_cache(card); if (card->cache.valid && card->cache.current_ef) { entry = sc_file_get_acl_entry(card->cache.current_ef, SC_AC_OP_UPDATE); if (!entry) LOG_TEST_RET(ctx, SC_ERROR_OBJECT_NOT_FOUND, \"iasecc_sm_update() 'UPDATE' ACL not present\"); sc_log(ctx, \"UPDATE method/reference %X/%X\", entry->method, entry->key_ref); if (entry->method == SC_AC_SCB && (entry->key_ref & IASECC_SCB_METHOD_SM)) { unsigned char se_num = entry->method == SC_AC_SCB ? entry->key_ref & IASECC_SCB_METHOD_MASK_REF : 0; rv = iasecc_sm_update_binary(card, se_num, offs, buff, count); LOG_FUNC_RETURN(ctx, rv); } } LOG_FUNC_RETURN(ctx, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431111, "input": "encode_layoutreturn(struct xdr_stream *xdr, const struct nfs4_layoutreturn_args *args, struct compound_hdr *hdr) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269622, "input": "TfLiteStatus Subgraph::Invoke() { SubgraphGuard guard(&context_, &is_subgraph_in_use_); TF_LITE_ENSURE_OK(&context_, guard.status()); if (!consistent_) { ReportError(\"Invoke called on model that is not consistent.\"); return kTfLiteError; } TfLiteStatus status = kTfLiteOk; if (state_ == kStateUninvokable) { ReportError(\"Invoke called on model that is not ready.\"); return kTfLiteError; } else if (memory_planner_ && !memory_planner_->HasNonPersistentMemory()) { ReportError(\"Non-persistent memory is not available.\"); return kTfLiteError; } TFLITE_SCOPED_TAGGED_DEFAULT_PROFILE(profiler_.get(), \"Invoke\"); // Invocations are always done in node order. // Note that calling Invoke repeatedly will cause the original memory plan to // be reused, unless either ResizeInputTensor() or AllocateTensors() has been // called. for (int execution_plan_index = 0; execution_plan_index < execution_plan_.size(); execution_plan_index++) { if (execution_plan_index == next_execution_plan_index_to_prepare_) { TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors()); TF_LITE_ENSURE(&context_, next_execution_plan_index_to_prepare_ >= execution_plan_index); } int node_index = execution_plan_[execution_plan_index]; TfLiteNode& node = nodes_and_registration_[node_index].first; const TfLiteRegistration& registration = nodes_and_registration_[node_index].second; const char* op_name = nullptr; if (profiler_) op_name = GetTFLiteOpName(registration); TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler_.get(), op_name, node_index); for (int i = 0; i < node.inputs->size; ++i) { int tensor_index = node.inputs->data[i]; if (tensor_index == kTfLiteOptionalTensor) { continue; } TfLiteTensor* tensor = &tensors_[tensor_index]; if (tensor->delegate && tensor->delegate != node.delegate && tensor->data_is_stale) { TF_LITE_ENSURE_STATUS(EnsureTensorDataIsReadable(tensor_index)); } if (tensor->data.raw == nullptr && tensor->bytes > 0) { if (registration.builtin_code == kTfLiteBuiltinReshape && i == 1 && tensor->dims->size != 1) { // In general, having a tensor here with no buffer will be an error. // However, for the reshape operator, the second input tensor is // sometimes only used for the shape, not for the data. Thus, null // buffer is ok in this situation. // The situation where null buffer is not ok for reshape operator is // only when there are 2 inputs given to the node and the one // corresponding to the shape (i == 1) is a vector that contains all // dimensions. See `GetOutputShape()` function in // `tensorflow/lite/kernels/reshape.cc` continue; } else { // In all other cases, we need to return an error as otherwise we will // trigger a null pointer dereference (likely). ReportError(\"Input tensor %d lacks data\", tensor_index); return kTfLiteError; } } } if (check_cancelled_func_ != nullptr && check_cancelled_func_(cancellation_data_)) { ReportError(\"Client requested cancel during Invoke()\"); return kTfLiteError; } EnsureTensorsVectorCapacity(); tensor_resized_since_op_invoke_ = false; if (OpInvoke(registration, &node) != kTfLiteOk) { return ReportOpError(&context_, node, registration, node_index, \"failed to invoke\"); } // Force execution prep for downstream ops if the latest op triggered the // resize of a dynamic tensor. if (tensor_resized_since_op_invoke_ && HasDynamicTensor(context_, node.outputs)) { next_execution_plan_index_to_prepare_ = execution_plan_index + 1; // This happens when an intermediate dynamic tensor is resized. // We don't have to prepare all the ops, but we need to recompute // the allocation plan. if (next_execution_plan_index_to_plan_allocation_ > next_execution_plan_index_to_prepare_) { next_execution_plan_index_to_plan_allocation_ = next_execution_plan_index_to_prepare_; if (memory_planner_) { TF_LITE_ENSURE_STATUS(memory_planner_->ResetAllocationsAfter( next_execution_plan_index_to_plan_allocation_ - 1)); } } } } return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429183, "input": "PHP_FUNCTION(enchant_broker_set_dict_path) { zval *broker; enchant_broker *pbroker; long dict_type; char *value; int value_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rls\", &broker, &dict_type, &value, &value_len) == FAILURE) { RETURN_FALSE; } if (!value_len) { RETURN_FALSE; } PHP_ENCHANT_GET_BROKER; switch (dict_type) { case PHP_ENCHANT_MYSPELL: PHP_ENCHANT_GET_BROKER; enchant_broker_set_param(pbroker->pbroker, \"enchant.myspell.dictionary.path\", (const char *)value); RETURN_TRUE; break; case PHP_ENCHANT_ISPELL: PHP_ENCHANT_GET_BROKER; enchant_broker_set_param(pbroker->pbroker, \"enchant.ispell.dictionary.path\", (const char *)value); RETURN_TRUE; break; default: RETURN_FALSE; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281400, "input": "static int get_success_retcode(int code) { switch (code) { case 201: return STATUS_CREATED; case 204: return STATUS_NO_CONTENT; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 311107, "input": "DLLEXPORT int DLLCALL tjDecompressHeader3(tjhandle handle, const unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp, int *jpegColorspace) { int retval=0; getdinstance(handle); if((this->init&DECOMPRESS)==0) _throw(\"tjDecompressHeader3(): Instance has not been initialized for decompression\"); if(jpegBuf==NULL || jpegSize<=0 || width==NULL || height==NULL || jpegSubsamp==NULL || jpegColorspace==NULL) _throw(\"tjDecompressHeader3(): Invalid argument\"); if(setjmp(this->jerr.setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error. */ return -1; } jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize); jpeg_read_header(dinfo, TRUE); *width=dinfo->image_width; *height=dinfo->image_height; *jpegSubsamp=getSubsamp(dinfo); switch(dinfo->jpeg_color_space) { case JCS_GRAYSCALE: *jpegColorspace=TJCS_GRAY; break; case JCS_RGB: *jpegColorspace=TJCS_RGB; break; case JCS_YCbCr: *jpegColorspace=TJCS_YCbCr; break; case JCS_CMYK: *jpegColorspace=TJCS_CMYK; break; case JCS_YCCK: *jpegColorspace=TJCS_YCCK; break; default: *jpegColorspace=-1; break; } jpeg_abort_decompress(dinfo); if(*jpegSubsamp<0) _throw(\"tjDecompressHeader3(): Could not determine subsampling type for JPEG image\"); if(*jpegColorspace<0) _throw(\"tjDecompressHeader3(): Could not determine colorspace of JPEG image\"); if(*width<1 || *height<1) _throw(\"tjDecompressHeader3(): Invalid data returned in header\"); bailout: if(this->jerr.warning) retval=-1; return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255323, "input": "void pb_release(const pb_field_t fields[], void *dest_struct) { pb_field_iterator_t iter; pb_field_init(&iter, fields, dest_struct); if (iter.pos->tag == 0) return; /* Empty message type */ do { pb_release_single_field(&iter); } while (pb_field_next(&iter)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398203, "input": "struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id) { struct sctp_association *asoc = NULL; /* If this is not a UDP-style socket, assoc id should be ignored. */ if (!sctp_style(sk, UDP)) { /* Return NULL if the socket state is not ESTABLISHED. It * could be a TCP-style listening socket or a socket which * hasn't yet called connect() to establish an association. */ if (!sctp_sstate(sk, ESTABLISHED) && !sctp_sstate(sk, CLOSING)) return NULL; /* Get the first and the only association from the list. */ if (!list_empty(&sctp_sk(sk)->ep->asocs)) asoc = list_entry(sctp_sk(sk)->ep->asocs.next, struct sctp_association, asocs); return asoc; } /* Otherwise this is a UDP-style socket. */ if (id <= SCTP_ALL_ASSOC) return NULL; spin_lock_bh(&sctp_assocs_id_lock); asoc = (struct sctp_association *)idr_find(&sctp_assocs_id, (int)id); if (asoc && (asoc->base.sk != sk || asoc->base.dead)) asoc = NULL; spin_unlock_bh(&sctp_assocs_id_lock); return asoc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281265, "input": "RGWOp *RGWHandler_REST_Service_S3::op_post() { if (s->info.args.exists(\"Action\")) { string action = s->info.args.get(\"Action\"); if (action.compare(\"CreateRole\") == 0) return new RGWCreateRole; if (action.compare(\"DeleteRole\") == 0) return new RGWDeleteRole; if (action.compare(\"GetRole\") == 0) return new RGWGetRole; if (action.compare(\"UpdateAssumeRolePolicy\") == 0) return new RGWModifyRole; if (action.compare(\"ListRoles\") == 0) return new RGWListRoles; if (action.compare(\"PutRolePolicy\") == 0) return new RGWPutRolePolicy; if (action.compare(\"GetRolePolicy\") == 0) return new RGWGetRolePolicy; if (action.compare(\"ListRolePolicies\") == 0) return new RGWListRolePolicies; if (action.compare(\"DeleteRolePolicy\") == 0) return new RGWDeleteRolePolicy; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295059, "input": "POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s, BYTE xorBpp) { POINTER_COLOR_UPDATE* pointer_color = calloc(1, sizeof(POINTER_COLOR_UPDATE)); if (!pointer_color) goto fail; if (!_update_read_pointer_color(s, pointer_color, xorBpp, update->context->settings->LargePointerFlag)) goto fail; return pointer_color; fail: free_pointer_color_update(update->context, pointer_color); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509281, "input": "bool excl_dep_on_grouping_fields(st_select_lex *sel) { return (*ref)->excl_dep_on_grouping_fields(sel); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448846, "input": "void RGWDeleteObj_ObjStore_SWIFT::send_response() { int r = op_ret; if (multipart_delete) { r = 0; } else if(!r) { r = STATUS_NO_CONTENT; } set_req_state_err(s, r); dump_errno(s); if (multipart_delete) { end_header(s, this /* RGWOp */, nullptr /* contype */, CHUNKED_TRANSFER_ENCODING); if (deleter) { bulkdelete_respond(deleter->get_num_deleted(), deleter->get_num_unfound(), deleter->get_failures(), s->prot_flags, *s->formatter); } else if (-ENOENT == op_ret) { bulkdelete_respond(0, 1, {}, s->prot_flags, *s->formatter); } else { RGWBulkDelete::acct_path_t path; path.bucket_name = s->bucket_name; path.obj_key = s->object; RGWBulkDelete::fail_desc_t fail_desc; fail_desc.err = op_ret; fail_desc.path = path; bulkdelete_respond(0, 0, { fail_desc }, s->prot_flags, *s->formatter); } } else { end_header(s, this); } rgw_flush_formatter_and_reset(s, s->formatter); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509276, "input": "void fix_char_length(size_t max_char_length_arg) { max_length= char_to_byte_length_safe(max_char_length_arg, collation.collation->mbmaxlen); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421807, "input": "print_lan_set_arp_usage(void) { lprintf(LOG_NOTICE, \"lan set arp respond \"); lprintf(LOG_NOTICE, \"lan set arp generate \"); lprintf(LOG_NOTICE, \"lan set arp interval \"); lprintf(LOG_NOTICE, \"\"); lprintf(LOG_NOTICE, \"example: lan set 7 arp gratuitous off\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514756, "input": "RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t maxsz, void (*resized)(const char*, uint64_t length, void *host), MemoryRegion *mr, Error **errp) { return qemu_ram_alloc_internal(size, maxsz, resized, NULL, RAM_RESIZEABLE, mr, errp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354748, "input": "static inline gpa_t gfn_to_gpa(gfn_t gfn) { return (gpa_t)gfn << PAGE_SHIFT; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303083, "input": "int blosc_get_blocksize(void) { return (int)g_force_blocksize; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379937, "input": "static ISCSI_CLASS_ATTR(priv_sess, creator, S_IRUGO, show_priv_session_creator, NULL); static ssize_t show_priv_session_target_id(struct device *dev, struct device_attribute *attr, char *buf) {", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269763, "input": "void WebContents::ReceivePostMessage(const std::string& channel, blink::TransferableMessage message) { v8::HandleScope handle_scope(isolate()); auto wrapped_ports = MessagePort::EntanglePorts(isolate(), std::move(message.ports)); v8::Local message_value = electron::DeserializeV8Value(isolate(), message); EmitWithSender(\"-ipc-ports\", receivers_.current_context(), InvokeCallback(), false, channel, message_value, std::move(wrapped_ports)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394244, "input": "static int ctnetlink_filter_match(struct nf_conn *ct, void *data) { struct ctnetlink_filter *filter = data; struct nf_conntrack_tuple *tuple; if (filter == NULL) goto out; /* Match entries of a given L3 protocol number. * If it is not specified, ie. l3proto == 0, * then match everything. */ if (filter->family && nf_ct_l3num(ct) != filter->family) goto ignore_entry; if (filter->orig_flags) { tuple = nf_ct_tuple(ct, IP_CT_DIR_ORIGINAL); if (!ctnetlink_filter_match_tuple(&filter->orig, tuple, filter->orig_flags, filter->family)) goto ignore_entry; } if (filter->reply_flags) { tuple = nf_ct_tuple(ct, IP_CT_DIR_REPLY); if (!ctnetlink_filter_match_tuple(&filter->reply, tuple, filter->reply_flags, filter->family)) goto ignore_entry; } #ifdef CONFIG_NF_CONNTRACK_MARK if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) && (ct->mark & filter->mark.mask) != filter->mark.val) goto ignore_entry; else if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK)) && ct->mark != filter->mark.val) goto ignore_entry; #endif out: return 1; ignore_entry: return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281320, "input": "std::string RGWPostObj_ObjStore_S3::get_current_filename() const { return s->object.name; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490177, "input": "int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry) { struct ecryptfs_crypt_stat *crypt_stat = &ecryptfs_inode_to_private(ecryptfs_dentry->d_inode)->crypt_stat; struct ecryptfs_mount_crypt_stat *mount_crypt_stat = &ecryptfs_superblock_to_private( ecryptfs_dentry->d_sb)->mount_crypt_stat; int cipher_name_len; int rc = 0; ecryptfs_set_default_crypt_stat_vals(crypt_stat, mount_crypt_stat); crypt_stat->flags |= (ECRYPTFS_ENCRYPTED | ECRYPTFS_KEY_VALID); ecryptfs_copy_mount_wide_flags_to_inode_flags(crypt_stat, mount_crypt_stat); rc = ecryptfs_copy_mount_wide_sigs_to_inode_sigs(crypt_stat, mount_crypt_stat); if (rc) { printk(KERN_ERR \"Error attempting to copy mount-wide key sigs \" \"to the inode key sigs; rc = [%d]\\n\", rc); goto out; } cipher_name_len = strlen(mount_crypt_stat->global_default_cipher_name); memcpy(crypt_stat->cipher, mount_crypt_stat->global_default_cipher_name, cipher_name_len); crypt_stat->cipher[cipher_name_len] = '\\0'; crypt_stat->key_size = mount_crypt_stat->global_default_cipher_key_size; ecryptfs_generate_new_key(crypt_stat); rc = ecryptfs_init_crypt_ctx(crypt_stat); if (rc) ecryptfs_printk(KERN_ERR, \"Error initializing cryptographic \" \"context for cipher [%s]: rc = [%d]\\n\", crypt_stat->cipher, rc); out: return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399267, "input": "int imap_hcache_store_uid_seqset(struct ImapMboxData *mdata) { if (!mdata->hcache) return -1; /* The seqset is likely large. Preallocate to reduce reallocs */ struct Buffer buf = mutt_buffer_make(8192); imap_msn_index_to_uid_seqset(&buf, mdata); int rc = mutt_hcache_store_raw(mdata->hcache, \"/UIDSEQSET\", 10, buf.data, mutt_buffer_len(&buf) + 1); mutt_debug(LL_DEBUG3, \"Stored /UIDSEQSET %s\\n\", buf.data); mutt_buffer_dealloc(&buf); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431152, "input": "static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res) { __be32 *p; if (unlikely(bitmap[0] & (FATTR4_WORD0_RDATTR_ERROR - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_RDATTR_ERROR)) { p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) return -EIO; bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR; *res = -be32_to_cpup(p); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268818, "input": "R_API int r_sys_sleep(int secs) { #if HAS_CLOCK_NANOSLEEP struct timespec rqtp; rqtp.tv_sec = secs; rqtp.tv_nsec = 0; return clock_nanosleep (CLOCK_MONOTONIC, 0, &rqtp, NULL); #elif __UNIX__ return sleep (secs); #else Sleep (secs * 1000); // W32 return 0; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206065, "input": "static avifBool avifParseImageGridBox(avifImageGrid * grid, const uint8_t * raw, size_t rawLen) { BEGIN_STREAM(s, raw, rawLen); uint8_t version, flags; CHECK(avifROStreamRead(&s, &version, 1)); // unsigned int(8) version = 0; if (version != 0) { return AVIF_FALSE; } CHECK(avifROStreamRead(&s, &flags, 1)); // unsigned int(8) flags; CHECK(avifROStreamRead(&s, &grid->rows, 1)); // unsigned int(8) rows_minus_one; CHECK(avifROStreamRead(&s, &grid->columns, 1)); // unsigned int(8) columns_minus_one; ++grid->rows; ++grid->columns; uint32_t fieldLength = ((flags & 1) + 1) * 16; if (fieldLength == 16) { uint16_t outputWidth16, outputHeight16; CHECK(avifROStreamReadU16(&s, &outputWidth16)); // unsigned int(FieldLength) output_width; CHECK(avifROStreamReadU16(&s, &outputHeight16)); // unsigned int(FieldLength) output_height; grid->outputWidth = outputWidth16; grid->outputHeight = outputHeight16; } else { if (fieldLength != 32) { // This should be impossible return AVIF_FALSE; } CHECK(avifROStreamReadU32(&s, &grid->outputWidth)); // unsigned int(FieldLength) output_width; CHECK(avifROStreamReadU32(&s, &grid->outputHeight)); // unsigned int(FieldLength) output_height; } return AVIF_TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "libavif 0.8.0 and 0.8.1 has an out-of-bounds write in avifDecoderDataFillImageGrid.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2020-36407"}} -{"idx": 432643, "input": "static inline void enable_gif(struct vcpu_svm *svm) { if (vgif_enabled(svm)) svm->vmcb->control.int_ctl |= V_GIF_MASK; else svm->vcpu.arch.hflags |= HF_GIF_MASK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508967, "input": "bool check_vcol_func_processor(void *arg) { return mark_unsupported_function(\"safe_string\", arg, VCOL_IMPOSSIBLE); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 386055, "input": "static int ms_transfer_data(struct rtsx_usb_ms *host, unsigned char data_dir, u8 tpc, u8 cfg, struct scatterlist *sg) { struct rtsx_ucr *ucr = host->ucr; int err; unsigned int length = sg->length; u16 sec_cnt = (u16)(length / 512); u8 trans_mode, dma_dir, flag; unsigned int pipe; struct memstick_dev *card = host->msh->card; dev_dbg(ms_dev(host), \"%s: tpc = 0x%02x, data_dir = %s, length = %d\\n\", __func__, tpc, (data_dir == READ) ? \"READ\" : \"WRITE\", length); if (data_dir == READ) { flag = MODE_CDIR; dma_dir = DMA_DIR_FROM_CARD; if (card->id.type != MEMSTICK_TYPE_PRO) trans_mode = MS_TM_NORMAL_READ; else trans_mode = MS_TM_AUTO_READ; pipe = usb_rcvbulkpipe(ucr->pusb_dev, EP_BULK_IN); } else { flag = MODE_CDOR; dma_dir = DMA_DIR_TO_CARD; if (card->id.type != MEMSTICK_TYPE_PRO) trans_mode = MS_TM_NORMAL_WRITE; else trans_mode = MS_TM_AUTO_WRITE; pipe = usb_sndbulkpipe(ucr->pusb_dev, EP_BULK_OUT); } rtsx_usb_init_cmd(ucr); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TPC, 0xFF, tpc); if (card->id.type == MEMSTICK_TYPE_PRO) { rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_SECTOR_CNT_H, 0xFF, (u8)(sec_cnt >> 8)); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_SECTOR_CNT_L, 0xFF, (u8)sec_cnt); } rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC3, 0xFF, (u8)(length >> 24)); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC2, 0xFF, (u8)(length >> 16)); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC1, 0xFF, (u8)(length >> 8)); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC0, 0xFF, (u8)length); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_CTL, 0x03 | DMA_PACK_SIZE_MASK, dma_dir | DMA_EN | DMA_512); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_DATA_SOURCE, 0x01, RING_BUFFER); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANSFER, 0xFF, MS_TRANSFER_START | trans_mode); rtsx_usb_add_cmd(ucr, CHECK_REG_CMD, MS_TRANSFER, MS_TRANSFER_END, MS_TRANSFER_END); err = rtsx_usb_send_cmd(ucr, flag | STAGE_MS_STATUS, 100); if (err) return err; err = rtsx_usb_transfer_data(ucr, pipe, sg, length, 1, NULL, 10000); if (err) goto err_out; err = rtsx_usb_get_rsp(ucr, 3, 15000); if (err) goto err_out; if (ucr->rsp_buf[0] & MS_TRANSFER_ERR || ucr->rsp_buf[1] & (MS_CRC16_ERR | MS_RDY_TIMEOUT)) { err = -EIO; goto err_out; } return 0; err_out: ms_clear_error(host); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224954, "input": "snmp_ber_encode_type(snmp_packet_t *snmp_packet, uint8_t type) { if(snmp_packet->used == snmp_packet->max) { return 0; } *snmp_packet->out-- = type; snmp_packet->used++; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385619, "input": "template int Mapping::get(uchar c, uchar n, uchar* result) { CacheEntry entry = entries_[c & kMask]; if (entry.code_point_ == c) { if (entry.offset_ == 0) { return 0; } else { result[0] = c + entry.offset_; return 1; } } else { return CalculateValue(c, n, result); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432592, "input": "static void svm_set_vintr(struct vcpu_svm *svm) { set_intercept(svm, INTERCEPT_VINTR); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211908, "input": "int ImagingLibTiffDecode(Imaging im, ImagingCodecState state, UINT8* buffer, Py_ssize_t bytes) { TIFFSTATE *clientstate = (TIFFSTATE *)state->context; char *filename = \"tempfile.tif\"; char *mode = \"r\"; TIFF *tiff; /* buffer is the encoded file, bytes is the length of the encoded file */ /* it all ends up in state->buffer, which is a uint8* from Imaging.h */ TRACE((\"in decoder: bytes %d\\n\", bytes)); TRACE((\"State: count %d, state %d, x %d, y %d, ystep %d\\n\", state->count, state->state, state->x, state->y, state->ystep)); TRACE((\"State: xsize %d, ysize %d, xoff %d, yoff %d \\n\", state->xsize, state->ysize, state->xoff, state->yoff)); TRACE((\"State: bits %d, bytes %d \\n\", state->bits, state->bytes)); TRACE((\"Buffer: %p: %c%c%c%c\\n\", buffer, (char)buffer[0], (char)buffer[1],(char)buffer[2], (char)buffer[3])); TRACE((\"State->Buffer: %c%c%c%c\\n\", (char)state->buffer[0], (char)state->buffer[1],(char)state->buffer[2], (char)state->buffer[3])); TRACE((\"Image: mode %s, type %d, bands: %d, xsize %d, ysize %d \\n\", im->mode, im->type, im->bands, im->xsize, im->ysize)); TRACE((\"Image: image8 %p, image32 %p, image %p, block %p \\n\", im->image8, im->image32, im->image, im->block)); TRACE((\"Image: pixelsize: %d, linesize %d \\n\", im->pixelsize, im->linesize)); dump_state(clientstate); clientstate->size = bytes; clientstate->eof = clientstate->size; clientstate->loc = 0; clientstate->data = (tdata_t)buffer; clientstate->flrealloc = 0; dump_state(clientstate); TIFFSetWarningHandler(NULL); TIFFSetWarningHandlerExt(NULL); if (clientstate->fp) { TRACE((\"Opening using fd: %d\\n\",clientstate->fp)); lseek(clientstate->fp,0,SEEK_SET); // Sometimes, I get it set to the end. tiff = TIFFFdOpen(clientstate->fp, filename, mode); } else { TRACE((\"Opening from string\\n\")); tiff = TIFFClientOpen(filename, mode, (thandle_t) clientstate, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); } if (!tiff){ TRACE((\"Error, didn't get the tiff\\n\")); state->errcode = IMAGING_CODEC_BROKEN; return -1; } if (clientstate->ifd){ int rv; uint32 ifdoffset = clientstate->ifd; TRACE((\"reading tiff ifd %u\\n\", ifdoffset)); rv = TIFFSetSubDirectory(tiff, ifdoffset); if (!rv){ TRACE((\"error in TIFFSetSubDirectory\")); return -1; } } if (TIFFIsTiled(tiff)) { UINT32 x, y, tile_y, row_byte_size; UINT32 tile_width, tile_length, current_tile_width; UINT8 *new_data; TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &tile_width); TIFFGetField(tiff, TIFFTAG_TILELENGTH, &tile_length); // We could use TIFFTileSize, but for YCbCr data it returns subsampled data size row_byte_size = (tile_width * state->bits + 7) / 8; state->bytes = row_byte_size * tile_length; /* overflow check for malloc */ if (state->bytes > INT_MAX - 1) { state->errcode = IMAGING_CODEC_MEMORY; TIFFClose(tiff); return -1; } /* realloc to fit whole tile */ new_data = realloc (state->buffer, state->bytes); if (!new_data) { state->errcode = IMAGING_CODEC_MEMORY; TIFFClose(tiff); return -1; } state->buffer = new_data; TRACE((\"TIFFTileSize: %d\\n\", state->bytes)); for (y = state->yoff; y < state->ysize; y += tile_length) { for (x = state->xoff; x < state->xsize; x += tile_width) { if (ReadTile(tiff, x, y, (UINT32*) state->buffer) == -1) { TRACE((\"Decode Error, Tile at %dx%d\\n\", x, y)); state->errcode = IMAGING_CODEC_BROKEN; TIFFClose(tiff); return -1; } TRACE((\"Read tile at %dx%d; \\n\\n\", x, y)); current_tile_width = min(tile_width, state->xsize - x); // iterate over each line in the tile and stuff data into image for (tile_y = 0; tile_y < min(tile_length, state->ysize - y); tile_y++) { TRACE((\"Writing tile data at %dx%d using tile_width: %d; \\n\", tile_y + y, x, current_tile_width)); // UINT8 * bbb = state->buffer + tile_y * row_byte_size; // TRACE((\"chars: %x%x%x%x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3])); state->shuffle((UINT8*) im->image[tile_y + y] + x * im->pixelsize, state->buffer + tile_y * row_byte_size, current_tile_width ); } } } } else { UINT32 strip_row, row_byte_size; UINT8 *new_data; UINT32 rows_per_strip; int ret; ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &rows_per_strip); if (ret != 1) { rows_per_strip = state->ysize; } TRACE((\"RowsPerStrip: %u \\n\", rows_per_strip)); // We could use TIFFStripSize, but for YCbCr data it returns subsampled data size row_byte_size = (state->xsize * state->bits + 7) / 8; state->bytes = rows_per_strip * row_byte_size; TRACE((\"StripSize: %d \\n\", state->bytes)); /* realloc to fit whole strip */ new_data = realloc (state->buffer, state->bytes); if (!new_data) { state->errcode = IMAGING_CODEC_MEMORY; TIFFClose(tiff); return -1; } state->buffer = new_data; for (; state->y < state->ysize; state->y += rows_per_strip) { if (ReadStrip(tiff, state->y, (UINT32 *)state->buffer) == -1) { TRACE((\"Decode Error, strip %d\\n\", TIFFComputeStrip(tiff, state->y, 0))); state->errcode = IMAGING_CODEC_BROKEN; TIFFClose(tiff); return -1; } TRACE((\"Decoded strip for row %d \\n\", state->y)); // iterate over each row in the strip and stuff data into image for (strip_row = 0; strip_row < min(rows_per_strip, state->ysize - state->y); strip_row++) { TRACE((\"Writing data into line %d ; \\n\", state->y + strip_row)); // UINT8 * bbb = state->buffer + strip_row * (state->bytes / rows_per_strip); // TRACE((\"chars: %x %x %x %x\\n\", ((UINT8 *)bbb)[0], ((UINT8 *)bbb)[1], ((UINT8 *)bbb)[2], ((UINT8 *)bbb)[3])); state->shuffle((UINT8*) im->image[state->y + state->yoff + strip_row] + state->xoff * im->pixelsize, state->buffer + strip_row * row_byte_size, state->xsize); } } } TIFFClose(tiff); TRACE((\"Done Decoding, Returning \\n\")); // Returning -1 here to force ImageFile.load to break, rather than // even think about looping back around. return -1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "libImaging/TiffDecode.c in Pillow before 6.2.2 has a TIFF decoding integer overflow, related to realloc.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-5310"}} -{"idx": 509424, "input": "Item_outer_ref(THD *thd, Name_resolution_context *context_arg, Item_field *outer_field_arg): Item_direct_ref(thd, context_arg, 0, outer_field_arg->table_name, outer_field_arg->field_name), outer_ref(outer_field_arg), in_sum_func(0), found_in_select_list(0), found_in_group_by(0) { ref= &outer_ref; set_properties(); fixed= 0; /* reset flag set in set_properties() */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385761, "input": "MagickExport Image *MorphImages(const Image *image, const size_t number_frames,ExceptionInfo *exception) { #define MorphImageTag \"Morph/Image\" double alpha, beta; Image *morph_image, *morph_images; MagickBooleanType status; MagickOffsetType scene; const Image *next; ssize_t i; ssize_t y; /* Clone first frame in sequence. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); morph_images=CloneImage(image,0,0,MagickTrue,exception); if (morph_images == (Image *) NULL) return((Image *) NULL); if (GetNextImageInList(image) == (Image *) NULL) { /* Morph single image. */ for (i=1; i < (ssize_t) number_frames; i++) { morph_image=CloneImage(image,0,0,MagickTrue,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } AppendImageToList(&morph_images,morph_image); if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; proceed=SetImageProgress(image,MorphImageTag,(MagickOffsetType) i, number_frames); if (proceed == MagickFalse) status=MagickFalse; } } return(GetFirstImageInList(morph_images)); } /* Morph image sequence. */ status=MagickTrue; scene=0; next=image; for ( ; GetNextImageInList(next) != (Image *) NULL; next=GetNextImageInList(next)) { for (i=0; i < (ssize_t) number_frames; i++) { CacheView *image_view, *morph_view; beta=(double) (i+1.0)/(double) (number_frames+1.0); alpha=1.0-beta; morph_image=ResizeImage(next,(size_t) (alpha*next->columns+beta* GetNextImageInList(next)->columns+0.5),(size_t) (alpha* next->rows+beta*GetNextImageInList(next)->rows+0.5), next->filter,next->blur,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } if (SetImageStorageClass(morph_image,DirectClass) == MagickFalse) { InheritException(exception,&morph_image->exception); morph_image=DestroyImage(morph_image); return((Image *) NULL); } AppendImageToList(&morph_images,morph_image); morph_images=GetLastImageInList(morph_images); morph_image=ResizeImage(GetNextImageInList(next),morph_images->columns, morph_images->rows,GetNextImageInList(next)->filter, GetNextImageInList(next)->blur,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } image_view=AcquireVirtualCacheView(morph_image,exception); morph_view=AcquireAuthenticCacheView(morph_images,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \\ magick_number_threads(morph_image,morph_image,morph_image->rows,1) #endif for (y=0; y < (ssize_t) morph_images->rows; y++) { MagickBooleanType sync; const PixelPacket *magick_restrict p; ssize_t x; PixelPacket *magick_restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,morph_image->columns,1, exception); q=GetCacheViewAuthenticPixels(morph_view,0,y,morph_images->columns,1, exception); if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) morph_images->columns; x++) { SetPixelRed(q,ClampToQuantum(alpha* GetPixelRed(q)+beta*GetPixelRed(p))); SetPixelGreen(q,ClampToQuantum(alpha* GetPixelGreen(q)+beta*GetPixelGreen(p))); SetPixelBlue(q,ClampToQuantum(alpha* GetPixelBlue(q)+beta*GetPixelBlue(p))); SetPixelOpacity(q,ClampToQuantum(alpha* GetPixelOpacity(q)+beta*GetPixelOpacity(p))); p++; q++; } sync=SyncCacheViewAuthenticPixels(morph_view,exception); if (sync == MagickFalse) status=MagickFalse; } morph_view=DestroyCacheView(morph_view); image_view=DestroyCacheView(image_view); morph_image=DestroyImage(morph_image); } if (i < (ssize_t) number_frames) break; /* Clone last frame in sequence. */ morph_image=CloneImage(GetNextImageInList(next),0,0,MagickTrue,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } AppendImageToList(&morph_images,morph_image); morph_images=GetLastImageInList(morph_images); if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; proceed=SetImageProgress(image,MorphImageTag,scene, GetImageListLength(image)); if (proceed == MagickFalse) status=MagickFalse; } scene++; } if (GetNextImageInList(next) != (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } return(GetFirstImageInList(morph_images)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398122, "input": "static int sctp_setsockopt_bindx(struct sock *sk, struct sockaddr *addrs, int addrs_size, int op) { int err; int addrcnt = 0; int walk_size = 0; struct sockaddr *sa_addr; void *addr_buf = addrs; struct sctp_af *af; pr_debug(\"%s: sk:%p addrs:%p addrs_size:%d opt:%d\\n\", __func__, sk, addr_buf, addrs_size, op); if (unlikely(addrs_size <= 0)) return -EINVAL; /* Walk through the addrs buffer and count the number of addresses. */ while (walk_size < addrs_size) { if (walk_size + sizeof(sa_family_t) > addrs_size) return -EINVAL; sa_addr = addr_buf; af = sctp_get_af_specific(sa_addr->sa_family); /* If the address family is not supported or if this address * causes the address buffer to overflow return EINVAL. */ if (!af || (walk_size + af->sockaddr_len) > addrs_size) return -EINVAL; addrcnt++; addr_buf += af->sockaddr_len; walk_size += af->sockaddr_len; } /* Do the work. */ switch (op) { case SCTP_BINDX_ADD_ADDR: /* Allow security module to validate bindx addresses. */ err = security_sctp_bind_connect(sk, SCTP_SOCKOPT_BINDX_ADD, addrs, addrs_size); if (err) return err; err = sctp_bindx_add(sk, addrs, addrcnt); if (err) return err; return sctp_send_asconf_add_ip(sk, addrs, addrcnt); case SCTP_BINDX_REM_ADDR: err = sctp_bindx_rem(sk, addrs, addrcnt); if (err) return err; return sctp_send_asconf_del_ip(sk, addrs, addrcnt); default: return -EINVAL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342038, "input": "static bool no_xattr_list(struct dentry *dentry) { return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 116223, "input": "bool SpeechSynthesis::paused() const { return m_isPaused; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364918, "input": "int tipc_node_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, int selector) { struct tipc_link_entry *le = NULL; struct tipc_node *n; struct sk_buff_head xmitq; bool node_up = false; int bearer_id; int rc; if (in_own_node(net, dnode)) { tipc_loopback_trace(net, list); spin_lock_init(&list->lock); tipc_sk_rcv(net, list); return 0; } n = tipc_node_find(net, dnode); if (unlikely(!n)) { __skb_queue_purge(list); return -EHOSTUNREACH; } tipc_node_read_lock(n); node_up = node_is_up(n); if (node_up && n->peer_net && check_net(n->peer_net)) { /* xmit inner linux container */ tipc_lxc_xmit(n->peer_net, list); if (likely(skb_queue_empty(list))) { tipc_node_read_unlock(n); tipc_node_put(n); return 0; } } bearer_id = n->active_links[selector & 1]; if (unlikely(bearer_id == INVALID_BEARER_ID)) { tipc_node_read_unlock(n); tipc_node_put(n); __skb_queue_purge(list); return -EHOSTUNREACH; } __skb_queue_head_init(&xmitq); le = &n->links[bearer_id]; spin_lock_bh(&le->lock); rc = tipc_link_xmit(le->link, list, &xmitq); spin_unlock_bh(&le->lock); tipc_node_read_unlock(n); if (unlikely(rc == -ENOBUFS)) tipc_node_link_down(n, bearer_id, false); else tipc_bearer_xmit(net, bearer_id, &xmitq, &le->maddr, n); tipc_node_put(n); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409850, "input": "static void tcp_try_to_open(struct sock *sk, int flag) { struct tcp_sock *tp = tcp_sk(sk); tcp_verify_left_out(tp); if (!tp->frto_counter && !tcp_any_retrans_done(sk)) tp->retrans_stamp = 0; if (flag & FLAG_ECE) tcp_enter_cwr(sk, 1); if (inet_csk(sk)->icsk_ca_state != TCP_CA_CWR) { tcp_try_keep_open(sk); if (inet_csk(sk)->icsk_ca_state != TCP_CA_Open) tcp_moderate_cwnd(tp); } else { tcp_cwnd_down(sk, flag); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 482984, "input": "struct pipe_ctx *dcn20_acquire_idle_pipe_for_layer( struct dc_state *state, const struct resource_pool *pool, struct dc_stream_state *stream) { struct resource_context *res_ctx = &state->res_ctx; struct pipe_ctx *head_pipe = resource_get_head_pipe_for_stream(res_ctx, stream); struct pipe_ctx *idle_pipe = find_idle_secondary_pipe(res_ctx, pool, head_pipe); if (!head_pipe) ASSERT(0); if (!idle_pipe) return NULL; idle_pipe->stream = head_pipe->stream; idle_pipe->stream_res.tg = head_pipe->stream_res.tg; idle_pipe->stream_res.opp = head_pipe->stream_res.opp; idle_pipe->plane_res.hubp = pool->hubps[idle_pipe->pipe_idx]; idle_pipe->plane_res.ipp = pool->ipps[idle_pipe->pipe_idx]; idle_pipe->plane_res.dpp = pool->dpps[idle_pipe->pipe_idx]; idle_pipe->plane_res.mpcc_inst = pool->dpps[idle_pipe->pipe_idx]->inst; return idle_pipe; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410399, "input": "int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next) { char *end; if (!optstr || !*optstr || !value || !valsz) return -EINVAL; DBG(CXT, ul_debug(\"fixing gid\")); end = value + valsz; if (valsz == 7 && !strncmp(value, \"usergid\", 7) && (*(value + 7) == ',' || !*(value + 7))) return set_uint_value(optstr, getgid(), value, end, next); if (!isdigit(*value)) { int rc; gid_t id; char *p = strndup(value, valsz); if (!p) return -ENOMEM; rc = mnt_get_gid(p, &id); free(p); if (!rc) return set_uint_value(optstr, id, value, end, next); } if (next) { /* nothing */ *next = value + valsz; if (**next == ',') (*next)++; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198696, "input": "int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) { const char *content_type = NULL; string content_type_str; map response_attrs; map::iterator riter; bufferlist metadata_bl; if (sent_header) goto send_data; if (custom_http_ret) { set_req_state_err(s, 0); dump_errno(s, custom_http_ret); } else { set_req_state_err(s, (partial_content && !op_ret) ? STATUS_PARTIAL_CONTENT : op_ret); dump_errno(s); } if (op_ret) goto done; if (range_str) dump_range(s, start, end, s->obj_size); if (s->system_request && s->info.args.exists(RGW_SYS_PARAM_PREFIX \"prepend-metadata\")) { dump_header(s, \"Rgwx-Object-Size\", (long long)total_len); if (rgwx_stat) { /* * in this case, we're not returning the object's content, only the prepended * extra metadata */ total_len = 0; } /* JSON encode object metadata */ JSONFormatter jf; jf.open_object_section(\"obj_metadata\"); encode_json(\"attrs\", attrs, &jf); utime_t ut(lastmod); encode_json(\"mtime\", ut, &jf); jf.close_section(); stringstream ss; jf.flush(ss); metadata_bl.append(ss.str()); dump_header(s, \"Rgwx-Embedded-Metadata-Len\", metadata_bl.length()); total_len += metadata_bl.length(); } if (s->system_request && !real_clock::is_zero(lastmod)) { /* we end up dumping mtime in two different methods, a bit redundant */ dump_epoch_header(s, \"Rgwx-Mtime\", lastmod); uint64_t pg_ver = 0; int r = decode_attr_bl_single_value(attrs, RGW_ATTR_PG_VER, &pg_ver, (uint64_t)0); if (r < 0) { ldout(s->cct, 0) << \"ERROR: failed to decode pg ver attr, ignoring\" << dendl; } dump_header(s, \"Rgwx-Obj-PG-Ver\", pg_ver); uint32_t source_zone_short_id = 0; r = decode_attr_bl_single_value(attrs, RGW_ATTR_SOURCE_ZONE, &source_zone_short_id, (uint32_t)0); if (r < 0) { ldout(s->cct, 0) << \"ERROR: failed to decode pg ver attr, ignoring\" << dendl; } if (source_zone_short_id != 0) { dump_header(s, \"Rgwx-Source-Zone-Short-Id\", source_zone_short_id); } } for (auto &it : crypt_http_responses) dump_header(s, it.first, it.second); dump_content_length(s, total_len); dump_last_modified(s, lastmod); dump_header_if_nonempty(s, \"x-amz-version-id\", version_id); if (! op_ret) { if (! lo_etag.empty()) { /* Handle etag of Swift API's large objects (DLO/SLO). It's entirerly * legit to perform GET on them through S3 API. In such situation, * a client should receive the composited content with corresponding * etag value. */ dump_etag(s, lo_etag); } else { auto iter = attrs.find(RGW_ATTR_ETAG); if (iter != attrs.end()) { dump_etag(s, iter->second.to_str()); } } for (struct response_attr_param *p = resp_attr_params; p->param; p++) { bool exists; string val = s->info.args.get(p->param, &exists); if (exists) { if (strcmp(p->param, \"response-content-type\") != 0) { response_attrs[p->http_attr] = val; } else { content_type_str = val; content_type = content_type_str.c_str(); } } } for (auto iter = attrs.begin(); iter != attrs.end(); ++iter) { const char *name = iter->first.c_str(); map::iterator aiter = rgw_to_http_attrs.find(name); if (aiter != rgw_to_http_attrs.end()) { if (response_attrs.count(aiter->second) == 0) { /* Was not already overridden by a response param. */ response_attrs[aiter->second] = iter->second.c_str(); } } else if (iter->first.compare(RGW_ATTR_CONTENT_TYPE) == 0) { /* Special handling for content_type. */ if (!content_type) { content_type = iter->second.c_str(); } } else if (strcmp(name, RGW_ATTR_SLO_UINDICATOR) == 0) { // this attr has an extra length prefix from encode() in prior versions dump_header(s, \"X-Object-Meta-Static-Large-Object\", \"True\"); } else if (strncmp(name, RGW_ATTR_META_PREFIX, sizeof(RGW_ATTR_META_PREFIX)-1) == 0) { /* User custom metadata. */ name += sizeof(RGW_ATTR_PREFIX) - 1; dump_header(s, name, iter->second); } else if (iter->first.compare(RGW_ATTR_TAGS) == 0) { RGWObjTags obj_tags; try{ bufferlist::iterator it = iter->second.begin(); obj_tags.decode(it); } catch (buffer::error &err) { ldout(s->cct,0) << \"Error caught buffer::error couldn't decode TagSet \" << dendl; } dump_header(s, RGW_AMZ_TAG_COUNT, obj_tags.count()); } } } done: for (riter = response_attrs.begin(); riter != response_attrs.end(); ++riter) { dump_header(s, riter->first, riter->second); } if (op_ret == -ERR_NOT_MODIFIED) { end_header(s, this); } else { if (!content_type) content_type = \"binary/octet-stream\"; end_header(s, this, content_type); } if (metadata_bl.length()) { dump_body(s, metadata_bl); } sent_header = true; send_data: if (get_data && !op_ret) { int r = dump_body(s, bl.c_str() + bl_ofs, bl_len); if (r < 0) return r; } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"], "explanation": "A flaw was found in the Ceph Object Gateway, where it supports request sent by an anonymous user in Amazon S3. This flaw could lead to potential XSS attacks due to the lack of proper neutralization of untrusted input.", "severity_level": "NoInfo", "cwe": "CWE-79", "cve": "CVE-2020-1760"}} -{"idx": 303447, "input": "server_select_comp_method(gnutls_session_t session, uint8_t * data, int datalen) { int x, i, j; uint8_t comps[MAX_ALGOS]; x = _gnutls_supported_compression_methods(session, comps, MAX_ALGOS); if (x < 0) { gnutls_assert(); return x; } if (session->internals.priorities.server_precedence == 0) { for (j = 0; j < datalen; j++) { for (i = 0; i < x; i++) { if (comps[i] == data[j]) { gnutls_compression_method_t method = _gnutls_compression_get_id (comps[i]); _gnutls_epoch_set_compression (session, EPOCH_NEXT, method); session->security_parameters. compression_method = method; _gnutls_handshake_log (\"HSK[%p]: Selected Compression Method: %s\\n\", session, gnutls_compression_get_name (method)); return 0; } } } } else { for (i = 0; i < x; i++) { for (j = 0; j < datalen; j++) { if (comps[i] == data[j]) { gnutls_compression_method_t method = _gnutls_compression_get_id (comps[i]); _gnutls_epoch_set_compression (session, EPOCH_NEXT, method); session->security_parameters. compression_method = method; _gnutls_handshake_log (\"HSK[%p]: Selected Compression Method: %s\\n\", session, gnutls_compression_get_name (method)); return 0; } } } } /* we were not able to find a compatible compression * algorithm */ gnutls_assert(); return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212389, "input": "ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) { unsigned int nbits; gpg_err_code_t rc; struct pk_encoding_ctx ctx; gcry_sexp_t l1 = NULL; gcry_mpi_t data_e = NULL; ECC_secret_key sk; gcry_mpi_t mpi_g = NULL; char *curvename = NULL; mpi_ec_t ec = NULL; mpi_point_struct kG; mpi_point_struct R; gcry_mpi_t r = NULL; int flags = 0; memset (&sk, 0, sizeof sk); point_init (&kG); point_init (&R); _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_DECRYPT, (nbits = ecc_get_nbits (keyparms))); /* Look for flags. */ l1 = sexp_find_token (keyparms, \"flags\", 0); if (l1) { rc = _gcry_pk_util_parse_flaglist (l1, &flags, NULL); if (rc) goto leave; } sexp_release (l1); l1 = NULL; /* * Extract the data. */ rc = _gcry_pk_util_preparse_encval (s_data, ecc_names, &l1, &ctx); if (rc) goto leave; rc = sexp_extract_param (l1, NULL, \"e\", &data_e, NULL); if (rc) goto leave; if (DBG_CIPHER) log_printmpi (\"ecc_decrypt d_e\", data_e); if (mpi_is_opaque (data_e)) { rc = GPG_ERR_INV_DATA; goto leave; } /* * Extract the key. */ rc = sexp_extract_param (keyparms, NULL, \"-p?a?b?g?n?h?+d\", &sk.E.p, &sk.E.a, &sk.E.b, &mpi_g, &sk.E.n, &sk.E.h, &sk.d, NULL); if (rc) goto leave; if (mpi_g) { point_init (&sk.E.G); rc = _gcry_ecc_os2ec (&sk.E.G, mpi_g); if (rc) goto leave; } /* Add missing parameters using the optional curve parameter. */ sexp_release (l1); l1 = sexp_find_token (keyparms, \"curve\", 5); if (l1) { curvename = sexp_nth_string (l1, 1); if (curvename) { rc = _gcry_ecc_fill_in_curve (0, curvename, &sk.E, NULL); if (rc) goto leave; } } /* Guess required fields if a curve parameter has not been given. */ if (!curvename) { sk.E.model = MPI_EC_WEIERSTRASS; sk.E.dialect = ECC_DIALECT_STANDARD; if (!sk.E.h) sk.E.h = mpi_const (MPI_C_ONE); } if (DBG_CIPHER) { log_debug (\"ecc_decrypt info: %s/%s\\n\", _gcry_ecc_model2str (sk.E.model), _gcry_ecc_dialect2str (sk.E.dialect)); if (sk.E.name) log_debug (\"ecc_decrypt name: %s\\n\", sk.E.name); log_printmpi (\"ecc_decrypt p\", sk.E.p); log_printmpi (\"ecc_decrypt a\", sk.E.a); log_printmpi (\"ecc_decrypt b\", sk.E.b); log_printpnt (\"ecc_decrypt g\", &sk.E.G, NULL); log_printmpi (\"ecc_decrypt n\", sk.E.n); log_printmpi (\"ecc_decrypt h\", sk.E.h); if (!fips_mode ()) log_printmpi (\"ecc_decrypt d\", sk.d); } if (!sk.E.p || !sk.E.a || !sk.E.b || !sk.E.G.x || !sk.E.n || !sk.E.h || !sk.d) { rc = GPG_ERR_NO_OBJ; goto leave; } ec = _gcry_mpi_ec_p_internal_new (sk.E.model, sk.E.dialect, flags, sk.E.p, sk.E.a, sk.E.b); /* * Compute the plaintext. */ if (ec->model == MPI_EC_MONTGOMERY) rc = _gcry_ecc_mont_decodepoint (data_e, ec, &kG); else rc = _gcry_ecc_os2ec (&kG, data_e); if (rc) goto leave; if (DBG_CIPHER) log_printpnt (\"ecc_decrypt kG\", &kG, NULL); if (!(flags & PUBKEY_FLAG_DJB_TWEAK) /* For X25519, by its definition, validation should not be done. */ && !_gcry_mpi_ec_curve_point (&kG, ec)) { rc = GPG_ERR_INV_DATA; goto leave; } /* R = dkG */ _gcry_mpi_ec_mul_point (&R, sk.d, &kG, ec); /* The following is false: assert( mpi_cmp_ui( R.x, 1 )==0 );, so: */ { gcry_mpi_t x, y; x = mpi_new (0); if (ec->model == MPI_EC_MONTGOMERY) y = NULL; else y = mpi_new (0); if (_gcry_mpi_ec_get_affine (x, y, &R, ec)) { rc = GPG_ERR_INV_DATA; goto leave; /* * Note for X25519. * * By the definition of X25519, this is the case where X25519 * returns 0, mapping infinity to zero. However, we * deliberately let it return an error. * * For X25519 ECDH, comming here means that it might be * decrypted by anyone with the shared secret of 0 (the result * of this function could be always 0 by other scalar values, * other than the private key of SK.D). * * So, it looks like an encrypted message but it can be * decrypted by anyone, or at least something wrong * happens. Recipient should not proceed as if it were * properly encrypted message. * * This handling is needed for our major usage of GnuPG, * where it does the One-Pass Diffie-Hellman method, * C(1, 1, ECC CDH), with an ephemeral key. */ } if (y) r = _gcry_ecc_ec2os (x, y, sk.E.p); else { unsigned char *rawmpi; unsigned int rawmpilen; rawmpi = _gcry_mpi_get_buffer_extra (x, nbits/8, -1, &rawmpilen, NULL); if (!rawmpi) { rc = gpg_err_code_from_syserror (); goto leave; } else { rawmpi[0] = 0x40; rawmpilen++; r = mpi_new (0); mpi_set_opaque (r, rawmpi, rawmpilen*8); } } if (!r) rc = gpg_err_code_from_syserror (); else rc = 0; mpi_free (x); mpi_free (y); } if (DBG_CIPHER) log_printmpi (\"ecc_decrypt res\", r); if (!rc) rc = sexp_build (r_plain, NULL, \"(value %m)\", r); leave: point_free (&R); point_free (&kG); _gcry_mpi_release (r); _gcry_mpi_release (sk.E.p); _gcry_mpi_release (sk.E.a); _gcry_mpi_release (sk.E.b); _gcry_mpi_release (mpi_g); point_free (&sk.E.G); _gcry_mpi_release (sk.E.n); _gcry_mpi_release (sk.E.h); _gcry_mpi_release (sk.d); _gcry_mpi_release (data_e); xfree (curvename); sexp_release (l1); _gcry_mpi_ec_free (ec); _gcry_pk_util_free_encoding_ctx (&ctx); if (DBG_CIPHER) log_debug (\"ecc_decrypt => %s\\n\", gpg_strerror (rc)); return rc; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "Libgcrypt before 1.8.1 does not properly consider Curve25519 side-channel attacks, which makes it easier for attackers to discover a secret key, related to cipher/ecc.c and mpi/ec.c.", "severity_level": "Medium", "cwe": "CWE-200", "cve": "CVE-2017-0379"}} -{"idx": 409644, "input": "static BOOL rdp_print_draw_gdiplus_cache_capability_set(wStream* s, UINT16 length) { UINT32 drawGdiPlusSupportLevel; UINT32 GdipVersion; UINT32 drawGdiplusCacheLevel; WLog_INFO(TAG, \"DrawGdiPlusCacheCapabilitySet (length %\" PRIu16 \"):\", length); if (length < 40) return FALSE; Stream_Read_UINT32(s, drawGdiPlusSupportLevel); /* drawGdiPlusSupportLevel (4 bytes) */ Stream_Read_UINT32(s, GdipVersion); /* GdipVersion (4 bytes) */ Stream_Read_UINT32(s, drawGdiplusCacheLevel); /* drawGdiPlusCacheLevel (4 bytes) */ Stream_Seek(s, 10); /* GdipCacheEntries (10 bytes) */ Stream_Seek(s, 8); /* GdipCacheChunkSize (8 bytes) */ Stream_Seek(s, 6); /* GdipImageCacheProperties (6 bytes) */ return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394185, "input": "ctnetlink_exp_stat_cpu_dump(struct sk_buff *skb, struct netlink_callback *cb) { int cpu; struct net *net = sock_net(skb->sk); if (cb->args[0] == nr_cpu_ids) return 0; for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) { const struct ip_conntrack_stat *st; if (!cpu_possible(cpu)) continue; st = per_cpu_ptr(net->ct.stat, cpu); if (ctnetlink_exp_stat_fill_info(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, cpu, st) < 0) break; } cb->args[0] = cpu; return skb->len; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197200, "input": "void Compute(OpKernelContext *ctx) override { // (0) validations const Tensor *a_indices, *b_indices, *a_values_t, *b_values_t, *a_shape, *b_shape, *thresh_t; OP_REQUIRES_OK(ctx, ctx->input(\"a_indices\", &a_indices)); OP_REQUIRES_OK(ctx, ctx->input(\"b_indices\", &b_indices)); OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(a_indices->shape()) && TensorShapeUtils::IsMatrix(b_indices->shape()), errors::InvalidArgument( \"Input indices should be matrices but received shapes: \", a_indices->shape().DebugString(), \" and \", b_indices->shape().DebugString())); const int64 a_nnz = a_indices->dim_size(0); const int64 b_nnz = b_indices->dim_size(0); OP_REQUIRES_OK(ctx, ctx->input(\"a_values\", &a_values_t)); OP_REQUIRES_OK(ctx, ctx->input(\"b_values\", &b_values_t)); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(a_values_t->shape()) && TensorShapeUtils::IsVector(b_values_t->shape()), errors::InvalidArgument( \"Input values should be vectors but received shapes: \", a_values_t->shape().DebugString(), \" and \", b_values_t->shape().DebugString())); auto a_values = ctx->input(1).vec(); auto b_values = ctx->input(4).vec(); OP_REQUIRES( ctx, a_values.size() == a_nnz && b_values.size() == b_nnz, errors::InvalidArgument(\"Expected \", a_nnz, \" and \", b_nnz, \" non-empty input values, got \", a_values.size(), \" and \", b_values.size())); OP_REQUIRES_OK(ctx, ctx->input(\"a_shape\", &a_shape)); OP_REQUIRES_OK(ctx, ctx->input(\"b_shape\", &b_shape)); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(a_shape->shape()) && TensorShapeUtils::IsVector(b_shape->shape()), errors::InvalidArgument( \"Input shapes should be a vector but received shapes \", a_shape->shape().DebugString(), \" and \", b_shape->shape().DebugString())); OP_REQUIRES( ctx, a_shape->IsSameSize(*b_shape), errors::InvalidArgument( \"Operands do not have the same ranks; got shapes: \", a_shape->SummarizeValue(10), \" and \", b_shape->SummarizeValue(10))); const auto a_shape_flat = a_shape->flat(); const auto b_shape_flat = b_shape->flat(); for (int i = 0; i < a_shape->NumElements(); ++i) { OP_REQUIRES(ctx, a_shape_flat(i) == b_shape_flat(i), errors::InvalidArgument( \"Operands' shapes do not match: got \", a_shape_flat(i), \" and \", b_shape_flat(i), \" for dimension \", i)); } OP_REQUIRES_OK(ctx, ctx->input(\"thresh\", &thresh_t)); OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(thresh_t->shape()), errors::InvalidArgument( \"The magnitude threshold must be a scalar: got shape \", thresh_t->shape().DebugString())); // std::abs() so that it works for complex{64,128} values as well const Treal thresh = thresh_t->scalar()(); // (1) do a pass over inputs, and append values and indices to vectors auto a_indices_mat = a_indices->matrix(); auto b_indices_mat = b_indices->matrix(); std::vector> entries_to_copy; // from_a?, idx entries_to_copy.reserve(a_nnz + b_nnz); std::vector out_values; const int num_dims = a_shape->dim_size(0); // The input and output sparse tensors are assumed to be ordered along // increasing dimension number. int64 i = 0, j = 0; T s; while (i < a_nnz && j < b_nnz) { switch (sparse::DimComparator::cmp(a_indices_mat, b_indices_mat, i, j, num_dims)) { case -1: entries_to_copy.emplace_back(true, i); out_values.push_back(a_values(i)); ++i; break; case 0: s = a_values(i) + b_values(j); if (thresh <= std::abs(s)) { entries_to_copy.emplace_back(true, i); out_values.push_back(s); } ++i; ++j; break; case 1: entries_to_copy.emplace_back(false, j); out_values.push_back(b_values(j)); ++j; break; } } #define HANDLE_LEFTOVERS(A_OR_B, IDX, IS_A) \\ while (IDX < A_OR_B##_nnz) { \\ entries_to_copy.emplace_back(IS_A, IDX); \\ out_values.push_back(A_OR_B##_values(IDX)); \\ ++IDX; \\ } // at most one of these calls appends new values HANDLE_LEFTOVERS(a, i, true); HANDLE_LEFTOVERS(b, j, false); #undef HANDLE_LEFTOVERS // (2) allocate and fill output tensors const int64 sum_nnz = out_values.size(); Tensor *out_indices_t, *out_values_t; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({sum_nnz, num_dims}), &out_indices_t)); OP_REQUIRES_OK( ctx, ctx->allocate_output(1, TensorShape({sum_nnz}), &out_values_t)); auto out_indices_mat = out_indices_t->matrix(); auto out_values_flat = out_values_t->vec(); for (i = 0; i < sum_nnz; ++i) { const bool from_a = entries_to_copy[i].first; const int64 idx = entries_to_copy[i].second; out_indices_mat.chip<0>(i) = from_a ? a_indices_mat.chip<0>(idx) : b_indices_mat.chip<0>(idx); } if (sum_nnz > 0) { std::copy_n(out_values.begin(), sum_nnz, &out_values_flat(0)); } ctx->set_output(2, *a_shape); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. Incomplete validation in `SparseAdd` results in allowing attackers to exploit undefined behavior (dereferencing null pointers) as well as write outside of bounds of heap allocated data. The implementation(https://github.com/tensorflow/tensorflow/blob/656e7673b14acd7835dc778867f84916c6d1cac2/tensorflow/core/kernels/sparse_add_op.cc) has a large set of validation for the two sparse tensor inputs (6 tensors in total), but does not validate that the tensors are not empty or that the second dimension of `*_indices` matches the size of corresponding `*_shape`. This allows attackers to send tensor triples that represent invalid sparse tensors to abuse code assumptions that are not protected by validation. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-29609"}} -{"idx": 412629, "input": "HRESULT Http::HrGetUser(std::wstring *strUser) { if (m_strUser.empty()) return MAPI_E_NOT_FOUND; return X2W(m_strUser, strUser); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432009, "input": "static void hci_cc_role_discovery(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_rp_role_discovery *rp = (void *) skb->data; struct hci_conn *conn; BT_DBG(\"%s status 0x%2.2x\", hdev->name, rp->status); if (rp->status) return; hci_dev_lock(hdev); conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); if (conn) conn->role = rp->role; hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 241028, "input": "bool WindowsServiceControl::isRegistered() { return m_serviceHandle != nullptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357444, "input": "static OPJ_BOOL opj_j2k_read_ppm( opj_j2k_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, opj_event_mgr_t * p_manager) { opj_cp_t *l_cp = 00; OPJ_UINT32 l_Z_ppm; /* preconditions */ assert(p_header_data != 00); assert(p_j2k != 00); assert(p_manager != 00); /* We need to have the Z_ppm element + 1 byte of Nppm/Ippm at minimum */ if (p_header_size < 2) { opj_event_msg(p_manager, EVT_ERROR, \"Error reading PPM marker\\n\"); return OPJ_FALSE; } l_cp = &(p_j2k->m_cp); l_cp->ppm = 1; opj_read_bytes(p_header_data, &l_Z_ppm, 1); /* Z_ppm */ ++p_header_data; --p_header_size; /* check allocation needed */ if (l_cp->ppm_markers == NULL) { /* first PPM marker */ OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */ assert(l_cp->ppm_markers_count == 0U); l_cp->ppm_markers = (opj_ppx *) opj_calloc(l_newCount, sizeof(opj_ppx)); if (l_cp->ppm_markers == NULL) { opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to read PPM marker\\n\"); return OPJ_FALSE; } l_cp->ppm_markers_count = l_newCount; } else if (l_cp->ppm_markers_count <= l_Z_ppm) { OPJ_UINT32 l_newCount = l_Z_ppm + 1U; /* can't overflow, l_Z_ppm is UINT8 */ opj_ppx *new_ppm_markers; new_ppm_markers = (opj_ppx *) opj_realloc(l_cp->ppm_markers, l_newCount * sizeof(opj_ppx)); if (new_ppm_markers == NULL) { /* clean up to be done on l_cp destruction */ opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to read PPM marker\\n\"); return OPJ_FALSE; } l_cp->ppm_markers = new_ppm_markers; memset(l_cp->ppm_markers + l_cp->ppm_markers_count, 0, (l_newCount - l_cp->ppm_markers_count) * sizeof(opj_ppx)); l_cp->ppm_markers_count = l_newCount; } if (l_cp->ppm_markers[l_Z_ppm].m_data != NULL) { /* clean up to be done on l_cp destruction */ opj_event_msg(p_manager, EVT_ERROR, \"Zppm %u already read\\n\", l_Z_ppm); return OPJ_FALSE; } l_cp->ppm_markers[l_Z_ppm].m_data = (OPJ_BYTE *) opj_malloc(p_header_size); if (l_cp->ppm_markers[l_Z_ppm].m_data == NULL) { /* clean up to be done on l_cp destruction */ opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to read PPM marker\\n\"); return OPJ_FALSE; } l_cp->ppm_markers[l_Z_ppm].m_data_size = p_header_size; memcpy(l_cp->ppm_markers[l_Z_ppm].m_data, p_header_data, p_header_size); return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 285550, "input": "create_initial_state (re_dfa_t *dfa) { Idx first, i; reg_errcode_t err; re_node_set init_nodes; /* Initial states have the epsilon closure of the node which is the first node of the regular expression. */ first = dfa->str_tree->first->node_idx; dfa->init_node = first; err = re_node_set_init_copy (&init_nodes, dfa->eclosures + first); if (BE (err != REG_NOERROR, 0)) return err; /* The back-references which are in initial states can epsilon transit, since in this case all of the subexpressions can be null. Then we add epsilon closures of the nodes which are the next nodes of the back-references. */ if (dfa->nbackref > 0) for (i = 0; i < init_nodes.nelem; ++i) { Idx node_idx = init_nodes.elems[i]; re_token_type_t type = dfa->nodes[node_idx].type; Idx clexp_idx; if (type != OP_BACK_REF) continue; for (clexp_idx = 0; clexp_idx < init_nodes.nelem; ++clexp_idx) { re_token_t *clexp_node; clexp_node = dfa->nodes + init_nodes.elems[clexp_idx]; if (clexp_node->type == OP_CLOSE_SUBEXP && clexp_node->opr.idx == dfa->nodes[node_idx].opr.idx) break; } if (clexp_idx == init_nodes.nelem) continue; if (type == OP_BACK_REF) { Idx dest_idx = dfa->edests[node_idx].elems[0]; if (!re_node_set_contains (&init_nodes, dest_idx)) { reg_errcode_t merge_err = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx); if (merge_err != REG_NOERROR) return merge_err; i = 0; } } } /* It must be the first time to invoke acquire_state. */ dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0); /* We don't check ERR here, since the initial state must not be NULL. */ if (BE (dfa->init_state == NULL, 0)) return err; if (dfa->init_state->has_constraint) { dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_WORD); dfa->init_state_nl = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_NEWLINE); dfa->init_state_begbuf = re_acquire_state_context (&err, dfa, &init_nodes, CONTEXT_NEWLINE | CONTEXT_BEGBUF); if (BE (dfa->init_state_word == NULL || dfa->init_state_nl == NULL || dfa->init_state_begbuf == NULL, 0)) return err; } else dfa->init_state_word = dfa->init_state_nl = dfa->init_state_begbuf = dfa->init_state; re_node_set_free (&init_nodes); return REG_NOERROR; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379966, "input": "} EXPORT_SYMBOL_GPL(iscsi_dbg_trace); static __init int iscsi_transport_init(void) { int err; struct netlink_kernel_cfg cfg = { .groups = 1, .input = iscsi_if_rx, }; printk(KERN_INFO \"Loading iSCSI transport class v%s.\\n\", ISCSI_TRANSPORT_VERSION); atomic_set(&iscsi_session_nr, 0); err = class_register(&iscsi_transport_class); if (err) return err; err = class_register(&iscsi_endpoint_class); if (err) goto unregister_transport_class; err = class_register(&iscsi_iface_class); if (err) goto unregister_endpoint_class; err = transport_class_register(&iscsi_host_class); if (err) goto unregister_iface_class; err = transport_class_register(&iscsi_connection_class); if (err) goto unregister_host_class; err = transport_class_register(&iscsi_session_class); if (err) goto unregister_conn_class; err = bus_register(&iscsi_flashnode_bus); if (err) goto unregister_session_class; nls = netlink_kernel_create(&init_net, NETLINK_ISCSI, &cfg); if (!nls) { err = -ENOBUFS; goto unregister_flashnode_bus; } iscsi_eh_timer_workq = alloc_workqueue(\"%s\", WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 1, \"iscsi_eh\"); if (!iscsi_eh_timer_workq) { err = -ENOMEM; goto release_nls; } iscsi_destroy_workq = alloc_workqueue(\"%s\", WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, 1, \"iscsi_destroy\"); if (!iscsi_destroy_workq) { err = -ENOMEM; goto destroy_wq; } return 0; destroy_wq: destroy_workqueue(iscsi_eh_timer_workq); release_nls: netlink_kernel_release(nls); unregister_flashnode_bus: bus_unregister(&iscsi_flashnode_bus); unregister_session_class: transport_class_unregister(&iscsi_session_class); unregister_conn_class: transport_class_unregister(&iscsi_connection_class); unregister_host_class: transport_class_unregister(&iscsi_host_class); unregister_iface_class: class_unregister(&iscsi_iface_class); unregister_endpoint_class: class_unregister(&iscsi_endpoint_class); unregister_transport_class:", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445625, "input": "int unregister_ftrace_export(struct trace_export *export) { int ret; mutex_lock(&ftrace_export_lock); ret = rm_ftrace_export(&ftrace_exports_list, export); mutex_unlock(&ftrace_export_lock); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232659, "input": "Status TF_TensorToMaybeAliasedPyArray(Safe_TF_TensorPtr tensor, PyObject** out_ndarray) { auto dtype = TF_TensorType(tensor.get()); if (dtype == TF_STRING || dtype == TF_RESOURCE) { return TF_TensorToPyArray(std::move(tensor), out_ndarray); } TF_Tensor* moved = tensor.release(); int64 nelems = -1; gtl::InlinedVector dims; TF_RETURN_IF_ERROR(GetPyArrayDimensionsForTensor(moved, &dims, &nelems)); return ArrayFromMemory( dims.size(), dims.data(), TF_TensorData(moved), static_cast(dtype), [moved] { TF_DeleteTensor(moved); }, out_ndarray); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394266, "input": "static int ctnetlink_stat_exp_cpu(struct net *net, struct sock *ctnl, struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const cda[], struct netlink_ext_ack *extack) { if (nlh->nlmsg_flags & NLM_F_DUMP) { struct netlink_dump_control c = { .dump = ctnetlink_exp_stat_cpu_dump, }; return netlink_dump_start(ctnl, skb, nlh, &c); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431935, "input": "static void hci_cc_user_passkey_reply(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_rp_user_confirm_reply *rp = (void *) skb->data; BT_DBG(\"%s status 0x%2.2x\", hdev->name, rp->status); hci_dev_lock(hdev); if (hci_dev_test_flag(hdev, HCI_MGMT)) mgmt_user_passkey_reply_complete(hdev, &rp->bdaddr, ACL_LINK, 0, rp->status); hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280612, "input": "parse_SET_IP_DSCP(char *arg, const struct ofpact_parse_params *pp) { uint8_t tos; char *error; error = str_to_u8(arg, \"TOS\", &tos); if (error) { return error; } if (tos & ~IP_DSCP_MASK) { return xasprintf(\"%s: not a valid TOS\", arg); } ofpact_put_SET_IP_DSCP(pp->ofpacts)->dscp = tos; return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268876, "input": "R_API bool r_socket_listen (RSocket *s, const char *port, const char *certfile) { return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232387, "input": "inline uint8x8_t ComputeLerpx8Tmpl(const quint8* const yl, const quint8* yu, const int64* xl, const int64* xu, const int16* xlp, const int16x8_t ys_lerpsx) { return ComputeLerpx8( yl + xl[ID0] + CH0, yl + xu[ID0] + CH0, yu + xl[ID0] + CH0, yu + xu[ID0] + CH0, xlp + ID0, yl + xl[ID1] + CH1, yl + xu[ID1] + CH1, yu + xl[ID1] + CH1, yu + xu[ID1] + CH1, xlp + ID1, yl + xl[ID2] + CH2, yl + xu[ID2] + CH2, yu + xl[ID2] + CH2, yu + xu[ID2] + CH2, xlp + ID2, yl + xl[ID3] + CH3, yl + xu[ID3] + CH3, yu + xl[ID3] + CH3, yu + xu[ID3] + CH3, xlp + ID3, yl + xl[ID4] + CH4, yl + xu[ID4] + CH4, yu + xl[ID4] + CH4, yu + xu[ID4] + CH4, xlp + ID4, yl + xl[ID5] + CH5, yl + xu[ID5] + CH5, yu + xl[ID5] + CH5, yu + xu[ID5] + CH5, xlp + ID5, yl + xl[ID6] + CH6, yl + xu[ID6] + CH6, yu + xl[ID6] + CH6, yu + xu[ID6] + CH6, xlp + ID6, yl + xl[ID7] + CH7, yl + xu[ID7] + CH7, yu + xl[ID7] + CH7, yu + xu[ID7] + CH7, xlp + ID7, ys_lerpsx); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 386063, "input": "static int rtsx_usb_ms_suspend(struct device *dev) { struct rtsx_usb_ms *host = dev_get_drvdata(dev); struct memstick_host *msh = host->msh; /* Since we use rtsx_usb's resume callback to runtime resume its * children to implement remote wakeup signaling, this causes * rtsx_usb_ms' runtime resume callback runs after its suspend * callback: * rtsx_usb_ms_suspend() * rtsx_usb_resume() * -> rtsx_usb_ms_runtime_resume() * -> memstick_detect_change() * * rtsx_usb_suspend() * * To avoid this, skip runtime resume/suspend if system suspend is * underway. */ host->system_suspending = true; memstick_suspend_host(msh); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255324, "input": "static bool pb_field_next(pb_field_iterator_t *iter) { bool notwrapped = true; size_t prev_size = iter->pos->data_size; if (PB_ATYPE(iter->pos->type) == PB_ATYPE_STATIC && PB_HTYPE(iter->pos->type) == PB_HTYPE_REPEATED) { prev_size *= iter->pos->array_size; } else if (PB_ATYPE(iter->pos->type) == PB_ATYPE_POINTER) { prev_size = sizeof(void*); } if (iter->pos->tag == 0) return false; /* Only happens with empty message types */ if (PB_HTYPE(iter->pos->type) == PB_HTYPE_REQUIRED) iter->required_field_index++; iter->pos++; iter->field_index++; if (iter->pos->tag == 0) { iter->pos = iter->start; iter->field_index = 0; iter->required_field_index = 0; iter->pData = iter->dest_struct; prev_size = 0; notwrapped = false; } iter->pData = (char*)iter->pData + prev_size + iter->pos->data_offset; iter->pSize = (char*)iter->pData + iter->pos->size_offset; return notwrapped; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379420, "input": "adjust_shell_level (change) int change; { char new_level[5], *old_SHLVL; intmax_t old_level; SHELL_VAR *temp_var; old_SHLVL = get_string_value (\"SHLVL\"); if (old_SHLVL == 0 || *old_SHLVL == '\\0' || legal_number (old_SHLVL, &old_level) == 0) old_level = 0; shell_level = old_level + change; if (shell_level < 0) shell_level = 0; else if (shell_level > 1000) { internal_warning (_(\"shell level (%d) too high, resetting to 1\"), shell_level); shell_level = 1; } /* We don't need the full generality of itos here. */ if (shell_level < 10) { new_level[0] = shell_level + '0'; new_level[1] = '\\0'; } else if (shell_level < 100) { new_level[0] = (shell_level / 10) + '0'; new_level[1] = (shell_level % 10) + '0'; new_level[2] = '\\0'; } else if (shell_level < 1000) { new_level[0] = (shell_level / 100) + '0'; old_level = shell_level % 100; new_level[1] = (old_level / 10) + '0'; new_level[2] = (old_level % 10) + '0'; new_level[3] = '\\0'; } temp_var = bind_variable (\"SHLVL\", new_level, 0); set_auto_export (temp_var); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206645, "input": "exif_entry_get_value (ExifEntry *e, char *val, unsigned int maxlen) { unsigned int i, j, k; ExifShort v_short, v_short2, v_short3, v_short4; ExifByte v_byte; ExifRational v_rat; ExifSRational v_srat; char b[64]; const char *c; ExifByteOrder o; double d; ExifEntry *entry; static const struct { char label[5]; char major, minor; } versions[] = { {\"0110\", 1, 1}, {\"0120\", 1, 2}, {\"0200\", 2, 0}, {\"0210\", 2, 1}, {\"0220\", 2, 2}, {\"0221\", 2, 21}, {\"0230\", 2, 3}, {\"\" , 0, 0} }; (void) bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); if (!e || !e->parent || !e->parent->parent || !maxlen || !val) return val; /* make sure the returned string is zero terminated */ /* FIXME: this is inefficient in the case of long buffers and should * instead be taken care of on each write instead. */ memset (val, 0, maxlen); /* We need the byte order */ o = exif_data_get_byte_order (e->parent->parent); /* Sanity check */ if (e->size != e->components * exif_format_get_size (e->format)) { snprintf (val, maxlen, _(\"Invalid size of entry (%i, \" \"expected %li x %i).\"), e->size, e->components, exif_format_get_size (e->format)); return val; } switch (e->tag) { case EXIF_TAG_USER_COMMENT: /* * The specification says UNDEFINED, but some * manufacturers don't care and use ASCII. If this is the * case here, only refuse to read it if there is no chance * of finding readable data. */ if ((e->format != EXIF_FORMAT_ASCII) || (e->size <= 8) || ( memcmp (e->data, \"ASCII\\0\\0\\0\" , 8) && memcmp (e->data, \"UNICODE\\0\" , 8) && memcmp (e->data, \"JIS\\0\\0\\0\\0\\0\", 8) && memcmp (e->data, \"\\0\\0\\0\\0\\0\\0\\0\\0\", 8))) CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen); /* * Note that, according to the specification (V2.1, p 40), * the user comment field does not have to be * NULL terminated. */ if ((e->size >= 8) && !memcmp (e->data, \"ASCII\\0\\0\\0\", 8)) { strncpy (val, (char *) e->data + 8, MIN (e->size - 8, maxlen-1)); break; } if ((e->size >= 8) && !memcmp (e->data, \"UNICODE\\0\", 8)) { strncpy (val, _(\"Unsupported UNICODE string\"), maxlen-1); /* FIXME: use iconv to convert into the locale encoding. * EXIF 2.2 implies (but does not say) that this encoding is * UCS-2. */ break; } if ((e->size >= 8) && !memcmp (e->data, \"JIS\\0\\0\\0\\0\\0\", 8)) { strncpy (val, _(\"Unsupported JIS string\"), maxlen-1); /* FIXME: use iconv to convert into the locale encoding */ break; } /* Check if there is really some information in the tag. */ for (i = 0; (i < e->size) && (!e->data[i] || (e->data[i] == ' ')); i++); if (i == e->size) break; /* * If we reach this point, the tag does not * comply with the standard but seems to contain data. * Print as much as possible. * Note: make sure we do not overwrite the final \\0 at maxlen-1 */ exif_entry_log (e, EXIF_LOG_CODE_DEBUG, _(\"Tag UserComment contains data but is \" \"against specification.\")); for (j = 0; (i < e->size) && (j < maxlen-1); i++, j++) { exif_entry_log (e, EXIF_LOG_CODE_DEBUG, _(\"Byte at position %i: 0x%02x\"), i, e->data[i]); val[j] = isprint (e->data[i]) ? e->data[i] : '.'; } break; case EXIF_TAG_EXIF_VERSION: CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen); CC (e, 4, val, maxlen); strncpy (val, _(\"Unknown Exif Version\"), maxlen-1); for (i = 0; *versions[i].label; i++) { if (!memcmp (e->data, versions[i].label, 4)) { snprintf (val, maxlen, _(\"Exif Version %d.%d\"), versions[i].major, versions[i].minor); break; } } break; case EXIF_TAG_FLASH_PIX_VERSION: CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen); CC (e, 4, val, maxlen); if (!memcmp (e->data, \"0100\", 4)) strncpy (val, _(\"FlashPix Version 1.0\"), maxlen-1); else if (!memcmp (e->data, \"0101\", 4)) strncpy (val, _(\"FlashPix Version 1.01\"), maxlen-1); else strncpy (val, _(\"Unknown FlashPix Version\"), maxlen-1); break; case EXIF_TAG_COPYRIGHT: CF (e, EXIF_FORMAT_ASCII, val, maxlen); /* * First part: Photographer. * Some cameras store a string like \" \" here. Ignore it. * Remember that a corrupted tag might not be NUL-terminated */ if (e->size && e->data && match_repeated_char(e->data, ' ', e->size)) strncpy (val, (char *) e->data, MIN (maxlen-1, e->size)); else strncpy (val, _(\"[None]\"), maxlen-1); strncat (val, \" \", maxlen-1 - strlen (val)); strncat (val, _(\"(Photographer)\"), maxlen-1 - strlen (val)); /* Second part: Editor. */ strncat (val, \" - \", maxlen-1 - strlen (val)); k = 0; if (e->size && e->data) { const unsigned char *tagdata = memchr(e->data, 0, e->size); if (tagdata++) { unsigned int editor_ofs = tagdata - e->data; unsigned int remaining = e->size - editor_ofs; if (match_repeated_char(tagdata, ' ', remaining)) { strncat (val, (const char*)tagdata, MIN (maxlen-1 - strlen (val), remaining)); ++k; } } } if (!k) strncat (val, _(\"[None]\"), maxlen-1 - strlen (val)); strncat (val, \" \", maxlen-1 - strlen (val)); strncat (val, _(\"(Editor)\"), maxlen-1 - strlen (val)); break; case EXIF_TAG_FNUMBER: CF (e, EXIF_FORMAT_RATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_rat = exif_get_rational (e->data, o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_rat.numerator / (double) v_rat.denominator; snprintf (val, maxlen, \"f/%.01f\", d); break; case EXIF_TAG_APERTURE_VALUE: case EXIF_TAG_MAX_APERTURE_VALUE: CF (e, EXIF_FORMAT_RATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_rat = exif_get_rational (e->data, o); if (!v_rat.denominator || (0x80000000 == v_rat.numerator)) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_rat.numerator / (double) v_rat.denominator; snprintf (val, maxlen, _(\"%.02f EV\"), d); snprintf (b, sizeof (b), _(\" (f/%.01f)\"), pow (2, d / 2.)); strncat (val, b, maxlen-1 - strlen (val)); break; case EXIF_TAG_FOCAL_LENGTH: CF (e, EXIF_FORMAT_RATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_rat = exif_get_rational (e->data, o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } /* * For calculation of the 35mm equivalent, * Minolta cameras need a multiplier that depends on the * camera model. */ d = 0.; entry = exif_content_get_entry ( e->parent->parent->ifd[EXIF_IFD_0], EXIF_TAG_MAKE); if (entry && entry->data && entry->size >= 7 && !strncmp ((char *)entry->data, \"Minolta\", 7)) { entry = exif_content_get_entry ( e->parent->parent->ifd[EXIF_IFD_0], EXIF_TAG_MODEL); if (entry && entry->data && entry->size >= 8) { if (!strncmp ((char *)entry->data, \"DiMAGE 7\", 8)) d = 3.9; else if (!strncmp ((char *)entry->data, \"DiMAGE 5\", 8)) d = 4.9; } } if (d) snprintf (b, sizeof (b), _(\" (35 equivalent: %.0f mm)\"), (d * (double) v_rat.numerator / (double) v_rat.denominator)); else b[0] = 0; d = (double) v_rat.numerator / (double) v_rat.denominator; snprintf (val, maxlen, \"%.1f mm\", d); strncat (val, b, maxlen-1 - strlen (val)); break; case EXIF_TAG_SUBJECT_DISTANCE: CF (e, EXIF_FORMAT_RATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_rat = exif_get_rational (e->data, o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_rat.numerator / (double) v_rat.denominator; snprintf (val, maxlen, \"%.1f m\", d); break; case EXIF_TAG_EXPOSURE_TIME: CF (e, EXIF_FORMAT_RATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_rat = exif_get_rational (e->data, o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_rat.numerator / (double) v_rat.denominator; if (d < 1 && d) snprintf (val, maxlen, _(\"1/%.0f\"), 1. / d); else snprintf (val, maxlen, \"%.0f\", d); strncat (val, _(\" sec.\"), maxlen-1 - strlen (val)); break; case EXIF_TAG_SHUTTER_SPEED_VALUE: CF (e, EXIF_FORMAT_SRATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_srat = exif_get_srational (e->data, o); if (!v_srat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_srat.numerator / (double) v_srat.denominator; snprintf (val, maxlen, _(\"%.02f EV\"), d); if (pow (2, d)) d = 1. / pow (2, d); if (d < 1 && d) snprintf (b, sizeof (b), _(\" (1/%.0f sec.)\"), 1. / d); else snprintf (b, sizeof (b), _(\" (%.0f sec.)\"), d); strncat (val, b, maxlen-1 - strlen (val)); break; case EXIF_TAG_BRIGHTNESS_VALUE: CF (e, EXIF_FORMAT_SRATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_srat = exif_get_srational (e->data, o); if (!v_srat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_srat.numerator / (double) v_srat.denominator; snprintf (val, maxlen, _(\"%.02f EV\"), d); snprintf (b, sizeof (b), _(\" (%.02f cd/m^2)\"), 1. / (M_PI * 0.3048 * 0.3048) * pow (2, d)); strncat (val, b, maxlen-1 - strlen (val)); break; case EXIF_TAG_FILE_SOURCE: CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen); CC (e, 1, val, maxlen); v_byte = e->data[0]; if (v_byte == 3) strncpy (val, _(\"DSC\"), maxlen-1); else snprintf (val, maxlen, _(\"Internal error (unknown \" \"value %i)\"), v_byte); break; case EXIF_TAG_COMPONENTS_CONFIGURATION: CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen); CC (e, 4, val, maxlen); for (i = 0; i < 4; i++) { switch (e->data[i]) { case 0: c = _(\"-\"); break; case 1: c = _(\"Y\"); break; case 2: c = _(\"Cb\"); break; case 3: c = _(\"Cr\"); break; case 4: c = _(\"R\"); break; case 5: c = _(\"G\"); break; case 6: c = _(\"B\"); break; default: c = _(\"Reserved\"); break; } strncat (val, c, maxlen-1 - strlen (val)); if (i < 3) strncat (val, \" \", maxlen-1 - strlen (val)); } break; case EXIF_TAG_EXPOSURE_BIAS_VALUE: CF (e, EXIF_FORMAT_SRATIONAL, val, maxlen); CC (e, 1, val, maxlen); v_srat = exif_get_srational (e->data, o); if (!v_srat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_srat.numerator / (double) v_srat.denominator; snprintf (val, maxlen, _(\"%.02f EV\"), d); break; case EXIF_TAG_SCENE_TYPE: CF (e, EXIF_FORMAT_UNDEFINED, val, maxlen); CC (e, 1, val, maxlen); v_byte = e->data[0]; if (v_byte == 1) strncpy (val, _(\"Directly photographed\"), maxlen-1); else snprintf (val, maxlen, _(\"Internal error (unknown \" \"value %i)\"), v_byte); break; case EXIF_TAG_YCBCR_SUB_SAMPLING: CF (e, EXIF_FORMAT_SHORT, val, maxlen); CC (e, 2, val, maxlen); v_short = exif_get_short (e->data, o); v_short2 = exif_get_short ( e->data + exif_format_get_size (e->format), o); if ((v_short == 2) && (v_short2 == 1)) strncpy (val, _(\"YCbCr4:2:2\"), maxlen-1); else if ((v_short == 2) && (v_short2 == 2)) strncpy (val, _(\"YCbCr4:2:0\"), maxlen-1); else snprintf (val, maxlen, \"%u, %u\", v_short, v_short2); break; case EXIF_TAG_SUBJECT_AREA: CF (e, EXIF_FORMAT_SHORT, val, maxlen); switch (e->components) { case 2: v_short = exif_get_short (e->data, o); v_short2 = exif_get_short (e->data + 2, o); snprintf (val, maxlen, \"(x,y) = (%i,%i)\", v_short, v_short2); break; case 3: v_short = exif_get_short (e->data, o); v_short2 = exif_get_short (e->data + 2, o); v_short3 = exif_get_short (e->data + 4, o); snprintf (val, maxlen, _(\"Within distance %i of \" \"(x,y) = (%i,%i)\"), v_short3, v_short, v_short2); break; case 4: v_short = exif_get_short (e->data, o); v_short2 = exif_get_short (e->data + 2, o); v_short3 = exif_get_short (e->data + 4, o); v_short4 = exif_get_short (e->data + 6, o); snprintf (val, maxlen, _(\"Within rectangle \" \"(width %i, height %i) around \" \"(x,y) = (%i,%i)\"), v_short3, v_short4, v_short, v_short2); break; default: snprintf (val, maxlen, _(\"Unexpected number \" \"of components (%li, expected 2, 3, or 4).\"), e->components); } break; case EXIF_TAG_GPS_VERSION_ID: /* This is only valid in the GPS IFD */ CF (e, EXIF_FORMAT_BYTE, val, maxlen); CC (e, 4, val, maxlen); v_byte = e->data[0]; snprintf (val, maxlen, \"%u\", v_byte); for (i = 1; i < e->components; i++) { v_byte = e->data[i]; snprintf (b, sizeof (b), \".%u\", v_byte); strncat (val, b, maxlen-1 - strlen (val)); } break; case EXIF_TAG_INTEROPERABILITY_VERSION: /* a.k.a. case EXIF_TAG_GPS_LATITUDE: */ /* This tag occurs in EXIF_IFD_INTEROPERABILITY */ if (e->format == EXIF_FORMAT_UNDEFINED) { strncpy (val, (char *) e->data, MIN (maxlen-1, e->size)); break; } /* EXIF_TAG_GPS_LATITUDE is the same numerically as * EXIF_TAG_INTEROPERABILITY_VERSION but in EXIF_IFD_GPS */ exif_entry_format_value(e, val, maxlen); break; case EXIF_TAG_GPS_ALTITUDE_REF: /* This is only valid in the GPS IFD */ CF (e, EXIF_FORMAT_BYTE, val, maxlen); CC (e, 1, val, maxlen); v_byte = e->data[0]; if (v_byte == 0) strncpy (val, _(\"Sea level\"), maxlen-1); else if (v_byte == 1) strncpy (val, _(\"Sea level reference\"), maxlen-1); else snprintf (val, maxlen, _(\"Internal error (unknown \" \"value %i)\"), v_byte); break; case EXIF_TAG_GPS_TIME_STAMP: /* This is only valid in the GPS IFD */ CF (e, EXIF_FORMAT_RATIONAL, val, maxlen); CC (e, 3, val, maxlen); v_rat = exif_get_rational (e->data, o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } i = v_rat.numerator / v_rat.denominator; v_rat = exif_get_rational (e->data + exif_format_get_size (e->format), o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } j = v_rat.numerator / v_rat.denominator; v_rat = exif_get_rational (e->data + 2*exif_format_get_size (e->format), o); if (!v_rat.denominator) { exif_entry_format_value(e, val, maxlen); break; } d = (double) v_rat.numerator / (double) v_rat.denominator; snprintf (val, maxlen, \"%02u:%02u:%05.2f\", i, j, d); break; case EXIF_TAG_METERING_MODE: case EXIF_TAG_COMPRESSION: case EXIF_TAG_LIGHT_SOURCE: case EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT: case EXIF_TAG_RESOLUTION_UNIT: case EXIF_TAG_EXPOSURE_PROGRAM: case EXIF_TAG_FLASH: case EXIF_TAG_SUBJECT_DISTANCE_RANGE: case EXIF_TAG_COLOR_SPACE: CF (e,EXIF_FORMAT_SHORT, val, maxlen); CC (e, 1, val, maxlen); v_short = exif_get_short (e->data, o); /* Search the tag */ for (i = 0; list2[i].tag && (list2[i].tag != e->tag); i++); if (!list2[i].tag) { snprintf (val, maxlen, _(\"Internal error (unknown \" \"value %i)\"), v_short); break; } /* Find the value */ for (j = 0; list2[i].elem[j].values[0] && (list2[i].elem[j].index < v_short); j++); if (list2[i].elem[j].index != v_short) { snprintf (val, maxlen, _(\"Internal error (unknown \" \"value %i)\"), v_short); break; } /* Find a short enough value */ memset (val, 0, maxlen); for (k = 0; list2[i].elem[j].values[k]; k++) { size_t l = strlen (_(list2[i].elem[j].values[k])); if ((maxlen > l) && (strlen (val) < l)) strncpy (val, _(list2[i].elem[j].values[k]), maxlen-1); } if (!val[0]) snprintf (val, maxlen, \"%i\", v_short); break; case EXIF_TAG_PLANAR_CONFIGURATION: case EXIF_TAG_SENSING_METHOD: case EXIF_TAG_ORIENTATION: case EXIF_TAG_YCBCR_POSITIONING: case EXIF_TAG_PHOTOMETRIC_INTERPRETATION: case EXIF_TAG_CUSTOM_RENDERED: case EXIF_TAG_EXPOSURE_MODE: case EXIF_TAG_WHITE_BALANCE: case EXIF_TAG_SCENE_CAPTURE_TYPE: case EXIF_TAG_GAIN_CONTROL: case EXIF_TAG_SATURATION: case EXIF_TAG_CONTRAST: case EXIF_TAG_SHARPNESS: CF (e, EXIF_FORMAT_SHORT, val, maxlen); CC (e, 1, val, maxlen); v_short = exif_get_short (e->data, o); /* Search the tag */ for (i = 0; list[i].tag && (list[i].tag != e->tag); i++); if (!list[i].tag) { snprintf (val, maxlen, _(\"Internal error (unknown \" \"value %i)\"), v_short); break; } /* Find the value */ for (j = 0; list[i].strings[j] && (j < v_short); j++); if (!list[i].strings[j]) snprintf (val, maxlen, \"%i\", v_short); else if (!*list[i].strings[j]) snprintf (val, maxlen, _(\"Unknown value %i\"), v_short); else strncpy (val, _(list[i].strings[j]), maxlen-1); break; case EXIF_TAG_XP_TITLE: case EXIF_TAG_XP_COMMENT: case EXIF_TAG_XP_AUTHOR: case EXIF_TAG_XP_KEYWORDS: case EXIF_TAG_XP_SUBJECT: { unsigned char *utf16; /* Sanity check the size to prevent overflow */ if (e->size+sizeof(uint16_t)+1 < e->size) break; /* The tag may not be U+0000-terminated , so make a local U+0000-terminated copy before converting it */ utf16 = exif_mem_alloc (e->priv->mem, e->size+sizeof(uint16_t)+1); if (!utf16) break; memcpy(utf16, e->data, e->size); /* NUL terminate the string. If the size is odd (which isn't possible * for a valid UTF16 string), then this will overwrite the high byte of * the final half word, plus add a full zero NUL word at the end. */ utf16[e->size] = 0; utf16[e->size+1] = 0; utf16[e->size+2] = 0; /* Warning! The texts are converted from UTF16 to UTF8 */ /* FIXME: use iconv to convert into the locale encoding */ exif_convert_utf16_to_utf8(val, utf16, maxlen); exif_mem_free(e->priv->mem, utf16); break; } default: /* Use a generic value formatting */ exif_entry_format_value(e, val, maxlen); } return val; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "In exif_entry_get_value of exif-entry.c, there is a possible out of bounds write due to an integer overflow. This could lead to remote code execution if a third party app used this library to process remote image data with no additional execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android-8.1 Android-9 Android-10 Android-11 Android-8.0Android ID: A-159625731", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-0452"}} -{"idx": 318164, "input": "int headerIsSourceHeuristic(Header h) { indexEntry entry = findEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE); return entry && entry->info.count == 1 && entry->data && !*(const char *)entry->data; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 296017, "input": "pixFewColorsOctcubeQuant1(PIX *pixs, l_int32 level) { l_int32 w, h, wpls, wpld, i, j, depth, size, ncolors, index; l_int32 rval, gval, bval; l_int32 *carray, *rarray, *garray, *barray; l_uint32 octindex; l_uint32 *rtab, *gtab, *btab; l_uint32 *lines, *lined, *datas, *datad, *pspixel; PIX *pixd; PIXCMAP *cmap; PROCNAME(\"pixFewColorsOctcubeQuant1\"); if (!pixs) return (PIX *)ERROR_PTR(\"pixs not defined\", procName, NULL); if (pixGetDepth(pixs) != 32) return (PIX *)ERROR_PTR(\"pixs not 32 bpp\", procName, NULL); if (level < 1 || level > 6) return (PIX *)ERROR_PTR(\"invalid level\", procName, NULL); pixd = NULL; if (octcubeGetCount(level, &size)) /* array size = 2 ** (3 * level) */ return (PIX *)ERROR_PTR(\"size not returned\", procName, NULL); rtab = gtab = btab = NULL; makeRGBToIndexTables(level, &rtab, >ab, &btab); carray = (l_int32 *)LEPT_CALLOC(size, sizeof(l_int32)); rarray = (l_int32 *)LEPT_CALLOC(size, sizeof(l_int32)); garray = (l_int32 *)LEPT_CALLOC(size, sizeof(l_int32)); barray = (l_int32 *)LEPT_CALLOC(size, sizeof(l_int32)); if (!carray || !rarray || !garray || !barray) { L_ERROR(\"calloc fail for an array\\n\", procName); goto array_cleanup; } /* Place the pixels in octcube leaves. */ pixGetDimensions(pixs, &w, &h, NULL); datas = pixGetData(pixs); wpls = pixGetWpl(pixs); for (i = 0; i < h; i++) { lines = datas + i * wpls; for (j = 0; j < w; j++) { pspixel = lines + j; extractRGBValues(*pspixel, &rval, &gval, &bval); octindex = rtab[rval] | gtab[gval] | btab[bval]; carray[octindex]++; rarray[octindex] += rval; garray[octindex] += gval; barray[octindex] += bval; } } /* Find the number of different colors */ for (i = 0, ncolors = 0; i < size; i++) { if (carray[i] > 0) ncolors++; } if (ncolors > 256) { L_WARNING(\"%d colors found; more than 256\\n\", procName, ncolors); goto array_cleanup; } if (ncolors <= 4) depth = 2; else if (ncolors <= 16) depth = 4; else depth = 8; /* Average the colors in each octcube leaf and add to colormap table; * then use carray to hold the colormap index + 1 */ cmap = pixcmapCreate(depth); for (i = 0, index = 0; i < size; i++) { if (carray[i] > 0) { rarray[i] /= carray[i]; garray[i] /= carray[i]; barray[i] /= carray[i]; pixcmapAddColor(cmap, rarray[i], garray[i], barray[i]); carray[i] = index + 1; /* to avoid storing 0 */ index++; } } pixd = pixCreate(w, h, depth); pixSetColormap(pixd, cmap); pixCopyResolution(pixd, pixs); pixCopyInputFormat(pixd, pixs); datad = pixGetData(pixd); wpld = pixGetWpl(pixd); for (i = 0; i < h; i++) { lines = datas + i * wpls; lined = datad + i * wpld; for (j = 0; j < w; j++) { pspixel = lines + j; extractRGBValues(*pspixel, &rval, &gval, &bval); octindex = rtab[rval] | gtab[gval] | btab[bval]; switch (depth) { case 2: SET_DATA_DIBIT(lined, j, carray[octindex] - 1); break; case 4: SET_DATA_QBIT(lined, j, carray[octindex] - 1); break; case 8: SET_DATA_BYTE(lined, j, carray[octindex] - 1); break; default: L_WARNING(\"shouldn't get here\\n\", procName); } } } array_cleanup: LEPT_FREE(carray); LEPT_FREE(rarray); LEPT_FREE(garray); LEPT_FREE(barray); LEPT_FREE(rtab); LEPT_FREE(gtab); LEPT_FREE(btab); return pixd; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431895, "input": "static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn, bdaddr_t *bdaddr, u8 *name, u8 name_len) { struct discovery_state *discov = &hdev->discovery; struct inquiry_entry *e; /* Update the mgmt connected state if necessary. Be careful with * conn objects that exist but are not (yet) connected however. * Only those in BT_CONFIG or BT_CONNECTED states can be * considered connected. */ if (conn && (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) && !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) mgmt_device_connected(hdev, conn, 0, name, name_len); if (discov->state == DISCOVERY_STOPPED) return; if (discov->state == DISCOVERY_STOPPING) goto discov_complete; if (discov->state != DISCOVERY_RESOLVING) return; e = hci_inquiry_cache_lookup_resolve(hdev, bdaddr, NAME_PENDING); /* If the device was not found in a list of found devices names of which * are pending. there is no need to continue resolving a next name as it * will be done upon receiving another Remote Name Request Complete * Event */ if (!e) return; list_del(&e->list); if (name) { e->name_state = NAME_KNOWN; mgmt_remote_name(hdev, bdaddr, ACL_LINK, 0x00, e->data.rssi, name, name_len); } else { e->name_state = NAME_NOT_KNOWN; } if (hci_resolve_next_name(hdev)) return; discov_complete: hci_discovery_set_state(hdev, DISCOVERY_STOPPED); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232617, "input": "static void print_verifier_state(struct bpf_verifier_env *env, const struct bpf_func_state *state) { const struct bpf_reg_state *reg; enum bpf_reg_type t; int i; if (state->frameno) verbose(env, \" frame%d:\", state->frameno); for (i = 0; i < MAX_BPF_REG; i++) { reg = &state->regs[i]; t = reg->type; if (t == NOT_INIT) continue; verbose(env, \" R%d\", i); print_liveness(env, reg->live); verbose(env, \"=%s\", reg_type_str[t]); if (t == SCALAR_VALUE && reg->precise) verbose(env, \"P\"); if ((t == SCALAR_VALUE || t == PTR_TO_STACK) && tnum_is_const(reg->var_off)) { /* reg->off should be 0 for SCALAR_VALUE */ verbose(env, \"%lld\", reg->var_off.value + reg->off); } else { if (t == PTR_TO_BTF_ID) verbose(env, \"%s\", kernel_type_name(reg->btf_id)); verbose(env, \"(id=%d\", reg->id); if (reg_type_may_be_refcounted_or_null(t)) verbose(env, \",ref_obj_id=%d\", reg->ref_obj_id); if (t != SCALAR_VALUE) verbose(env, \",off=%d\", reg->off); if (type_is_pkt_pointer(t)) verbose(env, \",r=%d\", reg->range); else if (t == CONST_PTR_TO_MAP || t == PTR_TO_MAP_VALUE || t == PTR_TO_MAP_VALUE_OR_NULL) verbose(env, \",ks=%d,vs=%d\", reg->map_ptr->key_size, reg->map_ptr->value_size); if (tnum_is_const(reg->var_off)) { /* Typically an immediate SCALAR_VALUE, but * could be a pointer whose offset is too big * for reg->off */ verbose(env, \",imm=%llx\", reg->var_off.value); } else { if (reg->smin_value != reg->umin_value && reg->smin_value != S64_MIN) verbose(env, \",smin_value=%lld\", (long long)reg->smin_value); if (reg->smax_value != reg->umax_value && reg->smax_value != S64_MAX) verbose(env, \",smax_value=%lld\", (long long)reg->smax_value); if (reg->umin_value != 0) verbose(env, \",umin_value=%llu\", (unsigned long long)reg->umin_value); if (reg->umax_value != U64_MAX) verbose(env, \",umax_value=%llu\", (unsigned long long)reg->umax_value); if (!tnum_is_unknown(reg->var_off)) { char tn_buf[48]; tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); verbose(env, \",var_off=%s\", tn_buf); } } verbose(env, \")\"); } } for (i = 0; i < state->allocated_stack / BPF_REG_SIZE; i++) { char types_buf[BPF_REG_SIZE + 1]; bool valid = false; int j; for (j = 0; j < BPF_REG_SIZE; j++) { if (state->stack[i].slot_type[j] != STACK_INVALID) valid = true; types_buf[j] = slot_type_char[ state->stack[i].slot_type[j]]; } types_buf[BPF_REG_SIZE] = 0; if (!valid) continue; verbose(env, \" fp%d\", (-i - 1) * BPF_REG_SIZE); print_liveness(env, state->stack[i].spilled_ptr.live); if (state->stack[i].slot_type[0] == STACK_SPILL) { reg = &state->stack[i].spilled_ptr; t = reg->type; verbose(env, \"=%s\", reg_type_str[t]); if (t == SCALAR_VALUE && reg->precise) verbose(env, \"P\"); if (t == SCALAR_VALUE && tnum_is_const(reg->var_off)) verbose(env, \"%lld\", reg->var_off.value + reg->off); } else { verbose(env, \"=%s\", types_buf); } } if (state->acquired_refs && state->refs[0].id) { verbose(env, \" refs=%d\", state->refs[0].id); for (i = 1; i < state->acquired_refs; i++) if (state->refs[i].id) verbose(env, \",%d\", state->refs[i].id); } verbose(env, \"\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219937, "input": "bool CPlayListASX::LoadAsxIniInfo(std::istream &stream) { CLog::Log(LOGINFO, \"Parsing INI style ASX\"); std::string name, value; while( stream.good() ) { // consume blank rows, and blanks while((stream.peek() == '\\r' || stream.peek() == '\\n' || stream.peek() == ' ') && stream.good()) stream.get(); if(stream.peek() == '[') { // this is an [section] part, just ignore it while(stream.good() && stream.peek() != '\\r' && stream.peek() != '\\n') stream.get(); continue; } name = \"\"; value = \"\"; // consume name while(stream.peek() != '\\r' && stream.peek() != '\\n' && stream.peek() != '=' && stream.good()) name += stream.get(); // consume = if(stream.get() != '=') continue; // consume value while(stream.peek() != '\\r' && stream.peek() != '\\n' && stream.good()) value += stream.get(); CLog::Log(LOGINFO, \"Adding element {}={}\", name, value); CFileItemPtr newItem(new CFileItem(value)); newItem->SetPath(value); if (newItem->IsVideo() && !newItem->HasVideoInfoTag()) // File is a video and needs a VideoInfoTag newItem->GetVideoInfoTag()->Reset(); // Force VideoInfoTag creation Add(newItem); } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409922, "input": "static void tcp_mtup_probe_failed(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); icsk->icsk_mtup.search_high = icsk->icsk_mtup.probe_size - 1; icsk->icsk_mtup.probe_size = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232530, "input": "static void bpf_map_ptr_store(struct bpf_insn_aux_data *aux, const struct bpf_map *map, bool unpriv) { BUILD_BUG_ON((unsigned long)BPF_MAP_PTR_POISON & BPF_MAP_PTR_UNPRIV); unpriv |= bpf_map_ptr_unpriv(aux); aux->map_ptr_state = (unsigned long)map | (unpriv ? BPF_MAP_PTR_UNPRIV : 0UL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198286, "input": "static GF_Err gf_isom_parse_movie_boxes_internal(GF_ISOFile *mov, u32 *boxType, u64 *bytesMissing, Bool progressive_mode) { GF_Box *a; u64 totSize, mdat_end=0; GF_Err e = GF_OK; #ifndef GPAC_DISABLE_ISOM_FRAGMENTS if (mov->single_moof_mode && mov->single_moof_state == 2) { return e; } /*restart from where we stopped last*/ totSize = mov->current_top_box_start; if (mov->bytes_removed) { assert(totSize >= mov->bytes_removed); totSize -= mov->bytes_removed; } gf_bs_seek(mov->movieFileMap->bs, totSize); #endif /*while we have some data, parse our boxes*/ while (gf_bs_available(mov->movieFileMap->bs)) { *bytesMissing = 0; #ifndef GPAC_DISABLE_ISOM_FRAGMENTS mov->current_top_box_start = gf_bs_get_position(mov->movieFileMap->bs) + mov->bytes_removed; GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[iso file] Parsing a top-level box at position %d\\n\", mov->current_top_box_start)); #endif e = gf_isom_parse_root_box(&a, mov->movieFileMap->bs, boxType, bytesMissing, progressive_mode); if (e >= 0) { } else if (e == GF_ISOM_INCOMPLETE_FILE) { /*our mdat is uncomplete, only valid for READ ONLY files...*/ if (mov->openMode != GF_ISOM_OPEN_READ) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Incomplete MDAT while file is not read-only\\n\")); return GF_ISOM_INVALID_FILE; } if ((mov->openMode == GF_ISOM_OPEN_READ) && !progressive_mode) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Incomplete file while reading for dump - aborting parsing\\n\")); break; } return e; } else { return e; } switch (a->type) { /*MOOV box*/ case GF_ISOM_BOX_TYPE_MOOV: if (mov->moov) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Duplicate MOOV detected!\\n\")); gf_isom_box_del(a); return GF_ISOM_INVALID_FILE; } mov->moov = (GF_MovieBox *)a; mov->original_moov_offset = mov->current_top_box_start; /*set our pointer to the movie*/ mov->moov->mov = mov; #ifndef GPAC_DISABLE_ISOM_FRAGMENTS if (mov->moov->mvex) mov->moov->mvex->mov = mov; #ifdef GF_ENABLE_CTRN if (! (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG)) { gf_isom_setup_traf_inheritance(mov); } #endif #endif e = gf_list_add(mov->TopBoxes, a); if (e) return e; totSize += a->size; if (!mov->moov->mvhd) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Missing MovieHeaderBox\\n\")); return GF_ISOM_INVALID_FILE; } if (mov->meta) { gf_isom_meta_restore_items_ref(mov, mov->meta); } //dump senc info in dump mode if (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) { u32 k; for (k=0; kmoov->trackList); k++) { GF_TrackBox *trak = (GF_TrackBox *)gf_list_get(mov->moov->trackList, k); if (trak->sample_encryption) { e = senc_Parse(mov->movieFileMap->bs, trak, NULL, trak->sample_encryption); if (e) return e; } } } else { u32 k; for (k=0; kmoov->trackList); k++) { GF_TrackBox *trak = (GF_TrackBox *)gf_list_get(mov->moov->trackList, k); if (trak->Media->information->sampleTable->sampleGroups) { convert_compact_sample_groups(trak->Media->information->sampleTable->child_boxes, trak->Media->information->sampleTable->sampleGroups); } } } if (mdat_end && mov->signal_frag_bounds && !(mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) ) { gf_isom_push_mdat_end(mov, mdat_end); mdat_end=0; } break; /*META box*/ case GF_ISOM_BOX_TYPE_META: if (mov->meta) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Duplicate META detected!\\n\")); gf_isom_box_del(a); return GF_ISOM_INVALID_FILE; } mov->meta = (GF_MetaBox *)a; mov->original_meta_offset = mov->current_top_box_start; e = gf_list_add(mov->TopBoxes, a); if (e) { return e; } totSize += a->size; if (mov->moov) { gf_isom_meta_restore_items_ref(mov, mov->meta); } break; /*we only keep the MDAT in READ for dump purposes*/ case GF_ISOM_BOX_TYPE_MDAT: if (!mov->first_data_toplevel_offset) { mov->first_data_toplevel_offset = mov->current_top_box_start; mov->first_data_toplevel_size = a->size; } totSize += a->size; if (mov->openMode == GF_ISOM_OPEN_READ) { if (!mov->mdat) { mov->mdat = (GF_MediaDataBox *) a; e = gf_list_add(mov->TopBoxes, mov->mdat); if (e) { return e; } } #ifndef GPAC_DISABLE_ISOM_FRAGMENTS else if (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) gf_list_add(mov->TopBoxes, a); #endif else gf_isom_box_del(a); //in other modes we don't care if (mov->signal_frag_bounds && !(mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) ) { mdat_end = gf_bs_get_position(mov->movieFileMap->bs); if (mov->moov) { gf_isom_push_mdat_end(mov, mdat_end); mdat_end=0; } } } /*if we don't have any MDAT yet, create one (edit-write mode) We only work with one mdat, but we're puting it at the place of the first mdat found when opening a file for editing*/ else if (!mov->mdat && (mov->openMode != GF_ISOM_OPEN_READ) && (mov->openMode != GF_ISOM_OPEN_KEEP_FRAGMENTS)) { gf_isom_box_del(a); mov->mdat = (GF_MediaDataBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_MDAT); if (!mov->mdat) return GF_OUT_OF_MEM; e = gf_list_add(mov->TopBoxes, mov->mdat); if (e) { return e; } } else { gf_isom_box_del(a); } break; case GF_ISOM_BOX_TYPE_FTYP: /*ONE AND ONLY ONE FTYP*/ if (mov->brand) { gf_isom_box_del(a); GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Duplicate 'ftyp' detected!\\n\")); return GF_ISOM_INVALID_FILE; } mov->brand = (GF_FileTypeBox *)a; totSize += a->size; e = gf_list_add(mov->TopBoxes, a); if (e) return e; break; case GF_ISOM_BOX_TYPE_OTYP: /*ONE AND ONLY ONE FTYP*/ if (mov->otyp) { gf_isom_box_del(a); GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Duplicate 'otyp' detected!\\n\")); return GF_ISOM_INVALID_FILE; } if (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) { mov->otyp = (GF_Box *)a; totSize += a->size; e = gf_list_add(mov->TopBoxes, a); if (e) return e; } else { GF_FileTypeBox *brand = (GF_FileTypeBox *) gf_isom_box_find_child(a->child_boxes, GF_ISOM_BOX_TYPE_FTYP); if (brand) { s32 pos; gf_list_del_item(a->child_boxes, brand); pos = gf_list_del_item(mov->TopBoxes, mov->brand); gf_isom_box_del((GF_Box *) mov->brand); mov->brand = brand; if (pos<0) pos=0; gf_list_insert(mov->TopBoxes, brand, pos); } } break; case GF_ISOM_BOX_TYPE_PDIN: /*ONE AND ONLY ONE PDIN*/ if (mov->pdin) { gf_isom_box_del(a); GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Duplicate 'pdin'' detected!\\n\")); return GF_ISOM_INVALID_FILE; } mov->pdin = (GF_ProgressiveDownloadBox *) a; totSize += a->size; e = gf_list_add(mov->TopBoxes, a); if (e) return e; break; #ifndef GPAC_DISABLE_ISOM_FRAGMENTS case GF_ISOM_BOX_TYPE_STYP: { u32 brand = ((GF_FileTypeBox *)a)->majorBrand; switch (brand) { case GF_ISOM_BRAND_SISX: case GF_ISOM_BRAND_RISX: case GF_ISOM_BRAND_SSSS: mov->is_index_segment = GF_TRUE; break; default: break; } } /*fall-through*/ case GF_ISOM_BOX_TYPE_SIDX: case GF_ISOM_BOX_TYPE_SSIX: if (mov->moov && !mov->first_data_toplevel_offset) { mov->first_data_toplevel_offset = mov->current_top_box_start; mov->first_data_toplevel_size = a->size; } totSize += a->size; if (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) { e = gf_list_add(mov->TopBoxes, a); if (e) return e; } else if (mov->signal_frag_bounds && !(mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) && (mov->openMode!=GF_ISOM_OPEN_KEEP_FRAGMENTS) ) { if (a->type==GF_ISOM_BOX_TYPE_SIDX) { if (mov->root_sidx) gf_isom_box_del( (GF_Box *) mov->root_sidx); mov->root_sidx = (GF_SegmentIndexBox *) a; mov->sidx_start_offset = mov->current_top_box_start; mov->sidx_end_offset = gf_bs_get_position(mov->movieFileMap->bs); } else if (a->type==GF_ISOM_BOX_TYPE_STYP) { mov->styp_start_offset = mov->current_top_box_start; if (mov->seg_styp) gf_isom_box_del(mov->seg_styp); mov->seg_styp = a; } else if (a->type==GF_ISOM_BOX_TYPE_SSIX) { if (mov->seg_ssix) gf_isom_box_del(mov->seg_ssix); mov->seg_ssix = a; } else { gf_isom_box_del(a); } gf_isom_push_mdat_end(mov, mov->current_top_box_start); } else if (!mov->NextMoofNumber && (a->type==GF_ISOM_BOX_TYPE_SIDX)) { if (mov->main_sidx) gf_isom_box_del( (GF_Box *) mov->main_sidx); mov->main_sidx = (GF_SegmentIndexBox *) a; mov->main_sidx_end_pos = mov->current_top_box_start + a->size; } else { gf_isom_box_del(a); } break; case GF_ISOM_BOX_TYPE_MOOF: //no support for inplace rewrite for fragmented files gf_isom_disable_inplace_rewrite(mov); if (!mov->moov) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[iso file] Movie fragment but no moov (yet) - possibly broken parsing!\\n\")); } if (mov->single_moof_mode) { mov->single_moof_state++; if (mov->single_moof_state > 1) { gf_isom_box_del(a); return GF_OK; } } ((GF_MovieFragmentBox *)a)->mov = mov; totSize += a->size; mov->moof = (GF_MovieFragmentBox *) a; /*some smooth streaming streams contain a SDTP under the TRAF: this is incorrect, convert it*/ FixTrackID(mov); if (! (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG)) { FixSDTPInTRAF(mov->moof); } else { u32 k; for (k=0; kmoof->TrackList); k++) { GF_TrackFragmentBox *traf = (GF_TrackFragmentBox *)gf_list_get(mov->moof->TrackList, k); if (traf->sampleGroups) { convert_compact_sample_groups(traf->child_boxes, traf->sampleGroups); } } } /*read & debug: store at root level*/ if (mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG) { u32 k; gf_list_add(mov->TopBoxes, a); /*also update pointers to trex for debug*/ if (mov->moov) { for (k=0; kmoof->TrackList); k++) { GF_TrackFragmentBox *traf = gf_list_get(mov->moof->TrackList, k); if (traf->tfhd && mov->moov->mvex && mov->moov->mvex->TrackExList) { GF_TrackBox *trak = gf_isom_get_track_from_id(mov->moov, traf->tfhd->trackID); u32 j=0; while ((traf->trex = (GF_TrackExtendsBox*)gf_list_enum(mov->moov->mvex->TrackExList, &j))) { if (traf->trex->trackID == traf->tfhd->trackID) { if (!traf->trex->track) traf->trex->track = trak; break; } traf->trex = NULL; } } //we should only parse senc/psec when no saiz/saio is present, otherwise we fetch the info directly if (traf->trex && traf->tfhd && traf->trex->track && traf->sample_encryption) { GF_TrackBox *trak = GetTrackbyID(mov->moov, traf->tfhd->trackID); trak->current_traf_stsd_idx = traf->tfhd->sample_desc_index ? traf->tfhd->sample_desc_index : traf->trex->def_sample_desc_index; e = senc_Parse(mov->movieFileMap->bs, trak, traf, traf->sample_encryption); if (e) return e; trak->current_traf_stsd_idx = 0; } } } else { for (k=0; kmoof->TrackList); k++) { GF_TrackFragmentBox *traf = gf_list_get(mov->moof->TrackList, k); if (traf->sample_encryption) { e = senc_Parse(mov->movieFileMap->bs, NULL, traf, traf->sample_encryption); if (e) return e; } } } } else if (mov->openMode==GF_ISOM_OPEN_KEEP_FRAGMENTS) { mov->NextMoofNumber = mov->moof->mfhd->sequence_number+1; mov->moof = NULL; gf_isom_box_del(a); } else { /*merge all info*/ e = MergeFragment((GF_MovieFragmentBox *)a, mov); gf_isom_box_del(a); if (e) return e; } //done with moov if (mov->root_sidx) { gf_isom_box_del((GF_Box *) mov->root_sidx); mov->root_sidx = NULL; } if (mov->root_ssix) { gf_isom_box_del(mov->seg_ssix); mov->root_ssix = NULL; } if (mov->seg_styp) { gf_isom_box_del(mov->seg_styp); mov->seg_styp = NULL; } mov->sidx_start_offset = 0; mov->sidx_end_offset = 0; mov->styp_start_offset = 0; break; #endif case GF_ISOM_BOX_TYPE_UNKNOWN: { GF_UnknownBox *box = (GF_UnknownBox*)a; if (box->original_4cc == GF_ISOM_BOX_TYPE_JP) { u8 *c = (u8 *) box->data; if ((box->dataSize==4) && (GF_4CC(c[0],c[1],c[2],c[3])==(u32)0x0D0A870A)) mov->is_jp2 = 1; gf_isom_box_del(a); } else { e = gf_list_add(mov->TopBoxes, a); if (e) return e; } } break; case GF_ISOM_BOX_TYPE_PRFT: #ifndef GPAC_DISABLE_ISOM_FRAGMENTS if (!(mov->FragmentsFlags & GF_ISOM_FRAG_READ_DEBUG)) { //keep the last one read if (mov->last_producer_ref_time) gf_isom_box_del(a); else mov->last_producer_ref_time = (GF_ProducerReferenceTimeBox *)a; break; } #endif //fallthrough default: totSize += a->size; e = gf_list_add(mov->TopBoxes, a); if (e) return e; break; } #ifndef GPAC_DISABLE_ISOM_FRAGMENTS /*remember where we left, in case we append an entire number of movie fragments*/ mov->current_top_box_start = gf_bs_get_position(mov->movieFileMap->bs) + mov->bytes_removed; #endif } /*we need at least moov or meta*/ if (!mov->moov && !mov->meta #ifndef GPAC_DISABLE_ISOM_FRAGMENTS && !mov->moof && !mov->is_index_segment #endif ) { return GF_ISOM_INCOMPLETE_FILE; } /*we MUST have movie header*/ if (!gf_opts_get_bool(\"core\", \"no-check\")) { if (mov->moov && !mov->moov->mvhd) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Missing MVHD in MOOV!\\n\")); return GF_ISOM_INVALID_FILE; } /*we MUST have meta handler*/ if (mov->meta && !mov->meta->handler) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Missing handler in META!\\n\")); return GF_ISOM_INVALID_FILE; } } #ifndef GPAC_DISABLE_ISOM_WRITE if (mov->moov) { /*set the default interleaving time*/ mov->interleavingTime = mov->moov->mvhd->timeScale; #ifndef GPAC_DISABLE_ISOM_FRAGMENTS /*in edit mode with successfully loaded fragments, delete all fragment signaling since file is no longer fragmented*/ if ((mov->openMode > GF_ISOM_OPEN_READ) && (mov->openMode != GF_ISOM_OPEN_KEEP_FRAGMENTS) && mov->moov->mvex) { gf_isom_box_del_parent(&mov->moov->child_boxes, (GF_Box *)mov->moov->mvex); mov->moov->mvex = NULL; } #endif } //create a default mdat if none was found if (!mov->mdat && (mov->openMode != GF_ISOM_OPEN_READ) && (mov->openMode != GF_ISOM_OPEN_KEEP_FRAGMENTS)) { mov->mdat = (GF_MediaDataBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_MDAT); if (!mov->mdat) return GF_OUT_OF_MEM; e = gf_list_add(mov->TopBoxes, mov->mdat); if (e) return e; } #endif /*GPAC_DISABLE_ISOM_WRITE*/ return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Missing Release of Memory after Effective Lifetime"], "explanation": "Memory leak in the def_parent_box_new function in MP4Box in GPAC 1.0.1 allows attackers to read memory via a crafted file.", "severity_level": "NoInfo", "cwe": "CWE-401", "cve": "CVE-2021-33364"}} -{"idx": 334486, "input": "set_loader_error (MonoLoaderError *error) { TlsSetValue (loader_error_thread_id, error); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430791, "input": "void UnicodeStringTest::TestUnescape(void) { UnicodeString IN(\"abc\\\\u4567 \\\\n\\\\r \\\\U00101234xyz\\\\x1\\\\x{5289}\\\\x1b\", -1, US_INV); UnicodeString OUT(\"abc\"); OUT.append((UChar)0x4567); OUT.append(\" \"); OUT.append((UChar)0xA); OUT.append((UChar)0xD); OUT.append(\" \"); OUT.append((UChar32)0x00101234); OUT.append(\"xyz\"); OUT.append((UChar32)1).append((UChar32)0x5289).append((UChar)0x1b); UnicodeString result = IN.unescape(); if (result != OUT) { errln(\"FAIL: \" + prettify(IN) + \".unescape() -> \" + prettify(result) + \", expected \" + prettify(OUT)); } // test that an empty string is returned in case of an error if (!UNICODE_STRING(\"wrong \\\\u sequence\", 17).unescape().isEmpty()) { errln(\"FAIL: unescaping of a string with an illegal escape sequence did not return an empty string\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273234, "input": "Channel* GetChanTarget() const { return chantarget; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508424, "input": "static void add_not_null_conds(JOIN *join) { JOIN_TAB *tab; DBUG_ENTER(\"add_not_null_conds\"); for (tab= first_linear_tab(join, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES); tab; tab= next_linear_tab(join, tab, WITH_BUSH_ROOTS)) { if (tab->type == JT_REF || tab->type == JT_EQ_REF || tab->type == JT_REF_OR_NULL) { for (uint keypart= 0; keypart < tab->ref.key_parts; keypart++) { if (tab->ref.null_rejecting & ((key_part_map)1 << keypart)) { Item *item= tab->ref.items[keypart]; Item *notnull; Item *real= item->real_item(); if (real->const_item() && real->type() != Item::FIELD_ITEM && !real->is_expensive()) { /* It could be constant instead of field after constant propagation. */ continue; } DBUG_ASSERT(real->type() == Item::FIELD_ITEM); Item_field *not_null_item= (Item_field*)real; JOIN_TAB *referred_tab= not_null_item->field->table->reginfo.join_tab; /* For UPDATE queries such as: UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1); not_null_item is the t1.f1, but it's referred_tab is 0. */ if (!(notnull= new (join->thd->mem_root) Item_func_isnotnull(join->thd, item))) DBUG_VOID_RETURN; /* We need to do full fix_fields() call here in order to have correct notnull->const_item(). This is needed e.g. by test_quick_select when it is called from make_join_select after this function is called. */ if (notnull->fix_fields(join->thd, ¬null)) DBUG_VOID_RETURN; DBUG_EXECUTE(\"where\",print_where(notnull, (referred_tab ? referred_tab->table->alias.c_ptr() : \"outer_ref_cond\"), QT_ORDINARY);); if (!tab->first_inner) { COND *new_cond= (referred_tab && referred_tab->join == join) ? referred_tab->select_cond : join->outer_ref_cond; add_cond_and_fix(join->thd, &new_cond, notnull); if (referred_tab && referred_tab->join == join) referred_tab->set_select_cond(new_cond, __LINE__); else join->outer_ref_cond= new_cond; } else add_cond_and_fix(join->thd, tab->first_inner->on_expr_ref, notnull); } } } } DBUG_VOID_RETURN; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431498, "input": "int nfs4_proc_fsid_present(struct inode *inode, const struct cred *cred) { struct nfs_server *server = NFS_SERVER(inode); struct nfs_client *clp = server->nfs_client; const struct nfs4_mig_recovery_ops *ops = clp->cl_mvops->mig_recovery_ops; struct nfs4_exception exception = { .interruptible = true, }; int status; dprintk(\"%s: FSID %llx:%llx on \\\"%s\\\"\\n\", __func__, (unsigned long long)server->fsid.major, (unsigned long long)server->fsid.minor, clp->cl_hostname); nfs_display_fhandle(NFS_FH(inode), __func__); do { status = ops->fsid_present(inode, cred); if (status != -NFS4ERR_DELAY) break; nfs4_handle_exception(server, status, &exception); } while (exception.retry); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380011, "input": "} EXPORT_SYMBOL_GPL(iscsi_recv_pdu); int iscsi_offload_mesg(struct Scsi_Host *shost, struct iscsi_transport *transport, uint32_t type, char *data, uint16_t data_size) { struct nlmsghdr *nlh; struct sk_buff *skb; struct iscsi_uevent *ev; int len = nlmsg_total_size(sizeof(*ev) + data_size); skb = alloc_skb(len, GFP_ATOMIC); if (!skb) { printk(KERN_ERR \"can not deliver iscsi offload message:OOM\\n\"); return -ENOMEM; } nlh = __nlmsg_put(skb, 0, 0, 0, (len - sizeof(*nlh)), 0); ev = nlmsg_data(nlh); memset(ev, 0, sizeof(*ev)); ev->type = type; ev->transport_handle = iscsi_handle(transport); switch (type) { case ISCSI_KEVENT_PATH_REQ: ev->r.req_path.host_no = shost->host_no; break; case ISCSI_KEVENT_IF_DOWN: ev->r.notify_if_down.host_no = shost->host_no; break; } memcpy((char *)ev + sizeof(*ev), data, data_size);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197519, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& a = ctx->input(0); const Tensor& b = ctx->input(1); OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(a.shape()), errors::InvalidArgument(\"a is not a matrix\")); OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(b.shape()), errors::InvalidArgument(\"b is not a matrix\")); const int m = transpose_a_ ? a.dim_size(1) : a.dim_size(0); const int k = transpose_a_ ? a.dim_size(0) : a.dim_size(1); const int n = transpose_b_ ? b.dim_size(0) : b.dim_size(1); const int k2 = transpose_b_ ? b.dim_size(1) : b.dim_size(0); OP_REQUIRES(ctx, k == k2, errors::InvalidArgument( \"Matrix size incompatible: a: \", a.shape().DebugString(), \", b: \", b.shape().DebugString())); Tensor* output = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({m, n}), &output)); if (k == 0) { // If the inner dimension k in the matrix multiplication is zero, we fill // the output with zeros. functor::SetZeroFunctor f; f(ctx->eigen_device(), output->flat()); return; } auto out = output->matrix(); std::unique_ptr a_float; std::unique_ptr b_float; if (!a_is_sparse_ && !b_is_sparse_) { auto left = &a; auto right = &b; // TODO(agarwal): multi-thread the conversions from bfloat16 to float. if (std::is_same::value) { a_float.reset(new Tensor(DT_FLOAT, a.shape())); BFloat16ToFloat(a.flat().data(), a_float->flat().data(), a.NumElements()); left = a_float.get(); } if (std::is_same::value) { b_float.reset(new Tensor(DT_FLOAT, b.shape())); BFloat16ToFloat(b.flat().data(), b_float->flat().data(), b.NumElements()); right = b_float.get(); } Eigen::array, 1> dim_pair; dim_pair[0].first = transpose_a_ ? 0 : 1; dim_pair[0].second = transpose_b_ ? 1 : 0; out.device(ctx->template eigen_device()) = left->matrix().contract(right->matrix(), dim_pair); return; } auto left = &a; auto right = &b; bool transpose_output = false; bool transpose_a = transpose_a_; bool transpose_b = transpose_b_; if (!a_is_sparse_) { // Swap the order of multiplications using the identity: // A * B = (B' * A')'. std::swap(left, right); std::swap(transpose_a, transpose_b); transpose_a = !transpose_a; transpose_b = !transpose_b; transpose_output = !transpose_output; } std::unique_ptr right_tr; if (transpose_b) { // TODO(agarwal): avoid transposing the matrix here and directly handle // transpose in CreateDenseSlices. right_tr.reset( new Tensor(right->dtype(), TensorShape({right->dim_size(1), right->dim_size(0)}))); const auto perm = dsizes_10(); if (transpose_output) { right_tr->matrix().device(ctx->template eigen_device()) = right->matrix().shuffle(perm); } else { right_tr->matrix().device(ctx->template eigen_device()) = right->matrix().shuffle(perm); } right = right_tr.get(); } if (transpose_output) { DoMatMul::Compute(&this->cache_tr_, left->matrix(), right->matrix(), transpose_a, ctx->device()->tensorflow_cpu_worker_threads(), transpose_output, &out); } else { DoMatMul::Compute(&this->cache_nt_, left->matrix(), right->matrix(), transpose_a, ctx->device()->tensorflow_cpu_worker_threads(), transpose_output, &out); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a denial of service via a FPE runtime error in `tf.raw_ops.SparseMatMul`. The division by 0 occurs deep in Eigen code because the `b` tensor is empty. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-29557"}} -{"idx": 321581, "input": "static unsigned long mremap_to(unsigned long addr, unsigned long old_len, unsigned long new_addr, unsigned long new_len, bool *locked, unsigned long flags, struct vm_userfaultfd_ctx *uf, struct list_head *uf_unmap_early, struct list_head *uf_unmap) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; unsigned long ret = -EINVAL; unsigned long charged = 0; unsigned long map_flags = 0; if (offset_in_page(new_addr)) goto out; if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len) goto out; /* Ensure the old/new locations do not overlap */ if (addr + old_len > new_addr && new_addr + new_len > addr) goto out; /* * move_vma() need us to stay 4 maps below the threshold, otherwise * it will bail out at the very beginning. * That is a problem if we have already unmaped the regions here * (new_addr, and old_addr), because userspace will not know the * state of the vma's after it gets -ENOMEM. * So, to avoid such scenario we can pre-compute if the whole * operation has high chances to success map-wise. * Worst-scenario case is when both vma's (new_addr and old_addr) get * split in 3 before unmaping it. * That means 2 more maps (1 for each) to the ones we already hold. * Check whether current map count plus 2 still leads us to 4 maps below * the threshold, otherwise return -ENOMEM here to be more safe. */ if ((mm->map_count + 2) >= sysctl_max_map_count - 3) return -ENOMEM; if (flags & MREMAP_FIXED) { ret = do_munmap(mm, new_addr, new_len, uf_unmap_early); if (ret) goto out; } if (old_len >= new_len) { ret = do_munmap(mm, addr+new_len, old_len - new_len, uf_unmap); if (ret && old_len != new_len) goto out; old_len = new_len; } vma = vma_to_resize(addr, old_len, new_len, flags, &charged); if (IS_ERR(vma)) { ret = PTR_ERR(vma); goto out; } /* MREMAP_DONTUNMAP expands by old_len since old_len == new_len */ if (flags & MREMAP_DONTUNMAP && !may_expand_vm(mm, vma->vm_flags, old_len >> PAGE_SHIFT)) { ret = -ENOMEM; goto out; } if (flags & MREMAP_FIXED) map_flags |= MAP_FIXED; if (vma->vm_flags & VM_MAYSHARE) map_flags |= MAP_SHARED; ret = get_unmapped_area(vma->vm_file, new_addr, new_len, vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT), map_flags); if (IS_ERR_VALUE(ret)) goto out1; /* We got a new mapping */ if (!(flags & MREMAP_FIXED)) new_addr = ret; ret = move_vma(vma, addr, old_len, new_len, new_addr, locked, flags, uf, uf_unmap); if (!(offset_in_page(ret))) goto out; out1: vm_unacct_memory(charged); out: return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303067, "input": "static int snappy_wrap_compress(const char* input, size_t input_length, char* output, size_t maxout) { snappy_status status; size_t cl = maxout; status = snappy_compress(input, input_length, output, &cl); if (status != SNAPPY_OK) { return 0; } return (int)cl; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431501, "input": "static void encode_getfattr_open(struct xdr_stream *xdr, const u32 *bitmask, const u32 *open_bitmap, struct compound_hdr *hdr) { encode_getattr(xdr, open_bitmap, bitmask, 3, hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453288, "input": "static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd, struct bio *bio, bool is_sync, struct bfq_io_cq *bic) { const int ioprio = IOPRIO_PRIO_DATA(bic->ioprio); const int ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio); struct bfq_queue **async_bfqq = NULL; struct bfq_queue *bfqq; struct bfq_group *bfqg; rcu_read_lock(); bfqg = bfq_find_set_group(bfqd, __bio_blkcg(bio)); if (!bfqg) { bfqq = &bfqd->oom_bfqq; goto out; } if (!is_sync) { async_bfqq = bfq_async_queue_prio(bfqd, bfqg, ioprio_class, ioprio); bfqq = *async_bfqq; if (bfqq) goto out; } bfqq = kmem_cache_alloc_node(bfq_pool, GFP_NOWAIT | __GFP_ZERO | __GFP_NOWARN, bfqd->queue->node); if (bfqq) { bfq_init_bfqq(bfqd, bfqq, bic, current->pid, is_sync); bfq_init_entity(&bfqq->entity, bfqg); bfq_log_bfqq(bfqd, bfqq, \"allocated\"); } else { bfqq = &bfqd->oom_bfqq; bfq_log_bfqq(bfqd, bfqq, \"using oom bfqq\"); goto out; } /* * Pin the queue now that it's allocated, scheduler exit will * prune it. */ if (async_bfqq) { bfqq->ref++; /* * Extra group reference, w.r.t. sync * queue. This extra reference is removed * only if bfqq->bfqg disappears, to * guarantee that this queue is not freed * until its group goes away. */ bfq_log_bfqq(bfqd, bfqq, \"get_queue, bfqq not in async: %p, %d\", bfqq, bfqq->ref); *async_bfqq = bfqq; } out: bfqq->ref++; /* get a process reference to this queue */ bfq_log_bfqq(bfqd, bfqq, \"get_queue, at end: %p, %d\", bfqq, bfqq->ref); rcu_read_unlock(); return bfqq;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468985, "input": "static int udp_reuseport_add_sock(struct sock *sk, struct udp_hslot *hslot) { struct net *net = sock_net(sk); kuid_t uid = sock_i_uid(sk); struct sock *sk2; sk_for_each(sk2, &hslot->head) { if (net_eq(sock_net(sk2), net) && sk2 != sk && sk2->sk_family == sk->sk_family && ipv6_only_sock(sk2) == ipv6_only_sock(sk) && (udp_sk(sk2)->udp_port_hash == udp_sk(sk)->udp_port_hash) && (sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) && inet_rcv_saddr_equal(sk, sk2, false)) { return reuseport_add_sock(sk, sk2); } } /* Initial allocation may have already happened via setsockopt */ if (!rcu_access_pointer(sk->sk_reuseport_cb)) return reuseport_alloc(sk); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509422, "input": "virtual bool expr_cache_is_needed(THD *) { return FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439536, "input": "bfad_im_get_stats(struct Scsi_Host *shost) { struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0]; struct bfad_s *bfad = im_port->bfad; struct bfad_hal_comp fcomp; union bfa_port_stats_u *fcstats; struct fc_host_statistics *hstats; bfa_status_t rc; unsigned long flags; fcstats = kzalloc(sizeof(union bfa_port_stats_u), GFP_KERNEL); if (fcstats == NULL) return NULL; hstats = &bfad->link_stats; init_completion(&fcomp.comp); spin_lock_irqsave(&bfad->bfad_lock, flags); memset(hstats, 0, sizeof(struct fc_host_statistics)); rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa), fcstats, bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); if (rc != BFA_STATUS_OK) { kfree(fcstats); return NULL; } wait_for_completion(&fcomp.comp); /* Fill the fc_host_statistics structure */ hstats->seconds_since_last_reset = fcstats->fc.secs_reset; hstats->tx_frames = fcstats->fc.tx_frames; hstats->tx_words = fcstats->fc.tx_words; hstats->rx_frames = fcstats->fc.rx_frames; hstats->rx_words = fcstats->fc.rx_words; hstats->lip_count = fcstats->fc.lip_count; hstats->nos_count = fcstats->fc.nos_count; hstats->error_frames = fcstats->fc.error_frames; hstats->dumped_frames = fcstats->fc.dropped_frames; hstats->link_failure_count = fcstats->fc.link_failures; hstats->loss_of_sync_count = fcstats->fc.loss_of_syncs; hstats->loss_of_signal_count = fcstats->fc.loss_of_signals; hstats->prim_seq_protocol_err_count = fcstats->fc.primseq_errs; hstats->invalid_crc_count = fcstats->fc.invalid_crcs; kfree(fcstats); return hstats; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 456937, "input": "static void io_submit_state_start(struct io_submit_state *state, struct io_ring_ctx *ctx, unsigned int max_ios) { blk_start_plug(&state->plug); #ifdef CONFIG_BLOCK state->plug.nowait = true; #endif state->comp.nr = 0; INIT_LIST_HEAD(&state->comp.list); state->comp.ctx = ctx; state->free_reqs = 0; state->file = NULL; state->ios_left = max_ios; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338587, "input": "static int io_poll_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_poll_update *upd = &req->poll_update; u32 flags; if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; if (sqe->ioprio || sqe->buf_index) return -EINVAL; flags = READ_ONCE(sqe->len); if (flags & ~(IORING_POLL_UPDATE_EVENTS | IORING_POLL_UPDATE_USER_DATA | IORING_POLL_ADD_MULTI)) return -EINVAL; /* meaningless without update */ if (flags == IORING_POLL_ADD_MULTI) return -EINVAL; upd->old_user_data = READ_ONCE(sqe->addr); upd->update_events = flags & IORING_POLL_UPDATE_EVENTS; upd->update_user_data = flags & IORING_POLL_UPDATE_USER_DATA; upd->new_user_data = READ_ONCE(sqe->off); if (!upd->update_user_data && upd->new_user_data) return -EINVAL; if (upd->update_events) upd->events = io_poll_parse_events(sqe, flags); else if (sqe->poll32_events) return -EINVAL; return 0;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445718, "input": "static void put_trace_buf(void) { /* Don't let the decrement of nesting leak before this */ barrier(); this_cpu_dec(trace_percpu_buffer->nesting); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280538, "input": "check_ENQUEUE(const struct ofpact_enqueue *a, const struct ofpact_check_params *cp) { if (ofp_to_u16(a->port) >= ofp_to_u16(cp->max_ports) && a->port != OFPP_IN_PORT && a->port != OFPP_LOCAL) { return OFPERR_OFPBAC_BAD_OUT_PORT; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281362, "input": "int RGWCreateBucket_ObjStore_S3::get_params() { RGWAccessControlPolicy_S3 s3policy(s->cct); int r = create_s3_policy(s, store, s3policy, s->owner); if (r < 0) return r; policy = s3policy; int len = 0; char *data = nullptr; const auto max_size = s->cct->_conf->rgw_max_put_param_size; op_ret = rgw_rest_read_all_input(s, &data, &len, max_size, false); if ((op_ret < 0) && (op_ret != -ERR_LENGTH_REQUIRED)) return op_ret; auto data_deleter = std::unique_ptr{data, free}; const int auth_ret = do_aws4_auth_completion(); if (auth_ret < 0) { return auth_ret; } bufferptr in_ptr(data, len); in_data.append(in_ptr); if (len) { RGWCreateBucketParser parser; if (!parser.init()) { ldout(s->cct, 0) << \"ERROR: failed to initialize parser\" << dendl; return -EIO; } bool success = parser.parse(data, len, 1); ldout(s->cct, 20) << \"create bucket input data=\" << data << dendl; if (!success) { ldout(s->cct, 0) << \"failed to parse input: \" << data << dendl; return -EINVAL; } if (!parser.get_location_constraint(location_constraint)) { ldout(s->cct, 0) << \"provided input did not specify location constraint correctly\" << dendl; return -EINVAL; } ldout(s->cct, 10) << \"create bucket location constraint: \" << location_constraint << dendl; } size_t pos = location_constraint.find(':'); if (pos != string::npos) { placement_rule = location_constraint.substr(pos + 1); location_constraint = location_constraint.substr(0, pos); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 254701, "input": "static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_iter_t *field) { bool status = true; bool submsg_consumed = false; pb_istream_t substream; if (!pb_make_string_substream(stream, &substream)) return false; if (field->submsg_desc == NULL) PB_RETURN_ERROR(stream, \"invalid field descriptor\"); /* Submessages can have a separate message-level callback that is called * before decoding the message. Typically it is used to set callback fields * inside oneofs. */ if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL) { /* Message callback is stored right before pSize. */ pb_callback_t *callback = (pb_callback_t*)field->pSize - 1; if (callback->funcs.decode) { status = callback->funcs.decode(&substream, field, &callback->arg); if (substream.bytes_left == 0) { submsg_consumed = true; } } } /* Now decode the submessage contents */ if (status && !submsg_consumed) { unsigned int flags = 0; /* Static required/optional fields are already initialized by top-level * pb_decode(), no need to initialize them again. */ if (PB_ATYPE(field->type) == PB_ATYPE_STATIC && PB_HTYPE(field->type) != PB_HTYPE_REPEATED) { flags = PB_DECODE_NOINIT; } status = pb_decode_inner(&substream, field->submsg_desc, field->pData, flags); } if (!pb_close_string_substream(stream, &substream)) return false; return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422653, "input": "TEST(GtOp, ElemMatchKey) { BSONObj operand = BSON(\"$gt\" << 5); GTMatchExpression gt(\"a\", operand[\"$gt\"]); MatchDetails details; details.requestElemMatchKey(); ASSERT(!gt.matchesBSON(BSON(\"a\" << 4), &details)); ASSERT(!details.hasElemMatchKey()); ASSERT(gt.matchesBSON(BSON(\"a\" << 6), &details)); ASSERT(!details.hasElemMatchKey()); ASSERT(gt.matchesBSON(BSON(\"a\" << BSON_ARRAY(2 << 6 << 5)), &details)); ASSERT(details.hasElemMatchKey()); ASSERT_EQUALS(\"1\", details.elemMatchKey()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280196, "input": "static inline int kmem_cache_debug(struct kmem_cache *s) { #ifdef CONFIG_SLUB_DEBUG return unlikely(s->flags & SLAB_DEBUG_FLAGS); #else return 0; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509031, "input": "virtual bool eval_not_null_tables(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 262855, "input": "int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint32_t virt_gsi, enum intx_ctlr vgsi_ctlr) { int32_t status = 0; struct ptirq_remapping_info *entry = NULL; DEFINE_INTX_SID(virt_sid, virt_gsi, vgsi_ctlr); DEFINE_INTX_SID(alt_virt_sid, virt_gsi, vgsi_ctlr); /* * virt pin could come from primary vPIC, secondary vPIC or vIOAPIC * while phys pin is always means for physical IOAPIC. * * Device Model should pre-hold the mapping entries by calling * ptirq_add_intx_remapping for UOS. * * For SOS(sos_vm), it adds the mapping entries at runtime, if the * entry already be held by others, return error. */ /* no remap for vuart intx */ if (!is_vuart_intx(vm, virt_sid.intx_id.gsi)) { /* query if we have virt to phys mapping */ spinlock_obtain(&ptdev_lock); entry = find_ptirq_entry(PTDEV_INTR_INTX, &virt_sid, vm); if (entry == NULL) { if (is_sos_vm(vm)) { /* for sos_vm, there is chance of vpin source switch * between vPIC & vIOAPIC for one legacy phys_pin. * * here checks if there is already mapping entry from * the other vpin source for legacy pin. If yes, then * switch vpin source is needed */ if (virt_gsi < NR_LEGACY_PIN) { if (vgsi_ctlr == INTX_CTLR_PIC) { alt_virt_sid.intx_id.ctlr = INTX_CTLR_IOAPIC; } else { alt_virt_sid.intx_id.ctlr = INTX_CTLR_PIC; } entry = find_ptirq_entry(PTDEV_INTR_INTX, &alt_virt_sid, vm); if (entry != NULL) { uint32_t phys_gsi = virt_gsi; remove_intx_remapping(vm, alt_virt_sid.intx_id.gsi, alt_virt_sid.intx_id.ctlr); entry = add_intx_remapping(vm, virt_gsi, phys_gsi, vgsi_ctlr); if (entry == NULL) { pr_err(\"%s, add intx remapping failed\", __func__); status = -ENODEV; } else { dev_dbg(DBG_LEVEL_IRQ, \"IOAPIC gsi=%hhu pirq=%u vgsi=%d from %s to %s for vm%d\", entry->phys_sid.intx_id.gsi, entry->allocated_pirq, entry->virt_sid.intx_id.gsi, (vgsi_ctlr == INTX_CTLR_IOAPIC) ? \"vPIC\" : \"vIOAPIC\", (vgsi_ctlr == INTX_CTLR_IOAPIC) ? \"vIOPIC\" : \"vPIC\", entry->vm->vm_id); } } } /* entry could be updated by above switch check */ if (entry == NULL) { uint32_t phys_gsi = virt_gsi; entry = add_intx_remapping(vm, virt_gsi, phys_gsi, vgsi_ctlr); if (entry == NULL) { pr_err(\"%s, add intx remapping failed\", __func__); status = -ENODEV; } } } else { /* ptirq_intx_pin_remap is triggered by vPIC/vIOAPIC * everytime a pin get unmask, here filter out pins * not get mapped. */ status = -ENODEV; } } spinlock_release(&ptdev_lock); } else { status = -EINVAL; } if (status == 0) { activate_physical_ioapic(vm, entry); } return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 505212, "input": "static void auth_server_connection_input(struct auth_server_connection *conn) { struct istream *input; const char *line, *error; int ret; switch (i_stream_read(conn->input)) { case 0: return; case -1: /* disconnected */ error = conn->input->stream_errno != 0 ? strerror(conn->input->stream_errno) : \"EOF\"; auth_server_connection_reconnect(conn, error); return; case -2: /* buffer full - can't happen unless auth is buggy */ i_error(\"BUG: Auth server sent us more than %d bytes of data\", AUTH_SERVER_CONN_MAX_LINE_LENGTH); auth_server_connection_disconnect(conn, \"buffer full\"); return; } if (!conn->version_received) { line = i_stream_next_line(conn->input); if (line == NULL) return; /* make sure the major version matches */ if (strncmp(line, \"VERSION\\t\", 8) != 0 || !str_uint_equals(t_strcut(line + 8, '\\t'), AUTH_CLIENT_PROTOCOL_MAJOR_VERSION)) { i_error(\"Authentication server not compatible with \" \"this client (mixed old and new binaries?)\"); auth_server_connection_disconnect(conn, \"incompatible server\"); return; } conn->version_received = TRUE; } input = conn->input; i_stream_ref(input); while ((line = i_stream_next_line(input)) != NULL && !input->closed) { T_BEGIN { ret = auth_server_connection_input_line(conn, line); } T_END; if (ret < 0) { auth_server_connection_disconnect(conn, t_strdup_printf( \"Received broken input: %s\", line)); break; } } i_stream_unref(&input); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453694, "input": "static void parse_sec_attr(sc_card_t *card, sc_file_t *file, const u8 *buf, size_t len) { unsigned int op; /* list directory is not covered by ACLs - so always add an entry */ sc_file_add_acl_entry (file, SC_AC_OP_LIST_FILES, SC_AC_NONE, SC_AC_KEY_REF_NONE); /* FIXME: check for what LOCK is used */ sc_file_add_acl_entry (file, SC_AC_OP_LOCK, SC_AC_NONE, SC_AC_KEY_REF_NONE); for (; len >= 6; len -= 6, buf += 6) { /* FIXME: temporary hacks */ if (!memcmp(buf, \"\\xa4\\x00\\x00\\x00\\xff\\xff\", 6)) {/* select */ sc_file_add_acl_entry (file, SC_AC_OP_SELECT, SC_AC_NONE, SC_AC_KEY_REF_NONE); } else if (!memcmp(buf, \"\\xb0\\x00\\x00\\x00\\xff\\xff\", 6)) {/*read*/ sc_file_add_acl_entry (file, SC_AC_OP_READ, SC_AC_NONE, SC_AC_KEY_REF_NONE); } else if (!memcmp(buf, \"\\xd6\\x00\\x00\\x00\\xff\\xff\", 6)) {/*upd*/ sc_file_add_acl_entry (file, SC_AC_OP_UPDATE, SC_AC_NONE, SC_AC_KEY_REF_NONE); } else if (!memcmp(buf, \"\\x60\\x00\\x00\\x00\\xff\\xff\", 6)) {/*adm */ sc_file_add_acl_entry (file, SC_AC_OP_WRITE, SC_AC_NONE, SC_AC_KEY_REF_NONE); sc_file_add_acl_entry (file, SC_AC_OP_CREATE, SC_AC_NONE, SC_AC_KEY_REF_NONE); sc_file_add_acl_entry (file, SC_AC_OP_INVALIDATE, SC_AC_NONE, SC_AC_KEY_REF_NONE); sc_file_add_acl_entry (file, SC_AC_OP_REHABILITATE, SC_AC_NONE, SC_AC_KEY_REF_NONE); } else { /* the first byte tells use the command or the command group. We have to mask bit 0 because this one distinguish between AND/OR combination of PINs*/ op = map_operations (buf[0]); if (op == (unsigned int)-1) { sc_log(card->ctx, \"Unknown security command byte %02x\\n\", buf[0]); continue; } if (!buf[1]) sc_file_add_acl_entry (file, op, SC_AC_NONE, SC_AC_KEY_REF_NONE); else sc_file_add_acl_entry (file, op, SC_AC_CHV, buf[1]); if (!buf[2] && !buf[3]) sc_file_add_acl_entry (file, op, SC_AC_NONE, SC_AC_KEY_REF_NONE); else sc_file_add_acl_entry (file, op, SC_AC_TERM, (buf[2]<<8)|buf[3]); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268885, "input": "bool test_r_str_len_utf8_ansi(void) { int len; len = r_str_len_utf8_ansi (\"radare2\"); mu_assert_eq (len, 7, \"len(ascii only)\"); len = r_str_len_utf8_ansi (\"r\\x1b[38;2;208;80;0madare2\"); mu_assert_eq (len, 7, \"len(ascii + ansi ending with m)\"); len = r_str_len_utf8_ansi (\"r\\x1b[0Jadare2\"); mu_assert_eq (len, 7, \"len(ascii + ansi ending with J)\"); len = r_str_len_utf8_ansi (\"r\\x1b[42;42Hadare2\"); mu_assert_eq (len, 7, \"len(ascii + ansi ending with H)\"); len = r_str_len_utf8_ansi (\"r\\xc3\\xa4\"\"dare2\"); mu_assert_eq (len, 7, \"len(ascii + 2 byte utf-8 counted as 1 char)\"); len = r_str_len_utf8_ansi (\"radar\\xe2\\x82\\xac\"\"2\"); mu_assert_eq (len, 7, \"len(ascii + 3 byte utf-8 counted as 1 char)\"); len = r_str_len_utf8_ansi (\"radar\\xf0\\x9d\\x84\\x9e\"\"2\"); mu_assert_eq (len, 7, \"len(ascii + 4 byte utf-8 counted as 1 char)\"); mu_end; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429747, "input": "MA_FIELD_EXTENSION *new_ma_field_extension(MA_MEM_ROOT *memroot) { MA_FIELD_EXTENSION *ext= ma_alloc_root(memroot, sizeof(MA_FIELD_EXTENSION)); if (ext) memset((void *) ext, 0, sizeof(*ext)); return ext; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328521, "input": "static void __mark_reg_known(struct bpf_reg_state *reg, u64 imm) { /* Clear id, off, and union(map_ptr, range) */ memset(((u8 *)reg) + sizeof(reg->type), 0, offsetof(struct bpf_reg_state, var_off) - sizeof(reg->type)); reg->var_off = tnum_const(imm); reg->smin_value = (s64)imm; reg->smax_value = (s64)imm; reg->umin_value = imm; reg->umax_value = imm; reg->s32_min_value = (s32)imm; reg->s32_max_value = (s32)imm; reg->u32_min_value = (u32)imm; reg->u32_max_value = (u32)imm; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385323, "input": "static int xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, xmlNodePtr * first, xmlNodePtr * last, int toBool) { #define XP_TEST_HIT \\ if (hasAxisRange != 0) { \\ if (++pos == maxPos) { \\ if (addNode(seq, cur) < 0) \\ ctxt->error = XPATH_MEMORY_ERROR; \\ goto axis_range_end; } \\ } else { \\ if (addNode(seq, cur) < 0) \\ ctxt->error = XPATH_MEMORY_ERROR; \\ if (breakOnFirstHit) goto first_hit; } #define XP_TEST_HIT_NS \\ if (hasAxisRange != 0) { \\ if (++pos == maxPos) { \\ hasNsNodes = 1; \\ if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \\ ctxt->error = XPATH_MEMORY_ERROR; \\ goto axis_range_end; } \\ } else { \\ hasNsNodes = 1; \\ if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \\ ctxt->error = XPATH_MEMORY_ERROR; \\ if (breakOnFirstHit) goto first_hit; } xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value; xmlXPathTestVal test = (xmlXPathTestVal) op->value2; xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3; const xmlChar *prefix = op->value4; const xmlChar *name = op->value5; const xmlChar *URI = NULL; #ifdef DEBUG_STEP int nbMatches = 0, prevMatches = 0; #endif int total = 0, hasNsNodes = 0; /* The popped object holding the context nodes */ xmlXPathObjectPtr obj; /* The set of context nodes for the node tests */ xmlNodeSetPtr contextSeq; int contextIdx; xmlNodePtr contextNode; /* The final resulting node set wrt to all context nodes */ xmlNodeSetPtr outSeq; /* * The temporary resulting node set wrt 1 context node. * Used to feed predicate evaluation. */ xmlNodeSetPtr seq; xmlNodePtr cur; /* First predicate operator */ xmlXPathStepOpPtr predOp; int maxPos; /* The requested position() (when a \"[n]\" predicate) */ int hasPredicateRange, hasAxisRange, pos, size, newSize; int breakOnFirstHit; xmlXPathTraversalFunction next = NULL; int (*addNode) (xmlNodeSetPtr, xmlNodePtr); xmlXPathNodeSetMergeFunction mergeAndClear; xmlNodePtr oldContextNode; xmlXPathContextPtr xpctxt = ctxt->context; CHECK_TYPE0(XPATH_NODESET); obj = valuePop(ctxt); /* * Setup namespaces. */ if (prefix != NULL) { URI = xmlXPathNsLookup(xpctxt, prefix); if (URI == NULL) { xmlXPathReleaseObject(xpctxt, obj); XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR); } } /* * Setup axis. * * MAYBE FUTURE TODO: merging optimizations: * - If the nodes to be traversed wrt to the initial nodes and * the current axis cannot overlap, then we could avoid searching * for duplicates during the merge. * But the question is how/when to evaluate if they cannot overlap. * Example: if we know that for two initial nodes, the one is * not in the ancestor-or-self axis of the other, then we could safely * avoid a duplicate-aware merge, if the axis to be traversed is e.g. * the descendant-or-self axis. */ mergeAndClear = xmlXPathNodeSetMergeAndClear; switch (axis) { case AXIS_ANCESTOR: first = NULL; next = xmlXPathNextAncestor; break; case AXIS_ANCESTOR_OR_SELF: first = NULL; next = xmlXPathNextAncestorOrSelf; break; case AXIS_ATTRIBUTE: first = NULL; last = NULL; next = xmlXPathNextAttribute; mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; case AXIS_CHILD: last = NULL; if (((test == NODE_TEST_NAME) || (test == NODE_TEST_ALL)) && (type == NODE_TYPE_NODE)) { /* * Optimization if an element node type is 'element'. */ next = xmlXPathNextChildElement; } else next = xmlXPathNextChild; mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; case AXIS_DESCENDANT: last = NULL; next = xmlXPathNextDescendant; break; case AXIS_DESCENDANT_OR_SELF: last = NULL; next = xmlXPathNextDescendantOrSelf; break; case AXIS_FOLLOWING: last = NULL; next = xmlXPathNextFollowing; break; case AXIS_FOLLOWING_SIBLING: last = NULL; next = xmlXPathNextFollowingSibling; break; case AXIS_NAMESPACE: first = NULL; last = NULL; next = (xmlXPathTraversalFunction) xmlXPathNextNamespace; mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; case AXIS_PARENT: first = NULL; next = xmlXPathNextParent; break; case AXIS_PRECEDING: first = NULL; next = xmlXPathNextPrecedingInternal; break; case AXIS_PRECEDING_SIBLING: first = NULL; next = xmlXPathNextPrecedingSibling; break; case AXIS_SELF: first = NULL; last = NULL; next = xmlXPathNextSelf; mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; } #ifdef DEBUG_STEP xmlXPathDebugDumpStepAxis(op, (obj->nodesetval != NULL) ? obj->nodesetval->nodeNr : 0); #endif if (next == NULL) { xmlXPathReleaseObject(xpctxt, obj); return(0); } contextSeq = obj->nodesetval; if ((contextSeq == NULL) || (contextSeq->nodeNr <= 0)) { xmlXPathReleaseObject(xpctxt, obj); valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); return(0); } /* * Predicate optimization --------------------------------------------- * If this step has a last predicate, which contains a position(), * then we'll optimize (although not exactly \"position()\", but only * the short-hand form, i.e., \"[n]\". * * Example - expression \"/foo[parent::bar][1]\": * * COLLECT 'child' 'name' 'node' foo -- op (we are here) * ROOT -- op->ch1 * PREDICATE -- op->ch2 (predOp) * PREDICATE -- predOp->ch1 = [parent::bar] * SORT * COLLECT 'parent' 'name' 'node' bar * NODE * ELEM Object is a number : 1 -- predOp->ch2 = [1] * */ maxPos = 0; predOp = NULL; hasPredicateRange = 0; hasAxisRange = 0; if (op->ch2 != -1) { /* * There's at least one predicate. 16 == XPATH_OP_PREDICATE */ predOp = &ctxt->comp->steps[op->ch2]; if (xmlXPathIsPositionalPredicate(ctxt, predOp, &maxPos)) { if (predOp->ch1 != -1) { /* * Use the next inner predicate operator. */ predOp = &ctxt->comp->steps[predOp->ch1]; hasPredicateRange = 1; } else { /* * There's no other predicate than the [n] predicate. */ predOp = NULL; hasAxisRange = 1; } } } breakOnFirstHit = ((toBool) && (predOp == NULL)) ? 1 : 0; /* * Axis traversal ----------------------------------------------------- */ /* * 2.3 Node Tests * - For the attribute axis, the principal node type is attribute. * - For the namespace axis, the principal node type is namespace. * - For other axes, the principal node type is element. * * A node test * is true for any node of the * principal node type. For example, child::* will * select all element children of the context node */ oldContextNode = xpctxt->node; addNode = xmlXPathNodeSetAddUnique; outSeq = NULL; seq = NULL; contextNode = NULL; contextIdx = 0; while (((contextIdx < contextSeq->nodeNr) || (contextNode != NULL)) && (ctxt->error == XPATH_EXPRESSION_OK)) { xpctxt->node = contextSeq->nodeTab[contextIdx++]; if (seq == NULL) { seq = xmlXPathNodeSetCreate(NULL); if (seq == NULL) { total = 0; goto error; } } /* * Traverse the axis and test the nodes. */ pos = 0; cur = NULL; hasNsNodes = 0; do { cur = next(ctxt, cur); if (cur == NULL) break; /* * QUESTION TODO: What does the \"first\" and \"last\" stuff do? */ if ((first != NULL) && (*first != NULL)) { if (*first == cur) break; if (((total % 256) == 0) && #ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON (xmlXPathCmpNodesExt(*first, cur) >= 0)) #else (xmlXPathCmpNodes(*first, cur) >= 0)) #endif { break; } } if ((last != NULL) && (*last != NULL)) { if (*last == cur) break; if (((total % 256) == 0) && #ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON (xmlXPathCmpNodesExt(cur, *last) >= 0)) #else (xmlXPathCmpNodes(cur, *last) >= 0)) #endif { break; } } total++; #ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, \" %s\", cur->name); #endif switch (test) { case NODE_TEST_NONE: total = 0; STRANGE goto error; case NODE_TEST_TYPE: if (type == NODE_TYPE_NODE) { switch (cur->type) { case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: case XML_CDATA_SECTION_NODE: case XML_TEXT_NODE: XP_TEST_HIT break; case XML_NAMESPACE_DECL: { if (axis == AXIS_NAMESPACE) { XP_TEST_HIT_NS } else { hasNsNodes = 1; XP_TEST_HIT } break; } default: break; } } else if (cur->type == type) { if (cur->type == XML_NAMESPACE_DECL) XP_TEST_HIT_NS else XP_TEST_HIT } else if ((type == NODE_TYPE_TEXT) && (cur->type == XML_CDATA_SECTION_NODE)) { XP_TEST_HIT } break; case NODE_TEST_PI: if ((cur->type == XML_PI_NODE) && ((name == NULL) || xmlStrEqual(name, cur->name))) { XP_TEST_HIT } break; case NODE_TEST_ALL: if (axis == AXIS_ATTRIBUTE) { if (cur->type == XML_ATTRIBUTE_NODE) { if (prefix == NULL) { XP_TEST_HIT } else if ((cur->ns != NULL) && (xmlStrEqual(URI, cur->ns->href))) { XP_TEST_HIT } } } else if (axis == AXIS_NAMESPACE) { if (cur->type == XML_NAMESPACE_DECL) { XP_TEST_HIT_NS } } else { if (cur->type == XML_ELEMENT_NODE) { if (prefix == NULL) { XP_TEST_HIT } else if ((cur->ns != NULL) && (xmlStrEqual(URI, cur->ns->href))) { XP_TEST_HIT } } } break; case NODE_TEST_NS:{ TODO; break; } case NODE_TEST_NAME: if (axis == AXIS_ATTRIBUTE) { if (cur->type != XML_ATTRIBUTE_NODE) break; } else if (axis == AXIS_NAMESPACE) { if (cur->type != XML_NAMESPACE_DECL) break; } else { if (cur->type != XML_ELEMENT_NODE) break; } switch (cur->type) { case XML_ELEMENT_NODE: if (xmlStrEqual(name, cur->name)) { if (prefix == NULL) { if (cur->ns == NULL) { XP_TEST_HIT } } else { if ((cur->ns != NULL) && (xmlStrEqual(URI, cur->ns->href))) { XP_TEST_HIT } } } break; case XML_ATTRIBUTE_NODE:{ xmlAttrPtr attr = (xmlAttrPtr) cur; if (xmlStrEqual(name, attr->name)) { if (prefix == NULL) { if ((attr->ns == NULL) || (attr->ns->prefix == NULL)) { XP_TEST_HIT } } else { if ((attr->ns != NULL) && (xmlStrEqual(URI, attr->ns->href))) { XP_TEST_HIT } } } break; } case XML_NAMESPACE_DECL: if (cur->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) cur; if ((ns->prefix != NULL) && (name != NULL) && (xmlStrEqual(ns->prefix, name))) { XP_TEST_HIT_NS } } break; default: break; } break; } /* switch(test) */ } while ((cur != NULL) && (ctxt->error == XPATH_EXPRESSION_OK)); goto apply_predicates; axis_range_end: /* ----------------------------------------------------- */ /* * We have a \"/foo[n]\", and position() = n was reached. * Note that we can have as well \"/foo/::parent::foo[1]\", so * a duplicate-aware merge is still needed. * Merge with the result. */ if (outSeq == NULL) { outSeq = seq; seq = NULL; } else outSeq = mergeAndClear(outSeq, seq, 0); /* * Break if only a true/false result was requested. */ if (toBool) break; continue; first_hit: /* ---------------------------------------------------------- */ /* * Break if only a true/false result was requested and * no predicates existed and a node test succeeded. */ if (outSeq == NULL) { outSeq = seq; seq = NULL; } else outSeq = mergeAndClear(outSeq, seq, 0); break; #ifdef DEBUG_STEP if (seq != NULL) nbMatches += seq->nodeNr; #endif apply_predicates: /* --------------------------------------------------- */ if (ctxt->error != XPATH_EXPRESSION_OK) goto error; /* * Apply predicates. */ if ((predOp != NULL) && (seq->nodeNr > 0)) { /* * E.g. when we have a \"/foo[some expression][n]\". */ /* * QUESTION TODO: The old predicate evaluation took into * account location-sets. * (E.g. ctxt->value->type == XPATH_LOCATIONSET) * Do we expect such a set here? * All what I learned now from the evaluation semantics * does not indicate that a location-set will be processed * here, so this looks OK. */ /* * Iterate over all predicates, starting with the outermost * predicate. * TODO: Problem: we cannot execute the inner predicates first * since we cannot go back *up* the operator tree! * Options we have: * 1) Use of recursive functions (like is it currently done * via xmlXPathCompOpEval()) * 2) Add a predicate evaluation information stack to the * context struct * 3) Change the way the operators are linked; we need a * \"parent\" field on xmlXPathStepOp * * For the moment, I'll try to solve this with a recursive * function: xmlXPathCompOpEvalPredicate(). */ size = seq->nodeNr; if (hasPredicateRange != 0) newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt, predOp, seq, size, maxPos, maxPos, hasNsNodes); else newSize = xmlXPathCompOpEvalPredicate(ctxt, predOp, seq, size, hasNsNodes); if (ctxt->error != XPATH_EXPRESSION_OK) { total = 0; goto error; } /* * Add the filtered set of nodes to the result node set. */ if (newSize == 0) { /* * The predicates filtered all nodes out. */ xmlXPathNodeSetClear(seq, hasNsNodes); } else if (seq->nodeNr > 0) { /* * Add to result set. */ if (outSeq == NULL) { if (size != newSize) { /* * We need to merge and clear here, since * the sequence will contained NULLed entries. */ outSeq = mergeAndClear(NULL, seq, 1); } else { outSeq = seq; seq = NULL; } } else outSeq = mergeAndClear(outSeq, seq, (size != newSize) ? 1: 0); /* * Break if only a true/false result was requested. */ if (toBool) break; } } else if (seq->nodeNr > 0) { /* * Add to result set. */ if (outSeq == NULL) { outSeq = seq; seq = NULL; } else { outSeq = mergeAndClear(outSeq, seq, 0); } } } error: if ((obj->boolval) && (obj->user != NULL)) { /* * QUESTION TODO: What does this do and why? * TODO: Do we have to do this also for the \"error\" * cleanup further down? */ ctxt->value->boolval = 1; ctxt->value->user = obj->user; obj->user = NULL; obj->boolval = 0; } xmlXPathReleaseObject(xpctxt, obj); /* * Ensure we return at least an emtpy set. */ if (outSeq == NULL) { if ((seq != NULL) && (seq->nodeNr == 0)) outSeq = seq; else outSeq = xmlXPathNodeSetCreate(NULL); /* XXX what if xmlXPathNodeSetCreate returned NULL here? */ } if ((seq != NULL) && (seq != outSeq)) { xmlXPathFreeNodeSet(seq); } /* * Hand over the result. Better to push the set also in * case of errors. */ valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, outSeq)); /* * Reset the context node. */ xpctxt->node = oldContextNode; /* * When traversing the namespace axis in \"toBool\" mode, it's * possible that tmpNsList wasn't freed. */ if (xpctxt->tmpNsList != NULL) { xmlFree(xpctxt->tmpNsList); xpctxt->tmpNsList = NULL; } #ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, \"\\nExamined %d nodes, found %d nodes at that step\\n\", total, nbMatches); #endif", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514565, "input": "bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connection) { bool res= false; close_cached_connection_tables_arg argument; DBUG_ENTER(\"close_cached_connections\"); DBUG_ASSERT(thd); argument.thd= thd; argument.connection= connection; argument.tables= NULL; if (tdc_iterate(thd, (my_hash_walk_action) close_cached_connection_tables_callback, &argument)) DBUG_RETURN(true); for (TABLE_LIST *table= argument.tables; table; table= table->next_local) res|= tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db.str, table->table_name.str, TRUE); /* Return true if we found any open connections */ DBUG_RETURN(res); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330273, "input": "MagickExport MagickBooleanType PlasmaImage(Image *image, const SegmentInfo *segment,size_t attenuate,size_t depth, ExceptionInfo *exception) { CacheView *image_view, *u_view, *v_view; MagickBooleanType status; RandomInfo *random_info; assert(image != (Image *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\"); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\"); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); image_view=AcquireAuthenticCacheView(image,exception); u_view=AcquireVirtualCacheView(image,exception); v_view=AcquireVirtualCacheView(image,exception); random_info=AcquireRandomInfo(); status=PlasmaImageProxy(image,image_view,u_view,v_view,random_info,segment, attenuate,depth,exception); random_info=DestroyRandomInfo(random_info); v_view=DestroyCacheView(v_view); u_view=DestroyCacheView(u_view); image_view=DestroyCacheView(image_view); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263379, "input": "static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow, ndpi_protocol *ret) { /* Skype for a host doing MS Teams means MS Teams (MS Teams uses Skype as transport protocol for voice/video) */ if(flow) { /* Do not go for DNS when there is an application protocol. Example DNS.Apple */ if((flow->detected_protocol_stack[1] != NDPI_PROTOCOL_UNKNOWN) && (flow->detected_protocol_stack[0] /* app */ != flow->detected_protocol_stack[1] /* major */)) NDPI_CLR_BIT(flow->risk, NDPI_SUSPICIOUS_DGA_DOMAIN); } switch(ret->app_protocol) { case NDPI_PROTOCOL_MSTEAMS: if(flow->packet.iph && flow->packet.tcp) { // printf(\"====>> NDPI_PROTOCOL_MSTEAMS\\n\"); if(ndpi_str->msteams_cache == NULL) ndpi_str->msteams_cache = ndpi_lru_cache_init(1024); if(ndpi_str->msteams_cache) ndpi_lru_add_to_cache(ndpi_str->msteams_cache, flow->packet.iph->saddr, (flow->packet.current_time_ms / 1000) & 0xFFFF /* 16 bit */); } break; case NDPI_PROTOCOL_SKYPE: case NDPI_PROTOCOL_SKYPE_CALL: if(flow->packet.iph && flow->packet.udp && ndpi_str->msteams_cache) { u_int16_t when; if(ndpi_lru_find_cache(ndpi_str->msteams_cache, flow->packet.iph->saddr, &when, 0 /* Don't remove it as it can be used for other connections */)) { u_int16_t tdiff = ((flow->packet.current_time_ms /1000) & 0xFFFF) - when; if(tdiff < 60 /* sec */) { // printf(\"====>> NDPI_PROTOCOL_SKYPE(_CALL) -> NDPI_PROTOCOL_MSTEAMS [%u]\\n\", tdiff); ret->app_protocol = NDPI_PROTOCOL_MSTEAMS; /* Refresh cache */ ndpi_lru_add_to_cache(ndpi_str->msteams_cache, flow->packet.iph->saddr, (flow->packet.current_time_ms / 1000) & 0xFFFF /* 16 bit */); } } } break; } /* switch */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508565, "input": "bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) { DBUG_ENTER(\"mysql_explain_union\"); bool res= 0; SELECT_LEX *first= unit->first_select(); for (SELECT_LEX *sl= first; sl; sl= sl->next_select()) { sl->set_explain_type(FALSE); sl->options|= SELECT_DESCRIBE; } if (unit->is_unit_op() || unit->fake_select_lex) { if (unit->union_needs_tmp_table() && unit->fake_select_lex) { unit->fake_select_lex->select_number= FAKE_SELECT_LEX_ID; // just for initialization unit->fake_select_lex->type= unit_operation_text[unit->common_op()]; unit->fake_select_lex->options|= SELECT_DESCRIBE; } if (!(res= unit->prepare(unit->derived, result, SELECT_NO_UNLOCK | SELECT_DESCRIBE))) res= unit->exec(); } else { thd->lex->current_select= first; unit->set_limit(unit->global_parameters()); res= mysql_select(thd, first->table_list.first, first->with_wild, first->item_list, first->where, first->order_list.elements + first->group_list.elements, first->order_list.first, first->group_list.first, first->having, thd->lex->proc_list.first, first->options | thd->variables.option_bits | SELECT_DESCRIBE, result, unit, first); } DBUG_RETURN(res || thd->is_error()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281361, "input": "int RGWPostObj_ObjStore_S3::get_encrypt_filter( std::unique_ptr* filter, RGWPutObjDataProcessor* cb) { int res = 0; std::unique_ptr block_crypt; res = rgw_s3_prepare_encrypt(s, attrs, &parts, &block_crypt, crypt_http_responses); if (res == 0 && block_crypt != nullptr) { *filter = std::unique_ptr( new RGWPutObj_BlockEncrypt(s->cct, cb, std::move(block_crypt))); } else *filter = nullptr; return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431350, "input": "static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs4_server_caps_arg *args = data; const u32 *bitmask = args->bitmask; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fhandle, &hdr); encode_getattr(xdr, bitmask, NULL, 3, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398067, "input": "static void sctp_shutdown(struct sock *sk, int how) { struct net *net = sock_net(sk); struct sctp_endpoint *ep; if (!sctp_style(sk, TCP)) return; ep = sctp_sk(sk)->ep; if (how & SEND_SHUTDOWN && !list_empty(&ep->asocs)) { struct sctp_association *asoc; inet_sk_set_state(sk, SCTP_SS_CLOSING); asoc = list_entry(ep->asocs.next, struct sctp_association, asocs); sctp_primitive_SHUTDOWN(net, asoc, NULL); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393080, "input": "TEST_F(QueryPlannerTest, NoKeepWithMergeSort) { params.options = QueryPlannerParams::KEEP_MUTATIONS; addIndex(BSON(\"a\" << 1 << \"b\" << 1)); runQuerySortProj(fromjson(\"{a: {$in: [1, 2]}}\"), BSON(\"b\" << 1), BSONObj()); assertNumSolutions(1U); assertSolutionExists( \"{fetch: {filter: null, node: {mergeSort: {nodes: [\" \"{ixscan: {pattern: {a: 1, b: 1},\" \"bounds: {a: [[1,1,true,true]], b: [['MinKey','MaxKey',true,true]]}}},\" \"{ixscan: {pattern: {a: 1, b: 1},\" \"bounds: {a: [[2,2,true,true]], b: [['MinKey','MaxKey',true,true]]}}}]}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381454, "input": "static int v4l_g_sliced_vbi_cap(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct v4l2_sliced_vbi_cap *p = arg; int ret = check_fmt(file, p->type); if (ret) return ret; /* Clear up to type, everything after type is zeroed already */ memset(p, 0, offsetof(struct v4l2_sliced_vbi_cap, type)); return ops->vidioc_g_sliced_vbi_cap(file, fh, p); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330492, "input": "static ssize_t vnc_client_write_plain(VncState *vs) { ssize_t ret; #ifdef CONFIG_VNC_SASL VNC_DEBUG(\"Write Plain: Pending output %p size %zd offset %zd. Wait SSF %d\\n\", vs->output.buffer, vs->output.capacity, vs->output.offset, vs->sasl.waitWriteSSF); if (vs->sasl.conn && vs->sasl.runSSF && vs->sasl.waitWriteSSF) { ret = vnc_client_write_buf(vs, vs->output.buffer, vs->sasl.waitWriteSSF); if (ret) vs->sasl.waitWriteSSF -= ret; } else #endif /* CONFIG_VNC_SASL */ ret = vnc_client_write_buf(vs, vs->output.buffer, vs->output.offset); if (!ret) return 0; buffer_advance(&vs->output, ret); if (vs->output.offset == 0) { qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs); } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 235716, "input": "bool IsForward() const override { return Forward; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279959, "input": "void ItemStackMetadata::clear() { Metadata::clear(); updateToolCapabilities(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379514, "input": "setup_async_signals () { #if defined (__BEOS__) set_signal_handler (SIGHUP, SIG_IGN); /* they want csh-like behavior */ #endif #if defined (JOB_CONTROL) if (job_control == 0) #endif { set_signal_handler (SIGINT, SIG_IGN); set_signal_ignored (SIGINT); set_signal_handler (SIGQUIT, SIG_IGN); set_signal_ignored (SIGQUIT); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 222579, "input": "closure_setup(mrb_state *mrb, struct RProc *p) { mrb_callinfo *ci = mrb->c->ci; const struct RProc *up = p->upper; struct REnv *e = NULL; if (ci && (e = mrb_vm_ci_env(ci)) != NULL) { /* do nothing, because e is assigned already */ } else if (up) { struct RClass *tc = ci->u.target_class; e = mrb_env_new(mrb, mrb->c, ci, up->body.irep->nlocals, ci->stack, tc); ci->u.env = e; if (MRB_PROC_ENV_P(up) && MRB_PROC_ENV(up)->cxt == NULL) { e->mid = MRB_PROC_ENV(up)->mid; } } if (e) { p->e.env = e; p->flags |= MRB_PROC_ENVSET; mrb_field_write_barrier(mrb, (struct RBasic*)p, (struct RBasic*)e); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410349, "input": "f_getchar(typval_T *argvars, typval_T *rettv) { getchar_common(argvars, rettv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208226, "input": "handle_spawn (PortalFlatpak *object, GDBusMethodInvocation *invocation, GUnixFDList *fd_list, const gchar *arg_cwd_path, const gchar *const *arg_argv, GVariant *arg_fds, GVariant *arg_envs, guint arg_flags, GVariant *arg_options) { g_autoptr(GError) error = NULL; ChildSetupData child_setup_data = { NULL }; GPid pid; PidData *pid_data; InstanceIdReadData *instance_id_read_data = NULL; gsize i, j, n_fds, n_envs; const gint *fds = NULL; gint fds_len = 0; g_autofree FdMapEntry *fd_map = NULL; gchar **env; gint32 max_fd; GKeyFile *app_info; g_autoptr(GPtrArray) flatpak_argv = g_ptr_array_new_with_free_func (g_free); g_autofree char *app_id = NULL; g_autofree char *branch = NULL; g_autofree char *arch = NULL; g_autofree char *app_commit = NULL; g_autofree char *runtime_ref = NULL; g_auto(GStrv) runtime_parts = NULL; g_autofree char *runtime_commit = NULL; g_autofree char *instance_path = NULL; g_auto(GStrv) extra_args = NULL; g_auto(GStrv) shares = NULL; g_auto(GStrv) sockets = NULL; g_auto(GStrv) devices = NULL; g_auto(GStrv) sandbox_expose = NULL; g_auto(GStrv) sandbox_expose_ro = NULL; g_autoptr(GVariant) sandbox_expose_fd = NULL; g_autoptr(GVariant) sandbox_expose_fd_ro = NULL; g_autoptr(GOutputStream) instance_id_out_stream = NULL; guint sandbox_flags = 0; gboolean sandboxed; gboolean expose_pids; gboolean share_pids; gboolean notify_start; gboolean devel; g_autoptr(GString) env_string = g_string_new (\"\"); child_setup_data.instance_id_fd = -1; child_setup_data.env_fd = -1; if (fd_list != NULL) fds = g_unix_fd_list_peek_fds (fd_list, &fds_len); app_info = g_object_get_data (G_OBJECT (invocation), \"app-info\"); g_assert (app_info != NULL); app_id = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_NAME, NULL); g_assert (app_id != NULL); g_debug (\"spawn() called from app: '%s'\", app_id); if (*app_id == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"org.freedesktop.portal.Flatpak.Spawn only works in a flatpak\"); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (*arg_cwd_path == 0) arg_cwd_path = NULL; if (arg_argv == NULL || *arg_argv == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"No command given\"); return G_DBUS_METHOD_INVOCATION_HANDLED; } if ((arg_flags & ~FLATPAK_SPAWN_FLAGS_ALL) != 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"Unsupported flags enabled: 0x%x\", arg_flags & ~FLATPAK_SPAWN_FLAGS_ALL); return G_DBUS_METHOD_INVOCATION_HANDLED; } runtime_ref = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_RUNTIME, NULL); if (runtime_ref == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"No runtime found\"); return G_DBUS_METHOD_INVOCATION_HANDLED; } runtime_parts = g_strsplit (runtime_ref, \"/\", -1); branch = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_BRANCH, NULL); instance_path = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_INSTANCE_PATH, NULL); arch = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_ARCH, NULL); extra_args = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_EXTRA_ARGS, NULL, NULL); app_commit = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_APP_COMMIT, NULL); runtime_commit = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_RUNTIME_COMMIT, NULL); shares = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SHARED, NULL, NULL); sockets = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SOCKETS, NULL, NULL); devices = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_DEVICES, NULL, NULL); devel = g_key_file_get_boolean (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_DEVEL, NULL); g_variant_lookup (arg_options, \"sandbox-expose\", \"^as\", &sandbox_expose); g_variant_lookup (arg_options, \"sandbox-expose-ro\", \"^as\", &sandbox_expose_ro); g_variant_lookup (arg_options, \"sandbox-flags\", \"u\", &sandbox_flags); sandbox_expose_fd = g_variant_lookup_value (arg_options, \"sandbox-expose-fd\", G_VARIANT_TYPE (\"ah\")); sandbox_expose_fd_ro = g_variant_lookup_value (arg_options, \"sandbox-expose-fd-ro\", G_VARIANT_TYPE (\"ah\")); if ((sandbox_flags & ~FLATPAK_SPAWN_SANDBOX_FLAGS_ALL) != 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"Unsupported sandbox flags enabled: 0x%x\", arg_flags & ~FLATPAK_SPAWN_SANDBOX_FLAGS_ALL); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (instance_path == NULL && ((sandbox_expose != NULL && sandbox_expose[0] != NULL) || (sandbox_expose_ro != NULL && sandbox_expose_ro[0] != NULL))) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"Invalid sandbox expose, caller has no instance path\"); return G_DBUS_METHOD_INVOCATION_HANDLED; } for (i = 0; sandbox_expose != NULL && sandbox_expose[i] != NULL; i++) { const char *expose = sandbox_expose[i]; g_debug (\"exposing %s\", expose); if (!is_valid_expose (expose, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } } for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) { const char *expose = sandbox_expose_ro[i]; g_debug (\"exposing %s\", expose); if (!is_valid_expose (expose, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } } g_debug (\"Running spawn command %s\", arg_argv[0]); n_fds = 0; if (fds != NULL) n_fds = g_variant_n_children (arg_fds); fd_map = g_new0 (FdMapEntry, n_fds); child_setup_data.fd_map = fd_map; child_setup_data.fd_map_len = n_fds; max_fd = -1; for (i = 0; i < n_fds; i++) { gint32 handle, dest_fd; int handle_fd; g_variant_get_child (arg_fds, i, \"{uh}\", &dest_fd, &handle); if (handle >= fds_len || handle < 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"No file descriptor for handle %d\", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } handle_fd = fds[handle]; fd_map[i].to = dest_fd; fd_map[i].from = handle_fd; fd_map[i].final = fd_map[i].to; /* If stdin/out/err is a tty we try to set it as the controlling tty for the app, this way we can use this to run in a terminal. */ if ((dest_fd == 0 || dest_fd == 1 || dest_fd == 2) && !child_setup_data.set_tty && isatty (handle_fd)) { child_setup_data.set_tty = TRUE; child_setup_data.tty = handle_fd; } max_fd = MAX (max_fd, fd_map[i].to); max_fd = MAX (max_fd, fd_map[i].from); } /* We make a second pass over the fds to find if any \"to\" fd index overlaps an already in use fd (i.e. one in the \"from\" category that are allocated randomly). If a fd overlaps \"to\" fd then its a caller issue and not our fault, so we ignore that. */ for (i = 0; i < n_fds; i++) { int to_fd = fd_map[i].to; gboolean conflict = FALSE; /* At this point we're fine with using \"from\" values for this value (because we handle to==from in the code), or values that are before \"i\" in the fd_map (because those will be closed at this point when dup:ing). However, we can't reuse a fd that is in \"from\" for j > i. */ for (j = i + 1; j < n_fds; j++) { int from_fd = fd_map[j].from; if (from_fd == to_fd) { conflict = TRUE; break; } } if (conflict) fd_map[i].to = ++max_fd; } if (arg_flags & FLATPAK_SPAWN_FLAGS_CLEAR_ENV) { char *empty[] = { NULL }; env = g_strdupv (empty); } else env = g_get_environ (); n_envs = g_variant_n_children (arg_envs); for (i = 0; i < n_envs; i++) { const char *var = NULL; const char *val = NULL; g_variant_get_child (arg_envs, i, \"{&s&s}\", &var, &val); env = g_environ_setenv (env, var, val, TRUE); } g_ptr_array_add (flatpak_argv, g_strdup (\"flatpak\")); g_ptr_array_add (flatpak_argv, g_strdup (\"run\")); sandboxed = (arg_flags & FLATPAK_SPAWN_FLAGS_SANDBOX) != 0; if (sandboxed) { g_ptr_array_add (flatpak_argv, g_strdup (\"--sandbox\")); if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_DISPLAY) { if (sockets != NULL && g_strv_contains ((const char * const *) sockets, \"wayland\")) g_ptr_array_add (flatpak_argv, g_strdup (\"--socket=wayland\")); if (sockets != NULL && g_strv_contains ((const char * const *) sockets, \"fallback-x11\")) g_ptr_array_add (flatpak_argv, g_strdup (\"--socket=fallback-x11\")); if (sockets != NULL && g_strv_contains ((const char * const *) sockets, \"x11\")) g_ptr_array_add (flatpak_argv, g_strdup (\"--socket=x11\")); if (shares != NULL && g_strv_contains ((const char * const *) shares, \"ipc\") && sockets != NULL && (g_strv_contains ((const char * const *) sockets, \"fallback-x11\") || g_strv_contains ((const char * const *) sockets, \"x11\"))) g_ptr_array_add (flatpak_argv, g_strdup (\"--share=ipc\")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_SOUND) { if (sockets != NULL && g_strv_contains ((const char * const *) sockets, \"pulseaudio\")) g_ptr_array_add (flatpak_argv, g_strdup (\"--socket=pulseaudio\")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_GPU) { if (devices != NULL && (g_strv_contains ((const char * const *) devices, \"dri\") || g_strv_contains ((const char * const *) devices, \"all\"))) g_ptr_array_add (flatpak_argv, g_strdup (\"--device=dri\")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_ALLOW_DBUS) g_ptr_array_add (flatpak_argv, g_strdup (\"--session-bus\")); if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_ALLOW_A11Y) g_ptr_array_add (flatpak_argv, g_strdup (\"--a11y-bus\")); } else { for (i = 0; extra_args != NULL && extra_args[i] != NULL; i++) { if (g_str_has_prefix (extra_args[i], \"--env=\")) { const char *var_val = extra_args[i] + strlen (\"--env=\"); if (var_val[0] == '\\0' || var_val[0] == '=') { g_warning (\"Environment variable in extra-args has empty name\"); continue; } if (strchr (var_val, '=') == NULL) { g_warning (\"Environment variable in extra-args has no value\"); continue; } g_string_append (env_string, var_val); g_string_append_c (env_string, '\\0'); } else { g_ptr_array_add (flatpak_argv, g_strdup (extra_args[i])); } } } if (env_string->len > 0) { g_auto(GLnxTmpfile) env_tmpf = { 0, }; if (!flatpak_buffer_to_sealed_memfd_or_tmpfile (&env_tmpf, \"environ\", env_string->str, env_string->len, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } child_setup_data.env_fd = glnx_steal_fd (&env_tmpf.fd); g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--env-fd=%d\", child_setup_data.env_fd)); } expose_pids = (arg_flags & FLATPAK_SPAWN_FLAGS_EXPOSE_PIDS) != 0; share_pids = (arg_flags & FLATPAK_SPAWN_FLAGS_SHARE_PIDS) != 0; if (expose_pids || share_pids) { g_autofree char *instance_id = NULL; int sender_pid1 = 0; if (!(supports & FLATPAK_SPAWN_SUPPORT_FLAGS_EXPOSE_PIDS)) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, \"Expose pids not supported with setuid bwrap\"); return G_DBUS_METHOD_INVOCATION_HANDLED; } instance_id = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_INSTANCE_ID, NULL); if (instance_id) { g_autoptr(FlatpakInstance) instance = flatpak_instance_new_for_id (instance_id); sender_pid1 = flatpak_instance_get_child_pid (instance); } if (sender_pid1 == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"Could not find requesting pid\"); return G_DBUS_METHOD_INVOCATION_HANDLED; } g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--parent-pid=%d\", sender_pid1)); if (share_pids) g_ptr_array_add (flatpak_argv, g_strdup (\"--parent-share-pids\")); else g_ptr_array_add (flatpak_argv, g_strdup (\"--parent-expose-pids\")); } notify_start = (arg_flags & FLATPAK_SPAWN_FLAGS_NOTIFY_START) != 0; if (notify_start) { int pipe_fds[2]; if (pipe (pipe_fds) == -1) { int errsv = errno; g_dbus_method_invocation_return_error (invocation, G_IO_ERROR, g_io_error_from_errno (errsv), \"Failed to create instance ID pipe: %s\", g_strerror (errsv)); return G_DBUS_METHOD_INVOCATION_HANDLED; } GInputStream *in_stream = G_INPUT_STREAM (g_unix_input_stream_new (pipe_fds[0], TRUE)); /* This is saved to ensure the portal's end gets closed after the exec. */ instance_id_out_stream = G_OUTPUT_STREAM (g_unix_output_stream_new (pipe_fds[1], TRUE)); instance_id_read_data = g_new0 (InstanceIdReadData, 1); g_input_stream_read_async (in_stream, instance_id_read_data->buffer, INSTANCE_ID_BUFFER_SIZE - 1, G_PRIORITY_DEFAULT, NULL, instance_id_read_finish, instance_id_read_data); g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--instance-id-fd=%d\", pipe_fds[1])); child_setup_data.instance_id_fd = pipe_fds[1]; } if (devel) g_ptr_array_add (flatpak_argv, g_strdup (\"--devel\")); /* Inherit launcher network access from launcher, unless NO_NETWORK set. */ if (shares != NULL && g_strv_contains ((const char * const *) shares, \"network\") && !(arg_flags & FLATPAK_SPAWN_FLAGS_NO_NETWORK)) g_ptr_array_add (flatpak_argv, g_strdup (\"--share=network\")); else g_ptr_array_add (flatpak_argv, g_strdup (\"--unshare=network\")); if (instance_path) { for (i = 0; sandbox_expose != NULL && sandbox_expose[i] != NULL; i++) g_ptr_array_add (flatpak_argv, filesystem_sandbox_arg (instance_path, sandbox_expose[i], FALSE)); for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) g_ptr_array_add (flatpak_argv, filesystem_sandbox_arg (instance_path, sandbox_expose_ro[i], TRUE)); } for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) { const char *expose = sandbox_expose_ro[i]; g_debug (\"exposing %s\", expose); } if (sandbox_expose_fd != NULL) { gsize len = g_variant_n_children (sandbox_expose_fd); for (i = 0; i < len; i++) { gint32 handle; g_variant_get_child (sandbox_expose_fd, i, \"h\", &handle); if (handle >= 0 && handle < fds_len) { int handle_fd = fds[handle]; g_autofree char *path = NULL; gboolean writable = FALSE; path = get_path_for_fd (handle_fd, &writable, &error); if (path) { g_ptr_array_add (flatpak_argv, filesystem_arg (path, !writable)); } else { g_debug (\"unable to get path for sandbox-exposed fd %d, ignoring: %s\", handle_fd, error->message); g_clear_error (&error); } } else { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"No file descriptor for handle %d\", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } } } if (sandbox_expose_fd_ro != NULL) { gsize len = g_variant_n_children (sandbox_expose_fd_ro); for (i = 0; i < len; i++) { gint32 handle; g_variant_get_child (sandbox_expose_fd_ro, i, \"h\", &handle); if (handle >= 0 && handle < fds_len) { int handle_fd = fds[handle]; g_autofree char *path = NULL; gboolean writable = FALSE; path = get_path_for_fd (handle_fd, &writable, &error); if (path) { g_ptr_array_add (flatpak_argv, filesystem_arg (path, TRUE)); } else { g_debug (\"unable to get path for sandbox-exposed fd %d, ignoring: %s\", handle_fd, error->message); g_clear_error (&error); } } else { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, \"No file descriptor for handle %d\", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } } } g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--runtime=%s\", runtime_parts[1])); g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--runtime-version=%s\", runtime_parts[3])); if ((arg_flags & FLATPAK_SPAWN_FLAGS_LATEST_VERSION) == 0) { if (app_commit) g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--commit=%s\", app_commit)); if (runtime_commit) g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--runtime-commit=%s\", runtime_commit)); } if (arg_cwd_path != NULL) g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--cwd=%s\", arg_cwd_path)); if (arg_argv[0][0] != 0) g_ptr_array_add (flatpak_argv, g_strdup_printf (\"--command=%s\", arg_argv[0])); g_ptr_array_add (flatpak_argv, g_strdup_printf (\"%s/%s/%s\", app_id, arch ? arch : \"\", branch ? branch : \"\")); for (i = 1; arg_argv[i] != NULL; i++) g_ptr_array_add (flatpak_argv, g_strdup (arg_argv[i])); g_ptr_array_add (flatpak_argv, NULL); if (opt_verbose) { g_autoptr(GString) cmd = g_string_new (\"\"); for (i = 0; flatpak_argv->pdata[i] != NULL; i++) { if (i > 0) g_string_append (cmd, \" \"); g_string_append (cmd, flatpak_argv->pdata[i]); } g_debug (\"Starting: %s\\n\", cmd->str); } /* We use LEAVE_DESCRIPTORS_OPEN to work around dead-lock, see flatpak_close_fds_workaround */ if (!g_spawn_async_with_pipes (NULL, (char **) flatpak_argv->pdata, env, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN, child_setup_func, &child_setup_data, &pid, NULL, NULL, NULL, &error)) { gint code = G_DBUS_ERROR_FAILED; if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_ACCES)) code = G_DBUS_ERROR_ACCESS_DENIED; else if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT)) code = G_DBUS_ERROR_FILE_NOT_FOUND; g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, code, \"Failed to start command: %s\", error->message); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (instance_id_read_data) instance_id_read_data->pid = pid; pid_data = g_new0 (PidData, 1); pid_data->pid = pid; pid_data->client = g_strdup (g_dbus_method_invocation_get_sender (invocation)); pid_data->watch_bus = (arg_flags & FLATPAK_SPAWN_FLAGS_WATCH_BUS) != 0; pid_data->expose_or_share_pids = (expose_pids || share_pids); pid_data->child_watch = g_child_watch_add_full (G_PRIORITY_DEFAULT, pid, child_watch_died, pid_data, NULL); g_debug (\"Client Pid is %d\", pid_data->pid); g_hash_table_replace (client_pid_data_hash, GUINT_TO_POINTER (pid_data->pid), pid_data); portal_flatpak_complete_spawn (object, invocation, NULL, pid); return G_DBUS_METHOD_INVOCATION_HANDLED; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')"], "explanation": "Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. A bug was discovered in the `flatpak-portal` service that can allow sandboxed applications to execute arbitrary code on the host system (a sandbox escape). This sandbox-escape bug is present in versions from 0.11.4 and before fixed versions 1.8.5 and 1.10.0. The Flatpak portal D-Bus service (`flatpak-portal`, also known by its D-Bus service name `org.freedesktop.portal.Flatpak`) allows apps in a Flatpak sandbox to launch their own subprocesses in a new sandbox instance, either with the same security settings as the caller or with more restrictive security settings. For example, this is used in Flatpak-packaged web browsers such as Chromium to launch subprocesses that will process untrusted web content, and give those subprocesses a more restrictive sandbox than the browser itself. In vulnerable versions, the Flatpak portal service passes caller-specified environment variables to non-sandboxed processes on the host system, and in particular to the `flatpak run` command that is used to launch the new sandbox instance. A malicious or compromised Flatpak app could set environment variables that are trusted by the `flatpak run` command, and use them to execute arbitrary code that is not in a sandbox. As a workaround, this vulnerability can be mitigated by preventing the `flatpak-portal` service from starting, but that mitigation will prevent many Flatpak apps from working correctly. This is fixed in versions 1.8.5 and 1.10.0.", "severity_level": "NoInfo", "cwe": "CWE-74", "cve": "CVE-2021-21261"}} -{"idx": 230964, "input": "static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_context *lp_ctx, struct interface *ifaces, const struct model_ops *model_ops) { int num_interfaces; TALLOC_CTX *tmp_ctx = talloc_new(kdc); NTSTATUS status; int i; uint16_t kdc_port = lpcfg_krb5_port(lp_ctx); uint16_t kpasswd_port = lpcfg_kpasswd_port(lp_ctx); bool done_wildcard = false; num_interfaces = iface_list_count(ifaces); /* if we are allowing incoming packets from any address, then we need to bind to the wildcard address */ if (!lpcfg_bind_interfaces_only(lp_ctx)) { size_t num_binds = 0; char **wcard = iface_list_wildcard(kdc); NT_STATUS_HAVE_NO_MEMORY(wcard); for (i=0; wcard[i]; i++) { if (kdc_port) { status = kdc_add_socket(kdc, model_ops, \"kdc\", wcard[i], kdc_port, kdc_process, false); if (NT_STATUS_IS_OK(status)) { num_binds++; } } if (kpasswd_port) { status = kdc_add_socket(kdc, model_ops, \"kpasswd\", wcard[i], kpasswd_port, kpasswd_process, false); if (NT_STATUS_IS_OK(status)) { num_binds++; } } } talloc_free(wcard); if (num_binds == 0) { return NT_STATUS_INVALID_PARAMETER_MIX; } done_wildcard = true; } for (i=0; iacquired_refs, false); if (err) return err; err = copy_reference_state(dst, src); if (err) return err; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295119, "input": "void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) { int x, y; double sy1, sy2, sx1, sx2; if (!dst->trueColor) { gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH); return; } for (y = dstY; (y < dstY + dstH); y++) { sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH; sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / (double) dstH; for (x = dstX; (x < dstX + dstW); x++) { double sx, sy; double spixels = 0; double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; double alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0; sx1 = ((double) x - (double) dstX) * (double) srcW / dstW; sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW; sy = sy1; do { double yportion; if (floor_cast(sy) == floor_cast(sy1)) { yportion = 1.0f - (sy - floor_cast(sy)); if (yportion > sy2 - sy1) { yportion = sy2 - sy1; } sy = floor_cast(sy); } else if (sy == floorf(sy2)) { yportion = sy2 - floor_cast(sy2); } else { yportion = 1.0f; } sx = sx1; do { double xportion; double pcontribution; int p; if (floorf(sx) == floor_cast(sx1)) { xportion = 1.0f - (sx - floor_cast(sx)); if (xportion > sx2 - sx1) { xportion = sx2 - sx1; } sx = floor_cast(sx); } else if (sx == floorf(sx2)) { xportion = sx2 - floor_cast(sx2); } else { xportion = 1.0f; } pcontribution = xportion * yportion; p = gdImageGetTrueColorPixel(src, (int) sx + srcX, (int) sy + srcY); alpha_factor = ((gdAlphaMax - gdTrueColorGetAlpha(p))) * pcontribution; red += gdTrueColorGetRed (p) * alpha_factor; green += gdTrueColorGetGreen (p) * alpha_factor; blue += gdTrueColorGetBlue (p) * alpha_factor; alpha += gdTrueColorGetAlpha (p) * pcontribution; alpha_sum += alpha_factor; contrib_sum += pcontribution; spixels += xportion * yportion; sx += 1.0f; } while (sx < sx2); sy += 1.0f; } while (sy < sy2); if (spixels != 0.0f) { red /= spixels; green /= spixels; blue /= spixels; alpha /= spixels; alpha += 0.5; } if ( alpha_sum != 0.0f) { if( contrib_sum != 0.0f) { alpha_sum /= contrib_sum; } red /= alpha_sum; green /= alpha_sum; blue /= alpha_sum; } /* Clamping to allow for rounding errors above */ if (red > 255.0f) { red = 255.0f; } if (green > 255.0f) { green = 255.0f; } if (blue > 255.0f) { blue = 255.0f; } if (alpha > gdAlphaMax) { alpha = gdAlphaMax; } gdImageSetPixel(dst, x, y, gdTrueColorAlpha ((int) red, (int) green, (int) blue, (int) alpha)); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336878, "input": "rb_filesystem_str_new_cstr(const char *ptr) { return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_filesystem_encoding()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416757, "input": "static void cil_reset_typeattr(struct cil_typeattribute *attr) { /* during a re-resolve, we need to reset the lists of expression stacks associated with this attribute from a attributetypes statement */ if (attr->expr_list != NULL) { /* we don't want to destroy the expression stacks (cil_list) inside * this list cil_list_destroy destroys sublists, so we need to do it * manually */ struct cil_list_item *expr = attr->expr_list->head; while (expr != NULL) { struct cil_list_item *next = expr->next; cil_list_item_destroy(&expr, CIL_FALSE); expr = next; } free(attr->expr_list); attr->expr_list = NULL; } attr->used = CIL_FALSE; attr->keep = CIL_FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 349500, "input": "p11_rpc_message_read_space_string (p11_rpc_message *msg, CK_UTF8CHAR *buffer, CK_ULONG length) { const unsigned char *data; size_t n_data; assert (msg != NULL); assert (msg->input != NULL); assert (buffer != NULL); assert (length != 0); assert (!msg->signature || p11_rpc_message_verify_part (msg, \"s\")); if (!p11_rpc_buffer_get_byte_array (msg->input, &msg->parsed, &data, &n_data)) return false; if (n_data != length) { p11_message (\"invalid length space padded string received: %d != %d\", (int)length, (int)n_data); return false; } memcpy (buffer, data, length); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195007, "input": "static int xbuf_format_converter(char **outbuf, const char *fmt, va_list ap) { register char *s = nullptr; char *q; int s_len; register int min_width = 0; int precision = 0; enum { LEFT, RIGHT } adjust; char pad_char; char prefix_char; double fp_num; wide_int i_num = (wide_int) 0; u_wide_int ui_num; char num_buf[NUM_BUF_SIZE]; char char_buf[2]; /* for printing %% and % */ #ifdef HAVE_LOCALE_H struct lconv *lconv = nullptr; #endif /* * Flag variables */ length_modifier_e modifier; boolean_e alternate_form; boolean_e print_sign; boolean_e print_blank; boolean_e adjust_precision; boolean_e adjust_width; int is_negative; int size = 240; char *result = (char *)malloc(size); int outpos = 0; while (*fmt) { if (*fmt != '%') { appendchar(&result, &outpos, &size, *fmt); } else { /* * Default variable settings */ adjust = RIGHT; alternate_form = print_sign = print_blank = NO; pad_char = ' '; prefix_char = NUL; fmt++; /* * Try to avoid checking for flags, width or precision */ if (isascii((int)*fmt) && !islower((int)*fmt)) { /* * Recognize flags: -, #, BLANK, + */ for (;; fmt++) { if (*fmt == '-') adjust = LEFT; else if (*fmt == '+') print_sign = YES; else if (*fmt == '#') alternate_form = YES; else if (*fmt == ' ') print_blank = YES; else if (*fmt == '0') pad_char = '0'; else break; } /* * Check if a width was specified */ if (isdigit((int)*fmt)) { STR_TO_DEC(fmt, min_width); adjust_width = YES; } else if (*fmt == '*') { min_width = va_arg(ap, int); fmt++; adjust_width = YES; if (min_width < 0) { adjust = LEFT; min_width = -min_width; } } else adjust_width = NO; /* * Check if a precision was specified * * XXX: an unreasonable amount of precision may be specified * resulting in overflow of num_buf. Currently we * ignore this possibility. */ if (*fmt == '.') { adjust_precision = YES; fmt++; if (isdigit((int)*fmt)) { STR_TO_DEC(fmt, precision); } else if (*fmt == '*') { precision = va_arg(ap, int); fmt++; if (precision < 0) precision = 0; } else precision = 0; } else adjust_precision = NO; } else adjust_precision = adjust_width = NO; /* * Modifier check */ switch (*fmt) { case 'L': fmt++; modifier = LM_LONG_DOUBLE; break; case 'I': fmt++; #if SIZEOF_LONG_LONG if (*fmt == '6' && *(fmt+1) == '4') { fmt += 2; modifier = LM_LONG_LONG; } else #endif if (*fmt == '3' && *(fmt+1) == '2') { fmt += 2; modifier = LM_LONG; } else { #ifdef _WIN64 modifier = LM_LONG_LONG; #else modifier = LM_LONG; #endif } break; case 'l': fmt++; #if SIZEOF_LONG_LONG if (*fmt == 'l') { fmt++; modifier = LM_LONG_LONG; } else #endif modifier = LM_LONG; break; case 'z': fmt++; modifier = LM_SIZE_T; break; case 'j': fmt++; #if SIZEOF_INTMAX_T modifier = LM_INTMAX_T; #else modifier = LM_SIZE_T; #endif break; case 't': fmt++; #if SIZEOF_PTRDIFF_T modifier = LM_PTRDIFF_T; #else modifier = LM_SIZE_T; #endif break; case 'h': fmt++; if (*fmt == 'h') { fmt++; } /* these are promoted to int, so no break */ default: modifier = LM_STD; break; } /* * Argument extraction and printing. * First we determine the argument type. * Then, we convert the argument to a string. * On exit from the switch, s points to the string that * must be printed, s_len has the length of the string * The precision requirements, if any, are reflected in s_len. * * NOTE: pad_char may be set to '0' because of the 0 flag. * It is reset to ' ' by non-numeric formats */ switch (*fmt) { case 'u': switch(modifier) { default: i_num = (wide_int) va_arg(ap, unsigned int); break; case LM_LONG_DOUBLE: goto fmt_error; case LM_LONG: i_num = (wide_int) va_arg(ap, unsigned long int); break; case LM_SIZE_T: i_num = (wide_int) va_arg(ap, size_t); break; #if SIZEOF_LONG_LONG case LM_LONG_LONG: i_num = (wide_int) va_arg(ap, u_wide_int); break; #endif #if SIZEOF_INTMAX_T case LM_INTMAX_T: i_num = (wide_int) va_arg(ap, uintmax_t); break; #endif #if SIZEOF_PTRDIFF_T case LM_PTRDIFF_T: i_num = (wide_int) va_arg(ap, ptrdiff_t); break; #endif } /* * The rest also applies to other integer formats, so fall * into that case. */ case 'd': case 'i': /* * Get the arg if we haven't already. */ if ((*fmt) != 'u') { switch(modifier) { default: i_num = (wide_int) va_arg(ap, int); break; case LM_LONG_DOUBLE: goto fmt_error; case LM_LONG: i_num = (wide_int) va_arg(ap, long int); break; case LM_SIZE_T: #if SIZEOF_SSIZE_T i_num = (wide_int) va_arg(ap, ssize_t); #else i_num = (wide_int) va_arg(ap, size_t); #endif break; #if SIZEOF_LONG_LONG case LM_LONG_LONG: i_num = (wide_int) va_arg(ap, wide_int); break; #endif #if SIZEOF_INTMAX_T case LM_INTMAX_T: i_num = (wide_int) va_arg(ap, intmax_t); break; #endif #if SIZEOF_PTRDIFF_T case LM_PTRDIFF_T: i_num = (wide_int) va_arg(ap, ptrdiff_t); break; #endif } } s = ap_php_conv_10(i_num, (*fmt) == 'u', &is_negative, &num_buf[NUM_BUF_SIZE], &s_len); FIX_PRECISION(adjust_precision, precision, s, s_len); if (*fmt != 'u') { if (is_negative) prefix_char = '-'; else if (print_sign) prefix_char = '+'; else if (print_blank) prefix_char = ' '; } break; case 'o': switch(modifier) { default: ui_num = (u_wide_int) va_arg(ap, unsigned int); break; case LM_LONG_DOUBLE: goto fmt_error; case LM_LONG: ui_num = (u_wide_int) va_arg(ap, unsigned long int); break; case LM_SIZE_T: ui_num = (u_wide_int) va_arg(ap, size_t); break; #if SIZEOF_LONG_LONG case LM_LONG_LONG: ui_num = (u_wide_int) va_arg(ap, u_wide_int); break; #endif #if SIZEOF_INTMAX_T case LM_INTMAX_T: ui_num = (u_wide_int) va_arg(ap, uintmax_t); break; #endif #if SIZEOF_PTRDIFF_T case LM_PTRDIFF_T: ui_num = (u_wide_int) va_arg(ap, ptrdiff_t); break; #endif } s = ap_php_conv_p2(ui_num, 3, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); FIX_PRECISION(adjust_precision, precision, s, s_len); if (alternate_form && *s != '0') { *--s = '0'; s_len++; } break; case 'x': case 'X': switch(modifier) { default: ui_num = (u_wide_int) va_arg(ap, unsigned int); break; case LM_LONG_DOUBLE: goto fmt_error; case LM_LONG: ui_num = (u_wide_int) va_arg(ap, unsigned long int); break; case LM_SIZE_T: ui_num = (u_wide_int) va_arg(ap, size_t); break; #if SIZEOF_LONG_LONG case LM_LONG_LONG: ui_num = (u_wide_int) va_arg(ap, u_wide_int); break; #endif #if SIZEOF_INTMAX_T case LM_INTMAX_T: ui_num = (u_wide_int) va_arg(ap, uintmax_t); break; #endif #if SIZEOF_PTRDIFF_T case LM_PTRDIFF_T: ui_num = (u_wide_int) va_arg(ap, ptrdiff_t); break; #endif } s = ap_php_conv_p2(ui_num, 4, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); FIX_PRECISION(adjust_precision, precision, s, s_len); if (alternate_form && i_num != 0) { *--s = *fmt; /* 'x' or 'X' */ *--s = '0'; s_len += 2; } break; case 's': case 'v': s = va_arg(ap, char *); if (s != nullptr) { s_len = strlen(s); if (adjust_precision && precision < s_len) s_len = precision; } else { s = const_cast(s_null); s_len = S_NULL_LEN; } pad_char = ' '; break; case 'f': case 'F': case 'e': case 'E': switch(modifier) { case LM_LONG_DOUBLE: fp_num = (double) va_arg(ap, long double); break; case LM_STD: fp_num = va_arg(ap, double); break; default: goto fmt_error; } if (std::isnan(fp_num)) { s = const_cast(\"nan\"); s_len = 3; } else if (std::isinf(fp_num)) { s = const_cast(\"inf\"); s_len = 3; } else { #ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } #endif s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form, (adjust_precision == NO) ? FLOAT_DIGITS : precision, (*fmt == 'f')?LCONV_DECIMAL_POINT:'.', &is_negative, &num_buf[1], &s_len); if (is_negative) prefix_char = '-'; else if (print_sign) prefix_char = '+'; else if (print_blank) prefix_char = ' '; } break; case 'g': case 'k': case 'G': case 'H': switch(modifier) { case LM_LONG_DOUBLE: fp_num = (double) va_arg(ap, long double); break; case LM_STD: fp_num = va_arg(ap, double); break; default: goto fmt_error; } if (std::isnan(fp_num)) { s = const_cast(\"NAN\"); s_len = 3; break; } else if (std::isinf(fp_num)) { if (fp_num > 0) { s = const_cast(\"INF\"); s_len = 3; } else { s = const_cast(\"-INF\"); s_len = 4; } break; } if (adjust_precision == NO) precision = FLOAT_DIGITS; else if (precision == 0) precision = 1; /* * * We use &num_buf[ 1 ], so that we have room for the sign */ #ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } #endif s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); if (*s == '-') prefix_char = *s++; else if (print_sign) prefix_char = '+'; else if (print_blank) prefix_char = ' '; s_len = strlen(s); if (alternate_form && (q = strchr(s, '.')) == nullptr) s[s_len++] = '.'; break; case 'c': char_buf[0] = (char) (va_arg(ap, int)); s = &char_buf[0]; s_len = 1; pad_char = ' '; break; case '%': char_buf[0] = '%'; s = &char_buf[0]; s_len = 1; pad_char = ' '; break; case 'n': *(va_arg(ap, int *)) = outpos; goto skip_output; /* * Always extract the argument as a \"char *\" pointer. We * should be using \"void *\" but there are still machines * that don't understand it. * If the pointer size is equal to the size of an unsigned * integer we convert the pointer to a hex number, otherwise * we print \"%p\" to indicate that we don't handle \"%p\". */ case 'p': if (sizeof(char *) <= sizeof(u_wide_int)) { ui_num = (u_wide_int)((size_t) va_arg(ap, char *)); s = ap_php_conv_p2(ui_num, 4, 'x', &num_buf[NUM_BUF_SIZE], &s_len); if (ui_num != 0) { *--s = 'x'; *--s = '0'; s_len += 2; } } else { s = const_cast(\"%p\"); s_len = 2; } pad_char = ' '; break; case NUL: /* * The last character of the format string was %. * We ignore it. */ continue; fmt_error: throw Exception(\"Illegal length modifier specified '%c'\", *fmt); /* * The default case is for unrecognized %'s. * We print % to help the user identify what * option is not understood. * This is also useful in case the user wants to pass * the output of format_converter to another function * that understands some other % (like syslog). * Note that we can't point s inside fmt because the * unknown could be preceded by width etc. */ default: char_buf[0] = '%'; char_buf[1] = *fmt; s = char_buf; s_len = 2; pad_char = ' '; break; } if (prefix_char != NUL) { *--s = prefix_char; s_len++; } if (adjust_width && adjust == RIGHT && min_width > s_len) { if (pad_char == '0' && prefix_char != NUL) { appendchar(&result, &outpos, &size, *s); s++; s_len--; min_width--; } for (int i = 0; i < min_width - s_len; i++) { appendchar(&result, &outpos, &size, pad_char); } } /* * Print the (for now) non-null terminated string s. */ appendsimplestring(&result, &outpos, &size, s, s_len); if (adjust_width && adjust == LEFT && min_width > s_len) { for (int i = 0; i < min_width - s_len; i++) { appendchar(&result, &outpos, &size, pad_char); } } } skip_output: fmt++; } /* * Add the terminating null here since it wasn't added incrementally above * once the whole string has been composed. */ result[outpos] = NUL; *outbuf = result; return outpos; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "In-memory file operations (ie: using fopen on a data URI) did not properly restrict negative seeking, allowing for the reading of memory prior to the in-memory buffer. This issue affects HHVM versions prior to 4.56.3, all versions between 4.57.0 and 4.80.1, all versions between 4.81.0 and 4.93.1, and versions 4.94.0, 4.95.0, 4.96.0, 4.97.0, 4.98.0.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-1918"}} -{"idx": 215903, "input": "ms_escher_get_data (MSEscherState *state, gint offset, /* bytes from logical start of the stream */ gint num_bytes, /*how many bytes we want, NOT incl prefix */ gboolean * needs_free) { BiffQuery *q = state->q; guint8 *res; g_return_val_if_fail (offset >= state->start_offset, NULL); /* find the 1st containing record */ while (offset >= state->end_offset) { if (!ms_biff_query_next (q)) { g_warning (\"unexpected end of stream;\"); return NULL; } if (q->opcode != BIFF_MS_O_DRAWING && q->opcode != BIFF_MS_O_DRAWING_GROUP && q->opcode != BIFF_MS_O_DRAWING_SELECTION && q->opcode != BIFF_CHART_gelframe && q->opcode != BIFF_CONTINUE) { g_warning (\"Unexpected record type 0x%x len=0x%x @ 0x%lx;\", q->opcode, q->length, (long)q->streamPos); return NULL; } d (1, g_printerr (\"Target is 0x%x bytes at 0x%x, current = 0x%x..0x%x;\\n\" \"Adding biff-0x%x of length 0x%x;\\n\", num_bytes, offset, state->start_offset, state->end_offset, q->opcode, q->length);); state->start_offset = state->end_offset; state->end_offset += q->length; state->segment_len = q->length; } g_return_val_if_fail (offset >= state->start_offset, NULL); g_return_val_if_fail ((size_t)(offset - state->start_offset) < q->length, NULL); res = q->data + offset - state->start_offset; if ((*needs_free = ((offset + num_bytes) > state->end_offset))) { guint8 *buffer = g_malloc (num_bytes); guint8 *tmp = buffer; /* Setup front stub */ int len = q->length - (res - q->data); int counter = 0; d (1, g_printerr (\"MERGE needed (%d) which is >= %d + %d;\\n\", num_bytes, offset, state->end_offset);); do { d (1, g_printerr (\"record %d) add %d bytes;\\n\", ++counter, len);); /* copy necessary portion of current record */ memcpy (tmp, res, len); tmp += len; /* Get next record */ if (!ms_biff_query_next (q)) { g_warning (\"unexpected end of stream;\"); return NULL; } /* We should only see DRAW records now */ if (q->opcode != BIFF_MS_O_DRAWING && q->opcode != BIFF_MS_O_DRAWING_GROUP && q->opcode != BIFF_MS_O_DRAWING_SELECTION && q->opcode != BIFF_CHART_gelframe && q->opcode != BIFF_CONTINUE) { g_warning (\"Unexpected record type 0x%x @ 0x%lx;\", q->opcode, (long)q->streamPos); return NULL; } state->start_offset = state->end_offset; state->end_offset += q->length; state->segment_len = q->length; res = q->data; len = q->length; } while ((num_bytes - (tmp - buffer)) > len); /* Copy back stub */ memcpy (tmp, res, num_bytes - (tmp-buffer)); d (1, g_printerr (\"record %d) add %d bytes;\\n\", ++counter, num_bytes - (int)(tmp-buffer));); return buffer; } return res; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "Heap-based buffer overflow in the ms_escher_get_data function in plugins/excel/ms-escher.c in GNOME Office Gnumeric before 1.12.9 allows remote attackers to cause a denial of service (crash) via a crafted xls file with a crafted length value.", "severity_level": "Medium", "cwe": "CWE-119", "cve": "CVE-2013-6836"}} -{"idx": 374686, "input": "static int ebb_event_check(struct perf_event *event) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439534, "input": "bfad_im_node_name_show(struct device *dev, struct device_attribute *attr, char *buf) { struct Scsi_Host *shost = class_to_shost(dev); struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0]; struct bfad_port_s *port = im_port->port; u64 nwwn; nwwn = bfa_fcs_lport_get_nwwn(port->fcs_port); return snprintf(buf, PAGE_SIZE, \"0x%llx\\n\", cpu_to_be64(nwwn)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246169, "input": "static int multiSelect( Parse *pParse, /* Parsing context */ Select *p, /* The right-most of SELECTs to be coded */ SelectDest *pDest /* What to do with query results */ ){ int rc = SQLITE_OK; /* Success code from a subroutine */ Select *pPrior; /* Another SELECT immediately to our left */ Vdbe *v; /* Generate code to this VDBE */ SelectDest dest; /* Alternative data destination */ Select *pDelete = 0; /* Chain of simple selects to delete */ sqlite3 *db; /* Database connection */ /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. */ assert( p && p->pPrior ); /* Calling function guarantees this much */ assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION ); assert( p->selFlags & SF_Compound ); db = pParse->db; pPrior = p->pPrior; dest = *pDest; if( pPrior->pOrderBy || pPrior->pLimit ){ sqlite3ErrorMsg(pParse,\"%s clause should come after %s not before\", pPrior->pOrderBy!=0 ? \"ORDER BY\" : \"LIMIT\", selectOpName(p->op)); rc = 1; goto multi_select_end; } v = sqlite3GetVdbe(pParse); assert( v!=0 ); /* The VDBE already created by calling function */ /* Create the destination temporary table if necessary */ if( dest.eDest==SRT_EphemTab ){ assert( p->pEList ); sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr); dest.eDest = SRT_Table; } /* Special handling for a compound-select that originates as a VALUES clause. */ if( p->selFlags & SF_MultiValue ){ rc = multiSelectValues(pParse, p, &dest); if( rc>=0 ) goto multi_select_end; rc = SQLITE_OK; } /* Make sure all SELECTs in the statement have the same number of elements ** in their result sets. */ assert( p->pEList && pPrior->pEList ); assert( p->pEList->nExpr==pPrior->pEList->nExpr ); #ifndef SQLITE_OMIT_CTE if( p->selFlags & SF_Recursive ){ generateWithRecursiveQuery(pParse, p, &dest); }else #endif /* Compound SELECTs that have an ORDER BY clause are handled separately. */ if( p->pOrderBy ){ return multiSelectOrderBy(pParse, p, pDest); }else{ #ifndef SQLITE_OMIT_EXPLAIN if( pPrior->pPrior==0 ){ ExplainQueryPlan((pParse, 1, \"COMPOUND QUERY\")); ExplainQueryPlan((pParse, 1, \"LEFT-MOST SUBQUERY\")); } #endif /* Generate code for the left and right SELECT statements. */ switch( p->op ){ case TK_ALL: { int addr = 0; int nLimit; assert( !pPrior->pLimit ); pPrior->iLimit = p->iLimit; pPrior->iOffset = p->iOffset; pPrior->pLimit = p->pLimit; rc = sqlite3Select(pParse, pPrior, &dest); p->pLimit = 0; if( rc ){ goto multi_select_end; } p->pPrior = 0; p->iLimit = pPrior->iLimit; p->iOffset = pPrior->iOffset; if( p->iLimit ){ addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v); VdbeComment((v, \"Jump ahead if LIMIT reached\")); if( p->iOffset ){ sqlite3VdbeAddOp3(v, OP_OffsetLimit, p->iLimit, p->iOffset+1, p->iOffset); } } ExplainQueryPlan((pParse, 1, \"UNION ALL\")); rc = sqlite3Select(pParse, p, &dest); testcase( rc!=SQLITE_OK ); pDelete = p->pPrior; p->pPrior = pPrior; p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); if( pPrior->pLimit && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit) && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) ){ p->nSelectRow = sqlite3LogEst((u64)nLimit); } if( addr ){ sqlite3VdbeJumpHere(v, addr); } break; } case TK_EXCEPT: case TK_UNION: { int unionTab; /* Cursor number of the temp table holding result */ u8 op = 0; /* One of the SRT_ operations to apply to self */ int priorOp; /* The SRT_ operation to apply to prior selects */ Expr *pLimit; /* Saved values of p->nLimit */ int addr; SelectDest uniondest; testcase( p->op==TK_EXCEPT ); testcase( p->op==TK_UNION ); priorOp = SRT_Union; if( dest.eDest==priorOp ){ /* We can reuse a temporary table generated by a SELECT to our ** right. */ assert( p->pLimit==0 ); /* Not allowed on leftward elements */ unionTab = dest.iSDParm; }else{ /* We will need to create our own temporary table to hold the ** intermediate results. */ unionTab = pParse->nTab++; assert( p->pOrderBy==0 ); addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0); assert( p->addrOpenEphm[0] == -1 ); p->addrOpenEphm[0] = addr; findRightmost(p)->selFlags |= SF_UsesEphemeral; assert( p->pEList ); } /* Code the SELECT statements to our left */ assert( !pPrior->pOrderBy ); sqlite3SelectDestInit(&uniondest, priorOp, unionTab); rc = sqlite3Select(pParse, pPrior, &uniondest); if( rc ){ goto multi_select_end; } /* Code the current SELECT statement */ if( p->op==TK_EXCEPT ){ op = SRT_Except; }else{ assert( p->op==TK_UNION ); op = SRT_Union; } p->pPrior = 0; pLimit = p->pLimit; p->pLimit = 0; uniondest.eDest = op; ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\", selectOpName(p->op))); rc = sqlite3Select(pParse, p, &uniondest); testcase( rc!=SQLITE_OK ); /* Query flattening in sqlite3Select() might refill p->pOrderBy. ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */ sqlite3ExprListDelete(db, p->pOrderBy); pDelete = p->pPrior; p->pPrior = pPrior; p->pOrderBy = 0; if( p->op==TK_UNION ){ p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow); } sqlite3ExprDelete(db, p->pLimit); p->pLimit = pLimit; p->iLimit = 0; p->iOffset = 0; /* Convert the data in the temporary table into whatever form ** it is that we currently need. */ assert( unionTab==dest.iSDParm || dest.eDest!=priorOp ); assert( p->pEList || db->mallocFailed ); if( dest.eDest!=priorOp && db->mallocFailed==0 ){ int iCont, iBreak, iStart; iBreak = sqlite3VdbeMakeLabel(pParse); iCont = sqlite3VdbeMakeLabel(pParse); computeLimitRegisters(pParse, p, iBreak); sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v); iStart = sqlite3VdbeCurrentAddr(v); selectInnerLoop(pParse, p, unionTab, 0, 0, &dest, iCont, iBreak); sqlite3VdbeResolveLabel(v, iCont); sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v); sqlite3VdbeResolveLabel(v, iBreak); sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0); } break; } default: assert( p->op==TK_INTERSECT ); { int tab1, tab2; int iCont, iBreak, iStart; Expr *pLimit; int addr; SelectDest intersectdest; int r1; /* INTERSECT is different from the others since it requires ** two temporary tables. Hence it has its own case. Begin ** by allocating the tables we will need. */ tab1 = pParse->nTab++; tab2 = pParse->nTab++; assert( p->pOrderBy==0 ); addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0); assert( p->addrOpenEphm[0] == -1 ); p->addrOpenEphm[0] = addr; findRightmost(p)->selFlags |= SF_UsesEphemeral; assert( p->pEList ); /* Code the SELECTs to our left into temporary table \"tab1\". */ sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1); rc = sqlite3Select(pParse, pPrior, &intersectdest); if( rc ){ goto multi_select_end; } /* Code the current SELECT into temporary table \"tab2\" */ addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0); assert( p->addrOpenEphm[1] == -1 ); p->addrOpenEphm[1] = addr; p->pPrior = 0; pLimit = p->pLimit; p->pLimit = 0; intersectdest.iSDParm = tab2; ExplainQueryPlan((pParse, 1, \"%s USING TEMP B-TREE\", selectOpName(p->op))); rc = sqlite3Select(pParse, p, &intersectdest); testcase( rc!=SQLITE_OK ); pDelete = p->pPrior; p->pPrior = pPrior; if( p->nSelectRow>pPrior->nSelectRow ){ p->nSelectRow = pPrior->nSelectRow; } sqlite3ExprDelete(db, p->pLimit); p->pLimit = pLimit; /* Generate code to take the intersection of the two temporary ** tables. */ if( rc ) break; assert( p->pEList ); iBreak = sqlite3VdbeMakeLabel(pParse); iCont = sqlite3VdbeMakeLabel(pParse); computeLimitRegisters(pParse, p, iBreak); sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v); r1 = sqlite3GetTempReg(pParse); iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1); sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); VdbeCoverage(v); sqlite3ReleaseTempReg(pParse, r1); selectInnerLoop(pParse, p, tab1, 0, 0, &dest, iCont, iBreak); sqlite3VdbeResolveLabel(v, iCont); sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v); sqlite3VdbeResolveLabel(v, iBreak); sqlite3VdbeAddOp2(v, OP_Close, tab2, 0); sqlite3VdbeAddOp2(v, OP_Close, tab1, 0); break; } } #ifndef SQLITE_OMIT_EXPLAIN if( p->pNext==0 ){ ExplainQueryPlanPop(pParse); } #endif } if( pParse->nErr ) goto multi_select_end; /* Compute collating sequences used by ** temporary tables needed to implement the compound select. ** Attach the KeyInfo structure to all temporary tables. ** ** This section is run by the right-most SELECT statement only. ** SELECT statements to the left always skip this part. The right-most ** SELECT might also skip this part if it has no ORDER BY clause and ** no temp tables are required. */ if( p->selFlags & SF_UsesEphemeral ){ int i; /* Loop counter */ KeyInfo *pKeyInfo; /* Collating sequence for the result set */ Select *pLoop; /* For looping through SELECT statements */ CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */ int nCol; /* Number of columns in result set */ assert( p->pNext==0 ); nCol = p->pEList->nExpr; pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1); if( !pKeyInfo ){ rc = SQLITE_NOMEM_BKPT; goto multi_select_end; } for(i=0, apColl=pKeyInfo->aColl; ipDfltColl; } } for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ for(i=0; i<2; i++){ int addr = pLoop->addrOpenEphm[i]; if( addr<0 ){ /* If [0] is unused then [1] is also unused. So we can ** always safely abort as soon as the first unused slot is found */ assert( pLoop->addrOpenEphm[1]<0 ); break; } sqlite3VdbeChangeP2(v, addr, nCol); sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); pLoop->addrOpenEphm[i] = -1; } } sqlite3KeyInfoUnref(pKeyInfo); } multi_select_end: pDest->iSdst = dest.iSdst; pDest->nSdst = dest.nSdst; sqlite3SelectDelete(db, pDelete); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 388319, "input": "UINT cliprdr_read_format_list(wStream* s, CLIPRDR_FORMAT_LIST* formatList, BOOL useLongFormatNames) { UINT32 index; size_t position; BOOL asciiNames; int formatNameLength; char* szFormatName; WCHAR* wszFormatName; wStream sub1, sub2; CLIPRDR_FORMAT* formats = NULL; UINT error = CHANNEL_RC_OK; asciiNames = (formatList->msgFlags & CB_ASCII_NAMES) ? TRUE : FALSE; index = 0; /* empty format list */ formatList->formats = NULL; formatList->numFormats = 0; Stream_StaticInit(&sub1, Stream_Pointer(s), formatList->dataLen); if (!Stream_SafeSeek(s, formatList->dataLen)) return ERROR_INVALID_DATA; if (!formatList->dataLen) { } else if (!useLongFormatNames) { const size_t cap = Stream_Capacity(&sub1); formatList->numFormats = (cap / 36); if ((formatList->numFormats * 36) != cap) { WLog_ERR(TAG, \"Invalid short format list length: %\" PRIuz \"\", cap); return ERROR_INTERNAL_ERROR; } if (formatList->numFormats) formats = (CLIPRDR_FORMAT*)calloc(formatList->numFormats, sizeof(CLIPRDR_FORMAT)); if (!formats) { WLog_ERR(TAG, \"calloc failed!\"); return CHANNEL_RC_NO_MEMORY; } formatList->formats = formats; while (Stream_GetRemainingLength(&sub1) >= 4) { Stream_Read_UINT32(&sub1, formats[index].formatId); /* formatId (4 bytes) */ formats[index].formatName = NULL; /* According to MS-RDPECLIP 2.2.3.1.1.1 formatName is \"a 32-byte block containing * the *null-terminated* name assigned to the Clipboard Format: (32 ASCII 8 characters * or 16 Unicode characters)\" * However, both Windows RDSH and mstsc violate this specs as seen in the following * example of a transferred short format name string: [R.i.c.h. .T.e.x.t. .F.o.r.m.a.t.] * These are 16 unicode charaters - *without* terminating null ! */ szFormatName = (char*)Stream_Pointer(&sub1); wszFormatName = (WCHAR*)Stream_Pointer(&sub1); if (!Stream_SafeSeek(&sub1, 32)) goto error_out; if (asciiNames) { if (szFormatName[0]) { /* ensure null termination */ formats[index].formatName = (char*)malloc(32 + 1); if (!formats[index].formatName) { WLog_ERR(TAG, \"malloc failed!\"); error = CHANNEL_RC_NO_MEMORY; goto error_out; } CopyMemory(formats[index].formatName, szFormatName, 32); formats[index].formatName[32] = '\\0'; } } else { if (wszFormatName[0]) { /* ConvertFromUnicode always returns a null-terminated * string on success, even if the source string isn't. */ if (ConvertFromUnicode(CP_UTF8, 0, wszFormatName, 16, &(formats[index].formatName), 0, NULL, NULL) < 1) { WLog_ERR(TAG, \"failed to convert short clipboard format name\"); error = ERROR_INTERNAL_ERROR; goto error_out; } } } index++; } } else { sub2 = sub1; while (Stream_GetRemainingLength(&sub1) > 0) { size_t rest; if (!Stream_SafeSeek(&sub1, 4)) /* formatId (4 bytes) */ goto error_out; wszFormatName = (WCHAR*)Stream_Pointer(&sub1); rest = Stream_GetRemainingLength(&sub1); formatNameLength = _wcsnlen(wszFormatName, rest / sizeof(WCHAR)); if (!Stream_SafeSeek(&sub1, (formatNameLength + 1) * sizeof(WCHAR))) goto error_out; formatList->numFormats++; } if (formatList->numFormats) formats = (CLIPRDR_FORMAT*)calloc(formatList->numFormats, sizeof(CLIPRDR_FORMAT)); if (!formats) { WLog_ERR(TAG, \"calloc failed!\"); return CHANNEL_RC_NO_MEMORY; } formatList->formats = formats; while (Stream_GetRemainingLength(&sub2) >= 4) { size_t rest; Stream_Read_UINT32(&sub2, formats[index].formatId); /* formatId (4 bytes) */ formats[index].formatName = NULL; wszFormatName = (WCHAR*)Stream_Pointer(&sub2); rest = Stream_GetRemainingLength(&sub2); formatNameLength = _wcsnlen(wszFormatName, rest / sizeof(WCHAR)); if (!Stream_SafeSeek(&sub2, (formatNameLength + 1) * sizeof(WCHAR))) goto error_out; if (formatNameLength) { if (ConvertFromUnicode(CP_UTF8, 0, wszFormatName, formatNameLength, &(formats[index].formatName), 0, NULL, NULL) < 1) { WLog_ERR(TAG, \"failed to convert long clipboard format name\"); error = ERROR_INTERNAL_ERROR; goto error_out; } } index++; } } return error; error_out: cliprdr_free_format_list(formatList); return error; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431528, "input": "static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected, int *nfs_retval) { __be32 *p; uint32_t opnum; int32_t nfserr; p = xdr_inline_decode(xdr, 8); if (unlikely(!p)) goto out_overflow; opnum = be32_to_cpup(p++); if (unlikely(opnum != expected)) goto out_bad_operation; if (unlikely(*p != cpu_to_be32(NFS_OK))) goto out_status; *nfs_retval = 0; return true; out_status: nfserr = be32_to_cpup(p); trace_nfs4_xdr_status(xdr, opnum, nfserr); *nfs_retval = nfs4_stat_to_errno(nfserr); return true; out_bad_operation: dprintk(\"nfs: Server returned operation\" \" %d but we issued a request for %d\\n\", opnum, expected); *nfs_retval = -EREMOTEIO; return false; out_overflow: *nfs_retval = -EIO; return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506571, "input": "com_line() { #ifdef OS2_IPC static char *input_line_SharedMem = NULL; if (input_line_SharedMem == NULL) { /* get shared mem only once */ if (DosGetNamedSharedMem((PVOID) &input_line_SharedMem, mouseSharedMemName, PAG_WRITE | PAG_READ)) fputs(\"readline.c: DosGetNamedSharedMem ERROR\\n\", stderr); else *input_line_SharedMem = 0; } #endif /* OS2_IPC */ if (multiplot) { /* calls int_error() if it is not happy */ term_check_multiplot_okay(interactive); if (read_line(\"multiplot> \", 0)) return (1); } else { #if defined(OS2_IPC) && defined(USE_MOUSE) ULONG u; if (thread_rl_Running == 0) { int res = _beginthread(thread_read_line,NULL,32768,NULL); if (res == -1) fputs(\"error command.c could not begin thread\\n\",stderr); } /* wait until a line is read or gnupmdrv makes shared mem available */ DosWaitEventSem(semInputReady,SEM_INDEFINITE_WAIT); DosResetEventSem(semInputReady,&u); if (thread_rl_Running) { if (input_line_SharedMem == NULL || !*input_line_SharedMem) return (0); if (*input_line_SharedMem=='%') { do_event( (struct gp_event_t*)(input_line_SharedMem+1) ); /* pass terminal's event */ input_line_SharedMem[0] = 0; /* discard the whole command line */ thread_rl_RetCode = 0; return (0); } if (*input_line_SharedMem && strstr(input_line_SharedMem,\"plot\") != NULL && (strcmp(term->name,\"pm\") && strcmp(term->name,\"x11\"))) { /* avoid plotting if terminal is not PM or X11 */ fprintf(stderr,\"\\n\\tCommand(s) ignored for other than PM and X11 terminals\\a\\n\"); if (interactive) fputs(PROMPT,stderr); input_line_SharedMem[0] = 0; /* discard the whole command line */ return (0); } strcpy(gp_input_line, input_line_SharedMem); input_line_SharedMem[0] = 0; thread_rl_RetCode = 0; } if (thread_rl_RetCode) return (1); #else /* The normal case */ if (read_line(PROMPT, 0)) return (1); #endif /* defined(OS2_IPC) && defined(USE_MOUSE) */ } /* So we can flag any new output: if false at time of error, * we reprint the command line before printing caret. * TRUE for interactive terminals, since the command line is typed. * FALSE for non-terminal stdin, so command line is printed anyway. * (DFK 11/89) */ screen_ok = interactive; if (do_line()) return (1); else return (0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508638, "input": "bool cond_has_datetime_is_null(Item *cond) { if (cond_is_datetime_is_null(cond)) return true; if (cond->type() == Item::COND_ITEM) { List *cond_arg_list= ((Item_cond*) cond)->argument_list(); List_iterator li(*cond_arg_list); Item *item; while ((item= li++)) { if (cond_has_datetime_is_null(item)) return true; } } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 240828, "input": "uidcheck(const char *s, uid_t desired) { uid_t uid; if (parseuid(s, &uid) != 0) return -1; if (uid != desired) return -1; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 520949, "input": "static Jsi_RC jsi_ArrayFlatSub(Jsi_Interp *interp, Jsi_Obj* nobj, Jsi_Value *arr, int depth) { int i, n = 0, len = jsi_SizeOfArray(interp, arr->d.obj); if (len <= 0) return JSI_OK; Jsi_RC rc = JSI_OK; int clen = jsi_SizeOfArray(interp, nobj); for (i = 0; i < len && rc == JSI_OK; i++) { Jsi_Value *t = Jsi_ValueArrayIndex(interp, arr, i); if (t && depth>0 && Jsi_ValueIsArray(interp, t)) rc = jsi_ArrayFlatSub(interp, nobj, t , depth-1); else if (!Jsi_ValueIsUndef(interp, t)) Jsi_ObjArrayAdd(interp, nobj, t); if ((uint)(++n + clen)>interp->maxArrayList) return Jsi_LogError(\"array size exceeded\"); } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354593, "input": "static int kvm_s390_get_tod_low(struct kvm *kvm, struct kvm_device_attr *attr) { u64 gtod; gtod = kvm_s390_get_tod_clock_fast(kvm); if (copy_to_user((void __user *)attr->addr, >od, sizeof(gtod))) return -EFAULT; VM_EVENT(kvm, 3, \"QUERY: TOD base: 0x%llx\", gtod); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346355, "input": "static inline int evbuffer_chains_all_empty(struct evbuffer_chain *chain) { return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468979, "input": "static void ip_cork_release(struct inet_cork *cork) { cork->flags &= ~IPCORK_OPT; kfree(cork->opt); cork->opt = NULL; dst_release(cork->dst); cork->dst = NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198109, "input": "service_info *FindServiceControlURLPath( service_table *table, const char *controlURLPath) { service_info *finger = NULL; uri_type parsed_url; uri_type parsed_url_in; if (table && parse_uri(controlURLPath, strlen(controlURLPath), &parsed_url_in) == HTTP_SUCCESS) { finger = table->serviceList; while (finger) { if (finger->controlURL) { if (parse_uri(finger->controlURL, strlen(finger->controlURL), &parsed_url) == HTTP_SUCCESS) { if (!token_cmp(&parsed_url.pathquery, &parsed_url_in.pathquery)) { return finger; } } } finger = finger->next; } } return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "Portable UPnP SDK (aka libupnp) 1.12.1 and earlier allows remote attackers to cause a denial of service (crash) via a crafted SSDP message due to a NULL pointer dereference in the functions FindServiceControlURLPath and FindServiceEventURLPath in genlib/service_table/service_table.c.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2020-13848"}} -{"idx": 400908, "input": "ConnectClientToUnixSockWithTimeout(const char *sockFile, unsigned int timeout) { #ifdef WIN32 rfbClientErr(\"Windows doesn't support UNIX sockets\\n\"); return RFB_INVALID_SOCKET; #else rfbSocket sock; struct sockaddr_un addr; addr.sun_family = AF_UNIX; if(strlen(sockFile) + 1 > sizeof(addr.sun_path)) { rfbClientErr(\"ConnectToUnixSock: socket file name too long\\n\"); return RFB_INVALID_SOCKET; } strcpy(addr.sun_path, sockFile); sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock == RFB_INVALID_SOCKET) { rfbClientErr(\"ConnectToUnixSock: socket (%s)\\n\",strerror(errno)); return RFB_INVALID_SOCKET; } if (!SetNonBlocking(sock)) return RFB_INVALID_SOCKET; if (connect(sock, (struct sockaddr *)&addr, sizeof(addr.sun_family) + strlen(addr.sun_path)) < 0 && !(errno == EINPROGRESS && WaitForConnected(sock, timeout))) { rfbClientErr(\"ConnectToUnixSock: connect\\n\"); rfbCloseSocket(sock); return RFB_INVALID_SOCKET; } return sock; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 335498, "input": "dissect_dnp3_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { if (!check_dnp3_header(tvb, FALSE)) { return 0; } tcp_dissect_pdus(tvb, pinfo, tree, TRUE, DNP_HDR_LEN, get_dnp3_message_len, dissect_dnp3_message, data); return tvb_captured_length(tvb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499676, "input": "repair_inter_delayed_set_stat (struct stat *dir_stat_info) { struct delayed_set_stat *data; for (data = delayed_set_stat_head; data; data = data->next) { struct stat st; if (stat (data->stat.c_name, &st) != 0) { stat_error (data->stat.c_name); return -1; } if (st.st_dev == dir_stat_info->st_dev && st.st_ino == dir_stat_info->st_ino) { stat_to_cpio (&data->stat, dir_stat_info); data->invert_permissions = ((dir_stat_info->st_mode ^ st.st_mode) & MODE_RWX & ~ newdir_umask); return 0; } } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 498289, "input": "test_are_urls_equal(void) { unsigned i; static const struct { const char *url1; const char *url2; bool expected_result; } test_array[] = { { \"http://www.adomain.com/apath/\", \"http://www.adomain.com/apath/\", true }, { \"http://www.adomain.com/apath/\", \"http://www.adomain.com/anotherpath/\", false }, { \"http://www.adomain.com/apath/\", \"http://www.anotherdomain.com/path/\", false }, { \"http://www.adomain.com/~path/\", \"http://www.adomain.com/%7epath/\", true }, { \"http://www.adomain.com/longer-path/\", \"http://www.adomain.com/path/\", false }, { \"http://www.adomain.com/path%2f\", \"http://www.adomain.com/path/\", false }, }; for (i = 0; i < countof(test_array); ++i) { mu_assert (\"test_are_urls_equal: wrong result\", are_urls_equal (test_array[i].url1, test_array[i].url2) == test_array[i].expected_result); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 231544, "input": "void CClient::ParseUser(const CString& sAuthLine) { // user[@identifier][/network] const size_t uSlash = sAuthLine.rfind(\"/\"); if (uSlash != CString::npos) { m_sNetwork = sAuthLine.substr(uSlash + 1); ParseIdentifier(sAuthLine.substr(0, uSlash)); } else { ParseIdentifier(sAuthLine); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328347, "input": "static int nf_tables_updobj(const struct nft_ctx *ctx, const struct nft_object_type *type, const struct nlattr *attr, struct nft_object *obj) { struct nft_object *newobj; struct nft_trans *trans; int err; trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ, sizeof(struct nft_trans_obj)); if (!trans) return -ENOMEM; newobj = nft_obj_init(ctx, type, attr); if (IS_ERR(newobj)) { err = PTR_ERR(newobj); goto err_free_trans; } nft_trans_obj(trans) = obj; nft_trans_obj_update(trans) = true; nft_trans_obj_newobj(trans) = newobj; nft_trans_commit_list_add_tail(ctx->net, trans); return 0; err_free_trans: kfree(trans); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259623, "input": "void Compute(OpKernelContext* context) override { // Checks what we're remapping and inverts the relevant remapping Tensors to // be maps with key = old ID, value = new ID. std::unordered_map old_row_to_new_row_map; std::vector row_id_present; const Tensor* row_remapping_t; OP_REQUIRES_OK(context, context->input(\"row_remapping\", &row_remapping_t)); const auto row_remapping = row_remapping_t->vec(); OP_REQUIRES(context, row_remapping.size() == num_rows_, errors::InvalidArgument(strings::StrCat( \"Size of row_remapping is \", row_remapping.size(), \" instead of being equal to num_rows=\", num_rows_))); OP_REQUIRES_OK(context, RemapVectorToMap(row_remapping, &row_id_present, &old_row_to_new_row_map)); // Calculates the min/max old row ID that we need to read, to save us from // reading some unnecessary slices of the old tensor. int64 min_old_row = -1; int64 max_old_row = -1; for (int i = 0; i < row_remapping.size(); ++i) { if (min_old_row < 0 || (row_remapping(i) >= 0 && row_remapping(i) < min_old_row)) { min_old_row = row_remapping(i); } if (max_old_row < 0 || (row_remapping(i) >= 0 && row_remapping(i) > max_old_row)) { max_old_row = row_remapping(i); } } // Processes the remapping for columns. std::unordered_map old_col_to_new_col_map; std::vector col_id_present; const Tensor* col_remapping_t; OP_REQUIRES_OK(context, context->input(\"col_remapping\", &col_remapping_t)); const auto col_remapping = col_remapping_t->vec(); // Note that we always \"remap rows\", even when the row vocabulary does // not change, because partitioning requires a mapping from partitioned // Variables to the full checkpoints we load. const bool remap_cols = col_remapping.size() > 0; if (remap_cols) { OP_REQUIRES( context, col_remapping.size() == num_cols_, errors::InvalidArgument(strings::StrCat( \"Provided col_remapping, but its size is \", col_remapping.size(), \" instead of being equal to num_cols=\", num_cols_))); OP_REQUIRES_OK(context, RemapVectorToMap(col_remapping, &col_id_present, &old_col_to_new_col_map)); } else { col_id_present.clear(); col_id_present.resize(num_cols_, true); } // Processes the checkpoint source and the provided Tensor name. const Tensor* ckpt_path_t; OP_REQUIRES_OK(context, context->input(\"ckpt_path\", &ckpt_path_t)); OP_REQUIRES( context, ckpt_path_t->NumElements() == 1, errors::InvalidArgument(\"The `ckpt_path` tensor must have exactly one \" \"element, got tensor of shape \", ckpt_path_t->shape().DebugString())); const string& ckpt_path = ckpt_path_t->scalar()(); const Tensor* old_tensor_name_t; OP_REQUIRES_OK(context, context->input(\"old_tensor_name\", &old_tensor_name_t)); const string& old_tensor_name = old_tensor_name_t->scalar()(); LOG(INFO) << \"Processing checkpoint : \" << ckpt_path; BundleReader reader(context->env(), ckpt_path); OP_REQUIRES_OK(context, reader.status()); DataType tensor_type; TensorShape tensor_shape; OP_REQUIRES_OK(context, reader.LookupDtypeAndShape( old_tensor_name, &tensor_type, &tensor_shape)); OP_REQUIRES(context, tensor_type == DT_FLOAT, errors::InvalidArgument(strings::StrCat( \"Tensor \", old_tensor_name, \" has invalid type \", DataTypeString(tensor_type), \" instead of expected type \", DataTypeString(DT_FLOAT)))); // This op is limited to loading Tensors of rank 2 (matrices). OP_REQUIRES( context, tensor_shape.dims() == 2, errors::InvalidArgument(strings::StrCat( \"Tensor \", old_tensor_name, \" has shape \", tensor_shape.DebugString(), \" of invalid rank \", tensor_shape.dims(), \" instead of expected shape of rank 2.\"))); if (!remap_cols) { // TODO(weiho): Consider relaxing this restriction to allow partial column // loading (even when no column remapping is specified) if there turns out // to be a use case for it. OP_REQUIRES(context, num_cols_ == tensor_shape.dim_size(1), errors::InvalidArgument(strings::StrCat( \"Tensor \", old_tensor_name, \" has shape \", tensor_shape.DebugString(), \", where the size of its 2nd dimension is \", tensor_shape.dim_size(1), \" instead of being equal to num_cols=\", num_cols_))); } // Uses TensorSlice to potentially load the old tensor in chunks in case // memory usage is a concern. std::vector tensor_slices; TensorSlice slice(tensor_shape.dims()); if (min_old_row >= 0 && max_old_row >= 0) { int64 row_start = min_old_row; // TODO(weiho): Given the list of old row IDs of interest (the keys of // old_row_to_new_row_map), we could also try something smarter to // find some minimal set of covering ranges for the list of old row IDs // such that the size of each range is less than max_rows_in_memory_. while (row_start <= max_old_row) { const int64 slice_length = max_rows_in_memory_ <= 0 // If max_rows_in_memory_ <= 0, we just load the entire chunk. ? max_old_row - row_start + 1 : std::min(max_rows_in_memory_, max_old_row - row_start + 1); slice.set_start(0, row_start); slice.set_length(0, slice_length); tensor_slices.push_back(slice); row_start += slice_length; } } // Allocates the output matrix. Tensor* output_matrix_t = nullptr; OP_REQUIRES_OK(context, context->allocate_output(\"output_matrix\", TensorShape({num_rows_, num_cols_}), &output_matrix_t)); auto output_matrix = output_matrix_t->matrix(); // Iterates through tensor slices and copies over values from the old tensor // to the output matrix. int64 row_index = min_old_row; int64 rows_copied = 0; Tensor loaded_tensor_t; for (const TensorSlice& tensor_slice : tensor_slices) { LOG(INFO) << \"Loading slice \" << tensor_slice.DebugString(); TensorShape slice_shape; OP_REQUIRES_OK(context, tensor_slice.SliceTensorShape(tensor_shape, &slice_shape)); // Potentially re-allocates the tensor buffer since the last slice may // have fewer rows than the other slices. if (loaded_tensor_t.shape() != slice_shape) { loaded_tensor_t = Tensor(DT_FLOAT, slice_shape); } OP_REQUIRES_OK(context, reader.LookupSlice(old_tensor_name, tensor_slice, &loaded_tensor_t)); // Iterates through the old loaded tensor slice row-by-row. for (int row = 0; row < loaded_tensor_t.dim_size(0); ++row, ++row_index) { if (row_index % 500000 == min_old_row) { LOG(INFO) << \"Processing old row \" << row_index; } // If the old row ID is not found in old_row_to_new_row_map, continue // to the next row; otherwise, copy it to the output matrix. const int64* new_row_ptr = gtl::FindOrNull(old_row_to_new_row_map, row_index); if (new_row_ptr == nullptr) { continue; } ++rows_copied; const int64 new_row = *new_row_ptr; // Copies over the row element-by-element, in case remapping is needed // along the column axis. const auto& loaded_tensor = loaded_tensor_t.matrix(); for (int old_col = 0; old_col < loaded_tensor_t.dim_size(1); ++old_col) { int64 new_col = old_col; if (remap_cols) { const int64* new_col_ptr = gtl::FindOrNull(old_col_to_new_col_map, old_col); if (new_col_ptr == nullptr) { // Column remapping is specified, but this column is not found in // old_col_to_new_col_map, so we leave it uninitialized, to be // filled in with initializing_values later. continue; } new_col = *new_col_ptr; } OP_REQUIRES(context, new_row < num_rows_ && new_col < num_cols_ && new_row >= 0 && new_col >= 0, errors::Internal(strings::StrCat( \"new_row=\", new_row, \" and new_col=\", new_col, \" should have been less than num_rows_=\", num_rows_, \" and num_cols_=\", num_cols_, \" and non-negative. This should never have happened \" \"if the code were correct. Please file a bug.\"))); output_matrix(new_row, new_col) = loaded_tensor(row, old_col); } } } LOG(INFO) << \"Copied \" << rows_copied << \" rows from old matrix (with \" << tensor_shape.dim_size(0) << \" rows) to new matrix (with \" << num_rows_ << \" rows).\"; // At this point, there are potentially whole rows/columns uninitialized // (corresponding to the indices where row_id_present/col_id_present are // false). We fill this in cell-by-cell using row_id_present and // col_id_present while dequeuing from the initializing_values vector. const Tensor* initializing_values_t; OP_REQUIRES_OK( context, context->input(\"initializing_values\", &initializing_values_t)); const auto initializing_values = initializing_values_t->flat(); int64 initializing_values_index = 0; for (int i = 0; i < num_rows_; ++i) { for (int j = 0; j < num_cols_; ++j) { if (row_id_present[i] && col_id_present[j]) continue; OP_REQUIRES( context, initializing_values_index < initializing_values.size(), errors::InvalidArgument( \"initializing_values contained \", initializing_values.size(), \" elements, but more missing values remain.\")); output_matrix(i, j) = initializing_values(initializing_values_index); ++initializing_values_index; } } // Checks that we used all the given initializing values. OP_REQUIRES( context, initializing_values_index == initializing_values.size(), errors::InvalidArgument( \"initializing_values contained \", initializing_values.size(), \" elements, but only \", initializing_values_index, \" elements were used to fill in missing values.\")); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204277, "input": "int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) { const char *content_type = NULL; string content_type_str; map response_attrs; map::iterator riter; bufferlist metadata_bl; if (sent_header) goto send_data; if (custom_http_ret) { set_req_state_err(s, 0); dump_errno(s, custom_http_ret); } else { set_req_state_err(s, (partial_content && !op_ret) ? STATUS_PARTIAL_CONTENT : op_ret); dump_errno(s); } if (op_ret) goto done; if (range_str) dump_range(s, start, end, s->obj_size); if (s->system_request && s->info.args.exists(RGW_SYS_PARAM_PREFIX \"prepend-metadata\")) { dump_header(s, \"Rgwx-Object-Size\", (long long)total_len); if (rgwx_stat) { /* * in this case, we're not returning the object's content, only the prepended * extra metadata */ total_len = 0; } /* JSON encode object metadata */ JSONFormatter jf; jf.open_object_section(\"obj_metadata\"); encode_json(\"attrs\", attrs, &jf); utime_t ut(lastmod); encode_json(\"mtime\", ut, &jf); jf.close_section(); stringstream ss; jf.flush(ss); metadata_bl.append(ss.str()); dump_header(s, \"Rgwx-Embedded-Metadata-Len\", metadata_bl.length()); total_len += metadata_bl.length(); } if (s->system_request && !real_clock::is_zero(lastmod)) { /* we end up dumping mtime in two different methods, a bit redundant */ dump_epoch_header(s, \"Rgwx-Mtime\", lastmod); uint64_t pg_ver = 0; int r = decode_attr_bl_single_value(attrs, RGW_ATTR_PG_VER, &pg_ver, (uint64_t)0); if (r < 0) { ldout(s->cct, 0) << \"ERROR: failed to decode pg ver attr, ignoring\" << dendl; } dump_header(s, \"Rgwx-Obj-PG-Ver\", pg_ver); uint32_t source_zone_short_id = 0; r = decode_attr_bl_single_value(attrs, RGW_ATTR_SOURCE_ZONE, &source_zone_short_id, (uint32_t)0); if (r < 0) { ldout(s->cct, 0) << \"ERROR: failed to decode pg ver attr, ignoring\" << dendl; } if (source_zone_short_id != 0) { dump_header(s, \"Rgwx-Source-Zone-Short-Id\", source_zone_short_id); } } for (auto &it : crypt_http_responses) dump_header(s, it.first, it.second); dump_content_length(s, total_len); dump_last_modified(s, lastmod); dump_header_if_nonempty(s, \"x-amz-version-id\", version_id); if (! op_ret) { if (! lo_etag.empty()) { /* Handle etag of Swift API's large objects (DLO/SLO). It's entirerly * legit to perform GET on them through S3 API. In such situation, * a client should receive the composited content with corresponding * etag value. */ dump_etag(s, lo_etag); } else { auto iter = attrs.find(RGW_ATTR_ETAG); if (iter != attrs.end()) { dump_etag(s, iter->second.to_str()); } } for (struct response_attr_param *p = resp_attr_params; p->param; p++) { bool exists; string val = s->info.args.get(p->param, &exists); if (exists) { /* reject unauthenticated response header manipulation, see * https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html */ if (s->auth.identity->is_anonymous()) { return -ERR_INVALID_REQUEST; } if (strcmp(p->param, \"response-content-type\") != 0) { response_attrs[p->http_attr] = val; } else { content_type_str = val; content_type = content_type_str.c_str(); } } } for (auto iter = attrs.begin(); iter != attrs.end(); ++iter) { const char *name = iter->first.c_str(); map::iterator aiter = rgw_to_http_attrs.find(name); if (aiter != rgw_to_http_attrs.end()) { if (response_attrs.count(aiter->second) == 0) { /* Was not already overridden by a response param. */ response_attrs[aiter->second] = iter->second.c_str(); } } else if (iter->first.compare(RGW_ATTR_CONTENT_TYPE) == 0) { /* Special handling for content_type. */ if (!content_type) { content_type = iter->second.c_str(); } } else if (strcmp(name, RGW_ATTR_SLO_UINDICATOR) == 0) { // this attr has an extra length prefix from encode() in prior versions dump_header(s, \"X-Object-Meta-Static-Large-Object\", \"True\"); } else if (strncmp(name, RGW_ATTR_META_PREFIX, sizeof(RGW_ATTR_META_PREFIX)-1) == 0) { /* User custom metadata. */ name += sizeof(RGW_ATTR_PREFIX) - 1; dump_header(s, name, iter->second); } else if (iter->first.compare(RGW_ATTR_TAGS) == 0) { RGWObjTags obj_tags; try{ bufferlist::iterator it = iter->second.begin(); obj_tags.decode(it); } catch (buffer::error &err) { ldout(s->cct,0) << \"Error caught buffer::error couldn't decode TagSet \" << dendl; } dump_header(s, RGW_AMZ_TAG_COUNT, obj_tags.count()); } } } done: for (riter = response_attrs.begin(); riter != response_attrs.end(); ++riter) { dump_header(s, riter->first, riter->second); } if (op_ret == -ERR_NOT_MODIFIED) { end_header(s, this); } else { if (!content_type) content_type = \"binary/octet-stream\"; end_header(s, this, content_type); } if (metadata_bl.length()) { dump_body(s, metadata_bl); } sent_header = true; send_data: if (get_data && !op_ret) { int r = dump_body(s, bl.c_str() + bl_ofs, bl_len); if (r < 0) return r; } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"], "explanation": "A flaw was found in the Ceph Object Gateway, where it supports request sent by an anonymous user in Amazon S3. This flaw could lead to potential XSS attacks due to the lack of proper neutralization of untrusted input.", "severity_level": "NoInfo", "cwe": "CWE-79", "cve": "CVE-2020-1760"}} -{"idx": 219257, "input": "Variant php_split(const String& spliton, const String& str, int count, bool icase) { const char* strp = str.data(); const char* endp = strp + str.size(); regex_t re; int copts = icase ? REG_ICASE : 0; int err = regcomp(&re, spliton.data(), REG_EXTENDED | copts); if (err) { php_reg_eprint(err, &re); return false; } Array return_value = Array::CreateVArray(); regmatch_t subs[1]; /* churn through str, generating array entries as we go */ while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) { if (subs[0].rm_so == 0 && subs[0].rm_eo) { /* match is at start of string, return empty string */ return_value.append(\"\"); /* skip ahead the length of the regex match */ strp += subs[0].rm_eo; } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) { /* No more matches */ regfree(&re); raise_warning(\"Invalid Regular Expression to split()\"); return false; } else { /* On a real match */ /* make a copy of the substring */ int size = subs[0].rm_so; /* add it to the array */ return_value.append(String(strp, size, CopyString)); /* point at our new starting point */ strp = strp + subs[0].rm_eo; } /* if we're only looking for a certain number of points, stop looking once we hit it */ if (count != -1) { count--; } } /* see if we encountered an error */ if (err && err != REG_NOMATCH) { php_reg_eprint(err, &re); regfree(&re); return false; } /* otherwise we just have one last element to add to the array */ int size = endp - strp; return_value.append(String(strp, size, CopyString)); regfree(&re); return return_value; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412532, "input": "PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length, int replace_us_by_ws) /* {{{ */ { register unsigned int i; register unsigned const char *p1; register unsigned char *p2; register unsigned int h_nbl, l_nbl; size_t decoded_len, buf_size; unsigned char *retval; static unsigned int hexval_tbl[256] = { 64, 64, 64, 64, 64, 64, 64, 64, 64, 32, 16, 64, 64, 16, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 32, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 64, 64, 64, 64, 64, 64, 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 10, 11, 12, 13, 14, 15, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }; if (replace_us_by_ws) { replace_us_by_ws = '_'; } i = length, p1 = str; buf_size = length; while (i > 1 && *p1 != '\\0') { if (*p1 == '=') { buf_size -= 2; p1++; i--; } p1++; i--; } retval = emalloc(buf_size + 1); i = length; p1 = str; p2 = retval; decoded_len = 0; while (i > 0 && *p1 != '\\0') { if (*p1 == '=') { i--, p1++; if (i == 0 || *p1 == '\\0') { break; } h_nbl = hexval_tbl[*p1]; if (h_nbl < 16) { /* next char should be a hexadecimal digit */ if ((--i) == 0 || (l_nbl = hexval_tbl[*(++p1)]) >= 16) { efree(retval); return NULL; } *(p2++) = (h_nbl << 4) | l_nbl, decoded_len++; i--, p1++; } else if (h_nbl < 64) { /* soft line break */ while (h_nbl == 32) { if (--i == 0 || (h_nbl = hexval_tbl[*(++p1)]) == 64) { efree(retval); return NULL; } } if (p1[0] == '\\r' && i >= 2 && p1[1] == '\\n') { i--, p1++; } i--, p1++; } else { efree(retval); return NULL; } } else { *(p2++) = (replace_us_by_ws == *p1 ? '\\x20': *p1); i--, p1++, decoded_len++; } } *p2 = '\\0'; *ret_length = decoded_len; return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 216804, "input": "enhanced_recursion( const char *p, TBOOLEAN brace, char *fontname, double fontsize, double base, TBOOLEAN widthflag, TBOOLEAN showflag, int overprint) { TBOOLEAN wasitalic, wasbold; /* Keep track of the style of the font passed in at this recursion level */ wasitalic = (strstr(fontname, \":Italic\") != NULL); wasbold = (strstr(fontname, \":Bold\") != NULL); FPRINTF((stderr, \"RECURSE WITH \\\"%s\\\", %d %s %.1f %.1f %d %d %d\", p, brace, fontname, fontsize, base, widthflag, showflag, overprint)); /* Start each recursion with a clean string */ (term->enhanced_flush)(); if (base + fontsize > enhanced_max_height) { enhanced_max_height = base + fontsize; ENH_DEBUG((\"Setting max height to %.1f\\n\", enhanced_max_height)); } if (base < enhanced_min_height) { enhanced_min_height = base; ENH_DEBUG((\"Setting min height to %.1f\\n\", enhanced_min_height)); } while (*p) { double shift; /* * EAM Jun 2009 - treating bytes one at a time does not work for multibyte * encodings, including utf-8. If we hit a byte with the high bit set, test * whether it starts a legal UTF-8 sequence and if so copy the whole thing. * Other multibyte encodings are still a problem. * Gnuplot's other defined encodings are all single-byte; for those we * really do want to treat one byte at a time. */ if ((*p & 0x80) && (encoding == S_ENC_DEFAULT || encoding == S_ENC_UTF8)) { unsigned long utf8char; const char *nextchar = p; (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, overprint); if (utf8toulong(&utf8char, &nextchar)) { /* Legal UTF8 sequence */ while (p < nextchar) (term->enhanced_writec)(*p++); p--; } else { /* Some other multibyte encoding? */ (term->enhanced_writec)(*p); } /* shige : for Shift_JIS */ } else if ((*p & 0x80) && (encoding == S_ENC_SJIS)) { (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, overprint); (term->enhanced_writec)(*(p++)); (term->enhanced_writec)(*p); } else switch (*p) { case '}' : /*{{{ deal with it*/ if (brace) return (p); int_warn(NO_CARET, \"enhanced text parser - spurious }\"); break; /*}}}*/ case '_' : case '^' : /*{{{ deal with super/sub script*/ shift = (*p == '^') ? 0.5 : -0.3; (term->enhanced_flush)(); p = enhanced_recursion(p + 1, FALSE, fontname, fontsize * 0.8, base + shift * fontsize, widthflag, showflag, overprint); break; /*}}}*/ case '{' : { TBOOLEAN isitalic = FALSE, isbold = FALSE, isnormal = FALSE; const char *start_of_fontname = NULL; const char *end_of_fontname = NULL; char *localfontname = NULL; char ch; double f = fontsize, ovp; /* Mar 2014 - this will hold \"fontfamily{:Italic}{:Bold}\" */ char *styledfontname = NULL; /*{{{ recurse (possibly with a new font) */ ENH_DEBUG((\"Dealing with {\\n\")); /* 30 Sep 2016: Remove incorrect whitespace-eating loop going */ /* waaay back to 31-May-2000 */ /* while (*++p == ' '); */ ++p; /* get vertical offset (if present) for overprinted text */ if (overprint == 2) { char *end; ovp = strtod(p,&end); p = end; if (term->flags & TERM_IS_POSTSCRIPT) base = ovp*f; else base += ovp*f; } --p; if (*++p == '/') { /* then parse a fontname, optional fontsize */ while (*++p == ' ') ; /* do nothing */ if (*p=='-') { while (*++p == ' ') ; /* do nothing */ } start_of_fontname = p; /* Allow font name to be in quotes. * This makes it possible to handle font names containing spaces. */ if (*p == '\\'' || *p == '\"') { ++p; while (*p != '\\0' && *p != '}' && *p != *start_of_fontname) ++p; if (*p != *start_of_fontname) { int_warn(NO_CARET, \"cannot interpret font name %s\", start_of_fontname); p = start_of_fontname; } start_of_fontname++; end_of_fontname = p++; ch = *p; } else { /* Normal unquoted font name */ while ((ch = *p) > ' ' && ch != '=' && ch != '*' && ch != '}' && ch != ':') ++p; end_of_fontname = p; } do { if (ch == '=') { /* get optional font size */ char *end; p++; ENH_DEBUG((\"Calling strtod(\\\"%s\\\") ...\", p)); f = strtod(p, &end); p = end; ENH_DEBUG((\"Returned %.1f and \\\"%s\\\"\\n\", f, p)); if (f == 0) f = fontsize; else f *= enhanced_fontscale; /* remember the scaling */ ENH_DEBUG((\"Font size %.1f\\n\", f)); } else if (ch == '*') { /* get optional font size scale factor */ char *end; p++; ENH_DEBUG((\"Calling strtod(\\\"%s\\\") ...\", p)); f = strtod(p, &end); p = end; ENH_DEBUG((\"Returned %.1f and \\\"%s\\\"\\n\", f, p)); if (f) f *= fontsize; /* apply the scale factor */ else f = fontsize; ENH_DEBUG((\"Font size %.1f\\n\", f)); } else if (ch == ':') { /* get optional style markup attributes */ p++; if (!strncmp(p,\"Bold\",4)) isbold = TRUE; if (!strncmp(p,\"Italic\",6)) isitalic = TRUE; if (!strncmp(p,\"Normal\",6)) isnormal = TRUE; while (isalpha((unsigned char)*p)) {p++;} } } while (((ch = *p) == '=') || (ch == ':') || (ch == '*')); if (ch == '}') int_warn(NO_CARET,\"bad syntax in enhanced text string\"); if (*p == ' ') /* Eat up a single space following a font spec */ ++p; if (!start_of_fontname || (start_of_fontname == end_of_fontname)) { /* Use the font name passed in to us */ localfontname = gp_strdup(fontname); } else { /* We found a new font name {/Font ...} */ int len = end_of_fontname - start_of_fontname; localfontname = gp_alloc(len+1,\"localfontname\"); strncpy(localfontname, start_of_fontname, len); localfontname[len] = '\\0'; } } /*}}}*/ /* Collect cumulative style markup before passing it in the font name */ isitalic = (wasitalic || isitalic) && !isnormal; isbold = (wasbold || isbold) && !isnormal; styledfontname = stylefont(localfontname ? localfontname : fontname, isbold, isitalic); p = enhanced_recursion(p, TRUE, styledfontname, f, base, widthflag, showflag, overprint); (term->enhanced_flush)(); free(styledfontname); free(localfontname); break; } /* case '{' */ case '@' : /*{{{ phantom box - prints next 'char', then restores currentpoint */ (term->enhanced_flush)(); (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, 3); p = enhanced_recursion(++p, FALSE, fontname, fontsize, base, widthflag, showflag, overprint); (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, 4); break; /*}}}*/ case '&' : /*{{{ character skip - skips space equal to length of character(s) */ (term->enhanced_flush)(); p = enhanced_recursion(++p, FALSE, fontname, fontsize, base, widthflag, FALSE, overprint); break; /*}}}*/ case '~' : /*{{{ overprinted text */ /* the second string is overwritten on the first, centered * horizontally on the first and (optionally) vertically * shifted by an amount specified (as a fraction of the * current fontsize) at the beginning of the second string * Note that in this implementation neither the under- nor * overprinted string can contain syntax that would result * in additional recursions -- no subscripts, * superscripts, or anything else, with the exception of a * font definition at the beginning of the text */ (term->enhanced_flush)(); p = enhanced_recursion(++p, FALSE, fontname, fontsize, base, widthflag, showflag, 1); (term->enhanced_flush)(); if (!*p) break; p = enhanced_recursion(++p, FALSE, fontname, fontsize, base, FALSE, showflag, 2); overprint = 0; /* may not be necessary, but just in case . . . */ break; /*}}}*/ case '(' : case ')' : /*{{{ an escape and print it */ /* special cases */ (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, overprint); if (term->flags & TERM_IS_POSTSCRIPT) (term->enhanced_writec)('\\\\'); (term->enhanced_writec)(*p); break; /*}}}*/ case '\\\\' : /*{{{ various types of escape sequences, some context-dependent */ (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, overprint); /* Unicode represented as \\U+hhhhh where hhhhh is hexadecimal code point. * For UTF-8 encoding we translate hhhhh to a UTF-8 byte sequence and * output the bytes one by one. */ if (p[1] == 'U' && p[2] == '+') { if (encoding == S_ENC_UTF8) { uint32_t codepoint; unsigned char utf8char[8]; int i, length; sscanf(&(p[3]), \"%5x\", &codepoint); length = ucs4toutf8(codepoint, utf8char); p += (codepoint > 0xFFFF) ? 7 : 6; for (i=0; ienhanced_writec)(utf8char[i]); break; } /* FIXME: non-utf8 environments not yet supported. * Note that some terminals may have an alternative way to handle unicode * escape sequences that is not dependent on encoding. * E.g. svg and html output could convert to xml sequences &#xhhhh; * For these cases we must retain the leading backslash so that the * unicode escape sequence can be recognized by the terminal driver. */ (term->enhanced_writec)(p[0]); break; } /* Enhanced mode always uses \\xyz as an octal character representation * but each terminal type must give us the actual output format wanted. * pdf.trm wants the raw character code, which is why we use strtol(); * most other terminal types want some variant of \"\\\\%o\". */ if (p[1] >= '0' && p[1] <= '7') { char *e, escape[16], octal[4] = {'\\0','\\0','\\0','\\0'}; octal[0] = *(++p); if (p[1] >= '0' && p[1] <= '7') { octal[1] = *(++p); if (p[1] >= '0' && p[1] <= '7') octal[2] = *(++p); } sprintf(escape, enhanced_escape_format, strtol(octal,NULL,8)); for (e=escape; *e; e++) { (term->enhanced_writec)(*e); } break; } /* This was the original (prior to version 4) enhanced text code specific * to the reserved characters of PostScript. */ if (term->flags & TERM_IS_POSTSCRIPT) { if (p[1]=='\\\\' || p[1]=='(' || p[1]==')') { (term->enhanced_writec)('\\\\'); } else if (strchr(\"^_@&~{}\",p[1]) == NULL) { (term->enhanced_writec)('\\\\'); (term->enhanced_writec)('\\\\'); break; } } /* Step past the backslash character in the input stream */ ++p; /* HBB: Avoid broken output if there's a \\ exactly at the end of the line */ if (*p == '\\0') { int_warn(NO_CARET, \"enhanced text parser -- spurious backslash\"); break; } /* SVG requires an escaped '&' to be passed as something else */ /* FIXME: terminal-dependent code does not belong here */ if (*p == '&' && encoding == S_ENC_DEFAULT && !strcmp(term->name, \"svg\")) { (term->enhanced_writec)('\\376'); break; } /* print the character following the backslash */ (term->enhanced_writec)(*p); break; /*}}}*/ default: /*{{{ print it */ (term->enhanced_open)(fontname, fontsize, base, widthflag, showflag, overprint); (term->enhanced_writec)(*p); /*}}}*/ } /* switch (*p) */ /* like TeX, we only do one character in a recursion, unless it's * in braces */ if (!brace) { (term->enhanced_flush)(); return(p); /* the ++p in the outer copy will increment us */ } if (*p) /* only not true if { not terminated, I think */ ++p; } /* while (*p) */ (term->enhanced_flush)(); return p; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "com_line() in command.c in gnuplot 5.4 leads to an out-of-bounds-write from strncpy() that may lead to arbitrary code execution.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-25412"}} -{"idx": 509465, "input": "int save_in_field(Field *field, bool no_conversions) { field->set_notnull(); return field->store_hex_hybrid(str_value.ptr(), str_value.length()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 124803, "input": "void AudioContext::derefUnfinishedSourceNodes() { ASSERT(isMainThread()); for (unsigned i = 0; i < m_referencedNodes.size(); ++i) m_referencedNodes.at(i)->breakConnection(); m_referencedNodes.clear(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219117, "input": "bool HHVM_FUNCTION(imagesetthickness, const Resource& image, int64_t thickness) { gdImagePtr im = get_valid_image_resource(image); if (!im) return false; gdImageSetThickness(im, thickness); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 109008, "input": "void RunAndQuit(const base::Closure& closure, const base::Closure& quit, base::MessageLoopProxy* original_message_loop) { closure.Run(); original_message_loop->PostTask(FROM_HERE, quit); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509414, "input": "uint repertoire() const { return MY_STRING_METADATA::repertoire; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402554, "input": "static void adv_timeout_expire(struct work_struct *work) { struct hci_dev *hdev = container_of(work, struct hci_dev, adv_instance_expire.work); struct hci_request req; u8 instance; bt_dev_dbg(hdev, \"\"); hci_dev_lock(hdev); hdev->adv_instance_timeout = 0; instance = hdev->cur_adv_instance; if (instance == 0x00) goto unlock; hci_req_init(&req, hdev); hci_req_clear_adv_instance(hdev, NULL, &req, instance, false); if (list_empty(&hdev->adv_instances)) __hci_req_disable_advertising(&req); hci_req_run(&req, NULL); unlock: hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445637, "input": "static int tracing_set_clock(struct trace_array *tr, const char *clockstr) { int i; for (i = 0; i < ARRAY_SIZE(trace_clocks); i++) { if (strcmp(trace_clocks[i].name, clockstr) == 0) break; } if (i == ARRAY_SIZE(trace_clocks)) return -EINVAL; mutex_lock(&trace_types_lock); tr->clock_id = i; ring_buffer_set_clock(tr->trace_buffer.buffer, trace_clocks[i].func); /* * New clock may not be consistent with the previous clock. * Reset the buffer so that it doesn't have incomparable timestamps. */ tracing_reset_online_cpus(&tr->trace_buffer); #ifdef CONFIG_TRACER_MAX_TRACE if (tr->max_buffer.buffer) ring_buffer_set_clock(tr->max_buffer.buffer, trace_clocks[i].func); tracing_reset_online_cpus(&tr->max_buffer); #endif mutex_unlock(&trace_types_lock); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230474, "input": "void lua_datum::cleanup() { if (need_cleanup) { need_cleanup = false; lua.remove_shutdown_listener(this); lua_pushlightuserdata(lua, this); lua_pushnil(lua); lua_settable(lua, LUA_REGISTRYINDEX); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 102052, "input": "AudioManagerBase::~AudioManagerBase() { CHECK(!audio_thread_.get()); DCHECK_EQ(0, num_output_streams_); DCHECK_EQ(0, num_input_streams_); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328495, "input": "static void scalar_min_max_rsh(struct bpf_reg_state *dst_reg, struct bpf_reg_state *src_reg) { u64 umax_val = src_reg->umax_value; u64 umin_val = src_reg->umin_value; /* BPF_RSH is an unsigned shift. If the value in dst_reg might * be negative, then either: * 1) src_reg might be zero, so the sign bit of the result is * unknown, so we lose our signed bounds * 2) it's known negative, thus the unsigned bounds capture the * signed bounds * 3) the signed bounds cross zero, so they tell us nothing * about the result * If the value in dst_reg is known nonnegative, then again the * unsigned bounts capture the signed bounds. * Thus, in all cases it suffices to blow away our signed bounds * and rely on inferring new ones from the unsigned bounds and * var_off of the result. */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; dst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val); dst_reg->umin_value >>= umax_val; dst_reg->umax_value >>= umin_val; /* Its not easy to operate on alu32 bounds here because it depends * on bits being shifted in. Take easy way out and mark unbounded * so we can recalculate later from tnum. */ __mark_reg32_unbounded(dst_reg); __update_reg_bounds(dst_reg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224802, "input": "static int pep_ioctl(struct sock *sk, int cmd, unsigned long arg) { struct pep_sock *pn = pep_sk(sk); int answ; int ret = -ENOIOCTLCMD; switch (cmd) { case SIOCINQ: if (sk->sk_state == TCP_LISTEN) { ret = -EINVAL; break; } lock_sock(sk); if (sock_flag(sk, SOCK_URGINLINE) && !skb_queue_empty(&pn->ctrlreq_queue)) answ = skb_peek(&pn->ctrlreq_queue)->len; else if (!skb_queue_empty(&sk->sk_receive_queue)) answ = skb_peek(&sk->sk_receive_queue)->len; else answ = 0; release_sock(sk); ret = put_user(answ, (int __user *)arg); break; case SIOCPNENABLEPIPE: lock_sock(sk); if (sk->sk_state == TCP_SYN_SENT) ret = -EBUSY; else if (sk->sk_state == TCP_ESTABLISHED) ret = -EISCONN; else ret = pep_sock_enable(sk, NULL, 0); release_sock(sk); break; } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393259, "input": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexIsPartial) { params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS; AlwaysFalseMatchExpression matchExpr; addIndex(BSON(\"a\" << 1), &matchExpr); runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\")); assertNumSolutions(1); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1}, node: \" \"{cscan: {dir: 1}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265802, "input": "void CWebAuth::AcceptedLogin(CUser& User) { if (m_pWebSock) { std::shared_ptr spSession = m_pWebSock->GetSession(); spSession->SetUser(&User); m_pWebSock->SetLoggedIn(true); m_pWebSock->UnPauseRead(); if (m_bBasic) { m_pWebSock->ReadLine(\"\"); } else { m_pWebSock->Redirect(\"/?cookie_check=true\"); } DEBUG(\"Successful login attempt ==> USER [\" + User.GetUserName() + \"] ==> SESSION [\" + spSession->GetId() + \"]\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439902, "input": "ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, uint32_t default_ttl, const ldns_rdf *origin, ldns_rdf **prev) { return ldns_rr_new_frm_str_internal(newrr, str, default_ttl, origin, prev, false); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244789, "input": "static void skip_bits(struct rar5* rar, int bits) { const int new_bits = rar->bits.bit_addr + bits; rar->bits.in_addr += new_bits >> 3; rar->bits.bit_addr = new_bits & 7; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409617, "input": "static BOOL rdp_read_large_pointer_capability_set(wStream* s, UINT16 length, rdpSettings* settings) { UINT16 largePointerSupportFlags; if (length < 6) return FALSE; Stream_Read_UINT16(s, largePointerSupportFlags); /* largePointerSupportFlags (2 bytes) */ settings->LargePointerFlag = largePointerSupportFlags & (LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384); if ((largePointerSupportFlags & ~(LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384)) != 0) { WLog_WARN( TAG, \"TS_LARGE_POINTER_CAPABILITYSET with unsupported flags %04X (all flags %04X) received\", largePointerSupportFlags & ~(LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384), largePointerSupportFlags); } return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 313033, "input": "u_freeentries( buf_T *buf, u_header_T *uhp, u_header_T **uhpp) /* if not NULL reset when freeing this header */ { u_entry_T *uep, *nuep; /* Check for pointers to the header that become invalid now. */ if (buf->b_u_curhead == uhp) buf->b_u_curhead = NULL; if (buf->b_u_newhead == uhp) buf->b_u_newhead = NULL; /* freeing the newest entry */ if (uhpp != NULL && uhp == *uhpp) *uhpp = NULL; for (uep = uhp->uh_entry; uep != NULL; uep = nuep) { nuep = uep->ue_next; u_freeentry(uep, uep->ue_size); } #ifdef U_DEBUG uhp->uh_magic = 0; #endif vim_free((char_u *)uhp); --buf->b_u_numhead; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 414965, "input": "get_cached_region (GeglOperation *operation, const GeglRectangle *roi) { return get_bounding_box (operation); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 278018, "input": "completeopt_was_set(void) { compl_no_insert = FALSE; compl_no_select = FALSE; if (strstr((char *)p_cot, \"noselect\") != NULL) compl_no_select = TRUE; if (strstr((char *)p_cot, \"noinsert\") != NULL) compl_no_insert = TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198448, "input": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast(node->builtin_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input)); TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, kOutputTensor, &output)); TF_LITE_ENSURE_EQ(context, NumDimensions(input), 4); auto data_type = output->type; TF_LITE_ENSURE(context, data_type == kTfLiteFloat32 || data_type == kTfLiteUInt8 || data_type == kTfLiteInt8 || data_type == kTfLiteInt32 || data_type == kTfLiteInt64); TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type); const int block_size = params->block_size; const int input_height = input->dims->data[1]; const int input_width = input->dims->data[2]; int output_height = input_height / block_size; int output_width = input_width / block_size; TF_LITE_ENSURE_EQ(context, input_height, output_height * block_size); TF_LITE_ENSURE_EQ(context, input_width, output_width * block_size); TfLiteIntArray* output_size = TfLiteIntArrayCreate(4); output_size->data[0] = input->dims->data[0]; output_size->data[1] = output_height; output_size->data[2] = output_width; output_size->data[3] = input->dims->data[3] * block_size * block_size; return context->ResizeTensor(context, output, output_size); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The `Prepare` step of the `SpaceToDepth` TFLite operator does not check for 0 before division(https://github.com/tensorflow/tensorflow/blob/5f7975d09eac0f10ed8a17dbb6f5964977725adc/tensorflow/lite/kernels/space_to_depth.cc#L63-L67). An attacker can craft a model such that `params->block_size` would be zero. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-29587"}} -{"idx": 414969, "input": "ppm_load_read_header(FILE *fp, pnm_struct *img) { /* PPM Headers Variable Declaration */ gchar *ptr; //gchar *retval; gchar header[MAX_CHARS_IN_ROW]; gint maxval; /* Check the PPM file Type P2 or P5 */ fgets (header,MAX_CHARS_IN_ROW,fp); if (header[0] != ASCII_P || (header[1] != PIXMAP_ASCII && header[1] != PIXMAP_RAW)) { g_warning (\"Image is not a portable pixmap\"); return FALSE; } img->type = header[1]; /* Check the Comments */ fgets (header,MAX_CHARS_IN_ROW,fp); while(header[0] == '#') { fgets (header,MAX_CHARS_IN_ROW,fp); } /* Get Width and Height */ errno = 0; img->width = strtol (header,&ptr,10); if (errno) { g_warning (\"Error reading width: %s\", strerror(errno)); return FALSE; } else if (img->width < 0) { g_warning (\"Error: width is negative\"); return FALSE; } img->height = strtol (ptr,&ptr,10); if (errno) { g_warning (\"Error reading height: %s\", strerror(errno)); return FALSE; } else if (img->width < 0) { g_warning (\"Error: height is negative\"); return FALSE; } fgets (header,MAX_CHARS_IN_ROW,fp); maxval = strtol (header,&ptr,10); if ((maxval != 255) && (maxval != 65535)) { g_warning (\"Image is not an 8-bit or 16-bit portable pixmap\"); return FALSE; } switch (maxval) { case 255: img->bpc = sizeof (guchar); break; case 65535: img->bpc = sizeof (gushort); break; default: g_warning (\"%s: Programmer stupidity error\", G_STRLOC); } /* Later on, img->numsamples is multiplied with img->bpc to allocate * memory. Ensure it doesn't overflow. */ if (!img->width || !img->height || G_MAXSIZE / img->width / img->height / CHANNEL_COUNT < img->bpc) { g_warning (\"Illegal width/height: %ld/%ld\", img->width, img->height); return FALSE; } img->numsamples = img->width * img->height * CHANNEL_COUNT; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357387, "input": "static OPJ_BOOL opj_j2k_read_header_procedure(opj_j2k_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager) { OPJ_UINT32 l_current_marker; OPJ_UINT32 l_marker_size; const opj_dec_memory_marker_handler_t * l_marker_handler = 00; OPJ_BOOL l_has_siz = 0; OPJ_BOOL l_has_cod = 0; OPJ_BOOL l_has_qcd = 0; /* preconditions */ assert(p_stream != 00); assert(p_j2k != 00); assert(p_manager != 00); /* We enter in the main header */ p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_MHSOC; /* Try to read the SOC marker, the codestream must begin with SOC marker */ if (! opj_j2k_read_soc(p_j2k, p_stream, p_manager)) { opj_event_msg(p_manager, EVT_ERROR, \"Expected a SOC marker \\n\"); return OPJ_FALSE; } /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */ if (opj_stream_read_data(p_stream, p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) { opj_event_msg(p_manager, EVT_ERROR, \"Stream too short\\n\"); return OPJ_FALSE; } /* Read 2 bytes as the new marker ID */ opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_current_marker, 2); /* Try to read until the SOT is detected */ while (l_current_marker != J2K_MS_SOT) { /* Check if the current marker ID is valid */ if (l_current_marker < 0xff00) { opj_event_msg(p_manager, EVT_ERROR, \"A marker ID was expected (0xff--) instead of %.8x\\n\", l_current_marker); return OPJ_FALSE; } /* Get the marker handler from the marker ID */ l_marker_handler = opj_j2k_get_marker_handler(l_current_marker); /* Manage case where marker is unknown */ if (l_marker_handler->id == J2K_MS_UNK) { if (! opj_j2k_read_unk(p_j2k, p_stream, &l_current_marker, p_manager)) { opj_event_msg(p_manager, EVT_ERROR, \"Unknow marker have been detected and generated error.\\n\"); return OPJ_FALSE; } if (l_current_marker == J2K_MS_SOT) { break; /* SOT marker is detected main header is completely read */ } else { /* Get the marker handler from the marker ID */ l_marker_handler = opj_j2k_get_marker_handler(l_current_marker); } } if (l_marker_handler->id == J2K_MS_SIZ) { /* Mark required SIZ marker as found */ l_has_siz = 1; } if (l_marker_handler->id == J2K_MS_COD) { /* Mark required COD marker as found */ l_has_cod = 1; } if (l_marker_handler->id == J2K_MS_QCD) { /* Mark required QCD marker as found */ l_has_qcd = 1; } /* Check if the marker is known and if it is the right place to find it */ if (!(p_j2k->m_specific_param.m_decoder.m_state & l_marker_handler->states)) { opj_event_msg(p_manager, EVT_ERROR, \"Marker is not compliant with its position\\n\"); return OPJ_FALSE; } /* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */ if (opj_stream_read_data(p_stream, p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) { opj_event_msg(p_manager, EVT_ERROR, \"Stream too short\\n\"); return OPJ_FALSE; } /* read 2 bytes as the marker size */ opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_marker_size, 2); if (l_marker_size < 2) { opj_event_msg(p_manager, EVT_ERROR, \"Invalid marker size\\n\"); return OPJ_FALSE; } l_marker_size -= 2; /* Subtract the size of the marker ID already read */ /* Check if the marker size is compatible with the header data size */ if (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) { OPJ_BYTE *new_header_data = (OPJ_BYTE *) opj_realloc( p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size); if (! new_header_data) { opj_free(p_j2k->m_specific_param.m_decoder.m_header_data); p_j2k->m_specific_param.m_decoder.m_header_data = NULL; p_j2k->m_specific_param.m_decoder.m_header_data_size = 0; opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to read header\\n\"); return OPJ_FALSE; } p_j2k->m_specific_param.m_decoder.m_header_data = new_header_data; p_j2k->m_specific_param.m_decoder.m_header_data_size = l_marker_size; } /* Try to read the rest of the marker segment from stream and copy them into the buffer */ if (opj_stream_read_data(p_stream, p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager) != l_marker_size) { opj_event_msg(p_manager, EVT_ERROR, \"Stream too short\\n\"); return OPJ_FALSE; } /* Read the marker segment with the correct marker handler */ if (!(*(l_marker_handler->handler))(p_j2k, p_j2k->m_specific_param.m_decoder.m_header_data, l_marker_size, p_manager)) { opj_event_msg(p_manager, EVT_ERROR, \"Marker handler function failed to read the marker segment\\n\"); return OPJ_FALSE; } /* Add the marker to the codestream index*/ if (OPJ_FALSE == opj_j2k_add_mhmarker( p_j2k->cstr_index, l_marker_handler->id, (OPJ_UINT32) opj_stream_tell(p_stream) - l_marker_size - 4, l_marker_size + 4)) { opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to add mh marker\\n\"); return OPJ_FALSE; } /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */ if (opj_stream_read_data(p_stream, p_j2k->m_specific_param.m_decoder.m_header_data, 2, p_manager) != 2) { opj_event_msg(p_manager, EVT_ERROR, \"Stream too short\\n\"); return OPJ_FALSE; } /* read 2 bytes as the new marker ID */ opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data, &l_current_marker, 2); } if (l_has_siz == 0) { opj_event_msg(p_manager, EVT_ERROR, \"required SIZ marker not found in main header\\n\"); return OPJ_FALSE; } if (l_has_cod == 0) { opj_event_msg(p_manager, EVT_ERROR, \"required COD marker not found in main header\\n\"); return OPJ_FALSE; } if (l_has_qcd == 0) { opj_event_msg(p_manager, EVT_ERROR, \"required QCD marker not found in main header\\n\"); return OPJ_FALSE; } if (! opj_j2k_merge_ppm(&(p_j2k->m_cp), p_manager)) { opj_event_msg(p_manager, EVT_ERROR, \"Failed to merge PPM data\\n\"); return OPJ_FALSE; } opj_event_msg(p_manager, EVT_INFO, \"Main header has been correctly decoded.\\n\"); /* Position of the last element if the main header */ p_j2k->cstr_index->main_head_end = (OPJ_UINT32) opj_stream_tell(p_stream) - 2; /* Next step: read a tile-part header */ p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_TPHSOT; return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394637, "input": "LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n) { const char *name = NULL; if (ar) { TValue *o = debug_localname(L, ar, &name, (BCReg)n); if (name) { copyTV(L, L->top, o); incr_top(L); } } else if (tvisfunc(L->top-1) && isluafunc(funcV(L->top-1))) { name = debug_varname(funcproto(funcV(L->top-1)), 0, (BCReg)n-1); } return name; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354564, "input": "static void kvm_s390_set_crycb_format(struct kvm *kvm) { kvm->arch.crypto.crycbd = (__u32)(unsigned long) kvm->arch.crypto.crycb; /* Clear the CRYCB format bits - i.e., set format 0 by default */ kvm->arch.crypto.crycbd &= ~(CRYCB_FORMAT_MASK); /* Check whether MSAX3 is installed */ if (!test_kvm_facility(kvm, 76)) return; if (kvm_s390_apxa_installed()) kvm->arch.crypto.crycbd |= CRYCB_FORMAT2; else kvm->arch.crypto.crycbd |= CRYCB_FORMAT1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381726, "input": "static long evdev_ioctl_handler(struct file *file, unsigned int cmd, void __user *p, int compat_mode) { struct evdev_client *client = file->private_data; struct evdev *evdev = client->evdev; int retval; retval = mutex_lock_interruptible(&evdev->mutex); if (retval) return retval; if (!evdev->exist) { retval = -ENODEV; goto out; } retval = evdev_do_ioctl(file, cmd, p, compat_mode); out: mutex_unlock(&evdev->mutex); return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468954, "input": "static int __ip6_append_data(struct sock *sk, struct flowi6 *fl6, struct sk_buff_head *queue, struct inet_cork *cork, struct inet6_cork *v6_cork, struct page_frag *pfrag, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), void *from, int length, int transhdrlen, unsigned int flags, struct ipcm6_cookie *ipc6, const struct sockcm_cookie *sockc) { struct sk_buff *skb, *skb_prev = NULL; unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu; int exthdrlen = 0; int dst_exthdrlen = 0; int hh_len; int copy; int err; int offset = 0; __u8 tx_flags = 0; u32 tskey = 0; struct rt6_info *rt = (struct rt6_info *)cork->dst; struct ipv6_txoptions *opt = v6_cork->opt; int csummode = CHECKSUM_NONE; unsigned int maxnonfragsize, headersize; skb = skb_peek_tail(queue); if (!skb) { exthdrlen = opt ? opt->opt_flen : 0; dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; } mtu = cork->fragsize; orig_mtu = mtu; hh_len = LL_RESERVED_SPACE(rt->dst.dev); fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + (opt ? opt->opt_nflen : 0); maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); headersize = sizeof(struct ipv6hdr) + (opt ? opt->opt_flen + opt->opt_nflen : 0) + (dst_allfrag(&rt->dst) ? sizeof(struct frag_hdr) : 0) + rt->rt6i_nfheader_len; if (cork->length + length > mtu - headersize && ipc6->dontfrag && (sk->sk_protocol == IPPROTO_UDP || sk->sk_protocol == IPPROTO_RAW)) { ipv6_local_rxpmtu(sk, fl6, mtu - headersize + sizeof(struct ipv6hdr)); goto emsgsize; } if (ip6_sk_ignore_df(sk)) maxnonfragsize = sizeof(struct ipv6hdr) + IPV6_MAXPLEN; else maxnonfragsize = mtu; if (cork->length + length > maxnonfragsize - headersize) { emsgsize: ipv6_local_error(sk, EMSGSIZE, fl6, mtu - headersize + sizeof(struct ipv6hdr)); return -EMSGSIZE; } /* CHECKSUM_PARTIAL only with no extension headers and when * we are not going to fragment */ if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && headersize == sizeof(struct ipv6hdr) && length <= mtu - headersize && !(flags & MSG_MORE) && rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) csummode = CHECKSUM_PARTIAL; if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) { sock_tx_timestamp(sk, sockc->tsflags, &tx_flags); if (tx_flags & SKBTX_ANY_SW_TSTAMP && sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) tskey = sk->sk_tskey++; } /* * Let's try using as much space as possible. * Use MTU if total length of the message fits into the MTU. * Otherwise, we need to reserve fragment header and * fragment alignment (= 8-15 octects, in total). * * Note that we may need to \"move\" the data from the tail of * of the buffer to the new fragment when we split * the message. * * FIXME: It may be fragmented into multiple chunks * at once if non-fragmentable extension headers * are too large. * --yoshfuji */ cork->length += length; if ((skb && skb_is_gso(skb)) || (((length + (skb ? skb->len : headersize)) > mtu) && (skb_queue_len(queue) <= 1) && (sk->sk_protocol == IPPROTO_UDP) && (rt->dst.dev->features & NETIF_F_UFO) && !dst_xfrm(&rt->dst) && (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk))) { err = ip6_ufo_append_data(sk, queue, getfrag, from, length, hh_len, fragheaderlen, exthdrlen, transhdrlen, mtu, flags, fl6); if (err) goto error; return 0; } if (!skb) goto alloc_new_skb; while (length > 0) { /* Check if the remaining data fits into current packet. */ copy = (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - skb->len; if (copy < length) copy = maxfraglen - skb->len; if (copy <= 0) { char *data; unsigned int datalen; unsigned int fraglen; unsigned int fraggap; unsigned int alloclen; alloc_new_skb: /* There's no room in the current skb */ if (skb) fraggap = skb->len - maxfraglen; else fraggap = 0; /* update mtu and maxfraglen if necessary */ if (!skb || !skb_prev) ip6_append_data_mtu(&mtu, &maxfraglen, fragheaderlen, skb, rt, orig_mtu); skb_prev = skb; /* * If remaining data exceeds the mtu, * we know we need more fragment(s). */ datalen = length + fraggap; if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen) datalen = maxfraglen - fragheaderlen - rt->dst.trailer_len; if ((flags & MSG_MORE) && !(rt->dst.dev->features&NETIF_F_SG)) alloclen = mtu; else alloclen = datalen + fragheaderlen; alloclen += dst_exthdrlen; if (datalen != length + fraggap) { /* * this is not the last fragment, the trailer * space is regarded as data space. */ datalen += rt->dst.trailer_len; } alloclen += rt->dst.trailer_len; fraglen = datalen + fragheaderlen; /* * We just reserve space for fragment header. * Note: this may be overallocation if the message * (without MSG_MORE) fits into the MTU. */ alloclen += sizeof(struct frag_hdr); copy = datalen - transhdrlen - fraggap; if (copy < 0) { err = -EINVAL; goto error; } if (transhdrlen) { skb = sock_alloc_send_skb(sk, alloclen + hh_len, (flags & MSG_DONTWAIT), &err); } else { skb = NULL; if (refcount_read(&sk->sk_wmem_alloc) <= 2 * sk->sk_sndbuf) skb = sock_wmalloc(sk, alloclen + hh_len, 1, sk->sk_allocation); if (unlikely(!skb)) err = -ENOBUFS; } if (!skb) goto error; /* * Fill in the control structures */ skb->protocol = htons(ETH_P_IPV6); skb->ip_summed = csummode; skb->csum = 0; /* reserve for fragmentation and ipsec header */ skb_reserve(skb, hh_len + sizeof(struct frag_hdr) + dst_exthdrlen); /* Only the initial fragment is time stamped */ skb_shinfo(skb)->tx_flags = tx_flags; tx_flags = 0; skb_shinfo(skb)->tskey = tskey; tskey = 0; /* * Find where to start putting bytes */ data = skb_put(skb, fraglen); skb_set_network_header(skb, exthdrlen); data += fragheaderlen; skb->transport_header = (skb->network_header + fragheaderlen); if (fraggap) { skb->csum = skb_copy_and_csum_bits( skb_prev, maxfraglen, data + transhdrlen, fraggap, 0); skb_prev->csum = csum_sub(skb_prev->csum, skb->csum); data += fraggap; pskb_trim_unique(skb_prev, maxfraglen); } if (copy > 0 && getfrag(from, data + transhdrlen, offset, copy, fraggap, skb) < 0) { err = -EFAULT; kfree_skb(skb); goto error; } offset += copy; length -= datalen - fraggap; transhdrlen = 0; exthdrlen = 0; dst_exthdrlen = 0; if ((flags & MSG_CONFIRM) && !skb_prev) skb_set_dst_pending_confirm(skb, 1); /* * Put the packet on the pending queue */ __skb_queue_tail(queue, skb); continue; } if (copy > length) copy = length; if (!(rt->dst.dev->features&NETIF_F_SG)) { unsigned int off; off = skb->len; if (getfrag(from, skb_put(skb, copy), offset, copy, off, skb) < 0) { __skb_trim(skb, off); err = -EFAULT; goto error; } } else { int i = skb_shinfo(skb)->nr_frags; err = -ENOMEM; if (!sk_page_frag_refill(sk, pfrag)) goto error; if (!skb_can_coalesce(skb, i, pfrag->page, pfrag->offset)) { err = -EMSGSIZE; if (i == MAX_SKB_FRAGS) goto error; __skb_fill_page_desc(skb, i, pfrag->page, pfrag->offset, 0); skb_shinfo(skb)->nr_frags = ++i; get_page(pfrag->page); } copy = min_t(int, copy, pfrag->size - pfrag->offset); if (getfrag(from, page_address(pfrag->page) + pfrag->offset, offset, copy, skb->len, skb) < 0) goto error_efault; pfrag->offset += copy; skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); skb->len += copy; skb->data_len += copy; skb->truesize += copy; refcount_add(copy, &sk->sk_wmem_alloc); } offset += copy; length -= copy; } return 0; error_efault: err = -EFAULT; error: cork->length -= length; IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 210109, "input": "int init_aliases(void) { FILE *fp; char alias[MAXALIASLEN + 1U]; char dir[PATH_MAX + 1U]; if ((fp = fopen(ALIASES_FILE, \"r\")) == NULL) { return 0; } while (fgets(alias, sizeof alias, fp) != NULL) { if (*alias == '#' || *alias == '\\n' || *alias == 0) { continue; } { char * const z = alias + strlen(alias) - 1U; if (*z != '\\n') { goto bad; } *z = 0; } do { if (fgets(dir, sizeof dir, fp) == NULL || *dir == 0) { goto bad; } { char * const z = dir + strlen(dir) - 1U; if (*z == '\\n') { *z = 0; } } } while (*dir == '#' || *dir == 0); if (head == NULL) { if ((head = tail = malloc(sizeof *head)) == NULL || (tail->alias = strdup(alias)) == NULL || (tail->dir = strdup(dir)) == NULL) { die_mem(); } tail->next = NULL; } else { DirAlias *curr; if ((curr = malloc(sizeof *curr)) == NULL || (curr->alias = strdup(alias)) == NULL || (curr->dir = strdup(dir)) == NULL) { die_mem(); } tail->next = curr; tail = curr; } } fclose(fp); aliases_up++; return 0; bad: fclose(fp); logfile(LOG_ERR, MSG_ALIASES_BROKEN_FILE \" [\" ALIASES_FILE \"]\"); return -1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Access of Uninitialized Pointer"], "explanation": "An issue was discovered in Pure-FTPd 1.0.49. An uninitialized pointer vulnerability has been detected in the diraliases linked list. When the *lookup_alias(const char alias) or print_aliases(void) function is called, they fail to correctly detect the end of the linked list and try to access a non-existent list member. This is related to init_aliases in diraliases.c.", "severity_level": "NoInfo", "cwe": "CWE-824", "cve": "CVE-2020-9274"}} -{"idx": 330518, "input": "static void vnc_dpy_copy(DisplayChangeListener *dcl, int src_x, int src_y, int dst_x, int dst_y, int w, int h) { VncDisplay *vd = container_of(dcl, VncDisplay, dcl); VncState *vs, *vn; uint8_t *src_row; uint8_t *dst_row; int i, x, y, pitch, inc, w_lim, s; int cmp_bytes; if (!vd->server) { /* no client connected */ return; } vnc_refresh_server_surface(vd); QTAILQ_FOREACH_SAFE(vs, &vd->clients, next, vn) { if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) { vs->force_update = 1; vnc_update_client(vs, 1, true); /* vs might be free()ed here */ } } /* do bitblit op on the local surface too */ pitch = vnc_server_fb_stride(vd); src_row = vnc_server_fb_ptr(vd, src_x, src_y); dst_row = vnc_server_fb_ptr(vd, dst_x, dst_y); y = dst_y; inc = 1; if (dst_y > src_y) { /* copy backwards */ src_row += pitch * (h-1); dst_row += pitch * (h-1); pitch = -pitch; y = dst_y + h - 1; inc = -1; } w_lim = w - (VNC_DIRTY_PIXELS_PER_BIT - (dst_x % VNC_DIRTY_PIXELS_PER_BIT)); if (w_lim < 0) { w_lim = w; } else { w_lim = w - (w_lim % VNC_DIRTY_PIXELS_PER_BIT); } for (i = 0; i < h; i++) { for (x = 0; x <= w_lim; x += s, src_row += cmp_bytes, dst_row += cmp_bytes) { if (x == w_lim) { if ((s = w - w_lim) == 0) break; } else if (!x) { s = (VNC_DIRTY_PIXELS_PER_BIT - (dst_x % VNC_DIRTY_PIXELS_PER_BIT)); s = MIN(s, w_lim); } else { s = VNC_DIRTY_PIXELS_PER_BIT; } cmp_bytes = s * VNC_SERVER_FB_BYTES; if (memcmp(src_row, dst_row, cmp_bytes) == 0) continue; memmove(dst_row, src_row, cmp_bytes); QTAILQ_FOREACH(vs, &vd->clients, next) { if (!vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) { set_bit(((x + dst_x) / VNC_DIRTY_PIXELS_PER_BIT), vs->dirty[y]); } } } src_row += pitch - w * VNC_SERVER_FB_BYTES; dst_row += pitch - w * VNC_SERVER_FB_BYTES; y += inc; } QTAILQ_FOREACH(vs, &vd->clients, next) { if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) { vnc_copy(vs, src_x, src_y, dst_x, dst_y, w, h); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458336, "input": "static int hidinput_open(struct input_dev *dev) { struct hid_device *hid = input_get_drvdata(dev); return hid_hw_open(hid); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506570, "input": "do_command() { t_iterator *do_iterator; int do_start, do_end; int end_token; char *clause; c_token++; do_iterator = check_for_iteration(); if (forever_iteration(do_iterator)) { cleanup_iteration(do_iterator); int_error(c_token-2, \"unbounded iteration not accepted here\"); } if (!equals(c_token,\"{\")) { cleanup_iteration(do_iterator); int_error(c_token,\"expecting {do-clause}\"); } end_token = find_clause(&do_start, &do_end); clause = new_clause(do_start, do_end); begin_clause(); iteration_depth++; /* Sometimes the start point of a nested iteration is not within the * limits for all levels of nesting. In this case we need to advance * through the iteration to find the first good set of indices. * If we don't find one, forget the whole thing. */ if (empty_iteration(do_iterator) && !next_iteration(do_iterator)) { strcpy(clause, \";\"); } do { requested_continue = FALSE; do_string(clause); if (command_exit_requested != 0) requested_break = TRUE; if (requested_break) break; } while (next_iteration(do_iterator)); iteration_depth--; free(clause); end_clause(); c_token = end_token; /* FIXME: If any of the above exited via int_error() then this */ /* cleanup never happens and we leak memory. But do_iterator can */ /* not be static or global because do_command() can recurse. */ do_iterator = cleanup_iteration(do_iterator); requested_break = FALSE; requested_continue = FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 341921, "input": "static void fuse_link_write_file(struct file *file) { struct inode *inode = file_inode(file); struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_file *ff = file->private_data; /* * file may be written through mmap, so chain it onto the * inodes's write_file list */ spin_lock(&fi->lock); if (list_empty(&ff->write_entry)) list_add(&ff->write_entry, &fi->write_files); spin_unlock(&fi->lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458970, "input": "tsize_t t2p_write_pdf_string(const char* pdfstr, TIFF* output) { tsize_t written = 0; uint32 i = 0; char buffer[64]; size_t len = 0; len = strlen(pdfstr); written += t2pWriteFile(output, (tdata_t) \"(\", 1); for (i=0; i_data = NULL; } if (rd_buf) { rd_buf->_data = NULL; } if (!new || !owner || !ttl || !clas || !rdata || !rr_buf || !rd_buf || !rd || !xtok) { goto memerror; } ldns_buffer_new_frm_data(rr_buf, (char*)str, strlen(str)); /* split the rr in its parts -1 signals trouble */ if (ldns_bget_token(rr_buf, owner, \"\\t\\n \", LDNS_MAX_DOMAINLEN) == -1){ status = LDNS_STATUS_SYNTAX_ERR; goto error; } if (ldns_bget_token(rr_buf, ttl, \"\\t\\n \", LDNS_TTL_DATALEN) == -1) { status = LDNS_STATUS_SYNTAX_TTL_ERR; goto error; } ttl_val = (uint32_t) ldns_str2period(ttl, &endptr); if (strlen(ttl) > 0 && !isdigit((int) ttl[0])) { /* ah, it's not there or something */ if (default_ttl == 0) { ttl_val = LDNS_DEFAULT_TTL; } else { ttl_val = default_ttl; } /* we not ASSUMING the TTL is missing and that * the rest of the RR is still there. That is * CLASS TYPE RDATA * so ttl value we read is actually the class */ clas_val = ldns_get_rr_class_by_name(ttl); /* class can be left out too, assume IN, current * token must be type */ if (clas_val == 0) { clas_val = LDNS_RR_CLASS_IN; type_sz = strlen(ttl) + 1; type = LDNS_XMALLOC(char, type_sz); if (!type) { goto memerror; } strlcpy(type, ttl, type_sz); } } else { if (-1 == ldns_bget_token( rr_buf, clas, \"\\t\\n \", LDNS_SYNTAX_DATALEN)) { status = LDNS_STATUS_SYNTAX_CLASS_ERR; goto error; } clas_val = ldns_get_rr_class_by_name(clas); /* class can be left out too, assume IN, current * token must be type */ if (clas_val == 0) { clas_val = LDNS_RR_CLASS_IN; type_sz = strlen(clas) + 1; type = LDNS_XMALLOC(char, type_sz); if (!type) { goto memerror; } strlcpy(type, clas, type_sz); } } /* the rest should still be waiting for us */ if (!type) { type = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); if (!type) { goto memerror; } if (-1 == ldns_bget_token( rr_buf, type, \"\\t\\n \", LDNS_SYNTAX_DATALEN)) { status = LDNS_STATUS_SYNTAX_TYPE_ERR; goto error; } } if (ldns_bget_token(rr_buf, rdata, \"\\0\", LDNS_MAX_PACKETLEN) == -1) { /* apparently we are done, and it's only a question RR * so do not set status and go to ldnserror here */ } ldns_buffer_new_frm_data(rd_buf, rdata, strlen(rdata)); if (strlen(owner) <= 1 && strncmp(owner, \"@\", 1) == 0) { if (origin) { ldns_rr_set_owner(new, ldns_rdf_clone(origin)); } else if (prev && *prev) { ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); } else { /* default to root */ ldns_rr_set_owner(new, ldns_dname_new_frm_str(\".\")); } /* @ also overrides prev */ if (prev) { ldns_rdf_deep_free(*prev); *prev = ldns_rdf_clone(ldns_rr_owner(new)); if (!*prev) { goto memerror; } } } else { if (strlen(owner) == 0) { /* no ownername was given, try prev, if that fails * origin, else default to root */ if (prev && *prev) { ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); } else if (origin) { ldns_rr_set_owner(new, ldns_rdf_clone(origin)); } else { ldns_rr_set_owner(new, ldns_dname_new_frm_str(\".\")); } if(!ldns_rr_owner(new)) { goto memerror; } } else { owner_dname = ldns_dname_new_frm_str(owner); if (!owner_dname) { status = LDNS_STATUS_SYNTAX_ERR; goto error; } ldns_rr_set_owner(new, owner_dname); if (!ldns_dname_str_absolute(owner) && origin) { if(ldns_dname_cat(ldns_rr_owner(new), origin) != LDNS_STATUS_OK) { status = LDNS_STATUS_SYNTAX_ERR; goto error; } } if (prev) { ldns_rdf_deep_free(*prev); *prev = ldns_rdf_clone(ldns_rr_owner(new)); if (!*prev) { goto error; } } } } LDNS_FREE(owner); ldns_rr_set_question(new, question); ldns_rr_set_ttl(new, ttl_val); LDNS_FREE(ttl); ldns_rr_set_class(new, clas_val); LDNS_FREE(clas); rr_type = ldns_get_rr_type_by_name(type); LDNS_FREE(type); desc = ldns_rr_descript((uint16_t)rr_type); ldns_rr_set_type(new, rr_type); if (desc) { /* only the rdata remains */ r_max = ldns_rr_descriptor_maximum(desc); r_min = ldns_rr_descriptor_minimum(desc); } else { r_min = 0; r_max = 1; } for (done = false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) { quoted = false; switch (ldns_rr_descriptor_field_type(desc, r_cnt)) { case LDNS_RDF_TYPE_B64 : case LDNS_RDF_TYPE_HEX : /* These rdf types may con- */ case LDNS_RDF_TYPE_LOC : /* tain whitespace, only if */ case LDNS_RDF_TYPE_WKS : /* it is the last rd field. */ case LDNS_RDF_TYPE_IPSECKEY : case LDNS_RDF_TYPE_AMTRELAY : case LDNS_RDF_TYPE_NSEC : if (r_cnt == r_max - 1) { delimiters = \"\\n\"; break; } /* fallthrough */ default : delimiters = \"\\n\\t \"; } if (ldns_rdf_type_maybe_quoted( ldns_rr_descriptor_field_type( desc, r_cnt)) && ldns_buffer_remaining(rd_buf) > 0){ /* skip spaces */ while (*(ldns_buffer_current(rd_buf)) == ' ') { ldns_buffer_skip(rd_buf, 1); } if (*(ldns_buffer_current(rd_buf)) == '\\\"') { delimiters = \"\\\"\\0\"; ldns_buffer_skip(rd_buf, 1); quoted = true; } else if (ldns_rr_descriptor_field_type(desc, r_cnt) == LDNS_RDF_TYPE_LONG_STR) { status = LDNS_STATUS_SYNTAX_RDATA_ERR; goto error; } } /* because number of fields can be variable, we can't rely on * _maximum() only */ /* skip spaces */ while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf) && *(ldns_buffer_current(rd_buf)) == ' ' && !quoted) { ldns_buffer_skip(rd_buf, 1); } pre_data_pos = ldns_buffer_position(rd_buf); if (-1 == (c = ldns_bget_token( rd_buf, rd, delimiters, LDNS_MAX_RDFLEN))) { done = true; (void)done; /* we're breaking, so done not read anymore */ break; } /* hmmz, rfc3597 specifies that any type can be represented * with \\# method, which can contain spaces... * it does specify size though... */ rd_strlen = strlen(rd); /* unknown RR data */ if (strncmp(rd, \"\\\\#\", 2) == 0 && !quoted && (rd_strlen == 2 || rd[2]==' ')) { was_unknown_rr_format = 1; /* go back to before \\# * and skip it while setting delimiters better */ ldns_buffer_set_position(rd_buf, pre_data_pos); delimiters = \"\\n\\t \"; (void)ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); /* read rdata octet length */ c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); if (c == -1) { /* something goes very wrong here */ status = LDNS_STATUS_SYNTAX_RDATA_ERR; goto error; } hex_data_size = (uint16_t) atoi(rd); /* copy hex chars into hex str (2 chars per byte) */ hex_data_str = LDNS_XMALLOC(char, 2*hex_data_size + 1); if (!hex_data_str) { /* malloc error */ goto memerror; } cur_hex_data_size = 0; while(cur_hex_data_size < 2 * hex_data_size) { c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); if (c == -1) { status = LDNS_STATUS_SYNTAX_RDATA_ERR; goto error; } rd_strlen = strlen(rd); if ((size_t)cur_hex_data_size + rd_strlen > 2 * (size_t)hex_data_size) { status = LDNS_STATUS_SYNTAX_RDATA_ERR; goto error; } strlcpy(hex_data_str + cur_hex_data_size, rd, rd_strlen + 1); cur_hex_data_size += rd_strlen; } hex_data_str[cur_hex_data_size] = '\\0'; /* correct the rdf type */ /* if *we* know the type, interpret it as wireformat */ if (desc) { hex_pos = 0; hex_data = LDNS_XMALLOC(uint8_t, hex_data_size+2); if (!hex_data) { goto memerror; } ldns_write_uint16(hex_data, hex_data_size); ldns_hexstring_to_data( hex_data + 2, hex_data_str); status = ldns_wire2rdf(new, hex_data, hex_data_size + 2, &hex_pos); if (status != LDNS_STATUS_OK) { goto error; } LDNS_FREE(hex_data); } else { r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); if (!r) { goto memerror; } ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); if (!ldns_rr_push_rdf(new, r)) { goto memerror; } } LDNS_FREE(hex_data_str); } else if(rd_strlen > 0 || quoted) { /* Normal RR */ switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { case LDNS_RDF_TYPE_HEX: case LDNS_RDF_TYPE_B64: /* When this is the last rdata field, then the * rest should be read in (cause then these * rdf types may contain spaces). */ if (r_cnt == r_max - 1) { c = ldns_bget_token(rd_buf, xtok, \"\\n\", LDNS_MAX_RDFLEN); if (c != -1) { (void) strncat(rd, xtok, LDNS_MAX_RDFLEN - strlen(rd) - 1); } } r = ldns_rdf_new_frm_str( ldns_rr_descriptor_field_type( desc, r_cnt), rd); break; case LDNS_RDF_TYPE_HIP: /* * In presentation format this RDATA type has * three tokens: An algorithm byte, then a * variable length HIT (in hexbytes) and then * a variable length Public Key (in base64). * * We have just read the algorithm, so we need * two more tokens: HIT and Public Key. */ do { /* Read and append HIT */ if (ldns_bget_token(rd_buf, xtok, delimiters, LDNS_MAX_RDFLEN) == -1) break; (void) strncat(rd, \" \", LDNS_MAX_RDFLEN - strlen(rd) - 1); (void) strncat(rd, xtok, LDNS_MAX_RDFLEN - strlen(rd) - 1); /* Read and append Public Key*/ if (ldns_bget_token(rd_buf, xtok, delimiters, LDNS_MAX_RDFLEN) == -1) break; (void) strncat(rd, \" \", LDNS_MAX_RDFLEN - strlen(rd) - 1); (void) strncat(rd, xtok, LDNS_MAX_RDFLEN - strlen(rd) - 1); } while (false); r = ldns_rdf_new_frm_str( ldns_rr_descriptor_field_type( desc, r_cnt), rd); break; case LDNS_RDF_TYPE_DNAME: r = ldns_rdf_new_frm_str( ldns_rr_descriptor_field_type( desc, r_cnt), rd); /* check if the origin should be used * or concatenated */ if (r && ldns_rdf_size(r) > 1 && ldns_rdf_data(r)[0] == 1 && ldns_rdf_data(r)[1] == '@') { ldns_rdf_deep_free(r); r = origin ? ldns_rdf_clone(origin) : ( rr_type == LDNS_RR_TYPE_SOA ? ldns_rdf_clone( ldns_rr_owner(new)) : ldns_rdf_new_frm_str( LDNS_RDF_TYPE_DNAME, \".\") ); } else if (r && rd_strlen >= 1 && origin && !ldns_dname_str_absolute(rd)) { status = ldns_dname_cat(r, origin); if (status != LDNS_STATUS_OK) { goto error; } } break; default: r = ldns_rdf_new_frm_str( ldns_rr_descriptor_field_type( desc, r_cnt), rd); break; } if (!r) { status = LDNS_STATUS_SYNTAX_RDATA_ERR; goto error; } ldns_rr_push_rdf(new, r); } if (quoted) { if (ldns_buffer_available(rd_buf, 1)) { ldns_buffer_skip(rd_buf, 1); } else { done = true; } } } /* for (done = false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) */ LDNS_FREE(rd); LDNS_FREE(xtok); ldns_buffer_free(rr_buf); LDNS_FREE(rdata); if (ldns_buffer_remaining(rd_buf) > 0) { ldns_buffer_free(rd_buf); ldns_rr_free(new); return LDNS_STATUS_SYNTAX_SUPERFLUOUS_TEXT_ERR; } ldns_buffer_free(rd_buf); if (!question && desc && !was_unknown_rr_format && ldns_rr_rd_count(new) < r_min) { ldns_rr_free(new); return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; } if (newrr) { *newrr = new; } else { /* Maybe the caller just wanted to see if it would parse? */ ldns_rr_free(new); } return LDNS_STATUS_OK; memerror: status = LDNS_STATUS_MEM_ERR; error: if (rd_buf && rd_buf->_data) { ldns_buffer_free(rd_buf); } else { LDNS_FREE(rd_buf); } if (rr_buf && rr_buf->_data) { ldns_buffer_free(rr_buf); } else { LDNS_FREE(rr_buf); } LDNS_FREE(type); LDNS_FREE(owner); LDNS_FREE(ttl); LDNS_FREE(clas); LDNS_FREE(hex_data); LDNS_FREE(hex_data_str); LDNS_FREE(xtok); LDNS_FREE(rd); LDNS_FREE(rdata); ldns_rr_free(new); return status; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "When ldns version 1.7.1 verifies a zone file, the ldns_rr_new_frm_str_internal function has a heap out of bounds read vulnerability. An attacker can leak information on the heap by constructing a zone file payload.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-19860"}} -{"idx": 195675, "input": "void CLua::init_libraries() { lua_stack_cleaner clean(state()); // Open Crawl bindings cluaopen_kills(_state); cluaopen_you(_state); cluaopen_item(_state); cluaopen_food(_state); cluaopen_crawl(_state); cluaopen_file(_state); cluaopen_moninf(_state); cluaopen_options(_state); cluaopen_travel(_state); cluaopen_view(_state); cluaopen_spells(_state); cluaopen_globals(_state); execfile(\"dlua/macro.lua\", true, true); // All hook names must be chk_???? execstring(\"chk_startgame = { }\", \"base\"); lua_register(_state, \"loadfile\", _clua_loadfile); lua_register(_state, \"dofile\", _clua_dofile); lua_register(_state, \"crawl_require\", _clua_require); execfile(\"dlua/util.lua\", true, true); execfile(\"dlua/iter.lua\", true, true); execfile(\"dlua/tags.lua\", true, true); execfile(\"dlua/init.lua\", true, true); if (managed_vm) { lua_register(_state, \"pcall\", _clua_guarded_pcall); execfile(\"dlua/userbase.lua\", true, true); execfile(\"dlua/persist.lua\", true, true); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Unrestricted Upload of File with Dangerous Type"], "explanation": "Dungeon Crawl Stone Soup (aka DCSS or crawl) before 0.25 allows remote attackers to execute arbitrary code via Lua bytecode embedded in an uploaded .crawlrc file.", "severity_level": "NoInfo", "cwe": "CWE-434", "cve": "CVE-2020-11722"}} -{"idx": 431082, "input": "static void encode_getfattr(struct xdr_stream *xdr, const u32* bitmask, struct compound_hdr *hdr) { encode_getattr(xdr, nfs4_fattr_bitmap, bitmask, ARRAY_SIZE(nfs4_fattr_bitmap), hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268092, "input": "static int pfkey_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct sk_buff *skb = NULL; struct sadb_msg *hdr = NULL; int err; struct net *net = sock_net(sk); err = -EOPNOTSUPP; if (msg->msg_flags & MSG_OOB) goto out; err = -EMSGSIZE; if ((unsigned int)len > sk->sk_sndbuf - 32) goto out; err = -ENOBUFS; skb = alloc_skb(len, GFP_KERNEL); if (skb == NULL) goto out; err = -EFAULT; if (memcpy_from_msg(skb_put(skb,len), msg, len)) goto out; hdr = pfkey_get_base_msg(skb, &err); if (!hdr) goto out; mutex_lock(&net->xfrm.xfrm_cfg_mutex); err = pfkey_process(sk, skb, hdr); mutex_unlock(&net->xfrm.xfrm_cfg_mutex); out: if (err && hdr && pfkey_error(hdr, err, sk) == 0) err = 0; kfree_skb(skb); return err ? : len; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393063, "input": "TEST_F(QueryPlannerTest, GreaterThanEqual) { addIndex(BSON(\"x\" << 1)); runQuery(BSON(\"x\" << BSON(\"$gte\" << 5))); ASSERT_EQUALS(getNumSolutions(), 2U); assertSolutionExists(\"{cscan: {dir: 1, filter: {x: {$gte: 5}}}}\"); assertSolutionExists( \"{fetch: {filter: null, node: {ixscan: \" \"{filter: null, pattern: {x: 1}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508607, "input": "JOIN_TAB *next_explain_order_tab(JOIN* join, JOIN_TAB* tab) { /* If we're inside SJM nest and have reached its end, get out */ if (tab->last_leaf_in_bush) return tab->bush_root_tab; /* Move to next tab in the array we're traversing */ tab++; if (tab == join->join_tab + join->top_join_tab_count) return NULL; /* Outside SJM nest and reached EOF */ if (tab->bush_children) return tab->bush_children->start; return tab; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383746, "input": "spnego_gss_get_name_attribute(OM_uint32 *minor_status, gss_name_t name, gss_buffer_t attr, int *authenticated, int *complete, gss_buffer_t value, gss_buffer_t display_value, int *more) { OM_uint32 ret; ret = gss_get_name_attribute(minor_status, name, attr, authenticated, complete, value, display_value, more); return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402357, "input": "HttpStateData::abortAll(const char *reason) { debugs(11,5, HERE << \"aborting transaction for \" << reason << \"; \" << serverConnection << \", this \" << this); mustStop(reason); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431966, "input": "static void hci_cc_le_set_ext_scan_param(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_cp_le_set_ext_scan_params *cp; __u8 status = *((__u8 *) skb->data); struct hci_cp_le_scan_phy_params *phy_param; BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); if (status) return; cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_SCAN_PARAMS); if (!cp) return; phy_param = (void *)cp->data; hci_dev_lock(hdev); hdev->le_scan_type = phy_param->type; hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244760, "input": "static int parse_filter_data(struct rar5* rar, const uint8_t* p, uint32_t* filter_data) { int i, bytes; uint32_t data = 0; if(ARCHIVE_OK != read_consume_bits(rar, p, 2, &bytes)) return ARCHIVE_EOF; bytes++; for(i = 0; i < bytes; i++) { uint16_t byte; if(ARCHIVE_OK != read_bits_16(rar, p, &byte)) { return ARCHIVE_EOF; } /* Cast to uint32_t will ensure the shift operation will not * produce undefined result. */ data += ((uint32_t) byte >> 8) << (i * 8); skip_bits(rar, 8); } *filter_data = data; return ARCHIVE_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402307, "input": "clientNegotiateSSL(int fd, void *data) { ConnStateData *conn = (ConnStateData *)data; const int ret = tlsAttemptHandshake(conn, clientNegotiateSSL); if (ret <= 0) { if (ret < 0) // An error conn->clientConnection->close(); return; } Security::SessionPointer session(fd_table[fd].ssl); #if USE_OPENSSL if (Security::SessionIsResumed(session)) { debugs(83, 2, \"Session \" << SSL_get_session(session.get()) << \" reused on FD \" << fd << \" (\" << fd_table[fd].ipaddr << \":\" << (int)fd_table[fd].remote_port << \")\"); } else { if (Debug::Enabled(83, 4)) { /* Write out the SSL session details.. actually the call below, but * OpenSSL headers do strange typecasts confusing GCC.. */ /* PEM_write_SSL_SESSION(debug_log, SSL_get_session(ssl)); */ #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x00908000L PEM_ASN1_write(reinterpret_cast(i2d_SSL_SESSION), PEM_STRING_SSL_SESSION, debug_log, reinterpret_cast(SSL_get_session(session.get())), nullptr, nullptr, 0, nullptr, nullptr); #elif (ALLOW_ALWAYS_SSL_SESSION_DETAIL == 1) /* When using gcc 3.3.x and OpenSSL 0.9.7x sometimes a compile error can occur here. * This is caused by an unpredicatble gcc behaviour on a cast of the first argument * of PEM_ASN1_write(). For this reason this code section is disabled. To enable it, * define ALLOW_ALWAYS_SSL_SESSION_DETAIL=1. * Because there are two possible usable cast, if you get an error here, try the other * commented line. */ PEM_ASN1_write((int(*)())i2d_SSL_SESSION, PEM_STRING_SSL_SESSION, debug_log, reinterpret_cast(SSL_get_session(session.get())), nullptr, nullptr, 0, nullptr, nullptr); /* PEM_ASN1_write((int(*)(...))i2d_SSL_SESSION, PEM_STRING_SSL_SESSION, debug_log, reinterpret_cast(SSL_get_session(session.get())), nullptr, nullptr, 0, nullptr, nullptr); */ #else debugs(83, 4, \"With \" OPENSSL_VERSION_TEXT \", session details are available only defining ALLOW_ALWAYS_SSL_SESSION_DETAIL=1 in the source.\"); #endif /* Note: This does not automatically fflush the log file.. */ } debugs(83, 2, \"New session \" << SSL_get_session(session.get()) << \" on FD \" << fd << \" (\" << fd_table[fd].ipaddr << \":\" << fd_table[fd].remote_port << \")\"); } #else debugs(83, 2, \"TLS session reuse not yet implemented.\"); #endif // Connection established. Retrieve TLS connection parameters for logging. conn->clientConnection->tlsNegotiations()->retrieveNegotiatedInfo(session); #if USE_OPENSSL X509 *client_cert = SSL_get_peer_certificate(session.get()); if (client_cert) { debugs(83, 3, \"FD \" << fd << \" client certificate: subject: \" << X509_NAME_oneline(X509_get_subject_name(client_cert), 0, 0)); debugs(83, 3, \"FD \" << fd << \" client certificate: issuer: \" << X509_NAME_oneline(X509_get_issuer_name(client_cert), 0, 0)); X509_free(client_cert); } else { debugs(83, 5, \"FD \" << fd << \" has no client certificate.\"); } #else debugs(83, 2, \"Client certificate requesting not yet implemented.\"); #endif conn->readSomeData(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509136, "input": "Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509065, "input": "double val_real() { return (double)val_int(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385356, "input": "*/ void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; xmlXPathObjectPtr from; xmlXPathObjectPtr to; xmlBufPtr target; int offset, max; xmlChar ch; const xmlChar *point; xmlChar *cptr; CHECK_ARITY(3); CAST_TO_STRING; to = valuePop(ctxt); CAST_TO_STRING; from = valuePop(ctxt); CAST_TO_STRING; str = valuePop(ctxt); target = xmlBufCreate(); if (target) { max = xmlUTF8Strlen(to->stringval); for (cptr = str->stringval; (ch=*cptr); ) { offset = xmlUTF8Strloc(from->stringval, cptr); if (offset >= 0) { if (offset < max) { point = xmlUTF8Strpos(to->stringval, offset); if (point) xmlBufAdd(target, point, xmlUTF8Strsize(point, 1)); } } else xmlBufAdd(target, cptr, xmlUTF8Strsize(cptr, 1)); /* Step to next character in input */ cptr++; if ( ch & 0x80 ) { /* if not simple ascii, verify proper format */ if ( (ch & 0xc0) != 0xc0 ) { xmlGenericError(xmlGenericErrorContext, \"xmlXPathTranslateFunction: Invalid UTF8 string\\n\"); /* not asserting an XPath error is probably better */ break; } /* then skip over remaining bytes for this char */ while ( (ch <<= 1) & 0x80 ) if ( (*cptr++ & 0xc0) != 0x80 ) { xmlGenericError(xmlGenericErrorContext, \"xmlXPathTranslateFunction: Invalid UTF8 string\\n\"); /* not asserting an XPath error is probably better */ break; } if (ch & 0x80) /* must have had error encountered */ break; } } } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, xmlBufContent(target))); xmlBufFree(target); xmlXPathReleaseObject(ctxt->context, str); xmlXPathReleaseObject(ctxt->context, from);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 245443, "input": "void SpatialMaxPoolGradGrad(OpKernelContext* context, Tensor* bottom_diff, const Tensor& tensor_in, const Tensor& tensor_out, const Tensor& top_diff, const PoolParameters& params, const Padding& padding) { typedef Eigen::Map> ConstEigenMatrixMap; typedef Eigen::Map> EigenMatrixMap; ConstEigenMatrixMap in_mat( tensor_in.flat().data(), params.depth, params.tensor_in_cols * params.tensor_in_rows * params.tensor_in_batch); ConstEigenMatrixMap out_mat( tensor_out.flat().data(), params.depth, params.out_width * params.out_height * params.tensor_in_batch); ConstEigenMatrixMap top_diff_mat( top_diff.flat().data(), params.depth, params.tensor_in_cols * params.tensor_in_rows * params.tensor_in_batch); EigenMatrixMap bottom_diff_mat( bottom_diff->flat().data(), params.depth, params.out_width * params.out_height * params.tensor_in_batch); const DeviceBase::CpuWorkerThreads& worker_threads = *(context->device()->tensorflow_cpu_worker_threads()); // The following code basically does the following: // 1. Flattens the input, output, top_diff and bottom_diff tensors into // two dimensional arrays. // tensor_in_as_matrix: // depth by (tensor_in_cols * tensor_in_rows * tensor_in_batch) // tensor_out_as_matrix: // depth by (out_width * out_height * tensor_in_batch) // top_diff_as_matrix: // depth by (tensor_in_cols * tensor_in_rows * tensor_in_batch) // bottom_diff_as_matrix: // depth by (out_width * out_height * tensor_in_batch) // // 2. Walks through the set of columns in the flattened // tensor_in_as_matrix, tensor_out_as_matrix, top_diff_as_matrix // and updates the column(s) corresponding to the maximum values in // tensor_out_as_matrix with the corresponding values in // top_diff_as_matrix. auto shard = [¶ms, &in_mat, &out_mat, &top_diff_mat, &bottom_diff_mat]( int64 start, int64 limit) { const int32 depth = params.depth; const int32 in_rows = params.tensor_in_rows; const int32 in_cols = params.tensor_in_cols; const int32 pad_top = params.pad_top; const int32 pad_left = params.pad_left; const int32 window_rows = params.window_rows; const int32 window_cols = params.window_cols; const int32 row_stride = params.row_stride; const int32 col_stride = params.col_stride; const int32 out_height = params.out_height; const int32 out_width = params.out_width; { // Initializes the output grad backprop tensor with 0. const int32 output_image_size = out_height * out_width * params.depth; EigenMatrixMap bottom_diff_shard( bottom_diff_mat.data() + start * output_image_size, 1, (limit - start) * output_image_size); bottom_diff_shard.setZero(); } for (int b = start; b < limit; ++b) { for (int ph = 0; ph < out_height; ++ph) { for (int pw = 0; pw < out_width; ++pw) { // (h_start, h_end) * (w_start, w_end) is the range that the input // vector projects to. int h_start = ph * row_stride - pad_top; const int h_end = std::min(h_start + window_rows, in_rows); int w_start = pw * col_stride - pad_left; const int w_end = std::min(w_start + window_cols, in_cols); h_start = std::max(h_start, 0); w_start = std::max(w_start, 0); const int out_index = (b * out_height + ph) * out_width + pw; // Find value corresponding to the input maximum in top_diff. for (int d = 0; d < depth; ++d) { const T& output_ref = out_mat.coeffRef(d, out_index); bool should_stop = false; for (int h = h_start; h < h_end && !should_stop; ++h) { for (int w = w_start; w < w_end && !should_stop; ++w) { const int in_index = (b * in_rows + h) * in_cols + w; const T& input_ref = in_mat.coeffRef(d, in_index); if (output_ref == input_ref) { T& bottom_diff_ref = bottom_diff_mat.coeffRef(d, out_index); bottom_diff_ref = top_diff_mat.coeffRef(d, in_index); should_stop = true; } } } } } } } }; const int64 shard_cost = params.out_width * params.out_height * params.depth * params.window_rows * params.window_cols; Shard(worker_threads.num_threads, worker_threads.workers, params.tensor_in_batch, shard_cost, shard); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385778, "input": "MagickExport Image *ColorMatrixImage(const Image *image, const KernelInfo *color_matrix,ExceptionInfo *exception) { #define ColorMatrixImageTag \"ColorMatrix/Image\" CacheView *color_view, *image_view; double ColorMatrix[6][6] = { { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 }, { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 }, { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 } }; Image *color_image; MagickBooleanType status; MagickOffsetType progress; ssize_t i; ssize_t u, v, y; /* Create color matrix. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); i=0; for (v=0; v < (ssize_t) color_matrix->height; v++) for (u=0; u < (ssize_t) color_matrix->width; u++) { if ((v < 6) && (u < 6)) ColorMatrix[v][u]=color_matrix->values[i]; i++; } /* Initialize color image. */ color_image=CloneImage(image,0,0,MagickTrue,exception); if (color_image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(color_image,DirectClass) == MagickFalse) { InheritException(exception,&color_image->exception); color_image=DestroyImage(color_image); return((Image *) NULL); } if (image->debug != MagickFalse) { char format[MaxTextExtent], *message; (void) LogMagickEvent(TransformEvent,GetMagickModule(), \" ColorMatrix image with color matrix:\"); message=AcquireString(\"\"); for (v=0; v < 6; v++) { *message='\\0'; (void) FormatLocaleString(format,MaxTextExtent,\"%.20g: \",(double) v); (void) ConcatenateString(&message,format); for (u=0; u < 6; u++) { (void) FormatLocaleString(format,MaxTextExtent,\"%+f \", ColorMatrix[v][u]); (void) ConcatenateString(&message,format); } (void) LogMagickEvent(TransformEvent,GetMagickModule(),\"%s\",message); } message=DestroyString(message); } /* ColorMatrix image. */ status=MagickTrue; progress=0; image_view=AcquireVirtualCacheView(image,exception); color_view=AcquireAuthenticCacheView(color_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \\ magick_number_threads(image,color_image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { MagickRealType pixel; const IndexPacket *magick_restrict indexes; const PixelPacket *magick_restrict p; ssize_t x; IndexPacket *magick_restrict color_indexes; PixelPacket *magick_restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); q=GetCacheViewAuthenticPixels(color_view,0,y,color_image->columns,1, exception); if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL)) { status=MagickFalse; continue; } indexes=GetCacheViewVirtualIndexQueue(image_view); color_indexes=GetCacheViewAuthenticIndexQueue(color_view); for (x=0; x < (ssize_t) image->columns; x++) { ssize_t v; size_t height; height=color_matrix->height > 6 ? 6UL : color_matrix->height; for (v=0; v < (ssize_t) height; v++) { pixel=ColorMatrix[v][0]*GetPixelRed(p)+ColorMatrix[v][1]* GetPixelGreen(p)+ColorMatrix[v][2]*GetPixelBlue(p); if (image->matte != MagickFalse) pixel+=ColorMatrix[v][3]*(QuantumRange-GetPixelOpacity(p)); if (image->colorspace == CMYKColorspace) pixel+=ColorMatrix[v][4]*GetPixelIndex(indexes+x); pixel+=QuantumRange*ColorMatrix[v][5]; switch (v) { case 0: SetPixelRed(q,ClampToQuantum(pixel)); break; case 1: SetPixelGreen(q,ClampToQuantum(pixel)); break; case 2: SetPixelBlue(q,ClampToQuantum(pixel)); break; case 3: { if (image->matte != MagickFalse) SetPixelAlpha(q,ClampToQuantum(pixel)); break; } case 4: { if (image->colorspace == CMYKColorspace) SetPixelIndex(color_indexes+x,ClampToQuantum(pixel)); break; } } } p++; q++; } if (SyncCacheViewAuthenticPixels(color_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ColorMatrixImageTag,progress, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } color_view=DestroyCacheView(color_view); image_view=DestroyCacheView(image_view); if (status == MagickFalse) color_image=DestroyImage(color_image); return(color_image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219333, "input": "inline folly::MutableStringPiece StringData::bufferSlice() { assertx(!isImmutable()); return folly::MutableStringPiece{mutableData(), capacity()}; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 505492, "input": "Agraph_t *agraphof(void *obj) { switch (AGTYPE(obj)) { case AGINEDGE: case AGOUTEDGE: return ((Agedge_t *) obj)->node->root; case AGNODE: return ((Agnode_t *) obj)->root; case AGRAPH: return (Agraph_t *) obj; default: /* actually can't occur if only 2 bit tags */ agerr(AGERR, \"agraphof a bad object\"); return NILgraph; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381948, "input": "int oidc_content_handler(request_rec *r) { oidc_cfg *c = ap_get_module_config(r->server->module_config, &auth_openidc_module); int rc = DECLINED; /* track if the session needs to be updated/saved into the cache */ apr_byte_t needs_save = FALSE; oidc_session_t *session = NULL; if (oidc_enabled(r) && oidc_util_request_matches_url(r, oidc_get_redirect_uri(r, c))) { if (oidc_util_request_has_parameter(r, OIDC_REDIRECT_URI_REQUEST_INFO)) { oidc_session_load(r, &session); rc = oidc_handle_existing_session(r, c, session, &needs_save); if (rc == OK) /* handle request for session info */ rc = oidc_handle_info_request(r, c, session, needs_save); /* free resources allocated for the session */ oidc_session_free(r, session); } else if (oidc_util_request_has_parameter(r, OIDC_REDIRECT_URI_REQUEST_JWKS)) { /* handle JWKs request */ rc = oidc_handle_jwks(r, c); } } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269717, "input": "void WebContents::AddWorkSpace(gin_helper::Arguments* args, const base::FilePath& path) { if (path.empty()) { args->ThrowError(\"path cannot be empty\"); return; } DevToolsAddFileSystem(std::string(), path); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330381, "input": "packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, unsigned int optlen) { struct sock *sk = sock->sk; struct packet_sock *po = pkt_sk(sk); int ret; if (level != SOL_PACKET) return -ENOPROTOOPT; switch (optname) { case PACKET_ADD_MEMBERSHIP: case PACKET_DROP_MEMBERSHIP: { struct packet_mreq_max mreq; int len = optlen; memset(&mreq, 0, sizeof(mreq)); if (len < sizeof(struct packet_mreq)) return -EINVAL; if (len > sizeof(mreq)) len = sizeof(mreq); if (copy_from_sockptr(&mreq, optval, len)) return -EFAULT; if (len < (mreq.mr_alen + offsetof(struct packet_mreq, mr_address))) return -EINVAL; if (optname == PACKET_ADD_MEMBERSHIP) ret = packet_mc_add(sk, &mreq); else ret = packet_mc_drop(sk, &mreq); return ret; } case PACKET_RX_RING: case PACKET_TX_RING: { union tpacket_req_u req_u; int len; lock_sock(sk); switch (po->tp_version) { case TPACKET_V1: case TPACKET_V2: len = sizeof(req_u.req); break; case TPACKET_V3: default: len = sizeof(req_u.req3); break; } if (optlen < len) { ret = -EINVAL; } else { if (copy_from_sockptr(&req_u.req, optval, len)) ret = -EFAULT; else ret = packet_set_ring(sk, &req_u, 0, optname == PACKET_TX_RING); } release_sock(sk); return ret; } case PACKET_COPY_THRESH: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; pkt_sk(sk)->copy_thresh = val; return 0; } case PACKET_VERSION: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; switch (val) { case TPACKET_V1: case TPACKET_V2: case TPACKET_V3: break; default: return -EINVAL; } lock_sock(sk); if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY; } else { po->tp_version = val; ret = 0; } release_sock(sk); return ret; } case PACKET_RESERVE: { unsigned int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; if (val > INT_MAX) return -EINVAL; lock_sock(sk); if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY; } else { po->tp_reserve = val; ret = 0; } release_sock(sk); return ret; } case PACKET_LOSS: { unsigned int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; lock_sock(sk); if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY; } else { po->tp_loss = !!val; ret = 0; } release_sock(sk); return ret; } case PACKET_AUXDATA: { int val; if (optlen < sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; lock_sock(sk); po->auxdata = !!val; release_sock(sk); return 0; } case PACKET_ORIGDEV: { int val; if (optlen < sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; lock_sock(sk); po->origdev = !!val; release_sock(sk); return 0; } case PACKET_VNET_HDR: { int val; if (sock->type != SOCK_RAW) return -EINVAL; if (optlen < sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; lock_sock(sk); if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY; } else { po->has_vnet_hdr = !!val; ret = 0; } release_sock(sk); return ret; } case PACKET_TIMESTAMP: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; po->tp_tstamp = val; return 0; } case PACKET_FANOUT: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; return fanout_add(sk, val & 0xffff, val >> 16); } case PACKET_FANOUT_DATA: { if (!po->fanout) return -EINVAL; return fanout_set_data(po, optval, optlen); } case PACKET_IGNORE_OUTGOING: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; if (val < 0 || val > 1) return -EINVAL; po->prot_hook.ignore_outgoing = !!val; return 0; } case PACKET_TX_HAS_OFF: { unsigned int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; lock_sock(sk); if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY; } else { po->tp_tx_has_off = !!val; ret = 0; } release_sock(sk); return 0; } case PACKET_QDISC_BYPASS: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_sockptr(&val, optval, sizeof(val))) return -EFAULT; po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } default: return -ENOPROTOOPT; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269749, "input": "void WebContents::DevToolsClosed() { v8::Locker locker(isolate()); v8::HandleScope handle_scope(isolate()); devtools_web_contents_.Reset(); Emit(\"devtools-closed\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196939, "input": "extern \"C\" int64_t enc_untrusted_syscall(int sysno, ...) { if (!enc_is_error_handler_set()) { enc_set_error_handler(default_error_handler); } asylo::system_call::SystemCallDescriptor descriptor{sysno}; if (!descriptor.is_valid()) { error_handler(\"system_call.cc: Invalid SystemCallDescriptor encountered.\"); } // Collect the passed parameter list into an array. std::array parameters; va_list args; va_start(args, sysno); for (int i = 0; i < descriptor.parameter_count(); i++) { parameters[i] = va_arg(args, uint64_t); } va_end(args); // Allocate a buffer for the serialized request. asylo::primitives::Extent request; asylo::primitives::PrimitiveStatus status; status = asylo::system_call::SerializeRequest(sysno, parameters, &request); if (!status.ok()) { error_handler( \"system_call.cc: Encountered serialization error when serializing \" \"syscall parameters.\"); } std::unique_ptr request_owner(request.As()); // Invoke the system call dispatch callback to execute the system call. uint8_t *response_buffer; size_t response_size; if (!enc_is_syscall_dispatcher_set()) { error_handler(\"system_.cc: system call dispatcher not set.\"); } status = global_syscall_callback(request.As(), request.size(), &response_buffer, &response_size); if (!status.ok()) { error_handler( \"system_call.cc: Callback from syscall dispatcher was unsuccessful.\"); } std::unique_ptr response_owner(response_buffer); if (!response_buffer) { error_handler( \"system_call.cc: null response buffer received for the syscall.\"); } // Copy outputs back into pointer parameters. auto response_reader = asylo::system_call::MessageReader({response_buffer, response_size}); const asylo::primitives::PrimitiveStatus response_status = response_reader.Validate(); if (!response_status.ok()) { error_handler( \"system_call.cc: Error deserializing response buffer into response \" \"reader.\"); } for (int i = 0; i < asylo::system_call::kParameterMax; i++) { asylo::system_call::ParameterDescriptor parameter = descriptor.parameter(i); if (parameter.is_out()) { size_t size; if (parameter.is_fixed()) { size = parameter.size(); } else { size = parameters[parameter.size()] * parameter.element_size(); } const void *src = response_reader.parameter_address(i); void *dst = reinterpret_cast(parameters[i]); if (dst != nullptr) { memcpy(dst, src, size); } } } uint64_t result = response_reader.header()->result; if (static_cast(result) == -1) { int klinux_errno = response_reader.header()->error_number; // Simply having a return value of -1 from a syscall is not a necessary // condition that the syscall failed. Some syscalls can return -1 when // successful (eg., lseek). The reliable way to check for syscall failure is // to therefore check both return value and presence of a non-zero errno. if (klinux_errno != 0) { errno = FromkLinuxErrno(klinux_errno); } } return result; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "An untrusted memory read vulnerability in Asylo versions up to 0.6.1 allows an untrusted attacker to pass a syscall number in MessageReader that is then used by sysno() and can bypass validation. This can allow the attacker to read memory from within the secure enclave. We recommend updating to Asylo 0.6.3 or past https://github.com/google/asylo/commit/90d7619e9dd99bcdb6cd28c7649d741d254d9a1a", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-22552"}} -{"idx": 388290, "input": "MagickExport MagickBooleanType EvaluateImage(Image *image, const MagickEvaluateOperator op,const double value,ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; RandomInfo **magick_restrict random_info; ssize_t y; #if defined(MAGICKCORE_OPENMP_SUPPORT) unsigned long key; #endif assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); status=MagickTrue; progress=0; random_info=AcquireRandomInfoThreadSet(); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) key=GetRandomSecretKey(random_info[0]); #pragma omp parallel for schedule(static) shared(progress,status) \\ magick_number_threads(image,image,image->rows,key == ~0UL) #endif for (y=0; y < (ssize_t) image->rows; y++) { const int id = GetOpenMPThreadId(); Quantum *magick_restrict q; ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { double result; ssize_t i; for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel = GetPixelChannelChannel(image,i); PixelTrait traits = GetPixelChannelTraits(image,channel); if (traits == UndefinedPixelTrait) continue; if ((traits & CopyPixelTrait) != 0) continue; if ((traits & UpdatePixelTrait) == 0) continue; result=ApplyEvaluateOperator(random_info[id],q[i],op,value); if (op == MeanEvaluateOperator) result/=2.0; q[i]=ClampToQuantum(result); } q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,EvaluateImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); random_info=DestroyRandomInfoThreadSet(random_info); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246316, "input": "AP_DECLARE(const char *) ap_get_server_name(request_rec *r) { conn_rec *conn = r->connection; core_dir_config *d; const char *retval; d = (core_dir_config *)ap_get_core_module_config(r->per_dir_config); switch (d->use_canonical_name) { case USE_CANONICAL_NAME_ON: retval = r->server->server_hostname; break; case USE_CANONICAL_NAME_DNS: if (conn->local_host == NULL) { if (apr_getnameinfo(&conn->local_host, conn->local_addr, 0) != APR_SUCCESS) conn->local_host = apr_pstrdup(conn->pool, r->server->server_hostname); else { ap_str_tolower(conn->local_host); } } retval = conn->local_host; break; case USE_CANONICAL_NAME_OFF: case USE_CANONICAL_NAME_UNSET: retval = r->hostname ? r->hostname : r->server->server_hostname; break; default: ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00109) \"ap_get_server_name: Invalid UCN Option somehow\"); retval = \"localhost\"; break; } return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212821, "input": "writepid (const char* pidfile, pid_t pid) { FILE* f; if ((f = fopen(pidfile, \"w\")) == NULL ) { log_err(\"cannot open pidfile %s: %s\", pidfile, strerror(errno)); return; } if(fprintf(f, \"%lu\\n\", (unsigned long)pid) < 0) { log_err(\"cannot write to pidfile %s: %s\", pidfile, strerror(errno)); } fclose(f); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Link Resolution Before File Access ('Link Following')"], "explanation": "NLnet Labs Unbound, up to and including version 1.12.0, and NLnet Labs NSD, up to and including version 4.3.3, contain a local vulnerability that would allow for a local symlink attack. When writing the PID file, Unbound and NSD create the file if it is not there, or open an existing file for writing. In case the file was already present, they would follow symlinks if the file happened to be a symlink instead of a regular file. An additional chown of the file would then take place after it was written, making the user Unbound/NSD is supposed to run as the new owner of the file. If an attacker has local access to the user Unbound/NSD runs as, she could create a symlink in place of the PID file pointing to a file that she would like to erase. If then Unbound/NSD is killed and the PID file is not cleared, upon restarting with root privileges, Unbound/NSD will rewrite any file pointed at by the symlink. This is a local vulnerability that could create a Denial of Service of the system Unbound/NSD is running on. It requires an attacker having access to the limited permission user Unbound/NSD runs as and point through the symlink to a critical file on the system.", "severity_level": "NoInfo", "cwe": "CWE-59", "cve": "CVE-2020-28935"}} -{"idx": 281491, "input": "static void execlists_preempt(struct timer_list *timer) { execlists_kick(timer, preempt); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445692, "input": "void tracing_iter_reset(struct trace_iterator *iter, int cpu) { struct ring_buffer_event *event; struct ring_buffer_iter *buf_iter; unsigned long entries = 0; u64 ts; per_cpu_ptr(iter->trace_buffer->data, cpu)->skipped_entries = 0; buf_iter = trace_buffer_iter(iter, cpu); if (!buf_iter) return; ring_buffer_iter_reset(buf_iter); /* * We could have the case with the max latency tracers * that a reset never took place on a cpu. This is evident * by the timestamp being before the start of the buffer. */ while ((event = ring_buffer_iter_peek(buf_iter, &ts))) { if (ts >= iter->trace_buffer->time_start) break; entries++; ring_buffer_read(buf_iter, NULL); } per_cpu_ptr(iter->trace_buffer->data, cpu)->skipped_entries = entries; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 217238, "input": "static bool MR_primality_test(UnsignedBigInteger n, const Vector& tests) { // Written using Wikipedia: // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test ASSERT(!(n < 4)); auto predecessor = n.minus({ 1 }); auto d = predecessor; size_t r = 0; { auto div_result = d.divided_by(2); while (div_result.remainder == 0) { d = div_result.quotient; div_result = d.divided_by(2); ++r; } } if (r == 0) { // n - 1 is odd, so n was even. But there is only one even prime: return n == 2; } for (auto a : tests) { // Technically: ASSERT(2 <= a && a <= n - 2) ASSERT(a < n); auto x = ModularPower(a, d, n); if (x == 1 || x == predecessor) continue; bool skip_this_witness = false; // r \u2212 1 iterations. for (size_t i = 0; i < r - 1; ++i) { x = ModularPower(x, 2, n); if (x == predecessor) { skip_this_witness = true; break; } } if (skip_this_witness) continue; return false; // \"composite\" } return true; // \"probably prime\" }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')"], "explanation": "SerenityOS Unspecified is affected by: Buffer Overflow. The impact is: obtain sensitive information (context-dependent). The component is: /Userland/Libraries/LibCrypto/ASN1/DER.h Crypto::der_decode_sequence() function. The attack vector is: Parsing RSA Key ASN.1.", "severity_level": "NoInfo", "cwe": "CWE-120", "cve": "CVE-2021-27343"}} -{"idx": 338577, "input": "static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode, int sync, void *arg) { struct wait_page_queue *wpq; struct io_kiocb *req = wait->private; struct wait_page_key *key = arg; wpq = container_of(wait, struct wait_page_queue, wait); if (!wake_page_match(wpq, key)) return 0; req->rw.kiocb.ki_flags &= ~IOCB_WAITQ; list_del_init(&wait->entry); /* submit ref gets dropped, acquire a new one */ req_ref_get(req); io_req_task_queue(req); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259621, "input": "explicit LoadAndRemapMatrixOp(OpKernelConstruction* context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr(\"num_rows\", &num_rows_)); OP_REQUIRES_OK(context, context->GetAttr(\"num_cols\", &num_cols_)); OP_REQUIRES_OK( context, context->GetAttr(\"max_rows_in_memory\", &max_rows_in_memory_)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 231613, "input": "GF_Err Media_UpdateSample(GF_MediaBox *mdia, u32 sampleNumber, GF_ISOSample *sample, Bool data_only) { GF_Err e; u32 drefIndex, chunkNum, descIndex; u64 newOffset, DTS; GF_DataEntryURLBox *Dentry; GF_SampleTableBox *stbl; if (!mdia || !sample || !sampleNumber || !mdia->mediaTrack->moov->mov->editFileMap) return GF_BAD_PARAM; stbl = mdia->information->sampleTable; if (!data_only) { //check we have the sampe dts e = stbl_GetSampleDTS(stbl->TimeToSample, sampleNumber, &DTS); if (e) return e; if (DTS != sample->DTS) return GF_BAD_PARAM; } //get our infos stbl_GetSampleInfos(stbl, sampleNumber, &newOffset, &chunkNum, &descIndex, NULL); //then check the data ref e = Media_GetSampleDesc(mdia, descIndex, NULL, &drefIndex); if (e) return e; Dentry = (GF_DataEntryURLBox*)gf_list_get(mdia->information->dataInformation->dref->child_boxes, drefIndex - 1); if (!Dentry) return GF_ISOM_INVALID_FILE; if (Dentry->flags != 1) return GF_BAD_PARAM; //MEDIA DATA EDIT: write this new sample to the edit temp file newOffset = gf_isom_datamap_get_offset(mdia->mediaTrack->moov->mov->editFileMap); if (sample->dataLength) { e = gf_isom_datamap_add_data(mdia->mediaTrack->moov->mov->editFileMap, sample->data, sample->dataLength); if (e) return e; } if (data_only) { stbl_SetSampleSize(stbl->SampleSize, sampleNumber, sample->dataLength); return stbl_SetChunkOffset(mdia, sampleNumber, newOffset); } return UpdateSample(mdia, sampleNumber, sample->dataLength, sample->CTS_Offset, newOffset, sample->IsRAP); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 308282, "input": "XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) { if (parser == NULL) return 0; if (parser->m_parentParser) return XML_SetHashSalt(parser->m_parentParser, hash_salt); /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; hash_secret_salt = hash_salt; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 434215, "input": "static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *compiler, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_u32 bit, sljit_s32 dst_ind, sljit_s32 cmp1_ind, sljit_s32 cmp2_ind, sljit_s32 tmp_ind) { sljit_u8 instruction[4]; instruction[0] = 0x66; instruction[1] = 0x0f; if (char1 == char2 || bit != 0) { if (bit != 0) { /* POR xmm1, xmm2/m128 */ /* instruction[0] = 0x66; */ /* instruction[1] = 0x0f; */ instruction[2] = 0xeb; instruction[3] = 0xc0 | (dst_ind << 3) | cmp2_ind; sljit_emit_op_custom(compiler, instruction, 4); } /* PCMPEQB/W/D xmm1, xmm2/m128 */ /* instruction[0] = 0x66; */ /* instruction[1] = 0x0f; */ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind; sljit_emit_op_custom(compiler, instruction, 4); } else { /* MOVDQA xmm1, xmm2/m128 */ /* instruction[0] = 0x66; */ /* instruction[1] = 0x0f; */ instruction[2] = 0x6f; instruction[3] = 0xc0 | (tmp_ind << 3) | dst_ind; sljit_emit_op_custom(compiler, instruction, 4); /* PCMPEQB/W/D xmm1, xmm2/m128 */ /* instruction[0] = 0x66; */ /* instruction[1] = 0x0f; */ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind; sljit_emit_op_custom(compiler, instruction, 4); instruction[3] = 0xc0 | (tmp_ind << 3) | cmp2_ind; sljit_emit_op_custom(compiler, instruction, 4); /* POR xmm1, xmm2/m128 */ /* instruction[0] = 0x66; */ /* instruction[1] = 0x0f; */ instruction[2] = 0xeb; instruction[3] = 0xc0 | (dst_ind << 3) | tmp_ind; sljit_emit_op_custom(compiler, instruction, 4); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277014, "input": "DataType dtype() const { return vals_.dtype(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208254, "input": "xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) { xmlChar *encoding = NULL; SKIP_BLANKS; if (CMP8(CUR_PTR, 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g')) { SKIP(8); SKIP_BLANKS; if (RAW != '=') { xmlFatalErr(ctxt, XML_ERR_EQUAL_REQUIRED, NULL); return(NULL); } NEXT; SKIP_BLANKS; if (RAW == '\"') { NEXT; encoding = xmlParseEncName(ctxt); if (RAW != '\"') { xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); xmlFree((xmlChar *) encoding); return(NULL); } else NEXT; } else if (RAW == '\\''){ NEXT; encoding = xmlParseEncName(ctxt); if (RAW != '\\'') { xmlFatalErr(ctxt, XML_ERR_STRING_NOT_CLOSED, NULL); xmlFree((xmlChar *) encoding); return(NULL); } else NEXT; } else { xmlFatalErr(ctxt, XML_ERR_STRING_NOT_STARTED, NULL); } /* * Non standard parsing, allowing the user to ignore encoding */ if (ctxt->options & XML_PARSE_IGNORE_ENC) { xmlFree((xmlChar *) encoding); return(NULL); } /* * UTF-16 encoding stwich has already taken place at this stage, * more over the little-endian/big-endian selection is already done */ if ((encoding != NULL) && ((!xmlStrcasecmp(encoding, BAD_CAST \"UTF-16\")) || (!xmlStrcasecmp(encoding, BAD_CAST \"UTF16\")))) { /* * If no encoding was passed to the parser, that we are * using UTF-16 and no decoder is present i.e. the * document is apparently UTF-8 compatible, then raise an * encoding mismatch fatal error */ if ((ctxt->encoding == NULL) && (ctxt->input->buf != NULL) && (ctxt->input->buf->encoder == NULL)) { xmlFatalErrMsg(ctxt, XML_ERR_INVALID_ENCODING, \"Document labelled UTF-16 but has UTF-8 content\\n\"); } if (ctxt->encoding != NULL) xmlFree((xmlChar *) ctxt->encoding); ctxt->encoding = encoding; } /* * UTF-8 encoding is handled natively */ else if ((encoding != NULL) && ((!xmlStrcasecmp(encoding, BAD_CAST \"UTF-8\")) || (!xmlStrcasecmp(encoding, BAD_CAST \"UTF8\")))) { if (ctxt->encoding != NULL) xmlFree((xmlChar *) ctxt->encoding); ctxt->encoding = encoding; } else if (encoding != NULL) { xmlCharEncodingHandlerPtr handler; if (ctxt->input->encoding != NULL) xmlFree((xmlChar *) ctxt->input->encoding); ctxt->input->encoding = encoding; handler = xmlFindCharEncodingHandler((const char *) encoding); if (handler != NULL) { xmlSwitchToEncoding(ctxt, handler); } else { xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING, \"Unsupported encoding %s\\n\", encoding); return(NULL); } } } return(encoding); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "The xmlParseXMLDecl function in parser.c in libxml2 before 2.9.3 allows context-dependent attackers to obtain sensitive information via an (1) unterminated encoding value or (2) incomplete XML declaration in XML data, which triggers an out-of-bounds heap read.", "severity_level": "Medium", "cwe": "CWE-119", "cve": "CVE-2015-8317"}} -{"idx": 232434, "input": "static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len) { int i; if (len == 1) return; /* NOTE: fake 'exit' subprog should be updated as well. */ for (i = 0; i <= env->subprog_cnt; i++) { if (env->subprog_info[i].start <= off) continue; env->subprog_info[i].start += len - 1; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 101651, "input": "void VideoRendererBase::Stop(const base::Closure& callback) { if (state_ == kStopped) { callback.Run(); return; } base::PlatformThreadHandle thread_to_join = base::kNullThreadHandle; { base::AutoLock auto_lock(lock_); state_ = kStopped; statistics_cb_.Reset(); time_cb_.Reset(); if (!pending_paint_ && !pending_paint_with_last_available_) DoStopOrError_Locked(); if (thread_ != base::kNullThreadHandle) { frame_available_.Signal(); thread_to_join = thread_; thread_ = base::kNullThreadHandle; } } if (thread_to_join != base::kNullThreadHandle) base::PlatformThread::Join(thread_to_join); decoder_->Stop(callback); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422582, "input": "TEST(RegexMatchExpression, ElemMatchKey) { RegexMatchExpression regex(\"a\", \"b\", \"\"); MatchDetails details; details.requestElemMatchKey(); ASSERT(!regex.matchesBSON(BSON(\"a\" << \"c\"), &details)); ASSERT(!details.hasElemMatchKey()); ASSERT(regex.matchesBSON(BSON(\"a\" << \"b\"), &details)); ASSERT(!details.hasElemMatchKey()); ASSERT(regex.matchesBSON(BSON(\"a\" << BSON_ARRAY(\"c\" << \"b\")), &details)); ASSERT(details.hasElemMatchKey()); ASSERT_EQUALS(\"1\", details.elemMatchKey()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281341, "input": "int RGWSetBucketWebsite_ObjStore_S3::get_params() { char *data = nullptr; int len = 0; const auto max_size = s->cct->_conf->rgw_max_put_param_size; int r = rgw_rest_read_all_input(s, &data, &len, max_size, false); if (r < 0) { return r; } auto data_deleter = std::unique_ptr{data, free}; r = do_aws4_auth_completion(); if (r < 0) { return r; } bufferptr in_ptr(data, len); in_data.append(in_ptr); RGWXMLDecoder::XMLParser parser; if (!parser.init()) { ldout(s->cct, 0) << \"ERROR: failed to initialize parser\" << dendl; return -EIO; } if (!parser.parse(data, len, 1)) { string str(data, len); ldout(s->cct, 5) << \"failed to parse xml: \" << str << dendl; return -EINVAL; } try { RGWXMLDecoder::decode_xml(\"WebsiteConfiguration\", website_conf, &parser, true); } catch (RGWXMLDecoder::err& err) { string str(data, len); ldout(s->cct, 5) << \"unexpected xml: \" << str << dendl; return -EINVAL; } if (website_conf.is_redirect_all && website_conf.redirect_all.hostname.empty()) { s->err.message = \"A host name must be provided to redirect all requests (e.g. \\\"example.com\\\").\"; ldout(s->cct, 5) << s->err.message << dendl; return -EINVAL; } else if (!website_conf.is_redirect_all && !website_conf.is_set_index_doc) { s->err.message = \"A value for IndexDocument Suffix must be provided if RedirectAllRequestsTo is empty\"; ldout(s->cct, 5) << s->err.message << dendl; return -EINVAL; } else if (!website_conf.is_redirect_all && website_conf.is_set_index_doc && website_conf.index_doc_suffix.empty()) { s->err.message = \"The IndexDocument Suffix is not well formed\"; ldout(s->cct, 5) << s->err.message << dendl; return -EINVAL; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 360763, "input": "void initialize_polling_images(void) { int i, MB = 1024 * 1024; /* set all shm areas to \"none\" before trying to create any */ scanline_shm.shmid = -1; scanline_shm.shmaddr = (char *) -1; scanline = NULL; fullscreen_shm.shmid = -1; fullscreen_shm.shmaddr = (char *) -1; fullscreen = NULL; snaprect_shm.shmid = -1; snaprect_shm.shmaddr = (char *) -1; snaprect = NULL; for (i=1; i<=ntiles_x; i++) { tile_row_shm[i].shmid = -1; tile_row_shm[i].shmaddr = (char *) -1; tile_row[i] = NULL; } /* the scanline (e.g. 1280x1) shared memory area image: */ if (! shm_create(&scanline_shm, &scanline, dpy_x, 1, \"scanline\")) { clean_up_exit(1); } /* * the fullscreen (e.g. 1280x1024/fs_factor) shared memory area image: * (we cut down the size of the shm area to try avoid and shm segment * limits, e.g. the default 1MB on Solaris) */ if (UT.sysname && strstr(UT.sysname, \"Linux\")) { set_fs_factor(10 * MB); } else { set_fs_factor(1 * MB); } if (fs_frac >= 1.0) { fs_frac = 1.1; fs_factor = 0; } if (! fs_factor) { rfbLog(\"warning: fullscreen updates are disabled.\\n\"); } else { if (! shm_create(&fullscreen_shm, &fullscreen, dpy_x, dpy_y/fs_factor, \"fullscreen\")) { clean_up_exit(1); } } if (use_snapfb) { if (! fs_factor) { rfbLog(\"warning: disabling -snapfb mode.\\n\"); use_snapfb = 0; } else if (! shm_create(&snaprect_shm, &snaprect, dpy_x, dpy_y/fs_factor, \"snaprect\")) { clean_up_exit(1); } } /* * for copy_tiles we need a lot of shared memory areas, one for * each possible run length of changed tiles. 32 for 1024x768 * and 40 for 1280x1024, etc. */ tile_shm_count = 0; for (i=1; i<=ntiles_x; i++) { if (! shm_create(&tile_row_shm[i], &tile_row[i], tile_x * i, tile_y, \"tile_row\")) { if (i == 1) { clean_up_exit(1); } rfbLog(\"shm: Error creating shared memory tile-row for\" \" len=%d,\\n\", i); rfbLog(\"shm: reverting to -onetile mode. If this\" \" problem persists\\n\"); rfbLog(\"shm: try using the -onetile or -noshm options\" \" to limit\\n\"); rfbLog(\"shm: shared memory usage, or run ipcrm(1)\" \" to manually\\n\"); rfbLog(\"shm: delete unattached shm segments.\\n\"); single_copytile_count = i; single_copytile = 1; } tile_shm_count++; if (single_copytile && i >= 1) { /* only need 1x1 tiles */ break; } } if (verbose) { if (using_shm && ! xform24to32) { rfbLog(\"created %d tile_row shm polling images.\\n\", tile_shm_count); } else { rfbLog(\"created %d tile_row polling images.\\n\", tile_shm_count); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219441, "input": "const char *data() const { return m_str ? m_str->data() : \"\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295073, "input": "BOOL update_begin_paint(rdpUpdate* update) { if (!update) return FALSE; EnterCriticalSection(&update->mux); if (!update->BeginPaint) return TRUE; return update->BeginPaint(update->context); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497534, "input": "ms_escher_read_DeletedPspl (MSEscherState *state, MSEscherHeader *h) { return FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 210838, "input": "static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct stub_device *sdev = dev_get_drvdata(dev); int sockfd = 0; struct socket *socket; int rv; if (!sdev) { dev_err(dev, \"sdev is null\\n\"); return -ENODEV; } rv = sscanf(buf, \"%d\", &sockfd); if (rv != 1) return -EINVAL; if (sockfd != -1) { int err; dev_info(dev, \"stub up\\n\"); spin_lock_irq(&sdev->ud.lock); if (sdev->ud.status != SDEV_ST_AVAILABLE) { dev_err(dev, \"not ready\\n\"); goto err; } socket = sockfd_lookup(sockfd, &err); if (!socket) { dev_err(dev, \"failed to lookup sock\"); goto err; } if (socket->type != SOCK_STREAM) { dev_err(dev, \"Expecting SOCK_STREAM - found %d\", socket->type); goto sock_err; } sdev->ud.tcp_socket = socket; sdev->ud.sockfd = sockfd; spin_unlock_irq(&sdev->ud.lock); sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud, \"stub_rx\"); sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud, \"stub_tx\"); spin_lock_irq(&sdev->ud.lock); sdev->ud.status = SDEV_ST_USED; spin_unlock_irq(&sdev->ud.lock); } else { dev_info(dev, \"stub down\\n\"); spin_lock_irq(&sdev->ud.lock); if (sdev->ud.status != SDEV_ST_USED) goto err; spin_unlock_irq(&sdev->ud.lock); usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); } return count; sock_err: sockfd_put(socket); err: spin_unlock_irq(&sdev->ud.lock); return -EINVAL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"], "explanation": "An issue was discovered in the Linux kernel before 5.11.7. usbip_sockfd_store in drivers/usb/usbip/stub_dev.c allows attackers to cause a denial of service (GPF) because the stub-up sequence has race conditions during an update of the local and shared status, aka CID-9380afd6df70.", "severity_level": "NoInfo", "cwe": "CWE-362", "cve": "CVE-2021-29265"}} -{"idx": 219695, "input": "double toDouble () const { return m_str ? m_str->toDouble () : 0;}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230194, "input": "CallResult> JSObject::getPrototypeOf( PseudoHandle selfHandle, Runtime *runtime) { if (LLVM_LIKELY(!selfHandle->isProxyObject())) { return createPseudoHandle(selfHandle->getParent(runtime)); } return JSProxy::getPrototypeOf( runtime->makeHandle(std::move(selfHandle)), runtime); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514562, "input": "Open_table_context::Open_table_context(THD *thd, uint flags) :m_thd(thd), m_failed_table(NULL), m_start_of_statement_svp(thd->mdl_context.mdl_savepoint()), m_timeout(flags & MYSQL_LOCK_IGNORE_TIMEOUT ? LONG_TIMEOUT : thd->variables.lock_wait_timeout), m_flags(flags), m_action(OT_NO_ACTION), m_has_locks(thd->mdl_context.has_locks()), m_has_protection_against_grl(0) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277973, "input": "ins_compl_files( int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir) { char_u *ptr; int i; FILE *fp; int add_r; for (i = 0; i < count && !got_int && !compl_interrupted; i++) { fp = mch_fopen((char *)files[i], \"r\"); // open dictionary file if (flags != DICT_EXACT) { msg_hist_off = TRUE; // reset in msg_trunc_attr() vim_snprintf((char *)IObuff, IOSIZE, _(\"Scanning dictionary: %s\"), (char *)files[i]); (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R)); } if (fp == NULL) continue; // Read dictionary file line by line. // Check each line for a match. while (!got_int && !compl_interrupted && !vim_fgets(buf, LSIZE, fp)) { ptr = buf; while (vim_regexec(regmatch, buf, (colnr_T)(ptr - buf))) { ptr = regmatch->startp[0]; if (ctrl_x_mode_line_or_eval()) ptr = find_line_end(ptr); else ptr = find_word_end(ptr); add_r = ins_compl_add_infercase(regmatch->startp[0], (int)(ptr - regmatch->startp[0]), p_ic, files[i], *dir, FALSE); if (thesaurus) { // For a thesaurus, add all the words in the line ptr = buf; add_r = thesarurs_add_words_in_line(files[i], &ptr, *dir, regmatch->startp[0]); } if (add_r == OK) // if dir was BACKWARD then honor it just once *dir = FORWARD; else if (add_r == FAIL) break; // avoid expensive call to vim_regexec() when at end // of line if (*ptr == '\\n' || got_int) break; } line_breakcheck(); ins_compl_check_keys(50, FALSE); } fclose(fp); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230187, "input": "TEST_P(JSITest, ObjectTest) { eval(\"x = {1:2, '3':4, 5:'six', 'seven':['eight', 'nine']}\"); Object x = rt.global().getPropertyAsObject(rt, \"x\"); EXPECT_EQ(x.getPropertyNames(rt).size(rt), 4); EXPECT_TRUE(x.hasProperty(rt, \"1\")); EXPECT_TRUE(x.hasProperty(rt, PropNameID::forAscii(rt, \"1\"))); EXPECT_FALSE(x.hasProperty(rt, \"2\")); EXPECT_FALSE(x.hasProperty(rt, PropNameID::forAscii(rt, \"2\"))); EXPECT_TRUE(x.hasProperty(rt, \"3\")); EXPECT_TRUE(x.hasProperty(rt, PropNameID::forAscii(rt, \"3\"))); EXPECT_TRUE(x.hasProperty(rt, \"seven\")); EXPECT_TRUE(x.hasProperty(rt, PropNameID::forAscii(rt, \"seven\"))); EXPECT_EQ(x.getProperty(rt, \"1\").getNumber(), 2); EXPECT_EQ(x.getProperty(rt, PropNameID::forAscii(rt, \"1\")).getNumber(), 2); EXPECT_EQ(x.getProperty(rt, \"3\").getNumber(), 4); Value five = 5; EXPECT_EQ( x.getProperty(rt, PropNameID::forString(rt, five.toString(rt))) .getString(rt) .utf8(rt), \"six\"); x.setProperty(rt, \"ten\", 11); EXPECT_EQ(x.getPropertyNames(rt).size(rt), 5); EXPECT_TRUE(eval(\"x.ten == 11\").getBool()); x.setProperty(rt, \"e_as_float\", 2.71f); EXPECT_TRUE(eval(\"Math.abs(x.e_as_float - 2.71) < 0.001\").getBool()); x.setProperty(rt, \"e_as_double\", 2.71); EXPECT_TRUE(eval(\"x.e_as_double == 2.71\").getBool()); uint8_t utf8[] = {0xF0, 0x9F, 0x86, 0x97}; String nonAsciiName = String::createFromUtf8(rt, utf8, sizeof(utf8)); x.setProperty(rt, PropNameID::forString(rt, nonAsciiName), \"emoji\"); EXPECT_EQ(x.getPropertyNames(rt).size(rt), 8); EXPECT_TRUE(eval(\"x['\\\\uD83C\\\\uDD97'] == 'emoji'\").getBool()); Object seven = x.getPropertyAsObject(rt, \"seven\"); EXPECT_TRUE(seven.isArray(rt)); Object evalf = rt.global().getPropertyAsObject(rt, \"eval\"); EXPECT_TRUE(evalf.isFunction(rt)); Object movedX = Object(rt); movedX = std::move(x); EXPECT_EQ(movedX.getPropertyNames(rt).size(rt), 8); EXPECT_EQ(movedX.getProperty(rt, \"1\").getNumber(), 2); Object obj = Object(rt); obj.setProperty(rt, \"roses\", \"red\"); obj.setProperty(rt, \"violets\", \"blue\"); Object oprop = Object(rt); obj.setProperty(rt, \"oprop\", oprop); obj.setProperty(rt, \"aprop\", Array(rt, 1)); EXPECT_TRUE(function(\"function (obj) { return \" \"obj.roses == 'red' && \" \"obj['violets'] == 'blue' && \" \"typeof obj.oprop == 'object' && \" \"Array.isArray(obj.aprop); }\") .call(rt, obj) .getBool()); // Check that getPropertyNames doesn't return non-enumerable // properties. obj = function( \"function () {\" \" obj = {};\" \" obj.a = 1;\" \" Object.defineProperty(obj, 'b', {\" \" enumerable: false,\" \" value: 2\" \" });\" \" return obj;\" \"}\") .call(rt) .getObject(rt); EXPECT_EQ(obj.getProperty(rt, \"a\").getNumber(), 1); EXPECT_EQ(obj.getProperty(rt, \"b\").getNumber(), 2); Array names = obj.getPropertyNames(rt); EXPECT_EQ(names.size(rt), 1); EXPECT_EQ(names.getValueAtIndex(rt, 0).getString(rt).utf8(rt), \"a\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393073, "input": "TEST_F(QueryPlannerTest, RootedOrOfAndCollapseIndenticalScans) { addIndex(BSON(\"a\" << 1 << \"b\" << 1)); runQuery(fromjson(\"{$or: [{a:1, b:2}, {a:1, b:2}]}\")); assertNumSolutions(2U); assertSolutionExists(\"{cscan: {dir: 1}}\"); assertSolutionExists( \"{fetch: {filter: null, node: {ixscan: {pattern: {a: 1, b: 1}},\" \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]},\" \"filter: null}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244418, "input": "void PrintHintUsage() { u32 i=0; gf_sys_format_help(helpout, help_flags, \"# Hinting Options\\n\" \"IsoMedia hinting consists in creating special tracks in the file that contain transport protocol specific information and optionally multiplexing information. These tracks are then used by the server to create the actual packets being sent over the network, in other words they provide the server with hints on how to build packets, hence their names `hint tracks`.\\n\" \"MP4Box supports creation of hint tracks for RTSP servers supporting these such as QuickTime Streaming Server, DarwinStreaming Server or 3GPP-compliant RTSP servers.\\n\" \"Note: GPAC streaming tools [rtp output](rtpout) and [rtsp server](rtspout) do not use hint tracks, they use on-the-fly packetization \" \"from any media sources, not just MP4\\n\" \" \\n\" \"Options:\\n\" ); while (m4b_hint_args[i].name) { GF_GPACArg *arg = &m4b_hint_args[i]; i++; gf_sys_print_arg(helpout, help_flags, arg, \"mp4box-hint\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219356, "input": "int64_t length() const { return m_str ? m_str->size() : 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514767, "input": "long qemu_maxrampagesize(void) { return qemu_real_host_page_size(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409190, "input": "static int uvc_clock_param_get(char *buffer, const struct kernel_param *kp) { if (uvc_clock_param == CLOCK_MONOTONIC) return sprintf(buffer, \"CLOCK_MONOTONIC\"); else return sprintf(buffer, \"CLOCK_REALTIME\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330391, "input": "static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb, size_t *len) { struct virtio_net_hdr vnet_hdr; if (*len < sizeof(vnet_hdr)) return -EINVAL; *len -= sizeof(vnet_hdr); if (virtio_net_hdr_from_skb(skb, &vnet_hdr, vio_le(), true, 0)) return -EINVAL; return memcpy_to_msg(msg, (void *)&vnet_hdr, sizeof(vnet_hdr)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509024, "input": "void no_rows_in_result() { (*ref)->no_rows_in_result(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281471, "input": "static void restore_default_state(struct intel_context *ce, struct intel_engine_cs *engine) { u32 *regs = ce->lrc_reg_state; if (engine->pinned_default_state) memcpy(regs, /* skip restoring the vanilla PPHWSP */ engine->pinned_default_state + LRC_STATE_PN * PAGE_SIZE, engine->context_size - PAGE_SIZE); execlists_init_reg_state(regs, ce, engine, ce->ring, false); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206735, "input": "static int rtsx_usb_ms_drv_remove(struct platform_device *pdev) { struct rtsx_usb_ms *host = platform_get_drvdata(pdev); struct memstick_host *msh = host->msh; int err; host->eject = true; cancel_work_sync(&host->handle_req); mutex_lock(&host->host_mutex); if (host->req) { dev_dbg(ms_dev(host), \"%s: Controller removed during transfer\\n\", dev_name(&msh->dev)); host->req->error = -ENOMEDIUM; do { err = memstick_next_req(msh, &host->req); if (!err) host->req->error = -ENOMEDIUM; } while (!err); } mutex_unlock(&host->host_mutex); memstick_remove_host(msh); memstick_free_host(msh); /* Balance possible unbalanced usage count * e.g. unconditional module removal */ if (pm_runtime_active(ms_dev(host))) pm_runtime_put(ms_dev(host)); pm_runtime_disable(ms_dev(host)); platform_set_drvdata(pdev, NULL); dev_dbg(ms_dev(host), \": Realtek USB Memstick controller has been removed\\n\"); return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "A use-after-free vulnerability was found in rtsx_usb_ms_drv_remove in drivers/memstick/host/rtsx_usb_ms.c in memstick in the Linux kernel. In this flaw, a local attacker with a user privilege may impact system Confidentiality. This flaw affects kernel versions prior to 5.14 rc1.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2022-0487"}} -{"idx": 262687, "input": "static void convert(float y, float u, float v, float *b, float *g, float *r) { *r = y + 1.5747f * v; *g = y - 0.1873f * u - 0.4682f * v; *b = y + 1.8556f * u; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342081, "input": "static void fuse_kill_sb_blk(struct super_block *sb) { fuse_sb_destroy(sb); kill_block_super(sb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 101617, "input": "MockVideoCaptureImpl(const media::VideoCaptureSessionId id, scoped_refptr ml_proxy, VideoCaptureMessageFilter* filter) : VideoCaptureImpl(id, ml_proxy, filter) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196601, "input": "main(int argc, char **argv) { const char *safepath = \"/bin:/sbin:/usr/bin:/usr/sbin:\" \"/usr/local/bin:/usr/local/sbin\"; const char *confpath = NULL; char *shargv[] = { NULL, NULL }; char *sh; const char *p; const char *cmd; char cmdline[LINE_MAX]; struct passwd mypwstore, targpwstore; struct passwd *mypw, *targpw; const struct rule *rule; uid_t uid; uid_t target = 0; gid_t groups[NGROUPS_MAX + 1]; int ngroups; int i, ch, rv; int sflag = 0; int nflag = 0; char cwdpath[PATH_MAX]; const char *cwd; char **envp; setprogname(\"doas\"); closefrom(STDERR_FILENO + 1); uid = getuid(); while ((ch = getopt(argc, argv, \"+C:Lnsu:\")) != -1) { switch (ch) { case 'C': confpath = optarg; break; case 'L': #if defined(USE_TIMESTAMP) exit(timestamp_clear() == -1); #else exit(0); #endif case 'u': if (parseuid(optarg, &target) != 0) errx(1, \"unknown user\"); break; case 'n': nflag = 1; break; case 's': sflag = 1; break; default: usage(); break; } } argv += optind; argc -= optind; if (confpath) { if (sflag) usage(); } else if ((!sflag && !argc) || (sflag && argc)) usage(); rv = mygetpwuid_r(uid, &mypwstore, &mypw); if (rv != 0) err(1, \"getpwuid_r failed\"); if (mypw == NULL) errx(1, \"no passwd entry for self\"); ngroups = getgroups(NGROUPS_MAX, groups); if (ngroups == -1) err(1, \"can't get groups\"); groups[ngroups++] = getgid(); if (sflag) { sh = getenv(\"SHELL\"); if (sh == NULL || *sh == '\\0') { shargv[0] = mypw->pw_shell; } else shargv[0] = sh; argv = shargv; argc = 1; } if (confpath) { checkconfig(confpath, argc, argv, uid, groups, ngroups, target); exit(1); /* fail safe */ } if (geteuid()) errx(1, \"not installed setuid\"); parseconfig(DOAS_CONF, 1); /* cmdline is used only for logging, no need to abort on truncate */ (void)strlcpy(cmdline, argv[0], sizeof(cmdline)); for (i = 1; i < argc; i++) { if (strlcat(cmdline, \" \", sizeof(cmdline)) >= sizeof(cmdline)) break; if (strlcat(cmdline, argv[i], sizeof(cmdline)) >= sizeof(cmdline)) break; } cmd = argv[0]; if (!permit(uid, groups, ngroups, &rule, target, cmd, (const char **)argv + 1)) { syslog(LOG_AUTHPRIV | LOG_NOTICE, \"command not permitted for %s: %s\", mypw->pw_name, cmdline); errc(1, EPERM, NULL); } #if defined(USE_SHADOW) if (!(rule->options & NOPASS)) { if (nflag) errx(1, \"Authorization required\"); shadowauth(mypw->pw_name, rule->options & PERSIST); } #elif !defined(USE_PAM) /* no authentication provider, only allow NOPASS rules */ (void) nflag; if (!(rule->options & NOPASS)) errx(1, \"Authorization required\"); #endif if ((p = getenv(\"PATH\")) != NULL) formerpath = strdup(p); if (formerpath == NULL) formerpath = \"\"; if (rule->cmd) { if (setenv(\"PATH\", safepath, 1) == -1) err(1, \"failed to set PATH '%s'\", safepath); } rv = mygetpwuid_r(target, &targpwstore, &targpw); if (rv != 0) err(1, \"getpwuid_r failed\"); if (targpw == NULL) errx(1, \"no passwd entry for target\"); #if defined(USE_PAM) pamauth(targpw->pw_name, mypw->pw_name, !nflag, rule->options & NOPASS, rule->options & PERSIST); #endif #ifdef HAVE_LOGIN_CAP_H if (setusercontext(NULL, targpw, target, LOGIN_SETGROUP | LOGIN_SETPRIORITY | LOGIN_SETRESOURCES | LOGIN_SETUMASK | LOGIN_SETUSER) != 0) errx(1, \"failed to set user context for target\"); #else if (setresgid(targpw->pw_gid, targpw->pw_gid, targpw->pw_gid) != 0) err(1, \"setresgid\"); if (initgroups(targpw->pw_name, targpw->pw_gid) != 0) err(1, \"initgroups\"); if (setresuid(target, target, target) != 0) err(1, \"setresuid\"); #endif if (getcwd(cwdpath, sizeof(cwdpath)) == NULL) cwd = \"(failed)\"; else cwd = cwdpath; if (!(rule->options & NOLOG)) { syslog(LOG_AUTHPRIV | LOG_INFO, \"%s ran command %s as %s from %s\", mypw->pw_name, cmdline, targpw->pw_name, cwd); } envp = prepenv(rule, mypw, targpw); /* setusercontext set path for the next process, so reset it for us */ if (rule->cmd) { if (setenv(\"PATH\", safepath, 1) == -1) err(1, \"failed to set PATH '%s'\", safepath); } else { if (setenv(\"PATH\", formerpath, 1) == -1) err(1, \"failed to set PATH '%s'\", formerpath); } execvpe(cmd, argv, envp); if (errno == ENOENT) errx(1, \"%s: command not found\", cmd); err(1, \"%s\", cmd); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "In OpenDoas from 6.6 to 6.8 the users PATH variable was incorrectly inherited by authenticated executions if the authenticating rule allowed the user to execute any command. Rules that only allowed to authenticated user to execute specific commands were not affected by this issue.", "severity_level": "NoInfo", "cwe": "CWE-200", "cve": "CVE-2019-25016"}} -{"idx": 207309, "input": "void LibRaw::parse_exif(int base) { unsigned entries, tag, type, len, save, c; double expo, ape; unsigned kodak = !strncmp(make, \"EASTMAN\", 7) && tiff_nifds < 3; entries = get2(); if (!strncmp(make, \"Hasselblad\", 10) && (tiff_nifds > 3) && (entries > 512)) return; INT64 fsize = ifp->size(); while (entries--) { tiff_get(base, &tag, &type, &len, &save); INT64 savepos = ftell(ifp); if (len > 8 && savepos + len > fsize * 2) { fseek(ifp, save, SEEK_SET); // Recover tiff-read position!! continue; } if (callbacks.exif_cb) { callbacks.exif_cb(callbacks.exifparser_data, tag, type, len, order, ifp, base); fseek(ifp, savepos, SEEK_SET); } switch (tag) { case 0xA005: // Interoperability IFD fseek(ifp, get4() + base, SEEK_SET); parse_exif_interop(base); break; case 0xA001: // ExifIFD.ColorSpace c = get2(); if (c == 1 && imgdata.color.ExifColorSpace == LIBRAW_COLORSPACE_Unknown) imgdata.color.ExifColorSpace = LIBRAW_COLORSPACE_sRGB; else if (c == 2) imgdata.color.ExifColorSpace = LIBRAW_COLORSPACE_AdobeRGB; break; case 0x9400: imCommon.exifAmbientTemperature = getreal(type); if ((imCommon.CameraTemperature > -273.15f) && ((OlyID == OlyID_TG_5) || (OlyID == OlyID_TG_6)) ) imCommon.CameraTemperature += imCommon.exifAmbientTemperature; break; case 0x9401: imCommon.exifHumidity = getreal(type); break; case 0x9402: imCommon.exifPressure = getreal(type); break; case 0x9403: imCommon.exifWaterDepth = getreal(type); break; case 0x9404: imCommon.exifAcceleration = getreal(type); break; case 0x9405: imCommon.exifCameraElevationAngle = getreal(type); break; case 0xa405: // FocalLengthIn35mmFormat imgdata.lens.FocalLengthIn35mmFormat = get2(); break; case 0xa431: // BodySerialNumber stmread(imgdata.shootinginfo.BodySerial, len, ifp); break; case 0xa432: // LensInfo, 42034dec, Lens Specification per EXIF standard imgdata.lens.MinFocal = getreal(type); imgdata.lens.MaxFocal = getreal(type); imgdata.lens.MaxAp4MinFocal = getreal(type); imgdata.lens.MaxAp4MaxFocal = getreal(type); break; case 0xa435: // LensSerialNumber stmread(imgdata.lens.LensSerial, len, ifp); if (!strncmp(imgdata.lens.LensSerial, \"----\", 4)) imgdata.lens.LensSerial[0] = '\\0'; break; case 0xa420: /* 42016, ImageUniqueID */ stmread(imgdata.color.ImageUniqueID, len, ifp); break; case 0xc65d: /* 50781, RawDataUniqueID */ imgdata.color.RawDataUniqueID[16] = 0; fread(imgdata.color.RawDataUniqueID, 1, 16, ifp); break; case 0xc630: // DNG LensInfo, Lens Specification per EXIF standard imgdata.lens.dng.MinFocal = getreal(type); imgdata.lens.dng.MaxFocal = getreal(type); imgdata.lens.dng.MaxAp4MinFocal = getreal(type); imgdata.lens.dng.MaxAp4MaxFocal = getreal(type); break; case 0xc68b: /* 50827, OriginalRawFileName */ stmread(imgdata.color.OriginalRawFileName, len, ifp); break; case 0xa433: // LensMake stmread(imgdata.lens.LensMake, len, ifp); break; case 0xa434: // LensModel stmread(imgdata.lens.Lens, len, ifp); if (!strncmp(imgdata.lens.Lens, \"----\", 4)) imgdata.lens.Lens[0] = '\\0'; break; case 0x9205: imgdata.lens.EXIF_MaxAp = libraw_powf64l(2.0f, (getreal(type) / 2.0f)); break; case 0x829a: // 33434 tiff_ifd[tiff_nifds - 1].t_shutter = shutter = getreal(type); break; case 0x829d: // 33437, FNumber aperture = getreal(type); break; case 0x8827: // 34855 iso_speed = get2(); break; case 0x8831: // 34865 if (iso_speed == 0xffff && !strncasecmp(make, \"FUJI\", 4)) iso_speed = getreal(type); break; case 0x8832: // 34866 if (iso_speed == 0xffff && (!strncasecmp(make, \"SONY\", 4) || !strncasecmp(make, \"CANON\", 5))) iso_speed = getreal(type); break; case 0x9003: // 36867 case 0x9004: // 36868 get_timestamp(0); break; case 0x9201: // 37377 if ((expo = -getreal(type)) < 128 && shutter == 0.) tiff_ifd[tiff_nifds - 1].t_shutter = shutter = libraw_powf64l(2.0, expo); break; case 0x9202: // 37378 ApertureValue if ((fabs(ape = getreal(type)) < 256.0) && (!aperture)) aperture = libraw_powf64l(2.0, ape / 2); break; case 0x9209: // 37385 flash_used = getreal(type); break; case 0x920a: // 37386 focal_len = getreal(type); break; case 0x927c: // 37500 if (((make[0] == '\\0') && !strncmp(model, \"ov5647\", 6)) || (!strncmp(make, \"RaspberryPi\", 11) && (!strncmp(model, \"RP_OV5647\", 9) || !strncmp(model, \"RP_imx219\", 9)))) { char mn_text[512]; char *pos; char ccms[512]; ushort l; float num; fgets(mn_text, MIN(len, 511), ifp); mn_text[511] = 0; pos = strstr(mn_text, \"gain_r=\"); if (pos) cam_mul[0] = atof(pos + 7); pos = strstr(mn_text, \"gain_b=\"); if (pos) cam_mul[2] = atof(pos + 7); if ((cam_mul[0] > 0.001f) && (cam_mul[2] > 0.001f)) cam_mul[1] = cam_mul[3] = 1.0f; else cam_mul[0] = cam_mul[2] = 0.0f; pos = strstr(mn_text, \"ccm=\"); if (pos) { pos += 4; char *pos2 = strstr(pos, \" \"); if (pos2) { l = pos2 - pos; memcpy(ccms, pos, l); ccms[l] = '\\0'; #ifdef LIBRAW_WIN32_CALLS // Win32 strtok is already thread-safe pos = strtok(ccms, \",\"); #else char *last = 0; pos = strtok_r(ccms, \",\", &last); #endif if (pos) { for (l = 0; l < 4; l++) { num = 0.0; for (c = 0; c < 3; c++) { imgdata.color.ccm[l][c] = (float)atoi(pos); num += imgdata.color.ccm[l][c]; #ifdef LIBRAW_WIN32_CALLS pos = strtok(NULL, \",\"); #else pos = strtok_r(NULL, \",\", &last); #endif if (!pos) goto end; // broken } if (num > 0.01) FORC3 imgdata.color.ccm[l][c] = imgdata.color.ccm[l][c] / num; } } } } end:; } else if (!strncmp(make, \"SONY\", 4) && (!strncmp(model, \"DSC-V3\", 6) || !strncmp(model, \"DSC-F828\", 8))) { parseSonySRF(len); break; } else if ((len == 1) && !strncmp(make, \"NIKON\", 5)) { c = get4(); if (c) fseek(ifp, c, SEEK_SET); is_NikonTransfer = 1; } parse_makernote(base, 0); break; case 0xa002: // 40962 if (kodak) raw_width = get4(); break; case 0xa003: // 40963 if (kodak) raw_height = get4(); break; case 0xa302: // 41730 if (get4() == 0x20002) for (exif_cfa = c = 0; c < 8; c += 2) exif_cfa |= fgetc(ifp) * 0x01010101U << c; } fseek(ifp, save, SEEK_SET); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "LibRaw before 0.20-Beta3 has an out-of-bounds write in parse_exif() in metadata\\exif_gps.cpp via an unrecognized AtomName and a zero value of tiff_nifds.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-15365"}} -{"idx": 417851, "input": "static struct ttf_table *SFDGetTtfTable(FILE *sfd, SplineFont *sf,struct ttf_table *lasttab[2]) { /* We've read the TtfTable token, it is followed by a tag and a byte count */ /* and then the instructions in enc85 format */ int i,len; int which; struct enc85 dec; struct ttf_table *tab = chunkalloc(sizeof(struct ttf_table)); memset(&dec,'\\0', sizeof(dec)); dec.pos = -1; dec.sfd = sfd; tab->tag = gettag(sfd); if ( tab->tag==CHR('f','p','g','m') || tab->tag==CHR('p','r','e','p') || tab->tag==CHR('c','v','t',' ') || tab->tag==CHR('m','a','x','p')) which = 0; else which = 1; getint(sfd,&len); tab->data = malloc(len); tab->len = len; for ( i=0; idata[i] = Dec85(&dec); if ( lasttab[which]!=NULL ) lasttab[which]->next = tab; else if ( which==0 ) sf->ttf_tables = tab; else sf->ttf_tab_saved = tab; lasttab[which] = tab; return( tab ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246588, "input": "Status UncompressElement(const CompressedElement& compressed, std::vector* out) { int num_components = compressed.component_metadata_size(); out->clear(); out->reserve(num_components); // Step 1: Prepare the memory that we will uncompress into. std::vector iov(num_components); // We use tstring for access to resize_uninitialized. std::vector tensor_proto_strs; // num_components is a conservative estimate. It is important to reserve // vector space so that the vector doesn't resize itself, which could // invalidate pointers to its strings' data. tensor_proto_strs.reserve(num_components); int64 total_size = 0; for (int i = 0; i < num_components; ++i) { const CompressedComponentMetadata& metadata = compressed.component_metadata(i); if (DataTypeCanUseMemcpy(metadata.dtype())) { out->emplace_back(metadata.dtype(), metadata.tensor_shape()); TensorBuffer* buffer = DMAHelper::buffer(&out->back()); if (buffer) { iov[i].iov_base = buffer->data(); iov[i].iov_len = buffer->size(); } else { iov[i].iov_base = nullptr; iov[i].iov_len = 0; } } else { // Allocate an empty Tensor. We will fill it out later after // uncompressing into the tensor_proto_str. out->emplace_back(); tensor_proto_strs.emplace_back(); tstring& tensor_proto_str = tensor_proto_strs.back(); tensor_proto_str.resize_uninitialized(metadata.tensor_size_bytes()); iov[i].iov_base = tensor_proto_str.mdata(); iov[i].iov_len = tensor_proto_str.size(); } total_size += iov[i].iov_len; } // Step 2: Uncompress into the iovec. const std::string& compressed_data = compressed.data(); size_t uncompressed_size; if (!port::Snappy_GetUncompressedLength( compressed_data.data(), compressed_data.size(), &uncompressed_size)) { return errors::Internal( \"Could not get snappy uncompressed length. Compressed data size: \", compressed_data.size()); } if (uncompressed_size != static_cast(total_size)) { return errors::Internal( \"Uncompressed size mismatch. Snappy expects \", uncompressed_size, \" whereas the tensor metadata suggests \", total_size); } if (!port::Snappy_UncompressToIOVec(compressed_data.data(), compressed_data.size(), iov.data(), num_components)) { return errors::Internal(\"Failed to perform snappy decompression.\"); } // Step 3: Deserialize tensor proto strings to tensors. int tensor_proto_strs_index = 0; for (int i = 0; i < num_components; ++i) { if (DataTypeCanUseMemcpy(compressed.component_metadata(i).dtype())) { continue; } TensorProto tp; if (!tp.ParseFromString(tensor_proto_strs[tensor_proto_strs_index++])) { return errors::Internal(\"Could not parse TensorProto\"); } if (!out->at(i).FromProto(tp)) { return errors::Internal(\"Could not parse Tensor\"); } } return Status::OK(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214925, "input": "hufUncompress (const char compressed[], int nCompressed, unsigned short raw[], int nRaw) { // // need at least 20 bytes for header // if (nCompressed < 20 ) { if (nRaw != 0) notEnoughData(); return; } int im = readUInt (compressed); int iM = readUInt (compressed + 4); // int tableLength = readUInt (compressed + 8); int nBits = readUInt (compressed + 12); if (im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE) invalidTableSize(); const char *ptr = compressed + 20; if ( ptr + (nBits+7 )/8 > compressed+nCompressed) { notEnoughData(); return; } // // Fast decoder needs at least 2x64-bits of compressed data, and // needs to be run-able on this platform. Otherwise, fall back // to the original decoder // if (FastHufDecoder::enabled() && nBits > 128) { FastHufDecoder fhd (ptr, nCompressed - (ptr - compressed), im, iM, iM); fhd.decode ((unsigned char*)ptr, nBits, raw, nRaw); } else { AutoArray freq; AutoArray hdec; hufClearDecTable (hdec); hufUnpackEncTable (&ptr, nCompressed - (ptr - compressed), im, iM, freq); try { if (nBits > 8 * (nCompressed - (ptr - compressed))) invalidNBits(); hufBuildDecTable (freq, im, iM, hdec); hufDecode (freq, hdec, ptr, nBits, iM, nRaw, raw); } catch (...) { hufFreeDecTable (hdec); throw; } hufFreeDecTable (hdec); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "A flaw was found in OpenEXR's hufUncompress functionality in OpenEXR/IlmImf/ImfHuf.cpp. This flaw allows an attacker who can submit a crafted file that is processed by OpenEXR, to trigger an integer overflow. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2021-20300"}} -{"idx": 330395, "input": "static void prb_close_block(struct tpacket_kbdq_core *pkc1, struct tpacket_block_desc *pbd1, struct packet_sock *po, unsigned int stat) { __u32 status = TP_STATUS_USER | stat; struct tpacket3_hdr *last_pkt; struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1; struct sock *sk = &po->sk; if (atomic_read(&po->tp_drops)) status |= TP_STATUS_LOSING; last_pkt = (struct tpacket3_hdr *)pkc1->prev; last_pkt->tp_next_offset = 0; /* Get the ts of the last pkt */ if (BLOCK_NUM_PKTS(pbd1)) { h1->ts_last_pkt.ts_sec = last_pkt->tp_sec; h1->ts_last_pkt.ts_nsec = last_pkt->tp_nsec; } else { /* Ok, we tmo'd - so get the current time. * * It shouldn't really happen as we don't close empty * blocks. See prb_retire_rx_blk_timer_expired(). */ struct timespec64 ts; ktime_get_real_ts64(&ts); h1->ts_last_pkt.ts_sec = ts.tv_sec; h1->ts_last_pkt.ts_nsec = ts.tv_nsec; } smp_wmb(); /* Flush the block */ prb_flush_block(pkc1, pbd1, status); sk->sk_data_ready(sk); pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207646, "input": "virtio_dev_rx_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, struct rte_mbuf **pkts) { bool wrap_counter = vq->avail_wrap_counter; struct vring_packed_desc *descs = vq->desc_packed; uint16_t avail_idx = vq->last_avail_idx; uint64_t desc_addrs[PACKED_BATCH_SIZE]; struct virtio_net_hdr_mrg_rxbuf *hdrs[PACKED_BATCH_SIZE]; uint32_t buf_offset = dev->vhost_hlen; uint64_t lens[PACKED_BATCH_SIZE]; uint16_t ids[PACKED_BATCH_SIZE]; uint16_t i; if (unlikely(avail_idx & PACKED_BATCH_MASK)) return -1; if (unlikely((avail_idx + PACKED_BATCH_SIZE) > vq->size)) return -1; vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { if (unlikely(pkts[i]->next != NULL)) return -1; if (unlikely(!desc_is_avail(&descs[avail_idx + i], wrap_counter))) return -1; } rte_smp_rmb(); vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) lens[i] = descs[avail_idx + i].len; vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { if (unlikely(pkts[i]->pkt_len > (lens[i] - buf_offset))) return -1; } vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) desc_addrs[i] = vhost_iova_to_vva(dev, vq, descs[avail_idx + i].addr, &lens[i], VHOST_ACCESS_RW); vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { if (unlikely(lens[i] != descs[avail_idx + i].len)) return -1; } vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { rte_prefetch0((void *)(uintptr_t)desc_addrs[i]); hdrs[i] = (struct virtio_net_hdr_mrg_rxbuf *) (uintptr_t)desc_addrs[i]; lens[i] = pkts[i]->pkt_len + dev->vhost_hlen; } vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) virtio_enqueue_offload(pkts[i], &hdrs[i]->hdr); vq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE); vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) { rte_memcpy((void *)(uintptr_t)(desc_addrs[i] + buf_offset), rte_pktmbuf_mtod_offset(pkts[i], void *, 0), pkts[i]->pkt_len); } vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) vhost_log_cache_write_iova(dev, vq, descs[avail_idx + i].addr, lens[i]); vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) ids[i] = descs[avail_idx + i].id; vhost_flush_enqueue_batch_packed(dev, vq, lens, ids); return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Initialization"], "explanation": "A flaw was found in DPDK version 19.11 and above that allows a malicious guest to cause a segmentation fault of the vhost-user backend application running on the host, which could result in a loss of connectivity for the other guests running on that host. This is caused by a missing validity check of the descriptor address in the function `virtio_dev_rx_batch_packed()`.", "severity_level": "NoInfo", "cwe": "CWE-665", "cve": "CVE-2020-10725"}} -{"idx": 383918, "input": "LZWReadByte(gif_source_ptr sinfo) /* Read an LZW-compressed byte */ { register int code; /* current working code */ int incode; /* saves actual input code */ /* If any codes are stacked from a previously read symbol, return them */ if (sinfo->sp > sinfo->symbol_stack) return (int)(*(--sinfo->sp)); /* Time to read a new symbol */ code = GetCode(sinfo); if (code == sinfo->clear_code) { /* Reinit state, swallow any extra Clear codes, and */ /* return next code, which is expected to be a raw byte. */ ReInitLZW(sinfo); do { code = GetCode(sinfo); } while (code == sinfo->clear_code); if (code > sinfo->clear_code) { /* make sure it is a raw byte */ WARNMS(sinfo->cinfo, JWRN_GIF_BADDATA); code = 0; /* use something valid */ } /* make firstcode, oldcode valid! */ sinfo->firstcode = sinfo->oldcode = code; return code; } if (code == sinfo->end_code) { /* Skip the rest of the image, unless GetCode already read terminator */ if (!sinfo->out_of_blocks) { SkipDataBlocks(sinfo); sinfo->out_of_blocks = TRUE; } /* Complain that there's not enough data */ WARNMS(sinfo->cinfo, JWRN_GIF_ENDCODE); /* Pad data with 0's */ return 0; /* fake something usable */ } /* Got normal raw byte or LZW symbol */ incode = code; /* save for a moment */ if (code >= sinfo->max_code) { /* special case for not-yet-defined symbol */ /* code == max_code is OK; anything bigger is bad data */ if (code > sinfo->max_code) { WARNMS(sinfo->cinfo, JWRN_GIF_BADDATA); incode = 0; /* prevent creation of loops in symbol table */ } /* this symbol will be defined as oldcode/firstcode */ *(sinfo->sp++) = (UINT8)sinfo->firstcode; code = sinfo->oldcode; } /* If it's a symbol, expand it into the stack */ while (code >= sinfo->clear_code) { *(sinfo->sp++) = sinfo->symbol_tail[code]; /* tail is a byte value */ code = sinfo->symbol_head[code]; /* head is another LZW symbol */ } /* At this point code just represents a raw byte */ sinfo->firstcode = code; /* save for possible future use */ /* If there's room in table... */ if ((code = sinfo->max_code) < LZW_TABLE_SIZE) { /* Define a new symbol = prev sym + head of this sym's expansion */ sinfo->symbol_head[code] = (UINT16)sinfo->oldcode; sinfo->symbol_tail[code] = (UINT8)sinfo->firstcode; sinfo->max_code++; /* Is it time to increase code_size? */ if (sinfo->max_code >= sinfo->limit_code && sinfo->code_size < MAX_LZW_BITS) { sinfo->code_size++; sinfo->limit_code <<= 1; /* keep equal to 2^code_size */ } } sinfo->oldcode = incode; /* save last input symbol for future use */ return sinfo->firstcode; /* return first byte of symbol's expansion */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280183, "input": "static inline unsigned long next_tid(unsigned long tid) { return tid + TID_STEP; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267937, "input": "TfLiteStatus ResizeOutputTensor(TfLiteContext* context, const OneHotContext& op_context) { TF_LITE_ENSURE(context, *op_context.depth->data.i32 >= 0); TfLiteIntArray* output_size = TfLiteIntArrayCreate(op_context.output_dims); for (int i = 0; i < op_context.output_dims; ++i) { if (i < op_context.axis) { output_size->data[i] = op_context.indices->dims->data[i]; } else if (i == op_context.axis) { output_size->data[i] = *op_context.depth->data.i32; } else { output_size->data[i] = op_context.indices->dims->data[i - 1]; } } return context->ResizeTensor(context, op_context.output, output_size); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519658, "input": "XMLNode::add_child_nocopy(XMLNode& n) { _children.insert(_children.end(), &n); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 90050, "input": "DataObjectItem* DataObjectItem::CreateFromURL(const String& url, const String& title) { DataObjectItem* item = MakeGarbageCollected(kStringKind, kMimeTypeTextURIList); item->data_ = url; item->title_ = title; return item; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197749, "input": "void Compute(tensorflow::OpKernelContext* context) override { const tensorflow::Tensor* data; OP_REQUIRES_OK(context, context->input(\"data\", &data)); const auto& input_data = data->flat().data(); const tensorflow::Tensor* splits; OP_REQUIRES_OK(context, context->input(\"data_splits\", &splits)); const auto& splits_vec = splits->flat(); int num_batch_items = splits_vec.size() - 1; tensorflow::Tensor* ngrams_splits; OP_REQUIRES_OK( context, context->allocate_output(1, splits->shape(), &ngrams_splits)); auto ngrams_splits_data = ngrams_splits->flat().data(); // If there is no data or size, return an empty RT. if (data->flat().size() == 0 || splits_vec.size() == 0) { tensorflow::Tensor* empty; OP_REQUIRES_OK(context, context->allocate_output(0, data->shape(), &empty)); for (int i = 0; i <= num_batch_items; ++i) { ngrams_splits_data[i] = 0; } return; } ngrams_splits_data[0] = 0; for (int i = 1; i <= num_batch_items; ++i) { int length = splits_vec(i) - splits_vec(i - 1); int num_ngrams = 0; for (int ngram_width : ngram_widths_) num_ngrams += get_num_ngrams(length, ngram_width); if (preserve_short_ && length > 0 && num_ngrams == 0) { num_ngrams = 1; } ngrams_splits_data[i] = ngrams_splits_data[i - 1] + num_ngrams; } tensorflow::Tensor* ngrams; OP_REQUIRES_OK( context, context->allocate_output( 0, TensorShape({ngrams_splits_data[num_batch_items]}), &ngrams)); auto ngrams_data = ngrams->flat().data(); for (int i = 0; i < num_batch_items; ++i) { auto data_start = &input_data[splits_vec(i)]; int output_start_idx = ngrams_splits_data[i]; for (int ngram_width : ngram_widths_) { auto output_start = &ngrams_data[output_start_idx]; int length = splits_vec(i + 1) - splits_vec(i); int num_ngrams = get_num_ngrams(length, ngram_width); CreateNgrams(data_start, output_start, num_ngrams, ngram_width); output_start_idx += num_ngrams; } // If we're preserving short sequences, check to see if no sequence was // generated by comparing the current output start idx to the original // one (ngram_splits_data). If no ngrams were generated, then they will // be equal (since we increment output_start_idx by num_ngrams every // time we create a set of ngrams.) if (preserve_short_ && output_start_idx == ngrams_splits_data[i]) { int data_length = splits_vec(i + 1) - splits_vec(i); // One legitimate reason to not have any ngrams when preserve_short_ // is true is if the sequence itself is empty. In that case, move on. if (data_length == 0) { continue; } // We don't have to worry about dynamic padding sizes here: if padding // was dynamic, every sequence would have had sufficient padding to // generate at least one ngram. int ngram_width = data_length + 2 * pad_width_; auto output_start = &ngrams_data[output_start_idx]; int num_ngrams = 1; CreateNgrams(data_start, output_start, num_ngrams, ngram_width); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In Tensorflow before versions 1.15.4, 2.0.3, 2.1.2, 2.2.1 and 2.3.1, the `data_splits` argument of `tf.raw_ops.StringNGrams` lacks validation. This allows a user to pass values that can cause heap overflow errors and even leak contents of memory In the linked code snippet, all the binary strings after `ee ff` are contents from the memory stack. Since these can contain return addresses, this data leak can be used to defeat ASLR. The issue is patched in commit 0462de5b544ed4731aa2fb23946ac22c01856b80, and is released in TensorFlow versions 1.15.4, 2.0.3, 2.1.2, 2.2.1, or 2.3.1.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-15205"}} -{"idx": 386061, "input": "static int rtsx_usb_ms_issue_cmd(struct rtsx_usb_ms *host) { struct memstick_request *req = host->req; int err = 0; u8 cfg = 0, int_reg; dev_dbg(ms_dev(host), \"%s\\n\", __func__); if (req->need_card_int) { if (host->ifmode != MEMSTICK_SERIAL) cfg = WAIT_INT; } if (req->long_data) { err = ms_transfer_data(host, req->data_dir, req->tpc, cfg, &(req->sg)); } else { if (req->data_dir == READ) err = ms_read_bytes(host, req->tpc, cfg, req->data_len, req->data, &int_reg); else err = ms_write_bytes(host, req->tpc, cfg, req->data_len, req->data, &int_reg); } if (err < 0) return err; if (req->need_card_int) { if (host->ifmode == MEMSTICK_SERIAL) { err = ms_read_bytes(host, MS_TPC_GET_INT, NO_WAIT_INT, 1, &req->int_reg, NULL); if (err < 0) return err; } else { if (int_reg & MS_INT_CMDNK) req->int_reg |= MEMSTICK_INT_CMDNAK; if (int_reg & MS_INT_BREQ) req->int_reg |= MEMSTICK_INT_BREQ; if (int_reg & MS_INT_ERR) req->int_reg |= MEMSTICK_INT_ERR; if (int_reg & MS_INT_CED) req->int_reg |= MEMSTICK_INT_CED; } dev_dbg(ms_dev(host), \"int_reg: 0x%02x\\n\", req->int_reg); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318155, "input": "static int copyI18NEntry(Header h, indexEntry entry, rpmtd td, headerGetFlags flags) { const char *lang, *l, *le; indexEntry table; td->type = RPM_STRING_TYPE; td->count = 1; /* if no match, just return the first string */ td->data = entry->data; /* XXX Drepper sez' this is the order. */ if ((lang = getenv(\"LANGUAGE\")) == NULL && (lang = getenv(\"LC_ALL\")) == NULL && (lang = getenv(\"LC_MESSAGES\")) == NULL && (lang = getenv(\"LANG\")) == NULL) goto exit; if ((table = findEntry(h, RPMTAG_HEADERI18NTABLE, RPM_STRING_ARRAY_TYPE)) == NULL) goto exit; for (l = lang; *l != '\\0'; l = le) { const char *t; char *ed, *ed_weak = NULL; int langNum; while (*l && *l == ':') /* skip leading colons */ l++; if (*l == '\\0') break; for (le = l; *le && *le != ':'; le++) /* find end of this locale */ {}; /* For each entry in the header ... */ for (langNum = 0, t = table->data, ed = entry->data; langNum < entry->info.count; langNum++, t += strlen(t) + 1, ed += strlen(ed) + 1) { int match = headerMatchLocale(t, l, le); if (match == 1) { td->data = ed; goto exit; } else if (match == 2) { ed_weak = ed; } } if (ed_weak) { td->data = ed_weak; goto exit; } } exit: if (flags & HEADERGET_ALLOC) { td->data = xstrdup(td->data); td->flags |= RPMTD_ALLOCED; } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385620, "input": "unsigned Utf8Decoder::WriteUtf16(uint16_t* data, unsigned length) const { DCHECK(length > 0); if (length > utf16_length_) length = utf16_length_; // memcpy everything in buffer. unsigned buffer_length = last_byte_of_buffer_unused_ ? kBufferSize - 1 : kBufferSize; unsigned memcpy_length = length <= buffer_length ? length : buffer_length; v8::internal::MemCopy(data, buffer_, memcpy_length * sizeof(uint16_t)); if (length <= buffer_length) return length; DCHECK(unbuffered_start_ != NULL); // Copy the rest the slow way. WriteUtf16Slow(unbuffered_start_, unbuffered_length_, data + buffer_length, length - buffer_length); return length; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 350357, "input": "fopenTiffMemstream(const char *filename, const char *operation, l_uint8 **pdata, size_t *pdatasize) { L_MEMSTREAM *mstream; TIFF *tif; PROCNAME(\"fopenTiffMemstream\"); if (!filename) return (TIFF *)ERROR_PTR(\"filename not defined\", procName, NULL); if (!operation) return (TIFF *)ERROR_PTR(\"operation not defined\", procName, NULL); if (!pdata) return (TIFF *)ERROR_PTR(\"&data not defined\", procName, NULL); if (!pdatasize) return (TIFF *)ERROR_PTR(\"&datasize not defined\", procName, NULL); if (strcmp(operation, \"r\") && strcmp(operation, \"w\")) return (TIFF *)ERROR_PTR(\"op not 'r' or 'w'\", procName, NULL); if (!strcmp(operation, \"r\")) mstream = memstreamCreateForRead(*pdata, *pdatasize); else mstream = memstreamCreateForWrite(pdata, pdatasize); TIFFSetWarningHandler(NULL); /* disable warnings */ TIFFSetErrorHandler(NULL); /* disable error messages */ tif = TIFFClientOpen(filename, operation, (thandle_t)mstream, tiffReadCallback, tiffWriteCallback, tiffSeekCallback, tiffCloseCallback, tiffSizeCallback, tiffMapCallback, tiffUnmapCallback); if (!tif) LEPT_FREE(mstream); return tif; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410779, "input": "static inline int tcp_v6_iif(const struct sk_buff *skb) { bool l3_slave = skb_l3mdev_slave(TCP_SKB_CB(skb)->header.h6.flags); return l3_slave ? skb->skb_iif : TCP_SKB_CB(skb)->header.h6.iif; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432406, "input": "static unsigned long nested_svm_get_tdp_cr3(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); return svm->nested.nested_cr3; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431393, "input": "static void encode_remove(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) { encode_op_hdr(xdr, OP_REMOVE, decode_remove_maxsz, hdr); encode_string(xdr, name->len, name->name); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431902, "input": "static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_rp_read_class_of_dev *rp = (void *) skb->data; BT_DBG(\"%s status 0x%2.2x\", hdev->name, rp->status); if (rp->status) return; memcpy(hdev->dev_class, rp->dev_class, 3); BT_DBG(\"%s class 0x%.2x%.2x%.2x\", hdev->name, hdev->dev_class[2], hdev->dev_class[1], hdev->dev_class[0]); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439901, "input": "ldns_rr_label_count(const ldns_rr *rr) { if (!rr) { return 0; } return ldns_dname_label_count( ldns_rr_owner(rr)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295302, "input": "static struct dentry *lookup_slow(const struct qstr *name, struct dentry *dir, unsigned int flags) { struct inode *inode = dir->d_inode; struct dentry *res; inode_lock_shared(inode); res = __lookup_slow(name, dir, flags); inode_unlock_shared(inode); return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 441970, "input": "static void vhost_tx_batch(struct vhost_net *net, struct vhost_net_virtqueue *nvq, struct socket *sock, struct msghdr *msghdr) { struct tun_msg_ctl ctl = { .type = TUN_MSG_PTR, .num = nvq->batched_xdp, .ptr = nvq->xdp, }; int err; if (nvq->batched_xdp == 0) goto signal_used; msghdr->msg_control = &ctl; err = sock->ops->sendmsg(sock, msghdr, 0); if (unlikely(err < 0)) { vq_err(&nvq->vq, \"Fail to batch sending packets\\n\"); return; } signal_used: vhost_net_signal_used(nvq); nvq->batched_xdp = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268887, "input": "R_API int r_sys_sigaction(int *sig, void (*handler) (int)) { int ret, i; if (!sig) { return -EINVAL; } for (i = 0; sig[i] != 0; i++) { ret = signal (sig[i], handler); if (ret == SIG_ERR) { eprintf (\"Failed to set signal handler for signal '%d': %s\\n\", sig[i], strerror(errno)); return -1; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336761, "input": "yin_parse_extcomplex_flag(struct lys_module *mod, struct lyxml_elem *node, struct lys_ext_instance_complex *ext, LY_STMT stmt, const char *val1_str, const char *val2_str, uint16_t mask, uint16_t val1, uint16_t val2, struct unres_schema *unres) { uint16_t *val; const char *str; val = yin_getplace_for_extcomplex_flags(node, ext, stmt, mask); if (!val) { return EXIT_FAILURE; } str = lyxml_get_attr(node, \"value\", NULL); if (!str) { LOGVAL(mod->ctx, LYE_MISSARG, LY_VLOG_NONE, NULL, \"value\", node->name); } else if (!strcmp(val1_str, str)) { *val = *val | val1; } else if (!strcmp(val2_str, str)) { *val = *val | val2; } else { /* unknown value */ LOGVAL(mod->ctx, LYE_INARG, LY_VLOG_NONE, NULL, str, node->name); return EXIT_FAILURE; } if (lyp_yin_parse_subnode_ext(mod, ext, LYEXT_PAR_EXTINST, node, (LYEXT_SUBSTMT)stmt, 0, unres)) { return EXIT_FAILURE; } return EXIT_SUCCESS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445618, "input": "void trace_printk_init_buffers(void) { if (buffers_allocated) return; if (alloc_percpu_trace_buffer()) return; /* trace_printk() is for debug use only. Don't use it in production. */ pr_warn(\"\\n\"); pr_warn(\"**********************************************************\\n\"); pr_warn(\"** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\\n\"); pr_warn(\"** **\\n\"); pr_warn(\"** trace_printk() being used. Allocating extra memory. **\\n\"); pr_warn(\"** **\\n\"); pr_warn(\"** This means that this is a DEBUG kernel and it is **\\n\"); pr_warn(\"** unsafe for production use. **\\n\"); pr_warn(\"** **\\n\"); pr_warn(\"** If you see this message and you are not debugging **\\n\"); pr_warn(\"** the kernel, report this immediately to your vendor! **\\n\"); pr_warn(\"** **\\n\"); pr_warn(\"** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\\n\"); pr_warn(\"**********************************************************\\n\"); /* Expand the buffers to set size */ tracing_update_buffers(); buffers_allocated = 1; /* * trace_printk_init_buffers() can be called by modules. * If that happens, then we need to start cmdline recording * directly here. If the global_trace.buffer is already * allocated here, then this was called by module code. */ if (global_trace.trace_buffer.buffer) tracing_start_cmdline_record(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448765, "input": "void RGWCopyObj_ObjStore_SWIFT::send_response() { if (! sent_header) { string content_type; if (! op_ret) op_ret = STATUS_CREATED; set_req_state_err(s, op_ret); dump_errno(s); dump_etag(s, etag); dump_last_modified(s, mtime); dump_copy_info(); get_contype_from_attrs(attrs, content_type); dump_object_metadata(s, attrs); end_header(s, this, !content_type.empty() ? content_type.c_str() : \"binary/octet-stream\"); } else { s->formatter->close_section(); rgw_flush_formatter(s, s->formatter); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458358, "input": "static inline void hidinput_configure_usages(struct hid_input *hidinput, struct hid_report *report) { int i, j; for (i = 0; i < report->maxfield; i++) for (j = 0; j < report->field[i]->maxusage; j++) hidinput_configure_usage(hidinput, report->field[i], report->field[i]->usage + j); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279623, "input": "reg_set_bits(struct pcilynx *lynx, int offset, u32 mask) { reg_write(lynx, offset, (reg_read(lynx, offset) | mask)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336910, "input": "tr_trans(VALUE str, VALUE src, VALUE repl, int sflag) { const unsigned int errc = -1; unsigned int trans[256]; rb_encoding *enc, *e1, *e2; struct tr trsrc, trrepl; int cflag = 0; unsigned int c, c0; int last = 0, modify = 0, i, l; char *s, *send; VALUE hash = 0; int singlebyte = single_byte_optimizable(str); int cr; #define CHECK_IF_ASCII(c) \\ (void)((cr == ENC_CODERANGE_7BIT && !rb_isascii(c)) ? \\ (cr = ENC_CODERANGE_VALID) : 0) StringValue(src); StringValue(repl); if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil; if (RSTRING_LEN(repl) == 0) { return rb_str_delete_bang(1, &src, str); } cr = ENC_CODERANGE(str); e1 = rb_enc_check(str, src); e2 = rb_enc_check(str, repl); if (e1 == e2) { enc = e1; } else { enc = rb_enc_check(src, repl); } trsrc.p = RSTRING_PTR(src); trsrc.pend = trsrc.p + RSTRING_LEN(src); if (RSTRING_LEN(src) > 1 && rb_enc_ascget(trsrc.p, trsrc.pend, &l, enc) == '^' && trsrc.p + l < trsrc.pend) { cflag = 1; trsrc.p += l; } trrepl.p = RSTRING_PTR(repl); trrepl.pend = trrepl.p + RSTRING_LEN(repl); trsrc.gen = trrepl.gen = 0; trsrc.now = trrepl.now = 0; trsrc.max = trrepl.max = 0; if (cflag) { for (i=0; i<256; i++) { trans[i] = 1; } while ((c = trnext(&trsrc, enc)) != errc) { if (c < 256) { trans[c] = errc; } else { if (!hash) hash = rb_hash_new(); rb_hash_aset(hash, UINT2NUM(c), Qtrue); } } while ((c = trnext(&trrepl, enc)) != errc) /* retrieve last replacer */; last = trrepl.now; for (i=0; i<256; i++) { if (trans[i] != errc) { trans[i] = last; } } } else { unsigned int r; for (i=0; i<256; i++) { trans[i] = errc; } while ((c = trnext(&trsrc, enc)) != errc) { r = trnext(&trrepl, enc); if (r == errc) r = trrepl.now; if (c < 256) { trans[c] = r; if (rb_enc_codelen(r, enc) != 1) singlebyte = 0; } else { if (!hash) hash = rb_hash_new(); rb_hash_aset(hash, UINT2NUM(c), UINT2NUM(r)); } } } if (cr == ENC_CODERANGE_VALID) cr = ENC_CODERANGE_7BIT; str_modify_keep_cr(str); s = RSTRING_PTR(str); send = RSTRING_END(str); if (sflag) { int clen, tlen; long offset, max = RSTRING_LEN(str); unsigned int save = -1; char *buf = ALLOC_N(char, max), *t = buf; while (s < send) { int may_modify = 0; c0 = c = rb_enc_codepoint_len(s, send, &clen, e1); tlen = enc == e1 ? clen : rb_enc_codelen(c, enc); s += clen; if (c < 256) { c = trans[c]; } else if (hash) { VALUE tmp = rb_hash_lookup(hash, UINT2NUM(c)); if (NIL_P(tmp)) { if (cflag) c = last; else c = errc; } else if (cflag) c = errc; else c = NUM2INT(tmp); } else { c = errc; } if (c != (unsigned int)-1) { if (save == c) { CHECK_IF_ASCII(c); continue; } save = c; tlen = rb_enc_codelen(c, enc); modify = 1; } else { save = -1; c = c0; if (enc != e1) may_modify = 1; } while (t - buf + tlen >= max) { offset = t - buf; max *= 2; REALLOC_N(buf, char, max); t = buf + offset; } rb_enc_mbcput(c, t, enc); if (may_modify && memcmp(s, t, tlen) != 0) { modify = 1; } CHECK_IF_ASCII(c); t += tlen; } *t = '\\0'; RSTRING(str)->as.heap.ptr = buf; RSTRING(str)->as.heap.len = t - buf; STR_SET_NOEMBED(str); RSTRING(str)->as.heap.aux.capa = max; } else if (rb_enc_mbmaxlen(enc) == 1 || (singlebyte && !hash)) { while (s < send) { c = (unsigned char)*s; if (trans[c] != errc) { if (!cflag) { c = trans[c]; *s = c; modify = 1; } else { *s = last; modify = 1; } } CHECK_IF_ASCII(c); s++; } } else { int clen, tlen, max = (int)(RSTRING_LEN(str) * 1.2); long offset; char *buf = ALLOC_N(char, max), *t = buf; while (s < send) { int may_modify = 0; c0 = c = rb_enc_codepoint_len(s, send, &clen, e1); tlen = enc == e1 ? clen : rb_enc_codelen(c, enc); if (c < 256) { c = trans[c]; } else if (hash) { VALUE tmp = rb_hash_lookup(hash, UINT2NUM(c)); if (NIL_P(tmp)) { if (cflag) c = last; else c = errc; } else if (cflag) c = errc; else c = NUM2INT(tmp); } else { c = errc; } if (c != errc) { tlen = rb_enc_codelen(c, enc); modify = 1; } else { c = c0; if (enc != e1) may_modify = 1; } while (t - buf + tlen >= max) { offset = t - buf; max *= 2; REALLOC_N(buf, char, max); t = buf + offset; } if (s != t) { rb_enc_mbcput(c, t, enc); if (may_modify && memcmp(s, t, tlen) != 0) { modify = 1; } } CHECK_IF_ASCII(c); s += clen; t += tlen; } if (!STR_EMBED_P(str)) { xfree(RSTRING(str)->as.heap.ptr); } *t = '\\0'; RSTRING(str)->as.heap.ptr = buf; RSTRING(str)->as.heap.len = t - buf; STR_SET_NOEMBED(str); RSTRING(str)->as.heap.aux.capa = max; } if (modify) { if (cr != ENC_CODERANGE_BROKEN) ENC_CODERANGE_SET(str, cr); rb_enc_associate(str, enc); return str; } return Qnil; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 262657, "input": "explicit PhiloxRandomOp(OpKernelConstruction* ctx) : OpKernel(ctx) { OP_REQUIRES_OK(ctx, generator_.Init(ctx)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265771, "input": "void CWebAuth::Invalidate() { CAuthBase::Invalidate(); m_pWebSock = nullptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 200929, "input": "unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name) { int i; u_entry_T *uep; char_u **array; char_u *line; int line_len; uep = (u_entry_T *)U_ALLOC_LINE(sizeof(u_entry_T)); if (uep == NULL) return NULL; vim_memset(uep, 0, sizeof(u_entry_T)); #ifdef U_DEBUG uep->ue_magic = UE_MAGIC; #endif uep->ue_top = undo_read_4c(bi); uep->ue_bot = undo_read_4c(bi); uep->ue_lcount = undo_read_4c(bi); uep->ue_size = undo_read_4c(bi); if (uep->ue_size > 0) { array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue_size); if (array == NULL) { *error = TRUE; return uep; } vim_memset(array, 0, sizeof(char_u *) * uep->ue_size); } else array = NULL; uep->ue_array = array; for (i = 0; i < uep->ue_size; ++i) { line_len = undo_read_4c(bi); if (line_len >= 0) line = read_string_decrypt(bi, line_len); else { line = NULL; corruption_error(\"line length\", file_name); } if (line == NULL) { *error = TRUE; return uep; } array[i] = line; } return uep; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "An integer overflow at an unserialize_uep memory allocation site would occur for vim before patch 8.0.0378, if it does not properly validate values for tree length when reading a corrupted undo file, which may lead to resultant buffer overflows.", "severity_level": "High", "cwe": "CWE-190", "cve": "CVE-2017-6350"}} -{"idx": 268889, "input": "R_API char *r_str_ichr(char *str, char chr) { while (*str == chr) { str++; } return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448847, "input": "int RGWCopyObj_ObjStore_SWIFT::get_params() { if_mod = s->info.env->get(\"HTTP_IF_MODIFIED_SINCE\"); if_unmod = s->info.env->get(\"HTTP_IF_UNMODIFIED_SINCE\"); if_match = s->info.env->get(\"HTTP_COPY_IF_MATCH\"); if_nomatch = s->info.env->get(\"HTTP_COPY_IF_NONE_MATCH\"); src_tenant_name = s->src_tenant_name; src_bucket_name = s->src_bucket_name; src_object = s->src_object; dest_tenant_name = s->bucket_tenant; dest_bucket_name = s->bucket_name; dest_object = s->object.name; const char * const fresh_meta = s->info.env->get(\"HTTP_X_FRESH_METADATA\"); if (fresh_meta && strcasecmp(fresh_meta, \"TRUE\") == 0) { attrs_mod = RGWRados::ATTRSMOD_REPLACE; } else { attrs_mod = RGWRados::ATTRSMOD_MERGE; } int r = get_delete_at_param(s, delete_at); if (r < 0) { ldout(s->cct, 5) << \"ERROR: failed to get Delete-At param\" << dendl; return r; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273271, "input": "static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag) { const CodedBitstreamUnit *unit; uint8_t *data; size_t size, dp, sp; int i; size = 4; // SOI + EOI. for (i = 0; i < frag->nb_units; i++) { unit = &frag->units[i]; size += 2 + unit->data_size; if (unit->type == JPEG_MARKER_SOS) { for (sp = 0; sp < unit->data_size; sp++) { if (unit->data[sp] == 0xff) ++size; } } } frag->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!frag->data_ref) return AVERROR(ENOMEM); data = frag->data_ref->data; dp = 0; data[dp++] = 0xff; data[dp++] = JPEG_MARKER_SOI; for (i = 0; i < frag->nb_units; i++) { unit = &frag->units[i]; data[dp++] = 0xff; data[dp++] = unit->type; if (unit->type != JPEG_MARKER_SOS) { memcpy(data + dp, unit->data, unit->data_size); dp += unit->data_size; } else { sp = AV_RB16(unit->data); av_assert0(sp <= unit->data_size); memcpy(data + dp, unit->data, sp); dp += sp; for (; sp < unit->data_size; sp++) { if (unit->data[sp] == 0xff) { data[dp++] = 0xff; data[dp++] = 0x00; } else { data[dp++] = unit->data[sp]; } } } } data[dp++] = 0xff; data[dp++] = JPEG_MARKER_EOI; av_assert0(dp == size); memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); frag->data = data; frag->data_size = size; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224898, "input": "static u32 get_box_reg_idx(u32 boxCode, u32 parent_type) { u32 i=0, count = gf_isom_get_num_supported_boxes(); const char *parent_name = parent_type ? gf_4cc_to_str(parent_type) : NULL; for (i=1; ipf_expose : sctp_sk(sk)->pf_expose; if (put_user(len, optlen)) goto out; if (copy_to_user(optval, ¶ms, len)) goto out; retval = 0; out: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 272301, "input": "multi_client_connect_mda(struct multi_context *m, struct multi_instance *mi, const struct buffer_list *config, unsigned int option_permissions_mask, unsigned int *option_types_found) { if (config) { struct buffer_entry *be; for (be = config->head; be != NULL; be = be->next) { const char *opt = BSTR(&be->buf); options_string_import(&mi->context.options, opt, D_IMPORT_ERRORS|M_OPTERR, option_permissions_mask, option_types_found, mi->context.c2.es); } /* * If the --client-connect script generates a config file * with an --ifconfig-push directive, it will override any * --ifconfig-push directive from the --client-config-dir * directory or any --ifconfig-pool dynamic address. */ multi_select_virtual_addr(m, mi); multi_set_virtual_addr_env(mi); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508938, "input": "longlong val_int_from_real() { DBUG_ASSERT(fixed == 1); return Converter_double_to_longlong_with_warn(val_real(), false).result(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508473, "input": "init_sum_functions(Item_sum **func_ptr, Item_sum **end_ptr) { for (; func_ptr != end_ptr ;func_ptr++) { if ((*func_ptr)->reset_and_add()) return 1; } /* If rollup, calculate the upper sum levels */ for ( ; *func_ptr ; func_ptr++) { if ((*func_ptr)->aggregator_add()) return 1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461580, "input": "static bool is_axreg(u32 reg) { return reg == BPF_REG_0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267330, "input": "GF_Err gf_isom_reset_switch_parameters(GF_ISOFile *movie) { u32 i=0; while (i< gf_isom_get_track_count(movie) ) { //locate first available ID GF_TrackBox *a_trak = gf_isom_get_track_from_file(movie, i+1); reset_tsel_box(a_trak); i++; } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402571, "input": "int hci_get_random_address(struct hci_dev *hdev, bool require_privacy, bool use_rpa, struct adv_info *adv_instance, u8 *own_addr_type, bdaddr_t *rand_addr) { int err; bacpy(rand_addr, BDADDR_ANY); /* If privacy is enabled use a resolvable private address. If * current RPA has expired then generate a new one. */ if (use_rpa) { int to; /* If Controller supports LL Privacy use own address type is * 0x03 */ if (use_ll_privacy(hdev)) *own_addr_type = ADDR_LE_DEV_RANDOM_RESOLVED; else *own_addr_type = ADDR_LE_DEV_RANDOM; if (adv_instance) { if (!adv_instance->rpa_expired && !bacmp(&adv_instance->random_addr, &hdev->rpa)) return 0; adv_instance->rpa_expired = false; } else { if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && !bacmp(&hdev->random_addr, &hdev->rpa)) return 0; } err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); if (err < 0) { bt_dev_err(hdev, \"failed to generate new RPA\"); return err; } bacpy(rand_addr, &hdev->rpa); to = msecs_to_jiffies(hdev->rpa_timeout * 1000); if (adv_instance) queue_delayed_work(hdev->workqueue, &adv_instance->rpa_expired_cb, to); else queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); return 0; } /* In case of required privacy without resolvable private address, * use an non-resolvable private address. This is useful for * non-connectable advertising. */ if (require_privacy) { bdaddr_t nrpa; while (true) { /* The non-resolvable private address is generated * from random six bytes with the two most significant * bits cleared. */ get_random_bytes(&nrpa, 6); nrpa.b[5] &= 0x3f; /* The non-resolvable private address shall not be * equal to the public address. */ if (bacmp(&hdev->bdaddr, &nrpa)) break; } *own_addr_type = ADDR_LE_DEV_RANDOM; bacpy(rand_addr, &nrpa); return 0; } /* No privacy so use a public address. */ *own_addr_type = ADDR_LE_DEV_PUBLIC; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 231541, "input": "void CAuthBase::Invalidate() { m_pSock = nullptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267306, "input": "static GF_Err unpack_track(GF_TrackBox *trak) { GF_Err e = GF_OK; if (!trak->is_unpacked) { e = stbl_UnpackOffsets(trak->Media->information->sampleTable); if (e) return e; e = stbl_unpackCTS(trak->Media->information->sampleTable); trak->is_unpacked = GF_TRUE; } return e; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499710, "input": "copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes, char *filename) { off_t size; off_t k; off_t original_num_bytes; int rc; original_num_bytes = num_bytes; while (num_bytes > 0) { if (input_size == 0) if ((rc = disk_fill_input_buffer (in_des, num_bytes))) { if (rc > 0) { char buf[UINTMAX_STRSIZE_BOUND]; error (0, 0, ngettext (\"File %s shrunk by %s byte, padding with zeros\", \"File %s shrunk by %s bytes, padding with zeros\", num_bytes), filename, STRINGIFY_BIGINT (num_bytes, buf)); } else error (0, 0, _(\"Read error at byte %lld in file %s, padding with zeros\"), (long long) (original_num_bytes - num_bytes), filename); write_nuls_to_file (num_bytes, out_des, disk_buffered_write); break; } size = (input_size < num_bytes) ? input_size : num_bytes; if (crc_i_flag) { for (k = 0; k < size; ++k) crc += in_buff[k] & 0xff; } disk_buffered_write (in_buff, out_des, size); num_bytes -= size; input_size -= size; in_buff += size; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268019, "input": "static unsigned int pfkey_sockaddr_fill(const xfrm_address_t *xaddr, __be16 port, struct sockaddr *sa, unsigned short family) { switch (family) { case AF_INET: { struct sockaddr_in *sin = (struct sockaddr_in *)sa; sin->sin_family = AF_INET; sin->sin_port = port; sin->sin_addr.s_addr = xaddr->a4; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); return 32; } #if IS_ENABLED(CONFIG_IPV6) case AF_INET6: { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; sin6->sin6_family = AF_INET6; sin6->sin6_port = port; sin6->sin6_flowinfo = 0; sin6->sin6_addr = xaddr->in6; sin6->sin6_scope_id = 0; return 128; } #endif } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432436, "input": "static int nested_svm_exit_handled_msr(struct vcpu_svm *svm) { u32 offset, msr, value; int write, mask; if (!(svm->nested.intercept & (1ULL << INTERCEPT_MSR_PROT))) return NESTED_EXIT_HOST; msr = svm->vcpu.arch.regs[VCPU_REGS_RCX]; offset = svm_msrpm_offset(msr); write = svm->vmcb->control.exit_info_1 & 1; mask = 1 << ((2 * (msr & 0xf)) + write); if (offset == MSR_INVALID) return NESTED_EXIT_DONE; /* Offset is in 32 bit units but need in 8 bit units */ offset *= 4; if (kvm_vcpu_read_guest(&svm->vcpu, svm->nested.vmcb_msrpm + offset, &value, 4)) return NESTED_EXIT_DONE; return (value & mask) ? NESTED_EXIT_DONE : NESTED_EXIT_HOST; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422597, "input": "TEST(InMatchExpression, MatchesMinKey) { BSONObj operand = BSON_ARRAY(MinKey); InMatchExpression in(\"a\"); std::vector equalities{operand.firstElement()}; ASSERT_OK(in.setEqualities(std::move(equalities))); ASSERT(in.matchesBSON(BSON(\"a\" << MinKey), NULL)); ASSERT(!in.matchesBSON(BSON(\"a\" << MaxKey), NULL)); ASSERT(!in.matchesBSON(BSON(\"a\" << 4), NULL)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 254694, "input": "static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_extension_t *extension) { size_t pos = stream->bytes_left; while (extension != NULL && pos == stream->bytes_left) { bool status; if (extension->type->decode) status = extension->type->decode(stream, extension, tag, wire_type); else status = default_extension_decoder(stream, extension, tag, wire_type); if (!status) return false; extension = extension->next; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269899, "input": "Commissioner::Commissioner(Instance &aInstance) : InstanceLocator(aInstance) , mJoinerPort(0) , mJoinerRloc(0) , mSessionId(0) , mJoinerIndex(0) , mTransmitAttempts(0) , mJoinerExpirationTimer(aInstance, HandleJoinerExpirationTimer, this) , mTimer(aInstance, HandleTimer, this) , mRelayReceive(OT_URI_PATH_RELAY_RX, &Commissioner::HandleRelayReceive, this) , mDatasetChanged(OT_URI_PATH_DATASET_CHANGED, &Commissioner::HandleDatasetChanged, this) , mJoinerFinalize(OT_URI_PATH_JOINER_FINALIZE, &Commissioner::HandleJoinerFinalize, this) , mAnnounceBegin(aInstance) , mEnergyScan(aInstance) , mPanIdQuery(aInstance) , mStateCallback(NULL) , mJoinerCallback(NULL) , mCallbackContext(NULL) , mState(OT_COMMISSIONER_STATE_DISABLED) { memset(mJoiners, 0, sizeof(mJoiners)); mCommissionerAloc.Clear(); mCommissionerAloc.mPrefixLength = 64; mCommissionerAloc.mPreferred = true; mCommissionerAloc.mValid = true; mCommissionerAloc.mScopeOverride = Ip6::Address::kRealmLocalScope; mCommissionerAloc.mScopeOverrideValid = true; mProvisioningUrl[0] = '\\0'; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409883, "input": "static int tcp_try_undo_recovery(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); if (tcp_may_undo(tp)) { int mib_idx; /* Happy end! We did not retransmit anything * or our original transmission succeeded. */ DBGUNDO(sk, inet_csk(sk)->icsk_ca_state == TCP_CA_Loss ? \"loss\" : \"retrans\"); tcp_undo_cwr(sk, true); if (inet_csk(sk)->icsk_ca_state == TCP_CA_Loss) mib_idx = LINUX_MIB_TCPLOSSUNDO; else mib_idx = LINUX_MIB_TCPFULLUNDO; NET_INC_STATS_BH(sock_net(sk), mib_idx); tp->undo_marker = 0; } if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { /* Hold old state until something *above* high_seq * is ACKed. For Reno it is MUST to prevent false * fast retransmits (RFC2582). SACK TCP is safe. */ tcp_moderate_cwnd(tp); return 1; } tcp_set_ca_state(sk, TCP_CA_Open); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461568, "input": "static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) { u8 *jg_reloc, *prog = *pprog; int pivot, err, jg_bytes = 1, cnt = 0; s64 jg_offset; if (a == b) { /* Leaf node of recursion, i.e. not a range of indices * anymore. */ EMIT1(add_1mod(0x48, BPF_REG_3)); /* cmp rdx,func */ if (!is_simm32(progs[a])) return -1; EMIT2_off32(0x81, add_1reg(0xF8, BPF_REG_3), progs[a]); err = emit_cond_near_jump(&prog, /* je func */ (void *)progs[a], prog, X86_JE); if (err) return err; err = emit_fallback_jump(&prog); /* jmp thunk/indirect */ if (err) return err; *pprog = prog; return 0; } /* Not a leaf node, so we pivot, and recursively descend into * the lower and upper ranges. */ pivot = (b - a) / 2; EMIT1(add_1mod(0x48, BPF_REG_3)); /* cmp rdx,func */ if (!is_simm32(progs[a + pivot])) return -1; EMIT2_off32(0x81, add_1reg(0xF8, BPF_REG_3), progs[a + pivot]); if (pivot > 2) { /* jg upper_part */ /* Require near jump. */ jg_bytes = 4; EMIT2_off32(0x0F, X86_JG + 0x10, 0); } else { EMIT2(X86_JG, 0); } jg_reloc = prog; err = emit_bpf_dispatcher(&prog, a, a + pivot, /* emit lower_part */ progs); if (err) return err; /* From Intel 64 and IA-32 Architectures Optimization * Reference Manual, 3.4.1.4 Code Alignment, Assembly/Compiler * Coding Rule 11: All branch targets should be 16-byte * aligned. */ emit_align(&prog, 16); jg_offset = prog - jg_reloc; emit_code(jg_reloc - jg_bytes, jg_offset, jg_bytes); err = emit_bpf_dispatcher(&prog, a + pivot + 1, /* emit upper_part */ b, progs); if (err) return err; *pprog = prog; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202733, "input": "static int cmd_handle_untagged (IMAP_DATA* idata) { char* s; char* pn; unsigned int count; s = imap_next_word (idata->buf); pn = imap_next_word (s); if ((idata->state >= IMAP_SELECTED) && isdigit ((unsigned char) *s)) { pn = s; s = imap_next_word (s); /* EXISTS and EXPUNGE are always related to the SELECTED mailbox for the * connection, so update that one. */ if (ascii_strncasecmp (\"EXISTS\", s, 6) == 0) { dprint (2, (debugfile, \"Handling EXISTS\\n\")); /* new mail arrived */ mutt_atoui (pn, &count); if ( !(idata->reopen & IMAP_EXPUNGE_PENDING) && count < idata->max_msn) { /* Notes 6.0.3 has a tendency to report fewer messages exist than * it should. */ dprint (1, (debugfile, \"Message count is out of sync\")); return 0; } /* at least the InterChange server sends EXISTS messages freely, * even when there is no new mail */ else if (count == idata->max_msn) dprint (3, (debugfile, \"cmd_handle_untagged: superfluous EXISTS message.\\n\")); else { if (!(idata->reopen & IMAP_EXPUNGE_PENDING)) { dprint (2, (debugfile, \"cmd_handle_untagged: New mail in %s - %d messages total.\\n\", idata->mailbox, count)); idata->reopen |= IMAP_NEWMAIL_PENDING; } idata->newMailCount = count; } } /* pn vs. s: need initial seqno */ else if (ascii_strncasecmp (\"EXPUNGE\", s, 7) == 0) cmd_parse_expunge (idata, pn); else if (ascii_strncasecmp (\"FETCH\", s, 5) == 0) cmd_parse_fetch (idata, pn); } else if (ascii_strncasecmp (\"CAPABILITY\", s, 10) == 0) cmd_parse_capability (idata, s); else if (!ascii_strncasecmp (\"OK [CAPABILITY\", s, 14)) cmd_parse_capability (idata, pn); else if (!ascii_strncasecmp (\"OK [CAPABILITY\", pn, 14)) cmd_parse_capability (idata, imap_next_word (pn)); else if (ascii_strncasecmp (\"LIST\", s, 4) == 0) cmd_parse_list (idata, s); else if (ascii_strncasecmp (\"LSUB\", s, 4) == 0) cmd_parse_lsub (idata, s); else if (ascii_strncasecmp (\"MYRIGHTS\", s, 8) == 0) cmd_parse_myrights (idata, s); else if (ascii_strncasecmp (\"SEARCH\", s, 6) == 0) cmd_parse_search (idata, s); else if (ascii_strncasecmp (\"STATUS\", s, 6) == 0) cmd_parse_status (idata, s); else if (ascii_strncasecmp (\"ENABLED\", s, 7) == 0) cmd_parse_enabled (idata, s); else if (ascii_strncasecmp (\"BYE\", s, 3) == 0) { dprint (2, (debugfile, \"Handling BYE\\n\")); /* check if we're logging out */ if (idata->status == IMAP_BYE) return 0; /* server shut down our connection */ s += 3; SKIPWS (s); mutt_error (\"%s\", s); mutt_sleep (2); cmd_handle_fatal (idata); return -1; } else if (option (OPTIMAPSERVERNOISE) && (ascii_strncasecmp (\"NO\", s, 2) == 0)) { dprint (2, (debugfile, \"Handling untagged NO\\n\")); /* Display the warning message from the server */ mutt_error (\"%s\", s+3); mutt_sleep (2); } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Input Validation"], "explanation": "An issue was discovered in Mutt before 1.10.1 and NeoMutt before 2018-07-16. imap/command.c mishandles a NO response without a message.", "severity_level": "NoInfo", "cwe": "CWE-20", "cve": "CVE-2018-14349"}} -{"idx": 219883, "input": "Array HHVM_FUNCTION(gd_info) { Array ret = Array::CreateDArray(); ret.set(s_GD_Version, PHP_GD_VERSION_STRING); #ifdef ENABLE_GD_TTF ret.set(s_FreeType_Support, true); #if HAVE_LIBFREETYPE ret.set(s_FreeType_Linkage, s_with_freetype); #elif HAVE_LIBTTF ret.set(s_FreeType_Linkage, s_with_TTF_library); #else ret.set(s_FreeType_Linkage, s_with_unknown_library); #endif #else ret.set(s_FreeType_Support, false); #endif #ifdef HAVE_LIBT1 ret.set(s_T1Lib_Support, true); #else ret.set(s_T1Lib_Support, false); #endif ret.set(s_GIF_Read_Support, true); ret.set(s_GIF_Create_Support, true); #ifdef HAVE_GD_JPG ret.set(s_JPG_Support, true); #else ret.set(s_JPG_Support, false); #endif #ifdef HAVE_GD_PNG ret.set(s_PNG_Support, true); #else ret.set(s_PNG_Support, false); #endif ret.set(s_WBMP_Support, true); #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) ret.set(s_XPM_Support, true); #else ret.set(s_XPM_Support, false); #endif ret.set(s_XBM_Support, true); #if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED) ret.set(s_JIS_mapped_Japanese_Font_Support, true); #else ret.set(s_JIS_mapped_Japanese_Font_Support, false); #endif return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385768, "input": "MagickExport MagickBooleanType SolarizeImageChannel(Image *image, const ChannelType channel,const double threshold,ExceptionInfo *exception) { #define SolarizeImageTag \"Solarize/Image\" CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); if (IsGrayColorspace(image->colorspace) != MagickFalse) (void) SetImageColorspace(image,sRGBColorspace); if (image->storage_class == PseudoClass) { ssize_t i; /* Solarize colormap. */ for (i=0; i < (ssize_t) image->colors; i++) { if ((channel & RedChannel) != 0) if ((double) image->colormap[i].red > threshold) image->colormap[i].red=QuantumRange-image->colormap[i].red; if ((channel & GreenChannel) != 0) if ((double) image->colormap[i].green > threshold) image->colormap[i].green=QuantumRange-image->colormap[i].green; if ((channel & BlueChannel) != 0) if ((double) image->colormap[i].blue > threshold) image->colormap[i].blue=QuantumRange-image->colormap[i].blue; } } /* Solarize image. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \\ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { ssize_t x; PixelPacket *magick_restrict q; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1, exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { if ((channel & RedChannel) != 0) if ((double) GetPixelRed(q) > threshold) SetPixelRed(q,QuantumRange-GetPixelRed(q)); if ((channel & GreenChannel) != 0) if ((double) GetPixelGreen(q) > threshold) SetPixelGreen(q,QuantumRange-GetPixelGreen(q)); if ((channel & BlueChannel) != 0) if ((double) GetPixelBlue(q) > threshold) SetPixelBlue(q,QuantumRange-GetPixelBlue(q)); q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,SolarizeImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364959, "input": "static void __tipc_node_link_up(struct tipc_node *n, int bearer_id, struct sk_buff_head *xmitq) { int *slot0 = &n->active_links[0]; int *slot1 = &n->active_links[1]; struct tipc_link *ol = node_active_link(n, 0); struct tipc_link *nl = n->links[bearer_id].link; if (!nl || tipc_link_is_up(nl)) return; tipc_link_fsm_evt(nl, LINK_ESTABLISH_EVT); if (!tipc_link_is_up(nl)) return; n->working_links++; n->action_flags |= TIPC_NOTIFY_LINK_UP; n->link_id = tipc_link_id(nl); /* Leave room for tunnel header when returning 'mtu' to users: */ n->links[bearer_id].mtu = tipc_link_mss(nl); tipc_bearer_add_dest(n->net, bearer_id, n->addr); tipc_bcast_inc_bearer_dst_cnt(n->net, bearer_id); pr_debug(\"Established link <%s> on network plane %c\\n\", tipc_link_name(nl), tipc_link_plane(nl)); trace_tipc_node_link_up(n, true, \" \"); /* Ensure that a STATE message goes first */ tipc_link_build_state_msg(nl, xmitq); /* First link? => give it both slots */ if (!ol) { *slot0 = bearer_id; *slot1 = bearer_id; tipc_node_fsm_evt(n, SELF_ESTABL_CONTACT_EVT); n->action_flags |= TIPC_NOTIFY_NODE_UP; tipc_link_set_active(nl, true); tipc_bcast_add_peer(n->net, nl, xmitq); return; } /* Second link => redistribute slots */ if (tipc_link_prio(nl) > tipc_link_prio(ol)) { pr_debug(\"Old link <%s> becomes standby\\n\", tipc_link_name(ol)); *slot0 = bearer_id; *slot1 = bearer_id; tipc_link_set_active(nl, true); tipc_link_set_active(ol, false); } else if (tipc_link_prio(nl) == tipc_link_prio(ol)) { tipc_link_set_active(nl, true); *slot1 = bearer_id; } else { pr_debug(\"New link <%s> is standby\\n\", tipc_link_name(nl)); } /* Prepare synchronization with first link */ tipc_link_tnl_prepare(ol, nl, SYNCH_MSG, xmitq); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416771, "input": "int __cil_reset_node(struct cil_tree_node *node, __attribute__((unused)) uint32_t *finished, __attribute__((unused)) void *extra_args) { switch (node->flavor) { case CIL_CLASS: cil_reset_class(node->data); break; case CIL_PERM: case CIL_MAP_PERM: cil_reset_perm(node->data); break; case CIL_CLASSPERMISSION: cil_reset_classpermission(node->data); break; case CIL_CLASSPERMISSIONSET: cil_reset_classpermissionset(node->data); break; case CIL_CLASSMAPPING: cil_reset_classmapping(node->data); break; case CIL_TYPEALIAS: case CIL_SENSALIAS: case CIL_CATALIAS: cil_reset_alias(node->data); break; case CIL_USERRANGE: cil_reset_userrange(node->data); break; case CIL_USERLEVEL: cil_reset_userlevel(node->data); break; case CIL_USER: cil_reset_user(node->data); break; case CIL_USERATTRIBUTE: cil_reset_userattr(node->data); break; case CIL_USERATTRIBUTESET: cil_reset_userattributeset(node->data); break; case CIL_SELINUXUSERDEFAULT: case CIL_SELINUXUSER: cil_reset_selinuxuser(node->data); break; case CIL_ROLE: cil_reset_role(node->data); break; case CIL_ROLEATTRIBUTE: cil_reset_roleattr(node->data); break; case CIL_ROLEATTRIBUTESET: cil_reset_roleattributeset(node->data); break; case CIL_TYPE: cil_reset_type(node->data); break; case CIL_TYPEATTRIBUTE: cil_reset_typeattr(node->data); break; case CIL_TYPEATTRIBUTESET: cil_reset_typeattributeset(node->data); break; case CIL_RANGETRANSITION: cil_reset_rangetransition(node->data); break; case CIL_AVRULE: cil_reset_avrule(node->data); break; case CIL_SENS: cil_reset_sens(node->data); break; case CIL_CAT: cil_reset_cat(node->data); break; case CIL_SENSCAT: cil_reset_senscat(node->data); break; case CIL_CATSET: cil_reset_catset(node->data); break; case CIL_LEVEL: cil_reset_level(node->data); break; case CIL_LEVELRANGE: cil_reset_levelrange(node->data); break; case CIL_CONTEXT: cil_reset_context(node->data); break; case CIL_SIDCONTEXT: cil_reset_sidcontext(node->data); break; case CIL_FILECON: cil_reset_filecon(node->data); break; case CIL_IBPKEYCON: cil_reset_ibpkeycon(node->data); break; case CIL_IBENDPORTCON: cil_reset_ibendportcon(node->data); break; case CIL_PORTCON: cil_reset_portcon(node->data); break; case CIL_NODECON: cil_reset_nodecon(node->data); break; case CIL_GENFSCON: cil_reset_genfscon(node->data); break; case CIL_NETIFCON: cil_reset_netifcon(node->data); break; case CIL_PIRQCON: cil_reset_pirqcon(node->data); break; case CIL_IOMEMCON: cil_reset_iomemcon(node->data); break; case CIL_IOPORTCON: cil_reset_ioportcon(node->data); break; case CIL_PCIDEVICECON: cil_reset_pcidevicecon(node->data); break; case CIL_DEVICETREECON: cil_reset_devicetreecon(node->data); break; case CIL_FSUSE: cil_reset_fsuse(node->data); break; case CIL_SID: cil_reset_sid(node->data); break; case CIL_CONSTRAIN: case CIL_MLSCONSTRAIN: cil_reset_constrain(node->data); break; case CIL_VALIDATETRANS: case CIL_MLSVALIDATETRANS: cil_reset_validatetrans(node->data); break; case CIL_DEFAULTUSER: case CIL_DEFAULTROLE: case CIL_DEFAULTTYPE: cil_reset_default(node->data); break; case CIL_DEFAULTRANGE: cil_reset_defaultrange(node->data); break; case CIL_BOOLEANIF: cil_reset_booleanif(node->data); break; case CIL_TUNABLEIF: case CIL_CALL: break; /* Not effected by optional block disabling */ case CIL_MACRO: case CIL_SIDORDER: case CIL_CLASSORDER: case CIL_CATORDER: case CIL_SENSITIVITYORDER: case CIL_EXPANDTYPEATTRIBUTE: break; /* Nothing to reset */ default: break; } return SEPOL_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385233, "input": "guint32 get_mptcp_stream_count(void) { return mptcp_stream_count; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295058, "input": "rdpUpdate* update_new(rdpRdp* rdp) { const wObject cb = { NULL, NULL, NULL, update_free_queued_message, NULL }; rdpUpdate* update; OFFSCREEN_DELETE_LIST* deleteList; WINPR_UNUSED(rdp); update = (rdpUpdate*)calloc(1, sizeof(rdpUpdate)); if (!update) return NULL; update->log = WLog_Get(\"com.freerdp.core.update\"); InitializeCriticalSection(&(update->mux)); update->pointer = (rdpPointerUpdate*)calloc(1, sizeof(rdpPointerUpdate)); if (!update->pointer) goto fail; update->primary = (rdpPrimaryUpdate*)calloc(1, sizeof(rdpPrimaryUpdate)); if (!update->primary) goto fail; update->secondary = (rdpSecondaryUpdate*)calloc(1, sizeof(rdpSecondaryUpdate)); if (!update->secondary) goto fail; update->altsec = (rdpAltSecUpdate*)calloc(1, sizeof(rdpAltSecUpdate)); if (!update->altsec) goto fail; update->window = (rdpWindowUpdate*)calloc(1, sizeof(rdpWindowUpdate)); if (!update->window) goto fail; deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); deleteList->sIndices = 64; deleteList->indices = calloc(deleteList->sIndices, 2); if (!deleteList->indices) goto fail; deleteList->cIndices = 0; update->SuppressOutput = update_send_suppress_output; update->initialState = TRUE; update->autoCalculateBitmapData = TRUE; update->queue = MessageQueue_New(&cb); if (!update->queue) goto fail; return update; fail: update_free(update); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 455053, "input": "FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, uint32_t parameter) { FLAC__uint32 lsbs = 0, msbs = 0; uint32_t uval; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); FLAC__ASSERT(parameter <= 31); /* read the unary MSBs and end bit */ if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) return false; /* read the binary LSBs */ if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter)) return false; /* compose the value */ uval = (msbs << parameter) | lsbs; if(uval & 1) *val = -((int)(uval >> 1)) - 1; else *val = (int)(uval >> 1); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 231537, "input": "TEST_F(ZNCTest, Encoding) { auto znc = Run(); auto ircd = ConnectIRCd(); auto client = LoginClient(); ircd.Write(\":server 001 nick :hello\"); // legacy ircd.Write(\":n!u@h PRIVMSG nick :Hello\\xE6world\"); client.ReadUntil(\"Hello\\xE6world\"); client.Write(\"PRIVMSG *controlpanel :SetNetwork Encoding $me $net UTF-8\"); client.ReadUntil(\"Encoding = UTF-8\"); ircd.Write(\":n!u@h PRIVMSG nick :Hello\\xE6world\"); client.ReadUntil(\"Hello\\xEF\\xBF\\xBDworld\"); client.Write( \"PRIVMSG *controlpanel :SetNetwork Encoding $me $net ^CP-1251\"); client.ReadUntil(\"Encoding = ^CP-1251\"); ircd.Write(\":n!u@h PRIVMSG nick :Hello\\xE6world\"); client.ReadUntil(\"Hello\\xD0\\xB6world\"); ircd.Write(\":n!u@h PRIVMSG nick :Hello\\xD0\\xB6world\"); client.ReadUntil(\"Hello\\xD0\\xB6world\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508669, "input": "bool TABLE_REF::tmp_table_index_lookup_init(THD *thd, KEY *tmp_key, Item_iterator &it, bool value, uint skip) { uint tmp_key_parts= tmp_key->user_defined_key_parts; uint i; DBUG_ENTER(\"TABLE_REF::tmp_table_index_lookup_init\"); key= 0; /* The only temp table index. */ key_length= tmp_key->key_length; if (!(key_buff= (uchar*) thd->calloc(ALIGN_SIZE(tmp_key->key_length) * 2)) || !(key_copy= (store_key**) thd->alloc((sizeof(store_key*) * (tmp_key_parts + 1)))) || !(items= (Item**) thd->alloc(sizeof(Item*) * tmp_key_parts))) DBUG_RETURN(TRUE); key_buff2= key_buff + ALIGN_SIZE(tmp_key->key_length); KEY_PART_INFO *cur_key_part= tmp_key->key_part; store_key **ref_key= key_copy; uchar *cur_ref_buff= key_buff; it.open(); for (i= 0; i < skip; i++) it.next(); for (i= 0; i < tmp_key_parts; i++, cur_key_part++, ref_key++) { Item *item= it.next(); DBUG_ASSERT(item); items[i]= item; int null_count= MY_TEST(cur_key_part->field->real_maybe_null()); *ref_key= new store_key_item(thd, cur_key_part->field, /* TIMOUR: the NULL byte is taken into account in cur_key_part->store_length, so instead of cur_ref_buff + MY_TEST(maybe_null), we could use that information instead. */ cur_ref_buff + null_count, null_count ? cur_ref_buff : 0, cur_key_part->length, items[i], value); cur_ref_buff+= cur_key_part->store_length; } *ref_key= NULL; /* End marker. */ key_err= 1; key_parts= tmp_key_parts; DBUG_RETURN(FALSE); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 227287, "input": "void pushDouble(double data) { auto const tv = top++; tv->m_type = KindOfDouble; tv->m_data.dbl = data; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263453, "input": "void ReinterpretCopyArray(T (&dst)[M], const U (&src)[N], size_t max_len = SIZE_MAX) { memcpy(dst, src, std::min(max_len, std::min(sizeof(T) * M, sizeof(U) * N))); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338622, "input": "static int io_import_fixed(struct io_kiocb *req, int rw, struct iov_iter *iter) { struct io_ring_ctx *ctx = req->ctx; struct io_mapped_ubuf *imu = req->imu; u16 index, buf_index = req->buf_index; if (likely(!imu)) { if (unlikely(buf_index >= ctx->nr_user_bufs)) return -EFAULT; index = array_index_nospec(buf_index, ctx->nr_user_bufs); imu = READ_ONCE(ctx->user_bufs[index]); req->imu = imu; } return __io_import_fixed(req, rw, iter, imu); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357438, "input": "static OPJ_UINT32 opj_j2k_get_max_coc_size(opj_j2k_t *p_j2k) { OPJ_UINT32 i, j; OPJ_UINT32 l_nb_comp; OPJ_UINT32 l_nb_tiles; OPJ_UINT32 l_max = 0; /* preconditions */ l_nb_tiles = p_j2k->m_cp.tw * p_j2k->m_cp.th ; l_nb_comp = p_j2k->m_private_image->numcomps; for (i = 0; i < l_nb_tiles; ++i) { for (j = 0; j < l_nb_comp; ++j) { l_max = opj_uint_max(l_max, opj_j2k_get_SPCod_SPCoc_size(p_j2k, i, j)); } } return 6 + l_max; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 356887, "input": "ProtocolV1::~ProtocolV1() { ceph_assert(out_q.empty()); ceph_assert(sent.empty()); delete[] temp_buffer; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461653, "input": "static void rsi_reg_notify(struct wiphy *wiphy, struct regulatory_request *request) { struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct rsi_hw * adapter = hw->priv; struct rsi_common *common = adapter->priv; int i; mutex_lock(&common->mutex); rsi_dbg(INFO_ZONE, \"country = %s dfs_region = %d\\n\", request->alpha2, request->dfs_region); if (common->num_supp_bands > 1) { sband = wiphy->bands[NL80211_BAND_5GHZ]; for (i = 0; i < sband->n_channels; i++) { ch = &sband->channels[i]; if (ch->flags & IEEE80211_CHAN_DISABLED) continue; if (ch->flags & IEEE80211_CHAN_RADAR) ch->flags |= IEEE80211_CHAN_NO_IR; } } adapter->dfs_region = rsi_map_region_code(request->dfs_region); rsi_dbg(INFO_ZONE, \"RSI region code = %d\\n\", adapter->dfs_region); adapter->country[0] = request->alpha2[0]; adapter->country[1] = request->alpha2[1]; mutex_unlock(&common->mutex); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219474, "input": "bool HHVM_FUNCTION(imagegif, const Resource& image, const String& filename /* = null_string */) { return _php_image_output_ctx(image, filename, -1, -1, PHP_GDIMG_TYPE_GIF, \"GIF\", (void (*)())gdImageGifCtx); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197725, "input": "GF_Err gf_hinter_track_finalize(GF_RTPHinter *tkHint, Bool AddSystemInfo) { u32 Width, Height; GF_ESD *esd; char sdpLine[20000]; char mediaName[30], payloadName[30]; u32 mtype; Width = Height = 0; gf_isom_sdp_clean_track(tkHint->file, tkHint->TrackNum); mtype = gf_isom_get_media_type(tkHint->file, tkHint->TrackNum); if (gf_isom_is_video_handler_type(mtype)) gf_isom_get_visual_info(tkHint->file, tkHint->TrackNum, 1, &Width, &Height); gf_rtp_builder_get_payload_name(tkHint->rtp_p, payloadName, mediaName); /*TODO- extract out of rtp_p for future live tools*/ sprintf(sdpLine, \"m=%s 0 RTP/%s %d\", mediaName, tkHint->rtp_p->slMap.IV_length ? \"SAVP\" : \"AVP\", tkHint->rtp_p->PayloadType); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); if (tkHint->bandwidth) { sprintf(sdpLine, \"b=AS:%d\", tkHint->bandwidth); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } if (tkHint->nb_chan) { sprintf(sdpLine, \"a=rtpmap:%d %s/%d/%d\", tkHint->rtp_p->PayloadType, payloadName, tkHint->rtp_p->sl_config.timestampResolution, tkHint->nb_chan); } else { sprintf(sdpLine, \"a=rtpmap:%d %s/%d\", tkHint->rtp_p->PayloadType, payloadName, tkHint->rtp_p->sl_config.timestampResolution); } gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); /*control for MPEG-4*/ if (AddSystemInfo) { sprintf(sdpLine, \"a=mpeg4-esid:%d\", gf_isom_get_track_id(tkHint->file, tkHint->TrackNum)); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } /*control for QTSS/DSS*/ sprintf(sdpLine, \"a=control:trackID=%d\", gf_isom_get_track_id(tkHint->file, tkHint->HintTrack)); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); /*H263 extensions*/ if (tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_H263) { sprintf(sdpLine, \"a=cliprect:0,0,%d,%d\", Height, Width); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } /*AMR*/ else if ((tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_AMR) || (tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_AMR_WB)) { sprintf(sdpLine, \"a=fmtp:%d octet-align=1\", tkHint->rtp_p->PayloadType); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } /*Text*/ else if (tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_3GPP_TEXT) { u32 w, h, i, m_w, m_h; s32 tx, ty; s16 l; gf_isom_get_track_layout_info(tkHint->file, tkHint->TrackNum, &w, &h, &tx, &ty, &l); m_w = w; m_h = h; for (i=0; ifile); i++) { switch (gf_isom_get_media_type(tkHint->file, i+1)) { case GF_ISOM_MEDIA_SCENE: case GF_ISOM_MEDIA_VISUAL: case GF_ISOM_MEDIA_AUXV: case GF_ISOM_MEDIA_PICT: gf_isom_get_track_layout_info(tkHint->file, i+1, &w, &h, &tx, &ty, &l); if (w>m_w) m_w = w; if (h>m_h) m_h = h; break; default: break; } } gf_media_format_ttxt_sdp(tkHint->rtp_p, payloadName, sdpLine, w, h, tx, ty, l, m_w, m_h, NULL); strcat(sdpLine, \"; tx3g=\"); for (i=0; ifile, tkHint->TrackNum); i++) { u8 *tx3g; char buffer[2000]; u32 tx3g_len, len; gf_isom_text_get_encoded_tx3g(tkHint->file, tkHint->TrackNum, i+1, GF_RTP_TX3G_SIDX_OFFSET, &tx3g, &tx3g_len); len = gf_base64_encode(tx3g, tx3g_len, buffer, 2000); gf_free(tx3g); buffer[len] = 0; if (i) strcat(sdpLine, \", \"); strcat(sdpLine, buffer); } gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } /*EVRC/SMV in non header-free mode*/ else if ((tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_EVRC_SMV) && (tkHint->rtp_p->auh_size>1)) { sprintf(sdpLine, \"a=fmtp:%d maxptime=%d\", tkHint->rtp_p->PayloadType, tkHint->rtp_p->auh_size*20); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } /*H264/AVC*/ else if ((tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_H264_AVC) || (tkHint->rtp_p->rtp_payt == GF_RTP_PAYT_H264_SVC)) { GF_AVCConfig *avcc = gf_isom_avc_config_get(tkHint->file, tkHint->TrackNum, 1); GF_AVCConfig *svcc = gf_isom_svc_config_get(tkHint->file, tkHint->TrackNum, 1); /*TODO - check syntax for SVC (might be some extra signaling)*/ if (avcc) { sprintf(sdpLine, \"a=fmtp:%d profile-level-id=%02X%02X%02X; packetization-mode=1\", tkHint->rtp_p->PayloadType, avcc->AVCProfileIndication, avcc->profile_compatibility, avcc->AVCLevelIndication); } else { sprintf(sdpLine, \"a=fmtp:%d profile-level-id=%02X%02X%02X; packetization-mode=1\", tkHint->rtp_p->PayloadType, svcc->AVCProfileIndication, svcc->profile_compatibility, svcc->AVCLevelIndication); } write_avc_config(sdpLine, avcc, svcc); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); gf_odf_avc_cfg_del(avcc); gf_odf_avc_cfg_del(svcc); } /*MPEG-4 decoder config*/ else if (tkHint->rtp_p->rtp_payt==GF_RTP_PAYT_MPEG4) { esd = gf_isom_get_esd(tkHint->file, tkHint->TrackNum, 1); if (esd && esd->decoderConfig && esd->decoderConfig->decoderSpecificInfo && esd->decoderConfig->decoderSpecificInfo->data) { gf_rtp_builder_format_sdp(tkHint->rtp_p, payloadName, sdpLine, esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength); } else { gf_rtp_builder_format_sdp(tkHint->rtp_p, payloadName, sdpLine, NULL, 0); } if (esd) gf_odf_desc_del((GF_Descriptor *)esd); if (tkHint->rtp_p->slMap.IV_length) { const char *kms; gf_isom_get_ismacryp_info(tkHint->file, tkHint->TrackNum, 1, NULL, NULL, NULL, NULL, &kms, NULL, NULL, NULL); if (!strnicmp(kms, \"(key)\", 5) || !strnicmp(kms, \"(ipmp)\", 6) || !strnicmp(kms, \"(uri)\", 5)) { strcat(sdpLine, \"; ISMACrypKey=\"); } else { strcat(sdpLine, \"; ISMACrypKey=(uri)\"); } strcat(sdpLine, kms); } gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } /*MPEG-4 Audio LATM*/ else if (tkHint->rtp_p->rtp_payt==GF_RTP_PAYT_LATM) { GF_BitStream *bs; u8 *config_bytes; u32 config_size; /* form config string */ bs = gf_bs_new(NULL, 32, GF_BITSTREAM_WRITE); gf_bs_write_int(bs, 0, 1); /* AudioMuxVersion */ gf_bs_write_int(bs, 1, 1); /* all streams same time */ gf_bs_write_int(bs, 0, 6); /* numSubFrames */ gf_bs_write_int(bs, 0, 4); /* numPrograms */ gf_bs_write_int(bs, 0, 3); /* numLayer */ /* audio-specific config */ esd = gf_isom_get_esd(tkHint->file, tkHint->TrackNum, 1); if (esd && esd->decoderConfig && esd->decoderConfig->decoderSpecificInfo) { /*PacketVideo patch: don't signal SBR and PS stuff, not allowed in LATM with audioMuxVersion=0*/ gf_bs_write_data(bs, esd->decoderConfig->decoderSpecificInfo->data, MIN(esd->decoderConfig->decoderSpecificInfo->dataLength, 2) ); } if (esd) gf_odf_desc_del((GF_Descriptor *)esd); /* other data */ gf_bs_write_int(bs, 0, 3); /* frameLengthType */ gf_bs_write_int(bs, 0xff, 8); /* latmBufferFullness */ gf_bs_write_int(bs, 0, 1); /* otherDataPresent */ gf_bs_write_int(bs, 0, 1); /* crcCheckPresent */ gf_bs_get_content(bs, &config_bytes, &config_size); gf_bs_del(bs); gf_rtp_builder_format_sdp(tkHint->rtp_p, payloadName, sdpLine, config_bytes, config_size); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); gf_free(config_bytes); } #if GPAC_ENABLE_3GPP_DIMS_RTP /*3GPP DIMS*/ else if (tkHint->rtp_p->rtp_payt==GF_RTP_PAYT_3GPP_DIMS) { GF_DIMSDescription dims; gf_isom_get_visual_info(tkHint->file, tkHint->TrackNum, 1, &Width, &Height); gf_isom_get_dims_description(tkHint->file, tkHint->TrackNum, 1, &dims); sprintf(sdpLine, \"a=fmtp:%d Version-profile=%d\", tkHint->rtp_p->PayloadType, dims.profile); if (! dims.fullRequestHost) { char fmt[200]; strcat(sdpLine, \";useFullRequestHost=0\"); sprintf(fmt, \";pathComponents=%d\", dims.pathComponents); strcat(sdpLine, fmt); } if (!dims.streamType) strcat(sdpLine, \";stream-type=secondary\"); if (dims.containsRedundant == 1) strcat(sdpLine, \";contains-redundant=main\"); else if (dims.containsRedundant == 2) strcat(sdpLine, \";contains-redundant=redundant\"); if (dims.textEncoding && strlen(dims.textEncoding)) { strcat(sdpLine, \";text-encoding=\"); strcat(sdpLine, dims.textEncoding); } if (dims.contentEncoding && strlen(dims.contentEncoding)) { strcat(sdpLine, \";content-coding=\"); strcat(sdpLine, dims.contentEncoding); } if (dims.contentEncoding && dims.content_script_types && strlen(dims.content_script_types) ) { strcat(sdpLine, \";content-script-types=\"); strcat(sdpLine, dims.contentEncoding); } gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } #endif /*extensions for some mobile phones*/ if (Width && Height) { sprintf(sdpLine, \"a=framesize:%d %d-%d\", tkHint->rtp_p->PayloadType, Width, Height); gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } esd = gf_isom_get_esd(tkHint->file, tkHint->TrackNum, 1); if (esd && esd->decoderConfig && (esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config)) { if (esd->decoderConfig->predefined_rvc_config) { sprintf(sdpLine, \"a=rvc-config-predef:%d\", esd->decoderConfig->predefined_rvc_config); } else { /*temporary ...*/ if ((esd->decoderConfig->objectTypeIndication==GF_CODECID_AVC) || (esd->decoderConfig->objectTypeIndication==GF_CODECID_SVC)) { sprintf(sdpLine, \"a=rvc-config:%s\", \"http://download.tsi.telecom-paristech.fr/gpac/RVC/rvc_config_avc.xml\"); } else { sprintf(sdpLine, \"a=rvc-config:%s\", \"http://download.tsi.telecom-paristech.fr/gpac/RVC/rvc_config_sp.xml\"); } } gf_isom_sdp_add_track_line(tkHint->file, tkHint->HintTrack, sdpLine); } if (esd) gf_odf_desc_del((GF_Descriptor *)esd); gf_isom_set_track_enabled(tkHint->file, tkHint->HintTrack, GF_TRUE); return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "An issue was discovered in GPAC version 0.8.0 and 1.0.1. There is an invalid pointer dereference in the function gf_hinter_track_finalize() in media_tools/isom_hinter.c.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2020-35982"}} -{"idx": 204190, "input": "static inline void kvm_memslot_delete(struct kvm_memslots *slots, struct kvm_memory_slot *memslot) { struct kvm_memory_slot *mslots = slots->memslots; int i; if (WARN_ON(slots->id_to_index[memslot->id] == -1)) return; slots->used_slots--; for (i = slots->id_to_index[memslot->id]; i < slots->used_slots; i++) { mslots[i] = mslots[i + 1]; slots->id_to_index[mslots[i].id] = i; } mslots[i] = *memslot; slots->id_to_index[memslot->id] = -1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "An issue was discovered in the Linux kernel before 5.7. The KVM subsystem allows out-of-range access to memslots after a deletion, aka CID-0774a964ef56. This affects arch/s390/kvm/kvm-s390.c, include/linux/kvm_host.h, and virt/kvm/kvm_main.c.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2020-36313"}} -{"idx": 277945, "input": "compl_dir_forward(void) { return compl_direction == FORWARD; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416810, "input": "static MagickBooleanType SerializeImage(const ImageInfo *image_info, Image *image,MemoryInfo **pixel_info,size_t *length,ExceptionInfo *exception) { MagickBooleanType status; register const Quantum *p; register ssize_t x; register unsigned char *q; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); status=MagickTrue; *length=(image->colorspace == CMYKColorspace ? 4 : 3)*(size_t) image->columns*image->rows; *pixel_info=AcquireVirtualMemory(*length,sizeof(*q)); if (*pixel_info == (MemoryInfo *) NULL) ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\"); q=(unsigned char *) GetVirtualMemoryBlob(*pixel_info); for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { *q++=ScaleQuantumToChar(GetPixelRed(image,p)); *q++=ScaleQuantumToChar(GetPixelGreen(image,p)); *q++=ScaleQuantumToChar(GetPixelBlue(image,p)); p+=GetPixelChannels(image); } else for (x=0; x < (ssize_t) image->columns; x++) { *q++=ScaleQuantumToChar(GetPixelRed(image,p)); *q++=ScaleQuantumToChar(GetPixelGreen(image,p)); *q++=ScaleQuantumToChar(GetPixelBlue(image,p)); *q++=ScaleQuantumToChar(GetPixelBlack(image,p)); p+=GetPixelChannels(image); } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (status == MagickFalse) *pixel_info=RelinquishVirtualMemory(*pixel_info); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381465, "input": "static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct video_device *vfd = video_devdata(file); struct v4l2_query_ext_ctrl *p = arg; struct v4l2_fh *vfh = test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; if (vfh && vfh->ctrl_handler) return v4l2_query_ext_ctrl(vfh->ctrl_handler, p); if (vfd->ctrl_handler) return v4l2_query_ext_ctrl(vfd->ctrl_handler, p); if (ops->vidioc_query_ext_ctrl) return ops->vidioc_query_ext_ctrl(file, fh, p); return -ENOTTY; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 254855, "input": "static int acceptable(u_int32_t num_pkts){ return num_pkts > 5; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270696, "input": "static int cardos_create_file(sc_card_t *card, sc_file_t *file) { int r; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (card->type == SC_CARD_TYPE_CARDOS_GENERIC || card->type == SC_CARD_TYPE_CARDOS_M4_01) { r = cardos_set_file_attributes(card, file); if (r != SC_SUCCESS) return r; return iso_ops->create_file(card, file); } else if (card->type == SC_CARD_TYPE_CARDOS_M4_2 || card->type == SC_CARD_TYPE_CARDOS_M4_3 || card->type == SC_CARD_TYPE_CARDOS_M4_2B || card->type == SC_CARD_TYPE_CARDOS_M4_2C || card->type == SC_CARD_TYPE_CARDOS_M4_4) { u8 sbuf[SC_MAX_APDU_BUFFER_SIZE]; size_t len = sizeof(sbuf); sc_apdu_t apdu; r = cardos_construct_fcp(card, file, sbuf, &len); if (r < 0) { sc_log(card->ctx, \"unable to create FCP\"); return r; } sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE0, 0x00, 0x00); apdu.lc = len; apdu.datalen = len; apdu.data = sbuf; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(card->ctx, r, \"APDU transmit failed\"); return sc_check_sw(card, apdu.sw1, apdu.sw2); } else return SC_ERROR_NOT_SUPPORTED; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219596, "input": "Accessor& operator=(EntryPtr&& ep) { switch (m_kind) { case Kind::AccessorKind: m_u.accessor.~ConstAccessor(); case Kind::Empty: case Kind::Ptr: m_kind = Kind::SmartPtr; new (&m_u.smart_ptr) EntryPtr(std::move(ep)); break; case Kind::SmartPtr: m_u.smart_ptr = std::move(ep); break; } return *this; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268995, "input": "R_API char *r_str_escape_sh(const char *buf) { r_return_val_if_fail (buf, NULL); char *new_buf = malloc (1 + strlen (buf) * 2); if (!new_buf) { return NULL; } const char *p = buf; char *q = new_buf; while (*p) { switch (*p) { #if __UNIX__ case '$': case '`': #endif case '\\\\': case '\"': *q++ = '\\\\'; /* FALLTHRU */ default: *q++ = *p++; break; } } *q = '\\0'; return new_buf; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197476, "input": "CallResult JSObject::putComputedWithReceiver_RJS( Handle selfHandle, Runtime *runtime, Handle<> nameValHandle, Handle<> valueHandle, Handle<> receiver, PropOpFlags opFlags) { assert( !opFlags.getMustExist() && \"mustExist flag cannot be used with computed properties\"); // Try the fast-path first: has \"index-like\" properties, the \"name\" // already is a valid integer index, selfHandle and receiver are the // same, and it is present in storage. if (selfHandle->flags_.fastIndexProperties) { if (auto arrayIndex = toArrayIndexFastPath(*nameValHandle)) { if (selfHandle.getHermesValue().getRaw() == receiver->getRaw()) { if (haveOwnIndexed(selfHandle.get(), runtime, *arrayIndex)) { auto result = setOwnIndexed(selfHandle, runtime, *arrayIndex, valueHandle); if (LLVM_UNLIKELY(result == ExecutionStatus::EXCEPTION)) return ExecutionStatus::EXCEPTION; if (LLVM_LIKELY(*result)) return true; if (opFlags.getThrowOnError()) { // TODO: better message. return runtime->raiseTypeError( \"Cannot assign to read-only property\"); } return false; } } } } // If nameValHandle is an object, we should convert it to string now, // because toString may have side-effect, and we want to do this only // once. auto converted = toPropertyKeyIfObject(runtime, nameValHandle); if (LLVM_UNLIKELY(converted == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } auto nameValPrimitiveHandle = *converted; ComputedPropertyDescriptor desc; // Look for the property in this object or along the prototype chain. MutableHandle propObj{runtime}; if (LLVM_UNLIKELY( getComputedPrimitiveDescriptor( selfHandle, runtime, nameValPrimitiveHandle, propObj, desc) == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } // If the property exists (or, we hit a proxy/hostobject on the way // up the chain) if (propObj) { // Get the simple case out of the way: If the property already // exists on selfHandle, is not an accessor, selfHandle and // receiver are the same, selfHandle is not a host // object/proxy/internal setter, and the property is writable, // just write into the same slot. if (LLVM_LIKELY( selfHandle == propObj && selfHandle.getHermesValue().getRaw() == receiver->getRaw() && !desc.flags.accessor && !desc.flags.internalSetter && !desc.flags.hostObject && !desc.flags.proxyObject && desc.flags.writable)) { if (LLVM_UNLIKELY( setComputedSlotValue(selfHandle, runtime, desc, valueHandle) == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } return true; } // Is it an accessor? if (LLVM_UNLIKELY(desc.flags.accessor)) { auto *accessor = vmcast( getComputedSlotValue(propObj.get(), runtime, desc)); // If it is a read-only accessor, fail. if (!accessor->setter) { if (opFlags.getThrowOnError()) { return runtime->raiseTypeErrorForValue( \"Cannot assign to property \", nameValPrimitiveHandle, \" which has only a getter\"); } return false; } // Execute the accessor on this object. if (accessor->setter.get(runtime)->executeCall1( runtime->makeHandle(accessor->setter), runtime, receiver, valueHandle.get()) == ExecutionStatus::EXCEPTION) { return ExecutionStatus::EXCEPTION; } return true; } if (LLVM_UNLIKELY(desc.flags.proxyObject)) { assert( !opFlags.getMustExist() && \"MustExist cannot be used with Proxy objects\"); CallResult> key = toPropertyKey(runtime, nameValPrimitiveHandle); if (key == ExecutionStatus::EXCEPTION) return ExecutionStatus::EXCEPTION; CallResult setRes = JSProxy::setComputed(propObj, runtime, *key, valueHandle, receiver); if (LLVM_UNLIKELY(setRes == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } if (!*setRes && opFlags.getThrowOnError()) { // TODO: better message. return runtime->raiseTypeError( TwineChar16(\"Proxy trap returned false for property\")); } return setRes; } if (LLVM_UNLIKELY(!desc.flags.writable)) { if (desc.flags.staticBuiltin) { SymbolID id{}; LAZY_TO_IDENTIFIER(runtime, nameValPrimitiveHandle, id); return raiseErrorForOverridingStaticBuiltin( selfHandle, runtime, runtime->makeHandle(id)); } if (opFlags.getThrowOnError()) { return runtime->raiseTypeErrorForValue( \"Cannot assign to read-only property \", nameValPrimitiveHandle, \"\"); } return false; } if (selfHandle == propObj && desc.flags.internalSetter) { SymbolID id{}; LAZY_TO_IDENTIFIER(runtime, nameValPrimitiveHandle, id); return internalSetter( selfHandle, runtime, id, desc.castToNamedPropertyDescriptorRef(), valueHandle, opFlags); } } // The property does not exist as an conventional own property on // this object. MutableHandle receiverHandle{runtime, *selfHandle}; if (selfHandle.getHermesValue().getRaw() != receiver->getRaw() || receiverHandle->isHostObject() || receiverHandle->isProxyObject()) { if (selfHandle.getHermesValue().getRaw() != receiver->getRaw()) { receiverHandle = dyn_vmcast(*receiver); } if (!receiverHandle) { return false; } CallResult descDefinedRes = getOwnComputedPrimitiveDescriptor( receiverHandle, runtime, nameValPrimitiveHandle, IgnoreProxy::No, desc); if (LLVM_UNLIKELY(descDefinedRes == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } DefinePropertyFlags dpf; if (*descDefinedRes) { if (LLVM_UNLIKELY(desc.flags.accessor || !desc.flags.writable)) { return false; } if (LLVM_LIKELY( !desc.flags.internalSetter && !receiverHandle->isHostObject() && !receiverHandle->isProxyObject())) { if (LLVM_UNLIKELY( setComputedSlotValue( receiverHandle, runtime, desc, valueHandle) == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } return true; } } if (LLVM_UNLIKELY( desc.flags.internalSetter || receiverHandle->isHostObject() || receiverHandle->isProxyObject())) { SymbolID id{}; LAZY_TO_IDENTIFIER(runtime, nameValPrimitiveHandle, id); if (desc.flags.internalSetter) { return internalSetter( receiverHandle, runtime, id, desc.castToNamedPropertyDescriptorRef(), valueHandle, opFlags); } else if (receiverHandle->isHostObject()) { return vmcast(receiverHandle.get())->set(id, *valueHandle); } assert( receiverHandle->isProxyObject() && \"descriptor flags are impossible\"); if (*descDefinedRes) { dpf.setValue = 1; } else { dpf = DefinePropertyFlags::getDefaultNewPropertyFlags(); } return JSProxy::defineOwnProperty( receiverHandle, runtime, nameValPrimitiveHandle, dpf, valueHandle, opFlags); } } /// Can we add more properties? if (LLVM_UNLIKELY(!receiverHandle->isExtensible())) { if (opFlags.getThrowOnError()) { return runtime->raiseTypeError( \"cannot add a new property\"); // TODO: better message. } return false; } // If we have indexed storage we must check whether the property is an index, // and if it is, store it in indexed storage. if (receiverHandle->flags_.indexedStorage) { OptValue arrayIndex; MutableHandle strPrim{runtime}; TO_ARRAY_INDEX(runtime, nameValPrimitiveHandle, strPrim, arrayIndex); if (arrayIndex) { // Check whether we need to update array's \".length\" property. if (auto *array = dyn_vmcast(receiverHandle.get())) { if (LLVM_UNLIKELY(*arrayIndex >= JSArray::getLength(array))) { auto cr = putNamed_RJS( receiverHandle, runtime, Predefined::getSymbolID(Predefined::length), runtime->makeHandle( HermesValue::encodeNumberValue(*arrayIndex + 1)), opFlags); if (LLVM_UNLIKELY(cr == ExecutionStatus::EXCEPTION)) return ExecutionStatus::EXCEPTION; if (LLVM_UNLIKELY(!*cr)) return false; } } auto result = setOwnIndexed(receiverHandle, runtime, *arrayIndex, valueHandle); if (LLVM_UNLIKELY(result == ExecutionStatus::EXCEPTION)) return ExecutionStatus::EXCEPTION; if (LLVM_LIKELY(*result)) return true; if (opFlags.getThrowOnError()) { // TODO: better message. return runtime->raiseTypeError(\"Cannot assign to read-only property\"); } return false; } } SymbolID id{}; LAZY_TO_IDENTIFIER(runtime, nameValPrimitiveHandle, id); // Add a new named property. return addOwnProperty( receiverHandle, runtime, id, DefinePropertyFlags::getDefaultNewPropertyFlags(), valueHandle, opFlags); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "An out-of-bounds read in the JavaScript Interpreter in Facebook Hermes prior to commit 8cb935cd3b2321c46aa6b7ed8454d95c75a7fca0 allows attackers to cause a denial of service attack or possible further memory corruption via crafted JavaScript. Note that this is only exploitable if the application using Hermes permits evaluation of untrusted JavaScript. Hence, most React Native applications are not affected.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-1915"}} -{"idx": 400202, "input": "agent_decode_alg(struct sshkey *key, u_int flags) { if (key->type == KEY_RSA) { if (flags & SSH_AGENT_RSA_SHA2_256) return \"rsa-sha2-256\"; else if (flags & SSH_AGENT_RSA_SHA2_512) return \"rsa-sha2-512\"; } else if (key->type == KEY_RSA_CERT) { if (flags & SSH_AGENT_RSA_SHA2_256) return \"rsa-sha2-256-cert-v01@openssh.com\"; else if (flags & SSH_AGENT_RSA_SHA2_512) return \"rsa-sha2-512-cert-v01@openssh.com\"; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330362, "input": "static int packet_direct_xmit(struct sk_buff *skb) { return dev_direct_xmit(skb, packet_pick_tx_queue(skb)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232146, "input": "static void r_core_debug_syscall_hit(RCore *core) { const char *cmdhit = r_config_get (core->config, \"cmd.onsyscall\"); if (cmdhit && cmdhit[0] != 0) { r_core_cmd0 (core, cmdhit); r_cons_flush (); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409138, "input": "void Jp2Image::printStructure(std::ostream& out, PrintStructureOption option, int depth) { if (io_->open() != 0) throw Error(kerDataSourceOpenFailed, io_->path(), strError()); // Ensure that this is the correct image type if (!isJp2Type(*io_, false)) { if (io_->error() || io_->eof()) throw Error(kerFailedToReadImageData); throw Error(kerNotAJpeg); } bool bPrint = option == kpsBasic || option == kpsRecursive; bool bRecursive = option == kpsRecursive; bool bICC = option == kpsIccProfile; bool bXMP = option == kpsXMP; bool bIPTCErase = option == kpsIptcErase; if (bPrint) { out << \"STRUCTURE OF JPEG2000 FILE: \" << io_->path() << std::endl; out << \" address | length | box | data\" << std::endl; } if ( bPrint || bXMP || bICC || bIPTCErase ) { long position = 0; Jp2BoxHeader box = {1,1}; Jp2BoxHeader subBox = {1,1}; Jp2UuidBox uuid = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}; bool bLF = false; while (box.length && box.type != kJp2BoxTypeClose && io_->read((byte*)&box, sizeof(box)) == sizeof(box)) { position = io_->tell(); box.length = getLong((byte*)&box.length, bigEndian); box.type = getLong((byte*)&box.type, bigEndian); enforce(box.length <= io_->size()-io_->tell() , Exiv2::kerCorruptedMetadata); if (bPrint) { out << Internal::stringFormat(\"%8ld | %8ld | \", position - sizeof(box), (size_t)box.length) << toAscii(box.type) << \" | \"; bLF = true; if (box.type == kJp2BoxTypeClose) lf(out, bLF); } if (box.type == kJp2BoxTypeClose) break; switch (box.type) { case kJp2BoxTypeJp2Header: { lf(out, bLF); while (io_->read((byte*)&subBox, sizeof(subBox)) == sizeof(subBox) && io_->tell() < position + (long)box.length) // don't read beyond the box! { int address = io_->tell() - sizeof(subBox); subBox.length = getLong((byte*)&subBox.length, bigEndian); subBox.type = getLong((byte*)&subBox.type, bigEndian); if (subBox.length < sizeof(box) || subBox.length > io_->size() - io_->tell()) { throw Error(kerCorruptedMetadata); } DataBuf data(subBox.length - sizeof(box)); io_->read(data.pData_, data.size_); if (bPrint) { out << Internal::stringFormat(\"%8ld | %8ld | sub:\", (size_t)address, (size_t)subBox.length) << toAscii(subBox.type) << \" | \" << Internal::binaryToString(makeSlice(data, 0, std::min(30l, data.size_))); bLF = true; } if (subBox.type == kJp2BoxTypeColorHeader) { long pad = 3; // don't know why there are 3 padding bytes if (bPrint) { out << \" | pad:\"; for (int i = 0; i < 3; i++) out << \" \" << (int)data.pData_[i]; } long iccLength = getULong(data.pData_ + pad, bigEndian); if (bPrint) { out << \" | iccLength:\" << iccLength; } if (bICC) { out.write((const char*)data.pData_ + pad, iccLength); } } lf(out, bLF); } } break; case kJp2BoxTypeUuid: { if (io_->read((byte*)&uuid, sizeof(uuid)) == sizeof(uuid)) { bool bIsExif = memcmp(uuid.uuid, kJp2UuidExif, sizeof(uuid)) == 0; bool bIsIPTC = memcmp(uuid.uuid, kJp2UuidIptc, sizeof(uuid)) == 0; bool bIsXMP = memcmp(uuid.uuid, kJp2UuidXmp, sizeof(uuid)) == 0; bool bUnknown = !(bIsExif || bIsIPTC || bIsXMP); if (bPrint) { if (bIsExif) out << \"Exif: \"; if (bIsIPTC) out << \"IPTC: \"; if (bIsXMP) out << \"XMP : \"; if (bUnknown) out << \"????: \"; } DataBuf rawData; rawData.alloc(box.length - sizeof(uuid) - sizeof(box)); long bufRead = io_->read(rawData.pData_, rawData.size_); if (io_->error()) throw Error(kerFailedToReadImageData); if (bufRead != rawData.size_) throw Error(kerInputDataReadFailed); if (bPrint) { out << Internal::binaryToString( makeSlice(rawData, 0, rawData.size_>40?40:rawData.size_)); out.flush(); } lf(out, bLF); if (bIsExif && bRecursive && rawData.size_ > 8) { // \"II*\\0long\" if ((rawData.pData_[0] == rawData.pData_[1]) && (rawData.pData_[0] == 'I' || rawData.pData_[0] == 'M')) { BasicIo::UniquePtr p = BasicIo::UniquePtr(new MemIo(rawData.pData_, rawData.size_)); printTiffStructure(*p, out, option, depth); } } if (bIsIPTC && bRecursive) { IptcData::printStructure(out, makeSlice(rawData.pData_, 0, rawData.size_), depth); } if (bIsXMP && bXMP) { out.write((const char*)rawData.pData_, rawData.size_); } } } break; default: break; } // Move to the next box. io_->seek(static_cast(position - sizeof(box) + box.length), BasicIo::beg); if (io_->error()) throw Error(kerFailedToReadImageData); if (bPrint) lf(out, bLF); } } } // JpegBase::printStructure", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237618, "input": "GF_Box *CoLL_box_new() { ISOM_DECL_BOX_ALLOC(GF_VPContentLightLevelBox, GF_ISOM_BOX_TYPE_COLL); return (GF_Box *)tmp; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 341959, "input": "static inline u64 fuse_dentry_time(const struct dentry *entry) { return ((union fuse_dentry *) entry->d_fsdata)->time; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219086, "input": "bool HHVM_FUNCTION(imagecolordeallocate, const Resource& image, int64_t color) { gdImagePtr im = get_valid_image_resource(image); if (!im) return false; /* We can return right away for a truecolor image as deallocating colours is meaningless here */ if (gdImageTrueColor(im)) return true; if (color >= 0 && color < gdImageColorsTotal(im)) { gdImageColorDeallocate(im, color); return true; } else { raise_warning(\"Color index %\" PRId64 \" out of range\", color); return false; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336796, "input": "read_yin_notif(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options, struct unres_schema *unres) { struct ly_ctx *ctx = module->ctx; struct lyxml_elem *sub, *next, root; struct lys_node *node = NULL; struct lys_node *retval; struct lys_node_notif *notif; int r; int c_tpdf = 0, c_ftrs = 0, c_must = 0, c_ext = 0; void *reallocated; if (parent && (module->version < 2)) { LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, parent, \"notification\"); return NULL; } memset(&root, 0, sizeof root); notif = calloc(1, sizeof *notif); LY_CHECK_ERR_RETURN(!notif, LOGMEM(ctx), NULL); notif->nodetype = LYS_NOTIF; notif->prev = (struct lys_node *)notif; retval = (struct lys_node *)notif; if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin, OPT_IDENT | OPT_MODULE, unres)) { goto error; } LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name); /* insert the node into the schema tree */ if (lys_node_addchild(parent, lys_main_module(module), retval, options)) { goto error; } /* process rpc's specific children */ LY_TREE_FOR_SAFE(yin->child, next, sub) { if (strcmp(sub->ns->value, LY_NSYIN)) { /* extension */ YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"notification\", error); c_ext++; continue; /* data statements */ } else if (!strcmp(sub->name, \"container\") || !strcmp(sub->name, \"leaf-list\") || !strcmp(sub->name, \"leaf\") || !strcmp(sub->name, \"list\") || !strcmp(sub->name, \"choice\") || !strcmp(sub->name, \"uses\") || !strcmp(sub->name, \"grouping\") || !strcmp(sub->name, \"anyxml\") || !strcmp(sub->name, \"anydata\")) { lyxml_unlink_elem(ctx, sub, 2); lyxml_add_child(ctx, &root, sub); /* array counters */ } else if (!strcmp(sub->name, \"typedef\")) { YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, notif->tpdf_size, \"typedefs\", \"notification\", error); c_tpdf++; } else if (!strcmp(sub->name, \"if-feature\")) { YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"notification\", error); c_ftrs++; } else if ((module->version >= 2) && !strcmp(sub->name, \"must\")) { YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, notif->must_size, \"musts\", \"notification\", error); c_must++; } else { LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name); goto error; } } /* middle part - process nodes with cardinality of 0..n except the data nodes */ if (c_tpdf) { notif->tpdf = calloc(c_tpdf, sizeof *notif->tpdf); LY_CHECK_ERR_GOTO(!notif->tpdf, LOGMEM(ctx), error); } if (c_ftrs) { notif->iffeature = calloc(c_ftrs, sizeof *notif->iffeature); LY_CHECK_ERR_GOTO(!notif->iffeature, LOGMEM(ctx), error); } if (c_must) { notif->must = calloc(c_must, sizeof *notif->must); LY_CHECK_ERR_GOTO(!notif->must, LOGMEM(ctx), error); } if (c_ext) { /* some extensions may be already present from the substatements */ reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext); LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error); retval->ext = reallocated; /* init memory */ memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext); } LY_TREE_FOR_SAFE(yin->child, next, sub) { if (strcmp(sub->ns->value, LY_NSYIN)) { /* extension */ r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres); if (r) { goto error; } } else if (!strcmp(sub->name, \"typedef\")) { r = fill_yin_typedef(module, retval, sub, ¬if->tpdf[notif->tpdf_size], unres); notif->tpdf_size++; if (r) { goto error; } } else if (!strcmp(sub->name, \"if-feature\")) { r = fill_yin_iffeature(retval, 0, sub, ¬if->iffeature[notif->iffeature_size], unres); notif->iffeature_size++; if (r) { goto error; } } else if (!strcmp(sub->name, \"must\")) { r = fill_yin_must(module, sub, ¬if->must[notif->must_size], unres); notif->must_size++; if (r) { goto error; } } } lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size); /* last part - process data nodes */ options |= LYS_PARSE_OPT_CFG_IGNORE; LY_TREE_FOR_SAFE(root.child, next, sub) { if (!strcmp(sub->name, \"container\")) { node = read_yin_container(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"leaf-list\")) { node = read_yin_leaflist(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"leaf\")) { node = read_yin_leaf(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"list\")) { node = read_yin_list(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"choice\")) { node = read_yin_choice(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"uses\")) { node = read_yin_uses(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"grouping\")) { node = read_yin_grouping(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"anyxml\")) { node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres); } else if (!strcmp(sub->name, \"anydata\")) { node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres); } if (!node) { goto error; } lyxml_free(ctx, sub); } /* check XPath dependencies */ if (!(ctx->models.flags & LY_CTX_TRUSTED) && notif->must) { if (options & LYS_PARSE_OPT_INGRP) { if (lyxp_node_check_syntax(retval)) { goto error; } } else { if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) { goto error; } } } return retval; error: lys_node_free(ctx, retval, NULL, 0); while (root.child) { lyxml_free(ctx, root.child); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 460768, "input": "do_doautocmd( char_u *arg, int do_msg, /* give message for no matching autocmds? */ int *did_something) { char_u *fname; int nothing_done = TRUE; int group; if (did_something != NULL) *did_something = FALSE; /* * Check for a legal group name. If not, use AUGROUP_ALL. */ group = au_get_grouparg(&arg); if (arg == NULL) /* out of memory */ return FAIL; if (*arg == '*') { EMSG(_(\"E217: Can't execute autocommands for ALL events\")); return FAIL; } /* * Scan over the events. * If we find an illegal name, return here, don't do anything. */ fname = find_end_event(arg, group != AUGROUP_ALL); if (fname == NULL) return FAIL; fname = skipwhite(fname); /* * Loop over the events. */ while (*arg && !ends_excmd(*arg) && !VIM_ISWHITE(*arg)) if (apply_autocmds_group(event_name2nr(arg, &arg), fname, NULL, TRUE, group, curbuf, NULL)) nothing_done = FALSE; if (nothing_done && do_msg) MSG(_(\"No matching autocommands\")); if (did_something != NULL) *did_something = !nothing_done; #ifdef FEAT_EVAL return aborting() ? FAIL : OK; #else return OK; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385234, "input": "print_tcp_fragment_tree(fragment_head *ipfd_head, proto_tree *tree, proto_tree *tcp_tree, packet_info *pinfo, tvbuff_t *next_tvb) { proto_item *tcp_tree_item, *frag_tree_item; /* * The subdissector thought it was completely * desegmented (although the stuff at the * end may, in turn, require desegmentation), * so we show a tree with all segments. */ show_fragment_tree(ipfd_head, &tcp_segment_items, tree, pinfo, next_tvb, &frag_tree_item); /* * The toplevel fragment subtree is now * behind all desegmented data; move it * right behind the TCP tree. */ tcp_tree_item = proto_tree_get_parent(tcp_tree); if(frag_tree_item && tcp_tree_item) { proto_tree_move_item(tree, tcp_tree_item, frag_tree_item); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 372385, "input": "srs_reverse_alloc(srs_t *srs, char **sptr, const char *sender) { char *buf; int len; int ret; *sptr = NULL; if (!SRS_IS_SRS_ADDRESS(sender)) return SRS_ENOTSRSADDRESS; if (srs->noreverse) return SRS_ENOTREWRITTEN; len = strlen(sender) + 1; buf = (char *)srs_f_malloc(len); ret = srs_reverse(srs, buf, len, sender); if (ret == SRS_SUCCESS) *sptr = buf; else srs_f_free(buf); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509311, "input": "Item_func_or_sum(THD *thd, Item *a, Item *b): Item_result_field(thd), Item_args(a, b) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346367, "input": "evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start) { return evbuffer_search_range(buffer, what, len, start, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431626, "input": "static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) { struct nfs4_exception exception = { .interruptible = true, }; ssize_t ret; do { ret = __nfs4_get_acl_uncached(inode, buf, buflen); trace_nfs4_get_acl(inode, ret); if (ret >= 0) break; ret = nfs4_handle_exception(NFS_SERVER(inode), ret, &exception); } while (exception.retry); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409918, "input": "static int tcp_should_expand_sndbuf(const struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); /* If the user specified a specific send buffer setting, do * not modify it. */ if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) return 0; /* If we are under global TCP memory pressure, do not expand. */ if (tcp_memory_pressure) return 0; /* If we are under soft global TCP memory pressure, do not expand. */ if (atomic_long_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0]) return 0; /* If we filled the congestion window, do not expand. */ if (tp->packets_out >= tp->snd_cwnd) return 0; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357428, "input": "static void opj_j2k_read_int32_to_int32(const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem) { OPJ_BYTE * l_src_data = (OPJ_BYTE *) p_src_data; OPJ_INT32 * l_dest_data = (OPJ_INT32 *) p_dest_data; OPJ_UINT32 i; OPJ_UINT32 l_temp; for (i = 0; i < p_nb_elem; ++i) { opj_read_bytes(l_src_data, &l_temp, 4); l_src_data += sizeof(OPJ_INT32); *(l_dest_data++) = (OPJ_INT32) l_temp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195057, "input": "uint8_t ethereum_extractThorchainData(const EthereumSignTx *msg, char *buffer) { // Swap data begins 164 chars into data buffer: // offset = deposit function hash + address + address + uint256 uint16_t offset = 4 + (5 * 32); int16_t len = msg->data_length - offset; if (msg->has_data_length && len > 0) { memcpy(buffer, msg->data_initial_chunk.bytes + offset, len); // String length must be < 255 characters return len < 256 ? (uint8_t)len : 0; } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "Insufficient length checks in the ShapeShift KeepKey hardware wallet firmware before 7.1.0 allow a stack buffer overflow via crafted messages. The overflow in ethereum_extractThorchainSwapData() in ethereum.c can circumvent stack protections and lead to code execution. The vulnerable interface is reachable remotely over WebUSB.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-31616"}} -{"idx": 325860, "input": "archive_wstrcat(struct archive_wstring *as, const wchar_t *p) { /* Ditto. */ return archive_wstrncat(as, p, 0x1000000); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 284243, "input": "static apr_status_t setup_input(h2_stream *stream) { if (stream->input == NULL) { int empty = (stream->input_eof && (!stream->in_buffer || APR_BRIGADE_EMPTY(stream->in_buffer))); if (!empty) { h2_beam_create(&stream->input, stream->pool, stream->id, \"input\", H2_BEAM_OWNER_SEND, 0, stream->session->s->timeout); h2_beam_send_from(stream->input, stream->pool); } } return APR_SUCCESS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280742, "input": "parse_GROUP(char *arg, const struct ofpact_parse_params *pp) { return str_to_u32(arg, &ofpact_put_GROUP(pp->ofpacts)->group_id); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409946, "input": "static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); /* Check #1 */ if (tp->rcv_ssthresh < tp->window_clamp && (int)tp->rcv_ssthresh < tcp_space(sk) && !tcp_memory_pressure) { int incr; /* Check #2. Increase window, if skb with such overhead * will fit to rcvbuf in future. */ if (tcp_win_from_space(skb->truesize) <= skb->len) incr = 2 * tp->advmss; else incr = __tcp_grow_window(sk, skb); if (incr) { tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, tp->window_clamp); inet_csk(sk)->icsk_ack.quick |= 1; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 205720, "input": "static MagickBooleanType WriteAnimatedWEBPImage(const ImageInfo *image_info, Image *image,WebPConfig *configure,WebPMemoryWriter *writer_info, ExceptionInfo *exception) { Image *first_image; PictureMemory *current, *head; size_t effective_delta = 0, frame_timestamp = 0; WebPAnimEncoder *enc; WebPAnimEncoderOptions enc_options; WebPData webp_data; WebPPicture picture; WebPAnimEncoderOptionsInit(&enc_options); if (image_info->verbose) enc_options.verbose = 1; image=CoalesceImages(image, exception); first_image=image; enc=WebPAnimEncoderNew((int) image->page.width,(int) image->page.height, &enc_options); head=(PictureMemory *) calloc(sizeof(*head),1); current=head; while (image != NULL) { if (WebPPictureInit(&picture) == 0) ThrowWriterException(ResourceLimitError,\"UnableToEncodeImageFile\"); WriteSingleWEBPImage(image_info, image, &picture, current, exception); effective_delta = image->delay*1000/image->ticks_per_second; if (effective_delta < 10) effective_delta = 100; /* Consistent with gif2webp */ frame_timestamp+=effective_delta; WebPAnimEncoderAdd(enc,&picture,(int) frame_timestamp,configure); image = GetNextImageInList(image); current->next=(PictureMemory *) calloc(sizeof(*head), 1); current = current->next; } webp_data.bytes=writer_info->mem; webp_data.size=writer_info->size; WebPAnimEncoderAssemble(enc, &webp_data); WebPMemoryWriterClear(writer_info); writer_info->size=webp_data.size; writer_info->mem=(unsigned char *) webp_data.bytes; WebPAnimEncoderDelete(enc); DestroyImageList(first_image); FreePictureMemoryList(head); return(MagickTrue); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "A flaw was found in ImageMagick in coders/webp.c. An attacker who submits a crafted file that is processed by ImageMagick could trigger undefined behavior in the form of math division by zero. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-20245"}} -{"idx": 431371, "input": "static void nfs4_close_context(struct nfs_open_context *ctx, int is_sync) { if (ctx->state == NULL) return; if (is_sync) nfs4_close_sync(ctx->state, _nfs4_ctx_to_openmode(ctx)); else nfs4_close_state(ctx->state, _nfs4_ctx_to_openmode(ctx)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380142, "input": "static ssize_t dlpar_show(struct class *class, struct class_attribute *attr, char *buf) { return sprintf(buf, \"%s\\n\", \"memory,cpu\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370022, "input": "intrusive_ptr ExpressionCoerceToBool::create( ExpressionContext* const expCtx, intrusive_ptr pExpression) { return new ExpressionCoerceToBool(expCtx, std::move(pExpression)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 284269, "input": "void h2_stream_destroy(h2_stream *stream) { ap_assert(stream); ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, stream->session->c, H2_STRM_MSG(stream, \"destroy\")); apr_pool_destroy(stream->pool); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381970, "input": "static apr_byte_t oidc_authorization_response_match_state(request_rec *r, oidc_cfg *c, const char *state, struct oidc_provider_t **provider, oidc_proto_state_t **proto_state) { oidc_debug(r, \"enter (state=%s)\", state); if ((state == NULL) || (apr_strnatcmp(state, \"\") == 0)) { oidc_error(r, \"state parameter is not set\"); return FALSE; } /* check the state parameter against what we stored in a cookie */ if (oidc_restore_proto_state(r, c, state, proto_state) == FALSE) { oidc_error(r, \"unable to restore state\"); return FALSE; } *provider = oidc_get_provider_for_issuer(r, c, oidc_proto_state_get_issuer(*proto_state), FALSE); if (*provider == NULL) { oidc_proto_state_destroy(*proto_state); *proto_state = NULL; return FALSE; } return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402367, "input": "ConnStateData::whenClientIpKnown() { if (Config.onoff.log_fqdn) fqdncache_gethostbyaddr(clientConnection->remote, FQDN_LOOKUP_IF_MISS); #if USE_IDENT if (Ident::TheConfig.identLookup) { ACLFilledChecklist identChecklist(Ident::TheConfig.identLookup, NULL, NULL); identChecklist.src_addr = clientConnection->remote; identChecklist.my_addr = clientConnection->local; if (identChecklist.fastCheck().allowed()) Ident::Start(clientConnection, clientIdentDone, this); } #endif clientdbEstablished(clientConnection->remote, 1); #if USE_DELAY_POOLS fd_table[clientConnection->fd].clientInfo = NULL; if (!Config.onoff.client_db) return; // client delay pools require client_db ClientDelayPools& pools(Config.ClientDelay.pools); if (pools.size()) { ACLFilledChecklist ch(NULL, NULL, NULL); // TODO: we check early to limit error response bandwith but we // should recheck when we can honor delay_pool_uses_indirect // TODO: we should also pass the port details for myportname here. ch.src_addr = clientConnection->remote; ch.my_addr = clientConnection->local; for (unsigned int pool = 0; pool < pools.size(); ++pool) { /* pools require explicit 'allow' to assign a client into them */ if (pools[pool].access) { ch.changeAcl(pools[pool].access); allow_t answer = ch.fastCheck(); if (answer.allowed()) { /* request client information from db after we did all checks this will save hash lookup if client failed checks */ ClientInfo * cli = clientdbGetInfo(clientConnection->remote); assert(cli); /* put client info in FDE */ fd_table[clientConnection->fd].clientInfo = cli; /* setup write limiter for this request */ const double burst = floor(0.5 + (pools[pool].highwatermark * Config.ClientDelay.initial)/100.0); cli->setWriteLimiter(pools[pool].rate, burst, pools[pool].highwatermark); break; } else { debugs(83, 4, HERE << \"Delay pool \" << pool << \" skipped because ACL \" << answer); } } } } #endif // kids must extend to actually start doing something (e.g., reading) }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219506, "input": "GdExtension() : Extension(\"gd\", NO_EXTENSION_VERSION_YET) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234492, "input": "ff_layout_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode) { spin_lock(&inode->i_lock); pnfs_generic_ds_cinfo_destroy(fl_cinfo); spin_unlock(&inode->i_lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393604, "input": "lr_yum_check_checksum_of_md_record(LrYumRepoMdRecord *rec, const char *path, GError **err) { int fd; char *expected_checksum; LrChecksumType checksum_type; gboolean ret, matches; gboolean is_zchunk = FALSE; GError *tmp_err = NULL; assert(!err || *err == NULL); if (!rec || !path) return TRUE; #ifdef WITH_ZCHUNK if(rec->header_checksum) { expected_checksum = rec->header_checksum; checksum_type = lr_checksum_type(rec->header_checksum_type); is_zchunk = TRUE; } else { #endif /* WITH_ZCHUNK */ expected_checksum = rec->checksum; checksum_type = lr_checksum_type(rec->checksum_type); #ifdef WITH_ZCHUNK } #endif /* WITH_ZCHUNK */ g_debug(\"%s: Checking checksum of %s (expected: %s [%s])\", __func__, path, expected_checksum, rec->checksum_type); if (!expected_checksum) { // Empty checksum - suppose it's ok g_debug(\"%s: No checksum in repomd\", __func__); return TRUE; } if (checksum_type == LR_CHECKSUM_UNKNOWN) { g_debug(\"%s: Unknown checksum\", __func__); g_set_error(err, LR_YUM_ERROR, LRE_UNKNOWNCHECKSUM, \"Unknown checksum type for %s\", path); return FALSE; } fd = open(path, O_RDONLY); if (fd < 0) { g_debug(\"%s: Cannot open %s\", __func__, path); g_set_error(err, LR_YUM_ERROR, LRE_IO, \"Cannot open %s: %s\", path, g_strerror(errno)); return FALSE; } if (is_zchunk) { #ifdef WITH_ZCHUNK ret = FALSE; matches = FALSE; zckCtx *zck = lr_zck_init_read_base(expected_checksum, checksum_type, rec->size_header, fd, &tmp_err); if (!tmp_err) { if(zck_validate_checksums(zck) < 1) { g_set_error(&tmp_err, LR_YUM_ERROR, LRE_ZCK, \"Unable to validate zchunk checksums\"); } else { ret = TRUE; matches = TRUE; } } if (zck) zck_free(&zck); #endif /* WITH_ZCHUNK */ } else { ret = lr_checksum_fd_cmp(checksum_type, fd, expected_checksum, 1, &matches, &tmp_err); } close(fd); assert(ret || tmp_err); if (!ret) { // Checksum calculation error g_debug(\"%s: Checksum check %s - Error: %s\", __func__, path, tmp_err->message); g_propagate_prefixed_error(err, tmp_err, \"Checksum error %s: \", path); return FALSE; } else if (!matches) { g_debug(\"%s: Checksum check %s - Mismatch\", __func__, path); g_set_error(err, LR_YUM_ERROR, LRE_BADCHECKSUM, \"Checksum mismatch %s\", path); return FALSE; } g_debug(\"%s: Checksum check - Passed\", __func__); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416804, "input": "static MagickBooleanType SerializeImageIndexes(const ImageInfo *image_info, Image *image,MemoryInfo **pixel_info,size_t *length,ExceptionInfo *exception) { MagickBooleanType status; register const Quantum *p; register ssize_t x; register unsigned char *q; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); status=MagickTrue; *length=(size_t) image->columns*image->rows; *pixel_info=AcquireVirtualMemory(*length,sizeof(*q)); if (*pixel_info == (MemoryInfo *) NULL) ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\"); q=(unsigned char *) GetVirtualMemoryBlob(*pixel_info); for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(unsigned char) GetPixelIndex(image,p); p+=GetPixelChannels(image); } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (status == MagickFalse) *pixel_info=RelinquishVirtualMemory(*pixel_info); return(status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208465, "input": "static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) { if (sk->sk_send_head == skb_unlinked) sk->sk_send_head = NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Privilege Management"], "explanation": "The tcp_check_send_head function in include/net/tcp.h in the Linux kernel before 4.7.5 does not properly maintain certain SACK state after a failed data copy, which allows local users to cause a denial of service (tcp_xmit_retransmit_queue use-after-free and system crash) via a crafted SACK option.", "severity_level": "Medium", "cwe": "CWE-269", "cve": "CVE-2016-6828"}} -{"idx": 379409, "input": "sv_histsize (name) char *name; { char *temp; intmax_t num; int hmax; temp = get_string_value (name); if (temp && *temp) { if (legal_number (temp, &num)) { hmax = num; if (hmax < 0 && name[4] == 'S') unstifle_history (); /* unstifle history if HISTSIZE < 0 */ else if (name[4] == 'S') { stifle_history (hmax); hmax = where_history (); if (history_lines_this_session > hmax) history_lines_this_session = hmax; } else if (hmax >= 0) /* truncate HISTFILE if HISTFILESIZE >= 0 */ { history_truncate_file (get_string_value (\"HISTFILE\"), hmax); if (hmax <= history_lines_in_file) history_lines_in_file = hmax; } } } else if (name[4] == 'S') unstifle_history (); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197908, "input": "static int extractRDNSequence(struct ndpi_packet_struct *packet, u_int offset, char *buffer, u_int buffer_len, char *rdnSeqBuf, u_int *rdnSeqBuf_offset, u_int rdnSeqBuf_len, const char *label) { u_int8_t str_len = packet->payload[offset+4], is_printable = 1; char *str; u_int len, j; // packet is truncated... further inspection is not needed if((offset+4+str_len) >= packet->payload_packet_len) return(-1); str = (char*)&packet->payload[offset+5]; len = (u_int)ndpi_min(str_len, buffer_len-1); strncpy(buffer, str, len); buffer[len] = '\\0'; // check string is printable for(j = 0; j < len; j++) { if(!ndpi_isprint(buffer[j])) { is_printable = 0; break; } } if(is_printable) { int rc = snprintf(&rdnSeqBuf[*rdnSeqBuf_offset], rdnSeqBuf_len-(*rdnSeqBuf_offset), \"%s%s=%s\", (*rdnSeqBuf_offset > 0) ? \", \" : \"\", label, buffer); if(rc > 0) (*rdnSeqBuf_offset) += rc; } return(is_printable); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Overflow or Wraparound"], "explanation": "In nDPI through 3.2, there is a stack overflow in extractRDNSequence in lib/protocols/tls.c.", "severity_level": "NoInfo", "cwe": "CWE-190", "cve": "CVE-2020-15474"}} -{"idx": 381442, "input": "static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct v4l2_format *p = arg; struct video_device *vfd = video_devdata(file); int ret = check_fmt(file, p->type); unsigned int i; if (ret) return ret; v4l_sanitize_format(p); switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_vid_cap)) break; CLEAR_AFTER_FIELD(p, fmt.pix); ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg); /* just in case the driver zeroed it again */ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; if (vfd->vfl_type == VFL_TYPE_TOUCH) v4l_pix_format_touch(&p->fmt.pix); return ret; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane)) break; CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); for (i = 0; i < p->fmt.pix_mp.num_planes; i++) CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], bytesperline); return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (unlikely(!ops->vidioc_try_fmt_vid_overlay)) break; CLEAR_AFTER_FIELD(p, fmt.win); return ops->vidioc_try_fmt_vid_overlay(file, fh, arg); case V4L2_BUF_TYPE_VBI_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_vbi_cap)) break; CLEAR_AFTER_FIELD(p, fmt.vbi.flags); return ops->vidioc_try_fmt_vbi_cap(file, fh, arg); case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_cap)) break; CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); return ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_vid_out)) break; CLEAR_AFTER_FIELD(p, fmt.pix); ret = ops->vidioc_try_fmt_vid_out(file, fh, arg); /* just in case the driver zeroed it again */ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; return ret; case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane)) break; CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); for (i = 0; i < p->fmt.pix_mp.num_planes; i++) CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], bytesperline); return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay)) break; CLEAR_AFTER_FIELD(p, fmt.win); return ops->vidioc_try_fmt_vid_out_overlay(file, fh, arg); case V4L2_BUF_TYPE_VBI_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_vbi_out)) break; CLEAR_AFTER_FIELD(p, fmt.vbi.flags); return ops->vidioc_try_fmt_vbi_out(file, fh, arg); case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_out)) break; CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg); case V4L2_BUF_TYPE_SDR_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_sdr_cap)) break; CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); return ops->vidioc_try_fmt_sdr_cap(file, fh, arg); case V4L2_BUF_TYPE_SDR_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_sdr_out)) break; CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); return ops->vidioc_try_fmt_sdr_out(file, fh, arg); case V4L2_BUF_TYPE_META_CAPTURE: if (unlikely(!ops->vidioc_try_fmt_meta_cap)) break; CLEAR_AFTER_FIELD(p, fmt.meta); return ops->vidioc_try_fmt_meta_cap(file, fh, arg); case V4L2_BUF_TYPE_META_OUTPUT: if (unlikely(!ops->vidioc_try_fmt_meta_out)) break; CLEAR_AFTER_FIELD(p, fmt.meta); return ops->vidioc_try_fmt_meta_out(file, fh, arg); } return -EINVAL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293670, "input": "struct vm_area_struct *vm_area_alloc(struct mm_struct *mm) { struct vm_area_struct *vma; vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); if (vma) vma_init(vma, mm); return vma; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246314, "input": "static void init_config_defines(apr_pool_t *pconf) { saved_server_config_defines = ap_server_config_defines; /* Use apr_array_copy instead of apr_array_copy_hdr because it does not * protect from the way unset_define removes entries. */ ap_server_config_defines = apr_array_copy(pconf, ap_server_config_defines); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509342, "input": "virtual bool count_sargable_conds(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448843, "input": "static int get_swift_container_settings(req_state * const s, RGWRados * const store, RGWAccessControlPolicy * const policy, bool * const has_policy, uint32_t * rw_mask, RGWCORSConfiguration * const cors_config, bool * const has_cors) { const char * const read_list = s->info.env->get(\"HTTP_X_CONTAINER_READ\"); const char * const write_list = s->info.env->get(\"HTTP_X_CONTAINER_WRITE\"); *has_policy = false; if (read_list || write_list) { RGWAccessControlPolicy_SWIFT swift_policy(s->cct); const auto r = swift_policy.create(store, s->user->user_id, s->user->display_name, read_list, write_list, *rw_mask); if (r < 0) { return r; } *policy = swift_policy; *has_policy = true; } *has_cors = false; /*Check and update CORS configuration*/ const char *allow_origins = s->info.env->get(\"HTTP_X_CONTAINER_META_ACCESS_CONTROL_ALLOW_ORIGIN\"); const char *allow_headers = s->info.env->get(\"HTTP_X_CONTAINER_META_ACCESS_CONTROL_ALLOW_HEADERS\"); const char *expose_headers = s->info.env->get(\"HTTP_X_CONTAINER_META_ACCESS_CONTROL_EXPOSE_HEADERS\"); const char *max_age = s->info.env->get(\"HTTP_X_CONTAINER_META_ACCESS_CONTROL_MAX_AGE\"); if (allow_origins) { RGWCORSConfiguration_SWIFT *swift_cors = new RGWCORSConfiguration_SWIFT; int r = swift_cors->create_update(allow_origins, allow_headers, expose_headers, max_age); if (r < 0) { dout(0) << \"Error creating/updating the cors configuration\" << dendl; delete swift_cors; return r; } *has_cors = true; *cors_config = *swift_cors; cors_config->dump(); delete swift_cors; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219426, "input": "Variant HHVM_FUNCTION(mcrypt_cfb, const String& cipher, const String& key, const String& data, const Variant& mode, const Variant& viv /* = null_string */) { raise_deprecated(\"Function mcrypt_cfb() is deprecated\"); String iv = viv.toString(); return php_mcrypt_do_crypt(cipher, key, data, \"cfb\", iv, mode.toInt32(), \"mcrypt_cfb\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 213544, "input": "MagickPrivate double GenerateDifferentialNoise(RandomInfo *random_info, const Quantum pixel,const NoiseType noise_type,const double attenuate) { #define SigmaUniform (attenuate*0.015625) #define SigmaGaussian (attenuate*0.015625) #define SigmaImpulse (attenuate*0.1) #define SigmaLaplacian (attenuate*0.0390625) #define SigmaMultiplicativeGaussian (attenuate*0.5) #define SigmaPoisson (attenuate*12.5) #define SigmaRandom (attenuate) #define TauGaussian (attenuate*0.078125) double alpha, beta, noise, sigma; alpha=GetPseudoRandomValue(random_info); switch (noise_type) { case UniformNoise: default: { noise=(double) (pixel+QuantumRange*SigmaUniform*(alpha-0.5)); break; } case GaussianNoise: { double gamma, tau; if (fabs(alpha) < MagickEpsilon) alpha=1.0; beta=GetPseudoRandomValue(random_info); gamma=sqrt(-2.0*log(alpha)); sigma=gamma*cos((double) (2.0*MagickPI*beta)); tau=gamma*sin((double) (2.0*MagickPI*beta)); noise=(double) (pixel+sqrt((double) pixel)*SigmaGaussian*sigma+ QuantumRange*TauGaussian*tau); break; } case ImpulseNoise: { if (alpha < (SigmaImpulse/2.0)) noise=0.0; else if (alpha >= (1.0-(SigmaImpulse/2.0))) noise=(double) QuantumRange; else noise=(double) pixel; break; } case LaplacianNoise: { if (alpha <= 0.5) { if (alpha <= MagickEpsilon) noise=(double) (pixel-QuantumRange); else noise=(double) (pixel+QuantumRange*SigmaLaplacian*log(2.0*alpha)+ 0.5); break; } beta=1.0-alpha; if (beta <= (0.5*MagickEpsilon)) noise=(double) (pixel+QuantumRange); else noise=(double) (pixel-QuantumRange*SigmaLaplacian*log(2.0*beta)+0.5); break; } case MultiplicativeGaussianNoise: { sigma=1.0; if (alpha > MagickEpsilon) sigma=sqrt(-2.0*log(alpha)); beta=GetPseudoRandomValue(random_info); noise=(double) (pixel+pixel*SigmaMultiplicativeGaussian*sigma* cos((double) (2.0*MagickPI*beta))/2.0); break; } case PoissonNoise: { double poisson; ssize_t i; poisson=exp(-SigmaPoisson*QuantumScale*pixel); for (i=0; alpha > poisson; i++) { beta=GetPseudoRandomValue(random_info); alpha*=beta; } noise=(double) (QuantumRange*i/SigmaPoisson); break; } case RandomNoise: { noise=(double) (QuantumRange*SigmaRandom*alpha); break; } } return(noise); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "A divide-by-zero flaw was found in ImageMagick 6.9.11-57 and 7.0.10-57 in gem.c. This flaw allows an attacker who submits a crafted file that is processed by ImageMagick to trigger undefined behavior through a division by zero. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-20176"}} -{"idx": 336974, "input": "rb_str_strip(VALUE str) { str = rb_str_dup(str); rb_str_strip_bang(str); return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280157, "input": "static int slab_mem_going_online_callback(void *arg) { struct kmem_cache_node *n; struct kmem_cache *s; struct memory_notify *marg = arg; int nid = marg->status_change_nid_normal; int ret = 0; /* * If the node's memory is already available, then kmem_cache_node is * already created. Nothing to do. */ if (nid < 0) return 0; /* * We are bringing a node online. No memory is available yet. We must * allocate a kmem_cache_node structure in order to bring the node * online. */ mutex_lock(&slab_mutex); list_for_each_entry(s, &slab_caches, list) { /* * XXX: kmem_cache_alloc_node will fallback to other nodes * since memory is not yet available from the node that * is brought up. */ n = kmem_cache_alloc(kmem_cache_node, GFP_KERNEL); if (!n) { ret = -ENOMEM; goto out; } init_kmem_cache_node(n); s->node[nid] = n; } out: mutex_unlock(&slab_mutex); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399251, "input": "static BOOL saveCal(rdpSettings* settings, const BYTE* data, int length, char* hostname) { char hash[41]; FILE* fp; char* licenseStorePath = NULL; char filename[MAX_PATH], filenameNew[MAX_PATH]; char *filepath = NULL, *filepathNew = NULL; size_t written; BOOL ret = FALSE; if (!PathFileExistsA(settings->ConfigPath)) { if (!PathMakePathA(settings->ConfigPath, 0)) { WLog_ERR(TAG, \"error creating directory '%s'\", settings->ConfigPath); goto out; } WLog_INFO(TAG, \"creating directory %s\", settings->ConfigPath); } if (!(licenseStorePath = GetCombinedPath(settings->ConfigPath, licenseStore))) goto out; if (!PathFileExistsA(licenseStorePath)) { if (!PathMakePathA(licenseStorePath, 0)) { WLog_ERR(TAG, \"error creating directory '%s'\", licenseStorePath); goto out; } WLog_INFO(TAG, \"creating directory %s\", licenseStorePath); } if (!computeCalHash(hostname, hash)) goto out; sprintf_s(filename, sizeof(filename) - 1, \"%s.cal\", hash); sprintf_s(filenameNew, sizeof(filenameNew) - 1, \"%s.cal.new\", hash); if (!(filepath = GetCombinedPath(licenseStorePath, filename))) goto out; if (!(filepathNew = GetCombinedPath(licenseStorePath, filenameNew))) goto out; fp = fopen(filepathNew, \"wb\"); if (!fp) goto out; written = fwrite(data, length, 1, fp); fclose(fp); if (written != 1) { DeleteFile(filepathNew); goto out; } ret = MoveFileEx(filepathNew, filepath, MOVEFILE_REPLACE_EXISTING); out: free(filepathNew); free(filepath); free(licenseStorePath); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 284235, "input": "static void set_policy_for(h2_stream *stream, h2_request *r) { int enabled = h2_session_push_enabled(stream->session); stream->push_policy = h2_push_policy_determine(r->headers, stream->pool, enabled); r->serialize = h2_config_sgeti(stream->session->s, H2_CONF_SER_HEADERS); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490154, "input": "void ecryptfs_destroy_mount_crypt_stat( struct ecryptfs_mount_crypt_stat *mount_crypt_stat) { struct ecryptfs_global_auth_tok *auth_tok, *auth_tok_tmp; if (!(mount_crypt_stat->flags & ECRYPTFS_MOUNT_CRYPT_STAT_INITIALIZED)) return; mutex_lock(&mount_crypt_stat->global_auth_tok_list_mutex); list_for_each_entry_safe(auth_tok, auth_tok_tmp, &mount_crypt_stat->global_auth_tok_list, mount_crypt_stat_list) { list_del(&auth_tok->mount_crypt_stat_list); mount_crypt_stat->num_global_auth_toks--; if (auth_tok->global_auth_tok_key && !(auth_tok->flags & ECRYPTFS_AUTH_TOK_INVALID)) key_put(auth_tok->global_auth_tok_key); kmem_cache_free(ecryptfs_global_auth_tok_cache, auth_tok); } mutex_unlock(&mount_crypt_stat->global_auth_tok_list_mutex); memset(mount_crypt_stat, 0, sizeof(struct ecryptfs_mount_crypt_stat)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270458, "input": "static int read_from_url(struct playlist *pls, struct segment *seg, uint8_t *buf, int buf_size, enum ReadFromURLMode mode) { int ret; /* limit read if the segment was only a part of a file */ if (seg->size >= 0) buf_size = FFMIN(buf_size, seg->size - pls->cur_seg_offset); if (mode == READ_COMPLETE) ret = ffurl_read_complete(pls->input, buf, buf_size); else ret = ffurl_read(pls->input, buf, buf_size); if (ret > 0) pls->cur_seg_offset += ret; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 261985, "input": "int RemoveUnknownSections(void) { int a; int Modified = FALSE; for (a=0;aaddip_last_asconf) { list_add_tail(&chunk->list, &asoc->addip_chunk_list); goto out; } /* Hold the chunk until an ASCONF_ACK is received. */ sctp_chunk_hold(chunk); retval = sctp_primitive_ASCONF(asoc->base.net, asoc, chunk); if (retval) sctp_chunk_free(chunk); else asoc->addip_last_asconf = chunk; out: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 477410, "input": "iasecc_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_context *ctx = card->ctx; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, \"iasecc_pin_cmd() cmd 0x%X, PIN type 0x%X, PIN reference %i, PIN-1 %p:%i, PIN-2 %p:%i\", data->cmd, data->pin_type, data->pin_reference, data->pin1.data, data->pin1.len, data->pin2.data, data->pin2.len); switch (data->cmd) { case SC_PIN_CMD_VERIFY: rv = iasecc_pin_verify(card, data->pin_type, data->pin_reference, data->pin1.data, data->pin1.len, tries_left); break; case SC_PIN_CMD_CHANGE: if (data->pin_type == SC_AC_AUT) rv = iasecc_keyset_change(card, data, tries_left); else rv = iasecc_pin_change(card, data, tries_left); break; case SC_PIN_CMD_UNBLOCK: rv = iasecc_pin_reset(card, data, tries_left); break; case SC_PIN_CMD_GET_INFO: rv = iasecc_pin_get_policy(card, data); break; default: sc_log(ctx, \"Other pin commands not supported yet: 0x%X\", data->cmd); rv = SC_ERROR_NOT_SUPPORTED; } LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219528, "input": "TypedValue HHVM_FUNCTION(strtok, const String& str, const Variant& token) { return tvReturn(strtok(str, token)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267296, "input": "GF_Err gf_isom_set_sample_flags(GF_ISOFile *file, u32 track, u32 sampleNumber, u32 isLeading, u32 dependsOn, u32 dependedOn, u32 redundant) { GF_Err e; GF_TrackBox *trak; e = CanAccessMovie(file, GF_ISOM_OPEN_WRITE); if (e) return e; trak = gf_isom_get_track_from_file(file, track); if (!trak) return GF_BAD_PARAM; return stbl_SetDependencyType(trak->Media->information->sampleTable, sampleNumber, isLeading, dependsOn, dependedOn, redundant); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230177, "input": "CallResult JSObject::defineOwnProperty( Handle selfHandle, Runtime *runtime, SymbolID name, DefinePropertyFlags dpFlags, Handle<> valueOrAccessor, PropOpFlags opFlags) { assert( !opFlags.getMustExist() && \"cannot use mustExist with defineOwnProperty\"); assert( !(dpFlags.setValue && dpFlags.isAccessor()) && \"Cannot set both value and accessor\"); assert( (dpFlags.setValue || dpFlags.isAccessor() || valueOrAccessor.get().isUndefined()) && \"value must be undefined when all of setValue/setSetter/setGetter are \" \"false\"); #ifndef NDEBUG if (dpFlags.isAccessor()) { assert(valueOrAccessor.get().isPointer() && \"accessor must be non-empty\"); assert( !dpFlags.setWritable && !dpFlags.writable && \"writable must not be set with accessors\"); } #endif // Is it an existing property. NamedPropertyDescriptor desc; auto pos = findProperty(selfHandle, runtime, name, desc); if (pos) { return updateOwnProperty( selfHandle, runtime, name, *pos, desc, dpFlags, valueOrAccessor, opFlags); } if (LLVM_UNLIKELY( selfHandle->flags_.lazyObject || selfHandle->flags_.proxyObject)) { if (selfHandle->flags_.proxyObject) { return JSProxy::defineOwnProperty( selfHandle, runtime, name, dpFlags, valueOrAccessor, opFlags); } assert(selfHandle->flags_.lazyObject && \"descriptor flags are impossible\"); // if the property was not found and the object is lazy we need to // initialize it and try again. JSObject::initializeLazyObject(runtime, selfHandle); return defineOwnProperty( selfHandle, runtime, name, dpFlags, valueOrAccessor, opFlags); } return addOwnProperty( selfHandle, runtime, name, dpFlags, valueOrAccessor, opFlags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232201, "input": "R_API int r_core_search_cb(RCore *core, ut64 from, ut64 to, RCoreSearchCallback cb) { int ret, len = core->blocksize; ut8 *buf; if ((buf = malloc (len))) { while (from < to) { ut64 delta = to-from; if (delta < len) { len = (int)delta; } if (!r_io_read_at (core->io, from, buf, len)) { eprintf (\"Cannot read at 0x%\"PFMT64x\"\\n\", from); break; } for (ret = 0; ret < len;) { int done = cb (core, from, buf+ret, len-ret); if (done < 1) { /* interrupted */ free (buf); return false; } ret += done; } from += len; } free (buf); } else { eprintf (\"Cannot allocate blocksize\\n\"); } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 247283, "input": "M_ReadFile ( char const* name, byte** buffer ) { int handle, count, length; struct stat fileinfo; byte *buf; handle = open (name, O_RDONLY | O_BINARY, 0666); if (handle == -1) I_Error (\"Couldn't read file %s\", name); if (fstat (handle,&fileinfo) == -1) I_Error (\"Couldn't read file %s\", name); length = fileinfo.st_size; buf = Z_Malloc (length, PU_STATIC, NULL); count = read (handle, buf, length); close (handle); if (count < length) I_Error (\"Couldn't read file %s\", name); *buffer = buf; return length; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267991, "input": "static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct net *net = sock_net(sk); struct sk_buff *resp_skb; struct sadb_x_sa2 *sa2; struct sadb_address *saddr, *daddr; struct sadb_msg *out_hdr; struct sadb_spirange *range; struct xfrm_state *x = NULL; int mode; int err; u32 min_spi, max_spi; u32 reqid; u8 proto; unsigned short family; xfrm_address_t *xsaddr = NULL, *xdaddr = NULL; if (!present_and_same_family(ext_hdrs[SADB_EXT_ADDRESS_SRC-1], ext_hdrs[SADB_EXT_ADDRESS_DST-1])) return -EINVAL; proto = pfkey_satype2proto(hdr->sadb_msg_satype); if (proto == 0) return -EINVAL; if ((sa2 = ext_hdrs[SADB_X_EXT_SA2-1]) != NULL) { mode = pfkey_mode_to_xfrm(sa2->sadb_x_sa2_mode); if (mode < 0) return -EINVAL; reqid = sa2->sadb_x_sa2_reqid; } else { mode = 0; reqid = 0; } saddr = ext_hdrs[SADB_EXT_ADDRESS_SRC-1]; daddr = ext_hdrs[SADB_EXT_ADDRESS_DST-1]; family = ((struct sockaddr *)(saddr + 1))->sa_family; switch (family) { case AF_INET: xdaddr = (xfrm_address_t *)&((struct sockaddr_in *)(daddr + 1))->sin_addr.s_addr; xsaddr = (xfrm_address_t *)&((struct sockaddr_in *)(saddr + 1))->sin_addr.s_addr; break; #if IS_ENABLED(CONFIG_IPV6) case AF_INET6: xdaddr = (xfrm_address_t *)&((struct sockaddr_in6 *)(daddr + 1))->sin6_addr; xsaddr = (xfrm_address_t *)&((struct sockaddr_in6 *)(saddr + 1))->sin6_addr; break; #endif } if (hdr->sadb_msg_seq) { x = xfrm_find_acq_byseq(net, DUMMY_MARK, hdr->sadb_msg_seq); if (x && !xfrm_addr_equal(&x->id.daddr, xdaddr, family)) { xfrm_state_put(x); x = NULL; } } if (!x) x = xfrm_find_acq(net, &dummy_mark, mode, reqid, 0, proto, xdaddr, xsaddr, 1, family); if (x == NULL) return -ENOENT; min_spi = 0x100; max_spi = 0x0fffffff; range = ext_hdrs[SADB_EXT_SPIRANGE-1]; if (range) { min_spi = range->sadb_spirange_min; max_spi = range->sadb_spirange_max; } err = verify_spi_info(x->id.proto, min_spi, max_spi); if (err) { xfrm_state_put(x); return err; } err = xfrm_alloc_spi(x, min_spi, max_spi); resp_skb = err ? ERR_PTR(err) : pfkey_xfrm_state2msg(x); if (IS_ERR(resp_skb)) { xfrm_state_put(x); return PTR_ERR(resp_skb); } out_hdr = (struct sadb_msg *) resp_skb->data; out_hdr->sadb_msg_version = hdr->sadb_msg_version; out_hdr->sadb_msg_type = SADB_GETSPI; out_hdr->sadb_msg_satype = pfkey_proto2satype(proto); out_hdr->sadb_msg_errno = 0; out_hdr->sadb_msg_reserved = 0; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; xfrm_state_put(x); pfkey_broadcast(resp_skb, GFP_KERNEL, BROADCAST_ONE, sk, net); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366030, "input": "lyxml_free_attr(struct ly_ctx *ctx, struct lyxml_elem *parent, struct lyxml_attr *attr) { struct lyxml_attr *aiter, *aprev; if (!attr) { return; } if (parent) { /* unlink attribute from the parent's list of attributes */ aprev = NULL; for (aiter = parent->attr; aiter; aiter = aiter->next) { if (aiter == attr) { break; } aprev = aiter; } if (!aiter) { /* attribute to remove not found */ return; } if (!aprev) { /* attribute is first in parent's list of attributes */ parent->attr = attr->next; } else { /* reconnect previous attribute to the next */ aprev->next = attr->next; } } lydict_remove(ctx, attr->name); lydict_remove(ctx, attr->value); if (attr->type == LYXML_ATTR_STD_UNRES) { free((char *)attr->ns); } free(attr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198733, "input": "static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { ZZIP_FILE* file = zzip_file_open (disk, name, 0); if (file) { char buffer[1024]; int len; while ((len = zzip_file_read (file, buffer, 1024))) { fwrite (buffer, 1, len, out); } zzip_file_close (file); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Loop with Unreachable Exit Condition ('Infinite Loop')"], "explanation": "Infinite Loop in zziplib v0.13.69 allows remote attackers to cause a denial of service via the return value \"zzip_file_read\" in the function \"unzzip_cat_file\".", "severity_level": "NoInfo", "cwe": "CWE-835", "cve": "CVE-2020-18442"}} -{"idx": 219880, "input": "void moduleInit() override { setlocale(LC_CTYPE, \"\"); HHVM_FE(addcslashes); HHVM_FE(stripcslashes); HHVM_FE(addslashes); HHVM_FE(stripslashes); HHVM_FE(bin2hex); HHVM_FE(hex2bin); HHVM_FE(nl2br); HHVM_FE(quotemeta); HHVM_FE(str_shuffle); HHVM_FE(strrev); HHVM_FE(strtolower); HHVM_FE(strtoupper); HHVM_FE(ucfirst); HHVM_FE(lcfirst); HHVM_FE(ucwords); HHVM_FE(strip_tags); HHVM_FE(trim); HHVM_FE(ltrim); HHVM_FE(rtrim); HHVM_FE(chop); HHVM_FE(explode); HHVM_FE(implode); HHVM_FALIAS(join, implode); HHVM_FE(str_split); HHVM_FE(chunk_split); HHVM_FE(strtok); HHVM_FE(str_replace); HHVM_FE(str_replace_with_count); HHVM_FE(str_ireplace); HHVM_FE(str_ireplace_with_count); HHVM_FE(substr_replace); HHVM_FE(substr); HHVM_FE(str_pad); HHVM_FE(str_repeat); HHVM_FE(html_entity_decode); HHVM_FE(htmlentities); HHVM_FE(htmlspecialchars_decode); HHVM_FE(htmlspecialchars); HHVM_FE(fb_htmlspecialchars); HHVM_FE(quoted_printable_encode); HHVM_FE(quoted_printable_decode); HHVM_FE(convert_uudecode); HHVM_FE(convert_uuencode); HHVM_FE(str_rot13); HHVM_FE(crc32); HHVM_FE(crypt); HHVM_FE(md5); HHVM_FE(sha1); HHVM_FE(strtr); HHVM_FE(convert_cyr_string); HHVM_FE(get_html_translation_table); HHVM_FE(hebrev); HHVM_FE(hebrevc); HHVM_FE(setlocale); HHVM_FE(localeconv); HHVM_FE(nl_langinfo); HHVM_FE(sscanf); HHVM_FE(chr); HHVM_FE(ord); HHVM_FE(money_format); HHVM_FE(number_format); HHVM_FE(strcmp); HHVM_FE(strncmp); HHVM_FE(strnatcmp); HHVM_FE(strcasecmp); HHVM_FE(strncasecmp); HHVM_FE(strnatcasecmp); HHVM_FE(strcoll); HHVM_FE(substr_compare); HHVM_FE(strchr); HHVM_FE(strrchr); HHVM_FE(strstr); HHVM_FE(stristr); HHVM_FE(strpbrk); HHVM_FE(strpos); HHVM_FE(stripos); HHVM_FE(strrpos); HHVM_FE(strripos); HHVM_FE(substr_count); HHVM_FE(strspn); HHVM_FE(strcspn); HHVM_FE(strlen); HHVM_FE(str_getcsv); HHVM_FE(count_chars); HHVM_FE(str_word_count); HHVM_FE(levenshtein); HHVM_FE(similar_text); HHVM_FE(soundex); HHVM_FE(metaphone); HHVM_RC_INT(ENT_COMPAT, k_ENT_HTML_QUOTE_DOUBLE); HHVM_RC_INT(ENT_NOQUOTES, k_ENT_HTML_QUOTE_NONE); HHVM_RC_INT(ENT_QUOTES, k_ENT_QUOTES); HHVM_RC_INT(ENT_IGNORE, k_ENT_HTML_IGNORE_ERRORS); HHVM_RC_INT(ENT_SUBSTITUTE, k_ENT_HTML_SUBSTITUTE_ERRORS); HHVM_RC_INT(ENT_HTML401, k_ENT_HTML_DOC_HTML401); HHVM_RC_INT(ENT_XML1, k_ENT_HTML_DOC_XML1); HHVM_RC_INT(ENT_XHTML, k_ENT_HTML_DOC_XHTML); HHVM_RC_INT(ENT_HTML5, k_ENT_HTML_DOC_HTML5); HHVM_RC_INT(ENT_FB_UTF8, k_ENT_FB_UTF8); HHVM_RC_INT(ENT_FB_UTF8_ONLY, k_ENT_FB_UTF8_ONLY); HHVM_RC_INT(HTML_SPECIALCHARS, k_HTML_SPECIALCHARS); HHVM_RC_INT(HTML_ENTITIES, k_HTML_ENTITIES); HHVM_RC_INT(STR_PAD_LEFT, k_STR_PAD_LEFT); HHVM_RC_INT(STR_PAD_RIGHT, k_STR_PAD_RIGHT); HHVM_RC_INT(STR_PAD_BOTH, k_STR_PAD_BOTH); HHVM_RC_INT_SAME(LC_CTYPE); HHVM_RC_INT_SAME(LC_NUMERIC); HHVM_RC_INT_SAME(LC_TIME); HHVM_RC_INT_SAME(LC_COLLATE); HHVM_RC_INT_SAME(LC_MONETARY); HHVM_RC_INT_SAME(LC_ALL); #ifdef LC_MESSAGES HHVM_RC_INT_SAME(LC_MESSAGES); #endif #ifdef YESEXPR HHVM_RC_INT_SAME(YESEXPR); #endif #ifdef NOEXPR HHVM_RC_INT_SAME(NOEXPR); #endif HHVM_RC_INT(CHAR_MAX, std::numeric_limits::max()); HHVM_RC_STR(HPHP_TRIM_CHARLIST, k_HPHP_TRIM_CHARLIST); #ifdef ABDAY_1 HHVM_RC_INT_SAME(ABDAY_1); HHVM_RC_INT_SAME(ABDAY_2); HHVM_RC_INT_SAME(ABDAY_3); HHVM_RC_INT_SAME(ABDAY_4); HHVM_RC_INT_SAME(ABDAY_5); HHVM_RC_INT_SAME(ABDAY_6); HHVM_RC_INT_SAME(ABDAY_7); #endif #ifdef DAY_1 HHVM_RC_INT_SAME(DAY_1); HHVM_RC_INT_SAME(DAY_2); HHVM_RC_INT_SAME(DAY_3); HHVM_RC_INT_SAME(DAY_4); HHVM_RC_INT_SAME(DAY_5); HHVM_RC_INT_SAME(DAY_6); HHVM_RC_INT_SAME(DAY_7); #endif #ifdef ABMON_1 HHVM_RC_INT_SAME(ABMON_1); HHVM_RC_INT_SAME(ABMON_2); HHVM_RC_INT_SAME(ABMON_3); HHVM_RC_INT_SAME(ABMON_4); HHVM_RC_INT_SAME(ABMON_5); HHVM_RC_INT_SAME(ABMON_6); HHVM_RC_INT_SAME(ABMON_7); HHVM_RC_INT_SAME(ABMON_8); HHVM_RC_INT_SAME(ABMON_9); HHVM_RC_INT_SAME(ABMON_10); HHVM_RC_INT_SAME(ABMON_11); HHVM_RC_INT_SAME(ABMON_12); #endif #ifdef MON_1 HHVM_RC_INT_SAME(MON_1); HHVM_RC_INT_SAME(MON_2); HHVM_RC_INT_SAME(MON_3); HHVM_RC_INT_SAME(MON_4); HHVM_RC_INT_SAME(MON_5); HHVM_RC_INT_SAME(MON_6); HHVM_RC_INT_SAME(MON_7); HHVM_RC_INT_SAME(MON_8); HHVM_RC_INT_SAME(MON_9); HHVM_RC_INT_SAME(MON_10); HHVM_RC_INT_SAME(MON_11); HHVM_RC_INT_SAME(MON_12); #endif // These are ostensibly bools, // but for historical reasons are expressed as ints HHVM_RC_INT(CRYPT_BLOWFISH, 1); HHVM_RC_INT(CRYPT_EXT_DES, 0); HHVM_RC_INT(CRYPT_MD5, 1); HHVM_RC_INT(CRYPT_STD_DES, 1); HHVM_RC_INT(CRYPT_SALT_LENGTH, 12); loadSystemlib(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364934, "input": "int tipc_node_distr_xmit(struct net *net, struct sk_buff_head *xmitq) { struct sk_buff *skb; u32 selector, dnode; while ((skb = __skb_dequeue(xmitq))) { selector = msg_origport(buf_msg(skb)); dnode = msg_destnode(buf_msg(skb)); tipc_node_xmit_skb(net, skb, dnode, selector); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 450885, "input": "static int lp_release(struct inode * inode, struct file * file) { unsigned int minor = iminor(inode); lp_claim_parport_or_block (&lp_table[minor]); parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT); lp_table[minor].current_mode = IEEE1284_MODE_COMPAT; lp_release_parport (&lp_table[minor]); kfree(lp_table[minor].lp_buffer); lp_table[minor].lp_buffer = NULL; LP_F(minor) &= ~LP_BUSY; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409578, "input": "static void rdp_read_bitmap_cache_cell_info(wStream* s, BITMAP_CACHE_V2_CELL_INFO* cellInfo) { UINT32 info; /** * numEntries is in the first 31 bits, while the last bit (k) * is used to indicate a persistent bitmap cache. */ Stream_Read_UINT32(s, info); cellInfo->numEntries = (info & 0x7FFFFFFF); cellInfo->persistent = (info & 0x80000000) ? 1 : 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 449650, "input": "PJ_DEF(pjmedia_sdp_neg_state) pjmedia_sdp_neg_get_state( pjmedia_sdp_neg *neg ) { /* Check arguments are valid. */ PJ_ASSERT_RETURN(neg != NULL, PJMEDIA_SDP_NEG_STATE_NULL); return neg->state; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373782, "input": "DoDeleteBatchFromQStore(qqueue_t *pThis, int nElem) { int i; DEFiRet; ISOBJ_TYPE_assert(pThis, qqueue); /* now send delete request to storage driver */ for(i = 0 ; i < nElem ; ++i) { pThis->qDel(pThis); } /* iQueueSize is not decremented by qDel(), so we need to do it ourselves */ ATOMIC_SUB(&pThis->iQueueSize, nElem, &pThis->mutQueueSize); ATOMIC_SUB(&pThis->nLogDeq, nElem, &pThis->mutLogDeq); dbgprintf(\"delete batch from store, new sizes: log %d, phys %d\\n\", getLogicalQueueSize(pThis), getPhysicalQueueSize(pThis)); ++pThis->deqIDDel; /* one more batch dequeued */ RETiRet; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 217241, "input": "bool read(ReadonlyBytes buffer) { auto fields_size = sizeof(LocalFileHeader) - (sizeof(u8*) * 3); if (buffer.size() < fields_size) return false; if (memcmp(buffer.data(), local_file_header_signature, sizeof(local_file_header_signature)) != 0) return false; memcpy(reinterpret_cast(&minimum_version), buffer.data() + sizeof(local_file_header_signature), fields_size); name = buffer.data() + sizeof(local_file_header_signature) + fields_size; extra_data = name + name_length; compressed_data = extra_data + extra_data_length; return true; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')"], "explanation": "SerenityOS 2021-03-27 contains a buffer overflow vulnerability in the EndOfCentralDirectory::read() function.", "severity_level": "NoInfo", "cwe": "CWE-120", "cve": "CVE-2021-30045"}} -{"idx": 399256, "input": "BOOL license_read_binary_blob(wStream* s, LICENSE_BLOB* blob) { UINT16 wBlobType; if (Stream_GetRemainingLength(s) < 4) return FALSE; Stream_Read_UINT16(s, wBlobType); /* wBlobType (2 bytes) */ Stream_Read_UINT16(s, blob->length); /* wBlobLen (2 bytes) */ if (Stream_GetRemainingLength(s) < blob->length) return FALSE; /* * Server can choose to not send data by setting length to 0. * If so, it may not bother to set the type, so shortcut the warning */ if ((blob->type != BB_ANY_BLOB) && (blob->length == 0)) return TRUE; if ((blob->type != wBlobType) && (blob->type != BB_ANY_BLOB)) { WLog_ERR(TAG, \"license binary blob type (0x%\" PRIx16 \") does not match expected type (0x%\" PRIx16 \").\", wBlobType, blob->type); } blob->type = wBlobType; blob->data = (BYTE*)malloc(blob->length); if (!blob->data) return FALSE; Stream_Read(s, blob->data, blob->length); /* blobData */ return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499637, "input": "list_file (struct cpio_file_stat* file_hdr, int in_file_des) { if (verbose_flag) { #ifdef CP_IFLNK if ((file_hdr->c_mode & CP_IFMT) == CP_IFLNK) { if (archive_format != arf_tar && archive_format != arf_ustar) { char *link_name = get_link_name (file_hdr, in_file_des); if (link_name) { long_format (file_hdr, link_name); free (link_name); } } else long_format (file_hdr, file_hdr->c_tar_linkname); return; } else #endif long_format (file_hdr, (char *) 0); } else { /* Print out the name as it is. The name_end delimiter is normally '\\n', but can be reset to '\\0' by the -0 option. */ printf (\"%s%c\", file_hdr->c_name, name_end); } crc = 0; tape_toss_input (in_file_des, file_hdr->c_filesize); tape_skip_padding (in_file_des, file_hdr->c_filesize); if (only_verify_crc_flag) { #ifdef CP_IFLNK if ((file_hdr->c_mode & CP_IFMT) == CP_IFLNK) { return; /* links don't have a checksum */ } #endif if (crc != file_hdr->c_chksum) { error (0, 0, _(\"%s: checksum error (0x%x, should be 0x%x)\"), file_hdr->c_name, crc, file_hdr->c_chksum); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432569, "input": "static bool nested_vmcb_checks(struct vmcb *vmcb) { if ((vmcb->control.intercept & (1ULL << INTERCEPT_VMRUN)) == 0) return false; if (vmcb->control.asid == 0) return false; if ((vmcb->control.nested_ctl & SVM_NESTED_CTL_NP_ENABLE) && !npt_enabled) return false; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219488, "input": "std::string toCppString() const { return std::string(c_str(), size()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336758, "input": "lyp_yin_parse_subnode_ext(struct lys_module *mod, void *elem, LYEXT_PAR elem_type, struct lyxml_elem *yin, LYEXT_SUBSTMT type, uint8_t i, struct unres_schema *unres) { void *reallocated; struct lyxml_elem *next, *child; int r; struct lys_ext_instance ***ext; uint8_t *ext_size; const char *statement; r = lyp_get_ext_list(mod->ctx, elem, elem_type, &ext, &ext_size, &statement); LY_CHECK_RETURN(r, EXIT_FAILURE); if (type == LYEXT_SUBSTMT_SELF) { /* parse for the statement self, not for the substatement */ child = yin; next = NULL; goto parseext; } LY_TREE_FOR_SAFE(yin->child, next, child) { if (!child->ns) { LOGVAL(mod->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Extension instance \\\"%s\\\" is missing namespace.\", child->name); return EXIT_FAILURE; } if (!strcmp(child->ns->value, LY_NSYIN)) { /* skip the regular YIN nodes */ continue; } /* parse it as extension */ parseext: YIN_CHECK_ARRAY_OVERFLOW_RETURN(mod->ctx, *ext_size, *ext_size, \"extension\", statement, EXIT_FAILURE); /* first, allocate a space for the extension instance in the parent elem */ reallocated = realloc(*ext, (1 + (*ext_size)) * sizeof **ext); LY_CHECK_ERR_RETURN(!reallocated, LOGMEM(mod->ctx), EXIT_FAILURE); (*ext) = reallocated; /* init memory */ (*ext)[(*ext_size)] = NULL; /* parse YIN data */ r = lyp_yin_fill_ext(elem, elem_type, type, i, mod, child, ext, ext_size, unres); if (r) { return EXIT_FAILURE; } lyp_reduce_ext_list(ext, *ext_size, 1 + (*ext_size)); /* done - do not free the child, it is unlinked in lyp_yin_fill_ext */ } return EXIT_SUCCESS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509213, "input": "bool eval_const_cond() { DBUG_ASSERT(const_item()); DBUG_ASSERT(!is_expensive()); return val_bool(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402391, "input": "ConnStateData::initiateTunneledRequest(HttpRequest::Pointer const &cause, Http::MethodType const method, const char *reason, const SBuf &payload) { // fake a CONNECT request to force connState to tunnel SBuf connectHost; unsigned short connectPort = 0; if (pinning.serverConnection != nullptr) { static char ip[MAX_IPSTRLEN]; connectHost = pinning.serverConnection->remote.toStr(ip, sizeof(ip)); connectPort = pinning.serverConnection->remote.port(); } else if (cause) { connectHost = cause->url.hostOrIp(); connectPort = cause->url.port(); #if USE_OPENSSL } else if (!tlsConnectHostOrIp.isEmpty()) { connectHost = tlsConnectHostOrIp; connectPort = tlsConnectPort; #endif } else if (transparent()) { static char ip[MAX_IPSTRLEN]; connectHost = clientConnection->local.toStr(ip, sizeof(ip)); connectPort = clientConnection->local.port(); } else { debugs(33, 2, \"Not able to compute URL, abort request tunneling for \" << reason); return false; } debugs(33, 2, \"Request tunneling for \" << reason); ClientHttpRequest *http = buildFakeRequest(method, connectHost, connectPort, payload); HttpRequest::Pointer request = http->request; request->flags.forceTunnel = true; http->calloutContext = new ClientRequestContext(http); http->doCallouts(); clientProcessRequestFinished(this, request); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232599, "input": "int check_ctx_reg(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int regno) { /* Access to ctx or passing it to a helper is only allowed in * its original, unmodified form. */ if (reg->off) { verbose(env, \"dereference of modified ctx ptr R%d off=%d disallowed\\n\", regno, reg->off); return -EACCES; } if (!tnum_is_const(reg->var_off) || reg->var_off.value) { char tn_buf[48]; tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); verbose(env, \"variable ctx access var_off=%s disallowed\\n\", tn_buf); return -EACCES; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265772, "input": "void CWebSession::UpdateLastActive() { time(&m_tmLastActive); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379429, "input": "vlist_realloc (vlist, n) VARLIST *vlist; int n; { if (vlist == 0) return (vlist = vlist_alloc (n)); if (n > vlist->list_size) { vlist->list_size = n; vlist->list = (SHELL_VAR **)xrealloc (vlist->list, (vlist->list_size + 1) * sizeof (SHELL_VAR *)); } return vlist; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402195, "input": "int bcf_hdr_printf(bcf_hdr_t *hdr, const char *fmt, ...) { char tmp[256], *line = tmp; va_list ap; va_start(ap, fmt); int n = vsnprintf(line, sizeof(tmp), fmt, ap); va_end(ap); if (n >= sizeof(tmp)) { n++; // For trailing NUL line = (char*)malloc(n); if (!line) return -1; va_start(ap, fmt); vsnprintf(line, n, fmt, ap); va_end(ap); } int ret = bcf_hdr_append(hdr, line); if (line != tmp) free(line); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244382, "input": "GF_DashSegmenterInput *set_dash_input(GF_DashSegmenterInput *dash_inputs, char *name, u32 *nb_dash_inputs) { GF_DashSegmenterInput *di; char *other_opts = NULL; char *sep = gf_url_colon_suffix(name); dash_inputs = gf_realloc(dash_inputs, sizeof(GF_DashSegmenterInput) * (*nb_dash_inputs + 1) ); memset(&dash_inputs[*nb_dash_inputs], 0, sizeof(GF_DashSegmenterInput) ); di = &dash_inputs[*nb_dash_inputs]; (*nb_dash_inputs)++; if (sep) { char *opts, *first_opt; opts = first_opt = sep; while (opts) { sep = gf_url_colon_suffix(opts); while (sep) { /* this is a real separator if it is followed by a keyword we are looking for */ if (!strnicmp(sep, \":id=\", 4) || !strnicmp(sep, \":dur=\", 5) || !strnicmp(sep, \":period=\", 8) || !strnicmp(sep, \":BaseURL=\", 9) || !strnicmp(sep, \":bandwidth=\", 11) || !strnicmp(sep, \":role=\", 6) || !strnicmp(sep, \":desc\", 5) || !strnicmp(sep, \":sscale\", 7) || !strnicmp(sep, \":duration=\", 10) || !strnicmp(sep, \":period_duration=\", 10) || !strnicmp(sep, \":pdur=\", 6) || !strnicmp(sep, \":xlink=\", 7) || !strnicmp(sep, \":asID=\", 6) || !strnicmp(sep, \":sn=\", 4) || !strnicmp(sep, \":tpl=\", 5) || !strnicmp(sep, \":hls=\", 5) || !strnicmp(sep, \":trackID=\", 9) || !strnicmp(sep, \":@@\", 3) ) { break; } else { char *nsep = gf_url_colon_suffix(sep+1); if (nsep) nsep[0] = 0; gf_dynstrcat(&other_opts, sep, \":\"); if (nsep) nsep[0] = ':'; sep = strchr(sep+1, ':'); } } if (sep && !strncmp(sep, \"://\", 3) && strnicmp(sep, \":@@\", 3)) sep = gf_url_colon_suffix(sep+3); if (sep) sep[0] = 0; if (!strnicmp(opts, \"id=\", 3)) { di->representationID = gf_strdup(opts+3); /*we allow the same repID to be set to force muxed representations*/ } else if (!strnicmp(opts, \"dur=\", 4)) di->media_duration = (Double)atof(opts+4); else if (!strnicmp(opts, \"period=\", 7)) di->periodID = gf_strdup(opts+7); else if (!strnicmp(opts, \"BaseURL=\", 8)) { di->baseURL = (char **)gf_realloc(di->baseURL, (di->nb_baseURL+1)*sizeof(char *)); di->baseURL[di->nb_baseURL] = gf_strdup(opts+8); di->nb_baseURL++; } else if (!strnicmp(opts, \"bandwidth=\", 10)) di->bandwidth = atoi(opts+10); else if (!strnicmp(opts, \"role=\", 5)) { di->roles = gf_realloc(di->roles, sizeof (char *) * (di->nb_roles+1)); di->roles[di->nb_roles] = gf_strdup(opts+5); di->nb_roles++; } else if (!strnicmp(opts, \"desc\", 4)) { u32 *nb_descs=NULL; char ***descs=NULL; u32 opt_offset=0; u32 len; if (!strnicmp(opts, \"desc_p=\", 7)) { nb_descs = &di->nb_p_descs; descs = &di->p_descs; opt_offset = 7; } else if (!strnicmp(opts, \"desc_as=\", 8)) { nb_descs = &di->nb_as_descs; descs = &di->as_descs; opt_offset = 8; } else if (!strnicmp(opts, \"desc_as_c=\", 8)) { nb_descs = &di->nb_as_c_descs; descs = &di->as_c_descs; opt_offset = 10; } else if (!strnicmp(opts, \"desc_rep=\", 8)) { nb_descs = &di->nb_rep_descs; descs = &di->rep_descs; opt_offset = 9; } if (opt_offset) { (*nb_descs)++; opts += opt_offset; len = (u32) strlen(opts); (*descs) = (char **)gf_realloc((*descs), (*nb_descs)*sizeof(char *)); (*descs)[(*nb_descs)-1] = (char *)gf_malloc((len+1)*sizeof(char)); strncpy((*descs)[(*nb_descs)-1], opts, len); (*descs)[(*nb_descs)-1][len] = 0; } } else if (!strnicmp(opts, \"xlink=\", 6)) di->xlink = gf_strdup(opts+6); else if (!strnicmp(opts, \"sscale\", 6)) di->sscale = GF_TRUE; else if (!strnicmp(opts, \"pdur=\", 5)) di->period_duration = (Double) atof(opts+5); else if (!strnicmp(opts, \"period_duration=\", 16)) di->period_duration = (Double) atof(opts+16); else if (!strnicmp(opts, \"duration=\", 9)) di->dash_duration = (Double) atof(opts+9); else if (!strnicmp(opts, \"asID=\", 5)) di->asID = atoi(opts+5); else if (!strnicmp(opts, \"sn=\", 3)) di->startNumber = atoi(opts+3); else if (!strnicmp(opts, \"tpl=\", 4)) di->seg_template = gf_strdup(opts+4); else if (!strnicmp(opts, \"hls=\", 4)) di->hls_pl = gf_strdup(opts+4); else if (!strnicmp(opts, \"trackID=\", 8)) di->track_id = atoi(opts+8); else if (!strnicmp(opts, \"@@\", 2)) { di->filter_chain = gf_strdup(opts+2); if (sep) sep[0] = ':'; sep = NULL; } if (!sep) break; sep[0] = ':'; opts = sep+1; } first_opt[0] = '\\0'; } di->file_name = name; di->source_opts = other_opts; if (!di->representationID) { char szRep[100]; sprintf(szRep, \"%d\", *nb_dash_inputs); di->representationID = gf_strdup(szRep); } return dash_inputs; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 371767, "input": "MagickExport double GenerateDifferentialNoise(RandomInfo *random_info, const Quantum pixel,const NoiseType noise_type,const MagickRealType attenuate) { #define SigmaUniform (attenuate*0.015625) #define SigmaGaussian (attenuate*0.015625) #define SigmaImpulse (attenuate*0.1) #define SigmaLaplacian (attenuate*0.0390625) #define SigmaMultiplicativeGaussian (attenuate*0.5) #define SigmaPoisson (attenuate*12.5) #define SigmaRandom (attenuate) #define TauGaussian (attenuate*0.078125) double alpha, beta, noise, sigma; alpha=GetPseudoRandomValue(random_info); switch (noise_type) { case UniformNoise: default: { noise=(double) (pixel+QuantumRange*SigmaUniform*(alpha-0.5)); break; } case GaussianNoise: { double gamma, tau; if (fabs(alpha) < MagickEpsilon) alpha=1.0; beta=GetPseudoRandomValue(random_info); gamma=sqrt(-2.0*log(alpha)); sigma=gamma*cos((double) (2.0*MagickPI*beta)); tau=gamma*sin((double) (2.0*MagickPI*beta)); noise=(double) (pixel+sqrt((double) pixel)*SigmaGaussian*sigma+ QuantumRange*TauGaussian*tau); break; } case ImpulseNoise: { if (alpha < (SigmaImpulse/2.0)) noise=0.0; else if (alpha >= (1.0-(SigmaImpulse/2.0))) noise=(double) QuantumRange; else noise=(double) pixel; break; } case LaplacianNoise: { if (alpha <= 0.5) { if (alpha <= MagickEpsilon) noise=(double) (pixel-QuantumRange); else noise=(double) (pixel+QuantumRange*SigmaLaplacian*log(2.0*alpha)+ 0.5); break; } beta=1.0-alpha; if (beta <= (0.5*MagickEpsilon)) noise=(double) (pixel+QuantumRange); else noise=(double) (pixel-QuantumRange*SigmaLaplacian*log(2.0*beta)+0.5); break; } case MultiplicativeGaussianNoise: { sigma=1.0; if (alpha > MagickEpsilon) sigma=sqrt(-2.0*log(alpha)); beta=GetPseudoRandomValue(random_info); noise=(double) (pixel+pixel*SigmaMultiplicativeGaussian*sigma* cos((double) (2.0*MagickPI*beta))/2.0); break; } case PoissonNoise: { double poisson; ssize_t i; poisson=exp(-SigmaPoisson*QuantumScale*pixel); for (i=0; alpha > poisson; i++) { beta=GetPseudoRandomValue(random_info); alpha*=beta; } noise=(double) (QuantumRange*i*PerceptibleReciprocal(SigmaPoisson)); break; } case RandomNoise: { noise=(double) (QuantumRange*SigmaRandom*alpha); break; } } return(noise); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215994, "input": "load_image (const gchar *filename, GError **error) { FILE *fp; tga_info info; guchar header[18]; guchar footer[26]; guchar extension[495]; long offset; gint32 image_ID = -1; fp = g_fopen (filename, \"rb\"); if (! fp) { g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), _(\"Could not open '%s' for reading: %s\"), gimp_filename_to_utf8 (filename), g_strerror (errno)); return -1; } gimp_progress_init_printf (_(\"Opening '%s'\"), gimp_filename_to_utf8 (filename)); /* Is file big enough for a footer? */ if (!fseek (fp, -26L, SEEK_END)) { if (fread (footer, sizeof (footer), 1, fp) != 1) { g_message (_(\"Cannot read footer from '%s'\"), gimp_filename_to_utf8 (filename)); return -1; } else if (memcmp (footer + 8, magic, sizeof (magic)) == 0) { /* Check the signature. */ offset = (footer[0] + footer[1] * 256L + footer[2] * 65536L + footer[3] * 16777216L); if (offset != 0) { if (fseek (fp, offset, SEEK_SET) || fread (extension, sizeof (extension), 1, fp) != 1) { g_message (_(\"Cannot read extension from '%s'\"), gimp_filename_to_utf8 (filename)); return -1; } /* Eventually actually handle version 2 TGA here */ } } } if (fseek (fp, 0, SEEK_SET) || fread (header, sizeof (header), 1, fp) != 1) { g_message (_(\"Cannot read header from '%s'\"), gimp_filename_to_utf8 (filename)); return -1; } switch (header[2]) { case 1: info.imageType = TGA_TYPE_MAPPED; info.imageCompression = TGA_COMP_NONE; break; case 2: info.imageType = TGA_TYPE_COLOR; info.imageCompression = TGA_COMP_NONE; break; case 3: info.imageType = TGA_TYPE_GRAY; info.imageCompression = TGA_COMP_NONE; break; case 9: info.imageType = TGA_TYPE_MAPPED; info.imageCompression = TGA_COMP_RLE; break; case 10: info.imageType = TGA_TYPE_COLOR; info.imageCompression = TGA_COMP_RLE; break; case 11: info.imageType = TGA_TYPE_GRAY; info.imageCompression = TGA_COMP_RLE; break; default: info.imageType = 0; } info.idLength = header[0]; info.colorMapType = header[1]; info.colorMapIndex = header[3] + header[4] * 256; info.colorMapLength = header[5] + header[6] * 256; info.colorMapSize = header[7]; info.xOrigin = header[8] + header[9] * 256; info.yOrigin = header[10] + header[11] * 256; info.width = header[12] + header[13] * 256; info.height = header[14] + header[15] * 256; info.bpp = header[16]; info.bytes = (info.bpp + 7) / 8; info.alphaBits = header[17] & 0x0f; /* Just the low 4 bits */ info.flipHoriz = (header[17] & 0x10) ? 1 : 0; info.flipVert = (header[17] & 0x20) ? 0 : 1; /* hack to handle some existing files with incorrect headers, see bug #306675 */ if (info.alphaBits == info.bpp) info.alphaBits = 0; /* hack to handle yet another flavor of incorrect headers, see bug #540969 */ if (info.alphaBits == 0) { if (info.imageType == TGA_TYPE_COLOR && info.bpp == 32) info.alphaBits = 8; if (info.imageType == TGA_TYPE_GRAY && info.bpp == 16) info.alphaBits = 8; } switch (info.imageType) { case TGA_TYPE_MAPPED: if (info.bpp != 8) { g_message (\"Unhandled sub-format in '%s' (type = %u, bpp = %u)\", gimp_filename_to_utf8 (filename), info.imageType, info.bpp); return -1; } break; case TGA_TYPE_COLOR: if ((info.bpp != 15 && info.bpp != 16 && info.bpp != 24 && info.bpp != 32) || ((info.bpp == 15 || info.bpp == 24) && info.alphaBits != 0) || (info.bpp == 16 && info.alphaBits != 1) || (info.bpp == 32 && info.alphaBits != 8)) { g_message (\"Unhandled sub-format in '%s' (type = %u, bpp = %u, alpha = %u)\", gimp_filename_to_utf8 (filename), info.imageType, info.bpp, info.alphaBits); return -1; } break; case TGA_TYPE_GRAY: if (info.bpp != 8 && (info.alphaBits != 8 || (info.bpp != 16 && info.bpp != 15))) { g_message (\"Unhandled sub-format in '%s' (type = %u, bpp = %u)\", gimp_filename_to_utf8 (filename), info.imageType, info.bpp); return -1; } break; default: g_message (\"Unknown image type %u for '%s'\", info.imageType, gimp_filename_to_utf8 (filename)); return -1; } /* Plausible but unhandled formats */ if (info.bytes * 8 != info.bpp && info.bpp != 15) { g_message (\"Unhandled sub-format in '%s' (type = %u, bpp = %u)\", gimp_filename_to_utf8 (filename), info.imageType, info.bpp); return -1; } /* Check that we have a color map only when we need it. */ if (info.imageType == TGA_TYPE_MAPPED && info.colorMapType != 1) { g_message (\"Indexed image has invalid color map type %u\", info.colorMapType); return -1; } else if (info.imageType != TGA_TYPE_MAPPED && info.colorMapType != 0) { g_message (\"Non-indexed image has invalid color map type %u\", info.colorMapType); return -1; } /* Skip the image ID field. */ if (info.idLength && fseek (fp, info.idLength, SEEK_CUR)) { g_message (\"File '%s' is truncated or corrupted\", gimp_filename_to_utf8 (filename)); return -1; } image_ID = ReadImage (fp, &info, filename); fclose (fp); return image_ID; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In GIMP 2.8.22, there is a heap-based buffer over-read in ReadImage in plug-ins/common/file-tga.c (related to bgr2rgb.part.1) via an unexpected bits-per-pixel value for an RGBA image.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2017-17786"}} -{"idx": 431473, "input": "static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, struct xdr_stream *xdr, void *data) { struct nfs4_accessres *res = data; struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (status) goto out; status = decode_sequence(xdr, &res->seq_res, rqstp); if (status) goto out; status = decode_putfh(xdr); if (status != 0) goto out; status = decode_access(xdr, &res->supported, &res->access); if (status != 0) goto out; if (res->fattr) decode_getfattr(xdr, res->fattr, res->server); out: return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 403823, "input": "static bool test_valid_request(struct torture_context *torture, struct smb2_tree *tree) { bool ret = true; NTSTATUS status; struct smb2_handle dh; struct smb2_notify n; struct smb2_request *req; uint32_t max_buffer_size; torture_comment(torture, \"TESTING VALIDITY OF CHANGE NOTIFY REQUEST\\n\"); smb2_transport_credits_ask_num(tree->session->transport, 256); smb2_util_unlink(tree, FNAME); status = smb2_util_roothandle(tree, &dh); CHECK_STATUS(status, NT_STATUS_OK); max_buffer_size = smb2cli_conn_max_trans_size(tree->session->transport->conn); n.in.recursive = 0x0000; n.in.buffer_size = max_buffer_size; n.in.file.handle = dh; n.in.completion_filter = FILE_NOTIFY_CHANGE_ALL; n.in.unknown = 0x00000000; req = smb2_notify_send(tree, &n); while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { if (tevent_loop_once(torture->ev) != 0) { break; } } status = torture_setup_simple_file(torture, tree, FNAME); CHECK_STATUS(status, NT_STATUS_OK); status = smb2_notify_recv(req, torture, &n); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(n.out.num_changes, 1); CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_ADDED); CHECK_WIRE_STR(n.out.changes[0].name, FNAME); /* * if the change response doesn't fit in the buffer * NOTIFY_ENUM_DIR is returned. */ n.in.buffer_size = 0x00000000; req = smb2_notify_send(tree, &n); while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { if (tevent_loop_once(torture->ev) != 0) { break; } } status = torture_setup_simple_file(torture, tree, FNAME); CHECK_STATUS(status, NT_STATUS_OK); status = smb2_notify_recv(req, torture, &n); CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR); /* * if the change response fits in the buffer we get * NT_STATUS_OK again */ n.in.buffer_size = max_buffer_size; req = smb2_notify_send(tree, &n); while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { if (tevent_loop_once(torture->ev) != 0) { break; } } status = torture_setup_simple_file(torture, tree, FNAME); CHECK_STATUS(status, NT_STATUS_OK); status = smb2_notify_recv(req, torture, &n); CHECK_STATUS(status, NT_STATUS_OK); CHECK_VAL(n.out.num_changes, 3); CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_REMOVED); CHECK_WIRE_STR(n.out.changes[0].name, FNAME); CHECK_VAL(n.out.changes[1].action, NOTIFY_ACTION_ADDED); CHECK_WIRE_STR(n.out.changes[1].name, FNAME); CHECK_VAL(n.out.changes[2].action, NOTIFY_ACTION_MODIFIED); CHECK_WIRE_STR(n.out.changes[2].name, FNAME); /* if the first notify returns NOTIFY_ENUM_DIR, all do */ status = smb2_util_close(tree, dh); CHECK_STATUS(status, NT_STATUS_OK); status = smb2_util_roothandle(tree, &dh); CHECK_STATUS(status, NT_STATUS_OK); n.in.recursive = 0x0000; n.in.buffer_size = 0x00000001; n.in.file.handle = dh; n.in.completion_filter = FILE_NOTIFY_CHANGE_ALL; n.in.unknown = 0x00000000; req = smb2_notify_send(tree, &n); while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { if (tevent_loop_once(torture->ev) != 0) { break; } } status = torture_setup_simple_file(torture, tree, FNAME); CHECK_STATUS(status, NT_STATUS_OK); status = smb2_notify_recv(req, torture, &n); CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR); n.in.buffer_size = max_buffer_size; req = smb2_notify_send(tree, &n); while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) { if (tevent_loop_once(torture->ev) != 0) { break; } } status = torture_setup_simple_file(torture, tree, FNAME); CHECK_STATUS(status, NT_STATUS_OK); status = smb2_notify_recv(req, torture, &n); CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR); /* if the buffer size is too large, we get invalid parameter */ n.in.recursive = 0x0000; n.in.buffer_size = max_buffer_size + 1; n.in.file.handle = dh; n.in.completion_filter = FILE_NOTIFY_CHANGE_ALL; n.in.unknown = 0x00000000; req = smb2_notify_send(tree, &n); status = smb2_notify_recv(req, torture, &n); CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); done: return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422555, "input": "TEST(LtOp, MatchesMaxKey) { BSONObj operand = BSON(\"a\" << MaxKey); LTMatchExpression lt(\"a\", operand[\"a\"]); BSONObj minKeyObj = BSON(\"a\" << MinKey); BSONObj maxKeyObj = BSON(\"a\" << MaxKey); BSONObj numObj = BSON(\"a\" << 4); ASSERT(lt.matchesBSON(minKeyObj, NULL)); ASSERT(!lt.matchesBSON(maxKeyObj, NULL)); ASSERT(lt.matchesBSON(numObj, NULL)); ASSERT(lt.matchesSingleElement(minKeyObj.firstElement())); ASSERT(!lt.matchesSingleElement(maxKeyObj.firstElement())); ASSERT(lt.matchesSingleElement(numObj.firstElement())); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230224, "input": "void ObjectBuildMeta(const GCCell *cell, Metadata::Builder &mb) { // This call is just for debugging and consistency purposes. mb.addJSObjectOverlapSlots(JSObject::numOverlapSlots()); const auto *self = static_cast(cell); mb.addField(\"parent\", &self->parent_); mb.addField(\"class\", &self->clazz_); mb.addField(\"propStorage\", &self->propStorage_); // Declare the direct properties. static const char *directPropName[JSObject::DIRECT_PROPERTY_SLOTS] = { \"directProp0\", \"directProp1\", \"directProp2\", \"directProp3\"}; for (unsigned i = mb.getJSObjectOverlapSlots(); i < JSObject::DIRECT_PROPERTY_SLOTS; ++i) { mb.addField(directPropName[i], self->directProps() + i); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437568, "input": "static u64 __scale_tsc(u64 ratio, u64 tsc) { u64 mult, frac, _tsc; mult = ratio >> 32; frac = ratio & ((1ULL << 32) - 1); _tsc = tsc; _tsc *= mult; _tsc += (tsc >> 32) * frac; _tsc += ((tsc & ((1ULL << 32) - 1)) * frac) >> 32; return _tsc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364189, "input": "vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; gfp_t gfp; struct page *page; unsigned long haddr = vmf->address & HPAGE_PMD_MASK; if (!transhuge_vma_suitable(vma, haddr)) return VM_FAULT_FALLBACK; if (unlikely(anon_vma_prepare(vma))) return VM_FAULT_OOM; if (unlikely(khugepaged_enter(vma, vma->vm_flags))) return VM_FAULT_OOM; if (!(vmf->flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(vma->vm_mm) && transparent_hugepage_use_zero_page()) { pgtable_t pgtable; struct page *zero_page; bool set; vm_fault_t ret; pgtable = pte_alloc_one(vma->vm_mm); if (unlikely(!pgtable)) return VM_FAULT_OOM; zero_page = mm_get_huge_zero_page(vma->vm_mm); if (unlikely(!zero_page)) { pte_free(vma->vm_mm, pgtable); count_vm_event(THP_FAULT_FALLBACK); return VM_FAULT_FALLBACK; } vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); ret = 0; set = false; if (pmd_none(*vmf->pmd)) { ret = check_stable_address_space(vma->vm_mm); if (ret) { spin_unlock(vmf->ptl); } else if (userfaultfd_missing(vma)) { spin_unlock(vmf->ptl); ret = handle_userfault(vmf, VM_UFFD_MISSING); VM_BUG_ON(ret & VM_FAULT_FALLBACK); } else { set_huge_zero_page(pgtable, vma->vm_mm, vma, haddr, vmf->pmd, zero_page); spin_unlock(vmf->ptl); set = true; } } else spin_unlock(vmf->ptl); if (!set) pte_free(vma->vm_mm, pgtable); return ret; } gfp = alloc_hugepage_direct_gfpmask(vma); page = alloc_hugepage_vma(gfp, vma, haddr, HPAGE_PMD_ORDER); if (unlikely(!page)) { count_vm_event(THP_FAULT_FALLBACK); return VM_FAULT_FALLBACK; } prep_transhuge_page(page); return __do_huge_pmd_anonymous_page(vmf, page, gfp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281546, "input": "static void execlists_context_destroy(struct kref *kref) { struct intel_context *ce = container_of(kref, typeof(*ce), ref); GEM_BUG_ON(!i915_active_is_idle(&ce->active)); GEM_BUG_ON(intel_context_is_pinned(ce)); if (ce->state) __execlists_context_fini(ce); intel_context_fini(ce); intel_context_free(ce); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446049, "input": "static int grep_cache(struct grep_opt *opt, const char **paths, int cached) { int hit = 0; int nr; read_cache(); #if !NO_EXTERNAL_GREP /* * Use the external \"grep\" command for the case where * we grep through the checked-out files. It tends to * be a lot more optimized */ if (!cached) { hit = external_grep(opt, paths, cached); if (hit >= 0) return hit; } #endif for (nr = 0; nr < active_nr; nr++) { struct cache_entry *ce = active_cache[nr]; if (!S_ISREG(ce->ce_mode)) continue; if (!pathspec_matches(paths, ce->name)) continue; if (cached) { if (ce_stage(ce)) continue; hit |= grep_sha1(opt, ce->sha1, ce->name, 0); } else hit |= grep_file(opt, ce->name); if (ce_stage(ce)) { do { nr++; } while (nr < active_nr && !strcmp(ce->name, active_cache[nr]->name)); nr--; /* compensate for loop control */ } } free_grep_patterns(opt); return hit; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197715, "input": "void ValidateInputs(OpKernelContext* ctx, const CSRSparseMatrix& sparse_matrix, const Tensor& permutation_indices, int* batch_size, int64* num_rows) { OP_REQUIRES(ctx, sparse_matrix.dtype() == DataTypeToEnum::value, errors::InvalidArgument( \"Asked for a CSRSparseMatrix of type \", DataTypeString(DataTypeToEnum::value), \" but saw dtype: \", DataTypeString(sparse_matrix.dtype()))); const Tensor& dense_shape = sparse_matrix.dense_shape(); const int rank = dense_shape.dim_size(0); OP_REQUIRES(ctx, rank == 2 || rank == 3, errors::InvalidArgument(\"sparse matrix must have rank 2 or 3; \", \"but dense_shape has size \", rank)); const int row_dim = (rank == 2) ? 0 : 1; auto dense_shape_vec = dense_shape.vec(); *num_rows = dense_shape_vec(row_dim); const int64 num_cols = dense_shape_vec(row_dim + 1); OP_REQUIRES(ctx, *num_rows == num_cols, errors::InvalidArgument(\"sparse matrix must be square; got: \", *num_rows, \" != \", num_cols)); const TensorShape& perm_shape = permutation_indices.shape(); OP_REQUIRES( ctx, perm_shape.dims() + 1 == rank, errors::InvalidArgument( \"sparse matrix must have the same rank as permutation; got: \", rank, \" != \", perm_shape.dims(), \" + 1.\")); OP_REQUIRES( ctx, perm_shape.dim_size(rank - 2) == *num_rows, errors::InvalidArgument( \"permutation must have the same number of elements in each batch \" \"as the number of rows in sparse matrix; got: \", perm_shape.dim_size(rank - 2), \" != \", *num_rows)); *batch_size = sparse_matrix.batch_size(); if (*batch_size > 1) { OP_REQUIRES( ctx, perm_shape.dim_size(0) == *batch_size, errors::InvalidArgument(\"permutation must have the same batch size \" \"as sparse matrix; got: \", perm_shape.dim_size(0), \" != \", *batch_size)); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a null pointer dereference by providing an invalid `permutation` to `tf.raw_ops.SparseMatrixSparseCholesky`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/kernels/sparse/sparse_cholesky_op.cc#L85-L86) fails to properly validate the input arguments. Although `ValidateInputs` is called and there are checks in the body of this function, the code proceeds to the next line in `ValidateInputs` since `OP_REQUIRES`(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/framework/op_requires.h#L41-L48) is a macro that only exits the current function. Thus, the first validation condition that fails in `ValidateInputs` will cause an early return from that function. However, the caller will continue execution from the next line. The fix is to either explicitly check `context->status()` or to convert `ValidateInputs` to return a `Status`. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-29530"}} -{"idx": 255180, "input": "void CSoundFile::SendMIDINote(CHANNELINDEX chn, uint16 note, uint16 volume) { #ifndef NO_PLUGINS auto &channel = m_PlayState.Chn[chn]; const ModInstrument *pIns = channel.pModInstrument; // instro sends to a midi chan if (pIns && pIns->HasValidMIDIChannel()) { PLUGINDEX nPlug = pIns->nMixPlug; if ((nPlug) && (nPlug <= MAX_MIXPLUGINS)) { IMixPlugin *pPlug = m_MixPlugins[nPlug-1].pMixPlugin; if (pPlug != nullptr) { pPlug->MidiCommand(GetBestMidiChannel(chn), pIns->nMidiProgram, pIns->wMidiBank, note, volume, chn); if(note < NOTE_MIN_SPECIAL) channel.nLeftVU = channel.nRightVU = 0xFF; } } } #endif // NO_PLUGINS }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 308297, "input": "XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { if (parser != NULL) commentHandler = handler; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280826, "input": "check_STRIP_VLAN(const struct ofpact_null *a OVS_UNUSED, struct ofpact_check_params *cp) { if (!(cp->match->flow.vlans[0].tci & htons(VLAN_CFI))) { inconsistent_match(&cp->usable_protocols); } flow_pop_vlan(&cp->match->flow, NULL); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357023, "input": "int imap_expand_path(struct Buffer *buf) { mutt_buffer_alloc(buf, PATH_MAX); return imap_path_canon(buf->data, PATH_MAX); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 374674, "input": "static void power_pmu_bhrb_disable(struct perf_event *event) { struct cpu_hw_events *cpuhw = this_cpu_ptr(&cpu_hw_events); if (!ppmu->bhrb_nr) return; WARN_ON_ONCE(!cpuhw->bhrb_users); cpuhw->bhrb_users--; perf_sched_cb_dec(event->ctx->pmu); if (!cpuhw->disabled && !cpuhw->bhrb_users) { /* BHRB cannot be turned off when other * events are active on the PMU. */ /* avoid stale pointer */ cpuhw->bhrb_context = NULL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431398, "input": "static inline u32 *nfs4_bitmask(struct nfs_server *server, struct nfs4_label *label) { if (label) return server->attr_bitmask; return server->attr_bitmask_nl; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519582, "input": "int PasswdMgr::readPasswdFileData(std::vector& outBytes) { std::array keyBuff; std::ifstream keyFile(encryptKeyFileName, std::ios::in | std::ios::binary); if (!keyFile.is_open()) { log(\"Error in opening encryption key file\"); return -EIO; } keyFile.read(reinterpret_cast(keyBuff.data()), keyBuff.size()); if (keyFile.fail()) { log(\"Error in reading encryption key file\"); return -EIO; } std::ifstream passwdFile(passwdFileName, std::ios::in | std::ios::binary); if (!passwdFile.is_open()) { log(\"Error in opening ipmi password file\"); return -EIO; } // calculate file size and read the data passwdFile.seekg(0, std::ios::end); ssize_t fileSize = passwdFile.tellg(); passwdFile.seekg(0, std::ios::beg); std::vector input(fileSize); passwdFile.read(reinterpret_cast(input.data()), fileSize); if (passwdFile.fail()) { log(\"Error in reading encryption key file\"); return -EIO; } // verify the signature first MetaPassStruct* metaData = reinterpret_cast(input.data()); if (std::strncmp(metaData->signature, META_PASSWD_SIG, sizeof(metaData->signature))) { log(\"Error signature mismatch in password file\"); return -EBADMSG; } size_t inBytesLen = metaData->dataSize + metaData->padSize; // If data is empty i.e no password map then return success if (inBytesLen == 0) { log(\"Empty password file\"); return 0; } // compute the key needed to decrypt std::array key; auto keyLen = key.size(); if (NULL == HMAC(EVP_sha256(), keyBuff.data(), keyBuff.size(), input.data() + sizeof(*metaData), metaData->hashSize, key.data(), reinterpret_cast(&keyLen))) { log(\"Failed to create MAC for authentication\"); return -EIO; } // decrypt the data uint8_t* iv = input.data() + sizeof(*metaData) + metaData->hashSize; size_t ivLen = metaData->ivSize; uint8_t* inBytes = iv + ivLen; uint8_t* mac = inBytes + inBytesLen; size_t macLen = metaData->macSize; size_t outBytesLen = 0; // Resize to actual data size outBytes.resize(inBytesLen + EVP_MAX_BLOCK_LENGTH); if (encryptDecryptData(false, EVP_aes_128_cbc(), key.data(), keyLen, iv, ivLen, inBytes, inBytesLen, mac, &macLen, outBytes.data(), &outBytesLen) != 0) { log(\"Error in decryption\"); return -EIO; } // Resize the vector to outBytesLen outBytes.resize(outBytesLen); OPENSSL_cleanse(key.data(), keyLen); OPENSSL_cleanse(iv, ivLen); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 89081, "input": "void WebGraphicsContext3DDefaultImpl::synthesizeGLError(unsigned long error) { m_syntheticErrors.add(error); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 101644, "input": "void VideoRendererBase::Initialize(const scoped_refptr& decoder, const PipelineStatusCB& status_cb, const StatisticsCB& statistics_cb, const TimeCB& time_cb) { base::AutoLock auto_lock(lock_); DCHECK(decoder); DCHECK(!status_cb.is_null()); DCHECK(!statistics_cb.is_null()); DCHECK(!time_cb.is_null()); DCHECK_EQ(kUninitialized, state_); decoder_ = decoder; statistics_cb_ = statistics_cb; time_cb_ = time_cb; host()->SetNaturalVideoSize(decoder_->natural_size()); state_ = kFlushed; set_opaque_cb_.Run(!decoder->HasAlpha()); set_opaque_cb_.Reset(); if (!base::PlatformThread::Create(0, this, &thread_)) { NOTREACHED() << \"Video thread creation failed\"; state_ = kError; status_cb.Run(PIPELINE_ERROR_INITIALIZATION_FAILED); return; } #if defined(OS_WIN) ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); #endif // defined(OS_WIN) status_cb.Run(PIPELINE_OK); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212376, "input": "Pl_Count::write(unsigned char* buf, size_t len) { if (len) { this->m->count += QIntC::to_offset(len); getNext()->write(buf, len); this->m->last_char = buf[len - 1]; } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "QPDF 9.x through 9.1.1 and 10.x through 10.0.4 has a heap-based buffer overflow in Pl_ASCII85Decoder::write (called from Pl_AES_PDF::flush and Pl_AES_PDF::finish) when a certain downstream write fails.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-36978"}} -{"idx": 264860, "input": "GF_Err mdia_box_read(GF_Box *s, GF_BitStream *bs) { GF_Err e; u64 cookie = gf_bs_get_cookie(bs); cookie &= ~GF_ISOM_BS_COOKIE_VISUAL_TRACK; gf_bs_set_cookie(bs, cookie); e = gf_isom_box_array_read(s, bs, mdia_on_child_box); gf_bs_set_cookie(bs, cookie); if (e) return e; if (!((GF_MediaBox *)s)->information) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Missing MediaInformationBox\\n\")); return GF_ISOM_INVALID_FILE; } if (!((GF_MediaBox *)s)->handler) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Missing HandlerBox\\n\")); return GF_ISOM_INVALID_FILE; } if (!((GF_MediaBox *)s)->mediaHeader) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[iso file] Missing MediaHeaderBox\\n\")); return GF_ISOM_INVALID_FILE; } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280216, "input": "static void free_slab(struct kmem_cache *s, struct page *page) { if (unlikely(s->flags & SLAB_TYPESAFE_BY_RCU)) { call_rcu(&page->rcu_head, rcu_free_slab); } else __free_slab(s, page); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373749, "input": "static rsRetVal qConstructDisk(qqueue_t *pThis) { DEFiRet; int bRestarted = 0; ASSERT(pThis != NULL); /* and now check if there is some persistent information that needs to be read in */ iRet = qqueueTryLoadPersistedInfo(pThis); if(iRet == RS_RET_OK) bRestarted = 1; else if(iRet != RS_RET_FILE_NOT_FOUND) FINALIZE; if(bRestarted == 1) { ; } else { CHKiRet(strm.Construct(&pThis->tVars.disk.pWrite)); CHKiRet(strm.SetbSync(pThis->tVars.disk.pWrite, pThis->bSyncQueueFiles)); CHKiRet(strm.SetDir(pThis->tVars.disk.pWrite, glbl.GetWorkDir(), strlen((char*)glbl.GetWorkDir()))); CHKiRet(strm.SetiMaxFiles(pThis->tVars.disk.pWrite, 10000000)); CHKiRet(strm.SettOperationsMode(pThis->tVars.disk.pWrite, STREAMMODE_WRITE)); CHKiRet(strm.SetsType(pThis->tVars.disk.pWrite, STREAMTYPE_FILE_CIRCULAR)); CHKiRet(strm.ConstructFinalize(pThis->tVars.disk.pWrite)); CHKiRet(strm.Construct(&pThis->tVars.disk.pReadDeq)); CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pReadDeq, 0)); CHKiRet(strm.SetDir(pThis->tVars.disk.pReadDeq, glbl.GetWorkDir(), strlen((char*)glbl.GetWorkDir()))); CHKiRet(strm.SetiMaxFiles(pThis->tVars.disk.pReadDeq, 10000000)); CHKiRet(strm.SettOperationsMode(pThis->tVars.disk.pReadDeq, STREAMMODE_READ)); CHKiRet(strm.SetsType(pThis->tVars.disk.pReadDeq, STREAMTYPE_FILE_CIRCULAR)); CHKiRet(strm.ConstructFinalize(pThis->tVars.disk.pReadDeq)); CHKiRet(strm.Construct(&pThis->tVars.disk.pReadDel)); CHKiRet(strm.SetbSync(pThis->tVars.disk.pReadDel, pThis->bSyncQueueFiles)); CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pReadDel, 1)); CHKiRet(strm.SetDir(pThis->tVars.disk.pReadDel, glbl.GetWorkDir(), strlen((char*)glbl.GetWorkDir()))); CHKiRet(strm.SetiMaxFiles(pThis->tVars.disk.pReadDel, 10000000)); CHKiRet(strm.SettOperationsMode(pThis->tVars.disk.pReadDel, STREAMMODE_READ)); CHKiRet(strm.SetsType(pThis->tVars.disk.pReadDel, STREAMTYPE_FILE_CIRCULAR)); CHKiRet(strm.ConstructFinalize(pThis->tVars.disk.pReadDel)); CHKiRet(strm.SetFName(pThis->tVars.disk.pWrite, pThis->pszFilePrefix, pThis->lenFilePrefix)); CHKiRet(strm.SetFName(pThis->tVars.disk.pReadDeq, pThis->pszFilePrefix, pThis->lenFilePrefix)); CHKiRet(strm.SetFName(pThis->tVars.disk.pReadDel, pThis->pszFilePrefix, pThis->lenFilePrefix)); } /* now we set (and overwrite in case of a persisted restart) some parameters which * should always reflect the current configuration variables. Be careful by doing so, * for example file name generation must not be changed as that would break the * ability to read existing queue files. -- rgerhards, 2008-01-12 */ CHKiRet(strm.SetiMaxFileSize(pThis->tVars.disk.pWrite, pThis->iMaxFileSize)); CHKiRet(strm.SetiMaxFileSize(pThis->tVars.disk.pReadDeq, pThis->iMaxFileSize)); CHKiRet(strm.SetiMaxFileSize(pThis->tVars.disk.pReadDel, pThis->iMaxFileSize)); finalize_it: RETiRet; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197361, "input": "} void print_udta(GF_ISOFile *file, u32 track_number, Bool has_itags) { u32 i, count; count = gf_isom_get_udta_count(file, track_number); if (!count) return; if (has_itags) { for (i=0; i 0 && phdr < H2_PHDR_NUM_ENTRIES) { /* insert a pseudo header by its index (in phdr) and value (in value) */ if (fields & ((1 << phdr) | H2_PHDR_FND_NONE)) { if (fields & H2_PHDR_FND_NONE) { /* pseudo header field after regular headers */ goto fail; } else { /* repeated pseudo header field */ goto fail; } } fields |= 1 << phdr; phdr_val[phdr] = list[idx].v; continue; } else if (phdr != 0) { /* invalid pseudo header -- should never happen here */ goto fail; } /* regular header field in (name,value) */ if (unlikely(!(fields & H2_PHDR_FND_NONE))) { /* no more pseudo-headers, time to build the request line */ sl = h2_prepare_htx_reqline(fields, phdr_val, htx, msgf); if (!sl) goto fail; fields |= H2_PHDR_FND_NONE; /* http2bis draft recommends to drop Host in favor of :authority when * the latter is present. This is required to make sure there is no * discrepancy between the authority and the host header, especially * since routing rules usually involve Host. Here we already know if * :authority was found so we can emit it right now and mark the host * as filled so that it's skipped later. */ if (fields & H2_PHDR_FND_AUTH) { if (!htx_add_header(htx, ist(\"host\"), phdr_val[H2_PHDR_IDX_AUTH])) goto fail; fields |= H2_PHDR_FND_HOST; } } if (isteq(list[idx].n, ist(\"host\"))) { if (fields & H2_PHDR_FND_HOST) continue; fields |= H2_PHDR_FND_HOST; } if (isteq(list[idx].n, ist(\"content-length\"))) { ret = h2_parse_cont_len_header(msgf, &list[idx].v, body_len); if (ret < 0) goto fail; sl_flags |= HTX_SL_F_CLEN; if (ret == 0) continue; // skip this duplicate } /* these ones are forbidden in requests (RFC7540#8.1.2.2) */ if (isteq(list[idx].n, ist(\"connection\")) || isteq(list[idx].n, ist(\"proxy-connection\")) || isteq(list[idx].n, ist(\"keep-alive\")) || isteq(list[idx].n, ist(\"upgrade\")) || isteq(list[idx].n, ist(\"transfer-encoding\"))) goto fail; if (isteq(list[idx].n, ist(\"te\")) && !isteq(list[idx].v, ist(\"trailers\"))) goto fail; /* cookie requires special processing at the end */ if (isteq(list[idx].n, ist(\"cookie\"))) { list[idx].n.len = -1; if (ck < 0) ck = idx; else list[lck].n.len = idx; lck = idx; continue; } if (!htx_add_header(htx, list[idx].n, list[idx].v)) goto fail; } /* RFC7540#8.1.2.1 mandates to reject response pseudo-headers (:status) */ if (fields & H2_PHDR_FND_STAT) goto fail; /* Let's dump the request now if not yet emitted. */ if (!(fields & H2_PHDR_FND_NONE)) { sl = h2_prepare_htx_reqline(fields, phdr_val, htx, msgf); if (!sl) goto fail; } if (*msgf & H2_MSGF_BODY_TUNNEL) *msgf &= ~(H2_MSGF_BODY|H2_MSGF_BODY_CL); if (!(*msgf & H2_MSGF_BODY) || ((*msgf & H2_MSGF_BODY_CL) && *body_len == 0) || (*msgf & H2_MSGF_BODY_TUNNEL)) { /* Request without body or tunnel requested */ sl_flags |= HTX_SL_F_BODYLESS; htx->flags |= HTX_FL_EOM; } if (*msgf & H2_MSGF_EXT_CONNECT) { if (!htx_add_header(htx, ist(\"upgrade\"), phdr_val[H2_PHDR_IDX_PROT])) goto fail; if (!htx_add_header(htx, ist(\"connection\"), ist(\"upgrade\"))) goto fail; sl_flags |= HTX_SL_F_CONN_UPG; } /* update the start line with last detected header info */ sl->flags |= sl_flags; /* complete with missing Host if needed (we may validate this test if * no regular header was found). */ if ((fields & (H2_PHDR_FND_HOST|H2_PHDR_FND_AUTH)) == H2_PHDR_FND_AUTH) { /* missing Host field, use :authority instead */ if (!htx_add_header(htx, ist(\"host\"), phdr_val[H2_PHDR_IDX_AUTH])) goto fail; } /* now we may have to build a cookie list. We'll dump the values of all * visited headers. */ if (ck >= 0) { uint32_t fs; // free space uint32_t bs; // block size uint32_t vl; // value len uint32_t tl; // total length struct htx_blk *blk; blk = htx_add_header(htx, ist(\"cookie\"), list[ck].v); if (!blk) goto fail; tl = list[ck].v.len; fs = htx_free_data_space(htx); bs = htx_get_blksz(blk); /* for each extra cookie, we'll extend the cookie's value and * insert \"; \" before the new value. */ fs += tl; // first one is already counted while ((ck = list[ck].n.len) >= 0) { vl = list[ck].v.len; tl += vl + 2; if (tl > fs) goto fail; htx_change_blk_value_len(htx, blk, tl); *(char *)(htx_get_blk_ptr(htx, blk) + bs + 0) = ';'; *(char *)(htx_get_blk_ptr(htx, blk) + bs + 1) = ' '; memcpy(htx_get_blk_ptr(htx, blk) + bs + 2, list[ck].v.ptr, vl); bs += vl + 2; } } /* now send the end of headers marker */ if (!htx_add_endof(htx, HTX_BLK_EOH)) goto fail; /* proceed to scheme-based normalization on target-URI */ if (fields & H2_PHDR_FND_SCHM) http_scheme_based_normalize(htx); ret = 1; return ret; fail: return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508687, "input": "Item_func_trig_cond::add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, SARGABLE_PARAM **sargables) { /* Subquery optimization: Conditions that are pushed down into subqueries are wrapped into Item_func_trig_cond. We process the wrapped condition but need to set cond_guard for KEYUSE elements generated from it. */ if (!join->group_list && !join->order && join->unit->item && join->unit->item->substype() == Item_subselect::IN_SUBS && !join->unit->is_unit_op()) { KEY_FIELD *save= *key_fields; args[0]->add_key_fields(join, key_fields, and_level, usable_tables, sargables); // Indicate that this ref access candidate is for subquery lookup: for (; save != *key_fields; save++) save->cond_guard= get_trig_var(); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346343, "input": "get_n_bytes_readable_on_socket(evutil_socket_t fd) { #if defined(FIONREAD) && defined(WIN32) unsigned long lng = EVBUFFER_MAX_READ; if (ioctlsocket(fd, FIONREAD, &lng) < 0) return -1; /* Can overflow, but mostly harmlessly. XXXX */ return (int)lng; #elif defined(FIONREAD) int n = EVBUFFER_MAX_READ; if (ioctl(fd, FIONREAD, &n) < 0) return -1; return n; #else return EVBUFFER_MAX_READ; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219650, "input": "char * php_conv_fp(register char format, register double num, bool add_dp, int precision, char dec_point, int *is_negative, char *buf, int *len) { register char *s = buf; register char *p, *p_orig; int decimal_point; if (precision >= NDIG - 1) { precision = NDIG - 2; } if (format == 'F') { p_orig = p = php_fcvt(num, precision, &decimal_point, is_negative); } else { // either e or E format p_orig = p = php_ecvt(num, precision + 1, &decimal_point, is_negative); } // Check for Infinity and NaN if (isalpha((int)*p)) { *len = strlen(p); memcpy(buf, p, *len + 1); *is_negative = 0; free(p_orig); return (buf); } if (format == 'F') { if (decimal_point <= 0) { if (num != 0 || precision > 0) { *s++ = '0'; if (precision > 0) { *s++ = dec_point; while (decimal_point++ < 0) { *s++ = '0'; } } else if (add_dp) { *s++ = dec_point; } } } else { int addz = decimal_point >= NDIG ? decimal_point - NDIG + 1 : 0; decimal_point -= addz; while (decimal_point-- > 0) { *s++ = *p++; } while (addz-- > 0) { *s++ = '0'; } if (precision > 0 || add_dp) { *s++ = dec_point; } } } else { *s++ = *p++; if (precision > 0 || add_dp) { *s++ = '.'; } } // copy the rest of p, the NUL is NOT copied while (*p) { *s++ = *p++; } if (format != 'F') { char temp[EXPONENT_LENGTH]; // for exponent conversion int t_len; int exponent_is_negative; *s++ = format; // either e or E decimal_point--; if (decimal_point != 0) { p = ap_php_conv_10((int64_t) decimal_point, false, &exponent_is_negative, &temp[EXPONENT_LENGTH], &t_len); *s++ = exponent_is_negative ? '-' : '+'; // Make sure the exponent has at least 2 digits while (t_len--) { *s++ = *p++; } } else { *s++ = '+'; *s++ = '0'; } } *len = s - buf; free(p_orig); return (buf); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381476, "input": "static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct v4l2_create_buffers *create = arg; int ret = check_fmt(file, create->format.type); if (ret) return ret; CLEAR_AFTER_FIELD(create, capabilities); v4l_sanitize_format(&create->format); ret = ops->vidioc_create_bufs(file, fh, create); if (create->format.type == V4L2_BUF_TYPE_VIDEO_CAPTURE || create->format.type == V4L2_BUF_TYPE_VIDEO_OUTPUT) create->format.fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394265, "input": "static int ctnetlink_parse_filter(const struct nlattr *attr, struct ctnetlink_filter *filter) { struct nlattr *tb[CTA_FILTER_MAX + 1]; int ret = 0; ret = nla_parse_nested(tb, CTA_FILTER_MAX, attr, cta_filter_nla_policy, NULL); if (ret) return ret; if (tb[CTA_FILTER_ORIG_FLAGS]) { filter->orig_flags = nla_get_u32(tb[CTA_FILTER_ORIG_FLAGS]); if (filter->orig_flags & ~CTA_FILTER_F_ALL) return -EOPNOTSUPP; } if (tb[CTA_FILTER_REPLY_FLAGS]) { filter->reply_flags = nla_get_u32(tb[CTA_FILTER_REPLY_FLAGS]); if (filter->reply_flags & ~CTA_FILTER_F_ALL) return -EOPNOTSUPP; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 343483, "input": "static int stimer_start(struct kvm_vcpu_hv_stimer *stimer) { u64 time_now; ktime_t ktime_now; time_now = get_time_ref_counter(hv_stimer_to_vcpu(stimer)->kvm); ktime_now = ktime_get(); if (stimer->config.periodic) { if (stimer->exp_time) { if (time_now >= stimer->exp_time) { u64 remainder; div64_u64_rem(time_now - stimer->exp_time, stimer->count, &remainder); stimer->exp_time = time_now + (stimer->count - remainder); } } else stimer->exp_time = time_now + stimer->count; trace_kvm_hv_stimer_start_periodic( hv_stimer_to_vcpu(stimer)->vcpu_id, stimer->index, time_now, stimer->exp_time); hrtimer_start(&stimer->timer, ktime_add_ns(ktime_now, 100 * (stimer->exp_time - time_now)), HRTIMER_MODE_ABS); return 0; } stimer->exp_time = stimer->count; if (time_now >= stimer->count) { /* * Expire timer according to Hypervisor Top-Level Functional * specification v4(15.3.1): * \"If a one shot is enabled and the specified count is in * the past, it will expire immediately.\" */ stimer_mark_pending(stimer, false); return 0; } trace_kvm_hv_stimer_start_one_shot(hv_stimer_to_vcpu(stimer)->vcpu_id, stimer->index, time_now, stimer->count); hrtimer_start(&stimer->timer, ktime_add_ns(ktime_now, 100 * (stimer->count - time_now)), HRTIMER_MODE_ABS); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255322, "input": "static void pb_field_init(pb_field_iterator_t *iter, const pb_field_t *fields, void *dest_struct) { iter->start = iter->pos = fields; iter->field_index = 0; iter->required_field_index = 0; iter->pData = (char*)dest_struct + iter->pos->data_offset; iter->pSize = (char*)iter->pData + iter->pos->size_offset; iter->dest_struct = dest_struct; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364200, "input": "static inline struct deferred_split *get_deferred_split_queue(struct page *page) { struct mem_cgroup *memcg = compound_head(page)->mem_cgroup; struct pglist_data *pgdat = NODE_DATA(page_to_nid(page)); if (memcg) return &memcg->deferred_split_queue; else return &pgdat->deferred_split_queue; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499990, "input": "int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) { /* TBD */ return -EINVAL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 285580, "input": "regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf, size_t errbuf_size) #endif { const char *msg; size_t msg_size; if (BE (errcode < 0 || errcode >= (int) (sizeof (__re_error_msgid_idx) / sizeof (__re_error_msgid_idx[0])), 0)) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. Dump core so we can fix it. */ abort (); msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); msg_size = strlen (msg) + 1; /* Includes the null. */ if (BE (errbuf_size != 0, 1)) { size_t cpy_size = msg_size; if (BE (msg_size > errbuf_size, 0)) { cpy_size = errbuf_size - 1; errbuf[cpy_size] = '\\0'; } memcpy (errbuf, msg, cpy_size); } return msg_size; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342037, "input": "static void fuse_umount_begin(struct super_block *sb) { struct fuse_conn *fc = get_fuse_conn_super(sb); if (!fc->no_force_umount) fuse_abort_conn(fc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237570, "input": "static GF_ISOSAPType sap_type_from_nal_type(u8 nal_type) { switch (nal_type) { case GF_HEVC_NALU_SLICE_CRA: return SAP_TYPE_3; case GF_HEVC_NALU_SLICE_IDR_N_LP: case GF_HEVC_NALU_SLICE_BLA_N_LP: return SAP_TYPE_1; case GF_HEVC_NALU_SLICE_IDR_W_DLP: case GF_HEVC_NALU_SLICE_BLA_W_DLP: case GF_HEVC_NALU_SLICE_BLA_W_LP: return SAP_TYPE_2; default: return RAP_NO; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373790, "input": "qqueueAdviseMaxWorkers(qqueue_t *pThis) { DEFiRet; int iMaxWorkers; ISOBJ_TYPE_assert(pThis, qqueue); if(!pThis->bEnqOnly) { if(pThis->bIsDA && getLogicalQueueSize(pThis) >= pThis->iHighWtrMrk) { wtpAdviseMaxWorkers(pThis->pWtpDA, 1); /* disk queues have always one worker */ } else { if(getLogicalQueueSize(pThis) == 0) { iMaxWorkers = 0; } else if(pThis->qType == QUEUETYPE_DISK || pThis->iMinMsgsPerWrkr == 0) { iMaxWorkers = 1; } else { iMaxWorkers = getLogicalQueueSize(pThis) / pThis->iMinMsgsPerWrkr + 1; } wtpAdviseMaxWorkers(pThis->pWtpReg, iMaxWorkers); } } RETiRet; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 301520, "input": "void zend_shared_alloc_restore_state(void) { int i; for (i = 0; i < ZSMMG(shared_segments_count); i++) { ZSMMG(shared_segments)[i]->pos = ZSMMG(shared_memory_state).positions[i]; } ZSMMG(shared_free) = ZSMMG(shared_memory_state).shared_free; ZSMMG(memory_exhausted) = 0; ZSMMG(wasted_shared_memory) = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238740, "input": "ecma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */ { uint32_t index = ((ecma_extended_object_t *) iter_obj_p)->u.pseudo_array.u1.iterator_index; if (JERRY_UNLIKELY (index == ECMA_ITERATOR_INDEX_LIMIT)) { ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX); ecma_property_t *property_p = ecma_find_named_property (iter_obj_p, prop_name_p); ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p); return (uint32_t) (ecma_get_number_from_value (value_p->value)); } return index; } /* ecma_op_iterator_get_index */", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432868, "input": "static BOOL update_process_glyph_fragments(rdpContext* context, const BYTE* data, UINT32 length, UINT32 cacheId, UINT32 ulCharInc, UINT32 flAccel, UINT32 bgcolor, UINT32 fgcolor, INT32 x, INT32 y, INT32 bkX, INT32 bkY, INT32 bkWidth, INT32 bkHeight, INT32 opX, INT32 opY, INT32 opWidth, INT32 opHeight, BOOL fOpRedundant) { UINT32 n; UINT32 id; UINT32 size; UINT32 index = 0; BYTE* fragments; rdpGraphics* graphics; rdpGlyphCache* glyph_cache; rdpGlyph* glyph; RDP_RECT bound; if (!context || !data || !context->graphics || !context->cache || !context->cache->glyph) return FALSE; graphics = context->graphics; glyph_cache = context->cache->glyph; glyph = graphics->Glyph_Prototype; if (!glyph) return FALSE; /* Limit op rectangle to visible screen. */ if (opX < 0) { opWidth += opX; opX = 0; } if (opY < 0) { opHeight += opY; opY = 0; } if (opWidth < 0) opWidth = 0; if (opHeight < 0) opHeight = 0; /* Limit bk rectangle to visible screen. */ if (bkX < 0) { bkWidth += bkX; bkX = 0; } if (bkY < 0) { bkHeight += bkY; bkY = 0; } if (bkWidth < 0) bkWidth = 0; if (bkHeight < 0) bkHeight = 0; if (opX + opWidth > (INT64)context->settings->DesktopWidth) { /** * Some Microsoft servers send erroneous high values close to the * sint16 maximum in the OpRight field of the GlyphIndex, FastIndex and * FastGlyph drawing orders, probably a result of applications trying to * clear the text line to the very right end. * One example where this can be seen is typing in notepad.exe within * a RDP session to Windows XP Professional SP3. * This workaround prevents resulting problems in the UI callbacks. */ opWidth = context->settings->DesktopWidth - opX; } if (bkX + bkWidth > (INT64)context->settings->DesktopWidth) { /** * Some Microsoft servers send erroneous high values close to the * sint16 maximum in the OpRight field of the GlyphIndex, FastIndex and * FastGlyph drawing orders, probably a result of applications trying to * clear the text line to the very right end. * One example where this can be seen is typing in notepad.exe within * a RDP session to Windows XP Professional SP3. * This workaround prevents resulting problems in the UI callbacks. */ bkWidth = context->settings->DesktopWidth - bkX; } bound.x = bkX; bound.y = bkY; bound.width = bkWidth; bound.height = bkHeight; if (!glyph->BeginDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor, fOpRedundant)) return FALSE; if (!IFCALLRESULT(TRUE, glyph->SetBounds, context, bkX, bkY, bkWidth, bkHeight)) return FALSE; while (index < length) { const UINT32 op = data[index++]; switch (op) { case GLYPH_FRAGMENT_USE: if (index + 1 >= length) return FALSE; id = data[index++]; fragments = (BYTE*)glyph_cache_fragment_get(glyph_cache, id, &size); if (fragments == NULL) return FALSE; for (n = 0; n < size;) { const UINT32 fop = fragments[n++]; n = update_glyph_offset(fragments, size, n, &x, &y, ulCharInc, flAccel); if (!update_process_glyph(context, fragments, fop, &x, &y, cacheId, flAccel, fOpRedundant, &bound)) return FALSE; } break; case GLYPH_FRAGMENT_ADD: if (index + 2 > length) return FALSE; id = data[index++]; size = data[index++]; glyph_cache_fragment_put(glyph_cache, id, size, data); break; default: index = update_glyph_offset(data, length, index, &x, &y, ulCharInc, flAccel); if (!update_process_glyph(context, data, op, &x, &y, cacheId, flAccel, fOpRedundant, &bound)) return FALSE; break; } } return glyph->EndDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 285559, "input": "regcomp (preg, pattern, cflags) regex_t *_Restrict_ preg; const char *_Restrict_ pattern; int cflags; { reg_errcode_t ret; reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC); preg->buffer = NULL; preg->allocated = 0; preg->used = 0; /* Try to allocate space for the fastmap. */ preg->fastmap = re_malloc (char, SBC_MAX); if (BE (preg->fastmap == NULL, 0)) return REG_ESPACE; syntax |= (cflags & REG_ICASE) ? RE_ICASE : 0; /* If REG_NEWLINE is set, newlines are treated differently. */ if (cflags & REG_NEWLINE) { /* REG_NEWLINE implies neither . nor [^...] match newline. */ syntax &= ~RE_DOT_NEWLINE; syntax |= RE_HAT_LISTS_NOT_NEWLINE; /* It also changes the matching behavior. */ preg->newline_anchor = 1; } else preg->newline_anchor = 0; preg->no_sub = !!(cflags & REG_NOSUB); preg->translate = NULL; ret = re_compile_internal (preg, pattern, strlen (pattern), syntax); /* POSIX doesn't distinguish between an unmatched open-group and an unmatched close-group: both are REG_EPAREN. */ if (ret == REG_ERPAREN) ret = REG_EPAREN; /* We have already checked preg->fastmap != NULL. */ if (BE (ret == REG_NOERROR, 1)) /* Compute the fastmap now, since regexec cannot modify the pattern buffer. This function never fails in this implementation. */ (void) re_compile_fastmap (preg); else { /* Some error occurred while compiling the expression. */ re_free (preg->fastmap); preg->fastmap = NULL; } return (int) ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497635, "input": "SHACTX sha1_init(void) { SHACTX c = malloc(sizeof(*c)); if (c == NULL) { return NULL; } SHA1_Init(c); return c; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269731, "input": "void WebContents::StartDrag(const gin_helper::Dictionary& item, gin_helper::Arguments* args) { base::FilePath file; std::vector files; if (!item.Get(\"files\", &files) && item.Get(\"file\", &file)) { files.push_back(file); } gin::Handle icon; if (!item.Get(\"icon\", &icon) || icon->image().IsEmpty()) { args->ThrowError(\"Must specify non-empty 'icon' option\"); return; } // Start dragging. if (!files.empty()) { base::MessageLoopCurrent::ScopedNestableTaskAllower allow; DragFileItems(files, icon->image(), web_contents()->GetNativeView()); } else { args->ThrowError(\"Must specify either 'file' or 'files' option\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431375, "input": "static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) { __be32 *p; uint32_t delegation_type; p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) return -EIO; delegation_type = be32_to_cpup(p); res->delegation_type = 0; switch (delegation_type) { case NFS4_OPEN_DELEGATE_NONE: return 0; case NFS4_OPEN_DELEGATE_READ: case NFS4_OPEN_DELEGATE_WRITE: return decode_rw_delegation(xdr, delegation_type, res); case NFS4_OPEN_DELEGATE_NONE_EXT: return decode_no_delegation(xdr, res); } return -EIO; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402211, "input": "static int bcf_set_variant_types(bcf1_t *b) { if ( !(b->unpacked & BCF_UN_STR) ) bcf_unpack(b, BCF_UN_STR); bcf_dec_t *d = &b->d; if ( d->n_var < b->n_allele ) { d->var = (variant_t *) realloc(d->var, sizeof(variant_t)*b->n_allele); d->n_var = b->n_allele; } int i; b->d.var_type = 0; d->var[0].type = VCF_REF; d->var[0].n = 0; for (i=1; in_allele; i++) { bcf_set_variant_type(d->allele[0],d->allele[i], &d->var[i]); b->d.var_type |= d->var[i].type; //fprintf(stderr,\"[set_variant_type] %d %s %s -> %d %d .. %d\\n\", b->pos+1,d->allele[0],d->allele[i],d->var[i].type,d->var[i].n, b->d.var_type); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416657, "input": "static void php_mysqlnd_rset_header_free_mem(void * _packet, zend_bool stack_allocation TSRMLS_DC) { MYSQLND_PACKET_RSET_HEADER *p= (MYSQLND_PACKET_RSET_HEADER *) _packet; DBG_ENTER(\"php_mysqlnd_rset_header_free_mem\"); if (p->info_or_local_file) { mnd_efree(p->info_or_local_file); p->info_or_local_file = NULL; } if (!stack_allocation) { mnd_pefree(p, p->header.persistent); } DBG_VOID_RETURN;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399924, "input": "free_zmbuf(struct vhost_virtqueue *vq) { struct zcopy_mbuf *next = NULL; struct zcopy_mbuf *zmbuf; for (zmbuf = TAILQ_FIRST(&vq->zmbuf_list); zmbuf != NULL; zmbuf = next) { next = TAILQ_NEXT(zmbuf, next); uint16_t last_used_idx = vq->last_used_idx; if (mbuf_is_consumed(zmbuf->mbuf)) { uint16_t flags; flags = vq->desc_packed[last_used_idx].flags; if (vq->used_wrap_counter) { flags |= VRING_DESC_F_USED; flags |= VRING_DESC_F_AVAIL; } else { flags &= ~VRING_DESC_F_USED; flags &= ~VRING_DESC_F_AVAIL; } vq->desc_packed[last_used_idx].id = zmbuf->desc_idx; vq->desc_packed[last_used_idx].len = 0; rte_smp_wmb(); vq->desc_packed[last_used_idx].flags = flags; vq_inc_last_used_packed(vq, zmbuf->desc_count); TAILQ_REMOVE(&vq->zmbuf_list, zmbuf, next); restore_mbuf(zmbuf->mbuf); rte_pktmbuf_free(zmbuf->mbuf); put_zmbuf(zmbuf); vq->nr_zmbuf -= 1; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393288, "input": "TEST_F(QueryPlannerTest, BasicCovering) { addIndex(BSON(\"x\" << 1)); // query, sort, proj runQuerySortProj(fromjson(\"{ x : {$gt: 1}}\"), BSONObj(), fromjson(\"{_id: 0, x: 1}\")); ASSERT_EQUALS(getNumSolutions(), 2U); assertSolutionExists( \"{proj: {spec: {_id: 0, x: 1}, node: {ixscan: \" \"{filter: null, pattern: {x: 1}}}}}\"); assertSolutionExists( \"{proj: {spec: {_id: 0, x: 1}, node: \" \"{cscan: {dir: 1, filter: {x:{$gt:1}}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417816, "input": "void SFD_AssignLookups(SplineFont1 *sf) { PST1 *pst, *pst2; int isv; KernPair1 *kp, *kp2; KernClass1 *kc, *kc2; FPST1 *fpst; ASM1 *sm; AnchorClass1 *ac, *ac2; int gid, gid2, cnt, i, k, isgpos; SplineFont1 *subsf; SplineChar *sc, *sc2; OTLookup *otl, **all; struct lookup_subtable *sub; /* Fix up some gunk from really old versions of the sfd format */ SFDCleanupAnchorClasses(&sf->sf); if ( sf->sf.uni_interp==ui_unset && sf->sf.map!=NULL ) sf->sf.uni_interp = interp_from_encoding(sf->sf.map->enc,ui_none); /* Fixup for an old bug */ if ( sf->sf.pfminfo.os2_winascent < sf->sf.ascent/4 && !sf->sf.pfminfo.winascent_add ) { sf->sf.pfminfo.winascent_add = true; sf->sf.pfminfo.os2_winascent = 0; sf->sf.pfminfo.windescent_add = true; sf->sf.pfminfo.os2_windescent = 0; } /* First handle the PSTs, no complications here */ k=0; do { subsf = sf->sf.subfontcnt==0 ? sf : (SplineFont1 *) (sf->sf.subfonts[k]); for ( gid=0; gidsf.glyphcnt; ++gid ) if ( (sc=subsf->sf.glyphs[gid])!=NULL ) { for ( pst = (PST1 *) (sc->possub); pst!=NULL; pst = (PST1*) (pst->pst.next) ) { if ( pst->pst.type == pst_lcaret || pst->pst.subtable!=NULL ) continue; /* Nothing to do, or already done */ otl = CreateLookup(sf,pst->tag,pst->script_lang_index,pst->flags,pst->pst.type); sub = CreateSubtable(otl,sf); /* There might be another PST with the same flags on this glyph */ /* And we must fixup the current pst */ for ( pst2=pst ; pst2!=NULL; pst2 = (PST1 *) (pst2->pst.next) ) { if ( pst2->tag==pst->tag && pst2->script_lang_index==pst->script_lang_index && pst2->flags==pst->flags && pst2->pst.type==pst->pst.type ) pst2->pst.subtable = sub; } for ( gid2=gid+1; gid2sf.glyphcnt; ++gid2 ) if ( (sc2=subsf->sf.glyphs[gid2])!=NULL ) { for ( pst2 = (PST1 *) (sc2->possub); pst2!=NULL; pst2 = (PST1 *) (pst2->pst.next) ) { if ( pst2->tag==pst->tag && pst2->script_lang_index==pst->script_lang_index && pst2->flags==pst->flags && pst2->pst.type==pst->pst.type ) pst2->pst.subtable = sub; } } } } ++k; } while ( ksf.subfontcnt ); /* Now kerns. May need to merge kernclasses to kernpair lookups (different subtables, of course */ for ( isv=0; isv<2; ++isv ) { k=0; do { subsf = sf->sf.subfontcnt==0 ? sf : (SplineFont1 *) (sf->sf.subfonts[k]); for ( gid=0; gidsf.glyphcnt; ++gid ) if ( (sc=subsf->sf.glyphs[gid])!=NULL ) { for ( kp = (KernPair1 *) (isv ? sc->vkerns : sc->kerns); kp!=NULL; kp = (KernPair1 *) (kp->kp.next) ) { if ( kp->kp.subtable!=NULL ) continue; /* already done */ otl = CreateLookup(sf,isv ? CHR('v','k','r','n') : CHR('k','e','r','n'), kp->sli,kp->flags,pst_pair); sub = CreateSubtable(otl,sf); /* There might be another kp with the same flags on this glyph */ /* And we must fixup the current kp */ for ( kp2=kp ; kp2!=NULL; kp2 = (KernPair1 *) (kp2->kp.next) ) { if ( kp2->sli==kp->sli && kp2->flags==kp->flags ) kp2->kp.subtable = sub; } for ( gid2=gid+1; gid2sf.glyphcnt; ++gid2 ) if ( (sc2=subsf->sf.glyphs[gid2])!=NULL ) { for ( kp2 = (KernPair1 *) (isv ? sc2->vkerns : sc2->kerns); kp2!=NULL; kp2 = (KernPair1 *) (kp2->kp.next) ) { if ( kp2->sli==kp->sli && kp2->flags==kp->flags ) kp2->kp.subtable = sub; } } /* And there might be a kerning class... */ for ( kc=(KernClass1 *) (isv ? sf->sf.vkerns : sf->sf.kerns); kc!=NULL; kc = (KernClass1 *) (kc->kc.next) ) { if ( kc->sli == kp->sli && kc->flags == kp->flags && kc->kc.subtable==NULL) { sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->kc = &kc->kc; kc->kc.subtable = sub; } } } } ++k; } while ( ksf.subfontcnt ); /* Or there might be a kerning class all by its lonesome */ for ( kc=(KernClass1 *) (isv ? sf->sf.vkerns : sf->sf.kerns); kc!=NULL; kc = (KernClass1 *) (kc->kc.next) ) { if ( kc->kc.subtable==NULL) { otl = CreateLookup(sf,isv ? CHR('v','k','r','n') : CHR('k','e','r','n'), kc->sli,kc->flags,pst_pair); for ( kc2=kc; kc2!=NULL; kc2=(KernClass1 *) (kc2->kc.next) ) { if ( kc->sli == kc2->sli && kc->flags == kc2->flags && kc2->kc.subtable==NULL) { sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->kc = &kc2->kc; kc2->kc.subtable = sub; } } } } } /* Every FPST and ASM lives in its own lookup with one subtable */ /* But the old format refered to nested lookups by tag, and now we refer */ /* to the lookup itself, so fix that up */ for ( fpst=(FPST1 *) sf->sf.possub; fpst!=NULL; fpst=((FPST1 *) fpst->fpst.next) ) { otl = CreateLookup(sf,fpst->tag, fpst->script_lang_index, fpst->flags,fpst->fpst.type); sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->fpst = &fpst->fpst; fpst->fpst.subtable = sub; FPSTReplaceTagsWithLookups(&fpst->fpst,sf); } for ( sm=(ASM1 *) sf->sf.sm; sm!=NULL; sm=((ASM1 *) sm->sm.next) ) { otl = CreateMacLookup(sf,sm); sub = CreateSubtable(otl,sf); sub->per_glyph_pst_or_kern = false; sub->sm = &sm->sm; sm->sm.subtable = sub; if ( sm->sm.type==asm_context ) ASMReplaceTagsWithLookups(&sm->sm,sf); } /* We retained the old nested feature tags so we could do the above conversion */ /* of tag to lookup. Get rid of them now */ for ( isgpos=0; isgpos<2; ++isgpos ) { for ( otl = isgpos ? sf->sf.gpos_lookups : sf->sf.gsub_lookups ; otl != NULL; otl=otl->next ) { if ( otl->features!=NULL && otl->features->scripts==NULL ) { chunkfree(otl->features,sizeof(FeatureScriptLangList)); otl->features = NULL; } } } /* Anchor classes are complicated, because I foolishly failed to distinguish */ /* between mark to base and mark to ligature classes. So one AC might have */ /* both. If so we need to turn it into two ACs, and have separate lookups */ /* for each */ for ( ac=(AnchorClass1 *) (sf->sf.anchor); ac!=NULL; ac=(AnchorClass1 *) ac->ac.next ) { ACHasBaseLig(sf,ac); if ( ac->has_ligatures && !ac->has_bases ) ac->ac.type = act_mklg; else if ( ac->has_ligatures && ac->has_bases ) ACDisassociateLigatures(sf,ac); } for ( ac=(AnchorClass1 *) (sf->sf.anchor); ac!=NULL; ac=(AnchorClass1 *) ac->ac.next ) { if ( ac->ac.subtable==NULL ) { otl = CreateACLookup(sf,ac); sub = CreateSubtable(otl,sf); for ( ac2=ac; ac2!=NULL; ac2 = (AnchorClass1 *) ac2->ac.next ) { if ( ac2->feature_tag == ac->feature_tag && ac2->script_lang_index == ac->script_lang_index && ac2->flags == ac->flags && ac2->ac.type == ac->ac.type && ac2->merge_with == ac->merge_with ) ac2->ac.subtable = sub; } } } /* Now I want to order the gsub lookups. I shan't bother with the gpos */ /* lookups because I didn't before */ for ( otl=sf->sf.gsub_lookups, cnt=0; otl!=NULL; otl=otl->next, ++cnt ); if ( cnt!=0 ) { all = malloc(cnt*sizeof(OTLookup *)); for ( otl=sf->sf.gsub_lookups, cnt=0; otl!=NULL; otl=otl->next, ++cnt ) { all[cnt] = otl; otl->lookup_index = GSubOrder(sf,otl->features); } qsort(all,cnt,sizeof(OTLookup *),order_lookups); sf->sf.gsub_lookups = all[0]; for ( i=1; inext = all[i]; all[cnt-1]->next = NULL; free( all ); } for ( isgpos=0; isgpos<2; ++isgpos ) { for ( otl = isgpos ? sf->sf.gpos_lookups : sf->sf.gsub_lookups , cnt=0; otl!=NULL; otl = otl->next ) { otl->lookup_index = cnt++; NameOTLookup(otl,&sf->sf); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499888, "input": "static void credit_entropy_bits(struct entropy_store *r, int nbits) { unsigned long flags; int entropy_count; if (!nbits) return; spin_lock_irqsave(&r->lock, flags); DEBUG_ENT(\"added %d entropy credits to %s\\n\", nbits, r->name); entropy_count = r->entropy_count; entropy_count += nbits; if (entropy_count < 0) { DEBUG_ENT(\"negative entropy/overflow\\n\"); entropy_count = 0; } else if (entropy_count > r->poolinfo->POOLBITS) entropy_count = r->poolinfo->POOLBITS; r->entropy_count = entropy_count; /* should we wake readers? */ if (r == &input_pool && entropy_count >= random_read_wakeup_thresh) { wake_up_interruptible(&random_read_wait); kill_fasync(&fasync, SIGIO, POLL_IN); } spin_unlock_irqrestore(&r->lock, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206718, "input": "static int route4_change(struct net *net, struct sk_buff *in_skb, struct tcf_proto *tp, unsigned long base, u32 handle, struct nlattr **tca, void **arg, bool ovr, bool rtnl_held, struct netlink_ext_ack *extack) { struct route4_head *head = rtnl_dereference(tp->root); struct route4_filter __rcu **fp; struct route4_filter *fold, *f1, *pfp, *f = NULL; struct route4_bucket *b; struct nlattr *opt = tca[TCA_OPTIONS]; struct nlattr *tb[TCA_ROUTE4_MAX + 1]; unsigned int h, th; int err; bool new = true; if (opt == NULL) return handle ? -EINVAL : 0; err = nla_parse_nested_deprecated(tb, TCA_ROUTE4_MAX, opt, route4_policy, NULL); if (err < 0) return err; fold = *arg; if (fold && handle && fold->handle != handle) return -EINVAL; err = -ENOBUFS; f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL); if (!f) goto errout; err = tcf_exts_init(&f->exts, net, TCA_ROUTE4_ACT, TCA_ROUTE4_POLICE); if (err < 0) goto errout; if (fold) { f->id = fold->id; f->iif = fold->iif; f->res = fold->res; f->handle = fold->handle; f->tp = fold->tp; f->bkt = fold->bkt; new = false; } err = route4_set_parms(net, tp, base, f, handle, head, tb, tca[TCA_RATE], new, ovr, extack); if (err < 0) goto errout; h = from_hash(f->handle >> 16); fp = &f->bkt->ht[h]; for (pfp = rtnl_dereference(*fp); (f1 = rtnl_dereference(*fp)) != NULL; fp = &f1->next) if (f->handle < f1->handle) break; tcf_block_netif_keep_dst(tp->chain->block); rcu_assign_pointer(f->next, f1); rcu_assign_pointer(*fp, f); if (fold && fold->handle && f->handle != fold->handle) { th = to_hash(fold->handle); h = from_hash(fold->handle >> 16); b = rtnl_dereference(head->table[th]); if (b) { fp = &b->ht[h]; for (pfp = rtnl_dereference(*fp); pfp; fp = &pfp->next, pfp = rtnl_dereference(*fp)) { if (pfp == f) { *fp = f->next; break; } } } } route4_reset_fastmap(head); *arg = f; if (fold) { tcf_unbind_filter(tp, &fold->res); tcf_exts_get_net(&fold->exts); tcf_queue_work(&fold->rwork, route4_delete_filter_work); } return 0; errout: if (f) tcf_exts_destroy(&f->exts); kfree(f); return err; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "A flaw was found in the \"Routing decision\" classifier in the Linux kernel's Traffic Control networking subsystem in the way it handled changing of classification filters, leading to a use-after-free condition. This flaw allows unprivileged local users to escalate their privileges on the system. The highest threat from this vulnerability is to confidentiality, integrity, as well as system availability.", "severity_level": "NoInfo", "cwe": "CWE-200", "cve": "CVE-2021-3715"}} -{"idx": 244686, "input": "static void push_window_data(struct archive_read* a, struct rar5* rar, int64_t idx_begin, int64_t idx_end) { push_data(a, rar, rar->cstate.window_buf, idx_begin, idx_end); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 199822, "input": "static int zipfileUpdate( sqlite3_vtab *pVtab, int nVal, sqlite3_value **apVal, sqlite_int64 *pRowid ){ ZipfileTab *pTab = (ZipfileTab*)pVtab; int rc = SQLITE_OK; /* Return Code */ ZipfileEntry *pNew = 0; /* New in-memory CDS entry */ u32 mode = 0; /* Mode for new entry */ u32 mTime = 0; /* Modification time for new entry */ i64 sz = 0; /* Uncompressed size */ const char *zPath = 0; /* Path for new entry */ int nPath = 0; /* strlen(zPath) */ const u8 *pData = 0; /* Pointer to buffer containing content */ int nData = 0; /* Size of pData buffer in bytes */ int iMethod = 0; /* Compression method for new entry */ u8 *pFree = 0; /* Free this */ char *zFree = 0; /* Also free this */ ZipfileEntry *pOld = 0; ZipfileEntry *pOld2 = 0; int bUpdate = 0; /* True for an update that modifies \"name\" */ int bIsDir = 0; u32 iCrc32 = 0; if( pTab->pWriteFd==0 ){ rc = zipfileBegin(pVtab); if( rc!=SQLITE_OK ) return rc; } /* If this is a DELETE or UPDATE, find the archive entry to delete. */ if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){ const char *zDelete = (const char*)sqlite3_value_text(apVal[0]); int nDelete = (int)strlen(zDelete); if( nVal>1 ){ const char *zUpdate = (const char*)sqlite3_value_text(apVal[1]); if( zUpdate && zipfileComparePath(zUpdate, zDelete, nDelete)!=0 ){ bUpdate = 1; } } for(pOld=pTab->pFirstEntry; 1; pOld=pOld->pNext){ if( zipfileComparePath(pOld->cds.zFile, zDelete, nDelete)==0 ){ break; } assert( pOld->pNext ); } } if( nVal>1 ){ /* Check that \"sz\" and \"rawdata\" are both NULL: */ if( sqlite3_value_type(apVal[5])!=SQLITE_NULL ){ zipfileTableErr(pTab, \"sz must be NULL\"); rc = SQLITE_CONSTRAINT; } if( sqlite3_value_type(apVal[6])!=SQLITE_NULL ){ zipfileTableErr(pTab, \"rawdata must be NULL\"); rc = SQLITE_CONSTRAINT; } if( rc==SQLITE_OK ){ if( sqlite3_value_type(apVal[7])==SQLITE_NULL ){ /* data=NULL. A directory */ bIsDir = 1; }else{ /* Value specified for \"data\", and possibly \"method\". This must be ** a regular file or a symlink. */ const u8 *aIn = sqlite3_value_blob(apVal[7]); int nIn = sqlite3_value_bytes(apVal[7]); int bAuto = sqlite3_value_type(apVal[8])==SQLITE_NULL; iMethod = sqlite3_value_int(apVal[8]); sz = nIn; pData = aIn; nData = nIn; if( iMethod!=0 && iMethod!=8 ){ zipfileTableErr(pTab, \"unknown compression method: %d\", iMethod); rc = SQLITE_CONSTRAINT; }else{ if( bAuto || iMethod ){ int nCmp; rc = zipfileDeflate(aIn, nIn, &pFree, &nCmp, &pTab->base.zErrMsg); if( rc==SQLITE_OK ){ if( iMethod || nCmpbase.zErrMsg); } if( rc==SQLITE_OK ){ zPath = (const char*)sqlite3_value_text(apVal[2]); nPath = (int)strlen(zPath); mTime = zipfileGetTime(apVal[4]); } if( rc==SQLITE_OK && bIsDir ){ /* For a directory, check that the last character in the path is a ** '/'. This appears to be required for compatibility with info-zip ** (the unzip command on unix). It does not create directories ** otherwise. */ if( zPath[nPath-1]!='/' ){ zFree = sqlite3_mprintf(\"%s/\", zPath); if( zFree==0 ){ rc = SQLITE_NOMEM; } zPath = (const char*)zFree; nPath++; } } /* Check that we're not inserting a duplicate entry -OR- updating an ** entry with a path, thereby making it into a duplicate. */ if( (pOld==0 || bUpdate) && rc==SQLITE_OK ){ ZipfileEntry *p; for(p=pTab->pFirstEntry; p; p=p->pNext){ if( zipfileComparePath(p->cds.zFile, zPath, nPath)==0 ){ switch( sqlite3_vtab_on_conflict(pTab->db) ){ case SQLITE_IGNORE: { goto zipfile_update_done; } case SQLITE_REPLACE: { pOld2 = p; break; } default: { zipfileTableErr(pTab, \"duplicate name: \\\"%s\\\"\", zPath); rc = SQLITE_CONSTRAINT; break; } } break; } } } if( rc==SQLITE_OK ){ /* Create the new CDS record. */ pNew = zipfileNewEntry(zPath); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ pNew->cds.iVersionMadeBy = ZIPFILE_NEWENTRY_MADEBY; pNew->cds.iVersionExtract = ZIPFILE_NEWENTRY_REQUIRED; pNew->cds.flags = ZIPFILE_NEWENTRY_FLAGS; pNew->cds.iCompression = (u16)iMethod; zipfileMtimeToDos(&pNew->cds, mTime); pNew->cds.crc32 = iCrc32; pNew->cds.szCompressed = nData; pNew->cds.szUncompressed = (u32)sz; pNew->cds.iExternalAttr = (mode<<16); pNew->cds.iOffset = (u32)pTab->szCurrent; pNew->cds.nFile = (u16)nPath; pNew->mUnixTime = (u32)mTime; rc = zipfileAppendEntry(pTab, pNew, pData, nData); zipfileAddEntry(pTab, pOld, pNew); } } } if( rc==SQLITE_OK && (pOld || pOld2) ){ ZipfileCsr *pCsr; for(pCsr=pTab->pCsrList; pCsr; pCsr=pCsr->pCsrNext){ if( pCsr->pCurrent && (pCsr->pCurrent==pOld || pCsr->pCurrent==pOld2) ){ pCsr->pCurrent = pCsr->pCurrent->pNext; pCsr->bNoop = 1; } } zipfileRemoveEntryFromList(pTab, pOld); zipfileRemoveEntryFromList(pTab, pOld2); } zipfile_update_done: sqlite3_free(pFree); sqlite3_free(zFree); return rc; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Unrestricted Upload of File with Dangerous Type"], "explanation": "zipfileUpdate in ext/misc/zipfile.c in SQLite 3.30.1 mishandles a NULL pathname during an update of a ZIP archive.", "severity_level": "NoInfo", "cwe": "CWE-434", "cve": "CVE-2019-19925"}} -{"idx": 431278, "input": "int nfs4_call_sync(struct rpc_clnt *clnt, struct nfs_server *server, struct rpc_message *msg, struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, int cache_reply) { nfs4_init_sequence(args, res, cache_reply, 0); return nfs4_call_sync_sequence(clnt, server, msg, args, res); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429737, "input": "uint STDCALL mysql_field_tell(MYSQL_RES *res) { return (res)->current_field; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381983, "input": "int CServer::GetClientVersion(int ClientID) const { if(ClientID >= 0 && ClientID < MAX_CLIENTS && m_aClients[ClientID].m_State == CClient::STATE_INGAME) return m_aClients[ClientID].m_Version; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246183, "input": "static void unsetJoinExpr(Expr *p, int iTable){ while( p ){ if( ExprHasProperty(p, EP_FromJoin) && (iTable<0 || p->iRightJoinTable==iTable) ){ ExprClearProperty(p, EP_FromJoin); } if( p->op==TK_FUNCTION && p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ unsetJoinExpr(p->x.pList->a[i].pExpr, iTable); } } unsetJoinExpr(p->pLeft, iTable); p = p->pRight; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 124840, "input": "ScriptPromise AudioContext::suspendContext(ScriptState* scriptState) { ASSERT(isMainThread()); AutoLocker locker(this); if (isOfflineContext()) { return ScriptPromise::rejectWithDOMException( scriptState, DOMException::create( InvalidStateError, \"cannot suspend an OfflineAudioContext\")); } RefPtrWillBeRawPtr resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); m_suspendResolvers.append(resolver); return promise; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416693, "input": "static struct st_mysqlnd_packet_stats * MYSQLND_METHOD(mysqlnd_protocol, get_stats_packet)(MYSQLND_PROTOCOL * const protocol, zend_bool persistent TSRMLS_DC) { struct st_mysqlnd_packet_stats * packet = mnd_pecalloc(1, packet_methods[PROT_STATS_PACKET].struct_size, persistent); DBG_ENTER(\"mysqlnd_protocol::get_stats_packet\"); if (packet) { packet->header.m = &packet_methods[PROT_STATS_PACKET]; packet->header.persistent = persistent; } DBG_RETURN(packet);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214926, "input": "static void suboption(struct Curl_easy *data) { struct curl_slist *v; unsigned char temp[2048]; ssize_t bytes_written; size_t len; int err; char varname[128] = \"\"; char varval[128] = \"\"; struct TELNET *tn = data->req.p.telnet; struct connectdata *conn = data->conn; printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2); switch(CURL_SB_GET(tn)) { case CURL_TELOPT_TTYPE: len = strlen(tn->subopt_ttype) + 4 + 2; msnprintf((char *)temp, sizeof(temp), \"%c%c%c%c%s%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE, CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE); bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); if(bytes_written < 0) { err = SOCKERRNO; failf(data,\"Sending data failed (%d)\",err); } printsub(data, '>', &temp[2], len-2); break; case CURL_TELOPT_XDISPLOC: len = strlen(tn->subopt_xdisploc) + 4 + 2; msnprintf((char *)temp, sizeof(temp), \"%c%c%c%c%s%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC, CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE); bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); if(bytes_written < 0) { err = SOCKERRNO; failf(data,\"Sending data failed (%d)\",err); } printsub(data, '>', &temp[2], len-2); break; case CURL_TELOPT_NEW_ENVIRON: msnprintf((char *)temp, sizeof(temp), \"%c%c%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON, CURL_TELQUAL_IS); len = 4; for(v = tn->telnet_vars; v; v = v->next) { size_t tmplen = (strlen(v->data) + 1); /* Add the variable only if it fits */ if(len + tmplen < (int)sizeof(temp)-6) { if(sscanf(v->data, \"%127[^,],%127s\", varname, varval)) { msnprintf((char *)&temp[len], sizeof(temp) - len, \"%c%s%c%s\", CURL_NEW_ENV_VAR, varname, CURL_NEW_ENV_VALUE, varval); len += tmplen; } } } msnprintf((char *)&temp[len], sizeof(temp) - len, \"%c%c\", CURL_IAC, CURL_SE); len += 2; bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); if(bytes_written < 0) { err = SOCKERRNO; failf(data,\"Sending data failed (%d)\",err); } printsub(data, '>', &temp[2], len-2); break; } return; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "curl 7.7 through 7.76.1 suffers from an information disclosure when the `-t` command line option, known as `CURLOPT_TELNETOPTIONS` in libcurl, is used to send variable=content pairs to TELNET servers. Due to a flaw in the option parser for sending NEW_ENV variables, libcurl could be made to pass on uninitialized data from a stack based buffer to the server, resulting in potentially revealing sensitive internal information to the server using a clear-text network protocol.", "severity_level": "NoInfo", "cwe": "CWE-200", "cve": "CVE-2021-22898"}} -{"idx": 291391, "input": "static zend_bool php_openssl_pkey_init_and_assign_rsa(EVP_PKEY *pkey, RSA *rsa, zval *data) { BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; OPENSSL_PKEY_SET_BN(data, n); OPENSSL_PKEY_SET_BN(data, e); OPENSSL_PKEY_SET_BN(data, d); if (!n || !d || !RSA_set0_key(rsa, n, e, d)) { return 0; } OPENSSL_PKEY_SET_BN(data, p); OPENSSL_PKEY_SET_BN(data, q); if ((p || q) && !RSA_set0_factors(rsa, p, q)) { return 0; } OPENSSL_PKEY_SET_BN(data, dmp1); OPENSSL_PKEY_SET_BN(data, dmq1); OPENSSL_PKEY_SET_BN(data, iqmp); if ((dmp1 || dmq1 || iqmp) && !RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp)) { return 0; } if (!EVP_PKEY_assign_RSA(pkey, rsa)) { php_openssl_store_errors(); return 0; } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499735, "input": "cpio_create_dir (struct cpio_file_stat *file_hdr, int existing_dir) { int res; /* Result of various function calls. */ int setstat_delayed = 0; if (to_stdout_option) return 0; /* Strip any trailing `/'s off the filename; tar puts them on. We might as well do it here in case anybody else does too, since they cause strange things to happen. */ strip_trailing_slashes (file_hdr->c_name); /* Ignore the current directory. It must already exist, and we don't want to change its permission, ownership or time. */ if (file_hdr->c_name[0] == '.' && file_hdr->c_name[1] == '\\0') { return 0; } if (!existing_dir) res = cpio_mkdir (file_hdr, &setstat_delayed); else res = 0; if (res < 0 && create_dir_flag) { create_all_directories (file_hdr->c_name); res = cpio_mkdir (file_hdr, &setstat_delayed); } if (res < 0) { /* In some odd cases where the file_hdr->c_name includes `.', the directory may have actually been created by create_all_directories(), so the mkdir will fail because the directory exists. If that's the case, don't complain about it. */ struct stat file_stat; if (errno != EEXIST) { mkdir_error (file_hdr->c_name); return -1; } if (lstat (file_hdr->c_name, &file_stat)) { stat_error (file_hdr->c_name); return -1; } if (!(S_ISDIR (file_stat.st_mode))) { error (0, 0, _(\"%s is not a directory\"), quotearg_colon (file_hdr->c_name)); return -1; } } if (!setstat_delayed && repair_delayed_set_stat (file_hdr)) set_perms (-1, file_hdr); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 477388, "input": "iasecc_init_oberthur(struct sc_card *card) { struct sc_context *ctx = card->ctx; unsigned int flags; int rv = 0; LOG_FUNC_CALLED(ctx); flags = IASECC_CARD_DEFAULT_FLAGS; _sc_card_add_rsa_alg(card, 1024, flags, 0x10001); _sc_card_add_rsa_alg(card, 2048, flags, 0x10001); card->caps = SC_CARD_CAP_RNG; card->caps |= SC_CARD_CAP_APDU_EXT; card->caps |= SC_CARD_CAP_USE_FCI_AC; iasecc_parse_ef_atr(card); /* if we fail to select CM, */ if (gp_select_card_manager(card)) { gp_select_isd_rid(card); } rv = iasecc_oberthur_match(card); LOG_TEST_RET(ctx, rv, \"unknown Oberthur's IAS/ECC card\"); rv = iasecc_select_mf(card, NULL); LOG_TEST_RET(ctx, rv, \"MF selection error\"); rv = iasecc_parse_ef_atr(card); LOG_TEST_RET(ctx, rv, \"EF.ATR read or parse error\"); sc_log(ctx, \"EF.ATR(aid:'%s')\", sc_dump_hex(card->ef_atr->aid.value, card->ef_atr->aid.len)); LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 326074, "input": "void __do_SAK(struct tty_struct *tty) { #ifdef TTY_SOFT_SAK tty_hangup(tty); #else struct task_struct *g, *p; struct pid *session; int i; unsigned long flags; if (!tty) return; spin_lock_irqsave(&tty->ctrl_lock, flags); session = get_pid(tty->session); spin_unlock_irqrestore(&tty->ctrl_lock, flags); tty_ldisc_flush(tty); tty_driver_flush_buffer(tty); read_lock(&tasklist_lock); /* Kill the entire session */ do_each_pid_task(session, PIDTYPE_SID, p) { tty_notice(tty, \"SAK: killed process %d (%s): by session\\n\", task_pid_nr(p), p->comm); group_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_SID); } while_each_pid_task(session, PIDTYPE_SID, p); /* Now kill any processes that happen to have the tty open */ do_each_thread(g, p) { if (p->signal->tty == tty) { tty_notice(tty, \"SAK: killed process %d (%s): by controlling tty\\n\", task_pid_nr(p), p->comm); group_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_SID); continue; } task_lock(p); i = iterate_fd(p->files, 0, this_tty, tty); if (i != 0) { tty_notice(tty, \"SAK: killed process %d (%s): by fd#%d\\n\", task_pid_nr(p), p->comm, i - 1); group_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_SID); } task_unlock(p); } while_each_thread(g, p); read_unlock(&tasklist_lock); put_pid(session); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 301521, "input": "size_t zend_shared_alloc_get_free_memory(void) { return ZSMMG(shared_free); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 388300, "input": "static void ResetPixelList(PixelList *pixel_list) { int level; SkipNode *root; SkipList *p; /* Reset the skip-list. */ p=(&pixel_list->skip_list); root=p->nodes+65536UL; p->level=0; for (level=0; level < 9; level++) root->next[level]=65536UL; pixel_list->seed=pixel_list->signature++; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 321870, "input": "Math_f sh_mathstdfun(const char *fname, size_t fsize, short *nargs) { const struct mathtab *tp; char c = fname[0]; for (tp = shtab_math; *tp->fname; tp++) { if (*tp->fname > c) break; if (tp->fname[1] == c && tp->fname[fsize + 1] == 0 && strncmp(&tp->fname[1], fname, fsize) == 0) { if (nargs) *nargs = *tp->fname; return tp->fnptr; } } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280143, "input": "static void validate_slab(struct kmem_cache *s, struct page *page) { void *p; void *addr = page_address(page); unsigned long *map; slab_lock(page); if (!check_slab(s, page) || !on_freelist(s, page, NULL)) goto unlock; /* Now we know that a valid freelist exists */ map = get_map(s, page); for_each_object(p, s, addr, page->objects) { u8 val = test_bit(slab_index(p, s, addr), map) ? SLUB_RED_INACTIVE : SLUB_RED_ACTIVE; if (!check_object(s, page, p, val)) break; } put_map(map); unlock: slab_unlock(page); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246360, "input": "static void core_optional_fn_retrieve(void) { ap_init_scoreboard(NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265777, "input": "bool CWebSock::ForceLogin() { if (GetSession()->IsLoggedIn()) { return true; } GetSession()->AddError(\"You must login to view that page\"); Redirect(\"/\"); return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432609, "input": "static int nmi_interception(struct vcpu_svm *svm) { return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 221446, "input": "static int tagu32(char *tagname, int n /*number of stored fields*/) { //int numsize = n * 4; int size = 0; //int datasize = numsize + 16; #if 0 size += u32out(datasize + 8); size += dataout(tagname, 4); size += u32out(datasize); size += dataout(\"data\", 4); size += u32out(0); size += u32out(0); #endif return size; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 254858, "input": "void analyzeUnitTest() { struct ndpi_analyze_struct *s = ndpi_alloc_data_analysis(32); u_int32_t i; for(i=0; i<256; i++) { ndpi_data_add_value(s, rand()*i); // ndpi_data_add_value(s, i+1); } // ndpi_data_print_window_values(s); #ifdef RUN_DATA_ANALYSIS_THEN_QUIT printf(\"Average: [all: %f][window: %f]\\n\", ndpi_data_average(s), ndpi_data_window_average(s)); printf(\"Entropy: %f\\n\", ndpi_data_entropy(s)); printf(\"Min/Max: %u/%u\\n\", ndpi_data_min(s), ndpi_data_max(s)); #endif ndpi_free_data_analysis(s); #ifdef RUN_DATA_ANALYSIS_THEN_QUIT exit(0); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265773, "input": "CString CWebSock::FindTmpl(CModule* pModule, const CString& sName) { VCString vsDirs = GetDirs(pModule, true); CString sFile = pModule->GetModName() + \"_\" + sName; for (const CString& sDir : vsDirs) { if (CFile::Exists(CDir::ChangeDir(sDir, sFile))) { m_Template.AppendPath(sDir); return sFile; } } return sName; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346288, "input": "static int match_filter(const struct USBAutoFilter *f1, const struct USBAutoFilter *f2) { return f1->bus_num == f2->bus_num && f1->addr == f2->addr && f1->vendor_id == f2->vendor_id && f1->product_id == f2->product_id; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393069, "input": "TEST_F(QueryPlannerTest, ContainedOrCombineLeadingFieldsMoveToAnd) { addIndex(BSON(\"a\" << 1 << \"b\" << 1)); addIndex(BSON(\"c\" << 1 << \"a\" << 1)); runQuery( fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}]}\")); assertNumSolutions(3); assertSolutionExists( \"{fetch: {filter: null, node: {or: {nodes: [\" \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[0, 10, true, true]], b: [[6, 6, true, \" \"true]]}}},\" \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[0, Infinity, \" \"true, true]]}}}\" \"]}}}}\"); assertSolutionExists( \"{fetch: {filter: {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}, node: \" \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[0, Infinity, true, true]], b: [['MinKey', \" \"'MaxKey', true, true]]}}}\" \"}}\"); assertSolutionExists(\"{cscan: {dir: 1}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 201452, "input": "int LibRaw::ljpeg_start(struct jhead *jh, int info_only) { ushort c, tag, len; int cnt = 0; uchar data[0x10000]; const uchar *dp; memset(jh, 0, sizeof *jh); jh->restart = INT_MAX; if ((fgetc(ifp), fgetc(ifp)) != 0xd8) return 0; do { if (feof(ifp)) return 0; if (cnt++ > 1024) return 0; // 1024 tags limit if (!fread(data, 2, 2, ifp)) return 0; tag = data[0] << 8 | data[1]; len = (data[2] << 8 | data[3]) - 2; if (tag <= 0xff00) return 0; fread(data, 1, len, ifp); switch (tag) { case 0xffc3: // start of frame; lossless, Huffman jh->sraw = ((data[7] >> 4) * (data[7] & 15) - 1) & 3; case 0xffc1: case 0xffc0: jh->algo = tag & 0xff; jh->bits = data[0]; jh->high = data[1] << 8 | data[2]; jh->wide = data[3] << 8 | data[4]; jh->clrs = data[5] + jh->sraw; if (len == 9 && !dng_version) getc(ifp); break; case 0xffc4: // define Huffman tables if (info_only) break; for (dp = data; dp < data + len && !((c = *dp++) & -20);) jh->free[c] = jh->huff[c] = make_decoder_ref(&dp); break; case 0xffda: // start of scan jh->psv = data[1 + data[0] * 2]; jh->bits -= data[3 + data[0] * 2] & 15; break; case 0xffdb: FORC(64) jh->quant[c] = data[c * 2 + 1] << 8 | data[c * 2 + 2]; break; case 0xffdd: jh->restart = data[0] << 8 | data[1]; } } while (tag != 0xffda); if (jh->bits > 16 || jh->clrs > 6 || !jh->bits || !jh->high || !jh->wide || !jh->clrs) return 0; if (info_only) return 1; if (!jh->huff[0]) return 0; FORC(19) if (!jh->huff[c + 1]) jh->huff[c + 1] = jh->huff[c]; if (jh->sraw) { FORC(4) jh->huff[2 + c] = jh->huff[1]; FORC(jh->sraw) jh->huff[1 + c] = jh->huff[0]; } jh->row = (ushort *)calloc(jh->wide * jh->clrs, 4); merror(jh->row, \"ljpeg_start()\"); return zero_after_ff = 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In LibRaw, an out-of-bounds read vulnerability exists within the \"LibRaw::adobe_copy_pixel()\" function (libraw\\src\\decoders\\dng.cpp) when reading data from the image file.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-35533"}} -{"idx": 264820, "input": "GF_Err hinf_box_read(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_array_read(s, bs, hinf_on_child_box); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409196, "input": "static int __init uvc_init(void) { int ret; uvc_debugfs_init(); ret = usb_register(&uvc_driver.driver); if (ret < 0) { uvc_debugfs_cleanup(); return ret; } printk(KERN_INFO DRIVER_DESC \" (\" DRIVER_VERSION \")\\n\"); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279700, "input": "struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx, struct tevent_context *ev) { struct sys_notify_context *ctx; if (!(ctx = talloc(mem_ctx, struct sys_notify_context))) { DEBUG(0, (\"talloc failed\\n\")); return NULL; } ctx->ev = ev; ctx->private_data = NULL; return ctx; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195842, "input": "void *enc_untrusted_realloc(void *ptr, size_t size) { MessageWriter input; input.Push(reinterpret_cast(ptr)); input.Push(static_cast(size)); MessageReader output; asylo::primitives::PrimitiveStatus status = asylo::host_call::NonSystemCallDispatcher( asylo::host_call::kReallocHandler, &input, &output); CheckStatusAndParamCount(status, output, \"enc_untrusted_realloc\", 2); void *result = output.next(); int klinux_errno = output.next(); // realloc only sets the errno (ENOMEM) when output pointer is null and a // non-zero |size| is provided. if (!result && size != 0) { errno = FromkLinuxErrorNumber(klinux_errno); } return result; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Certificate Validation"], "explanation": "An arbitrary memory overwrite vulnerability in Asylo versions up to 0.6.0 allow an attacker to make an Ecall_restore function call to reallocate untrusted code and overwrite sections of the Enclave memory address. We recommend updating your library.", "severity_level": "NoInfo", "cwe": "CWE-295", "cve": "CVE-2020-8935"}} -{"idx": 198183, "input": "void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_backtick) { const char *quote = \"`\\\"\\\\\"; if (!quote_backtick) quote++; char *pt = dest; const char *s = src; *pt++ = '\"'; /* save room for trailing quote-char */ dlen -= 2; for (; *s && dlen; s++) { if (strchr(quote, *s)) { dlen -= 2; if (dlen == 0) break; *pt++ = '\\\\'; *pt++ = *s; } else { *pt++ = *s; dlen--; } } *pt++ = '\"'; *pt = '\\0'; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Integer Underflow (Wrap or Wraparound)"], "explanation": "An issue was discovered in Mutt before 1.10.1 and NeoMutt before 2018-07-16. imap_quote_string in imap/util.c has an integer underflow.", "severity_level": "NoInfo", "cwe": "CWE-191", "cve": "CVE-2018-14353"}} -{"idx": 277066, "input": "lib_file_open_search_with_combine(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx_p, const char *fname, uint flen, char *buffer, int blen, uint *pclen, ref *pfile, gx_io_device *iodev, bool starting_arg_file, char *fmode) { stream *s; const gs_file_path *pfpath = lib_path; uint pi; for (pi = 0; pi < r_size(&pfpath->list); ++pi) { const ref *prdir = pfpath->list.value.refs + pi; const char *pstr = (const char *)prdir->value.const_bytes; uint plen = r_size(prdir), blen1 = blen; gs_parsed_file_name_t pname; gp_file_name_combine_result r; /* We need to concatenate and parse the file name here * if this path has a %device% prefix. */ if (pstr[0] == '%') { int code; /* We concatenate directly since gp_file_name_combine_* * rules are not correct for other devices such as %rom% */ code = gs_parse_file_name(&pname, pstr, plen, mem); if (code < 0) continue; if (blen < max(pname.len, plen) + flen) return_error(gs_error_limitcheck); memcpy(buffer, pname.fname, pname.len); memcpy(buffer+pname.len, fname, flen); code = pname.iodev->procs.open_file(pname.iodev, buffer, pname.len + flen, fmode, &s, (gs_memory_t *)mem); if (code < 0) continue; make_stream_file(pfile, s, \"r\"); /* fill in the buffer with the device concatenated */ memcpy(buffer, pstr, plen); memcpy(buffer+plen, fname, flen); *pclen = plen + flen; return 0; } else { r = gp_file_name_combine(pstr, plen, fname, flen, false, buffer, &blen1); if (r != gp_combine_success) continue; if (iodev_os_open_file(iodev, (const char *)buffer, blen1, (const char *)fmode, &s, (gs_memory_t *)mem) == 0) { if (starting_arg_file || check_file_permissions_aux(i_ctx_p, buffer, blen1) >= 0) { *pclen = blen1; make_stream_file(pfile, s, \"r\"); return 0; } sclose(s); return_error(gs_error_invalidfileaccess); } } } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224943, "input": "snmp_ber_decode_length(snmp_packet_t *snmp_packet, uint8_t *length) { if(snmp_packet->used == 0) { return 0; } *length = *snmp_packet->in++; snmp_packet->used--; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263045, "input": "iasecc_chv_verify(struct sc_card *card, struct sc_pin_cmd_data *pin_cmd, unsigned char *scbs, int *tries_left) { struct sc_context *ctx = card->ctx; unsigned char scb = scbs[IASECC_ACLS_CHV_VERIFY]; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, \"Verify CHV PIN(ref:%i,len:%i,scb:%X)\", pin_cmd->pin_reference, pin_cmd->pin1.len, scb); if (scb & IASECC_SCB_METHOD_SM) { rv = iasecc_sm_pin_verify(card, scb & IASECC_SCB_METHOD_MASK_REF, pin_cmd, tries_left); LOG_FUNC_RETURN(ctx, rv); } rv = iso_ops->pin_cmd(card, pin_cmd, tries_left); LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195649, "input": "void Compute(OpKernelContext* context) override { const Tensor& logits_in = context->input(0); const Tensor& labels_in = context->input(1); TensorShape shape_in = logits_in.shape(); BCast bcast(BCast::FromShape(logits_in.shape()), BCast::FromShape(labels_in.shape())); if (!logits_in.IsSameSize(labels_in)) { OP_REQUIRES(context, bcast.IsValid(), errors::InvalidArgument( \"logits and labels must be broadcastable: logits_size=\", logits_in.shape().DebugString(), \" labels_size=\", labels_in.shape().DebugString())); shape_in = BCast::ToShape(bcast.output_shape()); } OP_REQUIRES(context, TensorShapeUtils::IsMatrix(shape_in), errors::InvalidArgument(\"logits and labels must be either \" \"2-dimensional, or broadcasted to be \" \"2-dimensional\")); if (std::is_same::value) { OP_REQUIRES(context, !OpDeterminismRequired(), errors::Unimplemented( \"The GPU implementation of SoftmaxCrossEntropyWithLogits\" \" that would have been executed is not deterministic.\" \" Note that the Python API uses an alternative,\" \" deterministic, GPU-accelerated path when determinism is\" \" enabled.\")); } // loss is 1-D (one per example), and size is batch_size. Tensor scratch; OP_REQUIRES_OK( context, context->allocate_temp(DataTypeToEnum::value, TensorShape({shape_in.dim_size(0), 1}), &scratch)); Tensor* loss_out = nullptr; OP_REQUIRES_OK(context, context->allocate_output( 0, TensorShape({shape_in.dim_size(0)}), &loss_out)); Tensor* back_out = nullptr; // Try to reuse the logits_in buffer for the backprop output. OP_REQUIRES_OK(context, context->forward_input_or_allocate_output( {0}, 1, shape_in, &back_out)); if (shape_in.dim_size(0) > 0) { functor::XentFunctor functor; if (logits_in.IsSameSize(labels_in)) { functor(context->eigen_device(), shape_in.AsEigenDSizes<2>(), Eigen::array{1, 1}, Eigen::array{1, 1}, logits_in.matrix(), labels_in.matrix(), scratch.matrix(), loss_out->vec(), back_out->matrix()); } else { functor(context->eigen_device(), shape_in.AsEigenDSizes<2>(), BCast::ToIndexArray<2>(bcast.x_bcast()), BCast::ToIndexArray<2>(bcast.y_bcast()), logits_in.template shaped(bcast.x_reshape()), labels_in.template shaped(bcast.y_reshape()), scratch.matrix(), loss_out->vec(), back_out->matrix()); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Validation of Integrity Check Value"], "explanation": "TensorFlow is an open source platform for machine learning. In affected versions several TensorFlow operations are missing validation for the shapes of the tensor arguments involved in the call. Depending on the API, this can result in undefined behavior and segfault or `CHECK`-fail related crashes but in some scenarios writes and reads from heap populated arrays are also possible. We have discovered these issues internally via tooling while working on improving/testing GPU op determinism. As such, we don't have reproducers and there will be multiple fixes for these issues. These fixes will be included in TensorFlow 2.7.0. We will also cherrypick these commits on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-354", "cve": "CVE-2021-41206"}} -{"idx": 336908, "input": "rb_str_to_f(VALUE str) { return DBL2NUM(rb_str_to_dbl(str, FALSE)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342047, "input": "static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, struct inode *newdir, struct dentry *newent, unsigned int flags, int opcode, size_t argsize) { int err; struct fuse_rename2_in inarg; struct fuse_mount *fm = get_fuse_mount(olddir); FUSE_ARGS(args); memset(&inarg, 0, argsize); inarg.newdir = get_node_id(newdir); inarg.flags = flags; args.opcode = opcode; args.nodeid = get_node_id(olddir); args.in_numargs = 3; args.in_args[0].size = argsize; args.in_args[0].value = &inarg; args.in_args[1].size = oldent->d_name.len + 1; args.in_args[1].value = oldent->d_name.name; args.in_args[2].size = newent->d_name.len + 1; args.in_args[2].value = newent->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { /* ctime changes */ fuse_invalidate_attr(d_inode(oldent)); fuse_update_ctime(d_inode(oldent)); if (flags & RENAME_EXCHANGE) { fuse_invalidate_attr(d_inode(newent)); fuse_update_ctime(d_inode(newent)); } fuse_dir_changed(olddir); if (olddir != newdir) fuse_dir_changed(newdir); /* newent will end up negative */ if (!(flags & RENAME_EXCHANGE) && d_really_is_positive(newent)) { fuse_invalidate_attr(d_inode(newent)); fuse_invalidate_entry_cache(newent); fuse_update_ctime(d_inode(newent)); } } else if (err == -EINTR) { /* If request was interrupted, DEITY only knows if the rename actually took place. If the invalidation fails (e.g. some process has CWD under the renamed directory), then there can be inconsistency between the dcache and the real filesystem. Tough luck. */ fuse_invalidate_entry(oldent); if (d_really_is_positive(newent)) fuse_invalidate_entry(newent); } return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230246, "input": "TEST_P(JSITest, MultiDecoratorTest) { struct Inc { void before() { ++count; } // Test optional after method. int count = 0; }; struct Nest { void before() { ++nest; } void after() { --nest; } int nest = 0; }; class MultiRuntime final : public WithRuntimeDecorator> { public: explicit MultiRuntime(std::unique_ptr rt) : WithRuntimeDecorator>(*rt, tuple_), rt_(std::move(rt)) {} int count() { return std::get<0>(tuple_).count; } int nest() { return std::get<1>(tuple_).nest; } private: std::unique_ptr rt_; std::tuple tuple_; }; MultiRuntime mrt(factory()); Function expectNestOne = Function::createFromHostFunction( mrt, PropNameID::forAscii(mrt, \"expectNestOne\"), 0, [](Runtime& rt, const Value& thisVal, const Value* args, size_t count) { MultiRuntime* funcmrt = dynamic_cast(&rt); EXPECT_NE(funcmrt, nullptr); EXPECT_EQ(funcmrt->count(), 3); EXPECT_EQ(funcmrt->nest(), 1); return Value::undefined(); }); expectNestOne.call(mrt); EXPECT_EQ(mrt.count(), 3); EXPECT_EQ(mrt.nest(), 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224810, "input": "static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb) { struct pep_sock *pn = pep_sk(sk); struct pnpipehdr *hdr; int wake = 0; if (!pskb_may_pull(skb, sizeof(*hdr) + 4)) return -EINVAL; hdr = pnp_hdr(skb); if (hdr->pep_type != PN_PEP_TYPE_COMMON) { net_dbg_ratelimited(\"Phonet unknown PEP type: %u\\n\", (unsigned int)hdr->pep_type); return -EOPNOTSUPP; } switch (hdr->data[0]) { case PN_PEP_IND_FLOW_CONTROL: switch (pn->tx_fc) { case PN_LEGACY_FLOW_CONTROL: switch (hdr->data[3]) { case PEP_IND_BUSY: atomic_set(&pn->tx_credits, 0); break; case PEP_IND_READY: atomic_set(&pn->tx_credits, wake = 1); break; } break; case PN_ONE_CREDIT_FLOW_CONTROL: if (hdr->data[3] == PEP_IND_READY) atomic_set(&pn->tx_credits, wake = 1); break; } break; case PN_PEP_IND_ID_MCFC_GRANT_CREDITS: if (pn->tx_fc != PN_MULTI_CREDIT_FLOW_CONTROL) break; atomic_add(wake = hdr->data[3], &pn->tx_credits); break; default: net_dbg_ratelimited(\"Phonet unknown PEP indication: %u\\n\", (unsigned int)hdr->data[0]); return -EOPNOTSUPP; } if (wake) sk->sk_write_space(sk); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 501557, "input": "int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p,*d; int n; unsigned long l; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey=NULL; #endif #ifndef OPENSSL_NO_KRB5 KSSL_ERR kssl_err; #endif /* OPENSSL_NO_KRB5 */ #ifndef OPENSSL_NO_ECDH EC_KEY *clnt_ecdh = NULL; const EC_POINT *srvr_ecpoint = NULL; EVP_PKEY *srvr_pub_pkey = NULL; unsigned char *encodedPoint = NULL; int encoded_pt_len = 0; BN_CTX * bn_ctx = NULL; #endif if (s->state == SSL3_ST_CW_KEY_EXCH_A) { d=(unsigned char *)s->init_buf->data; p= &(d[4]); l=s->s3->tmp.new_cipher->algorithms; /* Fool emacs indentation */ if (0) {} #ifndef OPENSSL_NO_RSA else if (l & SSL_kRSA) { RSA *rsa; unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH]; if (s->session->sess_cert->peer_rsa_tmp != NULL) rsa=s->session->sess_cert->peer_rsa_tmp; else { pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509); if ((pkey == NULL) || (pkey->type != EVP_PKEY_RSA) || (pkey->pkey.rsa == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR); goto err; } rsa=pkey->pkey.rsa; EVP_PKEY_free(pkey); } tmp_buf[0]=s->client_version>>8; tmp_buf[1]=s->client_version&0xff; if (RAND_bytes(&(tmp_buf[2]),sizeof tmp_buf-2) <= 0) goto err; s->session->master_key_length=sizeof tmp_buf; q=p; /* Fix buf for TLS and beyond */ if (s->version > SSL3_VERSION) p+=2; n=RSA_public_encrypt(sizeof tmp_buf, tmp_buf,p,rsa,RSA_PKCS1_PADDING); #ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) p[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0]=0x70; #endif if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_ENCRYPT); goto err; } /* Fix buf for TLS and beyond */ if (s->version > SSL3_VERSION) { s2n(n,q); n+=2; } s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key, tmp_buf,sizeof tmp_buf); OPENSSL_cleanse(tmp_buf,sizeof tmp_buf); } #endif #ifndef OPENSSL_NO_KRB5 else if (l & SSL_kKRB5) { krb5_error_code krb5rc; KSSL_CTX *kssl_ctx = s->kssl_ctx; /* krb5_data krb5_ap_req; */ krb5_data *enc_ticket; krb5_data authenticator, *authp = NULL; EVP_CIPHER_CTX ciph_ctx; EVP_CIPHER *enc = NULL; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH]; unsigned char epms[SSL_MAX_MASTER_KEY_LENGTH + EVP_MAX_IV_LENGTH]; int padl, outl = sizeof(epms); EVP_CIPHER_CTX_init(&ciph_ctx); #ifdef KSSL_DEBUG printf(\"ssl3_send_client_key_exchange(%lx & %lx)\\n\", l, SSL_kKRB5); #endif /* KSSL_DEBUG */ authp = NULL; #ifdef KRB5SENDAUTH if (KRB5SENDAUTH) authp = &authenticator; #endif /* KRB5SENDAUTH */ krb5rc = kssl_cget_tkt(kssl_ctx, &enc_ticket, authp, &kssl_err); enc = kssl_map_enc(kssl_ctx->enctype); if (enc == NULL) goto err; #ifdef KSSL_DEBUG { printf(\"kssl_cget_tkt rtn %d\\n\", krb5rc); if (krb5rc && kssl_err.text) printf(\"kssl_cget_tkt kssl_err=%s\\n\", kssl_err.text); } #endif /* KSSL_DEBUG */ if (krb5rc) { ssl3_send_alert(s,SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, kssl_err.reason); goto err; } /* 20010406 VRS - Earlier versions used KRB5 AP_REQ ** in place of RFC 2712 KerberosWrapper, as in: ** ** Send ticket (copy to *p, set n = length) ** n = krb5_ap_req.length; ** memcpy(p, krb5_ap_req.data, krb5_ap_req.length); ** if (krb5_ap_req.data) ** kssl_krb5_free_data_contents(NULL,&krb5_ap_req); ** ** Now using real RFC 2712 KerberosWrapper ** (Thanks to Simon Wilkinson ) ** Note: 2712 \"opaque\" types are here replaced ** with a 2-byte length followed by the value. ** Example: ** KerberosWrapper= xx xx asn1ticket 0 0 xx xx encpms ** Where \"xx xx\" = length bytes. Shown here with ** optional authenticator omitted. */ /* KerberosWrapper.Ticket */ s2n(enc_ticket->length,p); memcpy(p, enc_ticket->data, enc_ticket->length); p+= enc_ticket->length; n = enc_ticket->length + 2; /* KerberosWrapper.Authenticator */ if (authp && authp->length) { s2n(authp->length,p); memcpy(p, authp->data, authp->length); p+= authp->length; n+= authp->length + 2; free(authp->data); authp->data = NULL; authp->length = 0; } else { s2n(0,p);/* null authenticator length */ n+=2; } tmp_buf[0]=s->client_version>>8; tmp_buf[1]=s->client_version&0xff; if (RAND_bytes(&(tmp_buf[2]),sizeof tmp_buf-2) <= 0) goto err; /* 20010420 VRS. Tried it this way; failed. ** EVP_EncryptInit_ex(&ciph_ctx,enc, NULL,NULL); ** EVP_CIPHER_CTX_set_key_length(&ciph_ctx, ** kssl_ctx->length); ** EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv); */ memset(iv, 0, sizeof iv); /* per RFC 1510 */ EVP_EncryptInit_ex(&ciph_ctx,enc, NULL, kssl_ctx->key,iv); EVP_EncryptUpdate(&ciph_ctx,epms,&outl,tmp_buf, sizeof tmp_buf); EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl); outl += padl; if (outl > sizeof epms) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } EVP_CIPHER_CTX_cleanup(&ciph_ctx); /* KerberosWrapper.EncryptedPreMasterSecret */ s2n(outl,p); memcpy(p, epms, outl); p+=outl; n+=outl + 2; s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key, tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(epms, outl); } #endif #ifndef OPENSSL_NO_DH else if (l & (SSL_kEDH|SSL_kDHr|SSL_kDHd)) { DH *dh_srvr,*dh_clnt; if (s->session->sess_cert == NULL) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE); goto err; } if (s->session->sess_cert->peer_dh_tmp != NULL) dh_srvr=s->session->sess_cert->peer_dh_tmp; else { /* we get them from the cert */ ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNABLE_TO_FIND_DH_PARAMETERS); goto err; } /* generate a new random key */ if ((dh_clnt=DHparams_dup(dh_srvr)) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } if (!DH_generate_key(dh_clnt)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } /* use the 'p' output buffer for the DH key, but * make sure to clear it out afterwards */ n=DH_compute_key(p,dh_srvr->pub_key,dh_clnt); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } /* generate master key from the result */ s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key,p,n); /* clean up */ memset(p,0,n); /* send off the data */ n=BN_num_bytes(dh_clnt->pub_key); s2n(n,p); BN_bn2bin(dh_clnt->pub_key,p); n+=2; DH_free(dh_clnt); /* perhaps clean things up a bit EAY EAY EAY EAY*/ } #endif #ifndef OPENSSL_NO_ECDH else if ((l & SSL_kECDH) || (l & SSL_kECDHE)) { const EC_GROUP *srvr_group = NULL; EC_KEY *tkey; int ecdh_clnt_cert = 0; int field_size = 0; if (s->session->sess_cert == NULL) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE); goto err; } /* Did we send out the client's * ECDH share for use in premaster * computation as part of client certificate? * If so, set ecdh_clnt_cert to 1. */ if ((l & SSL_kECDH) && (s->cert != NULL)) { /* XXX: For now, we do not support client * authentication using ECDH certificates. * To add such support, one needs to add * code that checks for appropriate * conditions and sets ecdh_clnt_cert to 1. * For example, the cert have an ECC * key on the same curve as the server's * and the key should be authorized for * key agreement. * * One also needs to add code in ssl3_connect * to skip sending the certificate verify * message. * * if ((s->cert->key->privatekey != NULL) && * (s->cert->key->privatekey->type == * EVP_PKEY_EC) && ...) * ecdh_clnt_cert = 1; */ } if (s->session->sess_cert->peer_ecdh_tmp != NULL) { tkey = s->session->sess_cert->peer_ecdh_tmp; } else { /* Get the Server Public Key from Cert */ srvr_pub_pkey = X509_get_pubkey(s->session-> \\ sess_cert->peer_pkeys[SSL_PKEY_ECC].x509); if ((srvr_pub_pkey == NULL) || (srvr_pub_pkey->type != EVP_PKEY_EC) || (srvr_pub_pkey->pkey.ec == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } tkey = srvr_pub_pkey->pkey.ec; } srvr_group = EC_KEY_get0_group(tkey); srvr_ecpoint = EC_KEY_get0_public_key(tkey); if ((srvr_group == NULL) || (srvr_ecpoint == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if ((clnt_ecdh=EC_KEY_new()) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_group(clnt_ecdh, srvr_group)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_EC_LIB); goto err; } if (ecdh_clnt_cert) { /* Reuse key info from our certificate * We only need our private key to perform * the ECDH computation. */ const BIGNUM *priv_key; tkey = s->cert->key->privatekey->pkey.ec; priv_key = EC_KEY_get0_private_key(tkey); if (priv_key == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_private_key(clnt_ecdh, priv_key)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_EC_LIB); goto err; } } else { /* Generate a new ECDH key pair */ if (!(EC_KEY_generate_key(clnt_ecdh))) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } } /* use the 'p' output buffer for the ECDH key, but * make sure to clear it out afterwards */ field_size = EC_GROUP_get_degree(srvr_group); if (field_size <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } n=ECDH_compute_key(p, (field_size+7)/8, srvr_ecpoint, clnt_ecdh, NULL); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } /* generate master key from the result */ s->session->master_key_length = s->method->ssl3_enc \\ -> generate_master_secret(s, s->session->master_key, p, n); memset(p, 0, n); /* clean up */ if (ecdh_clnt_cert) { /* Send empty client key exch message */ n = 0; } else { /* First check the size of encoding and * allocate memory accordingly. */ encoded_pt_len = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, NULL, 0, NULL); encodedPoint = (unsigned char *) OPENSSL_malloc(encoded_pt_len * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); if ((encodedPoint == NULL) || (bn_ctx == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } /* Encode the public key */ n = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, encodedPoint, encoded_pt_len, bn_ctx); *p = n; /* length of encoded point */ /* Encoded point will be copied here */ p += 1; /* copy the point */ memcpy((unsigned char *)p, encodedPoint, n); /* increment n to account for length field */ n += 1; } /* Free allocated memory */ BN_CTX_free(bn_ctx); if (encodedPoint != NULL) OPENSSL_free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); } #endif /* !OPENSSL_NO_ECDH */ else { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } *(d++)=SSL3_MT_CLIENT_KEY_EXCHANGE; l2n3(n,d); s->state=SSL3_ST_CW_KEY_EXCH_B; /* number of bytes to write */ s->init_num=n+4; s->init_off=0; } /* SSL3_ST_CW_KEY_EXCH_B */ return(ssl3_do_write(s,SSL3_RT_HANDSHAKE)); err: #ifndef OPENSSL_NO_ECDH BN_CTX_free(bn_ctx); if (encodedPoint != NULL) OPENSSL_free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); #endif return(-1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393082, "input": "TEST_F(QueryPlannerTest, IndexBoundsIndexedSort) { addIndex(BSON(\"a\" << 1)); runQuerySortProj(fromjson(\"{$or: [{a: 1}, {a: 2}]}\"), BSON(\"a\" << 1), BSONObj()); assertNumSolutions(2U); assertSolutionExists( \"{sort: {pattern: {a:1}, limit: 0, node: {sortKeyGen: {node: \" \"{cscan: {filter: {$or:[{a:1},{a:2}]}, dir: 1}}}}}}\"); assertSolutionExists( \"{fetch: {filter: null, node: {ixscan: {filter: null, \" \"pattern: {a:1}, bounds: {a: [[1,1,true,true], [2,2,true,true]]}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 235720, "input": "void DoRealForwardFFT(OpKernelContext* ctx, uint64* fft_shape, const Tensor& in, Tensor* out) { // Create the axes (which are always trailing). const auto axes = Eigen::ArrayXi::LinSpaced(FFTRank, 1, FFTRank); auto device = ctx->eigen_device(); auto input = Tensor(in).flat_inner_dims(); const auto input_dims = input.dimensions(); // Slice input to fft_shape on its inner-most dimensions. Eigen::DSizes input_slice_sizes; input_slice_sizes[0] = input_dims[0]; TensorShape temp_shape{input_dims[0]}; for (int i = 1; i <= FFTRank; ++i) { input_slice_sizes[i] = fft_shape[i - 1]; temp_shape.AddDim(fft_shape[i - 1]); } OP_REQUIRES(ctx, temp_shape.num_elements() > 0, errors::InvalidArgument(\"Obtained a FFT shape of 0 elements: \", temp_shape.DebugString())); auto output = out->flat_inner_dims(); const Eigen::DSizes zero_start_indices; // Compute the full FFT using a temporary tensor. Tensor temp; OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::v(), temp_shape, &temp)); auto full_fft = temp.flat_inner_dims(); full_fft.device(device) = input.slice(zero_start_indices, input_slice_sizes) .template fft(axes); // Slice away the negative frequency components. output.device(device) = full_fft.slice(zero_start_indices, output.dimensions()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 382015, "input": "void CServer::CClient::Reset() { // reset input for(int i = 0; i < 200; i++) m_aInputs[i].m_GameTick = -1; m_CurrentInput = 0; mem_zero(&m_LatestInput, sizeof(m_LatestInput)); m_Snapshots.PurgeAll(); m_LastAckedSnapshot = -1; m_LastInputTick = -1; m_SnapRate = CClient::SNAPRATE_INIT; m_Score = 0; m_MapChunk = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412528, "input": "PHP_FUNCTION(quoted_printable_decode) { char *arg1, *str_in, *str_out; int arg1_len, i = 0, j = 0, k; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"s\", &arg1, &arg1_len) == FAILURE) { return; } if (arg1_len == 0) { /* shortcut */ RETURN_EMPTY_STRING(); } str_in = arg1; str_out = emalloc(arg1_len + 1); while (str_in[i]) { switch (str_in[i]) { case '=': if (str_in[i + 1] && str_in[i + 2] && isxdigit((int) str_in[i + 1]) && isxdigit((int) str_in[i + 2])) { str_out[j++] = (php_hex2int((int) str_in[i + 1]) << 4) + php_hex2int((int) str_in[i + 2]); i += 3; } else /* check for soft line break according to RFC 2045*/ { k = 1; while (str_in[i + k] && ((str_in[i + k] == 32) || (str_in[i + k] == 9))) { /* Possibly, skip spaces/tabs at the end of line */ k++; } if (!str_in[i + k]) { /* End of line reached */ i += k; } else if ((str_in[i + k] == 13) && (str_in[i + k + 1] == 10)) { /* CRLF */ i += k + 2; } else if ((str_in[i + k] == 13) || (str_in[i + k] == 10)) { /* CR or LF */ i += k + 1; } else { str_out[j++] = str_in[i++]; } } break; default: str_out[j++] = str_in[i++]; } } str_out[j] = '\\0'; RETVAL_STRINGL(str_out, j, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234481, "input": "static void ff_layout_read_record_layoutstats_start(struct rpc_task *task, struct nfs_pgio_header *hdr) { if (test_and_set_bit(NFS_IOHDR_STAT, &hdr->flags)) return; nfs4_ff_layout_stat_io_start_read(hdr->inode, FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), hdr->args.count, task->tk_start); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195719, "input": "GF_Err Media_CheckDataEntry(GF_MediaBox *mdia, u32 dataEntryIndex) { GF_DataEntryURLBox *entry; GF_DataMap *map; GF_Err e; if (!mdia || !dataEntryIndex || dataEntryIndex > gf_list_count(mdia->information->dataInformation->dref->child_boxes)) return GF_BAD_PARAM; entry = (GF_DataEntryURLBox*)gf_list_get(mdia->information->dataInformation->dref->child_boxes, dataEntryIndex - 1); if (!entry) return GF_ISOM_INVALID_FILE; if (entry->flags == 1) return GF_OK; //ok, not self contained, let's go for it... //we don't know what's a URN yet if (entry->type == GF_ISOM_BOX_TYPE_URN) return GF_NOT_SUPPORTED; if (mdia->mediaTrack->moov->mov->openMode == GF_ISOM_OPEN_WRITE) { e = gf_isom_datamap_new(entry->location, NULL, GF_ISOM_DATA_MAP_READ, &map); } else { e = gf_isom_datamap_new(entry->location, mdia->mediaTrack->moov->mov->fileName, GF_ISOM_DATA_MAP_READ, &map); } if (e) return e; gf_isom_datamap_del(map); return GF_OK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "Heap buffer overflow in the URL_GetProtocolType function in MP4Box in GPAC 1.0.1 allows attackers to cause a denial of service or execute arbitrary code via a crafted file.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-32137"}} -{"idx": 431939, "input": "static void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_remote_host_features *ev = (void *) skb->data; struct inquiry_entry *ie; struct hci_conn *conn; BT_DBG(\"%s\", hdev->name); hci_dev_lock(hdev); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); if (conn) memcpy(conn->features[1], ev->features, 8); ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); if (ie) ie->data.ssp_mode = (ev->features[0] & LMP_HOST_SSP); hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506491, "input": "screendump_command() { c_token++; #ifdef _WIN32 screen_dump(); #else fputs(\"screendump not implemented\\n\", stderr); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 275427, "input": "GF_Err gf_isom_track_cenc_add_sample_info(GF_ISOFile *the_file, u32 trackNumber, u32 container_type, u8 *buf, u32 len, Bool use_subsamples, Bool use_saio_32bit, Bool use_multikey) { GF_SampleEncryptionBox *senc; GF_CENCSampleAuxInfo *sai; GF_SampleTableBox *stbl; GF_TrackBox *trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak) return GF_BAD_PARAM; stbl = trak->Media->information->sampleTable; if (!stbl) return GF_BAD_PARAM; switch (container_type) { case GF_ISOM_BOX_UUID_PSEC: case GF_ISOM_BOX_TYPE_SENC: case 0: senc = trak->sample_encryption; break; default: return GF_NOT_SUPPORTED; } if (len && buf) { GF_SAFEALLOC(sai, GF_CENCSampleAuxInfo); if (!sai) return GF_OUT_OF_MEM; sai->cenc_data_size = len; sai->cenc_data = gf_malloc(sizeof(u8) * len); if (!sai->cenc_data) { gf_free(sai); return GF_OUT_OF_MEM; } memcpy(sai->cenc_data, buf, len); gf_list_add(senc->samp_aux_info, sai); } else { GF_SAFEALLOC(sai, GF_CENCSampleAuxInfo); if (!sai) return GF_OUT_OF_MEM; gf_list_add(senc->samp_aux_info, sai); sai->isNotProtected = 1; } if (use_subsamples) senc->flags = 0x00000002; if (use_multikey) senc->version = 1; #ifndef GPAC_DISABLE_ISOM_FRAGMENTS gf_isom_cenc_set_saiz_saio(senc, stbl, NULL, sai->cenc_data_size, use_saio_32bit, use_multikey); #endif return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437630, "input": "static u64 svm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc) { struct vmcb *vmcb = get_host_vmcb(to_svm(vcpu)); return vmcb->control.tsc_offset + svm_scale_tsc(vcpu, host_tsc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230518, "input": "int CLua::execstring(const char *s, const char *context, int nresults) { int err = 0; if ((err = loadstring(s, context))) return err; lua_State *ls = state(); lua_call_throttle strangler(this); err = lua_pcall(ls, 0, nresults, 0); set_error(err, ls); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346409, "input": "ZERO_CHAIN(struct evbuffer *dst) { ASSERT_EVBUFFER_LOCKED(dst); dst->first = NULL; dst->last = NULL; dst->last_with_datap = &(dst)->first; dst->total_len = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357320, "input": "static OPJ_BOOL opj_j2k_destroy_header_memory(opj_j2k_t * p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) { /* preconditions */ assert(p_j2k != 00); assert(p_stream != 00); assert(p_manager != 00); OPJ_UNUSED(p_stream); OPJ_UNUSED(p_manager); if (p_j2k->m_specific_param.m_encoder.m_header_tile_data) { opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data); p_j2k->m_specific_param.m_encoder.m_header_tile_data = 0; } p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0; return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 374681, "input": "static void power_pmu_sched_task(struct perf_event_context *ctx, bool sched_in) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 520952, "input": "static Jsi_RC jsi_ValueToIniVal(Jsi_Interp *interp, Jsi_OptionSpec* spec, Jsi_Value *inValue, const char *inStr, void *record, Jsi_Wide flags) { if (inStr) return JSI_ERROR; uchar *data = (uchar*)record, *odata; //Jsi_OptionValue iv; int idx = (intptr_t)spec->data; if (idx<=0 || !inValue) return Jsi_LogError(\"idx/value not set\"); Jsi_OptionSpec *typePtr = spec-idx; if (typePtr->id != JSI_OPTION_CUSTOM || typePtr->custom != &jsi_OptSwitchFieldType) return Jsi_LogError(\"Bad field type\"); const Jsi_OptionTypedef **tsp = (typeof(tsp))(data + typePtr->offset), *tsptr = *tsp, *ssp; SIGASSERT(tsptr, TYPEDEF); Jsi_FieldSpec *sf = jsi_csGetFieldSpec(data); Jsi_StructSpec *sl = jsi_csGetStructSpec(sf->extData); ssp = sl->type; SIGASSERT(ssp, TYPEDEF); odata = ssp->extra; if (!tsptr->sfmt) { if (tsptr->flags&jsi_CTYP_STRUCT && tsptr->extra) { if (!Jsi_ValueIsBoolean(interp, inValue)) Jsi_LogWarn(\"init for struct must be boolean\"); if (!Jsi_ValueIsTrue(interp, inValue)) return JSI_OK; Jsi_StructSpec *tsl = jsi_csGetStructSpec(tsptr->extData); int i, n = (sf->arrSize?sf->arrSize:1); for (i=0; ioffset+i*tsl->size, tsptr->extra, tsl->size); return JSI_OK; } else if (!(tsptr->flags&jsi_CTYP_ENUM)) return Jsi_LogError(\"init not supported for type: %s\", tsptr->cName); } return jsi_SetOption(interp, sf, \"init\", odata, inValue, flags, interp->isSafe); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219523, "input": "static String exif_get_sectionname(int section) { switch(section) { case SECTION_FILE: return s_FILE; case SECTION_COMPUTED: return s_COMPUTED; case SECTION_ANY_TAG: return s_ANY_TAG; case SECTION_IFD0: return s_IFD0; case SECTION_THUMBNAIL: return s_THUMBNAIL; case SECTION_COMMENT: return s_COMMENT; case SECTION_APP0: return s_APP0; case SECTION_EXIF: return s_EXIF; case SECTION_FPIX: return s_FPIX; case SECTION_GPS: return s_GPS; case SECTION_INTEROP: return s_INTEROP; case SECTION_APP12: return s_APP12; case SECTION_WINXP: return s_WINXP; case SECTION_MAKERNOTE: return s_MAKERNOTE; } return empty_string(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448690, "input": "void clear_context_free(CLEAR_CONTEXT* clear) { int i; if (!clear) return; nsc_context_free(clear->nsc); free(clear->TempBuffer); for (i = 0; i < 4000; i++) free(clear->GlyphCache[i].pixels); for (i = 0; i < 32768; i++) free(clear->VBarStorage[i].pixels); for (i = 0; i < 16384; i++) free(clear->ShortVBarStorage[i].pixels); free(clear); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509270, "input": "void set_null_ref_table() { if (!view->is_inner_table_of_outer_join() || !(null_ref_table= view->get_real_join_table())) null_ref_table= NO_NULL_TABLE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385765, "input": "MagickExport Image *AddNoiseImageChannel(const Image *image, const ChannelType channel,const NoiseType noise_type,ExceptionInfo *exception) { #define AddNoiseImageTag \"AddNoise/Image\" CacheView *image_view, *noise_view; const char *option; double attenuate; Image *noise_image; MagickBooleanType status; MagickOffsetType progress; RandomInfo **magick_restrict random_info; ssize_t y; #if defined(MAGICKCORE_OPENMP_SUPPORT) unsigned long key; #endif /* Initialize noise image attributes. */ assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); #if defined(MAGICKCORE_OPENCL_SUPPORT) noise_image=AccelerateAddNoiseImage(image,channel,noise_type,exception); if (noise_image != (Image *) NULL) return(noise_image); #endif noise_image=CloneImage(image,0,0,MagickTrue,exception); if (noise_image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(noise_image,DirectClass) == MagickFalse) { InheritException(exception,&noise_image->exception); noise_image=DestroyImage(noise_image); return((Image *) NULL); } /* Add noise in each row. */ attenuate=1.0; option=GetImageArtifact(image,\"attenuate\"); if (option != (char *) NULL) attenuate=StringToDouble(option,(char **) NULL); status=MagickTrue; progress=0; random_info=AcquireRandomInfoThreadSet(); image_view=AcquireVirtualCacheView(image,exception); noise_view=AcquireAuthenticCacheView(noise_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) key=GetRandomSecretKey(random_info[0]); #pragma omp parallel for schedule(static) shared(progress,status) \\ magick_number_threads(image,noise_image,image->rows,key == ~0UL) #endif for (y=0; y < (ssize_t) image->rows; y++) { const int id = GetOpenMPThreadId(); MagickBooleanType sync; const IndexPacket *magick_restrict indexes; const PixelPacket *magick_restrict p; IndexPacket *magick_restrict noise_indexes; ssize_t x; PixelPacket *magick_restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); q=GetCacheViewAuthenticPixels(noise_view,0,y,noise_image->columns,1, exception); if ((p == (PixelPacket *) NULL) || (q == (PixelPacket *) NULL)) { status=MagickFalse; continue; } indexes=GetCacheViewVirtualIndexQueue(image_view); noise_indexes=GetCacheViewAuthenticIndexQueue(noise_view); for (x=0; x < (ssize_t) image->columns; x++) { if ((channel & RedChannel) != 0) SetPixelRed(q,ClampToQuantum(GenerateDifferentialNoise(random_info[id], GetPixelRed(p),noise_type,attenuate))); if (IsGrayColorspace(image->colorspace) != MagickFalse) { SetPixelGreen(q,GetPixelRed(q)); SetPixelBlue(q,GetPixelRed(q)); } else { if ((channel & GreenChannel) != 0) SetPixelGreen(q,ClampToQuantum(GenerateDifferentialNoise( random_info[id],GetPixelGreen(p),noise_type,attenuate))); if ((channel & BlueChannel) != 0) SetPixelBlue(q,ClampToQuantum(GenerateDifferentialNoise( random_info[id],GetPixelBlue(p),noise_type,attenuate))); } if ((channel & OpacityChannel) != 0) SetPixelOpacity(q,ClampToQuantum(GenerateDifferentialNoise( random_info[id],GetPixelOpacity(p),noise_type,attenuate))); if (((channel & IndexChannel) != 0) && (image->colorspace == CMYKColorspace)) SetPixelIndex(noise_indexes+x,ClampToQuantum( GenerateDifferentialNoise(random_info[id],GetPixelIndex( indexes+x),noise_type,attenuate))); p++; q++; } sync=SyncCacheViewAuthenticPixels(noise_view,exception); if (sync == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,AddNoiseImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } noise_view=DestroyCacheView(noise_view); image_view=DestroyCacheView(image_view); random_info=DestroyRandomInfoThreadSet(random_info); if (status == MagickFalse) noise_image=DestroyImage(noise_image); return(noise_image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461629, "input": "static void rsi_register_rates_channels(struct rsi_hw *adapter, int band) { struct ieee80211_supported_band *sbands = &adapter->sbands[band]; void *channels = NULL; if (band == NL80211_BAND_2GHZ) { channels = kmalloc(sizeof(rsi_2ghz_channels), GFP_KERNEL); memcpy(channels, rsi_2ghz_channels, sizeof(rsi_2ghz_channels)); sbands->band = NL80211_BAND_2GHZ; sbands->n_channels = ARRAY_SIZE(rsi_2ghz_channels); sbands->bitrates = rsi_rates; sbands->n_bitrates = ARRAY_SIZE(rsi_rates); } else { channels = kmalloc(sizeof(rsi_5ghz_channels), GFP_KERNEL); memcpy(channels, rsi_5ghz_channels, sizeof(rsi_5ghz_channels)); sbands->band = NL80211_BAND_5GHZ; sbands->n_channels = ARRAY_SIZE(rsi_5ghz_channels); sbands->bitrates = &rsi_rates[4]; sbands->n_bitrates = ARRAY_SIZE(rsi_rates) - 4; } sbands->channels = channels; memset(&sbands->ht_cap, 0, sizeof(struct ieee80211_sta_ht_cap)); sbands->ht_cap.ht_supported = true; sbands->ht_cap.cap = (IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40); sbands->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K; sbands->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; sbands->ht_cap.mcs.rx_mask[0] = 0xff; sbands->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; /* sbands->ht_cap.mcs.rx_highest = 0x82; */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 456517, "input": "static int check_helper_mem_access(struct bpf_verifier_env *env, int regno, int access_size, bool zero_size_allowed, struct bpf_call_arg_meta *meta) { struct bpf_reg_state *regs = cur_regs(env), *reg = ®s[regno]; switch (reg->type) { case PTR_TO_PACKET: case PTR_TO_PACKET_META: return check_packet_access(env, regno, reg->off, access_size, zero_size_allowed); case PTR_TO_MAP_VALUE: if (check_map_access_type(env, regno, reg->off, access_size, meta && meta->raw_mode ? BPF_WRITE : BPF_READ)) return -EACCES; return check_map_access(env, regno, reg->off, access_size, zero_size_allowed); case PTR_TO_MEM: return check_mem_region_access(env, regno, reg->off, access_size, reg->mem_size, zero_size_allowed); case PTR_TO_RDONLY_BUF: if (meta && meta->raw_mode) return -EACCES; return check_buffer_access(env, reg, regno, reg->off, access_size, zero_size_allowed, \"rdonly\", &env->prog->aux->max_rdonly_access); case PTR_TO_RDWR_BUF: return check_buffer_access(env, reg, regno, reg->off, access_size, zero_size_allowed, \"rdwr\", &env->prog->aux->max_rdwr_access); case PTR_TO_STACK: return check_stack_boundary(env, regno, access_size, zero_size_allowed, meta); default: /* scalar_value or invalid ptr */ /* Allow zero-byte read from NULL, regardless of pointer type */ if (zero_size_allowed && access_size == 0 && register_is_null(reg)) return 0; verbose(env, \"R%d type=%s expected=%s\\n\", regno, reg_type_str[reg->type], reg_type_str[PTR_TO_STACK]); return -EACCES; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338625, "input": "static int io_iopoll_check(struct io_ring_ctx *ctx, long min) { unsigned int nr_events = 0; int ret = 0; /* * We disallow the app entering submit/complete with polling, but we * still need to lock the ring to prevent racing with polled issue * that got punted to a workqueue. */ mutex_lock(&ctx->uring_lock); /* * Don't enter poll loop if we already have events pending. * If we do, we can potentially be spinning for commands that * already triggered a CQE (eg in error). */ if (test_bit(0, &ctx->cq_check_overflow)) __io_cqring_overflow_flush(ctx, false); if (io_cqring_events(ctx)) goto out; do { /* * If a submit got punted to a workqueue, we can have the * application entering polling for a command before it gets * issued. That app will hold the uring_lock for the duration * of the poll right here, so we need to take a breather every * now and then to ensure that the issue has a chance to add * the poll to the issued list. Otherwise we can spin here * forever, while the workqueue is stuck trying to acquire the * very same mutex. */ if (list_empty(&ctx->iopoll_list)) { mutex_unlock(&ctx->uring_lock); io_run_task_work(); mutex_lock(&ctx->uring_lock); if (list_empty(&ctx->iopoll_list)) break; } ret = io_do_iopoll(ctx, &nr_events, min); } while (!ret && nr_events < min && !need_resched()); out: mutex_unlock(&ctx->uring_lock); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376250, "input": "int url_is_local_not_ssh(const char *url) { const char *colon = strchr(url, ':'); const char *slash = strchr(url, '/'); return !colon || (slash && slash < colon) || (has_dos_drive_prefix(url) && is_valid_path(url)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244397, "input": "void PrintDASHUsage() { u32 i=0; gf_sys_format_help(helpout, help_flags, \"# DASH Options\\n\" \"Also see:\\n\" \"- the [dasher `gpac -h dash`](dasher) filter documentation\\n\" \"- [[online DASH Intro doc|DASH Introduction]].\\n\" \"\\n\" \"# Specifying input files\\n\" \"Input media files to dash can use the following modifiers\\n\" \"- #trackID=N: only use the track ID N from the source file\\n\" \"- #N: only use the track ID N from the source file (mapped to [-tkid](mp4dmx))\\n\" \"- #video: only use the first video track from the source file\\n\" \"- #audio: only use the first audio track from the source file\\n\" \"- :id=NAME: set the representation ID to NAME. Reserved value `NULL` disables representation ID for multiplexed inputs\\n\" \"- :dur=VALUE: process VALUE seconds from the media. If VALUE is longer than media duration, last sample duration is extended.\\n\" \"- :period=NAME: set the representation's period to NAME. Multiple periods may be used. Periods appear in the MPD in the same order as specified with this option\\n\" \"- :BaseURL=NAME: set the BaseURL. Set multiple times for multiple BaseURLs\\nWarning: This does not modify generated files location (see segment template).\\n\" \"- :bandwidth=VALUE: set the representation's bandwidth to a given value\\n\" \"- :pdur=VALUE: increase the duration of this period by the given duration in seconds (alias for period_duration:VALUE). This is only used when no input media is specified (remote period insertion), eg `:period=X:xlink=Z:pdur=Y`\\n\" \"- :duration=VALUE: override target DASH segment duration for this input\\n\" \"- :xlink=VALUE: set the xlink value for the period containing this element. Only the xlink declared on the first rep of a period will be used\\n\" \"- :asID=VALUE: set the AdaptationSet ID to NAME\\n\" \"- :role=VALUE: set the role of this representation (cf DASH spec). Media with different roles belong to different adaptation sets.\\n\" \"- :desc_p=VALUE: add a descriptor at the Period level. Value must be a properly formatted XML element.\\n\" \"- :desc_as=VALUE: add a descriptor at the AdaptationSet level. Value must be a properly formatted XML element. Two input files with different values will be in different AdaptationSet elements.\\n\" \"- :desc_as_c=VALUE: add a descriptor at the AdaptationSet level. Value must be a properly formatted XML element. Value is ignored while creating AdaptationSet elements.\\n\" \"- :desc_rep=VALUE: add a descriptor at the Representation level. Value must be a properly formatted XML element. Value is ignored while creating AdaptationSet elements.\\n\" \"- :sscale: force movie timescale to match media timescale of the first track in the segment.\\n\" \"- :trackID=N: only use the track ID N from the source file\\n\" \"- @@f1[:args][@@fN:args]: set a filter chain to insert between the source and the dasher. Each filter in the chain is formatted as a regular filter, see [filter doc `gpac -h doc`](filters_general). If several filters are set, they will be chained in the given order.\\n\" \"\\n\" \"Note: `@@f` must be placed after all other options.\\n\" \"\\n\" \"# Options\\n\" ); while (m4b_dash_args[i].name) { GF_GPACArg *arg = &m4b_dash_args[i]; i++; gf_sys_print_arg(helpout, help_flags, arg, \"mp4box-dash\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211709, "input": "static int __init lp_setup (char *str) { static int parport_ptr; int x; if (get_option(&str, &x)) { if (x == 0) { /* disable driver on \"lp=\" or \"lp=0\" */ parport_nr[0] = LP_PARPORT_OFF; } else { printk(KERN_WARNING \"warning: 'lp=0x%x' is deprecated, ignored\\n\", x); return 0; } } else if (!strncmp(str, \"parport\", 7)) { int n = simple_strtoul(str+7, NULL, 10); if (parport_ptr < LP_NO) parport_nr[parport_ptr++] = n; else printk(KERN_INFO \"lp: too many ports, %s ignored.\\n\", str); } else if (!strcmp(str, \"auto\")) { parport_nr[0] = LP_PARPORT_AUTO; } else if (!strcmp(str, \"none\")) { parport_nr[parport_ptr++] = LP_PARPORT_NONE; } else if (!strcmp(str, \"reset\")) { reset = 1; } return 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "Linux drivers/char/lp.c Out-of-Bounds Write. Due to a missing bounds check, and the fact that parport_ptr integer is static, a 'secure boot' kernel command line adversary (can happen due to bootloader vulns, e.g. Google Nexus 6's CVE-2016-10277, where due to a vulnerability the adversary has partial control over the command line) can overflow the parport_nr array in the following code, by appending many (>LP_NO) 'lp=none' arguments to the command line.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2017-1000363"}} -{"idx": 269771, "input": "bool WebContents::SendIPCMessageWithSender(bool internal, bool send_to_all, const std::string& channel, blink::CloneableMessage args, int32_t sender_id) { std::vector target_hosts; if (!send_to_all) { auto* frame_host = web_contents()->GetMainFrame(); if (frame_host) { target_hosts.push_back(frame_host); } } else { target_hosts = web_contents()->GetAllFrames(); } for (auto* frame_host : target_hosts) { mojo::AssociatedRemote electron_renderer; frame_host->GetRemoteAssociatedInterfaces()->GetInterface( &electron_renderer); electron_renderer->Message(internal, false, channel, args.ShallowClone(), sender_id); } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508576, "input": "int JOIN::rollup_send_data(uint idx) { uint i; for (i= send_group_parts ; i-- > idx ; ) { int res= 0; /* Get reference pointers to sum functions in place */ copy_ref_ptr_array(ref_ptrs, rollup.ref_pointer_arrays[i]); if ((!having || having->val_int())) { if (send_records < unit->select_limit_cnt && do_send_rows && (res= result->send_data(rollup.fields[i])) > 0) return 1; if (!res) send_records++; } } /* Restore ref_pointer_array */ set_items_ref_array(current_ref_ptrs); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422549, "input": "TEST(BitTestMatchExpression, MatchLongWithBinaryBitMask) { const char* bitMaskSet = \"\\x36\\x00\\x00\\x00\"; const char* bitMaskClear = \"\\xC9\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\"; BSONObj match = fromjson(\"{a: 54}\"); BitsAllSetMatchExpression balls(\"a\", bitMaskSet, 4); BitsAllClearMatchExpression ballc(\"a\", bitMaskClear, 9); BitsAnySetMatchExpression banys(\"a\", bitMaskSet, 4); BitsAnyClearMatchExpression banyc(\"a\", bitMaskClear, 9); ASSERT(balls.matchesSingleElement(match[\"a\"])); ASSERT(ballc.matchesSingleElement(match[\"a\"])); ASSERT(banys.matchesSingleElement(match[\"a\"])); ASSERT(banyc.matchesSingleElement(match[\"a\"])); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409214, "input": "static struct uvc_streaming *uvc_stream_new(struct uvc_device *dev, struct usb_interface *intf) { struct uvc_streaming *stream; stream = kzalloc(sizeof(*stream), GFP_KERNEL); if (stream == NULL) return NULL; mutex_init(&stream->mutex); stream->dev = dev; stream->intf = usb_get_intf(intf); stream->intfnum = intf->cur_altsetting->desc.bInterfaceNumber; /* Allocate a stream specific work queue for asynchronous tasks. */ stream->async_wq = alloc_workqueue(\"uvcvideo\", WQ_UNBOUND | WQ_HIGHPRI, 0); if (!stream->async_wq) { uvc_stream_delete(stream); return NULL; } return stream; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 483011, "input": "enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream) { enum dc_status result = DC_OK; #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT result = remove_dsc_from_stream_resource(dc, new_ctx, dc_stream); #endif return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 231583, "input": "TEST(Config, AlreadyExists) { QTemporaryDir dir; WriteConfig(dir.path()); Process p(ZNC_BIN_DIR \"/znc\", QStringList() << \"--debug\" << \"--datadir\" << dir.path() << \"--makeconf\"); p.ReadUntil(\"already exists\"); p.CanDie(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198443, "input": "void LanLinkProvider::dataReceived() { QSslSocket* socket = qobject_cast(sender()); #if QT_VERSION < QT_VERSION_CHECK(5,7,0) if (!socket->canReadLine()) return; #else socket->startTransaction(); #endif const QByteArray data = socket->readLine(); qCDebug(KDECONNECT_CORE) << \"LanLinkProvider received reply:\" << data; NetworkPacket* np = new NetworkPacket(QLatin1String(\"\")); bool success = NetworkPacket::unserialize(data, np); #if QT_VERSION < QT_VERSION_CHECK(5,7,0) if (!success) { delete np; return; } #else if (!success) { delete np; socket->rollbackTransaction(); return; } socket->commitTransaction(); #endif if (np->type() != PACKET_TYPE_IDENTITY) { qCWarning(KDECONNECT_CORE) << \"LanLinkProvider/newConnection: Expected identity, received \" << np->type(); delete np; return; } // Needed in \"encrypted\" if ssl is used, similar to \"tcpSocketConnected\" m_receivedIdentityPackets[socket].np = np; const QString& deviceId = np->get(QStringLiteral(\"deviceId\")); //qCDebug(KDECONNECT_CORE) << \"Handshaking done (i'm the new device)\"; //This socket will now be owned by the LanDeviceLink or we don't want more data to be received, forget about it disconnect(socket, &QIODevice::readyRead, this, &LanLinkProvider::dataReceived); if (np->get(QStringLiteral(\"protocolVersion\")) >= MIN_VERSION_WITH_SSL_SUPPORT) { bool isDeviceTrusted = KdeConnectConfig::instance().trustedDevices().contains(deviceId); configureSslSocket(socket, deviceId, isDeviceTrusted); qCDebug(KDECONNECT_CORE) << \"Starting client ssl (but I'm the server TCP socket)\"; connect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted); if (isDeviceTrusted) { connect(socket, QOverload &>::of(&QSslSocket::sslErrors), this, &LanLinkProvider::sslErrors); } socket->startClientEncryption(); } else { qWarning() << np->get(QStringLiteral(\"deviceName\")) << \"uses an old protocol version, this won't work\"; //addLink(deviceId, socket, np, LanDeviceLink::Locally); delete m_receivedIdentityPackets.take(socket).np; } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "In kdeconnect-kde (aka KDE Connect) before 20.08.2, an attacker on the local network could send crafted packets that trigger use of large amounts of CPU, memory, or network connection slots, aka a Denial of Service attack.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2020-26164"}} -{"idx": 431149, "input": "static void nfs4_xdr_enc_setattr(struct rpc_rqst *req, struct xdr_stream *xdr, const void *data) { const struct nfs_setattrargs *args = data; struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_setattr(xdr, args, args->server, &hdr); encode_getfattr(xdr, args->bitmask, &hdr); encode_nops(&hdr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509258, "input": "bool walk(Item_processor processor, bool walk_subquery, void *arg) { return orig_item->walk(processor, walk_subquery, arg) || (this->*processor)(arg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246138, "input": "static void addWhereTerm( Parse *pParse, /* Parsing context */ SrcList *pSrc, /* List of tables in FROM clause */ int iLeft, /* Index of first table to join in pSrc */ int iColLeft, /* Index of column in first table */ int iRight, /* Index of second table in pSrc */ int iColRight, /* Index of column in second table */ int isOuterJoin, /* True if this is an OUTER join */ Expr **ppWhere /* IN/OUT: The WHERE clause to add to */ ){ sqlite3 *db = pParse->db; Expr *pE1; Expr *pE2; Expr *pEq; assert( iLeftnSrc>iRight ); assert( pSrc->a[iLeft].pTab ); assert( pSrc->a[iRight].pTab ); pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft); pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight); pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2); if( pEq && isOuterJoin ){ ExprSetProperty(pEq, EP_FromJoin); assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(pEq, EP_NoReduce); pEq->iRightJoinTable = (i16)pE2->iTable; } *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 278007, "input": "has_compl_option(int dict_opt) { if (dict_opt ? (*curbuf->b_p_dict == NUL && *p_dict == NUL #ifdef FEAT_SPELL && !curwin->w_p_spell #endif ) : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL #ifdef FEAT_COMPL_FUNC && *curbuf->b_p_tsrfu == NUL && *p_tsrfu == NUL #endif )) { ctrl_x_mode = CTRL_X_NORMAL; edit_submode = NULL; msg_attr(dict_opt ? _(\"'dictionary' option is empty\") : _(\"'thesaurus' option is empty\"), HL_ATTR(HLF_E)); if (emsg_silent == 0 && !in_assert_fails) { vim_beep(BO_COMPL); setcursor(); out_flush(); #ifdef FEAT_EVAL if (!get_vim_var_nr(VV_TESTING)) #endif ui_delay(2004L, FALSE); } return FALSE; } return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519652, "input": "XMLNode::has_property_with_value (const string& name, const string& value) const { XMLPropertyConstIterator iter = _proplist.begin(); while (iter != _proplist.end()) { if ((*iter)->name() == name && (*iter)->value() == value) { return true; } ++iter; } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508657, "input": "int test_if_item_cache_changed(List &list) { DBUG_ENTER(\"test_if_item_cache_changed\"); List_iterator li(list); int idx= -1,i; Cached_item *buff; for (i=(int) list.elements-1 ; (buff=li++) ; i--) { if (buff->cmp()) idx=i; } DBUG_PRINT(\"info\", (\"idx: %d\", idx)); DBUG_RETURN(idx); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422606, "input": "TEST(GtOp, MatchesMinKey) { BSONObj operand = BSON(\"a\" << MinKey); GTMatchExpression gt(\"a\", operand[\"a\"]); BSONObj minKeyObj = BSON(\"a\" << MinKey); BSONObj maxKeyObj = BSON(\"a\" << MaxKey); BSONObj numObj = BSON(\"a\" << 4); ASSERT(!gt.matchesBSON(minKeyObj, NULL)); ASSERT(gt.matchesBSON(maxKeyObj, NULL)); ASSERT(gt.matchesBSON(numObj, NULL)); ASSERT(!gt.matchesSingleElement(minKeyObj.firstElement())); ASSERT(gt.matchesSingleElement(maxKeyObj.firstElement())); ASSERT(gt.matchesSingleElement(numObj.firstElement())); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461581, "input": "static void emit_insn_suffix(u8 **pprog, u32 ptr_reg, u32 val_reg, int off) { u8 *prog = *pprog; int cnt = 0; if (is_imm8(off)) { /* 1-byte signed displacement. * * If off == 0 we could skip this and save one extra byte, but * special case of x86 R13 which always needs an offset is not * worth the hassle */ EMIT2(add_2reg(0x40, ptr_reg, val_reg), off); } else { /* 4-byte signed displacement */ EMIT1_off32(add_2reg(0x80, ptr_reg, val_reg), off); } *pprog = prog; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232190, "input": "static void chop_prompt (const char *filename, char *tmp, size_t max_tmp_size) { size_t tmp_len, file_len; unsigned int OTHRSCH = 3; const char DOTS[] = \"...\"; int w, p_len; w = r_cons_get_size (NULL); file_len = strlen (filename); tmp_len = strlen (tmp); p_len = R_MAX (0, w - 6); if (file_len + tmp_len + OTHRSCH >= p_len) { size_t dots_size = sizeof (DOTS); size_t chop_point = (size_t)(p_len - OTHRSCH - file_len - dots_size - 1); if (chop_point < (max_tmp_size - dots_size - 1)) { tmp[chop_point] = '\\0'; strncat (tmp, DOTS, dots_size); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398134, "input": "static int sctp_setsockopt_initmsg(struct sock *sk, struct sctp_initmsg *sinit, unsigned int optlen) { struct sctp_sock *sp = sctp_sk(sk); if (optlen != sizeof(struct sctp_initmsg)) return -EINVAL; if (sinit->sinit_num_ostreams) sp->initmsg.sinit_num_ostreams = sinit->sinit_num_ostreams; if (sinit->sinit_max_instreams) sp->initmsg.sinit_max_instreams = sinit->sinit_max_instreams; if (sinit->sinit_max_attempts) sp->initmsg.sinit_max_attempts = sinit->sinit_max_attempts; if (sinit->sinit_max_init_timeo) sp->initmsg.sinit_max_init_timeo = sinit->sinit_max_init_timeo; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421801, "input": "print_lan_set_defgw_usage(void) { lprintf(LOG_NOTICE, \"LAN set default gateway Commands: ipaddr, macaddr\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197806, "input": "ImmutableConstantOp::ImmutableConstantOp(OpKernelConstruction* context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr(kMemoryRegionNameAttr, ®ion_name_)); OP_REQUIRES_OK(context, context->GetAttr(kDTypeAttr, &dtype_)); OP_REQUIRES_OK(context, context->GetAttr(kShapeAttr, &shape_)); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. Calling `tf.raw_ops.ImmutableConst`(https://www.tensorflow.org/api_docs/python/tf/raw_ops/ImmutableConst) with a `dtype` of `tf.resource` or `tf.variant` results in a segfault in the implementation as code assumes that the tensor contents are pure scalars. We have patched the issue in 4f663d4b8f0bec1b48da6fa091a7d29609980fa4 and will release TensorFlow 2.5.0 containing the patch. TensorFlow nightly packages after this commit will also have the issue resolved. If using `tf.raw_ops.ImmutableConst` in code, you can prevent the segfault by inserting a filter for the `dtype` argument.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2021-29539"}} -{"idx": 219606, "input": "bool HHVM_FUNCTION(imagecopymergegray, const Resource& dst_im, const Resource& src_im, int64_t dst_x, int64_t dst_y, int64_t src_x, int64_t src_y, int64_t src_w, int64_t src_h, int64_t pct) { gdImagePtr im_src = cast(src_im)->get(); if (!im_src) return false; gdImagePtr im_dst = cast(dst_im)->get(); if (!im_dst) return false; gdImageCopyMergeGray(im_dst, im_src, dst_x, dst_y, src_x, src_y, src_w, src_h, pct); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379522, "input": "execute_subshell_builtin_or_function (words, redirects, builtin, var, pipe_in, pipe_out, async, fds_to_close, flags) WORD_LIST *words; REDIRECT *redirects; sh_builtin_func_t *builtin; SHELL_VAR *var; int pipe_in, pipe_out, async; struct fd_bitmap *fds_to_close; int flags; { int result, r, funcvalue; #if defined (JOB_CONTROL) int jobs_hack; jobs_hack = (builtin == jobs_builtin) && ((subshell_environment & SUBSHELL_ASYNC) == 0 || pipe_out != NO_PIPE); #endif /* A subshell is neither a login shell nor interactive. */ login_shell = interactive = 0; if (async) subshell_environment |= SUBSHELL_ASYNC; if (pipe_in != NO_PIPE || pipe_out != NO_PIPE) subshell_environment |= SUBSHELL_PIPE; maybe_make_export_env (); /* XXX - is this needed? */ #if defined (JOB_CONTROL) /* Eradicate all traces of job control after we fork the subshell, so all jobs begun by this subshell are in the same process group as the shell itself. */ /* Allow the output of `jobs' to be piped. */ if (jobs_hack) kill_current_pipeline (); else without_job_control (); set_sigchld_handler (); #endif /* JOB_CONTROL */ set_sigint_handler (); if (fds_to_close) close_fd_bitmap (fds_to_close); do_piping (pipe_in, pipe_out); if (do_redirections (redirects, RX_ACTIVE) != 0) exit (EXECUTION_FAILURE); if (builtin) { /* Give builtins a place to jump back to on failure, so we don't go back up to main(). */ result = setjmp (top_level); /* Give the return builtin a place to jump to when executed in a subshell or pipeline */ funcvalue = 0; if (return_catch_flag && builtin == return_builtin) funcvalue = setjmp (return_catch); if (result == EXITPROG) exit (last_command_exit_value); else if (result) exit (EXECUTION_FAILURE); else if (funcvalue) exit (return_catch_value); else { r = execute_builtin (builtin, words, flags, 1); fflush (stdout); if (r == EX_USAGE) r = EX_BADUSAGE; exit (r); } } else { r = execute_function (var, words, flags, fds_to_close, async, 1); fflush (stdout); exit (r); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198110, "input": "void Compute(OpKernelContext* context) override { const Tensor& x = context->input(0); const Tensor& y = context->input(1); const float min_x = context->input(2).flat()(0); const float max_x = context->input(3).flat()(0); const float min_y = context->input(4).flat()(0); const float max_y = context->input(5).flat()(0); BCast bcast(BCast::FromShape(x.shape()), BCast::FromShape(y.shape())); if (!bcast.IsValid()) { context->SetStatus(errors::InvalidArgument( \"Incompatible shapes: \", x.shape().DebugString(), \" vs. \", y.shape().DebugString())); return; } Tensor* z; OP_REQUIRES_OK(context, context->allocate_output( 0, BCast::ToShape(bcast.output_shape()), &z)); // Make sure that we have valid quantization ranges for the input buffers. // If the difference between the min and max is negative or zero, it makes // it hard to do meaningful intermediate operations on the values. OP_REQUIRES(context, (max_x > min_x), errors::InvalidArgument(\"max_x must be larger than min_a.\")); OP_REQUIRES(context, (max_y > min_y), errors::InvalidArgument(\"max_x must be larger than min_b.\")); const int32 offset_x = FloatToQuantizedUnclamped(0.0f, min_x, max_x); const int32 offset_y = FloatToQuantizedUnclamped(0.0f, min_y, max_y); const T* x_data = x.flat().data(); const T* y_data = y.flat().data(); Toutput* z_data = z->flat().data(); const int ndims = bcast.x_reshape().size(); if (ndims <= 1) { if (x.NumElements() == 1) { ScalarMultiply(context, y_data, offset_y, y.NumElements(), x_data[0], offset_x, z_data); } else if (y.NumElements() == 1) { ScalarMultiply(context, x_data, offset_x, x.NumElements(), y_data[0], offset_y, z_data); } else { VectorMultiply(context, x_data, offset_x, y_data, offset_y, x.NumElements(), z_data); } } else if (ndims == 2) { const T* vector_data; int64 vector_num_elements; int32 vector_offset; const T* tensor_data; int64 tensor_num_elements; int32 tensor_offset; if (x.NumElements() < y.NumElements()) { vector_data = x_data; vector_num_elements = x.NumElements(); vector_offset = offset_x; tensor_data = y_data; tensor_num_elements = y.NumElements(); tensor_offset = offset_y; } else { vector_data = y_data; vector_num_elements = y.NumElements(); vector_offset = offset_y; tensor_data = x_data; tensor_num_elements = x.NumElements(); tensor_offset = offset_x; } if (vector_num_elements == 0) { context->SetStatus( errors::InvalidArgument(\"vector must have at least 1 element\")); return; } VectorTensorMultiply( vector_data, vector_offset, vector_num_elements, tensor_data, tensor_offset, tensor_num_elements, z_data); } else { LOG(INFO) << \"ndims=\" << ndims; LOG(INFO) << \"bcast.x_reshape()=\" << TensorShape(bcast.x_reshape()).DebugString(); LOG(INFO) << \"bcast.y_reshape()=\" << TensorShape(bcast.y_reshape()).DebugString(); LOG(INFO) << \"bcast.x_bcast()=\" << TensorShape(bcast.x_bcast()).DebugString(); LOG(INFO) << \"bcast.y_bcast()=\" << TensorShape(bcast.y_bcast()).DebugString(); context->SetStatus(errors::Unimplemented( \"Broadcast between \", context->input(0).shape().DebugString(), \" and \", context->input(1).shape().DebugString(), \" is not supported yet.\")); return; } float min_z_value; float max_z_value; QuantizationRangeForMultiplication( min_x, max_x, min_y, max_y, &min_z_value, &max_z_value); Tensor* z_min = nullptr; OP_REQUIRES_OK(context, context->allocate_output(1, {}, &z_min)); z_min->flat()(0) = min_z_value; Tensor* z_max = nullptr; OP_REQUIRES_OK(context, context->allocate_output(2, {}, &z_max)); z_max->flat()(0) = max_z_value; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `QuantizedMul` by passing in invalid thresholds for the quantization. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/87cf4d3ea9949051e50ca3f071fc909538a51cd0/tensorflow/core/kernels/quantized_mul_op.cc#L287-L290) assumes that the 4 arguments are always valid scalars and tries to access the numeric value directly. However, if any of these tensors is empty, then `.flat()` is an empty buffer and accessing the element at position 0 results in overflow. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29535"}} -{"idx": 220880, "input": "static int rlp_calculate_number_length(uint32_t number) { if (number <= 0x7f) { return 1; } else if (number <= 0xff) { return 2; } else if (number <= 0xffff) { return 3; } else if (number <= 0xffffff) { return 4; } else { return 5; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431931, "input": "static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable) { hci_dev_lock(hdev); switch (enable) { case LE_SCAN_ENABLE: hci_dev_set_flag(hdev, HCI_LE_SCAN); if (hdev->le_scan_type == LE_SCAN_ACTIVE) clear_pending_adv_report(hdev); break; case LE_SCAN_DISABLE: /* We do this here instead of when setting DISCOVERY_STOPPED * since the latter would potentially require waiting for * inquiry to stop too. */ if (has_pending_adv_report(hdev)) { struct discovery_state *d = &hdev->discovery; mgmt_device_found(hdev, &d->last_adv_addr, LE_LINK, d->last_adv_addr_type, NULL, d->last_adv_rssi, d->last_adv_flags, d->last_adv_data, d->last_adv_data_len, NULL, 0); } /* Cancel this timer so that we don't try to disable scanning * when it's already disabled. */ cancel_delayed_work(&hdev->le_scan_disable); hci_dev_clear_flag(hdev, HCI_LE_SCAN); /* The HCI_LE_SCAN_INTERRUPTED flag indicates that we * interrupted scanning due to a connect request. Mark * therefore discovery as stopped. If this was not * because of a connect request advertising might have * been disabled because of active scanning, so * re-enable it again if necessary. */ if (hci_dev_test_and_clear_flag(hdev, HCI_LE_SCAN_INTERRUPTED)) hci_discovery_set_state(hdev, DISCOVERY_STOPPED); else if (!hci_dev_test_flag(hdev, HCI_LE_ADV) && hdev->discovery.state == DISCOVERY_FINDING) hci_req_reenable_advertising(hdev); break; default: bt_dev_err(hdev, \"use of reserved LE_Scan_Enable param %d\", enable); break; } hci_dev_unlock(hdev); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376802, "input": "static avifTrack * avifDecoderDataCreateTrack(avifDecoderData * data) { avifTrack * track = (avifTrack *)avifArrayPushPtr(&data->tracks); track->meta = avifMetaCreate(); return track; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224899, "input": "void gf_isom_box_array_del(GF_List *other_boxes) { u32 count, i; GF_Box *a; if (!other_boxes) return; count = gf_list_count(other_boxes); for (i = 0; i < count; i++) { a = (GF_Box *)gf_list_get(other_boxes, i); if (a) gf_isom_box_del(a); } gf_list_del(other_boxes); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398112, "input": "static int sctp_setsockopt_del_key(struct sock *sk, struct sctp_authkeyid *val, unsigned int optlen) { struct sctp_endpoint *ep = sctp_sk(sk)->ep; struct sctp_association *asoc; int ret = 0; if (optlen != sizeof(struct sctp_authkeyid)) return -EINVAL; asoc = sctp_id2assoc(sk, val->scact_assoc_id); if (!asoc && val->scact_assoc_id > SCTP_ALL_ASSOC && sctp_style(sk, UDP)) return -EINVAL; if (asoc) return sctp_auth_del_key_id(ep, asoc, val->scact_keynumber); if (sctp_style(sk, TCP)) val->scact_assoc_id = SCTP_FUTURE_ASSOC; if (val->scact_assoc_id == SCTP_FUTURE_ASSOC || val->scact_assoc_id == SCTP_ALL_ASSOC) { ret = sctp_auth_del_key_id(ep, asoc, val->scact_keynumber); if (ret) return ret; } if (val->scact_assoc_id == SCTP_CURRENT_ASSOC || val->scact_assoc_id == SCTP_ALL_ASSOC) { list_for_each_entry(asoc, &ep->asocs, asocs) { int res = sctp_auth_del_key_id(ep, asoc, val->scact_keynumber); if (res && !ret) ret = res; } } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232471, "input": "static void release_maps(struct bpf_verifier_env *env) { __bpf_free_used_maps(env->prog->aux, env->used_maps, env->used_map_cnt); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280714, "input": "ofpact_copy(struct ofpbuf *out, const struct ofpact *a) { ofpbuf_put(out, a, OFPACT_ALIGN(a->len)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 434221, "input": "static void compile_xclass_matchingpath(compiler_common *common, PCRE2_SPTR cc, jump_list **backtracks) { DEFINE_COMPILER; jump_list *found = NULL; jump_list **list = (cc[0] & XCL_NOT) == 0 ? &found : backtracks; sljit_uw c, charoffset, max = 256, min = READ_CHAR_MAX; struct sljit_jump *jump = NULL; PCRE2_SPTR ccbegin; int compares, invertcmp, numberofcmps; #if defined SUPPORT_UNICODE && (PCRE2_CODE_UNIT_WIDTH == 8 || PCRE2_CODE_UNIT_WIDTH == 16) BOOL utf = common->utf; #endif #ifdef SUPPORT_UNICODE BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE; BOOL charsaved = FALSE; int typereg = TMP1; const sljit_u32 *other_cases; sljit_uw typeoffset; #endif /* Scanning the necessary info. */ cc++; ccbegin = cc; compares = 0; if (cc[-1] & XCL_MAP) { min = 0; cc += 32 / sizeof(PCRE2_UCHAR); } while (*cc != XCL_END) { compares++; if (*cc == XCL_SINGLE) { cc ++; GETCHARINCTEST(c, cc); if (c > max) max = c; if (c < min) min = c; #ifdef SUPPORT_UNICODE needschar = TRUE; #endif } else if (*cc == XCL_RANGE) { cc ++; GETCHARINCTEST(c, cc); if (c < min) min = c; GETCHARINCTEST(c, cc); if (c > max) max = c; #ifdef SUPPORT_UNICODE needschar = TRUE; #endif } #ifdef SUPPORT_UNICODE else { SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP); cc++; if (*cc == PT_CLIST) { other_cases = PRIV(ucd_caseless_sets) + cc[1]; while (*other_cases != NOTACHAR) { if (*other_cases > max) max = *other_cases; if (*other_cases < min) min = *other_cases; other_cases++; } } else { max = READ_CHAR_MAX; min = 0; } switch(*cc) { case PT_ANY: /* Any either accepts everything or ignored. */ if (cc[-1] == XCL_PROP) { compile_char1_matchingpath(common, OP_ALLANY, cc, backtracks, FALSE); if (list == backtracks) add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); return; } break; case PT_LAMP: case PT_GC: case PT_PC: case PT_ALNUM: needstype = TRUE; break; case PT_SC: needsscript = TRUE; break; case PT_SPACE: case PT_PXSPACE: case PT_WORD: case PT_PXGRAPH: case PT_PXPRINT: case PT_PXPUNCT: needstype = TRUE; needschar = TRUE; break; case PT_CLIST: case PT_UCNC: needschar = TRUE; break; default: SLJIT_UNREACHABLE(); break; } cc += 2; } #endif } SLJIT_ASSERT(compares > 0); /* We are not necessary in utf mode even in 8 bit mode. */ cc = ccbegin; read_char_range(common, min, max, (cc[-1] & XCL_NOT) != 0); if ((cc[-1] & XCL_HASPROP) == 0) { if ((cc[-1] & XCL_MAP) != 0) { jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255); if (!optimize_class(common, (const sljit_u8 *)cc, (((const sljit_u8 *)cc)[31] & 0x80) != 0, TRUE, &found)) { OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7); OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc); OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0); OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0); add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO)); } add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); JUMPHERE(jump); cc += 32 / sizeof(PCRE2_UCHAR); } else { OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, min); add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_GREATER, TMP2, 0, SLJIT_IMM, max - min)); } } else if ((cc[-1] & XCL_MAP) != 0) { OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0); #ifdef SUPPORT_UNICODE charsaved = TRUE; #endif if (!optimize_class(common, (const sljit_u8 *)cc, FALSE, TRUE, list)) { #if PCRE2_CODE_UNIT_WIDTH == 8 jump = NULL; if (common->utf) #endif jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255); OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7); OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc); OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0); OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0); add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO)); #if PCRE2_CODE_UNIT_WIDTH == 8 if (common->utf) #endif JUMPHERE(jump); } OP1(SLJIT_MOV, TMP1, 0, RETURN_ADDR, 0); cc += 32 / sizeof(PCRE2_UCHAR); } #ifdef SUPPORT_UNICODE if (needstype || needsscript) { if (needschar && !charsaved) OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0); #if PCRE2_CODE_UNIT_WIDTH == 32 if (!common->utf) { jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, MAX_UTF_CODE_POINT + 1); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR); JUMPHERE(jump); } #endif OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1)); OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2)); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1); /* Before anything else, we deal with scripts. */ if (needsscript) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, script)); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3); ccbegin = cc; while (*cc != XCL_END) { if (*cc == XCL_SINGLE) { cc ++; GETCHARINCTEST(c, cc); } else if (*cc == XCL_RANGE) { cc ++; GETCHARINCTEST(c, cc); GETCHARINCTEST(c, cc); } else { SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP); cc++; if (*cc == PT_SC) { compares--; invertcmp = (compares == 0 && list != backtracks); if (cc[-1] == XCL_NOTPROP) invertcmp ^= 0x1; jump = CMP(SLJIT_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (int)cc[1]); add_jump(compiler, compares > 0 ? list : backtracks, jump); } cc += 2; } } cc = ccbegin; } if (needschar) { OP1(SLJIT_MOV, TMP1, 0, RETURN_ADDR, 0); } if (needstype) { if (!needschar) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype)); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3); } else { OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3); OP1(SLJIT_MOV_U8, RETURN_ADDR, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype)); typereg = RETURN_ADDR; } } } #endif /* Generating code. */ charoffset = 0; numberofcmps = 0; #ifdef SUPPORT_UNICODE typeoffset = 0; #endif while (*cc != XCL_END) { compares--; invertcmp = (compares == 0 && list != backtracks); jump = NULL; if (*cc == XCL_SINGLE) { cc ++; GETCHARINCTEST(c, cc); if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE)) { OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset)); OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_EQUAL); numberofcmps++; } else if (numberofcmps > 0) { OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset)); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); numberofcmps = 0; } else { jump = CMP(SLJIT_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset)); numberofcmps = 0; } } else if (*cc == XCL_RANGE) { cc ++; GETCHARINCTEST(c, cc); SET_CHAR_OFFSET(c); GETCHARINCTEST(c, cc); if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE)) { OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset)); OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL); numberofcmps++; } else if (numberofcmps > 0) { OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset)); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); numberofcmps = 0; } else { jump = CMP(SLJIT_LESS_EQUAL ^ invertcmp, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset)); numberofcmps = 0; } } #ifdef SUPPORT_UNICODE else { SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP); if (*cc == XCL_NOTPROP) invertcmp ^= 0x1; cc++; switch(*cc) { case PT_ANY: if (!invertcmp) jump = JUMP(SLJIT_JUMP); break; case PT_LAMP: OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); break; case PT_GC: c = PRIV(ucp_typerange)[(int)cc[1] * 2]; SET_TYPE_OFFSET(c); jump = CMP(SLJIT_LESS_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, PRIV(ucp_typerange)[(int)cc[1] * 2 + 1] - c); break; case PT_PC: jump = CMP(SLJIT_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, (int)cc[1] - typeoffset); break; case PT_SC: compares++; /* Do nothing. */ break; case PT_SPACE: case PT_PXSPACE: SET_CHAR_OFFSET(9); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); SET_TYPE_OFFSET(ucp_Zl); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); break; case PT_WORD: OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset)); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL); /* Fall through. */ case PT_ALNUM: SET_TYPE_OFFSET(ucp_Ll); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll); OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL); SET_TYPE_OFFSET(ucp_Nd); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); break; case PT_CLIST: other_cases = PRIV(ucd_caseless_sets) + cc[1]; /* At least three characters are required. Otherwise this case would be handled by the normal code path. */ SLJIT_ASSERT(other_cases[0] != NOTACHAR && other_cases[1] != NOTACHAR && other_cases[2] != NOTACHAR); SLJIT_ASSERT(other_cases[0] < other_cases[1] && other_cases[1] < other_cases[2]); /* Optimizing character pairs, if their difference is power of 2. */ if (is_powerof2(other_cases[1] ^ other_cases[0])) { if (charoffset == 0) OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]); else { OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset); OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]); } OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL); other_cases += 2; } else if (is_powerof2(other_cases[2] ^ other_cases[1])) { if (charoffset == 0) OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, other_cases[2] ^ other_cases[1]); else { OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset); OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]); } OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset)); OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL); other_cases += 3; } else { OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset)); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL); } while (*other_cases != NOTACHAR) { OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset)); OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL); } jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); break; case PT_UCNC: OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset)); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset)); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset)); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); SET_CHAR_OFFSET(0xa0); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset)); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL); SET_CHAR_OFFSET(0); OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_GREATER_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); break; case PT_PXGRAPH: /* C and Z groups are the farthest two groups. */ SET_TYPE_OFFSET(ucp_Ll); OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER); jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll); /* In case of ucp_Cf, we overwrite the result. */ SET_CHAR_OFFSET(0x2066); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); JUMPHERE(jump); jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0); break; case PT_PXPRINT: /* C and Z groups are the farthest two groups. */ SET_TYPE_OFFSET(ucp_Ll); OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll); OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_NOT_EQUAL); jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll); /* In case of ucp_Cf, we overwrite the result. */ SET_CHAR_OFFSET(0x2066); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL); OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066); OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL); JUMPHERE(jump); jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0); break; case PT_PXPUNCT: SET_TYPE_OFFSET(ucp_Sc); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL); SET_CHAR_OFFSET(0); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f); OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_LESS_EQUAL); SET_TYPE_OFFSET(ucp_Pc); OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL); jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp); break; default: SLJIT_UNREACHABLE(); break; } cc += 2; } #endif if (jump != NULL) add_jump(compiler, compares > 0 ? list : backtracks, jump); } if (found != NULL) set_jumps(found, LABEL()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219226, "input": "MemFile::MemFile(const String& wrapper, const String& stream) : File(false, wrapper, stream), m_data(nullptr), m_len(-1), m_cursor(0), m_malloced(false) { setIsLocal(true); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295166, "input": "void gdImageSetTile (gdImagePtr im, gdImagePtr tile) { int i; im->tile = tile; if (!im->trueColor && !im->tile->trueColor) { for (i = 0; i < gdImageColorsTotal(tile); i++) { int index; index = gdImageColorResolveAlpha(im, gdImageRed(tile, i), gdImageGreen(tile, i), gdImageBlue(tile, i), gdImageAlpha(tile, i)); im->tileColorMap[i] = index; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399946, "input": "fill_vec_buf_packed_indirect(struct virtio_net *dev, struct vhost_virtqueue *vq, struct vring_packed_desc *desc, uint16_t *vec_idx, struct buf_vector *buf_vec, uint32_t *len, uint8_t perm) { uint16_t i; uint32_t nr_descs; uint16_t vec_id = *vec_idx; uint64_t dlen; struct vring_packed_desc *descs, *idescs = NULL; dlen = desc->len; descs = (struct vring_packed_desc *)(uintptr_t) vhost_iova_to_vva(dev, vq, desc->addr, &dlen, VHOST_ACCESS_RO); if (unlikely(!descs)) return -1; if (unlikely(dlen < desc->len)) { /* * The indirect desc table is not contiguous * in process VA space, we have to copy it. */ idescs = vhost_alloc_copy_ind_table(dev, vq, desc->addr, desc->len); if (unlikely(!idescs)) return -1; descs = idescs; } nr_descs = desc->len / sizeof(struct vring_packed_desc); if (unlikely(nr_descs >= vq->size)) { free_ind_table(idescs); return -1; } for (i = 0; i < nr_descs; i++) { if (unlikely(vec_id >= BUF_VECTOR_MAX)) { free_ind_table(idescs); return -1; } *len += descs[i].len; if (unlikely(map_one_desc(dev, vq, buf_vec, &vec_id, descs[i].addr, descs[i].len, perm))) return -1; } *vec_idx = vec_id; if (unlikely(!!idescs)) free_ind_table(idescs); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214990, "input": "void LibRaw::identify_process_dng_fields() { if (!dng_version) return; int c; { /* copy DNG data from per-IFD field to color.dng */ int iifd = find_ifd_by_offset(data_offset); int pifd = find_ifd_by_offset(thumb_offset); #define CFAROUND(value, filters) \\ filters ? (filters >= 1000 ? ((value + 1) / 2) * 2 : ((value + 5) / 6) * 6) \\ : value #define IFDCOLORINDEX(ifd, subset, bit) \\ (tiff_ifd[ifd].dng_color[subset].parsedfields & bit) \\ ? ifd \\ : ((tiff_ifd[0].dng_color[subset].parsedfields & bit) ? 0 : -1) #define IFDLEVELINDEX(ifd, bit) \\ (tiff_ifd[ifd].dng_levels.parsedfields & bit) \\ ? ifd \\ : ((tiff_ifd[0].dng_levels.parsedfields & bit) ? 0 : -1) #define COPYARR(to, from) memmove(&to, &from, sizeof(from)) if (iifd < (int)tiff_nifds && iifd >= 0) { int sidx; // Per field, not per structure if (!(imgdata.params.raw_processing_options & LIBRAW_PROCESSING_DONT_CHECK_DNG_ILLUMINANT)) { int illidx[2], cmidx[2], calidx[2], abidx; for (int i = 0; i < 2; i++) { illidx[i] = IFDCOLORINDEX(iifd, i, LIBRAW_DNGFM_ILLUMINANT); cmidx[i] = IFDCOLORINDEX(iifd, i, LIBRAW_DNGFM_COLORMATRIX); calidx[i] = IFDCOLORINDEX(iifd, i, LIBRAW_DNGFM_CALIBRATION); } abidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_ANALOGBALANCE); // Data found, all in same ifd, illuminants are inited if (illidx[0] >= 0 && illidx[0] < (int)tiff_nifds && illidx[0] == illidx[1] && illidx[0] == cmidx[0] && illidx[0] == cmidx[1] && tiff_ifd[illidx[0]].dng_color[0].illuminant > 0 && tiff_ifd[illidx[0]].dng_color[1].illuminant > 0) { sidx = illidx[0]; // => selected IFD double cc[4][4], cm[4][3], cam_xyz[4][3]; // CM -> Color Matrix // CC -> Camera calibration for (int j = 0; j < 4; j++) for (int i = 0; i < 4; i++) cc[j][i] = i == j; int colidx = -1; // IS D65 here? for (int i = 0; i < 2; i++) { if (tiff_ifd[sidx].dng_color[i].illuminant == LIBRAW_WBI_D65) { colidx = i; break; } } // Other daylight-type ill if (colidx < 0) for (int i = 0; i < 2; i++) { int ill = tiff_ifd[sidx].dng_color[i].illuminant; if (ill == LIBRAW_WBI_Daylight || ill == LIBRAW_WBI_D55 || ill == LIBRAW_WBI_D75 || ill == LIBRAW_WBI_D50 || ill == LIBRAW_WBI_Flash) { colidx = i; break; } } if (colidx >= 0) // Selected { // Init camera matrix from DNG FORCC for (int j = 0; j < 3; j++) cm[c][j] = tiff_ifd[sidx].dng_color[colidx].colormatrix[c][j]; if (calidx[colidx] == sidx) { for (int i = 0; i < colors; i++) FORCC cc[i][c] = tiff_ifd[sidx].dng_color[colidx].calibration[i][c]; } if (abidx == sidx) for (int i = 0; i < colors; i++) FORCC cc[i][c] *= tiff_ifd[sidx].dng_levels.analogbalance[i]; int j; FORCC for (int i = 0; i < 3; i++) for (cam_xyz[c][i] = j = 0; j < colors; j++) cam_xyz[c][i] += cc[c][j] * cm[j][i]; // add AsShotXY later * xyz[i]; cam_xyz_coeff(cmatrix, cam_xyz); } } } bool noFujiDNGCrop = makeIs(LIBRAW_CAMERAMAKER_Fujifilm) && (!strcmp(normalized_model, \"S3Pro\") || !strcmp(normalized_model, \"S5Pro\") || !strcmp(normalized_model, \"S2Pro\")); if (!noFujiDNGCrop && (imgdata.params.raw_processing_options &LIBRAW_PROCESSING_USE_DNG_DEFAULT_CROP)) { sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_CROPORIGIN); int sidx2 = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_CROPSIZE); if (sidx >= 0 && sidx == sidx2 && tiff_ifd[sidx].dng_levels.default_crop[2] > 0 && tiff_ifd[sidx].dng_levels.default_crop[3] > 0) { int lm = tiff_ifd[sidx].dng_levels.default_crop[0]; int lmm = CFAROUND(lm, filters); int tm = tiff_ifd[sidx].dng_levels.default_crop[1]; int tmm = CFAROUND(tm, filters); int ww = tiff_ifd[sidx].dng_levels.default_crop[2]; int hh = tiff_ifd[sidx].dng_levels.default_crop[3]; if (lmm > lm) ww -= (lmm - lm); if (tmm > tm) hh -= (tmm - tm); if (left_margin + lm + ww <= raw_width && top_margin + tm + hh <= raw_height) { left_margin += lmm; top_margin += tmm; width = ww; height = hh; } } } if (!(imgdata.color.dng_color[0].parsedfields & LIBRAW_DNGFM_FORWARDMATRIX)) // Not set already (Leica makernotes) { sidx = IFDCOLORINDEX(iifd, 0, LIBRAW_DNGFM_FORWARDMATRIX); if (sidx >= 0) COPYARR(imgdata.color.dng_color[0].forwardmatrix, tiff_ifd[sidx].dng_color[0].forwardmatrix); } if (!(imgdata.color.dng_color[1].parsedfields & LIBRAW_DNGFM_FORWARDMATRIX)) // Not set already (Leica makernotes) { sidx = IFDCOLORINDEX(iifd, 1, LIBRAW_DNGFM_FORWARDMATRIX); if (sidx >= 0) COPYARR(imgdata.color.dng_color[1].forwardmatrix, tiff_ifd[sidx].dng_color[1].forwardmatrix); } for (int ss = 0; ss < 2; ss++) { sidx = IFDCOLORINDEX(iifd, ss, LIBRAW_DNGFM_COLORMATRIX); if (sidx >= 0) COPYARR(imgdata.color.dng_color[ss].colormatrix, tiff_ifd[sidx].dng_color[ss].colormatrix); sidx = IFDCOLORINDEX(iifd, ss, LIBRAW_DNGFM_CALIBRATION); if (sidx >= 0) COPYARR(imgdata.color.dng_color[ss].calibration, tiff_ifd[sidx].dng_color[ss].calibration); sidx = IFDCOLORINDEX(iifd, ss, LIBRAW_DNGFM_ILLUMINANT); if (sidx >= 0) imgdata.color.dng_color[ss].illuminant = tiff_ifd[sidx].dng_color[ss].illuminant; } // Levels sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_ANALOGBALANCE); if (sidx >= 0) COPYARR(imgdata.color.dng_levels.analogbalance, tiff_ifd[sidx].dng_levels.analogbalance); sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_BASELINEEXPOSURE); if (sidx >= 0) imgdata.color.dng_levels.baseline_exposure = tiff_ifd[sidx].dng_levels.baseline_exposure; sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_WHITE); if (sidx >= 0 && tiff_ifd[sidx].dng_levels.dng_whitelevel[0]) COPYARR(imgdata.color.dng_levels.dng_whitelevel, tiff_ifd[sidx].dng_levels.dng_whitelevel); else if (tiff_ifd[iifd].sample_format <= 2 && tiff_ifd[iifd].bps > 0 && tiff_ifd[iifd].bps < 32) FORC4 imgdata.color.dng_levels.dng_whitelevel[c] = (1 << tiff_ifd[iifd].bps) - 1; sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_ASSHOTNEUTRAL); if (sidx >= 0) { COPYARR(imgdata.color.dng_levels.asshotneutral, tiff_ifd[sidx].dng_levels.asshotneutral); if (imgdata.color.dng_levels.asshotneutral[0]) { cam_mul[3] = 0; FORCC if (fabs(imgdata.color.dng_levels.asshotneutral[c]) > 0.0001) cam_mul[c] = 1 / imgdata.color.dng_levels.asshotneutral[c]; } } sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_BLACK); if (sidx >= 0) { imgdata.color.dng_levels.dng_fblack = tiff_ifd[sidx].dng_levels.dng_fblack; imgdata.color.dng_levels.dng_black = tiff_ifd[sidx].dng_levels.dng_black; COPYARR(imgdata.color.dng_levels.dng_cblack, tiff_ifd[sidx].dng_levels.dng_cblack); COPYARR(imgdata.color.dng_levels.dng_fcblack, tiff_ifd[sidx].dng_levels.dng_fcblack); } if (pifd >= 0) { sidx = IFDLEVELINDEX(pifd, LIBRAW_DNGFM_PREVIEWCS); if (sidx >= 0) imgdata.color.dng_levels.preview_colorspace = tiff_ifd[sidx].dng_levels.preview_colorspace; } sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_OPCODE2); if (sidx >= 0) meta_offset = tiff_ifd[sidx].opcode2_offset; sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_LINTABLE); INT64 linoff = -1; int linlen = 0; if (sidx >= 0) { linoff = tiff_ifd[sidx].lineartable_offset; linlen = tiff_ifd[sidx].lineartable_len; } if (linoff >= 0 && linlen > 0) { INT64 pos = ftell(ifp); fseek(ifp, linoff, SEEK_SET); linear_table(linlen); fseek(ifp, pos, SEEK_SET); } // Need to add curve too } /* Copy DNG black level to LibRaw's */ if (load_raw == &LibRaw::lossy_dng_load_raw) { maximum = 0xffff; FORC4 imgdata.color.linear_max[c] = imgdata.color.dng_levels.dng_whitelevel[c] = 0xffff; } else { maximum = imgdata.color.dng_levels.dng_whitelevel[0]; } black = imgdata.color.dng_levels.dng_black; if (tiff_samples == 2 && imgdata.color.dng_levels.dng_cblack[4] * imgdata.color.dng_levels.dng_cblack[5] * tiff_samples == imgdata.color.dng_levels.dng_cblack[LIBRAW_CBLACK_SIZE - 1]) { unsigned ff = filters; if (filters > 999 && colors == 3) filters |= ((filters >> 2 & 0x22222222) | (filters << 2 & 0x88888888)) & filters << 1; /* Special case, Fuji SuperCCD dng */ int csum[4] = { 0,0,0,0 }, ccount[4] = { 0,0,0,0 }; int i = 6 + shot_select; for (unsigned row = 0; row < imgdata.color.dng_levels.dng_cblack[4]; row++) for (unsigned col = 0; col < imgdata.color.dng_levels.dng_cblack[5]; col++) { csum[FC(row, col)] += imgdata.color.dng_levels.dng_cblack[i]; ccount[FC(row, col)]++; i += tiff_samples; } for (int c = 0; c < 4; c++) if (ccount[c]) imgdata.color.dng_levels.dng_cblack[c] += csum[c] / ccount[c]; imgdata.color.dng_levels.dng_cblack[4] = imgdata.color.dng_levels.dng_cblack[5] = 0; filters = ff; } else if (tiff_samples > 2 && tiff_samples <= 4 && imgdata.color.dng_levels.dng_cblack[4] * imgdata.color.dng_levels.dng_cblack[5] * tiff_samples == imgdata.color.dng_levels.dng_cblack[LIBRAW_CBLACK_SIZE - 1]) { /* Special case, per_channel blacks in RepeatDim, average for per-channel */ int csum[4] = { 0,0,0,0 }, ccount[4] = { 0,0,0,0 }; int i = 6; for (unsigned row = 0; row < imgdata.color.dng_levels.dng_cblack[4]; row++) for (unsigned col = 0; col < imgdata.color.dng_levels.dng_cblack[5]; col++) for (unsigned c = 0; c < tiff_samples; c++) { csum[c] += imgdata.color.dng_levels.dng_cblack[i]; ccount[c]++; i++; } for (int c = 0; c < 4; c++) if (ccount[c]) imgdata.color.dng_levels.dng_cblack[c] += csum[c] / ccount[c]; imgdata.color.dng_levels.dng_cblack[4] = imgdata.color.dng_levels.dng_cblack[5] = 0; } memmove(cblack, imgdata.color.dng_levels.dng_cblack, sizeof(cblack)); if (iifd < (int)tiff_nifds && iifd >= 0) { int sidx = IFDLEVELINDEX(iifd, LIBRAW_DNGFM_LINEARRESPONSELIMIT); if (sidx >= 0) { imgdata.color.dng_levels.LinearResponseLimit = tiff_ifd[sidx].dng_levels.LinearResponseLimit; if (imgdata.color.dng_levels.LinearResponseLimit > 0.1 && imgdata.color.dng_levels.LinearResponseLimit <= 1.0) { // And approx promote it to linear_max: int bl4 = 0, bl64 = 0; for (int chan = 0; chan < colors && chan < 4; chan++) bl4 += cblack[chan]; bl4 /= LIM(colors, 1, 4); if (cblack[4] * cblack[5] > 0) { unsigned cnt = 0; for (unsigned c = 0; c < 4096 && c < cblack[4] * cblack[5]; c++) { bl64 += cblack[c + 6]; cnt++; } bl64 /= LIM(cnt, 1, 4096); } int rblack = black + bl4 + bl64; for (int chan = 0; chan < colors && chan < 4; chan++) imgdata.color.linear_max[chan] = (maximum - rblack) * imgdata.color.dng_levels.LinearResponseLimit + rblack; } } } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "Libraw before 0.20.1 has a stack buffer overflow via LibRaw::identify_process_dng_fields in identify.cpp.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-24870"}} -{"idx": 299161, "input": "yaffsfs_close(TSK_FS_INFO *fs) { if(fs != NULL){ YAFFSFS_INFO *yfs = (YAFFSFS_INFO *)fs; fs->tag = 0; // Walk and free the cache structures yaffscache_objects_free(yfs); yaffscache_chunks_free(yfs); //tsk_deinit_lock(&yaffsfs->lock); tsk_fs_free(fs); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 264800, "input": "GF_Err audio_sample_entry_box_size(GF_Box *s) { u32 pos=0; GF_MPEGAudioSampleEntryBox *ptr = (GF_MPEGAudioSampleEntryBox *)s; gf_isom_audio_sample_entry_size((GF_AudioSampleEntryBox*)s); if (ptr->qtff_mode) return GF_OK; gf_isom_check_position(s, (GF_Box *)ptr->esd, &pos); gf_isom_check_position(s, (GF_Box *)ptr->cfg_3gpp, &pos); gf_isom_check_position(s, (GF_Box *)ptr->cfg_opus, &pos); gf_isom_check_position(s, (GF_Box *)ptr->cfg_ac3, &pos); gf_isom_check_position(s, (GF_Box *)ptr->cfg_flac, &pos); return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196991, "input": "parseNormalModeParameters(IsoPresentation* self, uint8_t* buffer, int totalLength, int bufPos) { int endPos = bufPos + totalLength; self->calledPresentationSelector.size = 0; self->callingPresentationSelector.size = 0; bool hasUserData = false; while (bufPos < endPos) { uint8_t tag = buffer[bufPos++]; int len; if (bufPos == endPos) { if (DEBUG_PRES) printf(\"PRES: invalid message\\n\"); return -1; } bufPos = BerDecoder_decodeLength(buffer, &len, bufPos, endPos); if (bufPos < 0) { if (DEBUG_PRES) printf(\"PRES: wrong parameter length\\n\"); return -1; } switch (tag) { case 0x81: /* calling-presentation-selector */ if (len > 16) { if (DEBUG_PRES) printf(\"PRES: calling-presentation-sel too large\\n\"); } else { self->callingPresentationSelector.size = len; int i; for (i = 0; i < len; i++) self->callingPresentationSelector.value[i] = buffer[bufPos + i]; } bufPos += len; break; case 0x82: /* called-presentation-selector */ if (len > 16) { if (DEBUG_PRES) printf(\"PRES: called-presentation-sel too large\\n\"); } else { self->calledPresentationSelector.size = len; int i; for (i = 0; i < len; i++) self->calledPresentationSelector.value[i] = buffer[bufPos + i]; } bufPos += len; break; case 0x83: /* responding-presentation-selector */ if (len > 16) { if (DEBUG_PRES) printf(\"PRES: responding-presentation-sel too large\\n\"); } bufPos += len; break; case 0xa4: /* presentation-context-definition list */ if (DEBUG_PRES) printf(\"PRES: pcd list\\n\"); bufPos = parsePresentationContextDefinitionList(self, buffer, len, bufPos); break; case 0xa5: /* context-definition-result-list */ bufPos += len; break; case 0x61: /* user data */ if (DEBUG_PRES) printf(\"PRES: user-data\\n\"); bufPos = parseFullyEncodedData(self, buffer, len, bufPos); if (bufPos < 0) return -1; if (self->nextPayload.size > 0) hasUserData = true; break; case 0x00: /* indefinite length end tag -> ignore */ break; default: if (DEBUG_PRES) printf(\"PRES: unknown tag in normal-mode\\n\"); bufPos += len; break; } } if (hasUserData == false) { if (DEBUG_PRES) printf(\"PRES: user-data is missing\\n\"); return -1; } return bufPos; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "A denial of service vulnerability exists in the parseNormalModeParameters functionality of MZ Automation GmbH libiec61850 1.5.0. A specially-crafted series of network requests can lead to denial of service. An attacker can send a sequence of malformed iec61850 messages to trigger this vulnerability.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2022-21159"}} -{"idx": 281442, "input": "need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq) { int hint; if (!intel_engine_has_timeslices(engine)) return false; if (list_is_last(&rq->sched.link, &engine->active.requests)) return false; hint = max(rq_prio(list_next_entry(rq, sched.link)), engine->execlists.queue_priority_hint); return hint >= effective_prio(rq); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 368095, "input": "int BPMDetect::getBeats(float *pos, float *values, int max_num) { int num = beats.size(); if ((!pos) || (!values)) return num; // pos or values NULL, return just size for (int i = 0; (i < num) && (i < max_num); i++) { pos[i] = beats[i].pos; values[i] = beats[i].strength; } return num; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259064, "input": "int nbd_disconnect(int fd) { return -ENOTSUP; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431231, "input": "static void nfs4_sequence_free_slot(struct nfs4_sequence_res *res) { if (res->sr_slot != NULL) { if (res->sr_slot->table->session != NULL) nfs41_sequence_free_slot(res); else nfs40_sequence_free_slot(res); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293652, "input": "struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig) { struct vm_area_struct *new = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); if (new) { ASSERT_EXCLUSIVE_WRITER(orig->vm_flags); ASSERT_EXCLUSIVE_WRITER(orig->vm_file); /* * orig->shared.rb may be modified concurrently, but the clone * will be reinitialized. */ *new = data_race(*orig); INIT_LIST_HEAD(&new->anon_vma_chain); new->vm_next = new->vm_prev = NULL; } return new; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 384455, "input": "void iwl_fw_error_print_fseq_regs(struct iwl_fw_runtime *fwrt) { struct iwl_trans *trans = fwrt->trans; unsigned long flags; int i; struct { u32 addr; const char *str; } fseq_regs[] = { FSEQ_REG(FSEQ_ERROR_CODE), FSEQ_REG(FSEQ_TOP_INIT_VERSION), FSEQ_REG(FSEQ_CNVIO_INIT_VERSION), FSEQ_REG(FSEQ_OTP_VERSION), FSEQ_REG(FSEQ_TOP_CONTENT_VERSION), FSEQ_REG(FSEQ_ALIVE_TOKEN), FSEQ_REG(FSEQ_CNVI_ID), FSEQ_REG(FSEQ_CNVR_ID), FSEQ_REG(CNVI_AUX_MISC_CHIP), FSEQ_REG(CNVR_AUX_MISC_CHIP), FSEQ_REG(CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM), FSEQ_REG(CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR), }; if (!iwl_trans_grab_nic_access(trans, &flags)) return; IWL_ERR(fwrt, \"Fseq Registers:\\n\"); for (i = 0; i < ARRAY_SIZE(fseq_regs); i++) IWL_ERR(fwrt, \"0x%08X | %s\\n\", iwl_read_prph_no_grab(trans, fseq_regs[i].addr), fseq_regs[i].str); iwl_trans_release_nic_access(trans, &flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394245, "input": "ctnetlink_parse_zone(const struct nlattr *attr, struct nf_conntrack_zone *zone) { nf_ct_zone_init(zone, NF_CT_DEFAULT_ZONE_ID, NF_CT_DEFAULT_ZONE_DIR, 0); #ifdef CONFIG_NF_CONNTRACK_ZONES if (attr) zone->id = ntohs(nla_get_be16(attr)); #else if (attr) return -EOPNOTSUPP; #endif return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357443, "input": "static void opj_j2k_dump_MH_info(opj_j2k_t* p_j2k, FILE* out_stream) { fprintf(out_stream, \"Codestream info from main header: {\\n\"); fprintf(out_stream, \"\\t tx0=%d, ty0=%d\\n\", p_j2k->m_cp.tx0, p_j2k->m_cp.ty0); fprintf(out_stream, \"\\t tdx=%d, tdy=%d\\n\", p_j2k->m_cp.tdx, p_j2k->m_cp.tdy); fprintf(out_stream, \"\\t tw=%d, th=%d\\n\", p_j2k->m_cp.tw, p_j2k->m_cp.th); opj_j2k_dump_tile_info(p_j2k->m_specific_param.m_decoder.m_default_tcp, (OPJ_INT32)p_j2k->m_private_image->numcomps, out_stream); fprintf(out_stream, \"}\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338789, "input": "static void override_cache_bits(struct cpuinfo_x86 *c) { if (c->x86 != 6) return; switch (c->x86_model) { case INTEL_FAM6_NEHALEM: case INTEL_FAM6_WESTMERE: case INTEL_FAM6_SANDYBRIDGE: case INTEL_FAM6_IVYBRIDGE: case INTEL_FAM6_HASWELL: case INTEL_FAM6_HASWELL_L: case INTEL_FAM6_HASWELL_G: case INTEL_FAM6_BROADWELL: case INTEL_FAM6_BROADWELL_G: case INTEL_FAM6_SKYLAKE_L: case INTEL_FAM6_SKYLAKE: case INTEL_FAM6_KABYLAKE_L: case INTEL_FAM6_KABYLAKE: if (c->x86_cache_bits < 44) c->x86_cache_bits = 44; break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244778, "input": "DEFINE_TEST(test_read_format_rar5_block_size_is_too_small) { char buf[4096]; PROLOGUE(\"test_read_format_rar5_block_size_is_too_small.rar\"); /* This file is damaged, so those functions should return failure. * Additionally, SIGSEGV shouldn't be raised during execution * of those functions. */ assertA(archive_read_next_header(a, &ae) != ARCHIVE_OK); assertA(archive_read_data(a, buf, sizeof(buf)) <= 0); EPILOGUE(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 326051, "input": "void tty_kclose(struct tty_struct *tty) { /* * Ask the line discipline code to release its structures */ tty_ldisc_release(tty); /* Wait for pending work before tty destruction commmences */ tty_flush_works(tty); tty_debug_hangup(tty, \"freeing structure\\n\"); /* * The release_tty function takes care of the details of clearing * the slots and preserving the termios structure. */ mutex_lock(&tty_mutex); tty_port_set_kopened(tty->port, 0); release_tty(tty, tty->index); mutex_unlock(&tty_mutex); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230189, "input": "std::pair JSObject::_getOwnIndexedRangeImpl( JSObject *self, Runtime *runtime) { return {0, 0}; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280105, "input": "static int uevent_filter(struct kset *kset, struct kobject *kobj) { struct kobj_type *ktype = get_ktype(kobj); if (ktype == &slab_ktype) return 1; return 0;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 520909, "input": "static Jsi_RC CDataConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this, Jsi_Value **ret, Jsi_Func *funcPtr) { Jsi_Value *that = _this; Jsi_Obj *nobj; if (!Jsi_FunctionIsConstructor(funcPtr)) { Jsi_Obj *o = Jsi_ObjNew(interp); Jsi_PrototypeObjSet(interp, \"CData\", o); Jsi_ValueMakeObject(interp, ret, o); that = *ret; } CDataObj *cd = (typeof(cd))Jsi_Calloc(1,sizeof(*cd)); cd->interp = interp; Jsi_Value *val = Jsi_ValueArrayIndex(interp, args, 0); Jsi_vtype vtyp = Jsi_ValueTypeGet(val); int vlen, isNew = 0; const char *vstr = Jsi_ValueString(interp, val, &vlen); Jsi_DString dStr = {}; Jsi_Value *ival = Jsi_ValueArrayIndex(interp, args, 1); if (ival && Jsi_ValueIsUndef(interp, ival)) ival = NULL; else if (ival && !Jsi_ValueIsObjType(interp, ival, JSI_OT_OBJECT)) return Jsi_LogError(\"arg 2: expected object or undef\"); if (vstr && vlen) { char ech = 0; const char *nstr = vstr, *cp = vstr; while (*cp && (isalnum(*cp) || *cp=='_')) cp++; if (*cp) { int slen = cp-vstr; Jsi_DString sStr = {}; nstr = Jsi_DSAppendLen(&dStr, vstr, slen); if (*cp == '[') ech = ']'; else if (*cp == '{') ech = '}'; if (!ech || vstr[vlen-1] != ech) { Jsi_LogError(\"malformed var form is not: STRUCT, STRUCT{...}, STRUCT[...]\"); goto errout; } //cp++; cd->varParam = Jsi_KeyAdd(interp, Jsi_DSAppendLen(&sStr, cp, vlen-slen)); } cd->structName = Jsi_KeyAdd(interp, nstr); val = NULL; } else if (vtyp != JSI_VT_OBJECT) { Jsi_LogError(\"expected string, object\"); goto errout; } if (val && Jsi_OptionsProcess(interp, CDataOptions, cd, val, 0) < 0) goto errout; if (ival && (cd->mapPtr || cd->arrSize)) { Jsi_LogError(\"init can not be used with c-array/map\"); goto errout; } if (JSI_OK != jsi_csNewCData(interp, cd, JSI_OPT_NO_SIG)) goto errout; if (ival) { interp->callerErr = 1; Jsi_RC rc = Jsi_OptionsConf(interp, (Jsi_OptionSpec*)cd->sf, cd->data, ival, ret, 0); interp->callerErr = 0; if (rc != JSI_OK) { isNew = 1; goto errout; } } nobj = (Jsi_Obj*)Jsi_ValueGetObj(interp, that); cd->objId = Jsi_UserObjNew(interp, &cdataobject, nobj, cd); if (cd->objId<0) { goto errout; } cd->fobj = nobj; return JSI_OK; errout: Jsi_DSFree(&dStr); Jsi_OptionsFree(interp, CDataOptions, cd, 0); if (isNew) jsi_csObjFree(interp, cd); else Jsi_Free(cd); return JSI_ERROR; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508729, "input": "update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, uint tables, COND *cond, table_map normal_tables, SELECT_LEX *select_lex, SARGABLE_PARAM **sargables) { uint and_level,i; KEY_FIELD *key_fields, *end, *field; uint sz; uint m= MY_MAX(select_lex->max_equal_elems,1); DBUG_ENTER(\"update_ref_and_keys\"); DBUG_PRINT(\"enter\", (\"normal_tables: %llx\", normal_tables)); SELECT_LEX *sel=thd->lex->current_select; sel->cond_count= 0; sel->between_count= 0; if (cond) cond->walk(&Item::count_sargable_conds, 0, sel); for (i=0 ; i < tables ; i++) { if (*join_tab[i].on_expr_ref) (*join_tab[i].on_expr_ref)->walk(&Item::count_sargable_conds, 0, sel); } { List_iterator li(*join_tab->join->join_list); TABLE_LIST *table; while ((table= li++)) { if (table->nested_join) count_cond_for_nj(sel, table); } } /* We use the same piece of memory to store both KEY_FIELD and SARGABLE_PARAM structure. KEY_FIELD values are placed at the beginning this memory while SARGABLE_PARAM values are put at the end. All predicates that are used to fill arrays of KEY_FIELD and SARGABLE_PARAM structures have at most 2 arguments except BETWEEN predicates that have 3 arguments and IN predicates. This any predicate if it's not BETWEEN/IN can be used directly to fill at most 2 array elements, either of KEY_FIELD or SARGABLE_PARAM type. For a BETWEEN predicate 3 elements can be filled as this predicate is considered as saragable with respect to each of its argument. An IN predicate can require at most 1 element as currently it is considered as sargable only for its first argument. Multiple equality can add elements that are filled after substitution of field arguments by equal fields. There can be not more than select_lex->max_equal_elems such substitutions. */ sz= MY_MAX(sizeof(KEY_FIELD),sizeof(SARGABLE_PARAM))* ((sel->cond_count*2 + sel->between_count)*m+1); if (!(key_fields=(KEY_FIELD*) thd->alloc(sz))) DBUG_RETURN(TRUE); /* purecov: inspected */ and_level= 0; field= end= key_fields; *sargables= (SARGABLE_PARAM *) key_fields + (sz - sizeof((*sargables)[0].field))/sizeof(SARGABLE_PARAM); /* set a barrier for the array of SARGABLE_PARAM */ (*sargables)[0].field= 0; if (my_init_dynamic_array2(keyuse, sizeof(KEYUSE), thd->alloc(sizeof(KEYUSE) * 20), 20, 64, MYF(MY_THREAD_SPECIFIC))) DBUG_RETURN(TRUE); if (cond) { KEY_FIELD *saved_field= field; cond->add_key_fields(join_tab->join, &end, &and_level, normal_tables, sargables); for (; field != end ; field++) { /* Mark that we can optimize LEFT JOIN */ if (field->val->type() == Item::NULL_ITEM && !field->field->real_maybe_null()) field->field->table->reginfo.not_exists_optimize=1; } field= saved_field; } for (i=0 ; i < tables ; i++) { /* Block the creation of keys for inner tables of outer joins. Here only the outer joins that can not be converted to inner joins are left and all nests that can be eliminated are flattened. In the future when we introduce conditional accesses for inner tables in outer joins these keys will be taken into account as well. */ if (*join_tab[i].on_expr_ref) (*join_tab[i].on_expr_ref)->add_key_fields(join_tab->join, &end, &and_level, join_tab[i].table->map, sargables); } /* Process ON conditions for the nested joins */ { List_iterator li(*join_tab->join->join_list); TABLE_LIST *table; while ((table= li++)) { if (table->nested_join) add_key_fields_for_nj(join_tab->join, table, &end, &and_level, sargables); } } /* fill keyuse with found key parts */ for ( ; field != end ; field++) { if (add_key_part(keyuse,field)) DBUG_RETURN(TRUE); } if (select_lex->ftfunc_list->elements) { if (add_ft_keys(keyuse,join_tab,cond,normal_tables)) DBUG_RETURN(TRUE); } DBUG_RETURN(FALSE); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246349, "input": "AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config) { core_server_config *sconf = ap_get_core_module_config(s->module_config); void **new_space = (void **)apr_array_push(sconf->sec_dir); *new_space = dir_config; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342094, "input": "static int fuse_perm_getattr(struct inode *inode, int mask) { if (mask & MAY_NOT_BLOCK) return -ECHILD; forget_all_cached_acls(inode); return fuse_do_getattr(inode, NULL, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417024, "input": "void APar_Extract_AMR_Info(char *uint32_buffer, FILE *isofile, short track_level_atom, TrackInfo *track_info) { uint32_t amr_specific_offet = 8; APar_readX(track_info->encoder_name, isofile, parsedAtoms[track_level_atom].AtomicStart + amr_specific_offet, 4); if (track_info->track_codec == 0x73616D72 || track_info->track_codec == 0x73617762 || track_info->track_codec == 0x73766D72) { // samr,sawb & svmr contain modes only track_info->amr_modes = APar_read16( uint32_buffer, isofile, parsedAtoms[track_level_atom].AtomicStart + amr_specific_offet + 4 + 1); } return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453700, "input": "static int tcos_match_card(sc_card_t *card) { int i; i = _sc_match_atr(card, tcos_atrs, &card->type); if (i < 0) return 0; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398313, "input": "static void mcba_usb_write_bulk_callback(struct urb *urb) { struct mcba_usb_ctx *ctx = urb->context; struct net_device *netdev; WARN_ON(!ctx); netdev = ctx->priv->netdev; /* free up our allocated buffer */ usb_free_coherent(urb->dev, urb->transfer_buffer_length, urb->transfer_buffer, urb->transfer_dma); if (ctx->can) { if (!netif_device_present(netdev)) return; netdev->stats.tx_packets++; netdev->stats.tx_bytes += ctx->dlc; can_led_event(netdev, CAN_LED_EVENT_TX); can_get_echo_skb(netdev, ctx->ndx); } if (urb->status) netdev_info(netdev, \"Tx URB aborted (%d)\\n\", urb->status); /* Release the context */ mcba_usb_free_ctx(ctx); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232482, "input": "static bool is_ptr_cast_function(enum bpf_func_id func_id) { return func_id == BPF_FUNC_tcp_sock || func_id == BPF_FUNC_sk_fullsock; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219045, "input": "static Array str_offset_pair(const String& str, int offset, bool hackArrOutput) { return hackArrOutput ? make_vec_array(str, offset) : make_varray(str, offset); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234096, "input": "static u_int32_t ndpi_tls_refine_master_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int32_t protocol) { struct ndpi_packet_struct *packet = &flow->packet; // protocol = NDPI_PROTOCOL_TLS; if(packet->tcp != NULL) { switch(protocol) { case NDPI_PROTOCOL_TLS: { /* In case of TLS there are probably sub-protocols such as IMAPS that can be otherwise detected */ u_int16_t sport = ntohs(packet->tcp->source); u_int16_t dport = ntohs(packet->tcp->dest); if((sport == 465) || (dport == 465) || (sport == 587) || (dport == 587)) protocol = NDPI_PROTOCOL_MAIL_SMTPS; else if((sport == 993) || (dport == 993) || (flow->l4.tcp.mail_imap_starttls) ) protocol = NDPI_PROTOCOL_MAIL_IMAPS; else if((sport == 995) || (dport == 995)) protocol = NDPI_PROTOCOL_MAIL_POPS; } break; } } return(protocol); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269765, "input": "v8::Local WebContents::CapturePage(gin_helper::Arguments* args) { gfx::Rect rect; gin_helper::Promise promise(isolate()); v8::Local handle = promise.GetHandle(); // get rect arguments if they exist args->GetNext(&rect); auto* const view = web_contents()->GetRenderWidgetHostView(); if (!view) { promise.Resolve(gfx::Image()); return handle; } // Capture full page if user doesn't specify a |rect|. const gfx::Size view_size = rect.IsEmpty() ? view->GetViewBounds().size() : rect.size(); // By default, the requested bitmap size is the view size in screen // coordinates. However, if there's more pixel detail available on the // current system, increase the requested bitmap size to capture it all. gfx::Size bitmap_size = view_size; const gfx::NativeView native_view = view->GetNativeView(); const float scale = display::Screen::GetScreen() ->GetDisplayNearestView(native_view) .device_scale_factor(); if (scale > 1.0f) bitmap_size = gfx::ScaleToCeiledSize(view_size, scale); view->CopyFromSurface(gfx::Rect(rect.origin(), view_size), bitmap_size, base::BindOnce(&OnCapturePageDone, std::move(promise))); return handle; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490173, "input": "ecryptfs_encrypt_filename(struct ecryptfs_filename *filename, struct ecryptfs_crypt_stat *crypt_stat, struct ecryptfs_mount_crypt_stat *mount_crypt_stat) { int rc = 0; filename->encrypted_filename = NULL; filename->encrypted_filename_size = 0; if ((crypt_stat && (crypt_stat->flags & ECRYPTFS_ENCFN_USE_MOUNT_FNEK)) || (mount_crypt_stat && (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) { size_t packet_size; size_t remaining_bytes; rc = ecryptfs_write_tag_70_packet( NULL, NULL, &filename->encrypted_filename_size, mount_crypt_stat, NULL, filename->filename_size); if (rc) { printk(KERN_ERR \"%s: Error attempting to get packet \" \"size for tag 72; rc = [%d]\\n\", __func__, rc); filename->encrypted_filename_size = 0; goto out; } filename->encrypted_filename = kmalloc(filename->encrypted_filename_size, GFP_KERNEL); if (!filename->encrypted_filename) { printk(KERN_ERR \"%s: Out of memory whilst attempting \" \"to kmalloc [%zd] bytes\\n\", __func__, filename->encrypted_filename_size); rc = -ENOMEM; goto out; } remaining_bytes = filename->encrypted_filename_size; rc = ecryptfs_write_tag_70_packet(filename->encrypted_filename, &remaining_bytes, &packet_size, mount_crypt_stat, filename->filename, filename->filename_size); if (rc) { printk(KERN_ERR \"%s: Error attempting to generate \" \"tag 70 packet; rc = [%d]\\n\", __func__, rc); kfree(filename->encrypted_filename); filename->encrypted_filename = NULL; filename->encrypted_filename_size = 0; goto out; } filename->encrypted_filename_size = packet_size; } else { printk(KERN_ERR \"%s: No support for requested filename \" \"encryption method in this release\\n\", __func__); rc = -ENOTSUPP; goto out; } out: return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394650, "input": "LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, int level) { int top = (int)(L->top - L->base); int lim = TRACEBACK_LEVELS1; lua_Debug ar; if (msg) lua_pushfstring(L, \"%s\\n\", msg); lua_pushliteral(L, \"stack traceback:\"); while (lua_getstack(L1, level++, &ar)) { GCfunc *fn; if (level > lim) { if (!lua_getstack(L1, level + TRACEBACK_LEVELS2, &ar)) { level--; } else { lua_pushliteral(L, \"\\n\\t...\"); lua_getstack(L1, -10, &ar); level = ar.i_ci - TRACEBACK_LEVELS2; } lim = 2147483647; continue; } lua_getinfo(L1, \"Snlf\", &ar); fn = funcV(L1->top-1); L1->top--; if (isffunc(fn) && !*ar.namewhat) lua_pushfstring(L, \"\\n\\t[builtin#%d]:\", fn->c.ffid); else lua_pushfstring(L, \"\\n\\t%s:\", ar.short_src); if (ar.currentline > 0) lua_pushfstring(L, \"%d:\", ar.currentline); if (*ar.namewhat) { lua_pushfstring(L, \" in function \" LUA_QS, ar.name); } else { if (*ar.what == 'm') { lua_pushliteral(L, \" in main chunk\"); } else if (*ar.what == 'C') { lua_pushfstring(L, \" at %p\", fn->c.f); } else { lua_pushfstring(L, \" in function <%s:%d>\", ar.short_src, ar.linedefined); } } if ((int)(L->top - L->base) - top >= 15) lua_concat(L, (int)(L->top - L->base) - top); } lua_concat(L, (int)(L->top - L->base) - top); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280118, "input": "static ssize_t align_show(struct kmem_cache *s, char *buf) { return sprintf(buf, \"%u\\n\", s->align); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410804, "input": "static inline void tcp_slow_start_after_idle_check(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); s32 delta; if (!sysctl_tcp_slow_start_after_idle || tp->packets_out) return; delta = tcp_time_stamp - tp->lsndtime; if (delta > inet_csk(sk)->icsk_rto) tcp_cwnd_restart(sk, delta); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232466, "input": "static bool reg_type_mismatch(enum bpf_reg_type src, enum bpf_reg_type prev) { return src != prev && (!reg_type_mismatch_ok(src) || !reg_type_mismatch_ok(prev)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202741, "input": "static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) { struct io_buffer *buf; u64 addr = pbuf->addr; int i, bid = pbuf->bid; for (i = 0; i < pbuf->nbufs; i++) { buf = kmalloc(sizeof(*buf), GFP_KERNEL); if (!buf) break; buf->addr = addr; buf->len = pbuf->len; buf->bid = bid; addr += pbuf->len; bid++; if (!*head) { INIT_LIST_HEAD(&buf->list); *head = buf; } else { list_add_tail(&buf->list, &(*head)->list); } } return i ? i : -ENOMEM; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "The io_uring subsystem in the Linux kernel allowed the MAX_RW_COUNT limit to be bypassed in the PROVIDE_BUFFERS operation, which led to negative values being usedin mem_rw when reading /proc//mem. This could be used to create a heap overflow leading to arbitrary code execution in the kernel. It was addressed via commit d1f82808877b (\"io_uring: truncate lengths larger than MAX_RW_COUNT on provide buffers\") (v5.13-rc1) and backported to the stable kernels in v5.12.4, v5.11.21, and v5.10.37. It was introduced in ddf0322db79c (\"io_uring: add IORING_OP_PROVIDE_BUFFERS\") (v5.7-rc1).", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-3491"}} -{"idx": 313040, "input": "undo_read_time(bufinfo_T *bi) { #ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { char_u buf[8]; time_t n = 0; int i; undo_read(bi, buf, (size_t)8); for (i = 0; i < 8; ++i) n = (n << 8) + buf[i]; return n; } #endif return get8ctime(bi->bi_fp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267889, "input": "GF_Err stbl_AddDependencyType(GF_SampleTableBox *stbl, u32 sampleNumber, u32 isLeading, u32 dependsOn, u32 dependedOn, u32 redundant) { u32 flags; GF_SampleDependencyTypeBox *sdtp; if (stbl->SampleDep == NULL) { stbl->SampleDep = (GF_SampleDependencyTypeBox *) gf_isom_box_new_parent(&stbl->child_boxes, GF_ISOM_BOX_TYPE_SDTP); if (!stbl->SampleDep) return GF_OUT_OF_MEM; } sdtp = stbl->SampleDep; if (sdtp->sampleCount + 1 < sampleNumber) { u32 missed = sampleNumber-1 - sdtp->sampleCount; sdtp->sample_info = (u8*) gf_realloc(sdtp->sample_info, sizeof(u8) * (sdtp->sampleCount+missed) ); if (!sdtp->sample_info) return GF_OUT_OF_MEM; sdtp->sample_alloc = sdtp->sampleCount+missed; memset(&sdtp->sample_info[sdtp->sampleCount], 0, sizeof(u8) * missed ); while (missed) { GF_ISOSAPType isRAP; if (stbl->SyncSample) stbl_GetSampleRAP(stbl->SyncSample, sdtp->sampleCount+1, &isRAP, NULL, NULL); else isRAP = 1; sdtp->sample_info[sdtp->sampleCount] = isRAP ? (2<<4) : 0; if (isRAP) { sdtp->sample_info[sdtp->sampleCount] = 0; } sdtp->sampleCount++; missed--; } } flags = 0; flags |= isLeading << 6; flags |= dependsOn << 4; flags |= dependedOn << 2; flags |= redundant; sdtp->sample_info = (u8*) gf_realloc(sdtp->sample_info, sizeof(u8) * (sdtp->sampleCount + 1)); if (!sdtp->sample_info) return GF_OUT_OF_MEM; sdtp->sample_alloc = sdtp->sampleCount + 1; if (sdtp->sampleCount < sampleNumber) { sdtp->sample_info[sdtp->sampleCount] = flags; } else { u32 snum = sampleNumber-1; memmove(sdtp->sample_info+snum+1, sdtp->sample_info+snum, sizeof(u8) * (sdtp->sampleCount - snum) ); sdtp->sample_info[snum] = flags; } //update our list sdtp->sampleCount ++; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453375, "input": "*/ static bool bfq_bfqq_must_idle(struct bfq_queue *bfqq) { return RB_EMPTY_ROOT(&bfqq->sort_list) && bfq_better_to_idle(bfqq);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333137, "input": "repodata_serialize_key(Repodata *data, struct extdata *newincore, struct extdata *newvincore, Id *schema, Repokey *key, Id val) { Id *ida; struct extdata *xd; unsigned int oldvincorelen = 0; Id schemaid, *sp; xd = newincore; if (key->storage == KEY_STORAGE_VERTICAL_OFFSET) { xd = newvincore; oldvincorelen = xd->len; } switch (key->type) { case REPOKEY_TYPE_VOID: case REPOKEY_TYPE_CONSTANT: case REPOKEY_TYPE_CONSTANTID: case REPOKEY_TYPE_DELETED: break; case REPOKEY_TYPE_STR: data_addblob(xd, data->attrdata + val, strlen((char *)(data->attrdata + val)) + 1); break; case REPOKEY_TYPE_MD5: data_addblob(xd, data->attrdata + val, SIZEOF_MD5); break; case REPOKEY_TYPE_SHA1: data_addblob(xd, data->attrdata + val, SIZEOF_SHA1); break; case REPOKEY_TYPE_SHA224: data_addblob(xd, data->attrdata + val, SIZEOF_SHA224); break; case REPOKEY_TYPE_SHA256: data_addblob(xd, data->attrdata + val, SIZEOF_SHA256); break; case REPOKEY_TYPE_SHA384: data_addblob(xd, data->attrdata + val, SIZEOF_SHA384); break; case REPOKEY_TYPE_SHA512: data_addblob(xd, data->attrdata + val, SIZEOF_SHA512); break; case REPOKEY_TYPE_NUM: if (val & 0x80000000) { data_addid64(xd, data->attrnum64data[val ^ 0x80000000]); break; } /* FALLTHROUGH */ case REPOKEY_TYPE_ID: case REPOKEY_TYPE_DIR: data_addid(xd, val); break; case REPOKEY_TYPE_BINARY: { Id len; unsigned char *dp = data_read_id(data->attrdata + val, &len); dp += (unsigned int)len; data_addblob(xd, data->attrdata + val, dp - (data->attrdata + val)); } break; case REPOKEY_TYPE_IDARRAY: for (ida = data->attriddata + val; *ida; ida++) data_addideof(xd, ida[0], ida[1] ? 0 : 1); break; case REPOKEY_TYPE_DIRNUMNUMARRAY: for (ida = data->attriddata + val; *ida; ida += 3) { data_addid(xd, ida[0]); data_addid(xd, ida[1]); data_addideof(xd, ida[2], ida[3] ? 0 : 1); } break; case REPOKEY_TYPE_DIRSTRARRAY: for (ida = data->attriddata + val; *ida; ida += 2) { data_addideof(xd, ida[0], ida[2] ? 0 : 1); data_addblob(xd, data->attrdata + ida[1], strlen((char *)(data->attrdata + ida[1])) + 1); } break; case REPOKEY_TYPE_FIXARRAY: { int num = 0; schemaid = 0; for (ida = data->attriddata + val; *ida; ida++) { Id *kp; sp = schema; kp = data->xattrs[-*ida]; if (!kp) continue; /* ignore empty elements */ num++; for (; *kp; kp += 2) *sp++ = *kp; *sp = 0; if (!schemaid) schemaid = repodata_schema2id(data, schema, 1); else if (schemaid != repodata_schema2id(data, schema, 0)) { pool_debug(data->repo->pool, SOLV_ERROR, \"repodata_serialize_key: fixarray substructs with different schemas\\n\"); num = 0; break; } } data_addid(xd, num); if (!num) break; data_addid(xd, schemaid); for (ida = data->attriddata + val; *ida; ida++) { Id *kp = data->xattrs[-*ida]; if (!kp) continue; for (; *kp; kp += 2) repodata_serialize_key(data, newincore, newvincore, schema, data->keys + *kp, kp[1]); } break; } case REPOKEY_TYPE_FLEXARRAY: { int num = 0; for (ida = data->attriddata + val; *ida; ida++) num++; data_addid(xd, num); for (ida = data->attriddata + val; *ida; ida++) { Id *kp = data->xattrs[-*ida]; if (!kp) { data_addid(xd, 0); /* XXX */ continue; } sp = schema; for (;*kp; kp += 2) *sp++ = *kp; *sp = 0; schemaid = repodata_schema2id(data, schema, 1); data_addid(xd, schemaid); kp = data->xattrs[-*ida]; for (;*kp; kp += 2) repodata_serialize_key(data, newincore, newvincore, schema, data->keys + *kp, kp[1]); } break; } default: pool_debug(data->repo->pool, SOLV_FATAL, \"repodata_serialize_key: don't know how to handle type %d\\n\", key->type); exit(1); } if (key->storage == KEY_STORAGE_VERTICAL_OFFSET) { /* put offset/len in incore */ data_addid(newincore, data->lastverticaloffset + oldvincorelen); oldvincorelen = xd->len - oldvincorelen; data_addid(newincore, oldvincorelen); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204345, "input": "static OPJ_BOOL opj_j2k_write_sod(opj_j2k_t *p_j2k, opj_tcd_t * p_tile_coder, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, OPJ_UINT32 total_data_size, const opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) { opj_codestream_info_t *l_cstr_info = 00; OPJ_UINT32 l_remaining_data; opj_tcd_marker_info_t* marker_info = NULL; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); OPJ_UNUSED(p_stream); if (total_data_size < 4) { opj_event_msg(p_manager, EVT_ERROR, \"Not enough bytes in output buffer to write SOD marker\\n\"); return OPJ_FALSE; } opj_write_bytes(p_data, J2K_MS_SOD, 2); /* SOD */ /* make room for the EOF marker */ l_remaining_data = total_data_size - 4; /* update tile coder */ p_tile_coder->tp_num = p_j2k->m_specific_param.m_encoder.m_current_poc_tile_part_number ; p_tile_coder->cur_tp_num = p_j2k->m_specific_param.m_encoder.m_current_tile_part_number; /* INDEX >> */ /* TODO mergeV2: check this part which use cstr_info */ /*l_cstr_info = p_j2k->cstr_info; if (l_cstr_info) { if (!p_j2k->m_specific_param.m_encoder.m_current_tile_part_number ) { //TODO cstr_info->tile[p_j2k->m_current_tile_number].end_header = p_stream_tell(p_stream) + p_j2k->pos_correction - 1; l_cstr_info->tile[p_j2k->m_current_tile_number].tileno = p_j2k->m_current_tile_number; } else {*/ /* TODO if (cstr_info->tile[p_j2k->m_current_tile_number].packet[cstr_info->packno - 1].end_pos < p_stream_tell(p_stream)) { cstr_info->tile[p_j2k->m_current_tile_number].packet[cstr_info->packno].start_pos = p_stream_tell(p_stream); }*/ /*}*/ /* UniPG>> */ #ifdef USE_JPWL /* update markers struct */ /*OPJ_BOOL res = j2k_add_marker(p_j2k->cstr_info, J2K_MS_SOD, p_j2k->sod_start, 2); */ assert(0 && \"TODO\"); #endif /* USE_JPWL */ /* <m_specific_param.m_encoder.m_current_tile_part_number == 0) { p_tile_coder->tcd_image->tiles->packno = 0; #ifdef deadcode if (l_cstr_info) { l_cstr_info->packno = 0; } #endif } *p_data_written = 0; if (p_j2k->m_specific_param.m_encoder.m_PLT) { marker_info = opj_tcd_marker_info_create( p_j2k->m_specific_param.m_encoder.m_PLT); if (marker_info == NULL) { opj_event_msg(p_manager, EVT_ERROR, \"Cannot encode tile: opj_tcd_marker_info_create() failed\\n\"); return OPJ_FALSE; } } assert(l_remaining_data > p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT); l_remaining_data -= p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT; if (! opj_tcd_encode_tile(p_tile_coder, p_j2k->m_current_tile_number, p_data + 2, p_data_written, l_remaining_data, l_cstr_info, marker_info, p_manager)) { opj_event_msg(p_manager, EVT_ERROR, \"Cannot encode tile\\n\"); opj_tcd_marker_info_destroy(marker_info); return OPJ_FALSE; } /* For SOD */ *p_data_written += 2; if (p_j2k->m_specific_param.m_encoder.m_PLT) { OPJ_UINT32 l_data_written_PLT = 0; OPJ_BYTE* p_PLT_buffer = (OPJ_BYTE*)opj_malloc( p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT); if (!p_PLT_buffer) { opj_event_msg(p_manager, EVT_ERROR, \"Cannot allocate memory\\n\"); opj_tcd_marker_info_destroy(marker_info); return OPJ_FALSE; } if (!opj_j2k_write_plt_in_memory(p_j2k, marker_info, p_PLT_buffer, &l_data_written_PLT, p_manager)) { opj_tcd_marker_info_destroy(marker_info); opj_free(p_PLT_buffer); return OPJ_FALSE; } assert(l_data_written_PLT <= p_j2k->m_specific_param.m_encoder.m_reserved_bytes_for_PLT); /* Move PLT marker(s) before SOD */ memmove(p_data + l_data_written_PLT, p_data, *p_data_written); memcpy(p_data, p_PLT_buffer, l_data_written_PLT); opj_free(p_PLT_buffer); *p_data_written += l_data_written_PLT; } opj_tcd_marker_info_destroy(marker_info); return OPJ_TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Input Validation"], "explanation": "A flaw was found in openjpeg's src/lib/openjp2/t2.c in versions prior to 2.4.0. This flaw allows an attacker to provide crafted input to openjpeg during conversion and encoding, causing an out-of-bounds write. The highest threat from this vulnerability is to confidentiality, integrity, as well as system availability.", "severity_level": "NoInfo", "cwe": "CWE-20", "cve": "CVE-2020-27844"}} -{"idx": 408520, "input": "static void write_to_phy(MSF2EmacState *s) { uint8_t reg_addr = s->regs[R_MII_ADDR] & R_MII_ADDR_REGADDR_MASK; uint8_t phy_addr = (s->regs[R_MII_ADDR] >> R_MII_ADDR_PHYADDR_SHIFT) & R_MII_ADDR_REGADDR_MASK; uint16_t data = s->regs[R_MII_CTL] & 0xFFFF; if (phy_addr != PHYADDR) { return; } switch (reg_addr) { case MII_BMCR: if (data & MII_BMCR_RESET) { /* Phy reset */ msf2_phy_reset(s); data &= ~MII_BMCR_RESET; } if (data & MII_BMCR_AUTOEN) { /* Complete autonegotiation immediately */ data &= ~MII_BMCR_AUTOEN; s->phy_regs[MII_BMSR] |= MII_BMSR_AN_COMP; } break; } s->phy_regs[reg_addr] = data; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 454786, "input": "~sst_thread_arg() { mysql_cond_destroy (&cond); mysql_mutex_unlock (&lock); mysql_mutex_destroy (&lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 451894, "input": "int msg_new(message_data_t **m) { message_data_t *ret = (message_data_t *) xmalloc(sizeof(message_data_t)); ret->data = NULL; ret->f = NULL; ret->id = NULL; ret->path = NULL; ret->control = NULL; ret->size = 0; strarray_init(&ret->rcpt); ret->date = NULL; ret->hdrcache = spool_new_hdrcache(); *m = ret; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197133, "input": "void Compute(OpKernelContext* context) override { // Here's the basic idea: // Batch and depth dimension are independent from row and col dimension. And // because FractionalAvgPool currently only support pooling along row and // col, we can basically think of this 4D tensor backpropagation as // operation of a series of 2D planes. // // For each element of a 'slice' (2D plane) of output_backprop, we need to // figure out its contributors when doing FractionalAvgPool operation. This // can be done based on row_pooling_sequence, col_pooling_seq and // overlapping. // Once we figure out the original contributors, we just need to evenly // divide the value of this element among these contributors. // // Internally, we divide the out_backprop tensor and store it in a temporary // tensor of double type. And cast it to the corresponding type. typedef Eigen::Map> ConstEigenMatrixMap; typedef Eigen::Map> EigenDoubleMatrixMap; // Grab the inputs. const Tensor& orig_input_tensor_shape = context->input(0); OP_REQUIRES(context, orig_input_tensor_shape.dims() == 1 && orig_input_tensor_shape.NumElements() == 4, errors::InvalidArgument(\"original input tensor shape must be\" \"1-dimensional and 4 elements\")); const Tensor& out_backprop = context->input(1); const Tensor& row_seq_tensor = context->input(2); const Tensor& col_seq_tensor = context->input(3); const int64 out_batch = out_backprop.dim_size(0); const int64 out_rows = out_backprop.dim_size(1); const int64 out_cols = out_backprop.dim_size(2); const int64 out_depth = out_backprop.dim_size(3); auto row_seq_tensor_flat = row_seq_tensor.flat(); auto col_seq_tensor_flat = col_seq_tensor.flat(); auto orig_input_tensor_shape_flat = orig_input_tensor_shape.flat(); const int64 in_batch = orig_input_tensor_shape_flat(0); const int64 in_rows = orig_input_tensor_shape_flat(1); const int64 in_cols = orig_input_tensor_shape_flat(2); const int64 in_depth = orig_input_tensor_shape_flat(3); constexpr int tensor_in_and_out_dims = 4; // Transform orig_input_tensor_shape into TensorShape TensorShape in_shape; for (auto i = 0; i < tensor_in_and_out_dims; ++i) { in_shape.AddDim(orig_input_tensor_shape_flat(i)); } // Create intermediate in_backprop. Tensor in_backprop_tensor_temp; OP_REQUIRES_OK(context, context->forward_input_or_allocate_temp( {0}, DataTypeToEnum::v(), in_shape, &in_backprop_tensor_temp)); in_backprop_tensor_temp.flat().setZero(); // Transform 4D tensor to 2D matrix. EigenDoubleMatrixMap in_backprop_tensor_temp_mat( in_backprop_tensor_temp.flat().data(), in_depth, in_cols * in_rows * in_batch); ConstEigenMatrixMap out_backprop_mat(out_backprop.flat().data(), out_depth, out_cols * out_rows * out_batch); // Loop through each element of out_backprop and evenly distribute the // element to the corresponding pooling cell. const int64 in_max_row_index = in_rows - 1; const int64 in_max_col_index = in_cols - 1; for (int64 b = 0; b < out_batch; ++b) { for (int64 r = 0; r < out_rows; ++r) { const int64 in_row_start = row_seq_tensor_flat(r); int64 in_row_end = overlapping_ ? row_seq_tensor_flat(r + 1) : row_seq_tensor_flat(r + 1) - 1; in_row_end = std::min(in_row_end, in_max_row_index); for (int64 c = 0; c < out_cols; ++c) { const int64 in_col_start = col_seq_tensor_flat(c); int64 in_col_end = overlapping_ ? col_seq_tensor_flat(c + 1) : col_seq_tensor_flat(c + 1) - 1; in_col_end = std::min(in_col_end, in_max_col_index); const int64 num_elements_in_pooling_cell = (in_row_end - in_row_start + 1) * (in_col_end - in_col_start + 1); const int64 out_index = (b * out_rows + r) * out_cols + c; // Now we can evenly distribute out_backprop(b, h, w, *) to // in_backprop(b, hs:he, ws:we, *). for (int64 in_r = in_row_start; in_r <= in_row_end; ++in_r) { for (int64 in_c = in_col_start; in_c <= in_col_end; ++in_c) { const int64 in_index = (b * in_rows + in_r) * in_cols + in_c; // Walk through each channel (depth). for (int64 d = 0; d < out_depth; ++d) { const double out_backprop_element = static_cast( out_backprop_mat.coeffRef(d, out_index)); double& in_backprop_ref = in_backprop_tensor_temp_mat.coeffRef(d, in_index); in_backprop_ref += out_backprop_element / num_elements_in_pooling_cell; } } } } } } // Depending on the type, cast double to type T. Tensor* in_backprop_tensor = nullptr; OP_REQUIRES_OK(context, context->forward_input_or_allocate_output( {0}, 0, in_shape, &in_backprop_tensor)); auto in_backprop_tensor_flat = in_backprop_tensor->flat(); auto in_backprop_tensor_temp_flat = in_backprop_tensor_temp.flat(); for (int64 i = 0; i < in_backprop_tensor_flat.size(); ++i) { in_backprop_tensor_flat(i) = static_cast(in_backprop_tensor_temp_flat(i)); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.FractionalAvgPoolGrad` is vulnerable to a heap buffer overflow. The implementation(https://github.com/tensorflow/tensorflow/blob/dcba796a28364d6d7f003f6fe733d82726dda713/tensorflow/core/kernels/fractional_avg_pool_op.cc#L216) fails to validate that the pooling sequence arguments have enough elements as required by the `out_backprop` tensor shape. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-29578"}} -{"idx": 508605, "input": "setup_new_fields(THD *thd, List &fields, List &all_fields, ORDER *new_field) { Item **item; uint counter; enum_resolution_type not_used; DBUG_ENTER(\"setup_new_fields\"); thd->column_usage= MARK_COLUMNS_READ; // Not really needed, but... for (; new_field ; new_field= new_field->next) { if ((item= find_item_in_list(*new_field->item, fields, &counter, IGNORE_ERRORS, ¬_used))) new_field->item=item; /* Change to shared Item */ else { thd->where=\"procedure list\"; if ((*new_field->item)->fix_fields(thd, new_field->item)) DBUG_RETURN(1); /* purecov: inspected */ all_fields.push_front(*new_field->item, thd->mem_root); new_field->item=all_fields.head_ref(); } } DBUG_RETURN(0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 455266, "input": "CreateMultiStringPopUp ( IN UINTN RequestedWidth, IN UINTN NumberOfLines, ... ) { VA_LIST Marker; VA_START (Marker, NumberOfLines); CreateSharedPopUp (RequestedWidth, NumberOfLines, Marker); VA_END (Marker); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281516, "input": "static int execlists_request_alloc(struct i915_request *request) { int ret; GEM_BUG_ON(!intel_context_is_pinned(request->hw_context)); /* * Flush enough space to reduce the likelihood of waiting after * we start building the request - in which case we will just * have to repeat work. */ request->reserved_space += EXECLISTS_REQUEST_SIZE; /* * Note that after this point, we have committed to using * this request as it is being used to both track the * state of engine initialisation and liveness of the * golden renderstate above. Think twice before you try * to cancel/unwind this request now. */ /* Unconditionally invalidate GPU caches and TLBs. */ ret = request->engine->emit_flush(request, EMIT_INVALIDATE); if (ret) return ret; request->reserved_space -= EXECLISTS_REQUEST_SIZE; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 345170, "input": "int _ssh_buffer_unpack(struct ssh_buffer_struct *buffer, const char *format, size_t argc, ...) { va_list ap; int rc; va_start(ap, argc); rc = ssh_buffer_unpack_va(buffer, format, argc, ap); va_end(ap); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338585, "input": "static int io_sendmsg_prep_async(struct io_kiocb *req) { int ret; ret = io_sendmsg_copy_hdr(req, req->async_data); if (!ret) req->flags |= REQ_F_NEED_CLEANUP; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 455261, "input": "GetBufAndLenForValue ( IN EFI_HII_VALUE *Value, OUT UINT8 **Buf, OUT UINT16 *BufLen ) { switch (Value->Type) { case EFI_IFR_TYPE_BUFFER: *Buf = Value->Buffer; *BufLen = Value->BufferLen; break; case EFI_IFR_TYPE_DATE: *Buf = (UINT8 *) (&Value->Value.date); *BufLen = (UINT16) sizeof (EFI_HII_DATE); break; case EFI_IFR_TYPE_TIME: *Buf = (UINT8 *) (&Value->Value.time); *BufLen = (UINT16) sizeof (EFI_HII_TIME); break; case EFI_IFR_TYPE_REF: *Buf = (UINT8 *) (&Value->Value.ref); *BufLen = (UINT16) sizeof (EFI_HII_REF); break; default: *Buf = NULL; *BufLen = 0; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238831, "input": "WrappedConverter() {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 505206, "input": "auth_server_lookup_request(struct auth_server_connection *conn, const char *id_arg, bool remove, struct auth_client_request **request_r) { struct auth_client_request *request; unsigned int id; if (id_arg == NULL || str_to_uint(id_arg, &id) < 0) { i_error(\"BUG: Authentication server input missing ID\"); return -1; } request = hash_table_lookup(conn->requests, POINTER_CAST(id)); if (request == NULL) { i_error(\"BUG: Authentication server sent unknown id %u\", id); return -1; } if (remove || auth_client_request_is_aborted(request)) hash_table_remove(conn->requests, POINTER_CAST(id)); *request_r = request; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499903, "input": "static void add_timer_randomness(struct timer_rand_state *state, unsigned num) { struct { cycles_t cycles; long jiffies; unsigned num; } sample; long delta, delta2, delta3; preempt_disable(); /* if over the trickle threshold, use only 1 in 4096 samples */ if (input_pool.entropy_count > trickle_thresh && (__get_cpu_var(trickle_count)++ & 0xfff)) goto out; sample.jiffies = jiffies; sample.cycles = get_cycles(); sample.num = num; mix_pool_bytes(&input_pool, &sample, sizeof(sample)); /* * Calculate number of bits of randomness we probably added. * We take into account the first, second and third-order deltas * in order to make our estimate. */ if (!state->dont_count_entropy) { delta = sample.jiffies - state->last_time; state->last_time = sample.jiffies; delta2 = delta - state->last_delta; state->last_delta = delta; delta3 = delta2 - state->last_delta2; state->last_delta2 = delta2; if (delta < 0) delta = -delta; if (delta2 < 0) delta2 = -delta2; if (delta3 < 0) delta3 = -delta3; if (delta > delta2) delta = delta2; if (delta > delta3) delta = delta3; /* * delta is now minimum absolute delta. * Round down by 1 bit on general principles, * and limit entropy entimate to 12 bits. */ credit_entropy_bits(&input_pool, min_t(int, fls(delta>>1), 11)); } out: preempt_enable(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263060, "input": "iasecc_init_amos_or_sagem(struct sc_card *card) { struct sc_context *ctx = card->ctx; unsigned int flags; int rv = 0; LOG_FUNC_CALLED(ctx); flags = IASECC_CARD_DEFAULT_FLAGS; _sc_card_add_rsa_alg(card, 1024, flags, 0x10001); _sc_card_add_rsa_alg(card, 2048, flags, 0x10001); card->caps = IASECC_CARD_DEFAULT_CAPS; if (card->type == SC_CARD_TYPE_IASECC_MI) { rv = iasecc_mi_match(card); if (rv) card->type = SC_CARD_TYPE_IASECC_MI2; else LOG_FUNC_RETURN(ctx, SC_SUCCESS); } rv = iasecc_parse_ef_atr(card); if (rv == SC_ERROR_FILE_NOT_FOUND) { rv = iasecc_select_mf(card, NULL); LOG_TEST_RET(ctx, rv, \"MF selection error\"); rv = iasecc_parse_ef_atr(card); } LOG_TEST_RET(ctx, rv, \"IASECC: ATR parse failed\"); LOG_FUNC_RETURN(ctx, SC_SUCCESS); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 496257, "input": "static void __exit exit_em86_binfmt(void) { unregister_binfmt(&em86_format); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506577, "input": "graphics_null() { fprintf(stderr, \"WARNING: Plotting with an 'unknown' terminal.\\n\" \"No output will be generated. Please select a terminal with 'set terminal'.\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281554, "input": "static void execlists_cancel_requests(struct intel_engine_cs *engine) { struct intel_engine_execlists * const execlists = &engine->execlists; struct i915_request *rq, *rn; struct rb_node *rb; unsigned long flags; GEM_TRACE(\"%s\\n\", engine->name); /* * Before we call engine->cancel_requests(), we should have exclusive * access to the submission state. This is arranged for us by the * caller disabling the interrupt generation, the tasklet and other * threads that may then access the same state, giving us a free hand * to reset state. However, we still need to let lockdep be aware that * we know this state may be accessed in hardirq context, so we * disable the irq around this manipulation and we want to keep * the spinlock focused on its duties and not accidentally conflate * coverage to the submission's irq state. (Similarly, although we * shouldn't need to disable irq around the manipulation of the * submission's irq state, we also wish to remind ourselves that * it is irq state.) */ spin_lock_irqsave(&engine->active.lock, flags); __execlists_reset(engine, true); /* Mark all executing requests as skipped. */ list_for_each_entry(rq, &engine->active.requests, sched.link) mark_eio(rq); /* Flush the queued requests to the timeline list (for retiring). */ while ((rb = rb_first_cached(&execlists->queue))) { struct i915_priolist *p = to_priolist(rb); int i; priolist_for_each_request_consume(rq, rn, p, i) { mark_eio(rq); __i915_request_submit(rq); } rb_erase_cached(&p->node, &execlists->queue); i915_priolist_free(p); } /* Cancel all attached virtual engines */ while ((rb = rb_first_cached(&execlists->virtual))) { struct virtual_engine *ve = rb_entry(rb, typeof(*ve), nodes[engine->id].rb); rb_erase_cached(rb, &execlists->virtual); RB_CLEAR_NODE(rb); spin_lock(&ve->base.active.lock); rq = fetch_and_zero(&ve->request); if (rq) { mark_eio(rq); rq->engine = engine; __i915_request_submit(rq); i915_request_put(rq); ve->base.execlists.queue_priority_hint = INT_MIN; } spin_unlock(&ve->base.active.lock); } /* Remaining _unready_ requests will be nop'ed when submitted */ execlists->queue_priority_hint = INT_MIN; execlists->queue = RB_ROOT_CACHED; GEM_BUG_ON(__tasklet_is_enabled(&execlists->tasklet)); execlists->tasklet.func = nop_submission_tasklet; spin_unlock_irqrestore(&engine->active.lock, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430845, "input": "UnicodeString::getChar32At(int32_t offset) const { return char32At(offset); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342149, "input": "static int fuse_inode_set(struct inode *inode, void *_nodeidp) { u64 nodeid = *(u64 *) _nodeidp; get_fuse_inode(inode)->nodeid = nodeid; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402135, "input": "static INLINE BOOL RLEDECOMPRESS(const BYTE* pbSrcBuffer, UINT32 cbSrcBuffer, BYTE* pbDestBuffer, UINT32 rowDelta, UINT32 width, UINT32 height) { const BYTE* pbSrc = pbSrcBuffer; const BYTE* pbEnd; const BYTE* pbDestEnd; BYTE* pbDest = pbDestBuffer; PIXEL temp; PIXEL fgPel = WHITE_PIXEL; BOOL fInsertFgPel = FALSE; BOOL fFirstLine = TRUE; BYTE bitmask; PIXEL pixelA, pixelB; UINT32 runLength; UINT32 code; UINT32 advance; RLEEXTRA if ((rowDelta == 0) || (rowDelta < width)) return FALSE; if (!pbSrcBuffer || !pbDestBuffer) return FALSE; pbEnd = pbSrcBuffer + cbSrcBuffer; pbDestEnd = pbDestBuffer + rowDelta * height; while (pbSrc < pbEnd) { /* Watch out for the end of the first scanline. */ if (fFirstLine) { if ((UINT32)(pbDest - pbDestBuffer) >= rowDelta) { fFirstLine = FALSE; fInsertFgPel = FALSE; } } /* Extract the compression order code ID from the compression order header. */ code = ExtractCodeId(*pbSrc); /* Handle Background Run Orders. */ if (code == REGULAR_BG_RUN || code == MEGA_MEGA_BG_RUN) { runLength = ExtractRunLength(code, pbSrc, &advance); pbSrc = pbSrc + advance; if (fFirstLine) { if (fInsertFgPel) { if (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1)) return FALSE; DESTWRITEPIXEL(pbDest, fgPel); DESTNEXTPIXEL(pbDest); runLength = runLength - 1; } if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength)) return FALSE; UNROLL(runLength, { DESTWRITEPIXEL(pbDest, BLACK_PIXEL); DESTNEXTPIXEL(pbDest); }); } else { if (fInsertFgPel) { DESTREADPIXEL(temp, pbDest - rowDelta); if (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1)) return FALSE; DESTWRITEPIXEL(pbDest, temp ^ fgPel); DESTNEXTPIXEL(pbDest); runLength--; } if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength)) return FALSE; UNROLL(runLength, { DESTREADPIXEL(temp, pbDest - rowDelta); DESTWRITEPIXEL(pbDest, temp); DESTNEXTPIXEL(pbDest); }); } /* A follow-on background run order will need a foreground pel inserted. */ fInsertFgPel = TRUE; continue; } /* For any of the other run-types a follow-on background run order does not need a foreground pel inserted. */ fInsertFgPel = FALSE; switch (code) { /* Handle Foreground Run Orders. */ case REGULAR_FG_RUN: case MEGA_MEGA_FG_RUN: case LITE_SET_FG_FG_RUN: case MEGA_MEGA_SET_FG_RUN: runLength = ExtractRunLength(code, pbSrc, &advance); pbSrc = pbSrc + advance; if (code == LITE_SET_FG_FG_RUN || code == MEGA_MEGA_SET_FG_RUN) { if (pbSrc >= pbEnd) return FALSE; SRCREADPIXEL(fgPel, pbSrc); SRCNEXTPIXEL(pbSrc); } if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength)) return FALSE; if (fFirstLine) { UNROLL(runLength, { DESTWRITEPIXEL(pbDest, fgPel); DESTNEXTPIXEL(pbDest); }); } else { UNROLL(runLength, { DESTREADPIXEL(temp, pbDest - rowDelta); DESTWRITEPIXEL(pbDest, temp ^ fgPel); DESTNEXTPIXEL(pbDest); }); } break; /* Handle Dithered Run Orders. */ case LITE_DITHERED_RUN: case MEGA_MEGA_DITHERED_RUN: runLength = ExtractRunLength(code, pbSrc, &advance); pbSrc = pbSrc + advance; if (pbSrc >= pbEnd) return FALSE; SRCREADPIXEL(pixelA, pbSrc); SRCNEXTPIXEL(pbSrc); if (pbSrc >= pbEnd) return FALSE; SRCREADPIXEL(pixelB, pbSrc); SRCNEXTPIXEL(pbSrc); if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength * 2)) return FALSE; UNROLL(runLength, { DESTWRITEPIXEL(pbDest, pixelA); DESTNEXTPIXEL(pbDest); DESTWRITEPIXEL(pbDest, pixelB); DESTNEXTPIXEL(pbDest); }); break; /* Handle Color Run Orders. */ case REGULAR_COLOR_RUN: case MEGA_MEGA_COLOR_RUN: runLength = ExtractRunLength(code, pbSrc, &advance); pbSrc = pbSrc + advance; if (pbSrc >= pbEnd) return FALSE; SRCREADPIXEL(pixelA, pbSrc); SRCNEXTPIXEL(pbSrc); if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength)) return FALSE; UNROLL(runLength, { DESTWRITEPIXEL(pbDest, pixelA); DESTNEXTPIXEL(pbDest); }); break; /* Handle Foreground/Background Image Orders. */ case REGULAR_FGBG_IMAGE: case MEGA_MEGA_FGBG_IMAGE: case LITE_SET_FG_FGBG_IMAGE: case MEGA_MEGA_SET_FGBG_IMAGE: runLength = ExtractRunLength(code, pbSrc, &advance); pbSrc = pbSrc + advance; if (pbSrc >= pbEnd) return FALSE; if (code == LITE_SET_FG_FGBG_IMAGE || code == MEGA_MEGA_SET_FGBG_IMAGE) { SRCREADPIXEL(fgPel, pbSrc); SRCNEXTPIXEL(pbSrc); } if (fFirstLine) { while (runLength > 8) { bitmask = *pbSrc; pbSrc = pbSrc + 1; pbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, 8); if (!pbDest) return FALSE; runLength = runLength - 8; } } else { while (runLength > 8) { bitmask = *pbSrc; pbSrc = pbSrc + 1; pbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, 8); if (!pbDest) return FALSE; runLength = runLength - 8; } } if (runLength > 0) { bitmask = *pbSrc; pbSrc = pbSrc + 1; if (fFirstLine) { pbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, bitmask, fgPel, runLength); } else { pbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, bitmask, fgPel, runLength); } if (!pbDest) return FALSE; } break; /* Handle Color Image Orders. */ case REGULAR_COLOR_IMAGE: case MEGA_MEGA_COLOR_IMAGE: runLength = ExtractRunLength(code, pbSrc, &advance); pbSrc = pbSrc + advance; if (!ENSURE_CAPACITY(pbDest, pbDestEnd, runLength)) return FALSE; UNROLL(runLength, { if (pbSrc >= pbEnd) return FALSE; SRCREADPIXEL(temp, pbSrc); SRCNEXTPIXEL(pbSrc); DESTWRITEPIXEL(pbDest, temp); DESTNEXTPIXEL(pbDest); }); break; /* Handle Special Order 1. */ case SPECIAL_FGBG_1: pbSrc = pbSrc + 1; if (fFirstLine) { pbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg1, fgPel, 8); } else { pbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg1, fgPel, 8); } if (!pbDest) return FALSE; break; /* Handle Special Order 2. */ case SPECIAL_FGBG_2: pbSrc = pbSrc + 1; if (fFirstLine) { pbDest = WRITEFIRSTLINEFGBGIMAGE(pbDest, pbDestEnd, g_MaskSpecialFgBg2, fgPel, 8); } else { pbDest = WRITEFGBGIMAGE(pbDest, pbDestEnd, rowDelta, g_MaskSpecialFgBg2, fgPel, 8); } if (!pbDest) return FALSE; break; /* Handle White Order. */ case SPECIAL_WHITE: pbSrc = pbSrc + 1; if (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1)) return FALSE; DESTWRITEPIXEL(pbDest, WHITE_PIXEL); DESTNEXTPIXEL(pbDest); break; /* Handle Black Order. */ case SPECIAL_BLACK: pbSrc = pbSrc + 1; if (!ENSURE_CAPACITY(pbDest, pbDestEnd, 1)) return FALSE; DESTWRITEPIXEL(pbDest, BLACK_PIXEL); DESTNEXTPIXEL(pbDest); break; default: return FALSE; } } return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461596, "input": "static void maybe_emit_mod(u8 **pprog, u32 dst_reg, u32 src_reg, bool is64) { u8 *prog = *pprog; int cnt = 0; if (is64) EMIT1(add_2mod(0x48, dst_reg, src_reg)); else if (is_ereg(dst_reg) || is_ereg(src_reg)) EMIT1(add_2mod(0x40, dst_reg, src_reg)); *pprog = prog; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 95567, "input": "int BlobURLRequestJob::GetResponseCode() const { if (!response_info_.get()) return -1; return response_info_->headers->response_code(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255225, "input": "void CSoundFile::ExtendedMODCommands(CHANNELINDEX nChn, ModCommand::PARAM param) { ModChannel *pChn = &m_PlayState.Chn[nChn]; uint8 command = param & 0xF0; param &= 0x0F; switch(command) { // E0x: Set Filter case 0x00: for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { m_PlayState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1)); } break; // E1x: Fine Portamento Up case 0x10: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FinePortamentoUp(pChn, param); break; // E2x: Fine Portamento Down case 0x20: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FinePortamentoDown(pChn, param); break; // E3x: Set Glissando Control case 0x30: pChn->dwFlags.set(CHN_GLISSANDO, param != 0); break; // E4x: Set Vibrato WaveForm case 0x40: pChn->nVibratoType = param & 0x07; break; // E5x: Set FineTune case 0x50: if(!m_SongFlags[SONG_FIRSTTICK]) { break; } if(GetType() & (MOD_TYPE_MOD | MOD_TYPE_DIGI | MOD_TYPE_AMF0 | MOD_TYPE_MED)) { pChn->nFineTune = MOD2XMFineTune(param); if(pChn->nPeriod && pChn->rowCommand.IsNote()) pChn->nPeriod = GetPeriodFromNote(pChn->nNote, pChn->nFineTune, pChn->nC5Speed); } else if(pChn->rowCommand.IsNote()) { pChn->nFineTune = MOD2XMFineTune(param - 8); if(pChn->nPeriod) pChn->nPeriod = GetPeriodFromNote(pChn->nNote, pChn->nFineTune, pChn->nC5Speed); } break; // E6x: Pattern Loop // E7x: Set Tremolo WaveForm case 0x70: pChn->nTremoloType = param & 0x07; break; // E8x: Set 4-bit Panning case 0x80: if(m_SongFlags[SONG_FIRSTTICK]) { Panning(pChn, param, Pan4bit); } break; // E9x: Retrig case 0x90: RetrigNote(nChn, param); break; // EAx: Fine Volume Up case 0xA0: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FineVolumeUp(pChn, param, false); break; // EBx: Fine Volume Down case 0xB0: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FineVolumeDown(pChn, param, false); break; // ECx: Note Cut case 0xC0: NoteCut(nChn, param, false); break; // EDx: Note Delay // EEx: Pattern Delay case 0xF0: if(GetType() == MOD_TYPE_MOD) // MOD: Invert Loop { pChn->nEFxSpeed = param; if(m_SongFlags[SONG_FIRSTTICK]) InvertLoop(pChn); } else // XM: Set Active Midi Macro { pChn->nActiveMacro = param; } break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333810, "input": "int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op) { *new_op = op; ldout(s->cct, 10) << __func__ << \" Starting retarget\" << dendl; if (!(s->prot_flags & RGW_REST_WEBSITE)) return 0; int ret = store->get_bucket_info(*s->sysobj_ctx, s->bucket_tenant, s->bucket_name, s->bucket_info, NULL, &s->bucket_attrs); if (ret < 0) { // TODO-FUTURE: if the bucket does not exist, maybe expose it here? return -ERR_NO_SUCH_BUCKET; } if (!s->bucket_info.has_website) { // TODO-FUTURE: if the bucket has no WebsiteConfig, expose it here return -ERR_NO_SUCH_WEBSITE_CONFIGURATION; } rgw_obj_key new_obj; bool get_res = s->bucket_info.website_conf.get_effective_key(s->object.name, &new_obj.name, web_dir()); if (!get_res) { s->err.message = \"The IndexDocument Suffix is not configurated or not well formed!\"; ldout(s->cct, 5) << s->err.message << dendl; return -EINVAL; } ldout(s->cct, 10) << \"retarget get_effective_key \" << s->object << \" -> \" << new_obj << dendl; RGWBWRoutingRule rrule; bool should_redirect = s->bucket_info.website_conf.should_redirect(new_obj.name, 0, &rrule); if (should_redirect) { const string& hostname = s->info.env->get(\"HTTP_HOST\", \"\"); const string& protocol = (s->info.env->get(\"SERVER_PORT_SECURE\") ? \"https\" : \"http\"); int redirect_code = 0; rrule.apply_rule(protocol, hostname, s->object.name, &s->redirect, &redirect_code); // APply a custom HTTP response code if (redirect_code > 0) s->err.http_ret = redirect_code; // Apply a custom HTTP response code ldout(s->cct, 10) << \"retarget redirect code=\" << redirect_code << \" proto+host:\" << protocol << \"://\" << hostname << \" -> \" << s->redirect << dendl; return -ERR_WEBSITE_REDIRECT; } /* * FIXME: if s->object != new_obj, drop op and create a new op to handle * operation. Or remove this comment if it's not applicable anymore */ s->object = new_obj; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379984, "input": "iscsi_create_endpoint(int dd_size) { struct device *dev; struct iscsi_endpoint *ep; uint64_t id; int err; for (id = 1; id < ISCSI_MAX_EPID; id++) { dev = class_find_device(&iscsi_endpoint_class, NULL, &id, iscsi_match_epid); if (!dev) break; else put_device(dev); } if (id == ISCSI_MAX_EPID) { printk(KERN_ERR \"Too many connections. Max supported %u\\n\", ISCSI_MAX_EPID - 1); return NULL; } ep = kzalloc(sizeof(*ep) + dd_size, GFP_KERNEL); if (!ep) return NULL; ep->id = id; ep->dev.class = &iscsi_endpoint_class; dev_set_name(&ep->dev, \"ep-%llu\", (unsigned long long) id); err = device_register(&ep->dev); if (err) goto free_ep; err = sysfs_create_group(&ep->dev.kobj, &iscsi_endpoint_group); if (err) goto unregister_dev; if (dd_size) ep->dd_data = &ep[1]; return ep; unregister_dev: device_unregister(&ep->dev); return NULL; free_ep: kfree(ep); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 249552, "input": "static void on_m2ts_dump_event(GF_M2TS_Demuxer *ts, u32 evt_type, void *par) { u32 i, count; GF_M2TS_Program *prog; GF_M2TS_PES_PCK *pck; GF_M2TS_Dump *dumper = (GF_M2TS_Dump *)ts->user; switch (evt_type) { case GF_M2TS_EVT_PAT_FOUND: if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, 0); } break; case GF_M2TS_EVT_PAT_UPDATE: if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, 0); } break; case GF_M2TS_EVT_PAT_REPEAT: /* WARNING: We detect the pat on a repetition, probably to ensure that we also have seen all the PMT To be checked */ dumper->has_seen_pat = 1; if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, 0); } // fprintf(stderr, \"Repeated PAT found - %d programs\\n\", gf_list_count(ts->programs) ); break; case GF_M2TS_EVT_CAT_FOUND: if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, 0); } break; case GF_M2TS_EVT_CAT_UPDATE: if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, 0); } break; case GF_M2TS_EVT_CAT_REPEAT: if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, 0); } break; case GF_M2TS_EVT_PMT_FOUND: prog = (GF_M2TS_Program*)par; if (gf_list_count(ts->programs)>1 && prog->number!=dumper->prog_number) break; count = gf_list_count(prog->streams); GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Program number %d found - %d streams:\\n\", prog->number, count)); for (i=0; istreams, i); if (es->pid == prog->pmt_pid) { GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"\\tPID %d: Program Map Table\\n\", es->pid)); } else { GF_M2TS_PES *pes = (GF_M2TS_PES *)es; gf_m2ts_set_pes_framing(pes, dumper->pes_out ? GF_M2TS_PES_FRAMING_RAW : GF_M2TS_PES_FRAMING_DEFAULT); GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"\\tPID %d: %s \", pes->pid, gf_m2ts_get_stream_name(pes->stream_type) )); if (pes->mpeg4_es_id) GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\" - MPEG-4 ES ID %d\", pes->mpeg4_es_id)); GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"\\n\")); } } if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, prog->pmt_pid); } break; case GF_M2TS_EVT_PMT_UPDATE: prog = (GF_M2TS_Program*)par; if (gf_list_count(ts->programs)>1 && prog->number!=dumper->prog_number) break; if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, prog->pmt_pid); } break; case GF_M2TS_EVT_PMT_REPEAT: prog = (GF_M2TS_Program*)par; if (gf_list_count(ts->programs)>1 && prog->number!=dumper->prog_number) break; if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\n\", ts->pck_number, prog->pmt_pid); } break; case GF_M2TS_EVT_SDT_FOUND: #ifndef GPAC_DISABLE_LOG count = gf_list_count(ts->SDTs) ; GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Program Description found - %d desc:\\n\", count)); for (i=0; iSDTs, i); GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"\\tServiceID %d - Provider %s - Name %s\\n\", sdt->service_id, sdt->provider, sdt->service)); } #endif break; case GF_M2TS_EVT_SDT_UPDATE: #ifndef GPAC_DISABLE_LOG count = gf_list_count(ts->SDTs) ; GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"Program Description updated - %d desc\\n\", count)); for (i=0; iSDTs, i); GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"\\tServiceID %d - Provider %s - Name %s\\n\", sdt->service_id, sdt->provider, sdt->service)); } #endif break; case GF_M2TS_EVT_SDT_REPEAT: break; case GF_M2TS_EVT_PES_TIMING: pck = par; if (gf_list_count(ts->programs)>1 && pck->stream->program->number != dumper->prog_number) break; break; case GF_M2TS_EVT_PES_PCK: pck = par; if (gf_list_count(ts->programs)>1 && pck->stream->program->number != dumper->prog_number) break; if (dumper->has_seen_pat) { /*We need the interpolated PCR for the pcrb, hence moved this calculus out, and saving the calculated value in index_info to put it in the pcrb*/ GF_M2TS_PES *pes = pck->stream; /*FIXME : not used GF_M2TS_Program *prog = pes->program; */ /* Interpolated PCR value for the TS packet containing the PES header start */ u64 interpolated_pcr_value = 0; if (pes->last_pcr_value && pes->before_last_pcr_value_pck_number && pes->last_pcr_value > pes->before_last_pcr_value) { u32 delta_pcr_pck_num = pes->last_pcr_value_pck_number - pes->before_last_pcr_value_pck_number; u32 delta_pts_pcr_pck_num = pes->pes_start_packet_number - pes->last_pcr_value_pck_number; u64 delta_pcr_value = pes->last_pcr_value - pes->before_last_pcr_value; if ((pes->pes_start_packet_number > pes->last_pcr_value_pck_number) && (pes->last_pcr_value > pes->before_last_pcr_value)) { pes->last_pcr_value = pes->before_last_pcr_value; } /* we can compute the interpolated pcr value for the packet containing the PES header */ interpolated_pcr_value = pes->last_pcr_value + (u64)((delta_pcr_value*delta_pts_pcr_pck_num*1.0)/delta_pcr_pck_num); } if (dumper->timestamps_info_file) { Double diff; fprintf(dumper->timestamps_info_file, \"%u\\t%d\\t\", pck->stream->pes_start_packet_number, pck->stream->pid); if (interpolated_pcr_value) fprintf(dumper->timestamps_info_file, \"%f\", interpolated_pcr_value/(300.0 * 90000)); fprintf(dumper->timestamps_info_file, \"\\t\"); if (pck->DTS) fprintf(dumper->timestamps_info_file, \"%f\", (pck->DTS / 90000.0)); fprintf(dumper->timestamps_info_file, \"\\t%f\\t%d\\t%d\", pck->PTS / 90000.0, (pck->flags & GF_M2TS_PES_PCK_RAP) ? 1 : 0, (pck->flags & GF_M2TS_PES_PCK_DISCONTINUITY) ? 1 : 0); if (interpolated_pcr_value) { diff = (pck->DTS ? pck->DTS : pck->PTS) / 90000.0; diff -= pes->last_pcr_value / (300.0 * 90000); fprintf(dumper->timestamps_info_file, \"\\t%f\\n\", diff); if (diff<0) fprintf(stderr, \"Warning: detected PTS/DTS value less than current PCR of %g sec\\n\", diff); } else { fprintf(dumper->timestamps_info_file, \"\\t\\n\"); } } } if (dumper->has_seen_pat && dumper->pes_out && (dumper->dump_pid == pck->stream->pid)) { gf_fwrite(pck->data, pck->data_len, dumper->pes_out); } break; case GF_M2TS_EVT_PES_PCR: pck = par; if (gf_list_count(ts->programs)>1 && pck->stream->program->number != dumper->prog_number) break; if (dumper->timestamps_info_file) { fprintf(dumper->timestamps_info_file, \"%u\\t%d\\t%f\\t\\t\\t\\t%d\\n\", pck->stream->program->last_pcr_value_pck_number, pck->stream->pid, pck->PTS / (300*90000.0), (pck->flags & GF_M2TS_PES_PCK_DISCONTINUITY) ? 1 : 0); } break; case GF_M2TS_EVT_SL_PCK: #if 0 { GF_M2TS_SL_PCK *sl_pck = par; if (dumper->pes_out && (dumper->dump_pid == sl_pck->stream->pid)) { GF_SLHeader header; u32 header_len; if (sl_pck->stream->mpeg4_es_id) { GF_ESD *esd = ((GF_M2TS_PES*)sl_pck->stream)->esd; if (!dumper->is_info_dumped) { if (esd->decoderConfig->decoderSpecificInfo) gf_fwrite(esd->decoderConfig->decoderSpecificInfo->data, esd->decoderConfig->decoderSpecificInfo->dataLength, dumper->pes_out_info); dumper->is_info_dumped = 1; fprintf(dumper->pes_out_nhml, \"pes_out_nhml, \"timeScale=\\\"%d\\\" \", esd->slConfig->timestampResolution); fprintf(dumper->pes_out_nhml, \"streamType=\\\"%d\\\" \", esd->decoderConfig->streamType); fprintf(dumper->pes_out_nhml, \"objectTypeIndication=\\\"%d\\\" \", esd->decoderConfig->objectTypeIndication); if (esd->decoderConfig->decoderSpecificInfo) fprintf(dumper->pes_out_nhml, \"specificInfoFile=\\\"%s\\\" \", dumper->info); fprintf(dumper->pes_out_nhml, \"baseMediaFile=\\\"%s\\\" \", dumper->dump); fprintf(dumper->pes_out_nhml, \"inRootOD=\\\"yes\\\">\\n\"); } gf_sl_depacketize(esd->slConfig, &header, sl_pck->data, sl_pck->data_len, &header_len); gf_fwrite(sl_pck->data+header_len, sl_pck->data_len-header_len, dumper->pes_out); fprintf(dumper->pes_out_nhml, \"\\n\", header.decodingTimeStamp, sl_pck->data_len-header_len, (header.randomAccessPointFlag?\"yes\":\"no\")); } } } #endif break;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514785, "input": "int ram_block_discard_require(bool state) { int ret = 0; ram_block_discard_disable_mutex_lock(); if (!state) { ram_block_discard_required_cnt--; } else if (ram_block_discard_disabled_cnt || ram_block_uncoordinated_discard_disabled_cnt) { ret = -EBUSY; } else { ram_block_discard_required_cnt++; } ram_block_discard_disable_mutex_unlock(); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232619, "input": "static void update_branch_counts(struct bpf_verifier_env *env, struct bpf_verifier_state *st) { while (st) { u32 br = --st->branches; /* WARN_ON(br > 1) technically makes sense here, * but see comment in push_stack(), hence: */ WARN_ONCE((int)br < 0, \"BUG update_branch_counts:branches_to_explore=%d\\n\", br); if (br) break; st = st->parent; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273277, "input": "static int cbs_jpeg_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { CodedBitstreamJPEGContext *priv = ctx->priv_data; PutBitContext pbc; int err; if (!priv->write_buffer) { // Initial write buffer size is 1MB. priv->write_buffer_size = 1024 * 1024; reallocate_and_try_again: err = av_reallocp(&priv->write_buffer, priv->write_buffer_size); if (err < 0) { av_log(ctx->log_ctx, AV_LOG_ERROR, \"Unable to allocate a \" \"sufficiently large write buffer (last attempt \" \"%\"SIZE_SPECIFIER\" bytes).\\n\", priv->write_buffer_size); return err; } } init_put_bits(&pbc, priv->write_buffer, priv->write_buffer_size); if (unit->type == JPEG_MARKER_SOS) err = cbs_jpeg_write_scan(ctx, unit, &pbc); else err = cbs_jpeg_write_segment(ctx, unit, &pbc); if (err == AVERROR(ENOSPC)) { // Overflow. priv->write_buffer_size *= 2; goto reallocate_and_try_again; } if (err < 0) { // Write failed for some other reason. return err; } if (put_bits_count(&pbc) % 8) unit->data_bit_padding = 8 - put_bits_count(&pbc) % 8; else unit->data_bit_padding = 0; unit->data_size = (put_bits_count(&pbc) + 7) / 8; flush_put_bits(&pbc); err = ff_cbs_alloc_unit_data(ctx, unit, unit->data_size); if (err < 0) return err; memcpy(unit->data, priv->write_buffer, unit->data_size); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 414544, "input": "rndr_raw_html(struct buf *ob, const struct buf *text, void *opaque) { struct html_renderopt *options = opaque; /* HTML_ESCAPE overrides SKIP_HTML, SKIP_STYLE, SKIP_LINKS and SKIP_IMAGES It doesn't see if there are any valid tags, just escape all of them. */ if((options->flags & HTML_ESCAPE) != 0) { escape_html(ob, text->data, text->size); return 1; } if ((options->flags & HTML_SKIP_HTML) != 0) return 1; if ((options->flags & HTML_SKIP_STYLE) != 0 && sdhtml_is_tag(text->data, text->size, \"style\")) return 1; if ((options->flags & HTML_SKIP_LINKS) != 0 && sdhtml_is_tag(text->data, text->size, \"a\")) return 1; if ((options->flags & HTML_SKIP_IMAGES) != 0 && sdhtml_is_tag(text->data, text->size, \"img\")) return 1; bufput(ob, text->data, text->size); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 285598, "input": "xmlDocPtr soap_xmlParseFile(const char *filename TSRMLS_DC) { xmlParserCtxtPtr ctxt = NULL; xmlDocPtr ret; zend_bool old_allow_url_fopen; /* xmlInitParser(); */ old_allow_url_fopen = PG(allow_url_fopen); PG(allow_url_fopen) = 1; ctxt = xmlCreateFileParserCtxt(filename); PG(allow_url_fopen) = old_allow_url_fopen; if (ctxt) { zend_bool old; ctxt->keepBlanks = 0; ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace; ctxt->sax->comment = soap_Comment; ctxt->sax->warning = NULL; ctxt->sax->error = NULL; /*ctxt->sax->fatalError = NULL;*/ old = php_libxml_disable_entity_loader(1 TSRMLS_CC); xmlParseDocument(ctxt); php_libxml_disable_entity_loader(old TSRMLS_CC); if (ctxt->wellFormed) { ret = ctxt->myDoc; if (ret->URL == NULL && ctxt->directory != NULL) { ret->URL = xmlCharStrdup(ctxt->directory); } } else { ret = NULL; xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL; } xmlFreeParserCtxt(ctxt); } else { ret = NULL; } /* xmlCleanupParser(); */ if (ret) { cleanup_xml_node((xmlNodePtr)ret); } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379539, "input": "close_all_files () { register int i, fd_table_size; fd_table_size = getdtablesize (); if (fd_table_size > 256) /* clamp to a reasonable value */ fd_table_size = 256; for (i = 3; i < fd_table_size; i++) close (i); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197747, "input": "static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet) { packet->parsed_lines = 0, packet->empty_line_position_set = 0, packet->host_line.ptr = NULL, packet->host_line.len = 0, packet->referer_line.ptr = NULL, packet->referer_line.len = 0, packet->content_line.ptr = NULL, packet->content_line.len = 0, packet->accept_line.ptr = NULL, packet->accept_line.len = 0, packet->user_agent_line.ptr = NULL, packet->user_agent_line.len = 0, packet->http_url_name.ptr = NULL, packet->http_url_name.len = 0, packet->http_encoding.ptr = NULL, packet->http_encoding.len = 0, packet->http_transfer_encoding.ptr = NULL, packet->http_transfer_encoding.len = 0, packet->http_contentlen.ptr = NULL, packet->http_contentlen.len = 0, packet->http_cookie.ptr = NULL, packet->http_cookie.len = 0, packet->http_origin.len = 0, packet->http_origin.ptr = NULL, packet->http_x_session_type.ptr = NULL, packet->http_x_session_type.len = 0, packet->server_line.ptr = NULL, packet->server_line.len = 0, packet->http_method.ptr = NULL, packet->http_method.len = 0, packet->http_response.ptr = NULL, packet->http_response.len = 0, packet->http_num_headers = 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "In nDPI through 3.2, ndpi_reset_packet_line_info in lib/ndpi_main.c omits certain reinitialization, leading to a use-after-free.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-15475"}} -{"idx": 280821, "input": "check_DEC_TTL(const struct ofpact_cnt_ids *a OVS_UNUSED, struct ofpact_check_params *cp) { return check_set_ip(cp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381461, "input": "static void v4l_print_tuner(const void *arg, bool write_only) { const struct v4l2_tuner *p = arg; if (write_only) pr_cont(\"index=%u, audmode=%u\\n\", p->index, p->audmode); else pr_cont(\"index=%u, name=%.*s, type=%u, capability=0x%x, rangelow=%u, rangehigh=%u, signal=%u, afc=%d, rxsubchans=0x%x, audmode=%u\\n\", p->index, (int)sizeof(p->name), p->name, p->type, p->capability, p->rangelow, p->rangehigh, p->signal, p->afc, p->rxsubchans, p->audmode); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 285558, "input": "free_tree (void *extra, bin_tree_t *node) { free_token (&node->token); return REG_NOERROR; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519653, "input": "XMLProperty::~XMLProperty() { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234092, "input": "void init_netbios_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) { ndpi_set_bitmask_protocol_detection(\"NETBIOS\", ndpi_struct, detection_bitmask, *id, NDPI_PROTOCOL_NETBIOS, ndpi_search_netbios, NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION, SAVE_DETECTION_BITMASK_AS_UNKNOWN, ADD_TO_DETECTION_BITMASK); *id += 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 371771, "input": "MagickExport void ConvertRGBToHCL(const Quantum red,const Quantum green, const Quantum blue,double *hue,double *chroma,double *luma) { double b, c, g, h, max, r; /* Convert RGB to HCL colorspace. */ assert(hue != (double *) NULL); assert(chroma != (double *) NULL); assert(luma != (double *) NULL); r=(double) red; g=(double) green; b=(double) blue; max=MagickMax(r,MagickMax(g,b)); c=max-(double) MagickMin(r,MagickMin(g,b)); h=0.0; if (fabs(c) < MagickEpsilon) h=0.0; else if (red == (Quantum) max) h=fmod((g-b)/c+6.0,6.0); else if (green == (Quantum) max) h=((b-r)/c)+2.0; else if (blue == (Quantum) max) h=((r-g)/c)+4.0; *hue=(h/6.0); *chroma=QuantumScale*c; *luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509078, "input": "Item_basic_constant(THD *thd): Item_basic_value(thd), used_table_map(0) {};", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 455055, "input": "FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, uint32_t *val) #if 0 /* slow but readable version */ { uint32_t bit; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); *val = 0; while(1) { if(!FLAC__bitreader_read_bit(br, &bit)) return false; if(bit) break; else *val++; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357289, "input": "static OPJ_BOOL opj_j2k_write_epc(opj_j2k_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager) { opj_codestream_index_t * l_cstr_index = 00; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); OPJ_UNUSED(p_manager); l_cstr_index = p_j2k->cstr_index; if (l_cstr_index) { l_cstr_index->codestream_size = (OPJ_UINT64)opj_stream_tell(p_stream); /* UniPG>> */ /* The following adjustment is done to adjust the codestream size */ /* if SOD is not at 0 in the buffer. Useful in case of JP2, where */ /* the first bunch of bytes is not in the codestream */ l_cstr_index->codestream_size -= (OPJ_UINT64)l_cstr_index->main_head_start; /* <epc_on) { /* encode according to JPWL */ jpwl_encode(p_j2k, p_stream, image); } #endif assert(0 && \"TODO\"); #endif /* USE_JPWL */ return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432839, "input": "setup_rubytkkit(void) { init_static_tcltk_packages(); { ID const_id; const_id = rb_intern(RUBYTK_KITPATH_CONST_NAME); if (rb_const_defined(rb_cObject, const_id)) { volatile VALUE pathobj; pathobj = rb_const_get(rb_cObject, const_id); if (rb_obj_is_kind_of(pathobj, rb_cString)) { #ifdef HAVE_RUBY_ENCODING_H pathobj = rb_str_export_to_enc(pathobj, rb_utf8_encoding()); #endif set_rubytk_kitpath(RSTRING_PTR(pathobj)); } } } #ifdef CREATE_RUBYTK_KIT if (rubytk_kitpath == NULL) { #ifdef __WIN32__ /* rbtk_win32_SetHINSTANCE(\"tcltklib.so\"); */ { volatile VALUE basename; basename = rb_funcall(rb_cFile, rb_intern(\"basename\"), 1, rb_str_new2(rb_sourcefile())); rbtk_win32_SetHINSTANCE(RSTRING_PTR(basename)); } #endif set_rubytk_kitpath(rb_sourcefile()); } #endif if (rubytk_kitpath == NULL) { set_rubytk_kitpath(Tcl_GetNameOfExecutable()); } TclSetPreInitScript(rubytkkit_preInitCmd); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295842, "input": "rfbSendExtDesktopSize(rfbClientPtr cl, int w, int h) { rfbFramebufferUpdateRectHeader rect; rfbExtDesktopSizeMsg edsHdr; rfbExtDesktopScreen eds; int i; char *logmsg; int numScreens = cl->screen->numberOfExtDesktopScreensHook(cl); if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbExtDesktopSizeMsg + sz_rfbExtDesktopScreen * numScreens > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.encoding = Swap32IfLE(rfbEncodingExtDesktopSize); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.r.x = Swap16IfLE(cl->requestedDesktopSizeChange); rect.r.y = Swap16IfLE(cl->lastDesktopSizeChangeError); logmsg = \"\"; if (cl->requestedDesktopSizeChange == rfbExtDesktopSize_ClientRequestedChange) { /* our client requested the resize through setDesktopSize */ switch (cl->lastDesktopSizeChangeError) { case rfbExtDesktopSize_Success: logmsg = \"resize successful\"; break; case rfbExtDesktopSize_ResizeProhibited: logmsg = \"resize prohibited\"; break; case rfbExtDesktopSize_OutOfResources: logmsg = \"resize failed: out of resources\"; break; case rfbExtDesktopSize_InvalidScreenLayout: logmsg = \"resize failed: invalid screen layout\"; break; default: break; } } cl->requestedDesktopSizeChange = 0; cl->lastDesktopSizeChangeError = 0; rfbLog(\"Sending rfbEncodingExtDesktopSize for size (%dx%d) %s\\n\", w, h, logmsg); memcpy(&cl->updateBuf[cl->ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); cl->ublen += sz_rfbFramebufferUpdateRectHeader; edsHdr.numberOfScreens = numScreens; edsHdr.pad[0] = edsHdr.pad[1] = edsHdr.pad[2] = 0; memcpy(&cl->updateBuf[cl->ublen], (char *)&edsHdr, sz_rfbExtDesktopSizeMsg); cl->ublen += sz_rfbExtDesktopSizeMsg; for (i=0; iscreen->getExtDesktopScreenHook(i, &eds, cl)) { rfbErr(\"Error getting ExtendedDesktopSize information for screen #%d\\n\", i); return FALSE; } eds.id = Swap32IfLE(eds.id); eds.x = Swap16IfLE(eds.x); eds.y = Swap16IfLE(eds.y); eds.width = Swap16IfLE(eds.width); eds.height = Swap16IfLE(eds.height); eds.flags = Swap32IfLE(eds.flags); memcpy(&cl->updateBuf[cl->ublen], (char *)&eds, sz_rfbExtDesktopScreen); cl->ublen += sz_rfbExtDesktopScreen; } rfbStatRecordEncodingSent(cl, rfbEncodingExtDesktopSize, sz_rfbFramebufferUpdateRectHeader + sz_rfbExtDesktopSizeMsg + sz_rfbExtDesktopScreen * numScreens, sz_rfbFramebufferUpdateRectHeader + sz_rfbExtDesktopSizeMsg + sz_rfbExtDesktopScreen * numScreens); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402242, "input": "int bcf_enc_vfloat(kstring_t *s, int n, float *a) { assert(n >= 0); bcf_enc_size(s, n, BCF_BT_FLOAT); serialize_float_array(s, n, a); return 0; // FIXME: check for errs in this function }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268803, "input": "R_API void r_str_uri_decode(char *s) { int n; char *d; for (d = s; *s; s++, d++) { if (*s == '%') { sscanf (s + 1, \"%02x\", &n); *d = n; s += 2; } else { *d = *s; } } *d = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 389348, "input": "printer_ioctl(struct file *fd, unsigned int code, unsigned long arg) { struct printer_dev *dev = fd->private_data; unsigned long flags; int status = 0; DBG(dev, \"printer_ioctl: cmd=0x%4.4x, arg=%lu\\n\", code, arg); /* handle ioctls */ spin_lock_irqsave(&dev->lock, flags); if (dev->interface < 0) { spin_unlock_irqrestore(&dev->lock, flags); return -ENODEV; } switch (code) { case GADGET_GET_PRINTER_STATUS: status = (int)dev->printer_status; break; case GADGET_SET_PRINTER_STATUS: dev->printer_status = (u8)arg; break; default: /* could not handle ioctl */ DBG(dev, \"printer_ioctl: ERROR cmd=0x%4.4xis not supported\\n\", code); status = -ENOTTY; } spin_unlock_irqrestore(&dev->lock, flags); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 264759, "input": "UntrustedCacheMalloc::UntrustedCacheMalloc() : lock_(/*is_recursive=*/true) { if (is_destroyed_) { return; } // Initialize a free list object in the trusted heap. The free list object // stores an array of buffers stored in the untrusted heap. free_list_ = absl::make_unique(); free_list_->buffers.reset(reinterpret_cast( primitives::TrustedPrimitives::UntrustedLocalAlloc(sizeof(void *) * kFreeListCapacity))); free_list_->count = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268920, "input": "R_API char *r_socket_http_get(const char *url, int *code, int *rlen) { return socket_http_get_recursive (url, code, rlen, SOCKET_HTTP_MAX_REDIRECTS); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437669, "input": "static void svm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) { /* * Any change of EFLAGS.VM is accompained by a reload of SS * (caused by either a task switch or an inter-privilege IRET), * so we do not need to update the CPL here. */ to_svm(vcpu)->vmcb->save.rflags = rflags; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211099, "input": "allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size) { enum ring_buffer_flags rb_flags; rb_flags = tr->trace_flags & TRACE_ITER_OVERWRITE ? RB_FL_OVERWRITE : 0; buf->tr = tr; buf->buffer = ring_buffer_alloc(size, rb_flags); if (!buf->buffer) return -ENOMEM; buf->data = alloc_percpu(struct trace_array_cpu); if (!buf->data) { ring_buffer_free(buf->buffer); return -ENOMEM; } /* Allocate the first page for all buffers */ set_buffer_entries(&tr->trace_buffer, ring_buffer_size(tr->trace_buffer.buffer, 0)); return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Double Free"], "explanation": "An issue was discovered in the Linux kernel before 4.14.11. A double free may be caused by the function allocate_trace_buffer in the file kernel/trace/trace.c.", "severity_level": "NoInfo", "cwe": "CWE-415", "cve": "CVE-2017-18595"}} -{"idx": 393002, "input": "TEST_F(QueryPlannerTest, ContainedOrOnePredicateIsLeadingField) { addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1)); addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"d\" << 1)); runQuery(fromjson(\"{$and: [{a: 5}, {b: 6}, {$or: [{c: 7}, {d: 8}]}]}\")); assertNumSolutions(4); assertSolutionExists( \"{fetch: {filter: null, node: {or: {nodes: [\" \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \" \"true]], c: [[7, 7, true, true]]}}},\" \"{ixscan: {pattern: {a: 1, b: 1, d: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \" \"true]], d: [[8, 8, true, true]]}}}\" \"]}}}}\"); assertSolutionExists( \"{fetch: {filter: {$or: [{c: 7}, {d: 8}]}, node: \" \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \" \"true]], c: [['MinKey', 'MaxKey', true, true]]}}}\" \"}}\"); assertSolutionExists( \"{fetch: {filter: {$or: [{c: 7}, {d: 8}]}, node: \" \"{ixscan: {pattern: {a: 1, b: 1, d: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \" \"true]], d: [['MinKey', 'MaxKey', true, true]]}}}\" \"}}\"); assertSolutionExists(\"{cscan: {dir: 1}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208743, "input": "ppm_load_read_header(FILE *fp, pnm_struct *img) { /* PPM Headers Variable Declaration */ gchar *ptr; //gchar *retval; gchar header[MAX_CHARS_IN_ROW]; gint maxval; /* Check the PPM file Type P2 or P5 */ fgets (header,MAX_CHARS_IN_ROW,fp); if (header[0] != ASCII_P || (header[1] != PIXMAP_ASCII && header[1] != PIXMAP_RAW)) { g_warning (\"Image is not a portable pixmap\"); return FALSE; } img->type = header[1]; /* Check the Comments */ fgets (header,MAX_CHARS_IN_ROW,fp); while(header[0] == '#') { fgets (header,MAX_CHARS_IN_ROW,fp); } /* Get Width and Height */ img->width = strtol (header,&ptr,0); img->height = atoi (ptr); fgets (header,MAX_CHARS_IN_ROW,fp); maxval = strtol (header,&ptr,0); if ((maxval != 255) && (maxval != 65535)) { g_warning (\"Image is not an 8-bit or 16-bit portable pixmap\"); return FALSE; } switch (maxval) { case 255: img->bpc = sizeof (guchar); break; case 65535: img->bpc = sizeof (gushort); break; default: g_warning (\"%s: Programmer stupidity error\", G_STRLOC); } /* Later on, img->numsamples is multiplied with img->bpc to allocate * memory. Ensure it doesn't overflow. */ if (!img->width || !img->height || G_MAXSIZE / img->width / img->height / CHANNEL_COUNT < img->bpc) { g_warning (\"Illegal width/height: %ld/%ld\", img->width, img->height); return FALSE; } img->numsamples = img->width * img->height * CHANNEL_COUNT; return TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "Multiple integer overflows in operations/external/ppm-load.c in GEGL (Generic Graphics Library) 0.2.0 allow remote attackers to cause a denial of service (application crash) or possibly execute arbitrary code via a large (1) width or (2) height value in a Portable Pixel Map (ppm) image, which triggers a heap-based buffer overflow.", "severity_level": "High", "cwe": "CWE-189", "cve": "CVE-2012-4433"}} -{"idx": 336880, "input": "rb_str_subpat_set(VALUE str, VALUE re, VALUE backref, VALUE val) { int nth; VALUE match; long start, end, len; rb_encoding *enc; struct re_registers *regs; if (rb_reg_search(re, str, 0, 0) < 0) { rb_raise(rb_eIndexError, \"regexp not matched\"); } match = rb_backref_get(); nth = rb_reg_backref_number(match, backref); regs = RMATCH_REGS(match); if (nth >= regs->num_regs) { out_of_range: rb_raise(rb_eIndexError, \"index %d out of regexp\", nth); } if (nth < 0) { if (-nth >= regs->num_regs) { goto out_of_range; } nth += regs->num_regs; } start = BEG(nth); if (start == -1) { rb_raise(rb_eIndexError, \"regexp group %d not matched\", nth); } end = END(nth); len = end - start; StringValue(val); enc = rb_enc_check(str, val); rb_str_splice_0(str, start, len, val); rb_enc_associate(str, enc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 222587, "input": "mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx) { const struct RProc *p = mrb->c->ci->proc; struct REnv *e; if (!p || !MRB_PROC_CFUNC_P(p)) { mrb_raise(mrb, E_TYPE_ERROR, \"Can't get cfunc env from non-cfunc proc\"); } e = MRB_PROC_ENV(p); if (!e) { mrb_raise(mrb, E_TYPE_ERROR, \"Can't get cfunc env from cfunc Proc without REnv\"); } if (idx < 0 || MRB_ENV_LEN(e) <= idx) { mrb_raisef(mrb, E_INDEX_ERROR, \"Env index out of range: %i (expected: 0 <= index < %i)\", idx, MRB_ENV_LEN(e)); } return e->stack[idx]; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421537, "input": "lka_filter_begin(uint64_t reqid, const char *filter_name) { struct filter_session *fs; if (!filters_inited) { tree_init(&sessions); filters_inited = 1; } fs = xcalloc(1, sizeof (struct filter_session)); fs->id = reqid; fs->filter_name = xstrdup(filter_name); tree_xset(&sessions, fs->id, fs); log_trace(TRACE_FILTERS, \"%016\"PRIx64\" filters session-begin\", reqid); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 247286, "input": "void M_ScreenShot (void) { int i; byte* linear; char lbmname[12]; // munge planar buffer to linear linear = screens[2]; I_ReadScreen (linear); // find a file name to save it to strcpy(lbmname,\"DOOM00.pcx\"); for (i=0 ; i<=99 ; i++) { lbmname[4] = i/10 + '0'; lbmname[5] = i%10 + '0'; if (access(lbmname,0) == -1) break; // file doesn't exist } if (i==100) I_Error (\"M_ScreenShot: Couldn't create a PCX\"); // save the pcx file WritePCXfile (lbmname, linear, SCREENWIDTH, SCREENHEIGHT, W_CacheLumpName (\"PLAYPAL\",PU_CACHE)); players[consoleplayer].message = \"screen shot\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224828, "input": "static struct sock *pep_find_pipe(const struct hlist_head *hlist, const struct sockaddr_pn *dst, u8 pipe_handle) { struct sock *sknode; u16 dobj = pn_sockaddr_get_object(dst); sk_for_each(sknode, hlist) { struct pep_sock *pnnode = pep_sk(sknode); /* Ports match, but addresses might not: */ if (pnnode->pn_sk.sobject != dobj) continue; if (pnnode->pipe_handle != pipe_handle) continue; if (sknode->sk_state == TCP_CLOSE_WAIT) continue; sock_hold(sknode); return sknode; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 210735, "input": "static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement) { size_t i; int de, section_index = SECTION_MAKERNOTE; int NumDirEntries, old_motorola_intel, offset_diff; const maker_note_type *maker_note; char *dir_start; int data_len; for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) { #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, \"No maker note data found. Detected maker: %s (length = %d)\", ImageInfo->make, strlen(ImageInfo->make)); #endif /* unknown manufacturer, not an error, use it as a string */ return TRUE; } maker_note = maker_note_array+i; /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, \"check (%s,%s)\", maker_note->make?maker_note->make:\"\", maker_note->model?maker_note->model:\"\");*/ if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) continue; if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) continue; if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) continue; break; } if (value_len < 2 || maker_note->offset >= value_len - 1) { /* Do not go past the value end */ exif_error_docref(\"exif_read_data#error_ifd\" EXIFERR_CC, ImageInfo, E_WARNING, \"IFD data too short: 0x%04X offset 0x%04X\", value_len, maker_note->offset); return FALSE; } dir_start = value_ptr + maker_note->offset; #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, \"Process %s @x%04X + 0x%04X=%d: %s\", exif_get_sectionname(section_index), (int)dir_start-(int)offset_base+maker_note->offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, (int)dir_start-(int)offset_base+maker_note->offset+displacement)); #endif ImageInfo->sections_found |= FOUND_MAKERNOTE; old_motorola_intel = ImageInfo->motorola_intel; switch (maker_note->byte_order) { case MN_ORDER_INTEL: ImageInfo->motorola_intel = 0; break; case MN_ORDER_MOTOROLA: ImageInfo->motorola_intel = 1; break; default: case MN_ORDER_NORMAL: break; } NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); switch (maker_note->offset_mode) { case MN_OFFSET_MAKER: offset_base = value_ptr; data_len = value_len; break; case MN_OFFSET_GUESS: if (maker_note->offset + 10 + 4 >= value_len) { /* Can not read dir_start+10 since it's beyond value end */ exif_error_docref(\"exif_read_data#error_ifd\" EXIFERR_CC, ImageInfo, E_WARNING, \"IFD data too short: 0x%04X\", value_len); return FALSE; } offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel); #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, \"Using automatic offset correction: 0x%04X\", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff); #endif if (offset_diff < 0 || offset_diff >= value_len ) { exif_error_docref(\"exif_read_data#error_ifd\" EXIFERR_CC, ImageInfo, E_WARNING, \"IFD data bad offset: 0x%04X length 0x%04X\", offset_diff, value_len); return FALSE; } offset_base = value_ptr + offset_diff; data_len = value_len - offset_diff; break; default: case MN_OFFSET_NORMAL: data_len = value_len; break; } if ((2+NumDirEntries*12) > value_len) { exif_error_docref(\"exif_read_data#error_ifd\" EXIFERR_CC, ImageInfo, E_WARNING, \"Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X\", NumDirEntries, 2+NumDirEntries*12, value_len); return FALSE; } for (de=0;detag_table)) { return FALSE; } } ImageInfo->motorola_intel = old_motorola_intel; /* NextDirOffset (must be NULL) = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);*/ #ifdef EXIF_DEBUG exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, \"Subsection %s done\", exif_get_sectionname(SECTION_MAKERNOTE)); #endif return TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "When processing certain files, PHP EXIF extension in versions 7.1.x below 7.1.28, 7.2.x below 7.2.17 and 7.3.x below 7.3.4 can be caused to read past allocated buffer in exif_process_IFD_TAG function. This may lead to information disclosure or crash.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2019-11034"}} -{"idx": 505409, "input": "static void send_file(struct cgit_context *ctx, char *path) { struct stat st; int err; if (stat(path, &st)) { switch (errno) { case ENOENT: err = 404; break; case EACCES: err = 403; break; default: err = 400; } html_status(err, 0); return; } ctx->page.mimetype = \"application/octet-stream\"; ctx->page.filename = path; if (prefixcmp(ctx->repo->path, path)) ctx->page.filename += strlen(ctx->repo->path) + 1; cgit_print_http_headers(ctx); html_include(path); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280459, "input": "check_GROUP(const struct ofpact_group *a OVS_UNUSED, const struct ofpact_check_params *cp OVS_UNUSED) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 341953, "input": "int fuse_flush_times(struct inode *inode, struct fuse_file *ff) { struct fuse_mount *fm = get_fuse_mount(inode); FUSE_ARGS(args); struct fuse_setattr_in inarg; struct fuse_attr_out outarg; memset(&inarg, 0, sizeof(inarg)); memset(&outarg, 0, sizeof(outarg)); inarg.valid = FATTR_MTIME; inarg.mtime = inode->i_mtime.tv_sec; inarg.mtimensec = inode->i_mtime.tv_nsec; if (fm->fc->minor >= 23) { inarg.valid |= FATTR_CTIME; inarg.ctime = inode->i_ctime.tv_sec; inarg.ctimensec = inode->i_ctime.tv_nsec; } if (ff) { inarg.valid |= FATTR_FH; inarg.fh = ff->fh; } fuse_setattr_fill(fm->fc, &args, inode, &inarg, &outarg); return fuse_simple_request(fm, &args); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346411, "input": "evbuffer_cb_clear_flags(struct evbuffer *buffer, struct evbuffer_cb_entry *cb, ev_uint32_t flags) { /* the user isn't allowed to mess with these. */ flags &= ~EVBUFFER_CB_INTERNAL_FLAGS; EVBUFFER_LOCK(buffer); cb->flags &= ~flags; EVBUFFER_UNLOCK(buffer); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409618, "input": "static BOOL rdp_print_bitmap_cache_v3_codec_id_capability_set(wStream* s, UINT16 length) { BYTE bitmapCacheV3CodecId; WLog_INFO(TAG, \"BitmapCacheV3CodecIdCapabilitySet (length %\" PRIu16 \"):\", length); if (length < 5) return FALSE; Stream_Read_UINT8(s, bitmapCacheV3CodecId); /* bitmapCacheV3CodecId (1 byte) */ WLog_INFO(TAG, \"\\tbitmapCacheV3CodecId: 0x%02\" PRIX8 \"\", bitmapCacheV3CodecId); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399292, "input": "void imap_keepalive(void) { time_t now = mutt_date_epoch(); struct Account *np = NULL; TAILQ_FOREACH(np, &NeoMutt->accounts, entries) { if (np->type != MUTT_IMAP) continue; struct ImapAccountData *adata = np->adata; if (!adata || !adata->mailbox) continue; const short c_imap_keepalive = cs_subset_number(NeoMutt->sub, \"imap_keepalive\"); if ((adata->state >= IMAP_AUTHENTICATED) && (now >= (adata->lastread + c_imap_keepalive))) imap_check_mailbox(adata->mailbox, true); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303119, "input": "int blosc_get_complib_info(const char* compname, char** complib, char** version) { int clibcode; const char* clibname; const char* clibversion = \"unknown\"; #if (defined(HAVE_LZ4) && defined(LZ4_VERSION_MAJOR)) || \\ (defined(HAVE_LIZARD) && defined(LIZARD_VERSION_MAJOR)) || \\ (defined(HAVE_SNAPPY) && defined(SNAPPY_VERSION)) || \\ (defined(HAVE_ZSTD) && defined(ZSTD_VERSION_MAJOR)) char sbuffer[256]; #endif clibcode = compname_to_clibcode(compname); clibname = clibcode_to_clibname(clibcode); /* complib version */ if (clibcode == BLOSC_BLOSCLZ_LIB) { clibversion = BLOSCLZ_VERSION_STRING; } #if defined(HAVE_LZ4) else if (clibcode == BLOSC_LZ4_LIB) { #if defined(LZ4_VERSION_MAJOR) sprintf(sbuffer, \"%d.%d.%d\", LZ4_VERSION_MAJOR, LZ4_VERSION_MINOR, LZ4_VERSION_RELEASE); clibversion = sbuffer; #endif /* LZ4_VERSION_MAJOR */ } #endif /* HAVE_LZ4 */ #if defined(HAVE_LIZARD) else if (clibcode == BLOSC_LIZARD_LIB) { sprintf(sbuffer, \"%d.%d.%d\", LIZARD_VERSION_MAJOR, LIZARD_VERSION_MINOR, LIZARD_VERSION_RELEASE); clibversion = sbuffer; } #endif /* HAVE_LIZARD */ #if defined(HAVE_SNAPPY) else if (clibcode == BLOSC_SNAPPY_LIB) { #if defined(SNAPPY_VERSION) sprintf(sbuffer, \"%d.%d.%d\", SNAPPY_MAJOR, SNAPPY_MINOR, SNAPPY_PATCHLEVEL); clibversion = sbuffer; #endif /* SNAPPY_VERSION */ } #endif /* HAVE_SNAPPY */ #if defined(HAVE_ZLIB) else if (clibcode == BLOSC_ZLIB_LIB) { clibversion = ZLIB_VERSION; } #endif /* HAVE_ZLIB */ #if defined(HAVE_ZSTD) else if (clibcode == BLOSC_ZSTD_LIB) { sprintf(sbuffer, \"%d.%d.%d\", ZSTD_VERSION_MAJOR, ZSTD_VERSION_MINOR, ZSTD_VERSION_RELEASE); clibversion = sbuffer; } #endif /* HAVE_ZSTD */ #ifdef _MSC_VER *complib = _strdup(clibname); *version = _strdup(clibversion); #else *complib = strdup(clibname); *version = strdup(clibversion); #endif return clibcode; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354628, "input": "static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) { if (kvm_test_request(req, vcpu)) { kvm_clear_request(req, vcpu); /* * Ensure the rest of the request is visible to kvm_check_request's * caller. Paired with the smp_wmb in kvm_make_request. */ smp_mb__after_atomic(); return true; } else { return false; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211253, "input": "static apr_byte_t oidc_validate_post_logout_url(request_rec *r, const char *url, char **err_str, char **err_desc) { apr_uri_t uri; const char *c_host = NULL; if (apr_uri_parse(r->pool, url, &uri) != APR_SUCCESS) { *err_str = apr_pstrdup(r->pool, \"Malformed URL\"); *err_desc = apr_psprintf(r->pool, \"Logout URL malformed: %s\", url); oidc_error(r, \"%s: %s\", *err_str, *err_desc); return FALSE; } c_host = oidc_get_current_url_host(r); if ((uri.hostname != NULL) && ((strstr(c_host, uri.hostname) == NULL) || (strstr(uri.hostname, c_host) == NULL))) { *err_str = apr_pstrdup(r->pool, \"Invalid Request\"); *err_desc = apr_psprintf(r->pool, \"logout value \\\"%s\\\" does not match the hostname of the current request \\\"%s\\\"\", apr_uri_unparse(r->pool, &uri, 0), c_host); oidc_error(r, \"%s: %s\", *err_str, *err_desc); return FALSE; } else if (strstr(url, \"/\") != url) { *err_str = apr_pstrdup(r->pool, \"Malformed URL\"); *err_desc = apr_psprintf(r->pool, \"No hostname was parsed and it does not seem to be relative, i.e starting with '/': %s\", url); oidc_error(r, \"%s: %s\", *err_str, *err_desc); return FALSE; } /* validate the URL to prevent HTTP header splitting */ if (((strstr(url, \"\\n\") != NULL) || strstr(url, \"\\r\") != NULL)) { *err_str = apr_pstrdup(r->pool, \"Invalid Request\"); *err_desc = apr_psprintf(r->pool, \"logout value \\\"%s\\\" contains illegal \\\"\\n\\\" or \\\"\\r\\\" character(s)\", url); oidc_error(r, \"%s: %s\", *err_str, *err_desc); return FALSE; } return TRUE; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "A flaw was found in mod_auth_openidc before version 2.4.0.1. An open redirect issue exists in URLs with trailing slashes similar to CVE-2019-3877 in mod_auth_mellon.", "severity_level": "NoInfo", "cwe": "CWE-601", "cve": "CVE-2019-14857"}} -{"idx": 330490, "input": "static VncDisplay *vnc_display_find(const char *id) { VncDisplay *vd; if (id == NULL) { return QTAILQ_FIRST(&vnc_displays); } QTAILQ_FOREACH(vd, &vnc_displays, next) { if (strcmp(id, vd->id) == 0) { return vd; } } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269733, "input": "void WebContents::ExitFullscreenModeForTab(content::WebContents* source) { CommonWebContentsDelegate::ExitFullscreenModeForTab(source); Emit(\"leave-html-full-screen\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238845, "input": "bool operator()(const CPUDevice& d, typename TTypes::ConstTensor grads, typename TTypes::ConstTensor image, typename TTypes::ConstTensor boxes, typename TTypes::ConstTensor box_index, typename TTypes::Tensor grads_boxes) { const int batch_size = image.dimension(0); const int image_height = image.dimension(1); const int image_width = image.dimension(2); const int num_boxes = grads.dimension(0); const int crop_height = grads.dimension(1); const int crop_width = grads.dimension(2); const int depth = grads.dimension(3); grads_boxes.setZero(); for (int b = 0; b < num_boxes; ++b) { const float y1 = boxes(b, 0); const float x1 = boxes(b, 1); const float y2 = boxes(b, 2); const float x2 = boxes(b, 3); const int32 b_in = box_index(b); if (!FastBoundsCheck(b_in, batch_size)) { continue; } const float height_ratio = (crop_height > 1) ? static_cast(image_height - 1) / (crop_height - 1) : 0; const float width_ratio = (crop_width > 1) ? static_cast(image_width - 1) / (crop_width - 1) : 0; const float height_scale = (crop_height > 1) ? (y2 - y1) * height_ratio : 0; const float width_scale = (crop_width > 1) ? (x2 - x1) * width_ratio : 0; for (int y = 0; y < crop_height; ++y) { const float in_y = (crop_height > 1) ? y1 * (image_height - 1) + y * height_scale : 0.5 * (y1 + y2) * (image_height - 1); if (in_y < 0 || in_y > image_height - 1) { continue; } const int top_y_index = floorf(in_y); const int bottom_y_index = ceilf(in_y); const float y_lerp = in_y - top_y_index; for (int x = 0; x < crop_width; ++x) { const float in_x = (crop_width > 1) ? x1 * (image_width - 1) + x * width_scale : 0.5 * (x1 + x2) * (image_width - 1); if (in_x < 0 || in_x > image_width - 1) { continue; } const int left_x_index = floorf(in_x); const int right_x_index = ceilf(in_x); const float x_lerp = in_x - left_x_index; for (int d = 0; d < depth; ++d) { const float top_left( static_cast(image(b_in, top_y_index, left_x_index, d))); const float top_right( static_cast(image(b_in, top_y_index, right_x_index, d))); const float bottom_left(static_cast( image(b_in, bottom_y_index, left_x_index, d))); const float bottom_right(static_cast( image(b_in, bottom_y_index, right_x_index, d))); // Compute the image gradient. float image_grad_y = (1 - x_lerp) * (bottom_left - top_left) + x_lerp * (bottom_right - top_right); float image_grad_x = (1 - y_lerp) * (top_right - top_left) + y_lerp * (bottom_right - bottom_left); // Modulate the image gradient with the incoming gradient. const float top_grad = grads(b, y, x, d); image_grad_y *= top_grad; image_grad_x *= top_grad; // dy1, dy2 if (crop_height > 1) { grads_boxes(b, 0) += image_grad_y * (image_height - 1 - y * height_ratio); grads_boxes(b, 2) += image_grad_y * (y * height_ratio); } else { grads_boxes(b, 0) += image_grad_y * 0.5 * (image_height - 1); grads_boxes(b, 2) += image_grad_y * 0.5 * (image_height - 1); } // dx1, dx2 if (crop_width > 1) { grads_boxes(b, 1) += image_grad_x * (image_width - 1 - x * width_ratio); grads_boxes(b, 3) += image_grad_x * (x * width_ratio); } else { grads_boxes(b, 1) += image_grad_x * 0.5 * (image_width - 1); grads_boxes(b, 3) += image_grad_x * 0.5 * (image_width - 1); } } } } } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376777, "input": "static const avifPropertyArray * avifSampleTableGetProperties(const avifSampleTable * sampleTable) { for (uint32_t i = 0; i < sampleTable->sampleDescriptions.count; ++i) { const avifSampleDescription * description = &sampleTable->sampleDescriptions.description[i]; if (!memcmp(description->format, \"av01\", 4)) { return &description->properties; } } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445542, "input": "static inline void trace_access_lock_init(void) { int cpu; for_each_possible_cpu(cpu) mutex_init(&per_cpu(cpu_access_lock, cpu)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506565, "input": "continue_command() { c_token++; if (iteration_depth == 0) return; /* Skip to end of current clause */ c_token = num_tokens; /* request that remainder of this iteration be skipped also */ requested_continue = TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219159, "input": "int size() const { return m_px ? m_px->size() : 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402141, "input": "void bcf_hrec_destroy(bcf_hrec_t *hrec) { if (!hrec) return; free(hrec->key); if ( hrec->value ) free(hrec->value); int i; for (i=0; inkeys; i++) { free(hrec->keys[i]); free(hrec->vals[i]); } free(hrec->keys); free(hrec->vals); free(hrec); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462781, "input": "static void preinit_thread (lua_State *L, global_State *g) { G(L) = g; L->stack = NULL; L->ci = NULL; L->nci = 0; L->stacksize = 0; L->twups = L; /* thread has no upvalues */ L->errorJmp = NULL; L->hook = NULL; L->hookmask = 0; L->basehookcount = 0; L->allowhook = 1; resethookcount(L); L->openupval = NULL; L->status = LUA_OK; L->errfunc = 0; L->oldpc = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333168, "input": "data_addid64(struct extdata *xd, unsigned long long x) { if (x >= 0x100000000) { if ((x >> 35) != 0) { data_addid(xd, (Id)(x >> 35)); xd->buf[xd->len - 1] |= 128; } data_addid(xd, (Id)((unsigned int)x | 0x80000000)); xd->buf[xd->len - 5] = (x >> 28) | 128; } else data_addid(xd, (Id)x); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 392982, "input": "TEST_F(QueryPlannerTest, CannotTrimIxisectAndHashWithOrChild) { params.options = QueryPlannerParams::CANNOT_TRIM_IXISECT; params.options |= QueryPlannerParams::INDEX_INTERSECTION; params.options |= QueryPlannerParams::NO_TABLE_SCAN; addIndex(BSON(\"a\" << 1)); addIndex(BSON(\"b\" << 1)); addIndex(BSON(\"c\" << 1)); runQuery(fromjson(\"{c: 1, $or: [{a: 1}, {b: 1, d: 1}]}\")); assertNumSolutions(3U); assertSolutionExists( \"{fetch: {filter: {c: 1}, node: {or: {nodes: [\" \"{fetch: {filter: {d: 1}, node: {ixscan: {filter: null,\" \"pattern: {b: 1}, bounds: {b: [[1,1,true,true]]}}}}},\" \"{ixscan: {filter: null, pattern: {a: 1},\" \"bounds: {a: [[1,1,true,true]]}}}]}}}}\"); assertSolutionExists( \"{fetch: {filter: {$or:[{b:1,d:1},{a:1}]}, node:\" \"{ixscan: {filter: null, pattern: {c: 1}}}}}\"); assertSolutionExists( \"{fetch: {filter: {c:1,$or:[{a:1},{b:1,d:1}]}, node:{andHash:{nodes:[\" \"{or: {nodes: [\" \"{fetch: {filter: {d:1}, node: {ixscan: {pattern: {b: 1}}}}},\" \"{ixscan: {filter: null, pattern: {a: 1}}}]}},\" \"{ixscan: {filter: null, pattern: {c: 1}}}]}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506524, "input": "toggle_display_of_ipc_commands() { if (mouse_setting.verbose) mouse_setting.verbose = 0; else mouse_setting.verbose = 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246269, "input": "AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string) { core_request_config *conf = ap_get_core_module_config(r->request_config); int idx; if (conf->response_code_strings == NULL) { conf->response_code_strings = apr_pcalloc(r->pool, sizeof(*conf->response_code_strings) * RESPONSE_CODES); } idx = ap_index_of_response(status); conf->response_code_strings[idx] = ((ap_is_url(string) || (*string == '/')) && (*string != '\"')) ? apr_pstrdup(r->pool, string) : apr_pstrcat(r->pool, \"\\\"\", string, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215458, "input": "int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) { struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_super_block *es = sbi->s_es; int reserved_gdb = ext4_bg_has_super(sb, input->group) ? le16_to_cpu(es->s_reserved_gdt_blocks) : 0; struct buffer_head *primary = NULL; struct ext4_group_desc *gdp; struct inode *inode = NULL; handle_t *handle; int gdb_off, gdb_num; int num_grp_locked = 0; int err, err2; gdb_num = input->group / EXT4_DESC_PER_BLOCK(sb); gdb_off = input->group % EXT4_DESC_PER_BLOCK(sb); if (gdb_off == 0 && !EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)) { ext4_warning(sb, __func__, \"Can't resize non-sparse filesystem further\"); return -EPERM; } if (ext4_blocks_count(es) + input->blocks_count < ext4_blocks_count(es)) { ext4_warning(sb, __func__, \"blocks_count overflow\"); return -EINVAL; } if (le32_to_cpu(es->s_inodes_count) + EXT4_INODES_PER_GROUP(sb) < le32_to_cpu(es->s_inodes_count)) { ext4_warning(sb, __func__, \"inodes_count overflow\"); return -EINVAL; } if (reserved_gdb || gdb_off == 0) { if (!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_RESIZE_INODE) || !le16_to_cpu(es->s_reserved_gdt_blocks)) { ext4_warning(sb, __func__, \"No reserved GDT blocks, can't resize\"); return -EPERM; } inode = ext4_iget(sb, EXT4_RESIZE_INO); if (IS_ERR(inode)) { ext4_warning(sb, __func__, \"Error opening resize inode\"); return PTR_ERR(inode); } } if ((err = verify_group_input(sb, input))) goto exit_put; if ((err = setup_new_group_blocks(sb, input))) goto exit_put; /* * We will always be modifying at least the superblock and a GDT * block. If we are adding a group past the last current GDT block, * we will also modify the inode and the dindirect block. If we * are adding a group with superblock/GDT backups we will also * modify each of the reserved GDT dindirect blocks. */ handle = ext4_journal_start_sb(sb, ext4_bg_has_super(sb, input->group) ? 3 + reserved_gdb : 4); if (IS_ERR(handle)) { err = PTR_ERR(handle); goto exit_put; } lock_super(sb); if (input->group != sbi->s_groups_count) { ext4_warning(sb, __func__, \"multiple resizers run on filesystem!\"); err = -EBUSY; goto exit_journal; } if ((err = ext4_journal_get_write_access(handle, sbi->s_sbh))) goto exit_journal; /* * We will only either add reserved group blocks to a backup group * or remove reserved blocks for the first group in a new group block. * Doing both would be mean more complex code, and sane people don't * use non-sparse filesystems anymore. This is already checked above. */ if (gdb_off) { primary = sbi->s_group_desc[gdb_num]; if ((err = ext4_journal_get_write_access(handle, primary))) goto exit_journal; if (reserved_gdb && ext4_bg_num_gdb(sb, input->group) && (err = reserve_backup_gdb(handle, inode, input))) goto exit_journal; } else if ((err = add_new_gdb(handle, inode, input, &primary))) goto exit_journal; /* * OK, now we've set up the new group. Time to make it active. * * Current kernels don't lock all allocations via lock_super(), * so we have to be safe wrt. concurrent accesses the group * data. So we need to be careful to set all of the relevant * group descriptor data etc. *before* we enable the group. * * The key field here is sbi->s_groups_count: as long as * that retains its old value, nobody is going to access the new * group. * * So first we update all the descriptor metadata for the new * group; then we update the total disk blocks count; then we * update the groups count to enable the group; then finally we * update the free space counts so that the system can start * using the new disk blocks. */ num_grp_locked = ext4_mb_get_buddy_cache_lock(sb, input->group); /* Update group descriptor block for new group */ gdp = (struct ext4_group_desc *)((char *)primary->b_data + gdb_off * EXT4_DESC_SIZE(sb)); ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ ext4_free_blks_set(sb, gdp, input->free_blocks_count); ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); gdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_ZEROED); gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp); /* * We can allocate memory for mb_alloc based on the new group * descriptor */ err = ext4_mb_add_groupinfo(sb, input->group, gdp); if (err) { ext4_mb_put_buddy_cache_lock(sb, input->group, num_grp_locked); goto exit_journal; } /* * Make the new blocks and inodes valid next. We do this before * increasing the group count so that once the group is enabled, * all of its blocks and inodes are already valid. * * We always allocate group-by-group, then block-by-block or * inode-by-inode within a group, so enabling these * blocks/inodes before the group is live won't actually let us * allocate the new space yet. */ ext4_blocks_count_set(es, ext4_blocks_count(es) + input->blocks_count); le32_add_cpu(&es->s_inodes_count, EXT4_INODES_PER_GROUP(sb)); /* * We need to protect s_groups_count against other CPUs seeing * inconsistent state in the superblock. * * The precise rules we use are: * * * Writers of s_groups_count *must* hold lock_super * AND * * Writers must perform a smp_wmb() after updating all dependent * data and before modifying the groups count * * * Readers must hold lock_super() over the access * OR * * Readers must perform an smp_rmb() after reading the groups count * and before reading any dependent data. * * NB. These rules can be relaxed when checking the group count * while freeing data, as we can only allocate from a block * group after serialising against the group count, and we can * only then free after serialising in turn against that * allocation. */ smp_wmb(); /* Update the global fs size fields */ sbi->s_groups_count++; ext4_mb_put_buddy_cache_lock(sb, input->group, num_grp_locked); ext4_handle_dirty_metadata(handle, NULL, primary); /* Update the reserved block counts only once the new group is * active. */ ext4_r_blocks_count_set(es, ext4_r_blocks_count(es) + input->reserved_blocks); /* Update the free space counts */ percpu_counter_add(&sbi->s_freeblocks_counter, input->free_blocks_count); percpu_counter_add(&sbi->s_freeinodes_counter, EXT4_INODES_PER_GROUP(sb)); if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) { ext4_group_t flex_group; flex_group = ext4_flex_group(sbi, input->group); sbi->s_flex_groups[flex_group].free_blocks += input->free_blocks_count; sbi->s_flex_groups[flex_group].free_inodes += EXT4_INODES_PER_GROUP(sb); } ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh); sb->s_dirt = 1; exit_journal: unlock_super(sb); if ((err2 = ext4_journal_stop(handle)) && !err) err = err2; if (!err) { update_backups(sb, sbi->s_sbh->b_blocknr, (char *)es, sizeof(struct ext4_super_block)); update_backups(sb, primary->b_blocknr, primary->b_data, primary->b_size); } exit_put: iput(inode); return err; } /* ext4_group_add */", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Input Validation"], "explanation": "The ext4_group_add function in fs/ext4/resize.c in the Linux kernel 2.6.27 before 2.6.27.19 and 2.6.28 before 2.6.28.7 does not properly initialize the group descriptor during a resize (aka resize2fs) operation, which might allow local users to cause a denial of service (OOPS) by arranging for crafted values to be present in available memory.", "severity_level": "Medium", "cwe": "CWE-20", "cve": "CVE-2009-0745"}} -{"idx": 417818, "input": "static int SFDDumpBitmapFont(FILE *sfd,BDFFont *bdf,EncMap *encm,int *newgids, int todir, char *dirname) { int i; int err = false; BDFChar *bc; BDFRefChar *ref; ff_progress_next_stage(); if (bdf->foundry) fprintf( sfd, \"BitmapFont: %d %d %d %d %d %s\\n\", bdf->pixelsize, bdf->glyphcnt, bdf->ascent, bdf->descent, BDFDepth(bdf), bdf->foundry ); else fprintf( sfd, \"BitmapFont: %d %d %d %d %d\\n\", bdf->pixelsize, bdf->glyphcnt, bdf->ascent, bdf->descent, BDFDepth(bdf) ); if ( bdf->prop_cnt>0 ) { fprintf( sfd, \"BDFStartProperties: %d\\n\", bdf->prop_cnt ); for ( i=0; iprop_cnt; ++i ) { fprintf(sfd,\"%s %d \", bdf->props[i].name, bdf->props[i].type ); switch ( bdf->props[i].type&~prt_property ) { case prt_int: case prt_uint: fprintf(sfd, \"%d\\n\", bdf->props[i].u.val ); break; case prt_string: case prt_atom: fprintf(sfd, \"\\\"%s\\\"\\n\", bdf->props[i].u.str ); break; default: break; } } fprintf( sfd, \"BDFEndProperties\\n\" ); } if ( bdf->res>20 ) fprintf( sfd, \"Resolution: %d\\n\", bdf->res ); for ( i=0; iglyphcnt; ++i ) { if ( bdf->glyphs[i]!=NULL ) { if ( todir ) { char *glyphfile = malloc(strlen(dirname)+2*strlen(bdf->glyphs[i]->sc->name)+20); FILE *gsfd; appendnames(glyphfile,dirname,\"/\",bdf->glyphs[i]->sc->name,BITMAP_EXT ); gsfd = fopen(glyphfile,\"w\"); if ( gsfd!=NULL ) { SFDDumpBitmapChar(gsfd,bdf->glyphs[i],encm->backmap[i],newgids); if ( ferror(gsfd)) err = true; if ( fclose(gsfd)) err = true; } else err = true; free(glyphfile); } else SFDDumpBitmapChar(sfd,bdf->glyphs[i],encm->backmap[i],newgids); } ff_progress_next(); } for ( i=0; iglyphcnt; ++i ) if (( bc = bdf->glyphs[i] ) != NULL ) { for ( ref=bc->refs; ref!=NULL; ref=ref->next ) fprintf(sfd, \"BDFRefChar: %d %d %d %d %c\\n\", newgids!=NULL ? newgids[bc->orig_pos] : bc->orig_pos, newgids!=NULL ? newgids[ref->bdfc->orig_pos] : ref->bdfc->orig_pos, ref->xoff,ref->yoff,ref->selected?'S':'N' ); } fprintf( sfd, \"EndBitmapFont\\n\" ); return( err ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265799, "input": "~CWebAuth() override {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508498, "input": "static Item **get_sargable_cond(JOIN *join, TABLE *table) { Item **retval; if (table->pos_in_table_list->on_expr) { /* This is an inner table from a single-table LEFT JOIN, \"t1 LEFT JOIN t2 ON cond\". Use the condition cond. */ retval= &table->pos_in_table_list->on_expr; } else if (table->pos_in_table_list->embedding && !table->pos_in_table_list->embedding->sj_on_expr) { /* This is the inner side of a multi-table outer join. Use the appropriate ON expression. */ retval= &(table->pos_in_table_list->embedding->on_expr); } else { /* The table is not inner wrt some LEFT JOIN. Use the WHERE clause */ retval= &join->conds; } return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 503765, "input": "int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; unsigned int currbuf = 0; /* XXXX */ if ((s->rlayer.wpend_tot > (int)len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return (-1); } for (;;) { /* Loop until we find a buffer we haven't written out yet */ if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], i); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; return (s->rlayer.wpend_ret); } else if (i <= 0) { if (SSL_IS_DTLS(s)) { /* * For DTLS, just drop it. That's kind of the whole point in * using a datagram service */ SSL3_BUFFER_set_left(&wb[currbuf], 0); } return (i); } SSL3_BUFFER_add_offset(&wb[currbuf], i); SSL3_BUFFER_add_left(&wb[currbuf], -i); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279688, "input": "static bool notify_marshall_changes(int num_changes, uint32_t max_offset, struct notify_change_event *changes, DATA_BLOB *final_blob) { int i; if (num_changes == -1) { return false; } /* * Sort the notifies by timestamp when the event happened to avoid * coalescing and thus dropping events. */ qsort(changes, num_changes, sizeof(*changes), compare_notify_change_events); for (i=0; iname; m.FileNameLength = strlen_m(c->name)*2; m.Action = c->action; m._pad = data_blob_null; /* * Offset to next entry, only if there is one */ if (i == (num_changes-1)) { m.NextEntryOffset = 0; } else { if ((m.FileNameLength % 4) == 2) { m._pad = data_blob_const(&pad, 2); } m.NextEntryOffset = ndr_size_FILE_NOTIFY_INFORMATION(&m, 0); } ndr_err = ndr_push_struct_blob(&blob, talloc_tos(), &m, (ndr_push_flags_fn_t)ndr_push_FILE_NOTIFY_INFORMATION); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return false; } if (DEBUGLEVEL >= 10) { NDR_PRINT_DEBUG(FILE_NOTIFY_INFORMATION, &m); } if (!data_blob_append(talloc_tos(), final_blob, blob.data, blob.length)) { data_blob_free(&blob); return false; } data_blob_free(&blob); if (final_blob->length > max_offset) { /* Too much data for client. */ DEBUG(10, (\"Client only wanted %d bytes, trying to \" \"marshall %d bytes\\n\", (int)max_offset, (int)final_blob->length)); return False; } } return True; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 235715, "input": "se::DeviceMemory AsDeviceMemory(const T* cuda_memory) { se::DeviceMemoryBase wrapped(const_cast(cuda_memory)); se::DeviceMemory typed(wrapped); return typed; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338670, "input": "*/ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, const sigset_t __user *sig, size_t sigsz, struct __kernel_timespec __user *uts) { struct io_wait_queue iowq = { .wq = { .private = current, .func = io_wake_function, .entry = LIST_HEAD_INIT(iowq.wq.entry), }, .ctx = ctx, .to_wait = min_events, }; struct io_rings *rings = ctx->rings; signed long timeout = MAX_SCHEDULE_TIMEOUT; int ret; do { io_cqring_overflow_flush(ctx, false); if (io_cqring_events(ctx) >= min_events) return 0; if (!io_run_task_work()) break; } while (1); if (sig) { #ifdef CONFIG_COMPAT if (in_compat_syscall()) ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, sigsz); else #endif ret = set_user_sigmask(sig, sigsz); if (ret) return ret; } if (uts) { struct timespec64 ts; if (get_timespec64(&ts, uts)) return -EFAULT; timeout = timespec64_to_jiffies(&ts); } iowq.nr_timeouts = atomic_read(&ctx->cq_timeouts); trace_io_uring_cqring_wait(ctx, min_events); do { /* if we can't even flush overflow, don't wait for more */ if (!io_cqring_overflow_flush(ctx, false)) { ret = -EBUSY; break; } prepare_to_wait_exclusive(&ctx->wait, &iowq.wq, TASK_INTERRUPTIBLE); ret = io_cqring_wait_schedule(ctx, &iowq, &timeout); finish_wait(&ctx->wait, &iowq.wq); cond_resched(); } while (ret > 0); restore_saved_sigmask_unless(ret == -EINTR); return READ_ONCE(rings->cq.head) == READ_ONCE(rings->cq.tail) ? ret : 0;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 252497, "input": "static void pb_release_single_field(const pb_field_iter_t *iter) { pb_type_t type; type = iter->pos->type; if (PB_HTYPE(type) == PB_HTYPE_ONEOF) { if (*(pb_size_t*)iter->pSize != iter->pos->tag) return; /* This is not the current field in the union */ } /* Release anything contained inside an extension or submsg. * This has to be done even if the submsg itself is statically * allocated. */ if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) { /* Release fields from all extensions in the linked list */ pb_extension_t *ext = *(pb_extension_t**)iter->pData; while (ext != NULL) { pb_field_iter_t ext_iter; iter_from_extension(&ext_iter, ext); pb_release_single_field(&ext_iter); ext = ext->next; } } else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && PB_ATYPE(type) != PB_ATYPE_CALLBACK) { /* Release fields in submessage or submsg array */ void *pItem = iter->pData; pb_size_t count = 1; if (PB_ATYPE(type) == PB_ATYPE_POINTER) { pItem = *(void**)iter->pData; } if (PB_HTYPE(type) == PB_HTYPE_REPEATED) { if (PB_ATYPE(type) == PB_ATYPE_STATIC && iter->pSize == iter->pData) { /* No _count field so use size of the array */ count = iter->pos->array_size; } else { count = *(pb_size_t*)iter->pSize; } if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > iter->pos->array_size) { /* Protect against corrupted _count fields */ count = iter->pos->array_size; } } if (pItem) { while (count--) { pb_release((const pb_field_t*)iter->pos->ptr, pItem); pItem = (char*)pItem + iter->pos->data_size; } } } if (PB_ATYPE(type) == PB_ATYPE_POINTER) { if (PB_HTYPE(type) == PB_HTYPE_REPEATED && (PB_LTYPE(type) == PB_LTYPE_STRING || PB_LTYPE(type) == PB_LTYPE_BYTES)) { /* Release entries in repeated string or bytes array */ void **pItem = *(void***)iter->pData; pb_size_t count = *(pb_size_t*)iter->pSize; while (count--) { pb_free(*pItem); *pItem++ = NULL; } } if (PB_HTYPE(type) == PB_HTYPE_REPEATED) { /* We are going to release the array, so set the size to 0 */ *(pb_size_t*)iter->pSize = 0; } /* Release main item */ pb_free(*(void**)iter->pData); *(void**)iter->pData = NULL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 312988, "input": "undo_read_4c(bufinfo_T *bi) { #ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { char_u buf[4]; int n; undo_read(bi, buf, (size_t)4); n = ((unsigned)buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; return n; } #endif return get4c(bi->bi_fp); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268979, "input": "R_API int r_socket_flush(RSocket *s) { return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393270, "input": "TEST_F(QueryPlannerTest, IntersectSubtreeAndPred) { params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION; addIndex(BSON(\"a\" << 1)); addIndex(BSON(\"b\" << 1)); addIndex(BSON(\"c\" << 1)); runQuery(fromjson(\"{a: 1, $or: [{b:1}, {c:1}]}\")); // This (can be) rewritten to $or:[ {a:1, b:1}, {c:1, d:1}]. We don't look for the various // single $or solutions as that's tested elsewhere. We look for the intersect solution, // where each AND inside of the root OR is an and_sorted. size_t matches = 0; matches += numSolutionMatches( \"{fetch: {filter: null, node: {or: {nodes: [\" \"{andSorted: {nodes: [\" \"{ixscan: {filter: null, pattern: {'a':1}}},\" \"{ixscan: {filter: null, pattern: {'b':1}}}]}},\" \"{andSorted: {nodes: [\" \"{ixscan: {filter: null, pattern: {'a':1}}},\" \"{ixscan: {filter: null, pattern: {'c':1}}}]}}]}}}}\"); matches += numSolutionMatches( \"{fetch: {filter: null, node: {andHash: {nodes:[\" \"{or: {nodes: [{ixscan:{filter:null, pattern:{b:1}}},\" \"{ixscan:{filter:null, pattern:{c:1}}}]}},\" \"{ixscan:{filter: null, pattern:{a:1}}}]}}}}\"); ASSERT_GREATER_THAN_OR_EQUALS(matches, 1U); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237566, "input": "GF_HEVCConfig *HEVC_DuplicateConfig(GF_HEVCConfig *cfg) { u8 *data; u32 data_size; GF_HEVCConfig *new_cfg; GF_BitStream *bs; if (!cfg) return NULL; bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); gf_odf_hevc_cfg_write_bs(cfg, bs); gf_bs_get_content(bs, &data, &data_size); gf_bs_del(bs); bs = gf_bs_new(data, data_size, GF_BITSTREAM_READ); new_cfg = gf_odf_hevc_cfg_read_bs(bs, cfg->is_lhvc); new_cfg->is_lhvc = cfg->is_lhvc; gf_bs_del(bs); gf_free(data); return new_cfg; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354575, "input": "static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, const struct mmu_notifier_range *range) { struct kvm *kvm = mmu_notifier_to_kvm(mn); int need_tlb_flush = 0, idx; int ret; idx = srcu_read_lock(&kvm->srcu); spin_lock(&kvm->mmu_lock); /* * The count increase must become visible at unlock time as no * spte can be established without taking the mmu_lock and * count is also read inside the mmu_lock critical section. */ kvm->mmu_notifier_count++; need_tlb_flush = kvm_unmap_hva_range(kvm, range->start, range->end); need_tlb_flush |= kvm->tlbs_dirty; /* we've to flush the tlb before the pages can be freed */ if (need_tlb_flush) kvm_flush_remote_tlbs(kvm); spin_unlock(&kvm->mmu_lock); ret = kvm_arch_mmu_notifier_invalidate_range(kvm, range->start, range->end, mmu_notifier_range_blockable(range)); srcu_read_unlock(&kvm->srcu, idx); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280800, "input": "check_DEBUG_SLOW(const struct ofpact_null *a OVS_UNUSED, const struct ofpact_check_params *cp OVS_UNUSED) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 404077, "input": "int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, void *data, unsigned long len) { return kvm_read_guest_offset_cached(kvm, ghc, data, 0, len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 375133, "input": "__acquires(¤t->sighand->siglock) { bool gstop_done = false; if (arch_ptrace_stop_needed(exit_code, info)) { /* * The arch code has something special to do before a * ptrace stop. This is allowed to block, e.g. for faults * on user stack pages. We can't keep the siglock while * calling arch_ptrace_stop, so we must release it now. * To preserve proper semantics, we must do this before * any signal bookkeeping like checking group_stop_count. * Meanwhile, a SIGKILL could come in before we retake the * siglock. That must prevent us from sleeping in TASK_TRACED. * So after regaining the lock, we must check for SIGKILL. */ spin_unlock_irq(¤t->sighand->siglock); arch_ptrace_stop(exit_code, info); spin_lock_irq(¤t->sighand->siglock); if (sigkill_pending(current)) return; } set_special_state(TASK_TRACED); /* * We're committing to trapping. TRACED should be visible before * TRAPPING is cleared; otherwise, the tracer might fail do_wait(). * Also, transition to TRACED and updates to ->jobctl should be * atomic with respect to siglock and should be done after the arch * hook as siglock is released and regrabbed across it. * * TRACER TRACEE * * ptrace_attach() * [L] wait_on_bit(JOBCTL_TRAPPING) [S] set_special_state(TRACED) * do_wait() * set_current_state() smp_wmb(); * ptrace_do_wait() * wait_task_stopped() * task_stopped_code() * [L] task_is_traced() [S] task_clear_jobctl_trapping(); */ smp_wmb(); current->last_siginfo = info; current->exit_code = exit_code; /* * If @why is CLD_STOPPED, we're trapping to participate in a group * stop. Do the bookkeeping. Note that if SIGCONT was delievered * across siglock relocks since INTERRUPT was scheduled, PENDING * could be clear now. We act as if SIGCONT is received after * TASK_TRACED is entered - ignore it. */ if (why == CLD_STOPPED && (current->jobctl & JOBCTL_STOP_PENDING)) gstop_done = task_participate_group_stop(current); /* any trap clears pending STOP trap, STOP trap clears NOTIFY */ task_clear_jobctl_pending(current, JOBCTL_TRAP_STOP); if (info && info->si_code >> 8 == PTRACE_EVENT_STOP) task_clear_jobctl_pending(current, JOBCTL_TRAP_NOTIFY); /* entering a trap, clear TRAPPING */ task_clear_jobctl_trapping(current); spin_unlock_irq(¤t->sighand->siglock); read_lock(&tasklist_lock); if (may_ptrace_stop()) { /* * Notify parents of the stop. * * While ptraced, there are two parents - the ptracer and * the real_parent of the group_leader. The ptracer should * know about every stop while the real parent is only * interested in the completion of group stop. The states * for the two don't interact with each other. Notify * separately unless they're gonna be duplicates. */ do_notify_parent_cldstop(current, true, why); if (gstop_done && ptrace_reparented(current)) do_notify_parent_cldstop(current, false, why); /* * Don't want to allow preemption here, because * sys_ptrace() needs this task to be inactive. * * XXX: implement read_unlock_no_resched(). */ preempt_disable(); read_unlock(&tasklist_lock); cgroup_enter_frozen(); preempt_enable_no_resched(); freezable_schedule(); cgroup_leave_frozen(true); } else { /* * By the time we got the lock, our tracer went away. * Don't drop the lock yet, another tracer may come. * * If @gstop_done, the ptracer went away between group stop * completion and here. During detach, it would have set * JOBCTL_STOP_PENDING on us and we'll re-enter * TASK_STOPPED in do_signal_stop() on return, so notifying * the real parent of the group stop completion is enough. */ if (gstop_done) do_notify_parent_cldstop(current, false, why); /* tasklist protects us from ptrace_freeze_traced() */ __set_current_state(TASK_RUNNING); if (clear_code) current->exit_code = 0; read_unlock(&tasklist_lock); } /* * We are back. Now reacquire the siglock before touching * last_siginfo, so that we are sure to have synchronized with * any signal-sending on another CPU that wants to examine it. */ spin_lock_irq(¤t->sighand->siglock); current->last_siginfo = NULL; /* LISTENING can be set only during STOP traps, clear it */ current->jobctl &= ~JOBCTL_LISTENING; /* * Queued signals ignored us while we were stopped for tracing. * So check for any that we should take before resuming user mode. * This sets TIF_SIGPENDING, but never clears it. */ recalc_sigpending_tsk(current); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 505508, "input": "void agpushdisc(Agraph_t * g, Agcbdisc_t * cbd, void *state) { Agcbstack_t *stack_ent; stack_ent = AGNEW(g, Agcbstack_t); stack_ent->f = cbd; stack_ent->state = state; stack_ent->prev = g->clos->cb; g->clos->cb = stack_ent; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 388310, "input": "UINT cliprdr_read_format_data_request(wStream* s, CLIPRDR_FORMAT_DATA_REQUEST* request) { if (Stream_GetRemainingLength(s) < 4) { WLog_ERR(TAG, \"not enough data in stream!\"); return ERROR_INVALID_DATA; } Stream_Read_UINT32(s, request->requestedFormatId); /* requestedFormatId (4 bytes) */ return CHANNEL_RC_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508731, "input": "static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, bool distinct,const char *message) { THD *thd=join->thd; select_result *result=join->result; DBUG_ENTER(\"select_describe\"); /* Update the QPF with latest values of using_temporary, using_filesort */ for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit(); unit; unit= unit->next_unit()) { /* This fix_fields() call is to handle an edge case like this: SELECT ... UNION SELECT ... ORDER BY (SELECT ...) for such queries, we'll get here before having called subquery_expr->fix_fields(), which will cause failure to */ if (unit->item && !unit->item->fixed) { Item *ref= unit->item; if (unit->item->fix_fields(thd, &ref)) DBUG_VOID_RETURN; DBUG_ASSERT(ref == unit->item); } /* Save plans for child subqueries, when (1) they are not parts of eliminated WHERE/ON clauses. (2) they are not VIEWs that were \"merged for INSERT\". (3) they are not hanging CTEs (they are needed for execution) */ if (!(unit->item && unit->item->eliminated) && // (1) !(unit->derived && unit->derived->merged_for_insert) && // (2) (!unit->with_element || (unit->derived && unit->derived->derived_result && !unit->with_element->is_hanging_recursive()))) // (3) { if (mysql_explain_union(thd, unit, result)) DBUG_VOID_RETURN; } } DBUG_VOID_RETURN; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 481492, "input": "static void suboption(struct Curl_easy *data) { struct curl_slist *v; unsigned char temp[2048]; ssize_t bytes_written; size_t len; int err; char varname[128] = \"\"; char varval[128] = \"\"; struct TELNET *tn = data->req.p.telnet; struct connectdata *conn = data->conn; printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2); switch(CURL_SB_GET(tn)) { case CURL_TELOPT_TTYPE: len = strlen(tn->subopt_ttype) + 4 + 2; msnprintf((char *)temp, sizeof(temp), \"%c%c%c%c%s%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE, CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE); bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); if(bytes_written < 0) { err = SOCKERRNO; failf(data,\"Sending data failed (%d)\",err); } printsub(data, '>', &temp[2], len-2); break; case CURL_TELOPT_XDISPLOC: len = strlen(tn->subopt_xdisploc) + 4 + 2; msnprintf((char *)temp, sizeof(temp), \"%c%c%c%c%s%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC, CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE); bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); if(bytes_written < 0) { err = SOCKERRNO; failf(data,\"Sending data failed (%d)\",err); } printsub(data, '>', &temp[2], len-2); break; case CURL_TELOPT_NEW_ENVIRON: msnprintf((char *)temp, sizeof(temp), \"%c%c%c%c\", CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON, CURL_TELQUAL_IS); len = 4; for(v = tn->telnet_vars; v; v = v->next) { size_t tmplen = (strlen(v->data) + 1); /* Add the variable only if it fits */ if(len + tmplen < (int)sizeof(temp)-6) { if(sscanf(v->data, \"%127[^,],%127s\", varname, varval) == 2) { msnprintf((char *)&temp[len], sizeof(temp) - len, \"%c%s%c%s\", CURL_NEW_ENV_VAR, varname, CURL_NEW_ENV_VALUE, varval); len += tmplen; } } } msnprintf((char *)&temp[len], sizeof(temp) - len, \"%c%c\", CURL_IAC, CURL_SE); len += 2; bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); if(bytes_written < 0) { err = SOCKERRNO; failf(data,\"Sending data failed (%d)\",err); } printsub(data, '>', &temp[2], len-2); break; } return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279620, "input": "lynx_get(struct pcilynx *lynx) { kref_get(&lynx->kref); return lynx; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219132, "input": "Variant HHVM_FUNCTION(imagecolorallocate, const Resource& image, int64_t red, int64_t green, int64_t blue) { gdImagePtr im = get_valid_image_resource(image); if (!im) return false; int ct = gdImageColorAllocate(im, red, green, blue); if (ct < 0) { return false; } return ct; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 116279, "input": "void SoftwareFrameManager::GetCurrentFrameMailbox( cc::TextureMailbox* mailbox, scoped_ptr* callback) { DCHECK(HasCurrentFrame()); *mailbox = cc::TextureMailbox( current_frame_->shared_memory_.get(), current_frame_->frame_size_pixels_); *callback = cc::SingleReleaseCallback::Create( base::Bind(ReleaseMailbox, current_frame_)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230587, "input": "GF_Box *afra_box_new() { ISOM_DECL_BOX_ALLOC(GF_AdobeFragRandomAccessBox, GF_ISOM_BOX_TYPE_AFRA); tmp->local_access_entries = gf_list_new(); tmp->global_access_entries = gf_list_new(); return (GF_Box *)tmp; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431569, "input": "static void nfs4_locku_done(struct rpc_task *task, void *data) { struct nfs4_unlockdata *calldata = data; struct nfs4_exception exception = { .inode = calldata->lsp->ls_state->inode, .stateid = &calldata->arg.stateid, }; if (!nfs4_sequence_done(task, &calldata->res.seq_res)) return; switch (task->tk_status) { case 0: renew_lease(calldata->server, calldata->timestamp); locks_lock_inode_wait(calldata->lsp->ls_state->inode, &calldata->fl); if (nfs4_update_lock_stateid(calldata->lsp, &calldata->res.stateid)) break; /* Fall through */ case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_EXPIRED: nfs4_free_revoked_stateid(calldata->server, &calldata->arg.stateid, task->tk_msg.rpc_cred); /* Fall through */ case -NFS4ERR_BAD_STATEID: case -NFS4ERR_STALE_STATEID: if (nfs4_sync_lock_stateid(&calldata->arg.stateid, calldata->lsp)) rpc_restart_call_prepare(task); break; case -NFS4ERR_OLD_STATEID: if (nfs4_refresh_lock_old_stateid(&calldata->arg.stateid, calldata->lsp)) rpc_restart_call_prepare(task); break; default: task->tk_status = nfs4_async_handle_exception(task, calldata->server, task->tk_status, &exception); if (exception.retry) rpc_restart_call_prepare(task); } nfs_release_seqid(calldata->arg.seqid); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 116650, "input": "void SearchEngineTabHelper::OnDownloadedOSDD( scoped_ptr template_url) { Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); delegate_->ConfirmAddSearchProvider(template_url.release(), profile); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 343482, "input": "static void kvm_hv_notify_acked_sint(struct kvm_vcpu *vcpu, u32 sint) { struct kvm *kvm = vcpu->kvm; struct kvm_vcpu_hv_synic *synic = to_hv_synic(vcpu); struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); struct kvm_vcpu_hv_stimer *stimer; int gsi, idx; trace_kvm_hv_notify_acked_sint(vcpu->vcpu_id, sint); /* Try to deliver pending Hyper-V SynIC timers messages */ for (idx = 0; idx < ARRAY_SIZE(hv_vcpu->stimer); idx++) { stimer = &hv_vcpu->stimer[idx]; if (stimer->msg_pending && stimer->config.enable && !stimer->config.direct_mode && stimer->config.sintx == sint) stimer_mark_pending(stimer, false); } idx = srcu_read_lock(&kvm->irq_srcu); gsi = atomic_read(&synic->sint_to_gsi[sint]); if (gsi != -1) kvm_notify_acked_gsi(kvm, gsi); srcu_read_unlock(&kvm->irq_srcu, idx); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399225, "input": "static BOOL license_write_encrypted_premaster_secret_blob(wStream* s, const LICENSE_BLOB* blob, UINT32 ModulusLength) { UINT32 length; length = ModulusLength + 8; if (blob->length > ModulusLength) { WLog_ERR(TAG, \"license_write_encrypted_premaster_secret_blob: invalid blob\"); return FALSE; } if (!Stream_EnsureRemainingCapacity(s, length + 4)) return FALSE; Stream_Write_UINT16(s, blob->type); /* wBlobType (2 bytes) */ Stream_Write_UINT16(s, length); /* wBlobLen (2 bytes) */ if (blob->length > 0) Stream_Write(s, blob->data, blob->length); /* blobData */ Stream_Zero(s, length - blob->length); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346285, "input": "static int usb_host_set_address(USBHostDevice *s, int addr) { dprintf(\"husb: ctrl set addr %u\\n\", addr); s->dev.addr = addr; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295364, "input": "SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, int, flags) { return do_linkat(olddfd, oldname, newdfd, newname, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 349463, "input": "p11_rpc_mechanism_is_supported (CK_MECHANISM_TYPE mech) { if (mechanism_has_no_parameters (mech) || mechanism_has_sane_parameters (mech)) return true; return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519171, "input": "Decoder* decoder_for(const String& a_encoding) { auto encoding = get_standardized_encoding(a_encoding); if (encoding.equals_ignoring_case(\"windows-1252\")) return &latin1_decoder(); if (encoding.equals_ignoring_case(\"utf-8\")) return &utf8_decoder(); if (encoding.equals_ignoring_case(\"utf-16be\")) return &utf16be_decoder(); if (encoding.equals_ignoring_case(\"iso-8859-2\")) return &latin2_decoder(); dbgln(\"TextCodec: No decoder implemented for encoding '{}'\", a_encoding); return nullptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 414550, "input": "sdhtml_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options, unsigned int render_flags) { static const struct sd_callbacks cb_default = { rndr_blockcode, rndr_blockquote, rndr_raw_block, rndr_header, rndr_hrule, rndr_list, rndr_listitem, rndr_paragraph, rndr_table, rndr_tablerow, rndr_tablecell, rndr_footnotes, rndr_footnote_def, rndr_autolink, rndr_codespan, rndr_double_emphasis, rndr_emphasis, rndr_underline, rndr_highlight, rndr_quote, rndr_image, rndr_linebreak, rndr_link, rndr_raw_html, rndr_triple_emphasis, rndr_strikethrough, rndr_superscript, rndr_footnote_ref, NULL, rndr_normal_text, NULL, NULL, }; /* Prepare the options pointer */ memset(options, 0x0, sizeof(struct html_renderopt)); options->flags = render_flags; options->toc_data.nesting_bounds[0] = 1; options->toc_data.nesting_bounds[1] = 6; /* Prepare the callbacks */ memcpy(callbacks, &cb_default, sizeof(struct sd_callbacks)); if (render_flags & HTML_SKIP_IMAGES) callbacks->image = NULL; if (render_flags & HTML_SKIP_LINKS) { callbacks->link = NULL; callbacks->autolink = NULL; } if (render_flags & HTML_SKIP_HTML || render_flags & HTML_ESCAPE) callbacks->blockhtml = NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219098, "input": "void beginFrame(const char *symbol) override { VMRegAnchor _; ActRec *ar = vmfp(); Frame f(symbol); if (ar->func()->cls() && ar->hasThis()) { auto& memo = m_memos[symbol]; if (!memo.m_ignore) { ARRPROV_USE_RUNTIME_LOCATION(); auto args = hhvm_get_frame_args(ar); args.append((int64_t)(ar->getThis())); // Use the pointer not the obj VariableSerializer vs(VariableSerializer::Type::DebuggerSerialize); String sdata; try { sdata = vs.serialize(VarNR{args}, true); f.m_args = sdata; } catch (...) { fprintf(stderr, \"Args Serialization failure: %s\\n\", symbol); } } } m_stack.push_back(f); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373759, "input": "ShutdownWorkers(qqueue_t *pThis) { DEFiRet; ISOBJ_TYPE_assert(pThis, qqueue); ASSERT(pThis->pqParent == NULL); /* detect invalid calling sequence */ DBGOPRINT((obj_t*) pThis, \"initiating worker thread shutdown sequence\\n\"); CHKiRet(tryShutdownWorkersWithinQueueTimeout(pThis)); if(getPhysicalQueueSize(pThis) > 0) { CHKiRet(tryShutdownWorkersWithinActionTimeout(pThis)); } CHKiRet(cancelWorkers(pThis)); /* ... finally ... all worker threads have terminated :-) * Well, more precisely, they *are in termination*. Some cancel cleanup handlers * may still be running. Note that the main queue's DA worker may still be running. */ DBGOPRINT((obj_t*) pThis, \"worker threads terminated, remaining queue size log %d, phys %d.\\n\", getLogicalQueueSize(pThis), getPhysicalQueueSize(pThis)); finalize_it: RETiRet; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378594, "input": "int sqlite3VdbeHalt(Vdbe *p){ int rc; /* Used to store transient return codes */ sqlite3 *db = p->db; /* This function contains the logic that determines if a statement or ** transaction will be committed or rolled back as a result of the ** execution of this virtual machine. ** ** If any of the following errors occur: ** ** SQLITE_NOMEM ** SQLITE_IOERR ** SQLITE_FULL ** SQLITE_INTERRUPT ** ** Then the internal cache might have been left in an inconsistent ** state. We need to rollback the statement transaction, if there is ** one, or the complete transaction if there is no statement transaction. */ if( p->magic!=VDBE_MAGIC_RUN ){ return SQLITE_OK; } if( db->mallocFailed ){ p->rc = SQLITE_NOMEM_BKPT; } closeAllCursors(p); checkActiveVdbeCnt(db); /* No commit or rollback needed if the program never started or if the ** SQL statement does not read or write a database file. */ if( p->pc>=0 && p->bIsReader ){ int mrc; /* Primary error code from p->rc */ int eStatementOp = 0; int isSpecialError; /* Set to true if a 'special' error */ /* Lock all btrees used by the statement */ sqlite3VdbeEnter(p); /* Check for one of the special errors */ mrc = p->rc & 0xff; isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL; if( isSpecialError ){ /* If the query was read-only and the error code is SQLITE_INTERRUPT, ** no rollback is necessary. Otherwise, at least a savepoint ** transaction must be rolled back to restore the database to a ** consistent state. ** ** Even if the statement is read-only, it is important to perform ** a statement or transaction rollback operation. If the error ** occurred while writing to the journal, sub-journal or database ** file as part of an effort to free up cache space (see function ** pagerStress() in pager.c), the rollback is required to restore ** the pager to a consistent state. */ if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){ if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){ eStatementOp = SAVEPOINT_ROLLBACK; }else{ /* We are forced to roll back the active transaction. Before doing ** so, abort any other statements this handle currently has active. */ sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); sqlite3CloseSavepoints(db); db->autoCommit = 1; p->nChange = 0; } } } /* Check for immediate foreign key violations. */ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ sqlite3VdbeCheckFk(p, 0); } /* If the auto-commit flag is set and this is the only active writer ** VM, then we do either a commit or rollback of the current transaction. ** ** Note: This block also runs if one of the special errors handled ** above has occurred. */ if( !sqlite3VtabInSync(db) && db->autoCommit && db->nVdbeWrite==(p->readOnly==0) ){ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ rc = sqlite3VdbeCheckFk(p, 1); if( rc!=SQLITE_OK ){ if( NEVER(p->readOnly) ){ sqlite3VdbeLeave(p); return SQLITE_ERROR; } rc = SQLITE_CONSTRAINT_FOREIGNKEY; }else{ /* The auto-commit flag is true, the vdbe program was successful ** or hit an 'OR FAIL' constraint and there are no deferred foreign ** key constraints to hold up the transaction. This means a commit ** is required. */ rc = vdbeCommit(db, p); } if( rc==SQLITE_BUSY && p->readOnly ){ sqlite3VdbeLeave(p); return SQLITE_BUSY; }else if( rc!=SQLITE_OK ){ p->rc = rc; sqlite3RollbackAll(db, SQLITE_OK); p->nChange = 0; }else{ db->nDeferredCons = 0; db->nDeferredImmCons = 0; db->flags &= ~(u64)SQLITE_DeferFKs; sqlite3CommitInternalChanges(db); } }else{ sqlite3RollbackAll(db, SQLITE_OK); p->nChange = 0; } db->nStatement = 0; }else if( eStatementOp==0 ){ if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){ eStatementOp = SAVEPOINT_RELEASE; }else if( p->errorAction==OE_Abort ){ eStatementOp = SAVEPOINT_ROLLBACK; }else{ sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); sqlite3CloseSavepoints(db); db->autoCommit = 1; p->nChange = 0; } } /* If eStatementOp is non-zero, then a statement transaction needs to ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to ** do so. If this operation returns an error, and the current statement ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the ** current statement error code. */ if( eStatementOp ){ rc = sqlite3VdbeCloseStatement(p, eStatementOp); if( rc ){ if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){ p->rc = rc; sqlite3DbFree(db, p->zErrMsg); p->zErrMsg = 0; } sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); sqlite3CloseSavepoints(db); db->autoCommit = 1; p->nChange = 0; } } /* If this was an INSERT, UPDATE or DELETE and no statement transaction ** has been rolled back, update the database connection change-counter. */ if( p->changeCntOn ){ if( eStatementOp!=SAVEPOINT_ROLLBACK ){ sqlite3VdbeSetChanges(db, p->nChange); }else{ sqlite3VdbeSetChanges(db, 0); } p->nChange = 0; } /* Release the locks */ sqlite3VdbeLeave(p); } /* We have successfully halted and closed the VM. Record this fact. */ if( p->pc>=0 ){ db->nVdbeActive--; if( !p->readOnly ) db->nVdbeWrite--; if( p->bIsReader ) db->nVdbeRead--; assert( db->nVdbeActive>=db->nVdbeRead ); assert( db->nVdbeRead>=db->nVdbeWrite ); assert( db->nVdbeWrite>=0 ); } p->magic = VDBE_MAGIC_HALT; checkActiveVdbeCnt(db); if( db->mallocFailed ){ p->rc = SQLITE_NOMEM_BKPT; } /* If the auto-commit flag is set to true, then any locks that were held ** by connection db have now been released. Call sqlite3ConnectionUnlocked() ** to invoke any required unlock-notify callbacks. */ if( db->autoCommit ){ sqlite3ConnectionUnlocked(db); } assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 ); return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346333, "input": "evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len, struct evbuffer_ptr *start_at, struct evbuffer_iovec *vec, int n_vec) { struct evbuffer_chain *chain; int idx = 0; ev_ssize_t len_so_far = 0; EVBUFFER_LOCK(buffer); if (start_at) { chain = start_at->_internal.chain; len_so_far = chain->off - start_at->_internal.pos_in_chain; idx = 1; if (n_vec > 0) { vec[0].iov_base = chain->buffer + chain->misalign + start_at->_internal.pos_in_chain; vec[0].iov_len = len_so_far; } chain = chain->next; } else { chain = buffer->first; } if (n_vec == 0 && len < 0) { /* If no vectors are provided and they asked for \"everything\", * pretend they asked for the actual available amount. */ len = buffer->total_len; if (start_at) { len -= start_at->pos; } } while (chain) { if (len >= 0 && len_so_far >= len) break; if (idxbuffer + chain->misalign; vec[idx].iov_len = chain->off; } else if (len<0) { break; } ++idx; len_so_far += chain->off; chain = chain->next; } EVBUFFER_UNLOCK(buffer); return idx; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429703, "input": "mysql_get_server_name(MYSQL *mysql) { if (mysql->options.extension && mysql->options.extension->db_driver != NULL) return mysql->options.extension->db_driver->name; return mariadb_connection(mysql) ? \"MariaDB\" : \"MySQL\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 302856, "input": "xmlParseElementDecl(xmlParserCtxtPtr ctxt) { const xmlChar *name; int ret = -1; xmlElementContentPtr content = NULL; /* GROW; done in the caller */ if (CMP9(CUR_PTR, '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T')) { xmlParserInputPtr input = ctxt->input; SKIP(9); if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, \"Space required after 'ELEMENT'\\n\"); return(-1); } SKIP_BLANKS; name = xmlParseName(ctxt); if (name == NULL) { xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, \"xmlParseElementDecl: no name for Element\\n\"); return(-1); } while ((RAW == 0) && (ctxt->inputNr > 1)) xmlPopInput(ctxt); if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, \"Space required after the element name\\n\"); } SKIP_BLANKS; if (CMP5(CUR_PTR, 'E', 'M', 'P', 'T', 'Y')) { SKIP(5); /* * Element must always be empty. */ ret = XML_ELEMENT_TYPE_EMPTY; } else if ((RAW == 'A') && (NXT(1) == 'N') && (NXT(2) == 'Y')) { SKIP(3); /* * Element is a generic container. */ ret = XML_ELEMENT_TYPE_ANY; } else if (RAW == '(') { ret = xmlParseElementContentDecl(ctxt, name, &content); } else { /* * [ WFC: PEs in Internal Subset ] error handling. */ if ((RAW == '%') && (ctxt->external == 0) && (ctxt->inputNr == 1)) { xmlFatalErrMsg(ctxt, XML_ERR_PEREF_IN_INT_SUBSET, \"PEReference: forbidden within markup decl in internal subset\\n\"); } else { xmlFatalErrMsg(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, \"xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected\\n\"); } return(-1); } SKIP_BLANKS; /* * Pop-up of finished entities. */ while ((RAW == 0) && (ctxt->inputNr > 1)) xmlPopInput(ctxt); SKIP_BLANKS; if (RAW != '>') { xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL); if (content != NULL) { xmlFreeDocElementContent(ctxt->myDoc, content); } } else { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, \"Element declaration doesn't start and stop in the same entity\\n\"); } NEXT; if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->elementDecl != NULL)) { if (content != NULL) content->parent = NULL; ctxt->sax->elementDecl(ctxt->userData, name, ret, content); if ((content != NULL) && (content->parent == NULL)) { /* * this is a trick: if xmlAddElementDecl is called, * instead of copying the full tree it is plugged directly * if called from the parser. Avoid duplicating the * interfaces or change the API/ABI */ xmlFreeDocElementContent(ctxt->myDoc, content); } } else if (content != NULL) { xmlFreeDocElementContent(ctxt->myDoc, content); } } } return(ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338592, "input": "static bool io_wait_rsrc_data(struct io_rsrc_data *data) { if (!data) return false; if (!atomic_dec_and_test(&data->refs)) wait_for_completion(&data->done); return true;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354767, "input": "static inline bool vcpu_valid_wakeup(struct kvm_vcpu *vcpu) { return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431991, "input": "static void hci_cc_write_page_scan_type(struct hci_dev *hdev, struct sk_buff *skb) { u8 status = *((u8 *) skb->data); u8 *type; BT_DBG(\"%s status 0x%2.2x\", hdev->name, status); if (status) return; type = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_TYPE); if (type) hdev->page_scan_type = *type; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410741, "input": "static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) { tp->snd_wl1 = seq; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385303, "input": "static int __init load_umd(void) { int err; err = umd_load_blob(&umd_ops.info, &bpf_preload_umd_start, &bpf_preload_umd_end - &bpf_preload_umd_start); if (err) return err; bpf_preload_ops = &umd_ops; return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378607, "input": "void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){ sqlite3VdbeGetOp(p,addr)->p2 = val; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 124818, "input": "void AudioContext::markAudioNodeOutputDirty(AudioNodeOutput* output) { ASSERT(isGraphOwner()); ASSERT(isMainThread()); m_dirtyAudioNodeOutputs.add(output); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246856, "input": "GF_EXPORT u32 gf_isom_get_fragments_count(GF_ISOFile *movie, Bool segments_only) { u32 i=0; u32 nb_frags = 0; GF_Box *b; while ((b=(GF_Box*)gf_list_enum(movie->TopBoxes, &i))) { if (segments_only) { if (b->type==GF_ISOM_BOX_TYPE_SIDX) nb_frags++; } else { if (b->type==GF_ISOM_BOX_TYPE_MOOF) nb_frags++; } } return nb_frags;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263472, "input": "int FromkLinuxSocketType(int input) { int kLinux_sock_type = input; int output = 0; if (kLinux_sock_type & kLinux_SOCK_NONBLOCK) { output |= SOCK_NONBLOCK; kLinux_sock_type &= ~kLinux_SOCK_NONBLOCK; } if (kLinux_sock_type & kLinux_SOCK_CLOEXEC) { output |= SOCK_CLOEXEC; kLinux_sock_type &= ~kLinux_SOCK_CLOEXEC; } if (!kLinux_sock_type) { // Only kLinux_SOCK_CLOEXEC or kLinux_SOCK_NONBLOCK // are present. return output; } switch (kLinux_sock_type) { case kLinux_SOCK_STREAM: output |= SOCK_STREAM; break; case kLinux_SOCK_DGRAM: output |= SOCK_DGRAM; break; case kLinux_SOCK_SEQPACKET: output |= SOCK_SEQPACKET; break; case kLinux_SOCK_RAW: output |= SOCK_RAW; break; case kLinux_SOCK_RDM: output |= SOCK_RDM; break; case kLinux_SOCK_PACKET: output |= SOCK_PACKET; break; default: output = -1; // Unsupported } return output; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370100, "input": "ExpressionMeta::ExpressionMeta(ExpressionContext* const expCtx, MetaType metaType) : Expression(expCtx), _metaType(metaType) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 500014, "input": "int acpi_register_gsi(u32 gsi, int triggering, int polarity) { unsigned int irq; unsigned int plat_gsi = gsi; #ifdef CONFIG_PCI /* * Make sure all (legacy) PCI IRQs are set as level-triggered. */ if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { extern void eisa_set_level_irq(unsigned int irq); if (triggering == ACPI_LEVEL_SENSITIVE) eisa_set_level_irq(gsi); } #endif #ifdef CONFIG_X86_IO_APIC if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { plat_gsi = mp_register_gsi(gsi, triggering, polarity); } #endif acpi_gsi_to_irq(plat_gsi, &irq); return irq; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430278, "input": "virSecuritySELinuxRestoreTPMLabels(virSecurityManager *mgr, virDomainDef *def) { int ret = 0; size_t i; for (i = 0; i < def->ntpms; i++) { if (def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR) continue; ret = virSecuritySELinuxRestoreFileLabels( mgr, def->tpms[i]->data.emulator.storagepath); if (ret == 0 && def->tpms[i]->data.emulator.logfile) ret = virSecuritySELinuxRestoreFileLabels( mgr, def->tpms[i]->data.emulator.logfile); } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393205, "input": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCoveredIxscanIfEnabled) { params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS; addIndex(BSON(\"a\" << 1)); runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\")); assertNumSolutions(1); assertSolutionExists( \"{proj: {spec: {_id: 0, a: 1}, node: \" \"{ixscan: {filter: null, pattern: {a: 1},\" \"bounds: {a: [['MinKey', 'MaxKey', true, true]]}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237578, "input": "static GF_Err process_extractor(GF_ISOFile *file, GF_MediaBox *mdia, u32 sampleNumber, u64 sampleDTS, u32 nal_size, u16 nal_hdr, u32 nal_unit_size_field, Bool is_hevc, Bool rewrite_ps, Bool rewrite_start_codes, u32 extractor_mode) { GF_Err e; u32 di, ref_track_index, ref_track_num, data_offset, data_length, cur_extract_mode, ref_extract_mode, ref_nalu_size, nb_bytes_nalh; GF_TrackReferenceTypeBox *dpnd; GF_TrackBox *ref_trak; s8 sample_offset; u32 last_byte, ref_sample_num, prev_ref_sample_num; Bool header_written = GF_FALSE; nb_bytes_nalh = is_hevc ? 2 : 1; switch (extractor_mode) { case 0: last_byte = (u32) gf_bs_get_position(mdia->nalu_parser) + nal_size - (is_hevc ? 2 : 1); if (!is_hevc) gf_bs_read_int(mdia->nalu_parser, 24); //1 byte for HEVC , 3 bytes for AVC of NALUHeader in extractor while (gf_bs_get_position(mdia->nalu_parser) < last_byte) { u32 xmode = 0; //hevc extractors use constructors if (is_hevc) xmode = gf_bs_read_u8(mdia->nalu_parser); if (xmode) { u8 done=0, len = gf_bs_read_u8(mdia->nalu_parser); while (donenalu_parser); done++; if (header_written) { gf_bs_write_u8(mdia->nalu_out_bs, c); } else if (done==nal_unit_size_field) { if (rewrite_start_codes) { gf_bs_write_int(mdia->nalu_out_bs, 1, 32); } else { gf_bs_write_u8(mdia->nalu_out_bs, c); } header_written = GF_TRUE; } else if (!rewrite_start_codes) { gf_bs_write_u8(mdia->nalu_out_bs, c); } } continue; } ref_track_index = gf_bs_read_u8(mdia->nalu_parser); sample_offset = (s8) gf_bs_read_int(mdia->nalu_parser, 8); data_offset = gf_bs_read_int(mdia->nalu_parser, nal_unit_size_field*8); data_length = gf_bs_read_int(mdia->nalu_parser, nal_unit_size_field*8); Track_FindRef(mdia->mediaTrack, GF_ISOM_REF_SCAL, &dpnd); ref_track_num = 0; if (dpnd && ref_track_index && (ref_track_index<=dpnd->trackIDCount)) ref_track_num = gf_isom_get_track_by_id(file, dpnd->trackIDs[ref_track_index-1]); if (!ref_track_num) { GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, (\"ISOBMF: Extractor target track is not present in file - skipping.\\n\")); return GF_OK; } cur_extract_mode = gf_isom_get_nalu_extract_mode(file, ref_track_num); //we must be in inspect mode only otherwise the reference sample will not be the one stored on file (change in start codes, PS inserted or other NALUs inserted) //and this will corrupt extraction (wrong data offsets) ref_extract_mode = GF_ISOM_NALU_EXTRACT_INSPECT; gf_isom_set_nalu_extract_mode(file, ref_track_num, ref_extract_mode); ref_trak = gf_isom_get_track_from_file(file, ref_track_num); if (!ref_trak) return GF_ISOM_INVALID_FILE; if (!mdia->extracted_samp) { mdia->extracted_samp = gf_isom_sample_new(); if (!mdia->extracted_samp) return GF_IO_ERR; } if (!mdia->extracted_bs) { mdia->extracted_bs = gf_bs_new(\"a\", 1, GF_BITSTREAM_READ); if (!mdia->extracted_bs) return GF_IO_ERR; } e = stbl_findEntryForTime(ref_trak->Media->information->sampleTable, sampleDTS, 0, &ref_sample_num, &prev_ref_sample_num); if (e) return e; if (!ref_sample_num) ref_sample_num = prev_ref_sample_num; if (!ref_sample_num) return GF_ISOM_INVALID_FILE; if ((sample_offset<0) && (ref_sample_num > (u32) -sample_offset)) return GF_ISOM_INVALID_FILE; ref_sample_num = (u32) ( (s32) ref_sample_num + sample_offset); e = Media_GetSample(ref_trak->Media, ref_sample_num, &mdia->extracted_samp, &di, GF_FALSE, NULL); if (e) return e; if (!mdia->extracted_samp->alloc_size) mdia->extracted_samp->alloc_size = mdia->extracted_samp->dataLength; #if 0 if (!header_written && rewrite_start_codes) { gf_bs_write_int(dst_bs, 1, 32); if (is_hevc) { gf_bs_write_int(dst_bs, 0, 1); gf_bs_write_int(dst_bs, GF_HEVC_NALU_ACCESS_UNIT, 6); gf_bs_write_int(dst_bs, 0, 9); /*pic-type - by default we signal all slice types possible*/ gf_bs_write_int(dst_bs, 2, 3); gf_bs_write_int(dst_bs, 0, 5); } else { gf_bs_write_int(dst_bs, (ref_samp->data[0] & 0x60) | GF_AVC_NALU_ACCESS_UNIT, 8); gf_bs_write_int(dst_bs, 0xF0 , 8); /*7 \"all supported NALUs\" (=111) + rbsp trailing (10000)*/; } } #endif gf_bs_reassign_buffer(mdia->extracted_bs, mdia->extracted_samp->data + data_offset, mdia->extracted_samp->dataLength - data_offset); if (mdia->extracted_samp->dataLength - data_offset >= data_length) { while (data_length && gf_bs_available(mdia->extracted_bs)) { if (!header_written) { ref_nalu_size = gf_bs_read_int(mdia->extracted_bs, 8*nal_unit_size_field); assert(data_length>nal_unit_size_field); data_length -= nal_unit_size_field; if (data_length > gf_bs_available(mdia->extracted_bs)) { data_length = (u32)gf_bs_available(mdia->extracted_bs); } } else { ref_nalu_size = data_length; } if (ref_nalu_size > mdia->tmp_nal_copy_buffer_alloc) { mdia->tmp_nal_copy_buffer_alloc = ref_nalu_size; mdia->tmp_nal_copy_buffer = (char*) gf_realloc(mdia->tmp_nal_copy_buffer, sizeof(char) * ref_nalu_size ); } gf_bs_read_data(mdia->extracted_bs, mdia->tmp_nal_copy_buffer, ref_nalu_size); if (!header_written) { if (rewrite_start_codes) gf_bs_write_u32(mdia->nalu_out_bs, 1); else gf_bs_write_int(mdia->nalu_out_bs, ref_nalu_size, 8*nal_unit_size_field); } assert(data_length >= ref_nalu_size); gf_bs_write_data(mdia->nalu_out_bs, mdia->tmp_nal_copy_buffer, ref_nalu_size); data_length -= ref_nalu_size; header_written = GF_FALSE; } } else { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"ISOBMF: Extractor size is larger than referred sample size - skipping.\\n\")); } gf_isom_set_nalu_extract_mode(file, ref_track_num, cur_extract_mode); if (!is_hevc) break; } break; case 1: //skip to end of this NALU gf_bs_skip_bytes(mdia->nalu_parser, nal_size - nb_bytes_nalh); break; case 2: if (nal_size - nb_bytes_nalh > mdia->tmp_nal_copy_buffer_alloc) { mdia->tmp_nal_copy_buffer_alloc = nal_size - nb_bytes_nalh; mdia->tmp_nal_copy_buffer = (char*) gf_realloc(mdia->tmp_nal_copy_buffer, sizeof(char) * (nal_size - nb_bytes_nalh) ); } gf_bs_read_data(mdia->nalu_parser, mdia->tmp_nal_copy_buffer, nal_size - nb_bytes_nalh); if (rewrite_start_codes) gf_bs_write_u32(mdia->nalu_out_bs, 1); else gf_bs_write_int(mdia->nalu_out_bs, nal_size, 8*nal_unit_size_field); gf_bs_write_u8(mdia->nalu_out_bs, nal_hdr); gf_bs_write_data(mdia->nalu_out_bs, mdia->tmp_nal_copy_buffer, nal_size - nb_bytes_nalh); break; } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394267, "input": "static int ctnetlink_exp_dump_mask(struct sk_buff *skb, const struct nf_conntrack_tuple *tuple, const struct nf_conntrack_tuple_mask *mask) { const struct nf_conntrack_l4proto *l4proto; struct nf_conntrack_tuple m; struct nlattr *nest_parms; int ret; memset(&m, 0xFF, sizeof(m)); memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3)); m.src.u.all = mask->src.u.all; m.dst.protonum = tuple->dst.protonum; nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK); if (!nest_parms) goto nla_put_failure; rcu_read_lock(); ret = ctnetlink_dump_tuples_ip(skb, &m); if (ret >= 0) { l4proto = nf_ct_l4proto_find(tuple->dst.protonum); ret = ctnetlink_dump_tuples_proto(skb, &m, l4proto); } rcu_read_unlock(); if (unlikely(ret < 0)) goto nla_put_failure; nla_nest_end(skb, nest_parms); return 0; nla_put_failure: return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364103, "input": "static void xdp_clear_umem_at_qid(struct net_device *dev, u16 queue_id) { if (queue_id < dev->real_num_rx_queues) dev->_rx[queue_id].umem = NULL; if (queue_id < dev->real_num_tx_queues) dev->_tx[queue_id].umem = NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 488947, "input": "static int __init sbni_init(struct net_device *dev) { int i; if( dev->base_addr ) return sbni_isa_probe( dev ); /* otherwise we have to perform search our adapter */ if( io[ num ] != -1 ) dev->base_addr = io[ num ], dev->irq = irq[ num ]; else if( scandone || io[ 0 ] != -1 ) return -ENODEV; /* if io[ num ] contains non-zero address, then that is on ISA bus */ if( dev->base_addr ) return sbni_isa_probe( dev ); /* ...otherwise - scan PCI first */ if( !skip_pci_probe && !sbni_pci_probe( dev ) ) return 0; if( io[ num ] == -1 ) { /* Auto-scan will be stopped when first ISA card were found */ scandone = 1; if( num > 0 ) return -ENODEV; } for( i = 0; netcard_portlist[ i ]; ++i ) { int ioaddr = netcard_portlist[ i ]; if( request_region( ioaddr, SBNI_IO_EXTENT, dev->name ) && sbni_probe1( dev, ioaddr, 0 )) return 0; } return -ENODEV; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281285, "input": "void RGWPutCORS_ObjStore_S3::send_response() { if (op_ret) set_req_state_err(s, op_ret); dump_errno(s); end_header(s, NULL, \"application/xml\"); dump_start(s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 210165, "input": "PHP_FUNCTION(enchant_broker_request_dict) { zval *broker; enchant_broker *pbroker; enchant_dict *dict; EnchantDict *d; char *tag; int taglen; int pos; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rs\", &broker, &tag, &taglen) == FAILURE) { RETURN_FALSE; } PHP_ENCHANT_GET_BROKER; if (taglen == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, \"Tag cannot be empty\"); RETURN_FALSE; } d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag); if (d) { if (pbroker->dictcnt) { pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt); pos = pbroker->dictcnt++; } else { pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *)); pos = 0; pbroker->dictcnt++; } dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict)); dict->id = pos; dict->pbroker = pbroker; dict->pdict = d; dict->prev = pos ? pbroker->dict[pos-1] : NULL; dict->next = NULL; pbroker->dict[pos] = dict; if (pos) { pbroker->dict[pos-1]->next = dict; } dict->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict); zend_list_addref(pbroker->rsrc_id); } else { RETURN_FALSE; } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "Heap-based buffer overflow in the enchant_broker_request_dict function in ext/enchant/enchant.c in PHP before 5.4.38, 5.5.x before 5.5.22, and 5.6.x before 5.6.6 allows remote attackers to execute arbitrary code via vectors that trigger creation of multiple dictionaries.", "severity_level": "High", "cwe": "CWE-119", "cve": "CVE-2014-9705"}} -{"idx": 267192, "input": "GF_Err gf_isom_set_track_matrix(GF_ISOFile *the_file, u32 trackNumber, s32 matrix[9]) { GF_TrackBox *trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak || !trak->Header) return GF_BAD_PARAM; memcpy(trak->Header->matrix, matrix, sizeof(trak->Header->matrix)); return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 302812, "input": "sync_is_active(Slapi_Entry *e, Slapi_PBlock *pb) { if (pb == NULL) { /* not yet initialized */ return (0); } else { /* check id entry is in scope of sync request */ return (sync_is_active_scope(slapi_entry_get_sdn_const(e), pb)); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246173, "input": "void sqlite3SelectReset(Parse *pParse, Select *p){ if( ALWAYS(p) ){ clearSelect(pParse->db, p, 0); memset(&p->iLimit, 0, sizeof(Select) - offsetof(Select,iLimit)); p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(pParse->db,TK_NULL,0,0)); p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(SrcList)); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 216967, "input": "int setup_conds(THD *thd, TABLE_LIST *tables, List &leaves, COND **conds) { SELECT_LEX *select_lex= thd->lex->current_select; TABLE_LIST *table= NULL; // For HP compilers /* it_is_update set to TRUE when tables of primary SELECT_LEX (SELECT_LEX which belong to LEX, i.e. most up SELECT) will be updated by INSERT/UPDATE/LOAD NOTE: using this condition helps to prevent call of prepare_check_option() from subquery of VIEW, because tables of subquery belongs to VIEW (see condition before prepare_check_option() call) */ bool it_is_update= (select_lex == thd->lex->first_select_lex()) && thd->lex->which_check_option_applicable(); bool save_is_item_list_lookup= select_lex->is_item_list_lookup; TABLE_LIST *derived= select_lex->master_unit()->derived; DBUG_ENTER(\"setup_conds\"); select_lex->is_item_list_lookup= 0; thd->column_usage= MARK_COLUMNS_READ; DBUG_PRINT(\"info\", (\"thd->column_usage: %d\", thd->column_usage)); select_lex->cond_count= 0; select_lex->between_count= 0; select_lex->max_equal_elems= 0; for (table= tables; table; table= table->next_local) { if (select_lex == thd->lex->first_select_lex() && select_lex->first_cond_optimization && table->merged_for_insert && table->prepare_where(thd, conds, FALSE)) goto err_no_arena; } if (*conds) { thd->where=\"where clause\"; DBUG_EXECUTE(\"where\", print_where(*conds, \"WHERE in setup_conds\", QT_ORDINARY);); /* Wrap alone field in WHERE clause in case it will be outer field of subquery which need persistent pointer on it, but conds could be changed by optimizer */ if ((*conds)->type() == Item::FIELD_ITEM && !derived) wrap_ident(thd, conds); (*conds)->mark_as_condition_AND_part(NO_JOIN_NEST); if ((*conds)->fix_fields_if_needed_for_bool(thd, conds)) goto err_no_arena; } /* Apply fix_fields() to all ON clauses at all levels of nesting, including the ones inside view definitions. */ if (setup_on_expr(thd, tables, it_is_update)) goto err_no_arena; if (!thd->stmt_arena->is_conventional()) { /* We are in prepared statement preparation code => we should store WHERE clause changing for next executions. We do this ON -> WHERE transformation only once per PS/SP statement. */ select_lex->where= *conds; } thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; DBUG_RETURN(thd->is_error()); err_no_arena: select_lex->is_item_list_lookup= save_is_item_list_lookup; DBUG_RETURN(1); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "MariaDB Server v10.6.3 and below was discovered to contain an use-after-free in the component my_wildcmp_8bit_impl at /strings/ctype-simple.c.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2022-27455"}} -{"idx": 232580, "input": "static void mark_reg_unknown(struct bpf_verifier_env *env, struct bpf_reg_state *regs, u32 regno) { if (WARN_ON(regno >= MAX_BPF_REG)) { verbose(env, \"mark_reg_unknown(regs, %u)\\n\", regno); /* Something bad happened, let's kill all regs except FP */ for (regno = 0; regno < BPF_REG_FP; regno++) __mark_reg_not_init(env, regs + regno); return; } __mark_reg_unknown(env, regs + regno); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 222582, "input": "mrb_proc_init_copy(mrb_state *mrb, mrb_value self) { mrb_value proc = mrb_get_arg1(mrb); if (!mrb_proc_p(proc)) { mrb_raise(mrb, E_ARGUMENT_ERROR, \"not a proc\"); } mrb_proc_copy(mrb, mrb_proc_ptr(self), mrb_proc_ptr(proc)); return self; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 257471, "input": "static void define_macros_early(void) { const struct compile_time * const oct = &official_compile_time; char temp[128]; if (oct->have_local) { strftime(temp, sizeof temp, \"__DATE__=\\\"%Y-%m-%d\\\"\", &oct->local); preproc->pre_define(temp); strftime(temp, sizeof temp, \"__DATE_NUM__=%Y%m%d\", &oct->local); preproc->pre_define(temp); strftime(temp, sizeof temp, \"__TIME__=\\\"%H:%M:%S\\\"\", &oct->local); preproc->pre_define(temp); strftime(temp, sizeof temp, \"__TIME_NUM__=%H%M%S\", &oct->local); preproc->pre_define(temp); } if (oct->have_gm) { strftime(temp, sizeof temp, \"__UTC_DATE__=\\\"%Y-%m-%d\\\"\", &oct->gm); preproc->pre_define(temp); strftime(temp, sizeof temp, \"__UTC_DATE_NUM__=%Y%m%d\", &oct->gm); preproc->pre_define(temp); strftime(temp, sizeof temp, \"__UTC_TIME__=\\\"%H:%M:%S\\\"\", &oct->gm); preproc->pre_define(temp); strftime(temp, sizeof temp, \"__UTC_TIME_NUM__=%H%M%S\", &oct->gm); preproc->pre_define(temp); } if (oct->have_posix) { snprintf(temp, sizeof temp, \"__POSIX_TIME__=%\"PRId64, oct->posix); preproc->pre_define(temp); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509003, "input": "uint divisor_precision_increment() const { return decimals < NOT_FIXED_DEC ? decimals : is_temporal_type_with_time(field_type()) ? TIME_SECOND_PART_DIGITS : decimals; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 434224, "input": "static BOOL optimize_class_chars(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks) { /* May destroy TMP1. */ DEFINE_COMPILER; uint16_t char_list[MAX_CLASS_CHARS_SIZE]; uint8_t byte; sljit_s32 type; int i, j, k, len, c; if (!sljit_has_cpu_feature(SLJIT_HAS_CMOV)) return FALSE; len = 0; for (i = 0; i < 32; i++) { byte = bits[i]; if (nclass) byte = ~byte; j = 0; while (byte != 0) { if (byte & 0x1) { c = i * 8 + j; k = len; if ((c & 0x20) != 0) { for (k = 0; k < len; k++) if (char_list[k] == c - 0x20) { char_list[k] |= 0x120; break; } } if (k == len) { if (len >= MAX_CLASS_CHARS_SIZE) return FALSE; char_list[len++] = (uint16_t) c; } } byte >>= 1; j++; } } if (len == 0) return FALSE; /* Should never occur, but stops analyzers complaining. */ i = 0; j = 0; if (char_list[0] == 0) { i++; OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_ZERO); } else OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0); while (i < len) { if ((char_list[i] & 0x100) != 0) j++; else { OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char_list[i]); CMOV(SLJIT_ZERO, TMP2, TMP1, 0); } i++; } if (j != 0) { OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x20); for (i = 0; i < len; i++) if ((char_list[i] & 0x100) != 0) { j--; OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char_list[i] & 0xff); CMOV(SLJIT_ZERO, TMP2, TMP1, 0); } } if (invert) nclass = !nclass; type = nclass ? SLJIT_NOT_EQUAL : SLJIT_EQUAL; add_jump(compiler, backtracks, CMP(type, TMP2, 0, SLJIT_IMM, 0)); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197538, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& input = ctx->input(0); const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_); Tensor* output = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output)); Tensor num_bits_tensor; num_bits_tensor = ctx->input(3); int num_bits_val = num_bits_tensor.scalar()(); OP_REQUIRES( ctx, num_bits_val > 0 && num_bits_val < (signed_input_ ? 62 : 63), errors::InvalidArgument(\"num_bits is out of range: \", num_bits_val, \" with signed_input_ \", signed_input_)); Tensor input_min_tensor; Tensor input_max_tensor; if (range_given_) { input_min_tensor = ctx->input(1); input_max_tensor = ctx->input(2); if (axis_ == -1) { auto min_val = input_min_tensor.scalar()(); auto max_val = input_max_tensor.scalar()(); OP_REQUIRES(ctx, min_val <= max_val, errors::InvalidArgument(\"Invalid range: input_min \", min_val, \" > input_max \", max_val)); } else { OP_REQUIRES(ctx, input_min_tensor.dim_size(0) == depth, errors::InvalidArgument( \"input_min_tensor has incorrect size, was \", input_min_tensor.dim_size(0), \" expected \", depth, \" to match dim \", axis_, \" of the input \", input_min_tensor.shape())); OP_REQUIRES(ctx, input_max_tensor.dim_size(0) == depth, errors::InvalidArgument( \"input_max_tensor has incorrect size, was \", input_max_tensor.dim_size(0), \" expected \", depth, \" to match dim \", axis_, \" of the input \", input_max_tensor.shape())); } } else { auto range_shape = (axis_ == -1) ? TensorShape({}) : TensorShape({depth}); OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value, range_shape, &input_min_tensor)); OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum::value, range_shape, &input_max_tensor)); } if (axis_ == -1) { functor::QuantizeAndDequantizeOneScaleFunctor f; f(ctx->eigen_device(), input.flat(), signed_input_, num_bits_val, range_given_, &input_min_tensor, &input_max_tensor, ROUND_HALF_TO_EVEN, narrow_range_, output->flat()); } else { functor::QuantizeAndDequantizePerChannelFunctor f; f(ctx->eigen_device(), input.template flat_inner_outer_dims(axis_ - 1), signed_input_, num_bits_val, range_given_, &input_min_tensor, &input_max_tensor, ROUND_HALF_TO_EVEN, narrow_range_, output->template flat_inner_outer_dims(axis_ - 1)); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can read data outside of bounds of heap allocated buffer in `tf.raw_ops.QuantizeAndDequantizeV3`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/11ff7f80667e6490d7b5174aa6bf5e01886e770f/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L237) does not validate the value of user supplied `axis` attribute before using it to index in the array backing the `input` argument. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-29553"}} -{"idx": 519584, "input": "std::string PasswdMgr::getPasswdByUserName(const std::string& userName) { checkAndReload(); auto iter = passwdMapList.find(userName); if (iter == passwdMapList.end()) { return std::string(); } return iter->second; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268077, "input": "static int parse_exthdrs(struct sk_buff *skb, const struct sadb_msg *hdr, void **ext_hdrs) { const char *p = (char *) hdr; int len = skb->len; len -= sizeof(*hdr); p += sizeof(*hdr); while (len > 0) { const struct sadb_ext *ehdr = (const struct sadb_ext *) p; uint16_t ext_type; int ext_len; if (len < sizeof(*ehdr)) return -EINVAL; ext_len = ehdr->sadb_ext_len; ext_len *= sizeof(uint64_t); ext_type = ehdr->sadb_ext_type; if (ext_len < sizeof(uint64_t) || ext_len > len || ext_type == SADB_EXT_RESERVED) return -EINVAL; if (ext_type <= SADB_EXT_MAX) { int min = (int) sadb_ext_min_len[ext_type]; if (ext_len < min) return -EINVAL; if (ext_hdrs[ext_type-1] != NULL) return -EINVAL; switch (ext_type) { case SADB_EXT_ADDRESS_SRC: case SADB_EXT_ADDRESS_DST: case SADB_EXT_ADDRESS_PROXY: case SADB_X_EXT_NAT_T_OA: if (verify_address_len(p)) return -EINVAL; break; case SADB_X_EXT_SEC_CTX: if (verify_sec_ctx_len(p)) return -EINVAL; break; case SADB_EXT_KEY_AUTH: case SADB_EXT_KEY_ENCRYPT: if (verify_key_len(p)) return -EINVAL; break; default: break; } ext_hdrs[ext_type-1] = (void *) p; } p += ext_len; len -= ext_len; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 376840, "input": "static avifBool avifParse(avifDecoderData * data, const uint8_t * raw, size_t rawLen) { BEGIN_STREAM(s, raw, rawLen); while (avifROStreamHasBytesLeft(&s, 1)) { avifBoxHeader header; CHECK(avifROStreamReadBoxHeader(&s, &header)); if (!memcmp(header.type, \"ftyp\", 4)) { CHECK(avifParseFileTypeBox(&data->ftyp, avifROStreamCurrent(&s), header.size)); } else if (!memcmp(header.type, \"meta\", 4)) { CHECK(avifParseMetaBox(data->meta, avifROStreamCurrent(&s), header.size)); } else if (!memcmp(header.type, \"moov\", 4)) { CHECK(avifParseMoovBox(data, avifROStreamCurrent(&s), header.size)); } CHECK(avifROStreamSkip(&s, header.size)); } return AVIF_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432526, "input": "static __init int svm_hardware_setup(void) { int cpu; struct page *iopm_pages; void *iopm_va; int r; iopm_pages = alloc_pages(GFP_KERNEL, IOPM_ALLOC_ORDER); if (!iopm_pages) return -ENOMEM; iopm_va = page_address(iopm_pages); memset(iopm_va, 0xff, PAGE_SIZE * (1 << IOPM_ALLOC_ORDER)); iopm_base = page_to_pfn(iopm_pages) << PAGE_SHIFT; init_msrpm_offsets(); if (boot_cpu_has(X86_FEATURE_NX)) kvm_enable_efer_bits(EFER_NX); if (boot_cpu_has(X86_FEATURE_FXSR_OPT)) kvm_enable_efer_bits(EFER_FFXSR); if (boot_cpu_has(X86_FEATURE_TSCRATEMSR)) { kvm_has_tsc_control = true; kvm_max_tsc_scaling_ratio = TSC_RATIO_MAX; kvm_tsc_scaling_ratio_frac_bits = 32; } /* Check for pause filtering support */ if (!boot_cpu_has(X86_FEATURE_PAUSEFILTER)) { pause_filter_count = 0; pause_filter_thresh = 0; } else if (!boot_cpu_has(X86_FEATURE_PFTHRESHOLD)) { pause_filter_thresh = 0; } if (nested) { printk(KERN_INFO \"kvm: Nested Virtualization enabled\\n\"); kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE); } if (sev) { if (boot_cpu_has(X86_FEATURE_SEV) && IS_ENABLED(CONFIG_KVM_AMD_SEV)) { r = sev_hardware_setup(); if (r) sev = false; } else { sev = false; } } svm_adjust_mmio_mask(); for_each_possible_cpu(cpu) { r = svm_cpu_init(cpu); if (r) goto err; } if (!boot_cpu_has(X86_FEATURE_NPT)) npt_enabled = false; if (npt_enabled && !npt) { printk(KERN_INFO \"kvm: Nested Paging disabled\\n\"); npt_enabled = false; } if (npt_enabled) { printk(KERN_INFO \"kvm: Nested Paging enabled\\n\"); kvm_enable_tdp(); } else kvm_disable_tdp(); if (nrips) { if (!boot_cpu_has(X86_FEATURE_NRIPS)) nrips = false; } if (avic) { if (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC) || !IS_ENABLED(CONFIG_X86_LOCAL_APIC)) { avic = false; } else { pr_info(\"AVIC enabled\\n\"); amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier); } } if (vls) { if (!npt_enabled || !boot_cpu_has(X86_FEATURE_V_VMSAVE_VMLOAD) || !IS_ENABLED(CONFIG_X86_64)) { vls = false; } else { pr_info(\"Virtual VMLOAD VMSAVE supported\\n\"); } } if (vgif) { if (!boot_cpu_has(X86_FEATURE_VGIF)) vgif = false; else pr_info(\"Virtual GIF supported\\n\"); } return 0; err: __free_pages(iopm_pages, IOPM_ALLOC_ORDER); iopm_base = 0; return r; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453294, "input": "static void bfq_remove_request(struct request_queue *q, struct request *rq) { struct bfq_queue *bfqq = RQ_BFQQ(rq); struct bfq_data *bfqd = bfqq->bfqd; const int sync = rq_is_sync(rq); if (bfqq->next_rq == rq) { bfqq->next_rq = bfq_find_next_rq(bfqd, bfqq, rq); bfq_updated_next_req(bfqd, bfqq); } if (rq->queuelist.prev != &rq->queuelist) list_del_init(&rq->queuelist); bfqq->queued[sync]--; bfqd->queued--; elv_rb_del(&bfqq->sort_list, rq); elv_rqhash_del(q, rq); if (q->last_merge == rq) q->last_merge = NULL; if (RB_EMPTY_ROOT(&bfqq->sort_list)) { bfqq->next_rq = NULL; if (bfq_bfqq_busy(bfqq) && bfqq != bfqd->in_service_queue) { bfq_del_bfqq_busy(bfqd, bfqq, false); /* * bfqq emptied. In normal operation, when * bfqq is empty, bfqq->entity.service and * bfqq->entity.budget must contain, * respectively, the service received and the * budget used last time bfqq emptied. These * facts do not hold in this case, as at least * this last removal occurred while bfqq is * not in service. To avoid inconsistencies, * reset both bfqq->entity.service and * bfqq->entity.budget, if bfqq has still a * process that may issue I/O requests to it. */ bfqq->entity.budget = bfqq->entity.service = 0; } /* * Remove queue from request-position tree as it is empty. */ if (bfqq->pos_root) { rb_erase(&bfqq->pos_node, bfqq->pos_root); bfqq->pos_root = NULL; } } else { /* see comments on bfq_pos_tree_add_move() for the unlikely() */ if (unlikely(!bfqd->nonrot_with_queueing)) bfq_pos_tree_add_move(bfqd, bfqq); } if (rq->cmd_flags & REQ_META) bfqq->meta_pending--;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 311091, "input": "void my_reset_marker_reader(j_decompress_ptr dinfo) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 305346, "input": "static TPM_RESULT SWTPM_NVRAM_Lock_Lockfile(const char *directory, int *fd) { TPM_RESULT rc = 0; char *lockfile = NULL; struct flock flock = { .l_type = F_WRLCK, .l_whence = SEEK_SET, .l_start = 0, .l_len = 0, }; if (asprintf(&lockfile, \"%s/.lock\", directory) < 0) { logprintf(STDERR_FILENO, \"SWTPM_NVRAM_Lock_Lockfile: Could not asprintf lock filename\\n\"); return TPM_FAIL; } *fd = open(lockfile, O_WRONLY|O_CREAT|O_TRUNC|O_NOFOLLOW, 0660); if (*fd < 0) { logprintf(STDERR_FILENO, \"SWTPM_NVRAM_Lock_Lockfile: Could not open lockfile: %s\\n\", strerror(errno)); rc = TPM_FAIL; goto exit; } if (fcntl(*fd, F_SETLK, &flock) < 0) { logprintf(STDERR_FILENO, \"SWTPM_NVRAM_Lock_Lockfile: Could not lock access to lockfile: %s\\n\", strerror(errno)); rc = TPM_FAIL; close(*fd); *fd = -1; } exit: free(lockfile); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328382, "input": "static int nf_tables_getsetelem(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr * const nla[]) { struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_cur(info->net); struct net *net = info->net; struct nft_set *set; struct nlattr *attr; struct nft_ctx ctx; int rem, err = 0; err = nft_ctx_init_from_elemattr(&ctx, net, skb, info->nlh, nla, extack, genmask, NETLINK_CB(skb).portid); if (err < 0) return err; set = nft_set_lookup(ctx.table, nla[NFTA_SET_ELEM_LIST_SET], genmask); if (IS_ERR(set)) return PTR_ERR(set); if (info->nlh->nlmsg_flags & NLM_F_DUMP) { struct netlink_dump_control c = { .start = nf_tables_dump_set_start, .dump = nf_tables_dump_set, .done = nf_tables_dump_set_done, .module = THIS_MODULE, }; struct nft_set_dump_ctx dump_ctx = { .set = set, .ctx = ctx, }; c.data = &dump_ctx; return nft_netlink_dump_start_rcu(info->sk, skb, info->nlh, &c); } if (!nla[NFTA_SET_ELEM_LIST_ELEMENTS]) return -EINVAL; nla_for_each_nested(attr, nla[NFTA_SET_ELEM_LIST_ELEMENTS], rem) { err = nft_get_set_elem(&ctx, set, attr); if (err < 0) break; } return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357037, "input": "int imap_delete_mailbox(struct Mailbox *m, char *path) { char buf[PATH_MAX + 7]; char mbox[PATH_MAX]; struct Url *url = url_parse(path); struct ImapAccountData *adata = imap_adata_get(m); imap_munge_mbox_name(adata->unicode, mbox, sizeof(mbox), url->path); url_free(&url); snprintf(buf, sizeof(buf), \"DELETE %s\", mbox); if (imap_exec(m->account->adata, buf, IMAP_CMD_NO_FLAGS) != IMAP_EXEC_SUCCESS) return -1; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417808, "input": "static void SFDDumpEncoding(FILE *sfd,Encoding *encname,const char *keyword) { fprintf(sfd, \"%s: %s\\n\", keyword, encname->enc_name ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232057, "input": "int asylo_enclave_call(uint64_t selector, void *buffer) { SgxParams *const sgx_params = reinterpret_cast(buffer); if (!IsValidUntrustedAddress(sgx_params)) { PrimitiveStatus status{primitives::AbslStatusCode::kInvalidArgument, \"input should lie within untrusted memory.\"}; return status.error_code(); } const void *input = sgx_params->input; size_t input_size = sgx_params->input_size; size_t output_size = 0; MessageReader in; MessageWriter out; // Copy untrusted input to a trusted buffer before deserializing to prevent // TOC/TOU attacks. auto trusted_input = CopyFromUntrusted(input, input_size); if (trusted_input) { in.Deserialize(trusted_input.get(), input_size); } PrimitiveStatus status = InvokeEntryHandler(selector, &in, &out); // Serialize |out| to untrusted memory and pass that as output. The untrusted // caller is still responsible for freeing |*output|, which now points to // untrusted memory. output_size = out.MessageSize(); if (out.MessageSize() > 0) { // Serialize to a trusted output buffer first to prevent TOC/TOU attacks. std::unique_ptr trusted_output(new char[output_size]); out.Serialize(trusted_output.get()); sgx_params->output = CopyToUntrusted(trusted_output.get(), output_size); } sgx_params->output_size = static_cast(output_size); return status.error_code(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437653, "input": "static u64 svm_read_tsc_offset(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); return svm->vmcb->control.tsc_offset; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215300, "input": "isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) { isdn_net_dev *p = isdn_net_findif(cfg->name); ulong features; int i; int drvidx; int chidx; char drvid[25]; if (p) { isdn_net_local *lp = p->local; /* See if any registered driver supports the features we want */ features = ((1 << cfg->l2_proto) << ISDN_FEATURE_L2_SHIFT) | ((1 << cfg->l3_proto) << ISDN_FEATURE_L3_SHIFT); for (i = 0; i < ISDN_MAX_DRIVERS; i++) if (dev->drv[i]) if ((dev->drv[i]->interface->features & features) == features) break; if (i == ISDN_MAX_DRIVERS) { printk(KERN_WARNING \"isdn_net: No driver with selected features\\n\"); return -ENODEV; } if (lp->p_encap != cfg->p_encap){ #ifdef CONFIG_ISDN_X25 struct concap_proto * cprot = p -> cprot; #endif if (isdn_net_device_started(p)) { printk(KERN_WARNING \"%s: cannot change encap when if is up\\n\", p->dev->name); return -EBUSY; } #ifdef CONFIG_ISDN_X25 if( cprot && cprot -> pops ) cprot -> pops -> proto_del ( cprot ); p -> cprot = NULL; lp -> dops = NULL; /* ... , prepare for configuration of new one ... */ switch ( cfg -> p_encap ){ case ISDN_NET_ENCAP_X25IFACE: lp -> dops = &isdn_concap_reliable_dl_dops; } /* ... and allocate new one ... */ p -> cprot = isdn_concap_new( cfg -> p_encap ); /* p -> cprot == NULL now if p_encap is not supported by means of the concap_proto mechanism */ /* the protocol is not configured yet; this will happen later when isdn_net_reset() is called */ #endif } switch ( cfg->p_encap ) { case ISDN_NET_ENCAP_SYNCPPP: #ifndef CONFIG_ISDN_PPP printk(KERN_WARNING \"%s: SyncPPP support not configured\\n\", p->dev->name); return -EINVAL; #else p->dev->type = ARPHRD_PPP; /* change ARP type */ p->dev->addr_len = 0; p->dev->do_ioctl = isdn_ppp_dev_ioctl; #endif break; case ISDN_NET_ENCAP_X25IFACE: #ifndef CONFIG_ISDN_X25 printk(KERN_WARNING \"%s: isdn-x25 support not configured\\n\", p->dev->name); return -EINVAL; #else p->dev->type = ARPHRD_X25; /* change ARP type */ p->dev->addr_len = 0; #endif break; case ISDN_NET_ENCAP_CISCOHDLCK: p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl; break; default: if( cfg->p_encap >= 0 && cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP ) break; printk(KERN_WARNING \"%s: encapsulation protocol %d not supported\\n\", p->dev->name, cfg->p_encap); return -EINVAL; } if (strlen(cfg->drvid)) { /* A bind has been requested ... */ char *c, *e; drvidx = -1; chidx = -1; strcpy(drvid, cfg->drvid); if ((c = strchr(drvid, ','))) { /* The channel-number is appended to the driver-Id with a comma */ chidx = (int) simple_strtoul(c + 1, &e, 10); if (e == c) chidx = -1; *c = '\\0'; } for (i = 0; i < ISDN_MAX_DRIVERS; i++) /* Lookup driver-Id in array */ if (!(strcmp(dev->drvid[i], drvid))) { drvidx = i; break; } if ((drvidx == -1) || (chidx == -1)) /* Either driver-Id or channel-number invalid */ return -ENODEV; } else { /* Parameters are valid, so get them */ drvidx = lp->pre_device; chidx = lp->pre_channel; } if (cfg->exclusive > 0) { unsigned long flags; /* If binding is exclusive, try to grab the channel */ spin_lock_irqsave(&dev->lock, flags); if ((i = isdn_get_free_channel(ISDN_USAGE_NET, lp->l2_proto, lp->l3_proto, drvidx, chidx, lp->msn)) < 0) { /* Grab failed, because desired channel is in use */ lp->exclusive = -1; spin_unlock_irqrestore(&dev->lock, flags); return -EBUSY; } /* All went ok, so update isdninfo */ dev->usage[i] = ISDN_USAGE_EXCLUSIVE; isdn_info_update(); spin_unlock_irqrestore(&dev->lock, flags); lp->exclusive = i; } else { /* Non-exclusive binding or unbind. */ lp->exclusive = -1; if ((lp->pre_device != -1) && (cfg->exclusive == -1)) { isdn_unexclusive_channel(lp->pre_device, lp->pre_channel); isdn_free_channel(lp->pre_device, lp->pre_channel, ISDN_USAGE_NET); drvidx = -1; chidx = -1; } } strcpy(lp->msn, cfg->eaz); lp->pre_device = drvidx; lp->pre_channel = chidx; lp->onhtime = cfg->onhtime; lp->charge = cfg->charge; lp->l2_proto = cfg->l2_proto; lp->l3_proto = cfg->l3_proto; lp->cbdelay = cfg->cbdelay; lp->dialmax = cfg->dialmax; lp->triggercps = cfg->triggercps; lp->slavedelay = cfg->slavedelay * HZ; lp->pppbind = cfg->pppbind; lp->dialtimeout = cfg->dialtimeout >= 0 ? cfg->dialtimeout * HZ : -1; lp->dialwait = cfg->dialwait * HZ; if (cfg->secure) lp->flags |= ISDN_NET_SECURE; else lp->flags &= ~ISDN_NET_SECURE; if (cfg->cbhup) lp->flags |= ISDN_NET_CBHUP; else lp->flags &= ~ISDN_NET_CBHUP; switch (cfg->callback) { case 0: lp->flags &= ~(ISDN_NET_CALLBACK | ISDN_NET_CBOUT); break; case 1: lp->flags |= ISDN_NET_CALLBACK; lp->flags &= ~ISDN_NET_CBOUT; break; case 2: lp->flags |= ISDN_NET_CBOUT; lp->flags &= ~ISDN_NET_CALLBACK; break; } lp->flags &= ~ISDN_NET_DIALMODE_MASK; /* first all bits off */ if (cfg->dialmode && !(cfg->dialmode & ISDN_NET_DIALMODE_MASK)) { /* old isdnctrl version, where only 0 or 1 is given */ printk(KERN_WARNING \"Old isdnctrl version detected! Please update.\\n\"); lp->flags |= ISDN_NET_DM_OFF; /* turn on `off' bit */ } else { lp->flags |= cfg->dialmode; /* turn on selected bits */ } if (cfg->chargehup) lp->hupflags |= ISDN_CHARGEHUP; else lp->hupflags &= ~ISDN_CHARGEHUP; if (cfg->ihup) lp->hupflags |= ISDN_INHUP; else lp->hupflags &= ~ISDN_INHUP; if (cfg->chargeint > 10) { lp->hupflags |= ISDN_CHARGEHUP | ISDN_HAVECHARGE | ISDN_MANCHARGE; lp->chargeint = cfg->chargeint * HZ; } if (cfg->p_encap != lp->p_encap) { if (cfg->p_encap == ISDN_NET_ENCAP_RAWIP) { p->dev->header_ops = NULL; p->dev->flags = IFF_NOARP|IFF_POINTOPOINT; } else { p->dev->header_ops = &isdn_header_ops; if (cfg->p_encap == ISDN_NET_ENCAP_ETHER) p->dev->flags = IFF_BROADCAST | IFF_MULTICAST; else p->dev->flags = IFF_NOARP|IFF_POINTOPOINT; } } lp->p_encap = cfg->p_encap; return 0; } return -ENODEV; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "Buffer overflow in the isdn_net_setcfg function in isdn_net.c in Linux kernel 2.6.23 allows local users to have an unknown impact via a crafted argument to the isdn_ioctl function.", "severity_level": "Medium", "cwe": "CWE-119", "cve": "CVE-2007-6063"}} -{"idx": 268041, "input": "static int pfkey_do_dump(struct pfkey_sock *pfk) { struct sadb_msg *hdr; int rc; mutex_lock(&pfk->dump_lock); if (!pfk->dump.dump) { rc = 0; goto out; } rc = pfk->dump.dump(pfk); if (rc == -ENOBUFS) { rc = 0; goto out; } if (pfk->dump.skb) { if (!pfkey_can_dump(&pfk->sk)) { rc = 0; goto out; } hdr = (struct sadb_msg *) pfk->dump.skb->data; hdr->sadb_msg_seq = 0; hdr->sadb_msg_errno = rc; pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, &pfk->sk, sock_net(&pfk->sk)); pfk->dump.skb = NULL; } pfkey_terminate_dump(pfk); out: mutex_unlock(&pfk->dump_lock); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393290, "input": "TEST_F(QueryPlannerTest, ContainedOrMoveToNot) { addIndex(BSON(\"b\" << 1 << \"a\" << 1)); addIndex(BSON(\"c\" << 1 << \"a\" << 1)); runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$nor: [{b: 6}]}, {c: 7}]}]}\")); assertNumSolutions(2); assertSolutionExists( \"{fetch: {filter: null, node: {or: {nodes: [\" \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [['MinKey', 6, true, false], [6, 'MaxKey', \" \"false, true]], a: [[5, 5, true, true]]}}},\" \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \" \"true]]}}}\" \"]}}}}\"); assertSolutionExists(\"{cscan: {dir: 1}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 241036, "input": "bool WindowsServiceControl::install( const QString& filePath, const QString& displayName ) { const auto binaryPath = QStringLiteral(\"\\\"%1\\\"\").arg( QString( filePath ).replace( QLatin1Char('\"'), QString() ) ); m_serviceHandle = CreateService( m_serviceManager, // SCManager database WindowsCoreFunctions::toConstWCharArray( m_name ), // name of service WindowsCoreFunctions::toConstWCharArray( displayName ),// name to display SERVICE_ALL_ACCESS, // desired access SERVICE_WIN32_OWN_PROCESS, // service type SERVICE_AUTO_START, // start type SERVICE_ERROR_NORMAL, // error control type WindowsCoreFunctions::toConstWCharArray( binaryPath ), // service's binary nullptr, // no load ordering group nullptr, // no tag identifier L\"Tcpip\\0RpcSs\\0\\0\", // dependencies nullptr, // LocalSystem account nullptr ); // no password if( m_serviceHandle == nullptr ) { const auto error = GetLastError(); if( error == ERROR_SERVICE_EXISTS ) { vCritical() << qUtf8Printable( tr( \"The service \\\"%1\\\" is already installed.\" ).arg( m_name ) ); } else { vCritical() << qUtf8Printable( tr( \"The service \\\"%1\\\" could not be installed.\" ).arg( m_name ) ); } return false; } SC_ACTION serviceActions; serviceActions.Delay = 10000; serviceActions.Type = SC_ACTION_RESTART; SERVICE_FAILURE_ACTIONS serviceFailureActions; serviceFailureActions.dwResetPeriod = 0; serviceFailureActions.lpRebootMsg = nullptr; serviceFailureActions.lpCommand = nullptr; serviceFailureActions.lpsaActions = &serviceActions; serviceFailureActions.cActions = 1; ChangeServiceConfig2( m_serviceHandle, SERVICE_CONFIG_FAILURE_ACTIONS, &serviceFailureActions ); // Everything went fine vInfo() << qUtf8Printable( tr( \"The service \\\"%1\\\" has been installed successfully.\" ).arg( m_name ) ); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 454781, "input": "wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx, const void* msg, size_t msg_len, const wsrep_gtid_t* current_gtid, const char* state, size_t state_len, bool bypass) { const char* method = (char*)msg; size_t method_len = strlen (method); if (check_request_str(method, filename_char)) { WSREP_ERROR(\"Bad SST method name. SST canceled.\"); return WSREP_CB_FAILURE; } const char* data = method + method_len + 1; if (check_request_str(data, address_char)) { WSREP_ERROR(\"Bad SST address string. SST canceled.\"); return WSREP_CB_FAILURE; } char uuid_str[37]; wsrep_uuid_print (¤t_gtid->uuid, uuid_str, sizeof(uuid_str)); /* This will be reset when sync callback is called. * Should we set wsrep_ready to FALSE here too? */ local_status.set(WSREP_MEMBER_DONOR); wsp::env env(NULL); if (env.error()) { WSREP_ERROR(\"wsrep_sst_donate_cb(): env var ctor failed: %d\", -env.error()); return WSREP_CB_FAILURE; } int ret; if ((ret= sst_append_auth_env(env, sst_auth_real))) { WSREP_ERROR(\"wsrep_sst_donate_cb(): appending auth env failed: %d\", ret); return WSREP_CB_FAILURE; } if (!strcmp (WSREP_SST_MYSQLDUMP, method)) { ret = sst_donate_mysqldump(data, ¤t_gtid->uuid, uuid_str, current_gtid->seqno, bypass, env()); } else { ret = sst_donate_other(method, data, uuid_str, current_gtid->seqno, bypass, env()); } return (ret >= 0 ? WSREP_CB_SUCCESS : WSREP_CB_FAILURE); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 399266, "input": "void imap_pretty_mailbox(char *path, size_t pathlen, const char *folder) { struct ConnAccount cac_target = { { 0 } }; struct ConnAccount cac_home = { { 0 } }; struct Url url = { 0 }; const char *delim = NULL; int tlen; int hlen = 0; bool home_match = false; char target_mailbox[1024]; char home_mailbox[1024]; if (imap_parse_path(path, &cac_target, target_mailbox, sizeof(target_mailbox)) < 0) return; if (imap_path_probe(folder, NULL) != MUTT_IMAP) goto fallback; if (imap_parse_path(folder, &cac_home, home_mailbox, sizeof(home_mailbox)) < 0) goto fallback; tlen = mutt_str_len(target_mailbox); hlen = mutt_str_len(home_mailbox); /* check whether we can do '+' substitution */ if (tlen && imap_account_match(&cac_home, &cac_target) && mutt_strn_equal(home_mailbox, target_mailbox, hlen)) { const char *const c_imap_delim_chars = cs_subset_string(NeoMutt->sub, \"imap_delim_chars\"); if (hlen == 0) home_match = true; else if (c_imap_delim_chars) { for (delim = c_imap_delim_chars; *delim != '\\0'; delim++) if (target_mailbox[hlen] == *delim) home_match = true; } } /* do the '+' substitution */ if (home_match) { *path++ = '+'; /* copy remaining path, skipping delimiter */ if (hlen == 0) hlen = -1; memcpy(path, target_mailbox + hlen + 1, tlen - hlen - 1); path[tlen - hlen - 1] = '\\0'; return; } fallback: mutt_account_tourl(&cac_target, &url); url.path = target_mailbox; url_tostring(&url, path, pathlen, U_NO_FLAGS); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237591, "input": "void CoLL_box_del(GF_Box *a) { GF_VPContentLightLevelBox *p = (GF_VPContentLightLevelBox *)a; gf_free(p); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333805, "input": "int RGWPutObj_ObjStore_S3::get_params() { if (!s->length) return -ERR_LENGTH_REQUIRED; map src_attrs; size_t pos; int ret; map_qs_metadata(s); RGWAccessControlPolicy_S3 s3policy(s->cct); ret = create_s3_policy(s, store, s3policy, s->owner); if (ret < 0) return ret; policy = s3policy; if_match = s->info.env->get(\"HTTP_IF_MATCH\"); if_nomatch = s->info.env->get(\"HTTP_IF_NONE_MATCH\"); copy_source = url_decode(s->info.env->get(\"HTTP_X_AMZ_COPY_SOURCE\", \"\")); copy_source_range = s->info.env->get(\"HTTP_X_AMZ_COPY_SOURCE_RANGE\"); /* handle x-amz-copy-source */ boost::string_view cs_view(copy_source); if (! cs_view.empty()) { if (cs_view[0] == '/') cs_view.remove_prefix(1); copy_source_bucket_name = cs_view.to_string(); pos = copy_source_bucket_name.find(\"/\"); if (pos == std::string::npos) { ret = -EINVAL; ldout(s->cct, 5) << \"x-amz-copy-source bad format\" << dendl; return ret; } copy_source_object_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size()); copy_source_bucket_name = copy_source_bucket_name.substr(0, pos); #define VERSION_ID_STR \"?versionId=\" pos = copy_source_object_name.find(VERSION_ID_STR); if (pos == std::string::npos) { copy_source_object_name = url_decode(copy_source_object_name); } else { copy_source_version_id = copy_source_object_name.substr(pos + sizeof(VERSION_ID_STR) - 1); copy_source_object_name = url_decode(copy_source_object_name.substr(0, pos)); } pos = copy_source_bucket_name.find(\":\"); if (pos == std::string::npos) { copy_source_tenant_name = s->src_tenant_name; } else { copy_source_tenant_name = copy_source_bucket_name.substr(0, pos); copy_source_bucket_name = copy_source_bucket_name.substr(pos + 1, copy_source_bucket_name.size()); if (copy_source_bucket_name.empty()) { ret = -EINVAL; ldout(s->cct, 5) << \"source bucket name is empty\" << dendl; return ret; } } ret = store->get_bucket_info(*s->sysobj_ctx, copy_source_tenant_name, copy_source_bucket_name, copy_source_bucket_info, NULL, &src_attrs); if (ret < 0) { ldout(s->cct, 5) << __func__ << \"(): get_bucket_info() returned ret=\" << ret << dendl; return ret; } /* handle x-amz-copy-source-range */ if (copy_source_range) { string range = copy_source_range; pos = range.find(\"=\"); if (pos == std::string::npos) { ret = -EINVAL; ldout(s->cct, 5) << \"x-amz-copy-source-range bad format\" << dendl; return ret; } range = range.substr(pos + 1); pos = range.find(\"-\"); if (pos == std::string::npos) { ret = -EINVAL; ldout(s->cct, 5) << \"x-amz-copy-source-range bad format\" << dendl; return ret; } string first = range.substr(0, pos); string last = range.substr(pos + 1); copy_source_range_fst = strtoull(first.c_str(), NULL, 10); copy_source_range_lst = strtoull(last.c_str(), NULL, 10); } } /* copy_source */ /* handle object tagging */ auto tag_str = s->info.env->get(\"HTTP_X_AMZ_TAGGING\"); if (tag_str){ obj_tags = std::make_unique(); ret = obj_tags->set_from_string(tag_str); if (ret < 0){ ldout(s->cct,0) << \"setting obj tags failed with \" << ret << dendl; if (ret == -ERR_INVALID_TAG){ ret = -EINVAL; //s3 returns only -EINVAL for PUT requests } return ret; } } //handle object lock auto obj_lock_mode_str = s->info.env->get(\"HTTP_X_AMZ_OBJECT_LOCK_MODE\"); auto obj_lock_date_str = s->info.env->get(\"HTTP_X_AMZ_OBJECT_LOCK_RETAIN_UNTIL_DATE\"); auto obj_legal_hold_str = s->info.env->get(\"HTTP_X_AMZ_OBJECT_LOCK_LEGAL_HOLD\"); if (obj_lock_mode_str && obj_lock_date_str) { boost::optional date = ceph::from_iso_8601(obj_lock_date_str); if (boost::none == date || ceph::real_clock::to_time_t(*date) <= ceph_clock_now()) { ret = -EINVAL; ldpp_dout(this,0) << \"invalid x-amz-object-lock-retain-until-date value\" << dendl; return ret; } if (strcmp(obj_lock_mode_str, \"GOVERNANCE\") != 0 && strcmp(obj_lock_mode_str, \"COMPLIANCE\") != 0) { ret = -EINVAL; ldpp_dout(this,0) << \"invalid x-amz-object-lock-mode value\" << dendl; return ret; } obj_retention = new RGWObjectRetention(obj_lock_mode_str, *date); } else if ((obj_lock_mode_str && !obj_lock_date_str) || (!obj_lock_mode_str && obj_lock_date_str)) { ret = -EINVAL; ldpp_dout(this,0) << \"need both x-amz-object-lock-mode and x-amz-object-lock-retain-until-date \" << dendl; return ret; } if (obj_legal_hold_str) { if (strcmp(obj_legal_hold_str, \"ON\") != 0 && strcmp(obj_legal_hold_str, \"OFF\") != 0) { ret = -EINVAL; ldpp_dout(this,0) << \"invalid x-amz-object-lock-legal-hold value\" << dendl; return ret; } obj_legal_hold = new RGWObjectLegalHold(obj_legal_hold_str); } if (!s->bucket_info.obj_lock_enabled() && (obj_retention || obj_legal_hold)) { ldpp_dout(this, 0) << \"ERROR: object retention or legal hold can't be set if bucket object lock not configured\" << dendl; ret = -ERR_INVALID_REQUEST; return ret; } multipart_upload_id = s->info.args.get(\"uploadId\"); multipart_part_str = s->info.args.get(\"partNumber\"); if (!multipart_part_str.empty()) { string err; multipart_part_num = strict_strtol(multipart_part_str.c_str(), 10, &err); if (!err.empty()) { ldpp_dout(s, 10) << \"bad part number: \" << multipart_part_str << \": \" << err << dendl; return -EINVAL; } } else if (!multipart_upload_id.empty()) { ldpp_dout(s, 10) << \"part number with no multipart upload id\" << dendl; return -EINVAL; } append = s->info.args.exists(\"append\"); if (append) { string pos_str = s->info.args.get(\"position\"); if (pos_str.empty()) { return -EINVAL; } else { position = strtoull(pos_str.c_str(), NULL, 10); } } return RGWPutObj_ObjStore::get_params(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219721, "input": "static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, char *end, size_t IFDlength, size_t displacement, int section_index) { int de; int NumDirEntries; int NextDirOffset; ImageInfo->sections_found |= FOUND_IFD0; CHECK_BUFFER_R(dir_start, end, 2, 0); NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) { raise_warning(\"Illegal IFD size: x%04X + 2 + x%04X*12 = x%04X > x%04lX\", (int)((size_t)dir_start+2-(size_t)offset_base), NumDirEntries, (int)((size_t)dir_start+2+ NumDirEntries*12-(size_t)offset_base), IFDlength); return 0; } for (de=0;demotorola_intel); if (NextDirOffset) { /* the next line seems false but here IFDlength means length of all IFDs */ if (offset_base + NextDirOffset < offset_base || offset_base + NextDirOffset > offset_base+IFDlength) { raise_warning(\"Illegal IFD offset\"); return 0; } /* That is the IFD for the first thumbnail */ if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, end, IFDlength, displacement, SECTION_THUMBNAIL)) { if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN && ImageInfo->Thumbnail.size && ImageInfo->Thumbnail.offset && ImageInfo->read_thumbnail) { exif_thumbnail_extract(ImageInfo, offset_base, IFDlength); } return 1; } else { return 0; } } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273050, "input": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast(node->builtin_data); int axis = params->axis; int num_inputs = node->inputs->size; // The number of dimensions of the input tensors must match, and all // dimensions except 'axis' must be equal. const TfLiteTensor* t0; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &t0)); TfLiteType input_type = t0->type; if (axis < 0) axis += t0->dims->size; TF_LITE_ENSURE(context, axis >= 0); TF_LITE_ENSURE(context, axis < t0->dims->size); TF_LITE_ENSURE_EQ(context, params->activation, kTfLiteActNone); TF_LITE_ENSURE(context, input_type == kTfLiteFloat32 || input_type == kTfLiteUInt8 || input_type == kTfLiteInt8 || input_type == kTfLiteInt16 || input_type == kTfLiteInt32 || input_type == kTfLiteInt64 || input_type == kTfLiteBool); // Output dimensions will match input dimensions, except 'axis', which // will be the sum of inputs int sum_axis = t0->dims->data[axis]; for (int i = 1; i < num_inputs; ++i) { const TfLiteTensor* t; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, i, &t)); TF_LITE_ENSURE_EQ(context, t->dims->size, t0->dims->size); TF_LITE_ENSURE_EQ(context, t->type, input_type); for (int d = 0; d < t0->dims->size; ++d) { if (d == axis) { // Avoid integer overflow in sum_axis below TF_LITE_ENSURE(context, t->dims->data[axis] >= 0); TF_LITE_ENSURE(context, t->dims->data[axis] <= std::numeric_limits::max() - sum_axis); sum_axis += t->dims->data[axis]; } else { TF_LITE_ENSURE_EQ(context, t->dims->data[d], t0->dims->data[d]); } } } TfLiteIntArray* output_size = TfLiteIntArrayCreate(t0->dims->size); for (int d = 0; d < t0->dims->size; ++d) { output_size->data[d] = (d == axis) ? sum_axis : t0->dims->data[d]; } TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output)); TF_LITE_ENSURE_TYPES_EQ(context, output->type, input_type); if (input_type == kTfLiteInt8) { // Make sure there is no re-scaling needed for Int8 quantized kernel. This // is a restriction we introduced to Int8 kernels. VectorOfTensors all_inputs(*context, *node->inputs); for (int i = 0; i < node->inputs->size; ++i) { const TfLiteTensor* t; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, i, &t)); TF_LITE_ENSURE_EQ(context, t->params.scale, output->params.scale); TF_LITE_ENSURE_EQ(context, t->params.zero_point, output->params.zero_point); } } if (input_type == kTfLiteInt16) { // Make sure that all Int16 inputs have a null zero-point. for (int i = 0; i < node->inputs->size; ++i) { const TfLiteTensor* t = GetInput(context, node, i); TF_LITE_ENSURE_EQ(context, t->params.zero_point, 0); } TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0); } return context->ResizeTensor(context, output, output_size); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346346, "input": "_evbuffer_testing_use_sendfile(void) { int ok = 0; #ifdef USE_SENDFILE use_sendfile = 1; ok = 1; #endif #ifdef _EVENT_HAVE_MMAP use_mmap = 0; #endif return ok; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370049, "input": "intrusive_ptr ExpressionPow::create(ExpressionContext* const expCtx, Value base, Value exp) { intrusive_ptr expr(new ExpressionPow(expCtx)); expr->_children.push_back( ExpressionConstant::create(expr->getExpressionContext(), std::move(base))); expr->_children.push_back( ExpressionConstant::create(expr->getExpressionContext(), std::move(exp))); return expr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409635, "input": "static BOOL rdp_print_share_capability_set(wStream* s, UINT16 length) { UINT16 nodeId; UINT16 pad2Octets; WLog_INFO(TAG, \"ShareCapabilitySet (length %\" PRIu16 \"):\", length); if (length < 8) return FALSE; Stream_Read_UINT16(s, nodeId); /* nodeId (2 bytes) */ Stream_Read_UINT16(s, pad2Octets); /* pad2Octets (2 bytes) */ WLog_INFO(TAG, \"\\tnodeId: 0x%04\" PRIX16 \"\", nodeId); WLog_INFO(TAG, \"\\tpad2Octets: 0x%04\" PRIX16 \"\", pad2Octets); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448805, "input": "int RGWListBucket_ObjStore_SWIFT::get_params() { prefix = s->info.args.get(\"prefix\"); marker = s->info.args.get(\"marker\"); end_marker = s->info.args.get(\"end_marker\"); max_keys = s->info.args.get(\"limit\"); // non-standard s->info.args.get_bool(\"allow_unordered\", &allow_unordered, false); delimiter = s->info.args.get(\"delimiter\"); op_ret = parse_max_keys(); if (op_ret < 0) { return op_ret; } // S3 behavior is to silently cap the max-keys. // Swift behavior is to abort. if (max > default_max) return -ERR_PRECONDITION_FAILED; string path_args; if (s->info.args.exists(\"path\")) { // should handle empty path path_args = s->info.args.get(\"path\"); if (!delimiter.empty() || !prefix.empty()) { return -EINVAL; } prefix = path_args; delimiter=\"/\"; path = prefix; if (path.size() && path[path.size() - 1] != '/') path.append(\"/\"); int len = prefix.size(); int delim_size = delimiter.size(); if (len >= delim_size) { if (prefix.substr(len - delim_size).compare(delimiter) != 0) prefix.append(delimiter); } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417842, "input": "static void SFDDumpDeviceTable(FILE *sfd,DeviceTable *adjust) { int i; if ( adjust==NULL ) return; fprintf( sfd, \"{\" ); if ( adjust->corrections!=NULL ) { fprintf( sfd, \"%d-%d \", adjust->first_pixel_size, adjust->last_pixel_size ); for ( i=0; i<=adjust->last_pixel_size-adjust->first_pixel_size; ++i ) fprintf( sfd, \"%s%d\", i==0?\"\":\",\", adjust->corrections[i]); } fprintf( sfd, \"}\" ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379387, "input": "ansic_wshouldquote (string) const char *string; { const wchar_t *wcs; wchar_t wcc; wchar_t *wcstr = NULL; size_t wclen, slen; slen = mbstowcs (wcstr, string, 0); if (slen == -1) slen = 0; wcstr = (wchar_t *)xmalloc (sizeof (wchar_t) * (slen + 1)); mbstowcs (wcstr, string, slen + 1); for (wcs = wcstr; wcc = *wcs; wcs++) if (iswprint(wcc) == 0) { free (wcstr); return 1; } free (wcstr); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381542, "input": "static int v4l_reqbufs(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct v4l2_requestbuffers *p = arg; int ret = check_fmt(file, p->type); if (ret) return ret; CLEAR_AFTER_FIELD(p, capabilities); return ops->vidioc_reqbufs(file, fh, p); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267242, "input": "GF_Err gf_isom_set_watermark(GF_ISOFile *movie, bin128 UUID, u8* data, u32 length) { GF_Err e; GF_UnknownUUIDBox *ptr; GF_UserDataMap *map; e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE); if (e) return e; e = gf_isom_insert_moov(movie); if (e) return e; if (!movie->moov->udta) { e = moov_on_child_box((GF_Box*)movie->moov, gf_isom_box_new_parent(&movie->moov->child_boxes, GF_ISOM_BOX_TYPE_UDTA)); if (e) return e; } map = udta_getEntry(movie->moov->udta, GF_ISOM_BOX_TYPE_UUID, (bin128 *) & UUID); if (map) { ptr = (GF_UnknownUUIDBox *)gf_list_get(map->boxes, 0); if (ptr) { gf_free(ptr->data); ptr->data = (char*)gf_malloc(length); if (!ptr->data) return GF_OUT_OF_MEM; memcpy(ptr->data, data, length); ptr->dataSize = length; return GF_OK; } } //nope, create one ptr = (GF_UnknownUUIDBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_UUID); if (!ptr) return GF_OUT_OF_MEM; memcpy(ptr->uuid, UUID, 16); ptr->data = (char*)gf_malloc(length); if (!ptr->data) return GF_OUT_OF_MEM; memcpy(ptr->data, data, length); ptr->dataSize = length; return udta_on_child_box((GF_Box *)movie->moov->udta, (GF_Box *) ptr); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354435, "input": "static int kvm_s390_vm_get_attr(struct kvm *kvm, struct kvm_device_attr *attr) { int ret; switch (attr->group) { case KVM_S390_VM_MEM_CTRL: ret = kvm_s390_get_mem_control(kvm, attr); break; case KVM_S390_VM_TOD: ret = kvm_s390_get_tod(kvm, attr); break; case KVM_S390_VM_CPU_MODEL: ret = kvm_s390_get_cpu_model(kvm, attr); break; case KVM_S390_VM_MIGRATION: ret = kvm_s390_vm_get_migration(kvm, attr); break; default: ret = -ENXIO; break; } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269125, "input": "inline int MatchingFlatSizeSkipDim(const RuntimeShape& shape, int skip_dim, const RuntimeShape& check_shape_0, const RuntimeShape& check_shape_1, const RuntimeShape& check_shape_2, const RuntimeShape& check_shape_3) { const int dims_count = shape.DimensionsCount(); for (int i = 0; i < dims_count; ++i) { if (i != skip_dim) { TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); } } return MatchingFlatSizeSkipDim(shape, skip_dim, check_shape_1, check_shape_2, check_shape_3); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 308342, "input": "XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start) { if (parser != NULL) startNamespaceDeclHandler = start; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195664, "input": "CallResult> JSObject::getComputedWithReceiver_RJS( Handle selfHandle, Runtime *runtime, Handle<> nameValHandle, Handle<> receiver) { // Try the fast-path first: no \"index-like\" properties and the \"name\" already // is a valid integer index. if (selfHandle->flags_.fastIndexProperties) { if (auto arrayIndex = toArrayIndexFastPath(*nameValHandle)) { // Do we have this value present in our array storage? If so, return it. PseudoHandle<> ourValue = createPseudoHandle( getOwnIndexed(selfHandle.get(), runtime, *arrayIndex)); if (LLVM_LIKELY(!ourValue->isEmpty())) return ourValue; } } // If nameValHandle is an object, we should convert it to string now, // because toString may have side-effect, and we want to do this only // once. auto converted = toPropertyKeyIfObject(runtime, nameValHandle); if (LLVM_UNLIKELY(converted == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } auto nameValPrimitiveHandle = *converted; ComputedPropertyDescriptor desc; // Locate the descriptor. propObj contains the object which may be anywhere // along the prototype chain. MutableHandle propObj{runtime}; if (LLVM_UNLIKELY( getComputedPrimitiveDescriptor( selfHandle, runtime, nameValPrimitiveHandle, propObj, desc) == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } if (!propObj) return createPseudoHandle(HermesValue::encodeUndefinedValue()); if (LLVM_LIKELY( !desc.flags.accessor && !desc.flags.hostObject && !desc.flags.proxyObject)) return createPseudoHandle( getComputedSlotValue(propObj.get(), runtime, desc)); if (desc.flags.accessor) { auto *accessor = vmcast( getComputedSlotValue(propObj.get(), runtime, desc)); if (!accessor->getter) return createPseudoHandle(HermesValue::encodeUndefinedValue()); // Execute the accessor on this object. return accessor->getter.get(runtime)->executeCall0( runtime->makeHandle(accessor->getter), runtime, receiver); } else if (desc.flags.hostObject) { SymbolID id{}; LAZY_TO_IDENTIFIER(runtime, nameValPrimitiveHandle, id); auto propRes = vmcast(selfHandle.get())->get(id); if (propRes == ExecutionStatus::EXCEPTION) return ExecutionStatus::EXCEPTION; return createPseudoHandle(*propRes); } else { assert(desc.flags.proxyObject && \"descriptor flags are impossible\"); CallResult> key = toPropertyKey(runtime, nameValPrimitiveHandle); if (key == ExecutionStatus::EXCEPTION) return ExecutionStatus::EXCEPTION; return JSProxy::getComputed(propObj, runtime, *key, receiver); } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "A type confusion vulnerability when resolving properties of JavaScript objects with specially-crafted prototype chains in Facebook Hermes prior to commit fe52854cdf6725c2eaa9e125995da76e6ceb27da allows attackers to potentially execute arbitrary code via crafted JavaScript. Note that this is only exploitable if the application using Hermes permits evaluation of untrusted JavaScript. Hence, most React Native applications are not affected.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-1911"}} -{"idx": 462690, "input": "_gnutls_x509_export_int_named2(ASN1_TYPE asn1_data, const char *name, gnutls_x509_crt_fmt_t format, const char *pem_header, gnutls_datum_t * out) { int ret; if (format == GNUTLS_X509_FMT_DER) { ret = _gnutls_x509_der_encode(asn1_data, name, out, 0); if (ret < 0) return gnutls_assert_val(ret); } else { /* PEM */ gnutls_datum_t tmp; ret = _gnutls_x509_der_encode(asn1_data, name, &tmp, 0); if (ret < 0) return gnutls_assert_val(ret); ret = _gnutls_fbase64_encode(pem_header, tmp.data, tmp.size, out); _gnutls_free_datum(&tmp); if (ret < 0) return gnutls_assert_val(ret); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269735, "input": "std::vector WebContents::GetPreloadPaths() const { auto result = SessionPreferences::GetValidPreloads(GetBrowserContext()); if (auto* web_preferences = WebContentsPreferences::From(web_contents())) { base::FilePath::StringType preload; if (web_preferences->GetPreloadPath(&preload)) { result.emplace_back(preload); } } return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448785, "input": "void RGWPutMetadataBucket_ObjStore_SWIFT::send_response() { const auto meta_ret = handle_metadata_errors(s, op_ret); if (meta_ret != op_ret) { op_ret = meta_ret; } else { if (!op_ret && (op_ret != -EINVAL)) { op_ret = STATUS_NO_CONTENT; } set_req_state_err(s, op_ret); } dump_errno(s); end_header(s, this); rgw_flush_formatter_and_reset(s, s->formatter); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 489589, "input": "static int svc_shutdown(struct socket *sock,int how) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497614, "input": "static void des1_1_decrypt(struct ssh_cipher_struct *cipher, void *in, void *out, unsigned long len){ DES_ncbc_encrypt(in,out,len, cipher->key, cipher->IV, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 245150, "input": "void Compute(OpKernelContext* context) override { // Get inputs const Tensor& input_tensor = context->input(0); const auto input_tensor_flat = input_tensor.flat(); const Tensor& input_splits = context->input(1); const auto input_splits_flat = input_splits.flat(); // Operation will treat first argument in input_splits as if it were zero // regardless of its actual value since splits should begin with zero and // end with the length of the input values vector. OP_REQUIRES( context, input_splits_flat(0) == 0, errors::InvalidArgument(\"First value in input_splits must be zero.\")); OP_REQUIRES(context, input_splits_flat(input_splits_flat.size() - 1) == input_tensor_flat.size(), errors::InvalidArgument(\"Last value in input_splits must be \" \"equal to length of input_tensor.\")); // Since we limit to a 2-D input (flat_values of rank 1 and a single splits // tensor), our output dimension will be 1 with it's size equal to the // number of splits (outer dimension or ragged tensor). TensorShape output_shape({input_splits.dim_size(0) - 1}); Tensor* output_tensor; OP_REQUIRES_OK(context, context->allocate_output(\"output\", output_shape, &output_tensor)); auto output_tensor_flat = output_tensor->flat(); // Use a single index over the flattened input values tensor. int idx = 0; // Loop through our split dimension to create a new string at each split. for (int i = 1; i < input_splits_flat.size(); ++i) { icu::UnicodeString unicode_string; icu::UnicodeStringAppendable appendable_unicode_string(unicode_string); OP_REQUIRES( context, input_splits_flat(i - 1) <= input_splits_flat(i), errors::InvalidArgument( \"Values in input_splits must be equal or in ascending order.\")); OP_REQUIRES( context, input_splits_flat(i) <= input_tensor_flat.size(), errors::InvalidArgument(\"Values in input_splits must be less than or \" \"equal to input_tensor length.\")); for (; idx < input_splits_flat(i); ++idx) { int32 code_point = input_tensor_flat(idx); // Check for invalid code point if (!U_IS_UNICODE_CHAR(code_point)) { if (error_options_.error_on_malformatting) { context->CtxFailure(errors::InvalidArgument( \"Code point is out of range for Unicode, or a noncharacter.\")); return; } else if (!error_options_.elide_replacement) { code_point = error_options_.subst; } } appendable_unicode_string.appendCodePoint(code_point); } // Encode our string and save in the output. tstring result; Encode(encoding_, unicode_string, &result); output_tensor_flat(i - 1) = std::move(result); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 261456, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& input = ctx->input(0); OP_REQUIRES(ctx, ctx->input(1).NumElements() > 0, errors::InvalidArgument(\"Input min must not be empty.\")); OP_REQUIRES(ctx, ctx->input(2).NumElements() > 0, errors::InvalidArgument(\"Input max must not be empty.\")); const float input_min_float = ctx->input(1).flat()(0); const float input_max_float = ctx->input(2).flat()(0); Tensor* output_min = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &output_min)); Tensor* output_max = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(1, TensorShape({}), &output_max)); qint32 used_min_quantized; qint32 used_max_quantized; CalculateUsedRange(input, &used_min_quantized, &used_max_quantized); // We want to make sure that the minimum is no larger than zero, so that the // convolution operation can run efficiently. const float used_min_float = std::min( 0.0f, QuantizedToFloat(used_min_quantized, input_min_float, input_max_float)); const float used_max_float = QuantizedToFloat(used_max_quantized, input_min_float, input_max_float); output_min->flat().setConstant(used_min_float); output_max->flat().setConstant(used_max_float); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267291, "input": "GF_Err gf_isom_get_raw_user_data(GF_ISOFile *file, u8 **output, u32 *output_size) { GF_BitStream *bs; GF_Err e; GF_Box *b; u32 i; *output = NULL; *output_size = 0; if (!file || !file->moov || (!file->moov->udta && !file->moov->child_boxes)) return GF_OK; bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); if (file->moov->udta) { e = gf_isom_box_size( (GF_Box *) file->moov->udta); if (e) goto exit; e = gf_isom_box_write((GF_Box *) file->moov->udta, bs); if (e) goto exit; } e = GF_OK; i=0; while ((b = gf_list_enum(file->moov->child_boxes, &i))) { switch (b->type) { case GF_ISOM_BOX_TYPE_TRAK: case GF_ISOM_BOX_TYPE_MVHD: case GF_ISOM_BOX_TYPE_MVEX: case GF_ISOM_BOX_TYPE_IODS: case GF_ISOM_BOX_TYPE_META: continue; } e = gf_isom_box_size( (GF_Box *) b); if (e) goto exit; e = gf_isom_box_write((GF_Box *) b, bs); if (e) goto exit; } gf_bs_get_content(bs, output, output_size); exit: gf_bs_del(bs); return e; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380019, "input": "return 0; } static int iscsi_remove_host(struct transport_container *tc, struct device *dev, struct device *cdev) { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432395, "input": "static void avic_handle_dfr_update(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); u32 dfr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_DFR); if (svm->dfr_reg == dfr) return; avic_invalidate_logical_id_entry(vcpu); svm->dfr_reg = dfr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431240, "input": "static int _nfs41_proc_get_locations(struct inode *inode, struct nfs4_fs_locations *locations, struct page *page, const struct cred *cred) { struct nfs_server *server = NFS_SERVER(inode); struct rpc_clnt *clnt = server->client; u32 bitmask[2] = { [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, }; struct nfs4_fs_locations_arg args = { .fh = NFS_FH(inode), .page = page, .bitmask = bitmask, .migration = 1, /* skip LOOKUP */ }; struct nfs4_fs_locations_res res = { .fs_locations = locations, .migration = 1, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FS_LOCATIONS], .rpc_argp = &args, .rpc_resp = &res, .rpc_cred = cred, }; int status; nfs_fattr_init(&locations->fattr); locations->server = server; locations->nlocations = 0; nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1); status = nfs4_call_sync_sequence(clnt, server, &msg, &args.seq_args, &res.seq_res); if (status == NFS4_OK && res.seq_res.sr_status_flags & SEQ4_STATUS_LEASE_MOVED) status = -NFS4ERR_LEASE_MOVED; return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280111, "input": "static inline int alloc_debug_processing(struct kmem_cache *s, struct page *page, void *object, unsigned long addr) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373780, "input": "getLogicalQueueSize(qqueue_t *pThis) { return pThis->iQueueSize - pThis->nLogDeq; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270700, "input": "static int cardos_init(sc_card_t *card) { cardos_data_t * priv = NULL; unsigned long flags = 0; size_t data_field_length; sc_apdu_t apdu; u8 rbuf[2]; int r; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); priv = calloc(1, sizeof(cardos_data_t)); if (!priv) LOG_FUNC_RETURN(card->ctx, SC_ERROR_OUT_OF_MEMORY); card->drv_data = priv; card->name = \"Atos CardOS\"; card->cla = 0x00; /* let user override flags and type from opensc.conf */ /* user can override card->type too.*/ if (card->flags) { flags = card->flags; } else { /* Set up algorithm info. */ flags = 0; if (card->type == SC_CARD_TYPE_CARDOS_V5_0) { flags |= SC_ALGORITHM_RSA_PAD_PKCS1; } else if(card->type == SC_CARD_TYPE_CARDOS_V5_3) { flags |= SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_NONE | SC_ALGORITHM_ONBOARD_KEY_GEN; } else { flags |= SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_NONE | SC_ALGORITHM_NEED_USAGE | SC_ALGORITHM_ONBOARD_KEY_GEN; } } priv->flags = flags; if (card->type == SC_CARD_TYPE_CARDOS_M4_2) { r = cardos_have_2048bit_package(card); if (r < 0) { r = SC_ERROR_INVALID_CARD; goto err; } if (r == 1) priv->rsa_2048 = 1; card->caps |= SC_CARD_CAP_APDU_EXT; } else if (card->type == SC_CARD_TYPE_CARDOS_M4_3 || card->type == SC_CARD_TYPE_CARDOS_M4_2B || card->type == SC_CARD_TYPE_CARDOS_M4_2C || card->type == SC_CARD_TYPE_CARDOS_M4_4 || card->type == SC_CARD_TYPE_CARDOS_V5_0 || card->type == SC_CARD_TYPE_CARDOS_V5_3) { priv->rsa_2048 = 1; card->caps |= SC_CARD_CAP_APDU_EXT; /* TODO check this. EC only if in supported_algo */ priv->ext_flags = SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES; } /* probe DATA FIELD LENGTH with GET DATA */ sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x8D); apdu.le = sizeof rbuf; apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); r = sc_transmit_apdu(card, &apdu); if (r < 0) LOG_TEST_GOTO_ERR(card->ctx, SC_ERROR_INVALID_CARD, \"APDU transmit failed\"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r < 0) LOG_TEST_GOTO_ERR(card->ctx, SC_ERROR_INVALID_CARD, \"GET DATA command returned error\"); if (apdu.resplen != 2) { r = SC_ERROR_INVALID_CARD; goto err; } data_field_length = ((rbuf[0] << 8) | rbuf[1]); /* TODO is this really needed? strip the length of possible Lc and Le bytes */ /* Use Min card sizes and reader too. for V5_3 at least*/ if (card->type == SC_CARD_TYPE_CARDOS_V5_0 || card->type == SC_CARD_TYPE_CARDOS_V5_3) { sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, \"data_field_length:%\"SC_FORMAT_LEN_SIZE_T\"u \" \"card->reader->max_send_size:%\"SC_FORMAT_LEN_SIZE_T\"u \" \"card->reader->max_recv_size:%\"SC_FORMAT_LEN_SIZE_T\"u %s\", data_field_length, card->reader->max_send_size, card->reader->max_recv_size, (card->caps & SC_CARD_CAP_APDU_EXT) ? \"SC_CARD_CAP_APDU_EXT\" : \" \"); if (card->caps & SC_CARD_CAP_APDU_EXT) { card->max_send_size = data_field_length - 6; #ifdef _WIN32 /* Windows does not support PCSC PART_10 and may have forced reader to 255/256 * https://github.com/OpenSC/OpenSC/commit/eddea6f3c2d3dafc2c09eba6695c745a61b5186f * may have reset this. if so, will override and force extended * Most, if not all, cardos cards do extended, but not chaining */ if (card->reader->max_send_size == 255 && card->reader->max_recv_size == 256) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, \"resetting reader to use data_field_length\"); card->reader->max_send_size = data_field_length - 6; card->reader->max_recv_size = data_field_length - 3; } #endif } else card->max_send_size = data_field_length - 3; card->max_send_size = sc_get_max_send_size(card); /* include reader sizes and protocol */ card->max_recv_size = data_field_length - 2; card->max_recv_size = sc_get_max_recv_size(card); } else { /* old way, disregards reader capabilities */ if (card->caps & SC_CARD_CAP_APDU_EXT) card->max_send_size = data_field_length - 6; else card->max_send_size = data_field_length - 3; /* strip the length of SW bytes */ card->max_recv_size = data_field_length - 2; } /*for new cards, wait till after sc_pkcs15_bind_internal reads tokeninfo */ if (card->type != SC_CARD_TYPE_CARDOS_V5_0 && card->type != SC_CARD_TYPE_CARDOS_V5_3) { r = cardos_add_algs(card, flags, 0, 0); } err: if (r != SC_SUCCESS) { free(priv); card->drv_data = NULL; } return r; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421555, "input": "processor_register(const char *name, const char *line) { struct processor_instance *processor; processor = dict_xget(&processors, name); if (strcmp(line, \"register|ready\") == 0) { processor->ready = 1; return; } if (strncmp(line, \"register|report|\", 16) == 0) { lka_report_register_hook(name, line+16); return; } if (strncmp(line, \"register|filter|\", 16) == 0) { lka_filter_register_hook(name, line+16); return; } fatalx(\"Invalid register line received: %s\", line); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417017, "input": "void APar_ExtractDetails(FILE *isofile, uint8_t optional_output) { char uint32_buffer[8]; Trackage track = {0}; AtomicInfo *mvhdAtom = APar_FindAtom(\"moov.mvhd\", false, VERSIONED_ATOM, 0); if (mvhdAtom != NULL) { APar_ExtractMovieDetails(uint32_buffer, isofile, mvhdAtom); fprintf(stdout, \"Movie duration: %.3lf seconds (%s) - %.2lf* kbp/sec bitrate \" \"(*=approximate)\\n\", movie_info.seconds, secsTOtime(movie_info.seconds), movie_info.simple_bitrate_calc); if (optional_output & SHOW_DATE_INFO) { fprintf(stdout, \" Presentation Creation Date (UTC): %s\\n\", APar_extract_UTC(movie_info.creation_time)); fprintf(stdout, \" Presentation Modification Date (UTC): %s\\n\", APar_extract_UTC(movie_info.modified_time)); } } AtomicInfo *iodsAtom = APar_FindAtom(\"moov.iods\", false, VERSIONED_ATOM, 0); if (iodsAtom != NULL) { movie_info.contains_iods = true; APar_Extract_iods_Info(isofile, iodsAtom); } if (optional_output & SHOW_TRACK_INFO) { APar_TrackLevelInfo(&track, NULL); // With track_num set to 0, it will return the // total trak atom into total_tracks here. fprintf( stdout, \"Low-level details. Total tracks: %u\\n\", track.total_tracks); fprintf(stdout, \"Trk Type Handler Kind Lang Bytes\\n\"); if (track.total_tracks > 0) { while (track.total_tracks > track.track_num) { track.track_num += 1; TrackInfo track_info = {0}; // tracknum, handler type, handler name APar_ExtractTrackDetails(uint32_buffer, isofile, &track, &track_info); uint16_t more_whitespace = purge_extraneous_characters(track_info.track_hdlr_name); if (strlen(track_info.track_hdlr_name) == 0) { memcpy(track_info.track_hdlr_name, \"[none listed]\", 13); } fprintf(stdout, \"%u %s %s\", track.track_num, uint32tochar4(track_info.track_type, uint32_buffer), track_info.track_hdlr_name); uint16_t handler_len = strlen(track_info.track_hdlr_name); if (handler_len < 25 + more_whitespace) { for (uint16_t i = handler_len; i < 25 + more_whitespace; i++) { fprintf(stdout, \" \"); } } // codec, language fprintf(stdout, \" %s %s %\" PRIu64, uint32tochar4(track_info.track_codec, uint32_buffer), track_info.unpacked_lang, track_info.sample_aggregate); if (track_info.encoder_name[0] != 0 && track_info.contains_esds) { purge_extraneous_characters(track_info.encoder_name); fprintf(stdout, \" Encoder: %s\", track_info.encoder_name); } if (track_info.type_of_track & DRM_PROTECTED_TRACK) { fprintf(stdout, \" (protected %s)\", uint32tochar4(track_info.protected_codec, uint32_buffer)); } fprintf(stdout, \"\\n\"); /*---------------------------------*/ if (track_info.type_of_track & VIDEO_TRACK || track_info.type_of_track & AUDIO_TRACK) { APar_Print_TrackDetails(&track_info); } if (optional_output & SHOW_DATE_INFO) { fprintf(stdout, \" Creation Date (UTC): %s\\n\", APar_extract_UTC(track_info.creation_time)); fprintf(stdout, \" Modification Date (UTC): %s\\n\", APar_extract_UTC(track_info.modified_time)); } } } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393035, "input": "TEST_F(QueryPlannerTest, ExplodeMustReverseScans) { addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1 << \"d\" << 1)); runQuerySortProj(fromjson(\"{a: {$in: [1, 2]}, b: {$in: [3, 4]}}\"), BSON(\"c\" << -1), BSONObj()); assertNumSolutions(2U); assertSolutionExists( \"{sort: {pattern: {c: -1}, limit: 0, node: {sortKeyGen: {node: \" \"{cscan: {dir: 1}}}}}}\"); assertSolutionExists( \"{fetch: {node: {mergeSort: {nodes: \" \"[{ixscan: {pattern: {a:1, b:1, c:1, d:1}}},\" \"{ixscan: {pattern: {a:1, b:1, c:1, d:1}}},\" \"{ixscan: {pattern: {a:1, b:1, c:1, d:1}}},\" \"{ixscan: {pattern: {a:1, b:1, c:1, d:1}}}]}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273219, "input": "Privmsg(const std::string& source, const Channel* targetchan, const std::string& text, MessageType mt = MSG_PRIVMSG, char status = 0) : ClientProtocol::Message(CommandStrFromMsgType(mt), source) { PushTargetChan(status, targetchan); PushParam(text); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318220, "input": "int rtnl_listen_all_nsid(struct rtnl_handle *rth) { unsigned int on = 1; if (setsockopt(rth->fd, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, &on, sizeof(on)) < 0) { perror(\"NETLINK_LISTEN_ALL_NSID\"); return -1; } rth->flags |= RTNL_HANDLE_F_LISTEN_ALL_NSID; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238829, "input": "explicit UnicodeTranscodeOp(OpKernelConstruction* ctx) : OpKernel(ctx) { OP_REQUIRES_OK(ctx, GetErrorOptions(ctx, &error_options_)); string output_encoding; OP_REQUIRES_OK(ctx, ctx->GetAttr(\"output_encoding\", &output_encoding)); OP_REQUIRES_OK(ctx, ParseUnicodeEncoding(output_encoding, &output_encoding_)); OP_REQUIRES_OK(ctx, ctx->GetAttr(\"input_encoding\", &input_encoding_)); // Make a temporary UConverter to ensure it will create without error // at execution time (and to warm any data caches the converter needs). // This instance is not used. std::unique_ptr input_encoder = absl::make_unique(); input_encoder->init(input_encoding_); OP_REQUIRES(ctx, input_encoder->converter_, errors::InvalidArgument( \"Could not create converter for input encoding: \" + input_encoding_)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232614, "input": "static int check_attach_modify_return(struct bpf_verifier_env *env) { struct bpf_prog *prog = env->prog; unsigned long addr = (unsigned long) prog->aux->trampoline->func.addr; /* This is expected to be cleaned up in the future with the KRSI effort * introducing the LSM_HOOK macro for cleaning up lsm_hooks.h. */ if (within_error_injection_list(addr) || !strncmp(SECURITY_PREFIX, prog->aux->attach_func_name, sizeof(SECURITY_PREFIX) - 1)) return 0; verbose(env, \"fmod_ret attach_btf_id %u (%s) is not modifiable\\n\", prog->aux->attach_btf_id, prog->aux->attach_func_name); return -EINVAL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219249, "input": "Variant preg_replace_impl(const Variant& pattern, const Variant& replacement, const Variant& subject, int limit, int64_t* count, bool is_callable, bool is_filter) { assertx(!(is_callable && is_filter)); if (!is_callable && replacement.isArray() && !pattern.isArray()) { raise_warning(\"Parameter mismatch, pattern is a string while \" \"replacement is an array\"); return preg_return_internal_error(false); } int replace_count = 0; if (!isContainer(subject)) { auto ret = php_replace_in_subject(pattern, replacement, subject.toString(), limit, is_callable, &replace_count); if (ret.isNull()) return ret; // php_replace_in_subject already set error assertx(ret.isString()); if (count) *count = replace_count; if (is_filter && replace_count == 0) { return preg_return_internal_error(init_null()); } return preg_return_no_error(std::move(ret)); } Array return_value = Array::CreateDArray(); Array arrSubject = subject.toDArray(); for (ArrayIter iter(arrSubject); iter; ++iter) { auto old_replace_count = replace_count; String subject_entry = iter.second().toString(); auto ret = php_replace_in_subject(pattern, replacement, subject_entry, limit, is_callable, &replace_count); if (ret.isString() && (!is_filter || replace_count > old_replace_count)) { return_value.set(iter.first(), ret.asStrRef()); } } if (count) *count = replace_count; return preg_return_no_error(std::move(return_value)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429700, "input": "ulong STDCALL mysql_hex_string(char *to, const char *from, unsigned long len) { char *start= to; char hexdigits[]= \"0123456789ABCDEF\"; while (len--) { *to++= hexdigits[((unsigned char)*from) >> 4]; *to++= hexdigits[((unsigned char)*from) & 0x0F]; from++; } *to= 0; return (ulong)(to - start); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437581, "input": "static void pre_svm_run(struct vcpu_svm *svm) { int cpu = raw_smp_processor_id(); struct svm_cpu_data *sd = per_cpu(svm_data, cpu); /* FIXME: handle wraparound of asid_generation */ if (svm->asid_generation != sd->asid_generation) new_asid(svm, sd); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417942, "input": "SplineFont *SFRecoverFile(char *autosavename,int inquire,int *state) { FILE *asfd; SplineFont *ret; char tok[1025]; if (!inquire) { *state = 1; //Default to recover all } if (!ask_about_file(autosavename, state, &asfd)) { return( NULL ); } locale_t tmplocale; locale_t oldlocale; // Declare temporary locale storage. switch_to_c_locale(&tmplocale, &oldlocale); // Switch to the C locale temporarily and cache the old locale. ret = SlurpRecovery(asfd,tok,sizeof(tok)); if ( ret==NULL ) { const char *buts[3]; buts[0] = \"_Forget It\"; buts[1] = \"_Try Again\"; buts[2] = NULL; if ( ff_ask(_(\"Recovery Failed\"),(const char **) buts,0,1,_(\"Automagic recovery of changes to %.80s failed.\\nShould FontForge try again to recover next time you start it?\"),tok)==0 ) unlink(autosavename); } switch_to_old_locale(&tmplocale, &oldlocale); // Switch to the cached locale. fclose(asfd); if ( ret ) ret->autosavename = copy(autosavename); return( ret ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446311, "input": "LineBufferTask::execute () { try { // // Uncompress the data, if necessary // if (_lineBuffer->uncompressedData == 0) { size_t uncompressedSize = 0; int maxY = min (_lineBuffer->maxY, _ifd->maxY); for (int i = _lineBuffer->minY - _ifd->minY; i <= maxY - _ifd->minY; ++i) { uncompressedSize += _ifd->bytesPerLine[i]; } if (_lineBuffer->compressor && static_cast(_lineBuffer->dataSize) < uncompressedSize) { _lineBuffer->format = _lineBuffer->compressor->format(); _lineBuffer->dataSize = _lineBuffer->compressor->uncompress (_lineBuffer->buffer, _lineBuffer->dataSize, _lineBuffer->minY, _lineBuffer->uncompressedData); } else { // // If the line is uncompressed, it's in XDR format, // regardless of the compressor's output format. // _lineBuffer->format = Compressor::XDR; _lineBuffer->uncompressedData = _lineBuffer->buffer; } } int yStart, yStop, dy; if (_ifd->lineOrder == INCREASING_Y) { yStart = _scanLineMin; yStop = _scanLineMax + 1; dy = 1; } else { yStart = _scanLineMax; yStop = _scanLineMin - 1; dy = -1; } for (int y = yStart; y != yStop; y += dy) { // // Convert one scan line's worth of pixel data back // from the machine-independent representation, and // store the result in the frame buffer. // const char *readPtr = _lineBuffer->uncompressedData + _ifd->offsetInLineBuffer[y - _ifd->minY]; // // Iterate over all image channels. // for (unsigned int i = 0; i < _ifd->slices.size(); ++i) { // // Test if scan line y of this channel contains any data // (the scan line contains data only if y % ySampling == 0). // const InSliceInfo &slice = _ifd->slices[i]; if (modp (y, slice.ySampling) != 0) continue; // // Find the x coordinates of the leftmost and rightmost // sampled pixels (i.e. pixels within the data window // for which x % xSampling == 0). // int dMinX = divp (_ifd->minX, slice.xSampling); int dMaxX = divp (_ifd->maxX, slice.xSampling); // // Fill the frame buffer with pixel data. // if (slice.skip) { // // The file contains data for this channel, but // the frame buffer contains no slice for this channel. // skipChannel (readPtr, slice.typeInFile, dMaxX - dMinX + 1); } else { // // The frame buffer contains a slice for this channel. // intptr_t base = reinterpret_cast(slice.base); intptr_t linePtr = base + intptr_t( divp (y, slice.ySampling) ) * intptr_t( slice.yStride ); char *writePtr = reinterpret_cast (linePtr + intptr_t( dMinX ) * intptr_t( slice.xStride )); char *endPtr = reinterpret_cast (linePtr + intptr_t( dMaxX ) * intptr_t( slice.xStride )); copyIntoFrameBuffer (readPtr, writePtr, endPtr, slice.xStride, slice.fill, slice.fillValue, _lineBuffer->format, slice.typeInFrameBuffer, slice.typeInFile); } } } } catch (std::exception &e) { if (!_lineBuffer->hasException) { _lineBuffer->exception = e.what(); _lineBuffer->hasException = true; } } catch (...) { if (!_lineBuffer->hasException) { _lineBuffer->exception = \"unrecognized exception\"; _lineBuffer->hasException = true; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336928, "input": "rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts) { rb_econv_t *ec; rb_econv_result_t ret; long len; VALUE newstr; const unsigned char *sp; unsigned char *dp; if (!to) return str; if (from == to) return str; if ((rb_enc_asciicompat(to) && ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) || to == rb_ascii8bit_encoding()) { if (STR_ENC_GET(str) != to) { str = rb_str_dup(str); rb_enc_associate(str, to); } return str; } len = RSTRING_LEN(str); newstr = rb_str_new(0, len); retry: ec = rb_econv_open_opts(from->name, to->name, ecflags, ecopts); if (!ec) return str; sp = (unsigned char*)RSTRING_PTR(str); dp = (unsigned char*)RSTRING_PTR(newstr); ret = rb_econv_convert(ec, &sp, (unsigned char*)RSTRING_END(str), &dp, (unsigned char*)RSTRING_END(newstr), 0); rb_econv_close(ec); switch (ret) { case econv_destination_buffer_full: /* destination buffer short */ len *= 2; rb_str_resize(newstr, len); goto retry; case econv_finished: len = dp - (unsigned char*)RSTRING_PTR(newstr); rb_str_set_len(newstr, len); rb_enc_associate(newstr, to); return newstr; default: /* some error, return original */ return str; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 235730, "input": "explicit FFTBase(OpKernelConstruction* ctx) : OpKernel(ctx) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409224, "input": "struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id) { struct uvc_entity *entity; list_for_each_entry(entity, &dev->entities, list) { if (entity->id == id) return entity; } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197039, "input": "const char *enc_untrusted_inet_ntop(int af, const void *src, char *dst, socklen_t size) { if (!src || !dst) { errno = EFAULT; return nullptr; } size_t src_size = 0; if (af == AF_INET) { src_size = sizeof(struct in_addr); } else if (af == AF_INET6) { src_size = sizeof(struct in6_addr); } else { errno = EAFNOSUPPORT; return nullptr; } MessageWriter input; input.Push(TokLinuxAfFamily(af)); input.PushByReference(Extent{reinterpret_cast(src), src_size}); input.Push(size); MessageReader output; const auto status = NonSystemCallDispatcher( ::asylo::host_call::kInetNtopHandler, &input, &output); CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2); auto result = output.next(); int klinux_errno = output.next(); if (result.empty()) { errno = FromkLinuxErrorNumber(klinux_errno); return nullptr; } memcpy(dst, result.data(), std::min(static_cast(size), static_cast(INET6_ADDRSTRLEN))); return dst; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "An out of bounds read on the enc_untrusted_inet_ntop function allows an attack to extend the result size that is used by memcpy() to read memory from within the enclave heap. We recommend upgrading past commit 6ff3b77ffe110a33a2f93848a6333f33616f02c4", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-8939"}} -{"idx": 199840, "input": "static __latent_entropy struct task_struct *copy_process( struct pid *pid, int trace, int node, struct kernel_clone_args *args) { int pidfd = -1, retval; struct task_struct *p; struct multiprocess_signals delayed; struct file *pidfile = NULL; u64 clone_flags = args->flags; struct nsproxy *nsp = current->nsproxy; /* * Don't allow sharing the root directory with processes in a different * namespace */ if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) return ERR_PTR(-EINVAL); if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS)) return ERR_PTR(-EINVAL); /* * Thread groups must share signals as well, and detached threads * can only be started up within the thread group. */ if ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND)) return ERR_PTR(-EINVAL); /* * Shared signal handlers imply shared VM. By way of the above, * thread groups also imply shared VM. Blocking this case allows * for various simplifications in other code. */ if ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM)) return ERR_PTR(-EINVAL); /* * Siblings of global init remain as zombies on exit since they are * not reaped by their parent (swapper). To solve this and to avoid * multi-rooted process trees, prevent global and container-inits * from creating siblings. */ if ((clone_flags & CLONE_PARENT) && current->signal->flags & SIGNAL_UNKILLABLE) return ERR_PTR(-EINVAL); /* * If the new process will be in a different pid or user namespace * do not allow it to share a thread group with the forking task. */ if (clone_flags & CLONE_THREAD) { if ((clone_flags & (CLONE_NEWUSER | CLONE_NEWPID)) || (task_active_pid_ns(current) != nsp->pid_ns_for_children)) return ERR_PTR(-EINVAL); } /* * If the new process will be in a different time namespace * do not allow it to share VM or a thread group with the forking task. */ if (clone_flags & (CLONE_THREAD | CLONE_VM)) { if (nsp->time_ns != nsp->time_ns_for_children) return ERR_PTR(-EINVAL); } if (clone_flags & CLONE_PIDFD) { /* * - CLONE_DETACHED is blocked so that we can potentially * reuse it later for CLONE_PIDFD. * - CLONE_THREAD is blocked until someone really needs it. */ if (clone_flags & (CLONE_DETACHED | CLONE_THREAD)) return ERR_PTR(-EINVAL); } /* * Force any signals received before this point to be delivered * before the fork happens. Collect up signals sent to multiple * processes that happen during the fork and delay them so that * they appear to happen after the fork. */ sigemptyset(&delayed.signal); INIT_HLIST_NODE(&delayed.node); spin_lock_irq(¤t->sighand->siglock); if (!(clone_flags & CLONE_THREAD)) hlist_add_head(&delayed.node, ¤t->signal->multiprocess); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); retval = -ERESTARTNOINTR; if (signal_pending(current)) goto fork_out; retval = -ENOMEM; p = dup_task_struct(current, node); if (!p) goto fork_out; /* * This _must_ happen before we call free_task(), i.e. before we jump * to any of the bad_fork_* labels. This is to avoid freeing * p->set_child_tid which is (ab)used as a kthread's data pointer for * kernel threads (PF_KTHREAD). */ p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? args->child_tid : NULL; /* * Clear TID on mm_release()? */ p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? args->child_tid : NULL; ftrace_graph_init_task(p); rt_mutex_init_task(p); lockdep_assert_irqs_enabled(); #ifdef CONFIG_PROVE_LOCKING DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); #endif retval = -EAGAIN; if (atomic_read(&p->real_cred->user->processes) >= task_rlimit(p, RLIMIT_NPROC)) { if (p->real_cred->user != INIT_USER && !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) goto bad_fork_free; } current->flags &= ~PF_NPROC_EXCEEDED; retval = copy_creds(p, clone_flags); if (retval < 0) goto bad_fork_free; /* * If multiple threads are within copy_process(), then this check * triggers too late. This doesn't hurt, the check is only there * to stop root fork bombs. */ retval = -EAGAIN; if (data_race(nr_threads >= max_threads)) goto bad_fork_cleanup_count; delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER | PF_IDLE); p->flags |= PF_FORKNOEXEC; INIT_LIST_HEAD(&p->children); INIT_LIST_HEAD(&p->sibling); rcu_copy_process(p); p->vfork_done = NULL; spin_lock_init(&p->alloc_lock); init_sigpending(&p->pending); p->utime = p->stime = p->gtime = 0; #ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME p->utimescaled = p->stimescaled = 0; #endif prev_cputime_init(&p->prev_cputime); #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN seqcount_init(&p->vtime.seqcount); p->vtime.starttime = 0; p->vtime.state = VTIME_INACTIVE; #endif #ifdef CONFIG_IO_URING p->io_uring = NULL; #endif #if defined(SPLIT_RSS_COUNTING) memset(&p->rss_stat, 0, sizeof(p->rss_stat)); #endif p->default_timer_slack_ns = current->timer_slack_ns; #ifdef CONFIG_PSI p->psi_flags = 0; #endif task_io_accounting_init(&p->ioac); acct_clear_integrals(p); posix_cputimers_init(&p->posix_cputimers); p->io_context = NULL; audit_set_context(p, NULL); cgroup_fork(p); #ifdef CONFIG_NUMA p->mempolicy = mpol_dup(p->mempolicy); if (IS_ERR(p->mempolicy)) { retval = PTR_ERR(p->mempolicy); p->mempolicy = NULL; goto bad_fork_cleanup_threadgroup_lock; } #endif #ifdef CONFIG_CPUSETS p->cpuset_mem_spread_rotor = NUMA_NO_NODE; p->cpuset_slab_spread_rotor = NUMA_NO_NODE; seqcount_spinlock_init(&p->mems_allowed_seq, &p->alloc_lock); #endif #ifdef CONFIG_TRACE_IRQFLAGS memset(&p->irqtrace, 0, sizeof(p->irqtrace)); p->irqtrace.hardirq_disable_ip = _THIS_IP_; p->irqtrace.softirq_enable_ip = _THIS_IP_; p->softirqs_enabled = 1; p->softirq_context = 0; #endif p->pagefault_disabled = 0; #ifdef CONFIG_LOCKDEP lockdep_init_task(p); #endif #ifdef CONFIG_DEBUG_MUTEXES p->blocked_on = NULL; /* not blocked yet */ #endif #ifdef CONFIG_BCACHE p->sequential_io = 0; p->sequential_io_avg = 0; #endif /* Perform scheduler related setup. Assign this task to a CPU. */ retval = sched_fork(clone_flags, p); if (retval) goto bad_fork_cleanup_policy; retval = perf_event_init_task(p); if (retval) goto bad_fork_cleanup_policy; retval = audit_alloc(p); if (retval) goto bad_fork_cleanup_perf; /* copy all the process information */ shm_init_task(p); retval = security_task_alloc(p, clone_flags); if (retval) goto bad_fork_cleanup_audit; retval = copy_semundo(clone_flags, p); if (retval) goto bad_fork_cleanup_security; retval = copy_files(clone_flags, p); if (retval) goto bad_fork_cleanup_semundo; retval = copy_fs(clone_flags, p); if (retval) goto bad_fork_cleanup_files; retval = copy_sighand(clone_flags, p); if (retval) goto bad_fork_cleanup_fs; retval = copy_signal(clone_flags, p); if (retval) goto bad_fork_cleanup_sighand; retval = copy_mm(clone_flags, p); if (retval) goto bad_fork_cleanup_signal; retval = copy_namespaces(clone_flags, p); if (retval) goto bad_fork_cleanup_mm; retval = copy_io(clone_flags, p); if (retval) goto bad_fork_cleanup_namespaces; retval = copy_thread(clone_flags, args->stack, args->stack_size, p, args->tls); if (retval) goto bad_fork_cleanup_io; stackleak_task_init(p); if (pid != &init_struct_pid) { pid = alloc_pid(p->nsproxy->pid_ns_for_children, args->set_tid, args->set_tid_size); if (IS_ERR(pid)) { retval = PTR_ERR(pid); goto bad_fork_cleanup_thread; } } /* * This has to happen after we've potentially unshared the file * descriptor table (so that the pidfd doesn't leak into the child * if the fd table isn't shared). */ if (clone_flags & CLONE_PIDFD) { retval = get_unused_fd_flags(O_RDWR | O_CLOEXEC); if (retval < 0) goto bad_fork_free_pid; pidfd = retval; pidfile = anon_inode_getfile(\"[pidfd]\", &pidfd_fops, pid, O_RDWR | O_CLOEXEC); if (IS_ERR(pidfile)) { put_unused_fd(pidfd); retval = PTR_ERR(pidfile); goto bad_fork_free_pid; } get_pid(pid); /* held by pidfile now */ retval = put_user(pidfd, args->pidfd); if (retval) goto bad_fork_put_pidfd; } #ifdef CONFIG_BLOCK p->plug = NULL; #endif futex_init_task(p); /* * sigaltstack should be cleared when sharing the same VM */ if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM) sas_ss_reset(p); /* * Syscall tracing and stepping should be turned off in the * child regardless of CLONE_PTRACE. */ user_disable_single_step(p); clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE); #ifdef TIF_SYSCALL_EMU clear_tsk_thread_flag(p, TIF_SYSCALL_EMU); #endif clear_tsk_latency_tracing(p); /* ok, now we should be set up.. */ p->pid = pid_nr(pid); if (clone_flags & CLONE_THREAD) { p->exit_signal = -1; p->group_leader = current->group_leader; p->tgid = current->tgid; } else { if (clone_flags & CLONE_PARENT) p->exit_signal = current->group_leader->exit_signal; else p->exit_signal = args->exit_signal; p->group_leader = p; p->tgid = p->pid; } p->nr_dirtied = 0; p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10); p->dirty_paused_when = 0; p->pdeath_signal = 0; INIT_LIST_HEAD(&p->thread_group); p->task_works = NULL; /* * Ensure that the cgroup subsystem policies allow the new process to be * forked. It should be noted that the new process's css_set can be changed * between here and cgroup_post_fork() if an organisation operation is in * progress. */ retval = cgroup_can_fork(p, args); if (retval) goto bad_fork_put_pidfd; /* * From this point on we must avoid any synchronous user-space * communication until we take the tasklist-lock. In particular, we do * not want user-space to be able to predict the process start-time by * stalling fork(2) after we recorded the start_time but before it is * visible to the system. */ p->start_time = ktime_get_ns(); p->start_boottime = ktime_get_boottime_ns(); /* * Make it visible to the rest of the system, but dont wake it up yet. * Need tasklist lock for parent etc handling! */ write_lock_irq(&tasklist_lock); /* CLONE_PARENT re-uses the old parent */ if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) { p->real_parent = current->real_parent; p->parent_exec_id = current->parent_exec_id; } else { p->real_parent = current; p->parent_exec_id = current->self_exec_id; } klp_copy_process(p); spin_lock(¤t->sighand->siglock); /* * Copy seccomp details explicitly here, in case they were changed * before holding sighand lock. */ copy_seccomp(p); rseq_fork(p, clone_flags); /* Don't start children in a dying pid namespace */ if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) { retval = -ENOMEM; goto bad_fork_cancel_cgroup; } /* Let kill terminate clone/fork in the middle */ if (fatal_signal_pending(current)) { retval = -EINTR; goto bad_fork_cancel_cgroup; } /* past the last point of failure */ if (pidfile) fd_install(pidfd, pidfile); init_task_pid_links(p); if (likely(p->pid)) { ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); init_task_pid(p, PIDTYPE_PID, pid); if (thread_group_leader(p)) { init_task_pid(p, PIDTYPE_TGID, pid); init_task_pid(p, PIDTYPE_PGID, task_pgrp(current)); init_task_pid(p, PIDTYPE_SID, task_session(current)); if (is_child_reaper(pid)) { ns_of_pid(pid)->child_reaper = p; p->signal->flags |= SIGNAL_UNKILLABLE; } p->signal->shared_pending.signal = delayed.signal; p->signal->tty = tty_kref_get(current->signal->tty); /* * Inherit has_child_subreaper flag under the same * tasklist_lock with adding child to the process tree * for propagate_has_child_subreaper optimization. */ p->signal->has_child_subreaper = p->real_parent->signal->has_child_subreaper || p->real_parent->signal->is_child_subreaper; list_add_tail(&p->sibling, &p->real_parent->children); list_add_tail_rcu(&p->tasks, &init_task.tasks); attach_pid(p, PIDTYPE_TGID); attach_pid(p, PIDTYPE_PGID); attach_pid(p, PIDTYPE_SID); __this_cpu_inc(process_counts); } else { current->signal->nr_threads++; atomic_inc(¤t->signal->live); refcount_inc(¤t->signal->sigcnt); task_join_group_stop(p); list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); list_add_tail_rcu(&p->thread_node, &p->signal->thread_head); } attach_pid(p, PIDTYPE_PID); nr_threads++; } total_forks++; hlist_del_init(&delayed.node); spin_unlock(¤t->sighand->siglock); syscall_tracepoint_update(p); write_unlock_irq(&tasklist_lock); proc_fork_connector(p); sched_post_fork(p); cgroup_post_fork(p, args); perf_event_fork(p); trace_task_newtask(p, clone_flags); uprobe_copy_process(p, clone_flags); copy_oom_score_adj(clone_flags, p); return p; bad_fork_cancel_cgroup: spin_unlock(¤t->sighand->siglock); write_unlock_irq(&tasklist_lock); cgroup_cancel_fork(p, args); bad_fork_put_pidfd: if (clone_flags & CLONE_PIDFD) { fput(pidfile); put_unused_fd(pidfd); } bad_fork_free_pid: if (pid != &init_struct_pid) free_pid(pid); bad_fork_cleanup_thread: exit_thread(p); bad_fork_cleanup_io: if (p->io_context) exit_io_context(p); bad_fork_cleanup_namespaces: exit_task_namespaces(p); bad_fork_cleanup_mm: if (p->mm) { mm_clear_owner(p->mm, p); mmput(p->mm); } bad_fork_cleanup_signal: if (!(clone_flags & CLONE_THREAD)) free_signal_struct(p->signal); bad_fork_cleanup_sighand: __cleanup_sighand(p->sighand); bad_fork_cleanup_fs: exit_fs(p); /* blocking */ bad_fork_cleanup_files: exit_files(p); /* blocking */ bad_fork_cleanup_semundo: exit_sem(p); bad_fork_cleanup_security: security_task_free(p); bad_fork_cleanup_audit: audit_free(p); bad_fork_cleanup_perf: perf_event_free_task(p); bad_fork_cleanup_policy: lockdep_free_task(p); #ifdef CONFIG_NUMA mpol_put(p->mempolicy); bad_fork_cleanup_threadgroup_lock: #endif delayacct_tsk_free(p); bad_fork_cleanup_count: atomic_dec(&p->cred->user->processes); exit_creds(p); bad_fork_free: p->state = TASK_DEAD; put_task_stack(p); delayed_free_task(p); fork_out: spin_lock_irq(¤t->sighand->siglock); hlist_del_init(&delayed.node); spin_unlock_irq(¤t->sighand->siglock); return ERR_PTR(retval); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Initialization"], "explanation": "A flaw possibility of race condition and incorrect initialization of the process id was found in the Linux kernel child/parent process identification handling while filtering signal handlers. A local attacker is able to abuse this flaw to bypass checks to send any signal to a privileged process.", "severity_level": "NoInfo", "cwe": "CWE-665", "cve": "CVE-2020-35508"}} -{"idx": 337023, "input": "rb_str_start_with(int argc, VALUE *argv, VALUE str) { int i; for (i=0; ifield_length; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202139, "input": "ex_put(exarg_T *eap) { // \":0put\" works like \":1put!\". if (eap->line2 == 0) { eap->line2 = 1; eap->forceit = TRUE; } curwin->w_cursor.lnum = eap->line2; do_put(eap->regname, NULL, eap->forceit ? BACKWARD : FORWARD, 1L, PUT_LINE|PUT_CURSLINE); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Heap-based Buffer Overflow"], "explanation": "vim is vulnerable to Heap-based Buffer Overflow", "severity_level": "NoInfo", "cwe": "CWE-122", "cve": "CVE-2021-3927"}} -{"idx": 370078, "input": "boost::intrusive_ptr ExpressionSwitch::parse(ExpressionContext* const expCtx, BSONElement expr, const VariablesParseState& vps) { uassert(40060, str::stream() << \"$switch requires an object as an argument, found: \" << typeName(expr.type()), expr.type() == Object); boost::intrusive_ptr expDefault; std::vector> children; for (auto&& elem : expr.Obj()) { auto field = elem.fieldNameStringData(); if (field == \"branches\") { // Parse each branch separately. uassert(40061, str::stream() << \"$switch expected an array for 'branches', found: \" << typeName(elem.type()), elem.type() == Array); for (auto&& branch : elem.Array()) { uassert(40062, str::stream() << \"$switch expected each branch to be an object, found: \" << typeName(branch.type()), branch.type() == Object); boost::intrusive_ptr switchCase, switchThen; for (auto&& branchElement : branch.Obj()) { auto branchField = branchElement.fieldNameStringData(); if (branchField == \"case\") { switchCase = parseOperand(expCtx, branchElement, vps); } else if (branchField == \"then\") { switchThen = parseOperand(expCtx, branchElement, vps); } else { uasserted(40063, str::stream() << \"$switch found an unknown argument to a branch: \" << branchField); } } uassert(40064, \"$switch requires each branch have a 'case' expression\", switchCase); uassert( 40065, \"$switch requires each branch have a 'then' expression.\", switchThen); children.push_back(std::move(switchCase)); children.push_back(std::move(switchThen)); } } else if (field == \"default\") { // Optional, arbitrary expression. expDefault = parseOperand(expCtx, elem, vps); } else { uasserted(40067, str::stream() << \"$switch found an unknown argument: \" << field); } } children.push_back(std::move(expDefault)); // Obtain references to the case and branch expressions two-by-two from the children vector, // ignore the last. std::vector branches; boost::optional&> first; for (auto&& child : children) { if (first) { branches.emplace_back(*first, child); first = boost::none; } else { first = child; } } uassert(40068, \"$switch requires at least one branch.\", !branches.empty()); return new ExpressionSwitch(expCtx, std::move(children), std::move(branches)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 223181, "input": "TfLiteStatus EvalFloat(TfLiteContext* context, TfLiteNode* node, TfLiteDepthwiseConvParams* params, OpData* data, const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* bias, TfLiteTensor* output) { float output_activation_min, output_activation_max; CalculateActivationRange(params->activation, &output_activation_min, &output_activation_max); DepthwiseParams op_params; op_params.padding_type = PaddingType::kSame; op_params.padding_values.width = data->padding.width; op_params.padding_values.height = data->padding.height; op_params.stride_width = params->stride_width; op_params.stride_height = params->stride_height; op_params.dilation_width_factor = params->dilation_width_factor; op_params.dilation_height_factor = params->dilation_height_factor; op_params.float_activation_min = output_activation_min; op_params.float_activation_max = output_activation_max; TF_LITE_ENSURE_STATUS(ComputeDepthMultiplier(context, input, filter, &op_params.depth_multiplier)); if (kernel_type == kReference) { reference_ops::DepthwiseConv( op_params, GetTensorShape(input), GetTensorData(input), GetTensorShape(filter), GetTensorData(filter), GetTensorShape(bias), GetTensorData(bias), GetTensorShape(output), GetTensorData(output)); } else { optimized_ops::DepthwiseConv( op_params, GetTensorShape(input), GetTensorData(input), GetTensorShape(filter), GetTensorData(filter), GetTensorShape(bias), GetTensorData(bias), GetTensorShape(output), GetTensorData(output), CpuBackendContext::GetFromContext(context)); } return kTfLiteOk; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437036, "input": "u16 screen_glyph(struct vc_data *vc, int offset) { u16 w = scr_readw(screenpos(vc, offset, 1)); u16 c = w & 0xff; if (w & vc->vc_hi_font_mask) c |= 0x100; return c; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370080, "input": "Value ExpressionBinarySize::evaluate(const Document& root, Variables* variables) const { Value arg = _children[0]->evaluate(root, variables); if (arg.nullish()) { return Value(BSONNULL); } uassert(51276, str::stream() << \"$binarySize requires a string or BinData argument, found: \" << typeName(arg.getType()), arg.getType() == BSONType::BinData || arg.getType() == BSONType::String); if (arg.getType() == BSONType::String) { return strLenBytes(arg.getStringData()); } BSONBinData binData = arg.getBinData(); return Value(binData.length); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 227301, "input": "JSONContainerType get_container_type_from_options(int64_t options) { if ((options & k_JSON_FB_STABLE_MAPS) || (options & k_JSON_FB_COLLECTIONS)) { return JSONContainerType::COLLECTIONS; } if (options & k_JSON_FB_HACK_ARRAYS) { return JSONContainerType::HACK_ARRAYS; } if (options & k_JSON_FB_DARRAYS) { return JSONContainerType::DARRAYS; } if (options & k_JSON_FB_DARRAYS_AND_VARRAYS) { return JSONContainerType::DARRAYS_AND_VARRAYS; } if (options & k_JSON_FB_LEGACY_HACK_ARRAYS) { return JSONContainerType::LEGACY_HACK_ARRAYS; } return JSONContainerType::DARRAYS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281530, "input": "static void lrc_destroy_wa_ctx(struct intel_engine_cs *engine) { i915_vma_unpin_and_release(&engine->wa_ctx.vma, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462707, "input": "_gnutls_x509_get_signed_data(ASN1_TYPE src, const gnutls_datum *_der, const char *src_name, gnutls_datum_t * signed_data) { int start, end, result; gnutls_datum_t der; unsigned need_free = 0; if (_der == NULL || _der->size == 0) { result = _gnutls_x509_der_encode(src, \"\", &der, 0); if (result < 0) { gnutls_assert(); return result; } need_free = 1; } else { der.data = _der->data; der.size = _der->size; } /* Get the signed data */ result = asn1_der_decoding_startEnd(src, der.data, der.size, src_name, &start, &end); if (result != ASN1_SUCCESS) { result = _gnutls_asn2err(result); gnutls_assert(); goto cleanup; } result = _gnutls_set_datum(signed_data, &der.data[start], end - start + 1); if (result < 0) { gnutls_assert(); goto cleanup; } result = 0; cleanup: if (need_free != 0) _gnutls_free_datum(&der); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506536, "input": "print_command() { struct value a; /* space printed between two expressions only */ TBOOLEAN need_space = FALSE; char *dataline = NULL; size_t size = 256; size_t len = 0; if (!print_out) print_out = stderr; if (print_out_var != NULL) { /* print to datablock */ dataline = (char *) gp_alloc(size, \"dataline\"); *dataline = NUL; } screen_ok = FALSE; do { ++c_token; if (equals(c_token, \"$\") && isletter(c_token+1) && !equals(c_token+2,\"[\")) { char *datablock_name = parse_datablock_name(); char **line = get_datablock(datablock_name); /* Printing a datablock into itself would cause infinite recursion */ if (print_out_var && !strcmp(datablock_name, print_out_name)) continue; while (line && *line) { if (print_out_var != NULL) append_to_datablock(&print_out_var->udv_value, strdup(*line)); else fprintf(print_out, \"%s\\n\", *line); line++; } continue; } if (type_udv(c_token) == ARRAY && !equals(c_token+1, \"[\")) { udvt_entry *array = add_udv(c_token++); save_array_content(print_out, array->udv_value.v.value_array); continue; } const_express(&a); if (a.type == STRING) { if (dataline != NULL) len = strappend(&dataline, &size, len, a.v.string_val); else fputs(a.v.string_val, print_out); need_space = FALSE; } else { if (need_space) { if (dataline != NULL) len = strappend(&dataline, &size, len, \" \"); else putc(' ', print_out); } if (dataline != NULL) len = strappend(&dataline, &size, len, value_to_str(&a, FALSE)); else disp_value(print_out, &a, FALSE); need_space = TRUE; } free_value(&a); } while (!END_OF_COMMAND && equals(c_token, \",\")); if (dataline != NULL) { append_multiline_to_datablock(&print_out_var->udv_value, dataline); } else { (void) putc('\\n', print_out); fflush(print_out); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 261973, "input": "int RemoveSectionType(int SectionType) { int a; int retval = FALSE; for (a=0;afilelisttype = type; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234084, "input": "static void cleanupServerName(char *buffer, int buffer_len) { u_int i; /* Now all lowecase */ for(i=0; i 0) { where[--digits] = codetab[(v & ((1 << logbase) - 1))]; v >>= logbase; } return v != 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263477, "input": "bool TokLinuxEpollEvent(const struct epoll_event *input, struct klinux_epoll_event *output) { if (!input || !output) return false; output->events = TokLinuxEpollEvents(input->events); if (input->events != 0 && output->events == 0) { return false; } output->data.u64 = input->data.u64; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196673, "input": "void Compute(OpKernelContext* context) override { const float in_min = context->input(2).flat()(0); const float in_max = context->input(3).flat()(0); ImageResizerState st(align_corners_, false); st.ValidateAndCreateOutput(context); if (!context->status().ok()) return; // Return if the output is empty. if (st.output->NumElements() == 0) return; typename TTypes::ConstTensor image_data( context->input(0).tensor()); typename TTypes::Tensor output_data(st.output->tensor()); ResizeBilinear(image_data, st.height_scale, st.width_scale, in_min, in_max, half_pixel_centers_, &output_data); Tensor* out_min = nullptr; OP_REQUIRES_OK(context, context->allocate_output(1, {}, &out_min)); out_min->flat()(0) = in_min; Tensor* out_max = nullptr; OP_REQUIRES_OK(context, context->allocate_output(2, {}, &out_max)); out_max->flat()(0) = in_max; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `QuantizedResizeBilinear` by passing in invalid thresholds for the quantization. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/50711818d2e61ccce012591eeb4fdf93a8496726/tensorflow/core/kernels/quantized_resize_bilinear_op.cc#L705-L706) assumes that the 2 arguments are always valid scalars and tries to access the numeric value directly. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29537"}} -{"idx": 434169, "input": "static BOOL is_accelerated_repeat(PCRE2_SPTR cc) { switch(*cc) { case OP_TYPESTAR: case OP_TYPEMINSTAR: case OP_TYPEPLUS: case OP_TYPEMINPLUS: case OP_TYPEPOSSTAR: case OP_TYPEPOSPLUS: return (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI); case OP_STAR: case OP_MINSTAR: case OP_PLUS: case OP_MINPLUS: case OP_POSSTAR: case OP_POSPLUS: case OP_STARI: case OP_MINSTARI: case OP_PLUSI: case OP_MINPLUSI: case OP_POSSTARI: case OP_POSPLUSI: case OP_NOTSTAR: case OP_NOTMINSTAR: case OP_NOTPLUS: case OP_NOTMINPLUS: case OP_NOTPOSSTAR: case OP_NOTPOSPLUS: case OP_NOTSTARI: case OP_NOTMINSTARI: case OP_NOTPLUSI: case OP_NOTMINPLUSI: case OP_NOTPOSSTARI: case OP_NOTPOSPLUSI: return TRUE; case OP_CLASS: case OP_NCLASS: #if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8 case OP_XCLASS: cc += (*cc == OP_XCLASS) ? GET(cc, 1) : (int)(1 + (32 / sizeof(PCRE2_UCHAR))); #else cc += (1 + (32 / sizeof(PCRE2_UCHAR))); #endif switch(*cc) { case OP_CRSTAR: case OP_CRMINSTAR: case OP_CRPLUS: case OP_CRMINPLUS: case OP_CRPOSSTAR: case OP_CRPOSPLUS: return TRUE; } break; } return FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 258447, "input": "static int pppd_run(struct tunnel *tunnel) { pid_t pid; int amaster; int slave_stderr; #ifdef HAVE_STRUCT_TERMIOS struct termios termp = { .c_cflag = B9600, .c_cc[VTIME] = 0, .c_cc[VMIN] = 1 }; #endif static const char ppp_path[] = PPP_PATH; if (access(ppp_path, F_OK) != 0) { log_error(\"%s: %s.\\n\", ppp_path, strerror(errno)); return 1; } log_debug(\"ppp_path: %s\\n\", ppp_path); slave_stderr = dup(STDERR_FILENO); if (slave_stderr < 0) { log_error(\"slave stderr %s\\n\", strerror(errno)); return 1; } #ifdef HAVE_STRUCT_TERMIOS pid = forkpty(&amaster, NULL, &termp, NULL); #else pid = forkpty(&amaster, NULL, NULL, NULL); #endif if (pid == 0) { // child process struct ofv_varr pppd_args = { 0, 0, NULL }; dup2(slave_stderr, STDERR_FILENO); close(slave_stderr); #if HAVE_USR_SBIN_PPP /* * assume there is a default configuration to start. * Support for taking options from the command line * e.g. the name of the configuration or options * to send interactively to ppp will be added later */ static const char *const v[] = { ppp_path, \"-direct\" }; for (unsigned int i = 0; i < ARRAY_SIZE(v); i++) if (ofv_append_varr(&pppd_args, v[i])) return 1; #endif #if HAVE_USR_SBIN_PPPD if (tunnel->config->pppd_call) { if (ofv_append_varr(&pppd_args, ppp_path)) return 1; if (ofv_append_varr(&pppd_args, \"call\")) return 1; if (ofv_append_varr(&pppd_args, tunnel->config->pppd_call)) return 1; } else { static const char *const v[] = { ppp_path, \"115200\", // speed \":192.0.2.1\", // : \"noipdefault\", \"noaccomp\", \"noauth\", \"default-asyncmap\", \"nopcomp\", \"receive-all\", \"nodefaultroute\", \"nodetach\", \"lcp-max-configure\", \"40\", \"mru\", \"1354\" }; for (unsigned int i = 0; i < ARRAY_SIZE(v); i++) if (ofv_append_varr(&pppd_args, v[i])) return 1; } if (tunnel->config->pppd_use_peerdns) if (ofv_append_varr(&pppd_args, \"usepeerdns\")) return 1; if (tunnel->config->pppd_log) { if (ofv_append_varr(&pppd_args, \"debug\")) return 1; if (ofv_append_varr(&pppd_args, \"logfile\")) return 1; if (ofv_append_varr(&pppd_args, tunnel->config->pppd_log)) return 1; } else { /* * pppd defaults to logging to fd=1, clobbering the * actual PPP data */ if (ofv_append_varr(&pppd_args, \"logfd\")) return 1; if (ofv_append_varr(&pppd_args, \"2\")) return 1; } if (tunnel->config->pppd_plugin) { if (ofv_append_varr(&pppd_args, \"plugin\")) return 1; if (ofv_append_varr(&pppd_args, tunnel->config->pppd_plugin)) return 1; } if (tunnel->config->pppd_ipparam) { if (ofv_append_varr(&pppd_args, \"ipparam\")) return 1; if (ofv_append_varr(&pppd_args, tunnel->config->pppd_ipparam)) return 1; } if (tunnel->config->pppd_ifname) { if (ofv_append_varr(&pppd_args, \"ifname\")) return 1; if (ofv_append_varr(&pppd_args, tunnel->config->pppd_ifname)) return 1; } #endif #if HAVE_USR_SBIN_PPP if (tunnel->config->ppp_system) { if (ofv_append_varr(&pppd_args, tunnel->config->ppp_system)) return 1; } #endif close(tunnel->ssl_socket); execv(pppd_args.data[0], (char *const *)pppd_args.data); free(pppd_args.data); fprintf(stderr, \"execvp: %s\\n\", strerror(errno)); _exit(EXIT_FAILURE); } else { close(slave_stderr); if (pid == -1) { log_error(\"forkpty: %s\\n\", strerror(errno)); return 1; } } // Set non-blocking int flags = fcntl(amaster, F_GETFL, 0); if (flags == -1) flags = 0; if (fcntl(amaster, F_SETFL, flags | O_NONBLOCK) == -1) { log_error(\"fcntl: %s\\n\", strerror(errno)); return 1; } tunnel->pppd_pid = pid; tunnel->pppd_pty = amaster; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 262849, "input": "static void remove_intx_remapping(const struct acrn_vm *vm, uint32_t virt_gsi, enum intx_ctlr vgsi_ctlr) { uint32_t phys_irq; struct ptirq_remapping_info *entry; struct intr_source intr_src; DEFINE_INTX_SID(virt_sid, virt_gsi, vgsi_ctlr); entry = find_ptirq_entry(PTDEV_INTR_INTX, &virt_sid, vm); if (entry != NULL) { if (is_entry_active(entry)) { phys_irq = entry->allocated_pirq; /* disable interrupt */ ioapic_gsi_mask_irq(phys_irq); ptirq_deactivate_entry(entry); intr_src.is_msi = false; intr_src.src.ioapic_id = ioapic_irq_to_ioapic_id(phys_irq); dmar_free_irte(&intr_src, entry->irte_idx); dev_dbg(DBG_LEVEL_IRQ, \"deactive %s intx entry:pgsi=%d, pirq=%d \", (vgsi_ctlr == INTX_CTLR_PIC) ? \"vPIC\" : \"vIOAPIC\", entry->phys_sid.intx_id.gsi, phys_irq); dev_dbg(DBG_LEVEL_IRQ, \"from vm%d vgsi=%d\\n\", entry->vm->vm_id, virt_gsi); } ptirq_release_entry(entry); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416685, "input": "static void php_mysqlnd_chg_user_free_mem(void * _packet, zend_bool stack_allocation TSRMLS_DC) { MYSQLND_PACKET_CHG_USER_RESPONSE * p = (MYSQLND_PACKET_CHG_USER_RESPONSE *) _packet; if (p->new_auth_protocol) { mnd_efree(p->new_auth_protocol); p->new_auth_protocol = NULL; } p->new_auth_protocol_len = 0; if (p->new_auth_protocol_data) { mnd_efree(p->new_auth_protocol_data); p->new_auth_protocol_data = NULL; } p->new_auth_protocol_data_len = 0; if (!stack_allocation) { mnd_pefree(p, p->header.persistent); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439525, "input": "bfad_im_reset_stats(struct Scsi_Host *shost) { struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0]; struct bfad_s *bfad = im_port->bfad; struct bfad_hal_comp fcomp; unsigned long flags; bfa_status_t rc; init_completion(&fcomp.comp); spin_lock_irqsave(&bfad->bfad_lock, flags); rc = bfa_port_clear_stats(BFA_FCPORT(&bfad->bfa), bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); if (rc != BFA_STATUS_OK) return; wait_for_completion(&fcomp.comp); return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206930, "input": "static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image, *image2=NULL, *rotated_image; register Quantum *q; unsigned int status; MATHeader MATLAB_HDR; size_t size; size_t CellType; QuantumInfo *quantum_info; ImageInfo *clone_info; int i; ssize_t ldblk; unsigned char *BImgBuff = NULL; double MinVal, MaxVal; unsigned z, z2; unsigned Frames; int logging; int sample_size; MagickOffsetType filepos=0x80; BlobInfo *blob; size_t one; unsigned int (*ReadBlobXXXLong)(Image *image); unsigned short (*ReadBlobXXXShort)(Image *image); void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data); void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data); assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); logging = LogMagickEvent(CoderEvent,GetMagickModule(),\"enter\"); /* Open image file. */ image = AcquireImage(image_info,exception); status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read MATLAB image. */ quantum_info=(QuantumInfo *) NULL; clone_info=(ImageInfo *) NULL; if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124) ThrowReaderException(CorruptImageError,\"ImproperImageHeader\"); if (strncmp(MATLAB_HDR.identific,\"MATLAB\",6) != 0) { image2=ReadMATImageV4(image_info,image,exception); if (image2 == NULL) goto MATLAB_KO; image=image2; goto END_OF_READING; } MATLAB_HDR.Version = ReadBlobLSBShort(image); if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2) ThrowReaderException(CorruptImageError,\"ImproperImageHeader\"); if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule(),\" Endian %c%c\", MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]); if (!strncmp(MATLAB_HDR.EndianIndicator, \"IM\", 2)) { ReadBlobXXXLong = ReadBlobLSBLong; ReadBlobXXXShort = ReadBlobLSBShort; ReadBlobDoublesXXX = ReadBlobDoublesLSB; ReadBlobFloatsXXX = ReadBlobFloatsLSB; image->endian = LSBEndian; } else if (!strncmp(MATLAB_HDR.EndianIndicator, \"MI\", 2)) { ReadBlobXXXLong = ReadBlobMSBLong; ReadBlobXXXShort = ReadBlobMSBShort; ReadBlobDoublesXXX = ReadBlobDoublesMSB; ReadBlobFloatsXXX = ReadBlobFloatsMSB; image->endian = MSBEndian; } else goto MATLAB_KO; /* unsupported endian */ if (strncmp(MATLAB_HDR.identific, \"MATLAB\", 6)) { MATLAB_KO: clone_info=DestroyImageInfo(clone_info); ThrowReaderException(CorruptImageError,\"ImproperImageHeader\"); } filepos = TellBlob(image); while(!EOFBlob(image)) /* object parser loop */ { Frames = 1; (void) SeekBlob(image,filepos,SEEK_SET); /* printf(\"pos=%X\\n\",TellBlob(image)); */ MATLAB_HDR.DataType = ReadBlobXXXLong(image); if(EOFBlob(image)) break; MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image); if(EOFBlob(image)) break; if((MagickSizeType) (MATLAB_HDR.ObjectSize+filepos) > GetBlobSize(image)) goto MATLAB_KO; filepos += MATLAB_HDR.ObjectSize + 4 + 4; clone_info=CloneImageInfo(image_info); image2 = image; #if defined(MAGICKCORE_ZLIB_DELEGATE) if(MATLAB_HDR.DataType == miCOMPRESSED) { image2 = decompress_block(image,&MATLAB_HDR.ObjectSize,clone_info,exception); if(image2==NULL) continue; MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */ } #endif if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */ MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2); MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF; MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF; MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2); if(image!=image2) MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */ MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2); MATLAB_HDR.SizeX = ReadBlobXXXLong(image2); MATLAB_HDR.SizeY = ReadBlobXXXLong(image2); switch(MATLAB_HDR.DimFlag) { case 8: z2=z=1; break; /* 2D matrix*/ case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/ (void) ReadBlobXXXLong(image2); if(z!=3) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\"); break; case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */ if(z!=3 && z!=1) ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\"); Frames = ReadBlobXXXLong(image2); if (Frames == 0) ThrowReaderException(CorruptImageError,\"ImproperImageHeader\"); break; default: ThrowReaderException(CoderError, \"MultidimensionalMatricesAreNotSupported\"); } MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2); MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2); if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), \"MATLAB_HDR.StructureClass %d\",MATLAB_HDR.StructureClass); if (MATLAB_HDR.StructureClass != mxCHAR_CLASS && MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */ MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */ MATLAB_HDR.StructureClass != mxINT8_CLASS && MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */ MATLAB_HDR.StructureClass != mxINT16_CLASS && MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */ MATLAB_HDR.StructureClass != mxINT32_CLASS && MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */ MATLAB_HDR.StructureClass != mxINT64_CLASS && MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */ ThrowReaderException(CoderError,\"UnsupportedCellTypeInTheMatrix\"); switch (MATLAB_HDR.NameFlag) { case 0: size = ReadBlobXXXLong(image2); /* Object name string size */ size = 4 * (ssize_t) ((size + 3 + 1) / 4); (void) SeekBlob(image2, size, SEEK_CUR); break; case 1: case 2: case 3: case 4: (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */ break; default: goto MATLAB_KO; } CellType = ReadBlobXXXLong(image2); /* Additional object type */ if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \"MATLAB_HDR.CellType: %.20g\",(double) CellType); (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */ NEXT_FRAME: switch (CellType) { case miINT8: case miUINT8: sample_size = 8; if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL) image->depth = 1; else image->depth = 8; /* Byte type cell */ ldblk = (ssize_t) MATLAB_HDR.SizeX; break; case miINT16: case miUINT16: sample_size = 16; image->depth = 16; /* Word type cell */ ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX); break; case miINT32: case miUINT32: sample_size = 32; image->depth = 32; /* Dword type cell */ ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miINT64: case miUINT64: sample_size = 64; image->depth = 64; /* Qword type cell */ ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; case miSINGLE: sample_size = 32; image->depth = 32; /* double type cell */ (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex float type cell */ } ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miDOUBLE: sample_size = 64; image->depth = 64; /* double type cell */ (void) SetImageOption(clone_info,\"quantum:format\",\"floating-point\"); DisableMSCWarning(4127) if (sizeof(double) != 8) RestoreMSCWarning ThrowReaderException(CoderError, \"IncompatibleSizeOfDouble\"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex double type cell */ } ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; default: ThrowReaderException(CoderError, \"UnsupportedCellTypeInTheMatrix\"); } (void) sample_size; image->columns = MATLAB_HDR.SizeX; image->rows = MATLAB_HDR.SizeY; one=1; image->colors = one << image->depth; if (image->columns == 0 || image->rows == 0) goto MATLAB_KO; if((unsigned long)ldblk*MATLAB_HDR.SizeY > MATLAB_HDR.ObjectSize) goto MATLAB_KO; /* Image is gray when no complex flag is set and 2D Matrix */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) { image->type=GrayscaleType; SetImageColorspace(image,GRAYColorspace,exception); } /* If ping is true, then only set image size and colors without reading any image data. */ if (image_info->ping) { size_t temp = image->columns; image->columns = image->rows; image->rows = temp; goto done_reading; /* !!!!!! BAD !!!! */ } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); quantum_info=AcquireQuantumInfo(clone_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\"); /* ----- Load raster data ----- */ BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */ if (BImgBuff == NULL) ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\"); (void) ResetMagickMemory(BImgBuff,0,ldblk*sizeof(double)); MinVal = 0; MaxVal = 0; if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */ { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum); } /* Main loop for reading all scanlines */ if(z==1) z=0; /* read grey scanlines */ /* else read color scanlines */ do { for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception); if (q == (Quantum *) NULL) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), \" MAT set image pixels returns unexpected NULL on a row %u.\", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto done_reading; /* Skip image rotation, when cannot set image pixels */ } if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), \" MAT cannot read scanrow %u from a file.\", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL)) { FixLogical((unsigned char *)BImgBuff,ldblk); if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) { ImportQuantumPixelsFailed: if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), \" MAT failed to ImportQuantumPixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1)); break; } } else { if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) goto ImportQuantumPixelsFailed; if (z<=1 && /* fix only during a last pass z==0 || z==1 */ (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64)) FixSignedValues(image,q,MATLAB_HDR.SizeX); } if (!SyncAuthenticPixels(image,exception)) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), \" MAT failed to sync image pixels for a row %u\", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } } } while(z-- >= 2); ExitLoop: /* Read complex part of numbers here */ if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* Find Min and Max Values for complex parts of floats */ CellType = ReadBlobXXXLong(image2); /* Additional object type */ i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/ if (CellType==miDOUBLE || CellType==miSINGLE) { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal); } if (CellType==miDOUBLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff); InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal, exception); } if (CellType==miSINGLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff); InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal, exception); } } /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) image->type=GrayscaleType; if (image->depth == 1) image->type=BilevelType; if(image2==image) image2 = NULL; /* Remove shadow copy to an image before rotation. */ /* Rotate image. */ rotated_image = RotateImage(image, 90.0, exception); if (rotated_image != (Image *) NULL) { /* Remove page offsets added by RotateImage */ rotated_image->page.x=0; rotated_image->page.y=0; blob = rotated_image->blob; rotated_image->blob = image->blob; rotated_image->colors = image->colors; image->blob = blob; AppendImageToList(&image,rotated_image); DeleteImageFromList(&image); } done_reading: if(image2!=NULL) if(image2!=image) { DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (image->next == (Image *) NULL) break; image=SyncNextImageInList(image); image->columns=image->rows=0; image->colors=0; /* row scan buffer is no longer needed */ RelinquishMagickMemory(BImgBuff); BImgBuff = NULL; if(--Frames>0) { z = z2; if(image2==NULL) image2 = image; goto NEXT_FRAME; } if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */ { /* CloseBlob(image2); */ DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } } RelinquishMagickMemory(BImgBuff); if (quantum_info != (QuantumInfo *) NULL) quantum_info=DestroyQuantumInfo(quantum_info); END_OF_READING: if (clone_info) clone_info=DestroyImageInfo(clone_info); CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=scene++; } if(clone_info != NULL) /* cleanup garbage file from compression */ { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } DestroyImageInfo(clone_info); clone_info = NULL; } if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),\"return\"); if(image==NULL) ThrowReaderException(CorruptImageError,\"ImproperImageHeader\"); return (image); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Missing Release of Resource after Effective Lifetime"], "explanation": "When ImageMagick 7.0.6-1 processes a crafted file in convert, it can lead to a Memory Leak in the ReadMATImage() function in coders/mat.c.", "severity_level": "Medium", "cwe": "CWE-772", "cve": "CVE-2017-11644"}} -{"idx": 267887, "input": "GF_Err stbl_AddShadow(GF_ShadowSyncBox *stsh, u32 sampleNumber, u32 shadowNumber) { GF_StshEntry *ent; u32 i, count; count = gf_list_count(stsh->entries); for (i=0; ientries, i); if (ent->shadowedSampleNumber == shadowNumber) { ent->syncSampleNumber = sampleNumber; return GF_OK; } else if (ent->shadowedSampleNumber > shadowNumber) break; } ent = (GF_StshEntry*)gf_malloc(sizeof(GF_StshEntry)); if (!ent) return GF_OUT_OF_MEM; ent->shadowedSampleNumber = shadowNumber; ent->syncSampleNumber = sampleNumber; if (i == gf_list_count(stsh->entries)) { return gf_list_add(stsh->entries, ent); } else { return gf_list_insert(stsh->entries, ent, i ? i-1 : 0); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267225, "input": "GF_Err gf_isom_update_video_sample_entry_fields(GF_ISOFile *file, u32 track, u32 stsd_idx, u16 revision, u32 vendor, u32 temporalQ, u32 spatialQ, u32 horiz_res, u32 vert_res, u16 frames_per_sample, const char *compressor_name, s16 color_table_index) { GF_TrackBox *trak; GF_MPEGVisualSampleEntryBox *vid_ent; /*get orig sample desc and clone it*/ trak = gf_isom_get_track_from_file(file, track); if (!trak || !stsd_idx) return GF_BAD_PARAM; if (!trak->Media || !trak->Media->handler || !trak->Media->information || !trak->Media->information->sampleTable || !trak->Media->information->sampleTable->SampleDescription) return GF_ISOM_INVALID_FILE; switch (trak->Media->handler->handlerType) { case GF_ISOM_MEDIA_VISUAL: case GF_ISOM_MEDIA_AUXV: case GF_ISOM_MEDIA_PICT: break; default: return GF_BAD_PARAM; } vid_ent = gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, stsd_idx-1); if (!vid_ent) return GF_BAD_PARAM; vid_ent->revision = revision; vid_ent->vendor = vendor; vid_ent->temporal_quality = temporalQ; vid_ent->spatial_quality = spatialQ; vid_ent->horiz_res = horiz_res; vid_ent->vert_res = vert_res; vid_ent->frames_per_sample = frames_per_sample; if (compressor_name) strncpy(vid_ent->compressor_name, compressor_name, 32); vid_ent->color_table_index = color_table_index; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381449, "input": "static void v4l_print_create_buffers(const void *arg, bool write_only) { const struct v4l2_create_buffers *p = arg; pr_cont(\"index=%d, count=%d, memory=%s, \", p->index, p->count, prt_names(p->memory, v4l2_memory_names)); v4l_print_format(&p->format, write_only); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410735, "input": "static inline bool tcp_checksum_complete(struct sk_buff *skb) { return !skb_csum_unnecessary(skb) && __tcp_checksum_complete(skb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328393, "input": "static int nf_tables_delflowtable(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr * const nla[]) { const struct nfgenmsg *nfmsg = nlmsg_data(info->nlh); struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_next(info->net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; struct net *net = info->net; const struct nlattr *attr; struct nft_table *table; struct nft_ctx ctx; if (!nla[NFTA_FLOWTABLE_TABLE] || (!nla[NFTA_FLOWTABLE_NAME] && !nla[NFTA_FLOWTABLE_HANDLE])) return -EINVAL; table = nft_table_lookup(net, nla[NFTA_FLOWTABLE_TABLE], family, genmask, NETLINK_CB(skb).portid); if (IS_ERR(table)) { NL_SET_BAD_ATTR(extack, nla[NFTA_FLOWTABLE_TABLE]); return PTR_ERR(table); } if (nla[NFTA_FLOWTABLE_HANDLE]) { attr = nla[NFTA_FLOWTABLE_HANDLE]; flowtable = nft_flowtable_lookup_byhandle(table, attr, genmask); } else { attr = nla[NFTA_FLOWTABLE_NAME]; flowtable = nft_flowtable_lookup(table, attr, genmask); } if (IS_ERR(flowtable)) { NL_SET_BAD_ATTR(extack, attr); return PTR_ERR(flowtable); } nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla); if (nla[NFTA_FLOWTABLE_HOOK]) return nft_delflowtable_hook(&ctx, flowtable); if (flowtable->use > 0) { NL_SET_BAD_ATTR(extack, attr); return -EBUSY; } return nft_delflowtable(&ctx, flowtable); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 459311, "input": "static void WriteProfile(struct heif_context *context,Image *image, ExceptionInfo *exception) { const char *name; const StringInfo *profile; register ssize_t i; size_t length; struct heif_error error; struct heif_image_handle *image_handle; /* Get image handle. */ image_handle=(struct heif_image_handle *) NULL; error=heif_context_get_primary_image_handle(context,&image_handle); if (error.code != 0) return; /* Save image profile as a APP marker. */ ResetImageProfileIterator(image); for (name=GetNextImageProfile(image); name != (const char *) NULL; ) { profile=GetImageProfile(image,name); length=GetStringInfoLength(profile); if (LocaleCompare(name,\"EXIF\") == 0) { length=GetStringInfoLength(profile); if (length > 65533L) { (void) ThrowMagickException(exception,GetMagickModule(), CoderWarning,\"ExifProfileSizeExceedsLimit\",\"`%s'\", image->filename); length=65533L; } (void) heif_context_add_exif_metadata(context,image_handle, (void*) GetStringInfoDatum(profile),length); } if (LocaleCompare(name,\"XMP\") == 0) { StringInfo *xmp_profile; xmp_profile=StringToStringInfo(xmp_namespace); if (xmp_profile != (StringInfo *) NULL) { if (profile != (StringInfo *) NULL) ConcatenateStringInfo(xmp_profile,profile); GetStringInfoDatum(xmp_profile)[XmpNamespaceExtent]='\\0'; for (i=0; i < (ssize_t) GetStringInfoLength(xmp_profile); i+=65533L) { length=MagickMin(GetStringInfoLength(xmp_profile)-i,65533L); error=heif_context_add_XMP_metadata(context,image_handle, (void*) (GetStringInfoDatum(xmp_profile)+i),length); if (error.code != 0) break; } xmp_profile=DestroyStringInfo(xmp_profile); } } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), \"%s profile: %.20g bytes\",name,(double) GetStringInfoLength(profile)); name=GetNextImageProfile(image); } heif_image_handle_release(image_handle); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514775, "input": "int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp) { const ram_addr_t oldsize = block->used_length; const ram_addr_t unaligned_size = newsize; assert(block); newsize = HOST_PAGE_ALIGN(newsize); if (block->used_length == newsize) { /* * We don't have to resize the ram block (which only knows aligned * sizes), however, we have to notify if the unaligned size changed. */ if (unaligned_size != memory_region_size(block->mr)) { memory_region_set_size(block->mr, unaligned_size); if (block->resized) { block->resized(block->idstr, unaligned_size, block->host); } } return 0; } if (!(block->flags & RAM_RESIZEABLE)) { error_setg_errno(errp, EINVAL, \"Size mismatch: %s: 0x\" RAM_ADDR_FMT \" != 0x\" RAM_ADDR_FMT, block->idstr, newsize, block->used_length); return -EINVAL; } if (block->max_length < newsize) { error_setg_errno(errp, EINVAL, \"Size too large: %s: 0x\" RAM_ADDR_FMT \" > 0x\" RAM_ADDR_FMT, block->idstr, newsize, block->max_length); return -EINVAL; } /* Notify before modifying the ram block and touching the bitmaps. */ if (block->host) { ram_block_notify_resize(block->host, oldsize, newsize); } cpu_physical_memory_clear_dirty_range(block->offset, block->used_length); block->used_length = newsize; cpu_physical_memory_set_dirty_range(block->offset, block->used_length, DIRTY_CLIENTS_ALL); memory_region_set_size(block->mr, unaligned_size); if (block->resized) { block->resized(block->idstr, unaligned_size, block->host); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230217, "input": "getOwnIndexedPropertyFlags(JSObject *self, Runtime *runtime, uint32_t index) { return JSObject::getOwnIndexedPropertyFlags(self, runtime, index); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328523, "input": "static void scalar_min_max_or(struct bpf_reg_state *dst_reg, struct bpf_reg_state *src_reg) { bool src_known = tnum_is_const(src_reg->var_off); bool dst_known = tnum_is_const(dst_reg->var_off); s64 smin_val = src_reg->smin_value; u64 umin_val = src_reg->umin_value; if (src_known && dst_known) { __mark_reg_known(dst_reg, dst_reg->var_off.value | src_reg->var_off.value); return; } /* We get our maximum from the var_off, and our minimum is the * maximum of the operands' minima */ dst_reg->umin_value = max(dst_reg->umin_value, umin_val); dst_reg->umax_value = dst_reg->var_off.value | dst_reg->var_off.mask; if (dst_reg->smin_value < 0 || smin_val < 0) { /* Lose signed bounds when ORing negative numbers, * ain't nobody got time for that. */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { /* ORing two positives gives a positive, so safe to * cast result into s64. */ dst_reg->smin_value = dst_reg->umin_value; dst_reg->smax_value = dst_reg->umax_value; } /* We may learn something more from the var_off */ __update_reg_bounds(dst_reg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394260, "input": "ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], struct nf_conntrack_tuple *tuple, u32 type, u_int8_t l3num, struct nf_conntrack_zone *zone, u_int32_t flags) { struct nlattr *tb[CTA_TUPLE_MAX+1]; int err; memset(tuple, 0, sizeof(*tuple)); err = nla_parse_nested_deprecated(tb, CTA_TUPLE_MAX, cda[type], tuple_nla_policy, NULL); if (err < 0) return err; if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6) return -EOPNOTSUPP; tuple->src.l3num = l3num; if (flags & CTA_FILTER_FLAG(CTA_IP_DST) || flags & CTA_FILTER_FLAG(CTA_IP_SRC)) { if (!tb[CTA_TUPLE_IP]) return -EINVAL; err = ctnetlink_parse_tuple_ip(tb[CTA_TUPLE_IP], tuple, flags); if (err < 0) return err; } if (flags & CTA_FILTER_FLAG(CTA_PROTO_NUM)) { if (!tb[CTA_TUPLE_PROTO]) return -EINVAL; err = ctnetlink_parse_tuple_proto(tb[CTA_TUPLE_PROTO], tuple, flags); if (err < 0) return err; } else if (flags & CTA_FILTER_FLAG(ALL_CTA_PROTO)) { /* Can't manage proto flags without a protonum */ return -EINVAL; } if ((flags & CTA_FILTER_FLAG(CTA_TUPLE_ZONE)) && tb[CTA_TUPLE_ZONE]) { if (!zone) return -EINVAL; err = ctnetlink_parse_tuple_zone(tb[CTA_TUPLE_ZONE], type, zone); if (err < 0) return err; } /* orig and expect tuples get DIR_ORIGINAL */ if (type == CTA_TUPLE_REPLY) tuple->dst.dir = IP_CT_DIR_REPLY; else tuple->dst.dir = IP_CT_DIR_ORIGINAL; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 439910, "input": "ldns_is_rrset(const ldns_rr_list *rr_list) { ldns_rr_type t; ldns_rr_class c; ldns_rdf *o; ldns_rr *tmp; size_t i; if (!rr_list || ldns_rr_list_rr_count(rr_list) == 0) { return false; } tmp = ldns_rr_list_rr(rr_list, 0); t = ldns_rr_get_type(tmp); c = ldns_rr_get_class(tmp); o = ldns_rr_owner(tmp); /* compare these with the rest of the rr_list, start with 1 */ for (i = 1; i < ldns_rr_list_rr_count(rr_list); i++) { tmp = ldns_rr_list_rr(rr_list, i); if (t != ldns_rr_get_type(tmp)) { return false; } if (c != ldns_rr_get_class(tmp)) { return false; } if (ldns_rdf_compare(o, ldns_rr_owner(tmp)) != 0) { return false; } } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398075, "input": "static void sctp_sendmsg_update_sinfo(struct sctp_association *asoc, struct sctp_sndrcvinfo *sinfo, struct sctp_cmsgs *cmsgs) { if (!cmsgs->srinfo && !cmsgs->sinfo) { sinfo->sinfo_stream = asoc->default_stream; sinfo->sinfo_ppid = asoc->default_ppid; sinfo->sinfo_context = asoc->default_context; sinfo->sinfo_assoc_id = sctp_assoc2id(asoc); if (!cmsgs->prinfo) sinfo->sinfo_flags = asoc->default_flags; } if (!cmsgs->srinfo && !cmsgs->prinfo) sinfo->sinfo_timetolive = asoc->default_timetolive; if (cmsgs->authinfo) { /* Reuse sinfo_tsn to indicate that authinfo was set and * sinfo_ssn to save the keyid on tx path. */ sinfo->sinfo_tsn = 1; sinfo->sinfo_ssn = cmsgs->authinfo->auth_keynumber; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318217, "input": "int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data) { return addattr_l(n, maxlen, type, &data, sizeof(__u32)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 404049, "input": "static void kvm_inc_notifier_count(struct kvm *kvm, unsigned long start, unsigned long end) { /* * The count increase must become visible at unlock time as no * spte can be established without taking the mmu_lock and * count is also read inside the mmu_lock critical section. */ kvm->mmu_notifier_count++; if (likely(kvm->mmu_notifier_count == 1)) { kvm->mmu_notifier_range_start = start; kvm->mmu_notifier_range_end = end; } else { /* * Fully tracking multiple concurrent ranges has dimishing * returns. Keep things simple and just find the minimal range * which includes the current and new ranges. As there won't be * enough information to subtract a range after its invalidate * completes, any ranges invalidated concurrently will * accumulate and persist until all outstanding invalidates * complete. */ kvm->mmu_notifier_range_start = min(kvm->mmu_notifier_range_start, start); kvm->mmu_notifier_range_end = max(kvm->mmu_notifier_range_end, end); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393091, "input": "TEST_F(QueryPlannerTest, OrOfAnd4) { addIndex(BSON(\"a\" << 1 << \"b\" << 1)); runQuery( fromjson(\"{$or: [{a:{$gt:1,$lt:5}, b:{$gt:0,$lt:3}, c:6}, \" \"{a:3, b:{$gt:1,$lt:2}, c:{$gt:0,$lt:10}}]}\")); assertNumSolutions(2U); assertSolutionExists(\"{cscan: {dir: 1}}\"); assertSolutionExists( \"{or: {nodes: [\" \"{fetch: {filter: {c:6}, node: {ixscan: {pattern: {a:1,b:1}, \" \"bounds: {a: [[1,5,false,false]], b: [[0,3,false,false]]}}}}}, \" \"{fetch: {filter: {$and:[{c:{$lt:10}},{c:{$gt:0}}]}, node: \" \"{ixscan: {pattern: {a:1,b:1}, \" \" bounds: {a:[[3,3,true,true]], b:[[1,2,false,false]]}}}}}]}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412798, "input": "_tiffReadProc(thandle_t hdata, tdata_t buf, tsize_t size) { TIFFSTATE *state = (TIFFSTATE *)hdata; tsize_t to_read; TRACE((\"_tiffReadProc: %d \\n\", (int)size)); dump_state(state); if (state->loc > state->eof) { TIFFError(\"_tiffReadProc\", \"Invalid Read at loc %d, eof: %d\", state->loc, state->eof); return 0; } to_read = min(size, min(state->size, (tsize_t)state->eof) - (tsize_t)state->loc); TRACE((\"to_read: %d\\n\", (int)to_read)); _TIFFmemcpy(buf, (UINT8 *)state->data + state->loc, to_read); state->loc += (toff_t)to_read; TRACE((\"location: %u\\n\", (uint)state->loc)); return to_read; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 270174, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& data = ctx->input(0); OP_REQUIRES(ctx, data.dims() <= 2, errors::InvalidArgument( \"Shape must be at most rank 2 but is rank \", data.dims())); const Tensor& size_t = ctx->input(1); const Tensor& weights = ctx->input(2); Tidx size = size_t.scalar()(); OP_REQUIRES( ctx, size >= 0, errors::InvalidArgument(\"size (\", size, \") must be non-negative\")); Tensor* out_t; functor::SetZeroFunctor fill; if (data.dims() == 1) { OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({size}), &out_t)); auto out = out_t->flat(); fill(ctx->eigen_device(), out); if (binary_output_) { OP_REQUIRES_OK( ctx, functor::BincountFunctor::Compute( ctx, data.flat(), weights.flat(), out, size)); } else { OP_REQUIRES_OK( ctx, functor::BincountFunctor::Compute( ctx, data.flat(), weights.flat(), out, size)); } } else if (data.dims() == 2) { const int64 num_rows = data.dim_size(0); auto weight_matrix = (weights.NumElements() == 0) ? weights.shaped(gtl::InlinedVector(2, 0)) : weights.matrix(); OP_REQUIRES_OK( ctx, ctx->allocate_output(0, TensorShape({num_rows, size}), &out_t)); auto out = out_t->matrix(); fill(ctx->eigen_device(), out_t->flat()); if (binary_output_) { OP_REQUIRES_OK( ctx, functor::BincountReduceFunctor::Compute( ctx, data.matrix(), weight_matrix, out, size)); } else { OP_REQUIRES_OK( ctx, functor::BincountReduceFunctor::Compute( ctx, data.matrix(), weight_matrix, out, size)); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234465, "input": "ff_layout_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, gfp_t gfp_flags) { struct nfs4_ff_layout_ds *dsaddr; dsaddr = nfs4_ff_alloc_deviceid_node(server, pdev, gfp_flags); if (!dsaddr) return NULL; return &dsaddr->id_node; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 89082, "input": "void WebGraphicsContext3DDefaultImpl::texImage2D(unsigned target, unsigned level, unsigned internalFormat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, const void* pixels) { OwnArrayPtr zero; if (!pixels) { size_t size = imageSizeInBytes(width, height, format, type); zero.set(new uint8[size]); memset(zero.get(), 0, size); pixels = zero.get(); } glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393068, "input": "TEST_F(QueryPlannerTest, IndexBoundsUnindexedSortHint) { addIndex(BSON(\"a\" << 1)); runQuerySortHint(fromjson(\"{$or: [{a: 1}, {a: 2}]}\"), BSON(\"b\" << 1), BSON(\"a\" << 1)); assertNumSolutions(1U); assertSolutionExists( \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: {fetch: \" \"{filter: null, node: {ixscan: {filter: null, \" \"pattern: {a:1}, bounds: {a: [[1,1,true,true], [2,2,true,true]]}}}}}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295109, "input": "static BOOL update_write_pointer_large(wStream* s, const POINTER_LARGE_UPDATE* pointer) { if (!Stream_EnsureRemainingCapacity(s, 32 + pointer->lengthAndMask + pointer->lengthXorMask)) return FALSE; Stream_Write_UINT16(s, pointer->xorBpp); Stream_Write_UINT16(s, pointer->cacheIndex); Stream_Write_UINT16(s, pointer->hotSpotX); Stream_Write_UINT16(s, pointer->hotSpotY); Stream_Write_UINT16(s, pointer->width); Stream_Write_UINT16(s, pointer->height); Stream_Write_UINT32(s, pointer->lengthAndMask); Stream_Write_UINT32(s, pointer->lengthXorMask); Stream_Write(s, pointer->xorMaskData, pointer->lengthXorMask); Stream_Write(s, pointer->andMaskData, pointer->lengthAndMask); Stream_Write_UINT8(s, 0); /* pad (1 byte) */ return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336984, "input": "rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src) { /* this function is designed for copying encoding and coderange * from src to new string \"dest\" which is made from the part of src. */ str_enc_copy(dest, src); switch (ENC_CODERANGE(src)) { case ENC_CODERANGE_7BIT: ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT); break; case ENC_CODERANGE_VALID: if (!rb_enc_asciicompat(STR_ENC_GET(src)) || search_nonascii(RSTRING_PTR(dest), RSTRING_END(dest))) ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID); else ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT); break; default: if (RSTRING_LEN(dest) == 0) { if (!rb_enc_asciicompat(STR_ENC_GET(src))) ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID); else ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT); } break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 216521, "input": "int X509_verify_cert(X509_STORE_CTX *ctx) { X509 *x, *xtmp, *xtmp2, *chain_ss = NULL; int bad_chain = 0; X509_VERIFY_PARAM *param = ctx->param; int depth, i, ok = 0; int num, j, retry; int (*cb) (int xok, X509_STORE_CTX *xctx); STACK_OF(X509) *sktmp = NULL; if (ctx->cert == NULL) { X509err(X509_F_X509_VERIFY_CERT, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY); return -1; } if (ctx->chain != NULL) { /* * This X509_STORE_CTX has already been used to verify a cert. We * cannot do another one. */ X509err(X509_F_X509_VERIFY_CERT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return -1; } cb = ctx->verify_cb; /* * first we make sure the chain we are going to build is present and that * the first entry is in place */ if (((ctx->chain = sk_X509_new_null()) == NULL) || (!sk_X509_push(ctx->chain, ctx->cert))) { X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); goto end; } CRYPTO_add(&ctx->cert->references, 1, CRYPTO_LOCK_X509); ctx->last_untrusted = 1; /* We use a temporary STACK so we can chop and hack at it */ if (ctx->untrusted != NULL && (sktmp = sk_X509_dup(ctx->untrusted)) == NULL) { X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); goto end; } num = sk_X509_num(ctx->chain); x = sk_X509_value(ctx->chain, num - 1); depth = param->depth; for (;;) { /* If we have enough, we break */ if (depth < num) break; /* FIXME: If this happens, we should take * note of it and, if appropriate, use the * X509_V_ERR_CERT_CHAIN_TOO_LONG error code * later. */ /* If we are self signed, we break */ if (ctx->check_issued(ctx, x, x)) break; /* If we were passed a cert chain, use it first */ if (ctx->untrusted != NULL) { xtmp = find_issuer(ctx, sktmp, x); if (xtmp != NULL) { if (!sk_X509_push(ctx->chain, xtmp)) { X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); goto end; } CRYPTO_add(&xtmp->references, 1, CRYPTO_LOCK_X509); (void)sk_X509_delete_ptr(sktmp, xtmp); ctx->last_untrusted++; x = xtmp; num++; /* * reparse the full chain for the next one */ continue; } } break; } /* Remember how many untrusted certs we have */ j = num; /* * at this point, chain should contain a list of untrusted certificates. * We now need to add at least one trusted one, if possible, otherwise we * complain. */ do { /* * Examine last certificate in chain and see if it is self signed. */ i = sk_X509_num(ctx->chain); x = sk_X509_value(ctx->chain, i - 1); if (ctx->check_issued(ctx, x, x)) { /* we have a self signed certificate */ if (sk_X509_num(ctx->chain) == 1) { /* * We have a single self signed certificate: see if we can * find it in the store. We must have an exact match to avoid * possible impersonation. */ ok = ctx->get_issuer(&xtmp, ctx, x); if ((ok <= 0) || X509_cmp(x, xtmp)) { ctx->error = X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT; ctx->current_cert = x; ctx->error_depth = i - 1; if (ok == 1) X509_free(xtmp); bad_chain = 1; ok = cb(0, ctx); if (!ok) goto end; } else { /* * We have a match: replace certificate with store * version so we get any trust settings. */ X509_free(x); x = xtmp; (void)sk_X509_set(ctx->chain, i - 1, x); ctx->last_untrusted = 0; } } else { /* * extract and save self signed certificate for later use */ chain_ss = sk_X509_pop(ctx->chain); ctx->last_untrusted--; num--; j--; x = sk_X509_value(ctx->chain, num - 1); } } /* We now lookup certs from the certificate store */ for (;;) { /* If we have enough, we break */ if (depth < num) break; /* If we are self signed, we break */ if (ctx->check_issued(ctx, x, x)) break; ok = ctx->get_issuer(&xtmp, ctx, x); if (ok < 0) return ok; if (ok == 0) break; x = xtmp; if (!sk_X509_push(ctx->chain, x)) { X509_free(xtmp); X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); return 0; } num++; } /* * If we haven't got a least one certificate from our store then check * if there is an alternative chain that could be used. We only do this * if the user hasn't switched off alternate chain checking */ retry = 0; if (j == ctx->last_untrusted && !(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS)) { while (j-- > 1) { xtmp2 = sk_X509_value(ctx->chain, j - 1); ok = ctx->get_issuer(&xtmp, ctx, xtmp2); if (ok < 0) goto end; /* Check if we found an alternate chain */ if (ok > 0) { /* * Free up the found cert we'll add it again later */ X509_free(xtmp); /* * Dump all the certs above this point - we've found an * alternate chain */ while (num > j) { xtmp = sk_X509_pop(ctx->chain); X509_free(xtmp); num--; } ctx->last_untrusted = sk_X509_num(ctx->chain); retry = 1; break; } } } } while (retry); /* Is last certificate looked up self signed? */ if (!ctx->check_issued(ctx, x, x)) { if ((chain_ss == NULL) || !ctx->check_issued(ctx, x, chain_ss)) { if (ctx->last_untrusted >= num) ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; else ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT; ctx->current_cert = x; } else { sk_X509_push(ctx->chain, chain_ss); num++; ctx->last_untrusted = num; ctx->current_cert = chain_ss; ctx->error = X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN; chain_ss = NULL; } ctx->error_depth = num - 1; bad_chain = 1; ok = cb(0, ctx); if (!ok) goto end; } /* We have the chain complete: now we need to check its purpose */ ok = check_chain_extensions(ctx); if (!ok) goto end; /* Check name constraints */ ok = check_name_constraints(ctx); if (!ok) goto end; /* The chain extensions are OK: check trust */ if (param->trust > 0) ok = check_trust(ctx); if (!ok) goto end; /* We may as well copy down any DSA parameters that are required */ X509_get_pubkey_parameters(NULL, ctx->chain); /* * Check revocation status: we do this after copying parameters because * they may be needed for CRL signature verification. */ ok = ctx->check_revocation(ctx); if (!ok) goto end; /* At this point, we have a chain and need to verify it */ if (ctx->verify != NULL) ok = ctx->verify(ctx); else ok = internal_verify(ctx); if (!ok) goto end; #ifndef OPENSSL_NO_RFC3779 /* RFC 3779 path validation, now that CRL check has been done */ ok = v3_asid_validate_path(ctx); if (!ok) goto end; ok = v3_addr_validate_path(ctx); if (!ok) goto end; #endif /* If we get this far evaluate policies */ if (!bad_chain && (ctx->param->flags & X509_V_FLAG_POLICY_CHECK)) ok = ctx->check_policy(ctx); if (!ok) goto end; if (0) { end: X509_get_pubkey_parameters(NULL, ctx->chain); } if (sktmp != NULL) sk_X509_free(sktmp); if (chain_ss != NULL) X509_free(chain_ss); return ok; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "The X509_verify_cert function in crypto/x509/x509_vfy.c in OpenSSL 1.0.1n, 1.0.1o, 1.0.2b, and 1.0.2c does not properly process X.509 Basic Constraints cA values during identification of alternative certificate chains, which allows remote attackers to spoof a Certification Authority role and trigger unintended certificate verifications via a valid leaf certificate.", "severity_level": "Medium", "cwe": "CWE-254", "cve": "CVE-2015-1793"}} -{"idx": 434199, "input": "static void compile_matchingpath(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, backtrack_common *parent) { DEFINE_COMPILER; backtrack_common *backtrack; BOOL has_then_trap = FALSE; then_trap_backtrack *save_then_trap = NULL; SLJIT_ASSERT(*ccend == OP_END || (*ccend >= OP_ALT && *ccend <= OP_KETRPOS)); if (common->has_then && common->then_offsets[cc - common->start] != 0) { SLJIT_ASSERT(*ccend != OP_END && common->control_head_ptr != 0); has_then_trap = TRUE; save_then_trap = common->then_trap; /* Tail item on backtrack. */ compile_then_trap_matchingpath(common, cc, ccend, parent); } while (cc < ccend) { switch(*cc) { case OP_SOD: case OP_SOM: case OP_NOT_WORD_BOUNDARY: case OP_WORD_BOUNDARY: case OP_EODN: case OP_EOD: case OP_DOLL: case OP_DOLLM: case OP_CIRC: case OP_CIRCM: case OP_REVERSE: cc = compile_simple_assertion_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks); break; case OP_NOT_DIGIT: case OP_DIGIT: case OP_NOT_WHITESPACE: case OP_WHITESPACE: case OP_NOT_WORDCHAR: case OP_WORDCHAR: case OP_ANY: case OP_ALLANY: case OP_ANYBYTE: case OP_NOTPROP: case OP_PROP: case OP_ANYNL: case OP_NOT_HSPACE: case OP_HSPACE: case OP_NOT_VSPACE: case OP_VSPACE: case OP_EXTUNI: case OP_NOT: case OP_NOTI: cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE); break; case OP_SET_SOM: PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); allocate_stack(common, 1); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); cc++; break; case OP_CHAR: case OP_CHARI: if (common->mode == PCRE2_JIT_COMPLETE) cc = compile_charn_matchingpath(common, cc, ccend, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks); else cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE); break; case OP_STAR: case OP_MINSTAR: case OP_PLUS: case OP_MINPLUS: case OP_QUERY: case OP_MINQUERY: case OP_UPTO: case OP_MINUPTO: case OP_EXACT: case OP_POSSTAR: case OP_POSPLUS: case OP_POSQUERY: case OP_POSUPTO: case OP_STARI: case OP_MINSTARI: case OP_PLUSI: case OP_MINPLUSI: case OP_QUERYI: case OP_MINQUERYI: case OP_UPTOI: case OP_MINUPTOI: case OP_EXACTI: case OP_POSSTARI: case OP_POSPLUSI: case OP_POSQUERYI: case OP_POSUPTOI: case OP_NOTSTAR: case OP_NOTMINSTAR: case OP_NOTPLUS: case OP_NOTMINPLUS: case OP_NOTQUERY: case OP_NOTMINQUERY: case OP_NOTUPTO: case OP_NOTMINUPTO: case OP_NOTEXACT: case OP_NOTPOSSTAR: case OP_NOTPOSPLUS: case OP_NOTPOSQUERY: case OP_NOTPOSUPTO: case OP_NOTSTARI: case OP_NOTMINSTARI: case OP_NOTPLUSI: case OP_NOTMINPLUSI: case OP_NOTQUERYI: case OP_NOTMINQUERYI: case OP_NOTUPTOI: case OP_NOTMINUPTOI: case OP_NOTEXACTI: case OP_NOTPOSSTARI: case OP_NOTPOSPLUSI: case OP_NOTPOSQUERYI: case OP_NOTPOSUPTOI: case OP_TYPESTAR: case OP_TYPEMINSTAR: case OP_TYPEPLUS: case OP_TYPEMINPLUS: case OP_TYPEQUERY: case OP_TYPEMINQUERY: case OP_TYPEUPTO: case OP_TYPEMINUPTO: case OP_TYPEEXACT: case OP_TYPEPOSSTAR: case OP_TYPEPOSPLUS: case OP_TYPEPOSQUERY: case OP_TYPEPOSUPTO: cc = compile_iterator_matchingpath(common, cc, parent); break; case OP_CLASS: case OP_NCLASS: if (cc[1 + (32 / sizeof(PCRE2_UCHAR))] >= OP_CRSTAR && cc[1 + (32 / sizeof(PCRE2_UCHAR))] <= OP_CRPOSRANGE) cc = compile_iterator_matchingpath(common, cc, parent); else cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE); break; #if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32 case OP_XCLASS: if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRPOSRANGE) cc = compile_iterator_matchingpath(common, cc, parent); else cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE); break; #endif case OP_REF: case OP_REFI: if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRPOSRANGE) cc = compile_ref_iterator_matchingpath(common, cc, parent); else { compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE); cc += 1 + IMM2_SIZE; } break; case OP_DNREF: case OP_DNREFI: if (cc[1 + 2 * IMM2_SIZE] >= OP_CRSTAR && cc[1 + 2 * IMM2_SIZE] <= OP_CRPOSRANGE) cc = compile_ref_iterator_matchingpath(common, cc, parent); else { compile_dnref_search(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks); compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE); cc += 1 + 2 * IMM2_SIZE; } break; case OP_RECURSE: cc = compile_recurse_matchingpath(common, cc, parent); break; case OP_CALLOUT: case OP_CALLOUT_STR: cc = compile_callout_matchingpath(common, cc, parent); break; case OP_ASSERT: case OP_ASSERT_NOT: case OP_ASSERTBACK: case OP_ASSERTBACK_NOT: PUSH_BACKTRACK_NOVALUE(sizeof(assert_backtrack), cc); cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE); break; case OP_BRAMINZERO: PUSH_BACKTRACK_NOVALUE(sizeof(braminzero_backtrack), cc); cc = bracketend(cc + 1); if (*(cc - 1 - LINK_SIZE) != OP_KETRMIN) { allocate_stack(common, 1); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); } else { allocate_stack(common, 2); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), STR_PTR, 0); } BACKTRACK_AS(braminzero_backtrack)->matchingpath = LABEL(); count_match(common); break; case OP_ONCE: case OP_BRA: case OP_CBRA: case OP_COND: case OP_SBRA: case OP_SCBRA: case OP_SCOND: cc = compile_bracket_matchingpath(common, cc, parent); break; case OP_BRAZERO: if (cc[1] > OP_ASSERTBACK_NOT) cc = compile_bracket_matchingpath(common, cc, parent); else { PUSH_BACKTRACK_NOVALUE(sizeof(assert_backtrack), cc); cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE); } break; case OP_BRAPOS: case OP_CBRAPOS: case OP_SBRAPOS: case OP_SCBRAPOS: case OP_BRAPOSZERO: cc = compile_bracketpos_matchingpath(common, cc, parent); break; case OP_MARK: PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc); SLJIT_ASSERT(common->mark_ptr != 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); allocate_stack(common, common->has_skip_arg ? 5 : 1); OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2)); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); if (common->has_skip_arg) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, type_mark); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), SLJIT_IMM, (sljit_sw)(cc + 2)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(3), STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0); } cc += 1 + 2 + cc[1]; break; case OP_PRUNE: case OP_PRUNE_ARG: case OP_SKIP: case OP_SKIP_ARG: case OP_THEN: case OP_THEN_ARG: case OP_COMMIT: case OP_COMMIT_ARG: cc = compile_control_verb_matchingpath(common, cc, parent); break; case OP_FAIL: case OP_ACCEPT: case OP_ASSERT_ACCEPT: cc = compile_fail_accept_matchingpath(common, cc, parent); break; case OP_CLOSE: cc = compile_close_matchingpath(common, cc); break; case OP_SKIPZERO: cc = bracketend(cc + 1); break; default: SLJIT_UNREACHABLE(); return; } if (cc == NULL) return; } if (has_then_trap) { /* Head item on backtrack. */ PUSH_BACKTRACK_NOVALUE(sizeof(then_trap_backtrack), cc); BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode; BACKTRACK_AS(then_trap_backtrack)->then_trap = common->then_trap; common->then_trap = save_then_trap; } SLJIT_ASSERT(cc == ccend); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330243, "input": "ex_cd(exarg_T *eap) { char_u *new_dir; new_dir = eap->arg; #if !defined(UNIX) && !defined(VMS) // for non-UNIX \":cd\" means: print current directory if (*new_dir == NUL) ex_pwd(NULL); else #endif { cdscope_T scope = CDSCOPE_GLOBAL; if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir) scope = CDSCOPE_WINDOW; else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir) scope = CDSCOPE_TABPAGE; if (changedir_func(new_dir, eap->forceit, scope)) { // Echo the new current directory if the command was typed. if (KeyTyped || p_verbose >= 5) ex_pwd(eap); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 299142, "input": "yaffs_validate_config_file(std::map & paramMap){ int offset_field_count; // Make a list of all fields to test std::set integerParams; integerParams.insert(YAFFS_CONFIG_SEQ_NUM_STR); integerParams.insert(YAFFS_CONFIG_OBJ_ID_STR); integerParams.insert(YAFFS_CONFIG_CHUNK_ID_STR); integerParams.insert(YAFFS_CONFIG_PAGE_SIZE_STR); integerParams.insert(YAFFS_CONFIG_SPARE_SIZE_STR); integerParams.insert(YAFFS_CONFIG_CHUNKS_PER_BLOCK_STR); // If the parameter is set, verify that the value is an int for(std::set::iterator it = integerParams.begin();it != integerParams.end();it++){ if((paramMap.find(*it) != paramMap.end()) && (0 != yaffs_validate_integer_field(paramMap[*it]))){ tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS); tsk_error_set_errstr( \"yaffs_validate_config_file: Empty or non-integer value for Yaffs2 parameter \\\"%s\\\". %s\", (*it).c_str(), YAFFS_HELP_MESSAGE); return 1; } } // Check that we have all three spare offset fields, or none of the three offset_field_count = 0; if(paramMap.find(YAFFS_CONFIG_SEQ_NUM_STR) != paramMap.end()){ offset_field_count++; } if(paramMap.find(YAFFS_CONFIG_OBJ_ID_STR) != paramMap.end()){ offset_field_count++; } if(paramMap.find(YAFFS_CONFIG_CHUNK_ID_STR) != paramMap.end()){ offset_field_count++; } if(! ((offset_field_count == 0) || (offset_field_count == 3))){ tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS); tsk_error_set_errstr( \"yaffs_validate_config_file: Require either all three spare offset fields or none. %s\", YAFFS_HELP_MESSAGE); return 1; } // Make sure there aren't any unexpected fields present for(std::map::iterator it = paramMap.begin(); it != paramMap.end();it++){ if(integerParams.find(it->first) == integerParams.end()){ tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS); tsk_error_set_errstr( \"yaffs_validate_config_file: Found unexpected field in config file (\\\"%s\\\"). %s\", it->first.c_str(), YAFFS_HELP_MESSAGE); return 1; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431456, "input": "static int nfs4_xdr_dec_create(struct rpc_rqst *rqstp, struct xdr_stream *xdr, void *data) { struct nfs4_create_res *res = data; struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (status) goto out; status = decode_sequence(xdr, &res->seq_res, rqstp); if (status) goto out; status = decode_putfh(xdr); if (status) goto out; status = decode_create(xdr, &res->dir_cinfo); if (status) goto out; status = decode_getfh(xdr, res->fh); if (status) goto out; decode_getfattr_label(xdr, res->fattr, res->label, res->server); out: return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 386075, "input": "static void rtsx_usb_ms_request(struct memstick_host *msh) { struct rtsx_usb_ms *host = memstick_priv(msh); dev_dbg(ms_dev(host), \"--> %s\\n\", __func__); if (!host->eject) schedule_work(&host->handle_req); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506595, "input": "write_multiline( int x, int y, char *text, JUSTIFY hor, /* horizontal ... */ VERT_JUSTIFY vert, /* ... and vertical just - text in hor direction despite angle */ int angle, /* assume term has already been set for this */ const char *font) /* NULL or \"\" means use default */ { struct termentry *t = term; char *p = text; if (!p) return; /* EAM 9-Feb-2003 - Set font before calculating sizes */ if (font && *font) (*t->set_font) (font); if (vert != JUST_TOP) { /* count lines and adjust y */ int lines = 0; /* number of linefeeds - one fewer than lines */ while (*p) { if (*p++ == '\\n') ++lines; } if (angle) x -= (vert * lines * t->v_char) / 2; else y += (vert * lines * t->v_char) / 2; } for (;;) { /* we will explicitly break out */ if ((text != NULL) && (p = strchr(text, '\\n')) != NULL) *p = 0; /* terminate the string */ if ((*t->justify_text) (hor)) { if (on_page(x, y)) (*t->put_text) (x, y, text); } else { int len = estimate_strlen(text, NULL); int hfix, vfix; if (angle == 0) { hfix = hor * t->h_char * len / 2; vfix = 0; } else { /* Attention: This relies on the numeric values of enum JUSTIFY! */ hfix = hor * t->h_char * len * cos(angle * DEG2RAD) / 2 + 0.5; vfix = hor * t->v_char * len * sin(angle * DEG2RAD) / 2 + 0.5; } if (on_page(x - hfix, y - vfix)) (*t->put_text) (x - hfix, y - vfix, text); } if (angle == 90 || angle == TEXT_VERTICAL) x += t->v_char; else if (angle == -90 || angle == -TEXT_VERTICAL) x -= t->v_char; else y -= t->v_char; if (!p) break; else { /* put it back */ *p = '\\n'; } text = p + 1; } /* unconditional branch back to the for(;;) - just a goto ! */ if (font && *font) (*t->set_font) (\"\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330252, "input": "eval_vars( char_u *src, // pointer into commandline char_u *srcstart, // beginning of valid memory for src int *usedlen, // characters after src that are used linenr_T *lnump, // line number for :e command, or NULL char **errormsg, // pointer to error message int *escaped) // return value has escaped white space (can // be NULL) { int i; char_u *s; char_u *result; char_u *resultbuf = NULL; int resultlen; buf_T *buf; int valid = VALID_HEAD + VALID_PATH; // assume valid result int spec_idx; int tilde_file = FALSE; int skip_mod = FALSE; char_u strbuf[30]; *errormsg = NULL; if (escaped != NULL) *escaped = FALSE; /* * Check if there is something to do. */ spec_idx = find_cmdline_var(src, usedlen); if (spec_idx < 0) // no match { *usedlen = 1; return NULL; } /* * Skip when preceded with a backslash \"\\%\" and \"\\#\". * Note: In \"\\\\%\" the % is also not recognized! */ if (src > srcstart && src[-1] == '\\\\') { *usedlen = 0; STRMOVE(src - 1, src); // remove backslash return NULL; } /* * word or WORD under cursor */ if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD || spec_idx == SPEC_CEXPR) { resultlen = find_ident_under_cursor(&result, spec_idx == SPEC_CWORD ? (FIND_IDENT | FIND_STRING) : spec_idx == SPEC_CEXPR ? (FIND_IDENT | FIND_STRING | FIND_EVAL) : FIND_STRING); if (resultlen == 0) { *errormsg = \"\"; return NULL; } } /* * '#': Alternate file name * '%': Current file name * File name under the cursor * File name for autocommand * and following modifiers */ else { int off = 0; switch (spec_idx) { case SPEC_PERC: #ifdef FEAT_EVAL if (!in_vim9script() || src[1] != '%') #endif { // '%': current file if (curbuf->b_fname == NULL) { result = (char_u *)\"\"; valid = 0; // Must have \":p:h\" to be valid } else { result = curbuf->b_fname; tilde_file = STRCMP(result, \"~\") == 0; } break; } #ifdef FEAT_EVAL // \"%%\" alternate file off = 1; #endif // FALLTHROUGH case SPEC_HASH: // '#' or \"#99\": alternate file if (off == 0 ? src[1] == '#' : src[2] == '%') { // \"##\" or \"%%%\": the argument list result = arg_all(); resultbuf = result; *usedlen = off + 2; if (escaped != NULL) *escaped = TRUE; skip_mod = TRUE; break; } s = src + off + 1; if (*s == '<') // \"#<99\" uses v:oldfiles ++s; i = (int)getdigits(&s); if (s == src + off + 2 && src[off + 1] == '-') // just a minus sign, don't skip over it s--; *usedlen = (int)(s - src); // length of what we expand if (src[off + 1] == '<' && i != 0) { if (*usedlen < off + 2) { // Should we give an error message for # off + 1) *usedlen = off + 1; buf = buflist_findnr(i); if (buf == NULL) { *errormsg = _(\"E194: No alternate file name to substitute for '#'\"); return NULL; } if (lnump != NULL) *lnump = ECMD_LAST; if (buf->b_fname == NULL) { result = (char_u *)\"\"; valid = 0; // Must have \":p:h\" to be valid } else { result = buf->b_fname; tilde_file = STRCMP(result, \"~\") == 0; } } break; #ifdef FEAT_SEARCHPATH case SPEC_CFILE: // file name under cursor result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); if (result == NULL) { *errormsg = \"\"; return NULL; } resultbuf = result; // remember allocated string break; #endif case SPEC_AFILE: // file name for autocommand result = autocmd_fname; if (result != NULL && !autocmd_fname_full) { // Still need to turn the fname into a full path. It is // postponed to avoid a delay when is not used. autocmd_fname_full = TRUE; result = FullName_save(autocmd_fname, FALSE); vim_free(autocmd_fname); autocmd_fname = result; } if (result == NULL) { *errormsg = _(\"E495: no autocommand file name to substitute for \\\"\\\"\"); return NULL; } result = shorten_fname1(result); break; case SPEC_ABUF: // buffer number for autocommand if (autocmd_bufnr <= 0) { *errormsg = _(\"E496: no autocommand buffer number to substitute for \\\"\\\"\"); return NULL; } sprintf((char *)strbuf, \"%d\", autocmd_bufnr); result = strbuf; break; case SPEC_AMATCH: // match name for autocommand result = autocmd_match; if (result == NULL) { *errormsg = _(\"E497: no autocommand match name to substitute for \\\"\\\"\"); return NULL; } break; case SPEC_SFILE: // file name for \":so\" command case SPEC_STACK: // call stack result = estack_sfile(spec_idx == SPEC_SFILE ? ESTACK_SFILE : ESTACK_STACK); if (result == NULL) { *errormsg = spec_idx == SPEC_SFILE ? _(\"E498: no :source file name to substitute for \\\"\\\"\") : _(\"E489: no call stack to substitute for \\\"\\\"\"); return NULL; } resultbuf = result; // remember allocated string break; case SPEC_SLNUM: // line in file for \":so\" command if (SOURCING_NAME == NULL || SOURCING_LNUM == 0) { *errormsg = _(\"E842: no line number to use for \\\"\\\"\"); return NULL; } sprintf((char *)strbuf, \"%ld\", SOURCING_LNUM); result = strbuf; break; #ifdef FEAT_EVAL case SPEC_SFLNUM: // line in script file if (current_sctx.sc_lnum + SOURCING_LNUM == 0) { *errormsg = _(\"E961: no line number to use for \\\"\\\"\"); return NULL; } sprintf((char *)strbuf, \"%ld\", (long)(current_sctx.sc_lnum + SOURCING_LNUM)); result = strbuf; break; case SPEC_SID: if (current_sctx.sc_sid <= 0) { *errormsg = _(e_usingsid); return NULL; } sprintf((char *)strbuf, \"%d_\", current_sctx.sc_sid); result = strbuf; break; #endif #ifdef FEAT_CLIENTSERVER case SPEC_CLIENT: // Source of last submitted input sprintf((char *)strbuf, PRINTF_HEX_LONG_U, (long_u)clientWindow); result = strbuf; break; #endif default: result = (char_u *)\"\"; // avoid gcc warning break; } resultlen = (int)STRLEN(result); // length of new string if (src[*usedlen] == '<') // remove the file name extension { ++*usedlen; if ((s = vim_strrchr(result, '.')) != NULL && s >= gettail(result)) resultlen = (int)(s - result); } else if (!skip_mod) { valid |= modify_fname(src, tilde_file, usedlen, &result, &resultbuf, &resultlen); if (result == NULL) { *errormsg = \"\"; return NULL; } } } if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH) { if (valid != VALID_HEAD + VALID_PATH) // xgettext:no-c-format *errormsg = _(\"E499: Empty file name for '%' or '#', only works with \\\":p:h\\\"\"); else *errormsg = _(\"E500: Evaluates to an empty string\"); result = NULL; } else result = vim_strnsave(result, resultlen); vim_free(resultbuf); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 474546, "input": "ReadVeNCryptSecurityType(rfbClient* client, uint32_t *result) { uint8_t count=0; uint8_t loop=0; uint8_t flag=0; uint32_t tAuth[256], t; char buf1[500],buf2[10]; uint32_t authScheme; if (!ReadFromRFBServer(client, (char *)&count, 1)) return FALSE; if (count==0) { rfbClientLog(\"List of security types is ZERO. Giving up.\\n\"); return FALSE; } rfbClientLog(\"We have %d security types to read\\n\", count); authScheme=0; /* now, we have a list of available security types to read ( uint8_t[] ) */ for (loop=0;loop=sizeof(buf1)-1) break; snprintf(buf2, sizeof(buf2), (loop>0 ? \", %d\" : \"%d\"), (int)tAuth[loop]); strncat(buf1, buf2, sizeof(buf1)-strlen(buf1)-1); } rfbClientLog(\"Unknown VeNCrypt authentication scheme from VNC server: %s\\n\", buf1); return FALSE; } *result = authScheme; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208679, "input": "managesieve_parser_read_string(struct managesieve_parser *parser, const unsigned char *data, size_t data_size) { size_t i; /* QUOTED-CHAR = SAFE-UTF8-CHAR / \"\\\" QUOTED-SPECIALS * quoted = <\"> *QUOTED-CHAR <\"> * ;; limited to 1024 octets between the <\">s */ /* read until we've found non-escaped \", CR or LF */ for (i = parser->cur_pos; i < data_size; i++) { if (data[i] == '\"') { if ( !uni_utf8_data_is_valid(data+1, i-1) ) { parser->error = \"Invalid UTF-8 character in quoted-string.\"; return FALSE; } managesieve_parser_save_arg(parser, data, i); i++; /* skip the trailing '\"' too */ break; } if (data[i] == '\\\\') { if (i+1 == data_size) { /* known data ends with '\\' - leave it to next time as well if it happens to be \\\" */ break; } /* save the first escaped char */ if (parser->str_first_escape < 0) parser->str_first_escape = i; /* skip the escaped char */ i++; if ( !IS_QUOTED_SPECIAL(data[i]) ) { parser->error = \"Escaped quoted-string character is not a QUOTED-SPECIAL.\"; return FALSE; } continue; } if ( (data[i] & 0x80) == 0 && !IS_SAFE_CHAR(data[i]) ) { parser->error = \"String contains invalid character.\"; return FALSE; } } parser->cur_pos = i; return ( parser->cur_type == ARG_PARSE_NONE ); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "In Dovecot before 2.2.36.4 and 2.3.x before 2.3.7.2 (and Pigeonhole before 0.5.7.2), protocol processing can fail for quoted strings. This occurs because '\\0' characters are mishandled, and can lead to out-of-bounds writes and remote code execution.", "severity_level": "High", "cwe": "CWE-787", "cve": "CVE-2019-11500"}} -{"idx": 295446, "input": "int kern_path(const char *name, unsigned int flags, struct path *path) { return filename_lookup(AT_FDCWD, getname_kernel(name), flags, path, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269191, "input": "CACHE_BITMAP_ORDER* copy_cache_bitmap_order(rdpContext* context, const CACHE_BITMAP_ORDER* order) { CACHE_BITMAP_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_ORDER)); if (!dst || !order) goto fail; *dst = *order; if (order->bitmapLength > 0) { dst->bitmapDataStream = malloc(order->bitmapLength); if (!dst->bitmapDataStream) goto fail; memcpy(dst->bitmapDataStream, order->bitmapDataStream, order->bitmapLength); } return dst; fail: free_cache_bitmap_order(context, dst); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281354, "input": "int RGWGetObj_ObjStore_S3Website::send_response_data_error() { return RGWGetObj_ObjStore_S3::send_response_data_error(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234395, "input": "static void ff_layout_commit_done(struct rpc_task *task, void *data) { pnfs_generic_write_commit_done(task, data); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268950, "input": "R_API bool r_str_endswith(const char *str, const char *needle) { r_return_val_if_fail (str && needle, false); if (!*needle) { return true; } int slen = strlen (str); int nlen = strlen (needle); if (!slen || !nlen || slen < nlen) { return false; } return !strcmp (str + (slen - nlen), needle); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338668, "input": "static bool __io_file_supports_async(struct file *file, int rw) { umode_t mode = file_inode(file)->i_mode; if (S_ISBLK(mode)) { if (IS_ENABLED(CONFIG_BLOCK) && io_bdev_nowait(I_BDEV(file->f_mapping->host))) return true; return false; } if (S_ISCHR(mode) || S_ISSOCK(mode)) return true; if (S_ISREG(mode)) { if (IS_ENABLED(CONFIG_BLOCK) && io_bdev_nowait(file->f_inode->i_sb->s_bdev) && file->f_op != &io_uring_fops) return true; return false; } /* any ->read/write should understand O_NONBLOCK */ if (file->f_flags & O_NONBLOCK) return true; if (!(file->f_mode & FMODE_NOWAIT)) return false; if (rw == READ) return file->f_op->read_iter != NULL; return file->f_op->write_iter != NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281259, "input": "RGWCreateBucketParser() {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446289, "input": "void ScanLineInputFile::rawPixelDataToBuffer(int scanLine, char *pixelData, int &pixelDataSize) const { if (_data->memoryMapped) { throw IEX_NAMESPACE::ArgExc (\"Reading raw pixel data to a buffer \" \"is not supported for memory mapped \" \"streams.\" ); } try { #if ILMBASE_THREADING_ENABLED std::lock_guard lock (*_streamData); #endif if (scanLine < _data->minY || scanLine > _data->maxY) { throw IEX_NAMESPACE::ArgExc (\"Tried to read scan line outside \" \"the image file's data window.\"); } readPixelData (_streamData, _data, scanLine, pixelData, pixelDataSize); } catch (IEX_NAMESPACE::BaseExc &e) { REPLACE_EXC (e, \"Error reading pixel data from image \" \"file \\\"\" << fileName() << \"\\\". \" << e.what()); throw; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 200455, "input": "static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) { char command[MagickPathExtent], *density, filename[MagickPathExtent], input_filename[MagickPathExtent], message[MagickPathExtent], *options, postscript_filename[MagickPathExtent]; const char *option; const DelegateInfo *delegate_info; GeometryInfo geometry_info; Image *image, *next, *pdf_image; ImageInfo *read_info; int file; MagickBooleanType fitPage, status; MagickStatusType flags; PDFInfo pdf_info; PointInfo delta; RectangleInfo page; register ssize_t i; size_t scene; assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); /* Open image file. */ image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } status=AcquireUniqueSymbolicLink(image_info->filename,input_filename); if (status == MagickFalse) { ThrowFileException(exception,FileOpenError,\"UnableToCreateTemporaryFile\", image_info->filename); image=DestroyImageList(image); return((Image *) NULL); } /* Set the page density. */ delta.x=DefaultResolution; delta.y=DefaultResolution; if ((image->resolution.x == 0.0) || (image->resolution.y == 0.0)) { flags=ParseGeometry(PSDensityGeometry,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } if (image_info->density != (char *) NULL) { flags=ParseGeometry(image_info->density,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } (void) memset(&page,0,sizeof(page)); (void) ParseAbsoluteGeometry(PSPageGeometry,&page); if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); page.width=(size_t) ((ssize_t) ceil((double) (page.width* image->resolution.x/delta.x)-0.5)); page.height=(size_t) ((ssize_t) ceil((double) (page.height* image->resolution.y/delta.y)-0.5)); /* Determine page geometry from the PDF media box. */ ReadPDFInfo(image_info,image,&pdf_info,exception); (void) CloseBlob(image); /* Set PDF render geometry. */ if ((fabs(pdf_info.bounds.x2-pdf_info.bounds.x1) >= MagickEpsilon) && (fabs(pdf_info.bounds.y2-pdf_info.bounds.y1) >= MagickEpsilon)) { (void) FormatImageProperty(image,\"pdf:HiResBoundingBox\", \"%gx%g%+.15g%+.15g\",pdf_info.bounds.x2-pdf_info.bounds.x1, pdf_info.bounds.y2-pdf_info.bounds.y1,pdf_info.bounds.x1, pdf_info.bounds.y1); page.width=(size_t) ((ssize_t) ceil((double) ((pdf_info.bounds.x2- pdf_info.bounds.x1)*image->resolution.x/delta.x)-0.5)); page.height=(size_t) ((ssize_t) ceil((double) ((pdf_info.bounds.y2- pdf_info.bounds.y1)*image->resolution.y/delta.y)-0.5)); } fitPage=MagickFalse; option=GetImageOption(image_info,\"pdf:fit-page\"); if (option != (char *) NULL) { char *page_geometry; page_geometry=GetPageGeometry(option); flags=ParseMetaGeometry(page_geometry,&page.x,&page.y,&page.width, &page.height); page_geometry=DestroyString(page_geometry); if (flags == NoValue) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \"InvalidGeometry\",\"`%s'\",option); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } page.width=(size_t) ((ssize_t) ceil((double) (page.width* image->resolution.x/delta.x)-0.5)); page.height=(size_t) ((ssize_t) ceil((double) (page.height* image->resolution.y/delta.y)-0.5)); fitPage=MagickTrue; } if ((fabs(pdf_info.angle) == 90.0) || (fabs(pdf_info.angle) == 270.0)) { size_t swap; swap=page.width; page.width=page.height; page.height=swap; } if (IssRGBCompatibleColorspace(image_info->colorspace) != MagickFalse) pdf_info.cmyk=MagickFalse; /* Create Ghostscript control file. */ file=AcquireUniqueFileResource(postscript_filename); if (file == -1) { ThrowFileException(exception,FileOpenError,\"UnableToCreateTemporaryFile\", image_info->filename); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } if (write(file,\" \",1) != 1) { file=close(file)-1; (void) RelinquishUniqueFileResource(postscript_filename); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } file=close(file)-1; /* Render Postscript with the Ghostscript delegate. */ if (image_info->monochrome != MagickFalse) delegate_info=GetDelegateInfo(\"ps:mono\",(char *) NULL,exception); else if (pdf_info.cmyk != MagickFalse) delegate_info=GetDelegateInfo(\"ps:cmyk\",(char *) NULL,exception); else delegate_info=GetDelegateInfo(\"ps:alpha\",(char *) NULL,exception); if (delegate_info == (const DelegateInfo *) NULL) { (void) RelinquishUniqueFileResource(postscript_filename); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } density=AcquireString(\"\"); options=AcquireString(\"\"); (void) FormatLocaleString(density,MagickPathExtent,\"%gx%g\", image->resolution.x,image->resolution.y); if ((image_info->page != (char *) NULL) || (fitPage != MagickFalse)) (void) FormatLocaleString(options,MagickPathExtent,\"-g%.20gx%.20g \",(double) page.width,(double) page.height); if (fitPage != MagickFalse) (void) ConcatenateMagickString(options,\"-dPSFitPage \",MagickPathExtent); if (pdf_info.cropbox != MagickFalse) (void) ConcatenateMagickString(options,\"-dUseCropBox \",MagickPathExtent); if (pdf_info.trimbox != MagickFalse) (void) ConcatenateMagickString(options,\"-dUseTrimBox \",MagickPathExtent); option=GetImageOption(image_info,\"pdf:stop-on-error\"); if (IsStringTrue(option) != MagickFalse) (void) ConcatenateMagickString(options,\"-dPDFSTOPONERROR \", MagickPathExtent); option=GetImageOption(image_info,\"pdf:interpolate\"); if (IsStringTrue(option) != MagickFalse) (void) ConcatenateMagickString(options,\"-dInterpolateControl=-1 \", MagickPathExtent); option=GetImageOption(image_info,\"authenticate\"); if ((option != (char *) NULL) && (strpbrk(option,\"&;<>|\") == (char *) NULL)) { char passphrase[MagickPathExtent]; (void) FormatLocaleString(passphrase,MagickPathExtent, \"\\\"-sPDFPassword=%s\\\" \",option); (void) ConcatenateMagickString(options,passphrase,MagickPathExtent); } read_info=CloneImageInfo(image_info); *read_info->magick='\\0'; if (read_info->number_scenes != 0) { char pages[MagickPathExtent]; (void) FormatLocaleString(pages,MagickPathExtent,\"-dFirstPage=%.20g \" \"-dLastPage=%.20g\",(double) read_info->scene+1,(double) (read_info->scene+read_info->number_scenes)); (void) ConcatenateMagickString(options,pages,MagickPathExtent); read_info->number_scenes=0; if (read_info->scenes != (char *) NULL) *read_info->scenes='\\0'; } (void) CopyMagickString(filename,read_info->filename,MagickPathExtent); (void) AcquireUniqueFilename(filename); (void) RelinquishUniqueFileResource(filename); (void) ConcatenateMagickString(filename,\"%d\",MagickPathExtent); (void) FormatLocaleString(command,MagickPathExtent, GetDelegateCommands(delegate_info), read_info->antialias != MagickFalse ? 4 : 1, read_info->antialias != MagickFalse ? 4 : 1,density,options,filename, postscript_filename,input_filename); options=DestroyString(options); density=DestroyString(density); *message='\\0'; status=InvokeGhostscriptDelegate(read_info->verbose,command,message, exception); (void) RelinquishUniqueFileResource(postscript_filename); (void) RelinquishUniqueFileResource(input_filename); pdf_image=(Image *) NULL; if (status == MagickFalse) for (i=1; ; i++) { (void) InterpretImageFilename(image_info,image,filename,(int) i, read_info->filename,exception); if (IsGhostscriptRendered(read_info->filename) == MagickFalse) break; (void) RelinquishUniqueFileResource(read_info->filename); } else for (i=1; ; i++) { (void) InterpretImageFilename(image_info,image,filename,(int) i, read_info->filename,exception); if (IsGhostscriptRendered(read_info->filename) == MagickFalse) break; read_info->blob=NULL; read_info->length=0; next=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); if (next == (Image *) NULL) break; AppendImageToList(&pdf_image,next); } read_info=DestroyImageInfo(read_info); if (pdf_image == (Image *) NULL) { if (*message != '\\0') (void) ThrowMagickException(exception,GetMagickModule(),DelegateError, \"PDFDelegateFailed\",\"`%s'\",message); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } if (LocaleCompare(pdf_image->magick,\"BMP\") == 0) { Image *cmyk_image; cmyk_image=ConsolidateCMYKImages(pdf_image,exception); if (cmyk_image != (Image *) NULL) { pdf_image=DestroyImageList(pdf_image); pdf_image=cmyk_image; } } if (pdf_info.profile != (StringInfo *) NULL) { char *profile; (void) SetImageProfile(image,\"xmp\",pdf_info.profile,exception); profile=(char *) GetStringInfoDatum(pdf_info.profile); if (strstr(profile,\"Adobe Illustrator\") != (char *) NULL) (void) CopyMagickString(image->magick,\"AI\",MagickPathExtent); } CleanupPDFInfo(&pdf_info); if (image_info->number_scenes != 0) { Image *clone_image; /* Add place holder images to meet the subimage specification requirement. */ for (i=0; i < (ssize_t) image_info->scene; i++) { clone_image=CloneImage(pdf_image,1,1,MagickTrue,exception); if (clone_image != (Image *) NULL) PrependImageToList(&pdf_image,clone_image); } } do { (void) CopyMagickString(pdf_image->filename,filename,MagickPathExtent); (void) CopyMagickString(pdf_image->magick,image->magick,MagickPathExtent); pdf_image->page=page; (void) CloneImageProfiles(pdf_image,image); (void) CloneImageProperties(pdf_image,image); next=SyncNextImageInList(pdf_image); if (next != (Image *) NULL) pdf_image=next; } while (next != (Image *) NULL); image=DestroyImage(image); scene=0; for (next=GetFirstImageInList(pdf_image); next != (Image *) NULL; ) { next->scene=scene++; next=GetNextImageInList(next); } return(GetFirstImageInList(pdf_image)); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["XML Injection (aka Blind XPath Injection)"], "explanation": "ImageMagick before 6.9.11-40 and 7.x before 7.0.10-40 mishandles the -authenticate option, which allows setting a password for password-protected PDF files. The user-controlled password was not properly escaped/sanitized and it was therefore possible to inject additional shell commands via coders/pdf.c.", "severity_level": "NoInfo", "cwe": "CWE-91", "cve": "CVE-2020-29599"}} -{"idx": 409205, "input": "static int uvc_register_video(struct uvc_device *dev, struct uvc_streaming *stream) { int ret; /* Initialize the streaming interface with default parameters. */ ret = uvc_video_init(stream); if (ret < 0) { uvc_printk(KERN_ERR, \"Failed to initialize the device (%d).\\n\", ret); return ret; } if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_META_CAPTURE; else stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT; uvc_debugfs_init_stream(stream); /* Register the device with V4L. */ return uvc_register_video_device(dev, stream, &stream->vdev, &stream->queue, stream->type, &uvc_fops, &uvc_ioctl_ops); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269074, "input": "R_API const char *r_str_get(const char *str) { return str? str: nullstr_c; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198453, "input": "void Compute(tensorflow::OpKernelContext* context) override { const tensorflow::Tensor* data; OP_REQUIRES_OK(context, context->input(\"data\", &data)); const auto& input_data = data->flat().data(); const tensorflow::Tensor* splits; OP_REQUIRES_OK(context, context->input(\"data_splits\", &splits)); const auto& splits_vec = splits->flat(); // Validate that the splits are valid indices into data, only if there are // splits specified. const int input_data_size = data->flat().size(); const int splits_vec_size = splits_vec.size(); if (splits_vec_size > 0) { int prev_split = splits_vec(0); OP_REQUIRES(context, prev_split == 0, errors::InvalidArgument(\"First split value must be 0, got \", prev_split)); for (int i = 1; i < splits_vec_size; ++i) { bool valid_splits = splits_vec(i) >= prev_split; valid_splits = valid_splits && (splits_vec(i) <= input_data_size); OP_REQUIRES(context, valid_splits, errors::InvalidArgument( \"Invalid split value \", splits_vec(i), \", must be in [\", prev_split, \", \", input_data_size, \"]\")); prev_split = splits_vec(i); } OP_REQUIRES(context, prev_split == input_data_size, errors::InvalidArgument( \"Last split value must be data size. Expected \", input_data_size, \", got \", prev_split)); } int num_batch_items = splits_vec.size() - 1; tensorflow::Tensor* ngrams_splits; OP_REQUIRES_OK( context, context->allocate_output(1, splits->shape(), &ngrams_splits)); auto ngrams_splits_data = ngrams_splits->flat().data(); // If there is no data or size, return an empty RT. if (data->flat().size() == 0 || splits_vec.size() == 0) { tensorflow::Tensor* empty; OP_REQUIRES_OK(context, context->allocate_output(0, data->shape(), &empty)); for (int i = 0; i <= num_batch_items; ++i) { ngrams_splits_data[i] = 0; } return; } ngrams_splits_data[0] = 0; for (int i = 1; i <= num_batch_items; ++i) { int length = splits_vec(i) - splits_vec(i - 1); int num_ngrams = 0; for (int ngram_width : ngram_widths_) num_ngrams += get_num_ngrams(length, ngram_width); if (preserve_short_ && length > 0 && num_ngrams == 0) { num_ngrams = 1; } ngrams_splits_data[i] = ngrams_splits_data[i - 1] + num_ngrams; } tensorflow::Tensor* ngrams; OP_REQUIRES_OK( context, context->allocate_output( 0, TensorShape({ngrams_splits_data[num_batch_items]}), &ngrams)); auto ngrams_data = ngrams->flat().data(); for (int i = 0; i < num_batch_items; ++i) { auto data_start = &input_data[splits_vec(i)]; int output_start_idx = ngrams_splits_data[i]; for (int ngram_width : ngram_widths_) { auto output_start = &ngrams_data[output_start_idx]; int length = splits_vec(i + 1) - splits_vec(i); int num_ngrams = get_num_ngrams(length, ngram_width); CreateNgrams(data_start, output_start, num_ngrams, ngram_width); output_start_idx += num_ngrams; } // If we're preserving short sequences, check to see if no sequence was // generated by comparing the current output start idx to the original // one (ngram_splits_data). If no ngrams were generated, then they will // be equal (since we increment output_start_idx by num_ngrams every // time we create a set of ngrams.) if (preserve_short_ && output_start_idx == ngrams_splits_data[i]) { int data_length = splits_vec(i + 1) - splits_vec(i); // One legitimate reason to not have any ngrams when preserve_short_ // is true is if the sequence itself is empty. In that case, move on. if (data_length == 0) { continue; } // We don't have to worry about dynamic padding sizes here: if padding // was dynamic, every sequence would have had sufficient padding to // generate at least one ngram. int ngram_width = data_length + 2 * pad_width_; auto output_start = &ngrams_data[output_start_idx]; int num_ngrams = 1; CreateNgrams(data_start, output_start, num_ngrams, ngram_width); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of `tf.raw_ops.StringNGrams` is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/string_ngrams_op.cc#L184) calls `reserve` on a `tstring` with a value that sometimes can be negative if user supplies negative `ngram_widths`. The `reserve` method calls `TF_TString_Reserve` which has an `unsigned long` argument for the size of the buffer. Hence, the implicit conversion transforms the negative value to a large integer. We have patched the issue in GitHub commit c283e542a3f422420cfdb332414543b62fc4e4a5. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-37646"}} -{"idx": 338654, "input": "static void io_free_req_deferred(struct io_kiocb *req) { req->task_work.func = io_put_req_deferred_cb; if (unlikely(io_req_task_work_add(req))) io_req_task_work_add_fallback(req, io_put_req_deferred_cb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333199, "input": "repodata_add_idarray(Repodata *data, Id solvid, Id keyname, Id id) { #if 0 fprintf(stderr, \"repodata_add_idarray %d %d (%d)\\n\", solvid, id, data->attriddatalen); #endif repodata_add_array(data, solvid, keyname, REPOKEY_TYPE_IDARRAY, 1); data->attriddata[data->attriddatalen++] = id; data->attriddata[data->attriddatalen++] = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342077, "input": "long fuse_ioctl_common(struct file *file, unsigned int cmd, unsigned long arg, unsigned int flags) { struct inode *inode = file_inode(file); struct fuse_conn *fc = get_fuse_conn(inode); if (!fuse_allow_current_process(fc)) return -EACCES; if (fuse_is_bad(inode)) return -EIO; return fuse_do_ioctl(file, cmd, arg, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430854, "input": "UnicodeStringTest::TestFindAndReplace() { UnicodeString test1(\"One potato, two potato, three potato, four\\n\"); UnicodeString test2(\"potato\"); UnicodeString test3(\"MISSISSIPPI\"); UnicodeString expectedValue; test1.findAndReplace(test2, test3); expectedValue = \"One MISSISSIPPI, two MISSISSIPPI, three MISSISSIPPI, four\\n\"; if (test1 != expectedValue) errln(\"findAndReplace failed: expected \\\"\" + expectedValue + \"\\\", got \\\"\" + test1 + \"\\\".\"); test1.findAndReplace(2, 32, test3, test2); expectedValue = \"One potato, two potato, three MISSISSIPPI, four\\n\"; if (test1 != expectedValue) errln(\"findAndReplace failed: expected \\\"\" + expectedValue + \"\\\", got \\\"\" + test1 + \"\\\".\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 217249, "input": "static PyObject* patch(PyObject* self, PyObject* args) { char *origData, *newData, *diffBlock, *extraBlock, *diffPtr, *extraPtr; Py_ssize_t origDataLength, newDataLength, diffBlockLength, extraBlockLength; PyObject *controlTuples, *tuple, *results; off_t oldpos, newpos, x, y, z; int i, j, numTuples; if (!PyArg_ParseTuple(args, \"s#nO!s#s#\", &origData, &origDataLength, &newDataLength, &PyList_Type, &controlTuples, &diffBlock, &diffBlockLength, &extraBlock, &extraBlockLength)) return NULL; /* allocate the memory for the new data */ newData = PyMem_Malloc(newDataLength + 1); if (!newData) return PyErr_NoMemory(); oldpos = 0; newpos = 0; diffPtr = diffBlock; extraPtr = extraBlock; numTuples = PyList_GET_SIZE(controlTuples); for (i = 0; i < numTuples; i++) { tuple = PyList_GET_ITEM(controlTuples, i); if (!PyTuple_Check(tuple)) { PyMem_Free(newData); PyErr_SetString(PyExc_TypeError, \"expecting tuple\"); return NULL; } if (PyTuple_GET_SIZE(tuple) != 3) { PyMem_Free(newData); PyErr_SetString(PyExc_TypeError, \"expecting tuple of size 3\"); return NULL; } x = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 0)); y = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 1)); z = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 2)); if (newpos + x > newDataLength || diffPtr + x > diffBlock + diffBlockLength || extraPtr + y > extraBlock + extraBlockLength) { PyMem_Free(newData); PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\"); return NULL; } memcpy(newData + newpos, diffPtr, x); diffPtr += x; for (j = 0; j < x; j++) if ((oldpos + j >= 0) && (oldpos + j < origDataLength)) newData[newpos + j] += origData[oldpos + j]; newpos += x; oldpos += x; memcpy(newData + newpos, extraPtr, y); extraPtr += y; newpos += y; oldpos += z; } /* confirm that a valid patch was applied */ if (newpos != newDataLength || diffPtr != diffBlock + diffBlockLength || extraPtr != extraBlock + extraBlockLength) { PyMem_Free(newData); PyErr_SetString(PyExc_ValueError, \"corrupt patch (underflow)\"); return NULL; } results = PyBytes_FromStringAndSize(newData, newDataLength); PyMem_Free(newData); return results; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "A buffer overflow in the patching routine of bsdiff4 before 1.2.0 allows an attacker to write to heap memory (beyond allocated bounds) via a crafted patch file.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-15904"}} -{"idx": 380131, "input": "void dlpar_free_cc_property(struct property *prop) { kfree(prop->name); kfree(prop->value); kfree(prop); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207478, "input": "static void sctp_destroy_sock(struct sock *sk) { struct sctp_sock *sp; pr_debug(\"%s: sk:%p\\n\", __func__, sk); /* Release our hold on the endpoint. */ sp = sctp_sk(sk); /* This could happen during socket init, thus we bail out * early, since the rest of the below is not setup either. */ if (sp->ep == NULL) return; if (sp->do_auto_asconf) { sp->do_auto_asconf = 0; list_del(&sp->auto_asconf_list); } sctp_endpoint_free(sp->ep); local_bh_disable(); sk_sockets_allocated_dec(sk); sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); local_bh_enable(); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"], "explanation": "A race condition in Linux kernel SCTP sockets (net/sctp/socket.c) before 5.12-rc8 can lead to kernel privilege escalation from the context of a network service or an unprivileged process. If sctp_destroy_sock is called without sock_net(sk)->sctp.addr_wq_lock then an element is removed from the auto_asconf_splist list without any proper locking. This can be exploited by an attacker with network service privileges to escalate to root or from the context of an unprivileged user directly if a BPF_CGROUP_INET_SOCK_CREATE is attached which denies creation of some SCTP socket.", "severity_level": "NoInfo", "cwe": "CWE-362", "cve": "CVE-2021-23133"}} -{"idx": 481109, "input": "void xdr_init_decode_pages(struct xdr_stream *xdr, struct xdr_buf *buf, struct page **pages, unsigned int len) { memset(buf, 0, sizeof(*buf)); buf->pages = pages; buf->page_len = len; buf->buflen = len; buf->len = len; xdr_init_decode(xdr, buf, NULL, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 374475, "input": "ZEND_METHOD(error_exception, __construct) { char *message = NULL, *filename = NULL; long code = 0, severity = E_ERROR, lineno; zval *object, *previous = NULL; int argc = ZEND_NUM_ARGS(), message_len, filename_len; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, \"|sllslO!\", &message, &message_len, &code, &severity, &filename, &filename_len, &lineno, &previous, default_exception_ce) == FAILURE) { zend_error(E_ERROR, \"Wrong parameters for ErrorException([string $exception [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Exception $previous = NULL]]]]]])\"); } object = getThis(); if (message) { zend_update_property_string(default_exception_ce, object, \"message\", sizeof(\"message\")-1, message TSRMLS_CC); } if (code) { zend_update_property_long(default_exception_ce, object, \"code\", sizeof(\"code\")-1, code TSRMLS_CC); } if (previous) { zend_update_property(default_exception_ce, object, \"previous\", sizeof(\"previous\")-1, previous TSRMLS_CC); } zend_update_property_long(default_exception_ce, object, \"severity\", sizeof(\"severity\")-1, severity TSRMLS_CC); if (argc >= 4) { zend_update_property_string(default_exception_ce, object, \"file\", sizeof(\"file\")-1, filename TSRMLS_CC); if (argc < 5) { lineno = 0; /* invalidate lineno */ } zend_update_property_long(default_exception_ce, object, \"line\", sizeof(\"line\")-1, lineno TSRMLS_CC); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437573, "input": "static void svm_sync_pir_to_irr(struct kvm_vcpu *vcpu) { return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196921, "input": "void Compute(OpKernelContext* context) override { typedef Eigen::Map> ConstEigenMatrixMap; typedef Eigen::Map> EigenMatrixMap; constexpr int tensor_in_and_out_dims = 4; const Tensor& tensor_in = context->input(0); OP_REQUIRES(context, tensor_in.dims() == tensor_in_and_out_dims, errors::InvalidArgument(\"tensor_in must be 4-dimensional\")); std::vector input_size(tensor_in_and_out_dims); std::vector output_size(tensor_in_and_out_dims); for (int i = 0; i < tensor_in_and_out_dims; ++i) { input_size[i] = tensor_in.dim_size(i); } // Output size. for (int i = 0; i < tensor_in_and_out_dims; ++i) { output_size[i] = static_cast(std::floor(input_size[i] / pooling_ratio_[i])); DCHECK_GT(output_size[i], 0); } // Generate pooling sequence. std::vector row_cum_seq; std::vector col_cum_seq; GuardedPhiloxRandom generator; generator.Init(seed_, seed2_); row_cum_seq = GeneratePoolingSequence(input_size[1], output_size[1], &generator, pseudo_random_); col_cum_seq = GeneratePoolingSequence(input_size[2], output_size[2], &generator, pseudo_random_); // Prepare output. Tensor* output_tensor = nullptr; OP_REQUIRES_OK(context, context->allocate_output( 0, TensorShape({output_size[0], output_size[1], output_size[2], output_size[3]}), &output_tensor)); Tensor* output_row_seq_tensor = nullptr; OP_REQUIRES_OK(context, context->allocate_output( 1, TensorShape({static_cast(row_cum_seq.size())}), &output_row_seq_tensor)); Tensor* output_col_seq_tensor = nullptr; OP_REQUIRES_OK(context, context->allocate_output( 2, TensorShape({static_cast(col_cum_seq.size())}), &output_col_seq_tensor)); ConstEigenMatrixMap in_mat(tensor_in.flat().data(), input_size[3], input_size[2] * input_size[1] * input_size[0]); EigenMatrixMap out_mat(output_tensor->flat().data(), output_size[3], output_size[2] * output_size[1] * output_size[0]); // out_count corresponds to number of elements in each pooling cell. Eigen::Matrix out_count(out_mat.cols()); // Initializes the output tensor and out_count with 0. out_mat.setZero(); out_count.setZero(); auto output_row_seq_flat = output_row_seq_tensor->flat(); auto output_col_seq_flat = output_col_seq_tensor->flat(); // Set output tensors. for (int i = 0; i < row_cum_seq.size(); ++i) { output_row_seq_flat(i) = row_cum_seq[i]; } for (int i = 0; i < col_cum_seq.size(); ++i) { output_col_seq_flat(i) = col_cum_seq[i]; } // For both input and output, // 0: batch // 1: row / row // 2: col / col // 3: depth / channel const int64 row_max = input_size[1] - 1; const int64 col_max = input_size[2] - 1; for (int64 b = 0; b < input_size[0]; ++b) { // row sequence. for (int64 hs = 0; hs < row_cum_seq.size() - 1; ++hs) { // row start and end. const int64 row_start = row_cum_seq[hs]; int64 row_end = overlapping_ ? row_cum_seq[hs + 1] : row_cum_seq[hs + 1] - 1; row_end = std::min(row_end, row_max); // col sequence. for (int64 ws = 0; ws < col_cum_seq.size() - 1; ++ws) { const int64 out_offset = (b * output_size[1] + hs) * output_size[2] + ws; // col start and end. const int64 col_start = col_cum_seq[ws]; int64 col_end = overlapping_ ? col_cum_seq[ws + 1] : col_cum_seq[ws + 1] - 1; col_end = std::min(col_end, col_max); for (int64 h = row_start; h <= row_end; ++h) { for (int64 w = col_start; w <= col_end; ++w) { const int64 in_offset = (b * input_size[1] + h) * input_size[2] + w; out_mat.col(out_offset) += in_mat.col(in_offset); out_count(out_offset)++; } } } } } DCHECK_GT(out_count.minCoeff(), 0); out_mat.array().rowwise() /= out_count.transpose().array(); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a runtime division by zero error and denial of service in `tf.raw_ops.FractionalAvgPool`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/acc8ee69f5f46f92a3f1f11230f49c6ac266f10c/tensorflow/core/kernels/fractional_avg_pool_op.cc#L85-L89) computes a divisor quantity by dividing two user controlled values. The user controls the values of `input_size[i]` and `pooling_ratio_[i]` (via the `value.shape()` and `pooling_ratio` arguments). If the value in `input_size[i]` is smaller than the `pooling_ratio_[i]`, then the floor operation results in `output_size[i]` being 0. The `DCHECK_GT` line is a no-op outside of debug mode, so in released versions of TF this does not trigger. Later, these computed values are used as arguments(https://github.com/tensorflow/tensorflow/blob/acc8ee69f5f46f92a3f1f11230f49c6ac266f10c/tensorflow/core/kernels/fractional_avg_pool_op.cc#L96-L99) to `GeneratePoolingSequence`(https://github.com/tensorflow/tensorflow/blob/acc8ee69f5f46f92a3f1f11230f49c6ac266f10c/tensorflow/core/kernels/fractional_pool_common.cc#L100-L108). There, the first computation is a division in a modulo operation. Since `output_length` can be 0, this results in runtime crashing. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-29550"}} -{"idx": 409884, "input": "static void tcp_reset(struct sock *sk) { /* We want the right error as BSD sees it (and indeed as we do). */ switch (sk->sk_state) { case TCP_SYN_SENT: sk->sk_err = ECONNREFUSED; break; case TCP_CLOSE_WAIT: sk->sk_err = EPIPE; break; case TCP_CLOSE: return; default: sk->sk_err = ECONNRESET; } /* This barrier is coupled with smp_rmb() in tcp_poll() */ smp_wmb(); if (!sock_flag(sk, SOCK_DEAD)) sk->sk_error_report(sk); tcp_done(sk); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 274261, "input": "static NTSTATUS ldapsrv_task_init(struct task_server *task) { char *ldapi_path; #ifdef WITH_LDAPI_PRIV_SOCKET char *priv_dir; #endif const char *dns_host_name; struct ldapsrv_service *ldap_service; NTSTATUS status; switch (lpcfg_server_role(task->lp_ctx)) { case ROLE_STANDALONE: task_server_terminate(task, \"ldap_server: no LDAP server required in standalone configuration\", false); return NT_STATUS_INVALID_DOMAIN_ROLE; case ROLE_DOMAIN_MEMBER: task_server_terminate(task, \"ldap_server: no LDAP server required in member server configuration\", false); return NT_STATUS_INVALID_DOMAIN_ROLE; case ROLE_ACTIVE_DIRECTORY_DC: /* Yes, we want an LDAP server */ break; } task_server_set_title(task, \"task[ldapsrv]\"); ldap_service = talloc_zero(task, struct ldapsrv_service); if (ldap_service == NULL) { status = NT_STATUS_NO_MEMORY; goto failed; } ldap_service->task = task; dns_host_name = talloc_asprintf(ldap_service, \"%s.%s\", lpcfg_netbios_name(task->lp_ctx), lpcfg_dnsdomain(task->lp_ctx)); if (dns_host_name == NULL) { status = NT_STATUS_NO_MEMORY; goto failed; } status = tstream_tls_params_server(ldap_service, dns_host_name, lpcfg_tls_enabled(task->lp_ctx), lpcfg_tls_keyfile(ldap_service, task->lp_ctx), lpcfg_tls_certfile(ldap_service, task->lp_ctx), lpcfg_tls_cafile(ldap_service, task->lp_ctx), lpcfg_tls_crlfile(ldap_service, task->lp_ctx), lpcfg_tls_dhpfile(ldap_service, task->lp_ctx), lpcfg_tls_priority(task->lp_ctx), &ldap_service->tls_params); if (!NT_STATUS_IS_OK(status)) { DBG_ERR(\"ldapsrv failed tstream_tls_params_server - %s\\n\", nt_errstr(status)); goto failed; } ldap_service->call_queue = tevent_queue_create(ldap_service, \"ldapsrv_call_queue\"); if (ldap_service->call_queue == NULL) { status = NT_STATUS_NO_MEMORY; goto failed; } if (lpcfg_interfaces(task->lp_ctx) && lpcfg_bind_interfaces_only(task->lp_ctx)) { struct interface *ifaces; int num_interfaces; int i; load_interface_list(task, task->lp_ctx, &ifaces); num_interfaces = iface_list_count(ifaces); /* We have been given an interfaces line, and been told to only bind to those interfaces. Create a socket per interface and bind to only these. */ for(i = 0; i < num_interfaces; i++) { const char *address = iface_list_n_ip(ifaces, i); status = add_socket(task, task->lp_ctx, task->model_ops, address, ldap_service); if (!NT_STATUS_IS_OK(status)) goto failed; } } else { char **wcard; size_t i; size_t num_binds = 0; wcard = iface_list_wildcard(task); if (wcard == NULL) { DBG_ERR(\"No wildcard addresses available\\n\"); status = NT_STATUS_UNSUCCESSFUL; goto failed; } for (i=0; wcard[i]; i++) { status = add_socket(task, task->lp_ctx, task->model_ops, wcard[i], ldap_service); if (NT_STATUS_IS_OK(status)) { num_binds++; } } talloc_free(wcard); if (num_binds == 0) { status = NT_STATUS_UNSUCCESSFUL; goto failed; } } ldapi_path = lpcfg_private_path(ldap_service, task->lp_ctx, \"ldapi\"); if (!ldapi_path) { status = NT_STATUS_UNSUCCESSFUL; goto failed; } status = stream_setup_socket(task, task->event_ctx, task->lp_ctx, task->model_ops, &ldap_stream_nonpriv_ops, \"unix\", ldapi_path, NULL, lpcfg_socket_options(task->lp_ctx), ldap_service, task->process_context); talloc_free(ldapi_path); if (!NT_STATUS_IS_OK(status)) { DBG_ERR(\"ldapsrv failed to bind to %s - %s\\n\", ldapi_path, nt_errstr(status)); } #ifdef WITH_LDAPI_PRIV_SOCKET priv_dir = lpcfg_private_path(ldap_service, task->lp_ctx, \"ldap_priv\"); if (priv_dir == NULL) { status = NT_STATUS_UNSUCCESSFUL; goto failed; } /* * Make sure the directory for the privileged ldapi socket exists, and * is of the correct permissions */ if (!directory_create_or_exist(priv_dir, 0750)) { task_server_terminate(task, \"Cannot create ldap \" \"privileged ldapi directory\", true); return NT_STATUS_UNSUCCESSFUL; } ldapi_path = talloc_asprintf(ldap_service, \"%s/ldapi\", priv_dir); talloc_free(priv_dir); if (ldapi_path == NULL) { status = NT_STATUS_NO_MEMORY; goto failed; } status = stream_setup_socket(task, task->event_ctx, task->lp_ctx, task->model_ops, &ldap_stream_priv_ops, \"unix\", ldapi_path, NULL, lpcfg_socket_options(task->lp_ctx), ldap_service, task->process_context); talloc_free(ldapi_path); if (!NT_STATUS_IS_OK(status)) { DBG_ERR(\"ldapsrv failed to bind to %s - %s\\n\", ldapi_path, nt_errstr(status)); } #endif /* register the server */ irpc_add_name(task->msg_ctx, \"ldap_server\"); task->private_data = ldap_service; return NT_STATUS_OK; failed: task_server_terminate(task, \"Failed to startup ldap server task\", true); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215215, "input": "gdImagePtr gdImageCrop(gdImagePtr src, const gdRectPtr crop) { gdImagePtr dst; int y; /* check size */ if (crop->width<=0 || crop->height<=0) { return NULL; } /* allocate the requested size (could be only partially filled) */ if (src->trueColor) { dst = gdImageCreateTrueColor(crop->width, crop->height); gdImageSaveAlpha(dst, 1); } else { dst = gdImageCreate(crop->width, crop->height); gdImagePaletteCopy(dst, src); } if (dst == NULL) { return NULL; } dst->transparent = src->transparent; /* check position in the src image */ if (crop->x < 0 || crop->x>=src->sx || crop->y<0 || crop->y>=src->sy) { return dst; } /* reduce size if needed */ if ((src->sx - crop->width) < crop->x) { crop->width = src->sx - crop->x; } if ((src->sy - crop->height) < crop->y) { crop->height = src->sy - crop->y; } #if 0 printf(\"rect->x: %i\\nrect->y: %i\\nrect->width: %i\\nrect->height: %i\\n\", crop->x, crop->y, crop->width, crop->height); #endif y = crop->y; if (src->trueColor) { unsigned int dst_y = 0; while (y < (crop->y + (crop->height - 1))) { /* TODO: replace 4 w/byte per channel||pitch once available */ memcpy(dst->tpixels[dst_y++], src->tpixels[y++] + crop->x, crop->width * 4); } } else { int x; for (y = crop->y; y < (crop->y + (crop->height - 1)); y++) { for (x = crop->x; x < (crop->x + (crop->width - 1)); x++) { dst->pixels[y - crop->y][x - crop->x] = src->pixels[y][x]; } } } return dst; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "Integer overflow in the gdImageCrop function in ext/gd/gd.c in PHP 5.5.x before 5.5.9 allows remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via an imagecrop function call with a large x dimension value, leading to a heap-based buffer overflow.", "severity_level": "Medium", "cwe": "CWE-189", "cve": "CVE-2013-7226"}} -{"idx": 293129, "input": "static int zipfileCommit(sqlite3_vtab *pVtab){ ZipfileTab *pTab = (ZipfileTab*)pVtab; int rc = SQLITE_OK; if( pTab->pWriteFd ){ i64 iOffset = pTab->szCurrent; ZipfileEntry *p; ZipfileEOCD eocd; int nEntry = 0; /* Write out all entries */ for(p=pTab->pFirstEntry; rc==SQLITE_OK && p; p=p->pNext){ int n = zipfileSerializeCDS(p, pTab->aBuffer); rc = zipfileAppendData(pTab, pTab->aBuffer, n); nEntry++; } /* Write out the EOCD record */ eocd.iDisk = 0; eocd.iFirstDisk = 0; eocd.nEntry = (u16)nEntry; eocd.nEntryTotal = (u16)nEntry; eocd.nSize = (u32)(pTab->szCurrent - iOffset); eocd.iOffset = (u32)iOffset; rc = zipfileAppendEOCD(pTab, &eocd); zipfileCleanupTransaction(pTab); } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280734, "input": "ofpacts_parse_copy(const char *s_, const struct ofpact_parse_params *pp, bool allow_instructions, enum ofpact_type outer_action) { char *error, *s; *pp->usable_protocols = OFPUTIL_P_ANY; s = xstrdup(s_); error = ofpacts_parse(s, pp, allow_instructions, outer_action); free(s); return error; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509402, "input": "Item_cache_real(THD *thd): Item_cache(thd, MYSQL_TYPE_DOUBLE), value(0) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 460745, "input": "set_file_options(int set_options, exarg_T *eap) { /* set default 'fileformat' */ if (set_options) { if (eap != NULL && eap->force_ff != 0) set_fileformat(get_fileformat_force(curbuf, eap), OPT_LOCAL); else if (*p_ffs != NUL) set_fileformat(default_fileformat(), OPT_LOCAL); } /* set or reset 'binary' */ if (eap != NULL && eap->force_bin != 0) { int oldval = curbuf->b_p_bin; curbuf->b_p_bin = (eap->force_bin == FORCE_BIN); set_options_bin(oldval, curbuf->b_p_bin, OPT_LOCAL); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 478005, "input": "suggest_load_files(void) { langp_T *lp; int lpi; slang_T *slang; char_u *dotp; FILE *fd; char_u buf[MAXWLEN]; int i; time_t timestamp; int wcount; int wordnr; garray_T ga; int c; /* Do this for all languages that support sound folding. */ for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) { lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi); slang = lp->lp_slang; if (slang->sl_sugtime != 0 && !slang->sl_sugloaded) { /* Change \".spl\" to \".sug\" and open the file. When the file isn't * found silently skip it. Do set \"sl_sugloaded\" so that we * don't try again and again. */ slang->sl_sugloaded = TRUE; dotp = vim_strrchr(slang->sl_fname, '.'); if (dotp == NULL || fnamecmp(dotp, \".spl\") != 0) continue; STRCPY(dotp, \".sug\"); fd = mch_fopen((char *)slang->sl_fname, \"r\"); if (fd == NULL) goto nextone; /* * : */ for (i = 0; i < VIMSUGMAGICL; ++i) buf[i] = getc(fd); /* */ if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) { EMSG2(_(\"E778: This does not look like a .sug file: %s\"), slang->sl_fname); goto nextone; } c = getc(fd); /* */ if (c < VIMSUGVERSION) { EMSG2(_(\"E779: Old .sug file, needs to be updated: %s\"), slang->sl_fname); goto nextone; } else if (c > VIMSUGVERSION) { EMSG2(_(\"E780: .sug file is for newer version of Vim: %s\"), slang->sl_fname); goto nextone; } /* Check the timestamp, it must be exactly the same as the one in * the .spl file. Otherwise the word numbers won't match. */ timestamp = get8ctime(fd); /* */ if (timestamp != slang->sl_sugtime) { EMSG2(_(\"E781: .sug file doesn't match .spl file: %s\"), slang->sl_fname); goto nextone; } /* * : * Read the trie with the soundfolded words. */ if (spell_read_tree(fd, &slang->sl_sbyts, &slang->sl_sidxs, FALSE, 0) != 0) { someerror: EMSG2(_(\"E782: error while reading .sug file: %s\"), slang->sl_fname); slang_clear_sug(slang); goto nextone; } /* * : ... * * Read the table with word numbers. We use a file buffer for * this, because it's so much like a file with lines. Makes it * possible to swap the info and save on memory use. */ slang->sl_sugbuf = open_spellbuf(); if (slang->sl_sugbuf == NULL) goto someerror; /* */ wcount = get4c(fd); if (wcount < 0) goto someerror; /* Read all the wordnr lists into the buffer, one NUL terminated * list per line. */ ga_init2(&ga, 1, 100); for (wordnr = 0; wordnr < wcount; ++wordnr) { ga.ga_len = 0; for (;;) { c = getc(fd); /* */ if (c < 0 || ga_grow(&ga, 1) == FAIL) goto someerror; ((char_u *)ga.ga_data)[ga.ga_len++] = c; if (c == NUL) break; } if (ml_append_buf(slang->sl_sugbuf, (linenr_T)wordnr, ga.ga_data, ga.ga_len, TRUE) == FAIL) goto someerror; } ga_clear(&ga); /* * Need to put word counts in the word tries, so that we can find * a word by its number. */ tree_count_words(slang->sl_fbyts, slang->sl_fidxs); tree_count_words(slang->sl_sbyts, slang->sl_sidxs); nextone: if (fd != NULL) fclose(fd); STRCPY(dotp, \".spl\"); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383689, "input": "spnego_gss_display_name( OM_uint32 *minor_status, gss_name_t input_name, gss_buffer_t output_name_buffer, gss_OID *output_name_type) { OM_uint32 status = GSS_S_COMPLETE; dsyslog(\"Entering display_name\\n\"); status = gss_display_name(minor_status, input_name, output_name_buffer, output_name_type); dsyslog(\"Leaving display_name\\n\"); return (status); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318212, "input": "int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) { return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208379, "input": "void Jp2Image::encodeJp2Header(const DataBuf& boxBuf,DataBuf& outBuf) { DataBuf output(boxBuf.size_ + iccProfile_.size_ + 100); // allocate sufficient space int outlen = sizeof(Jp2BoxHeader) ; // now many bytes have we written to output? int inlen = sizeof(Jp2BoxHeader) ; // how many bytes have we read from boxBuf? Jp2BoxHeader* pBox = (Jp2BoxHeader*) boxBuf.pData_; int32_t length = getLong((byte*)&pBox->length, bigEndian); int32_t count = sizeof (Jp2BoxHeader); char* p = (char*) boxBuf.pData_; bool bWroteColor = false ; while ( count < length || !bWroteColor ) { Jp2BoxHeader* pSubBox = (Jp2BoxHeader*) (p+count) ; // copy data. pointer could be into a memory mapped file which we will decode! Jp2BoxHeader subBox ; memcpy(&subBox,pSubBox,sizeof(subBox)); Jp2BoxHeader newBox = subBox; if ( count < length ) { subBox.length = getLong((byte*)&subBox.length, bigEndian); subBox.type = getLong((byte*)&subBox.type , bigEndian); #ifdef EXIV2_DEBUG_MESSAGES std::cout << \"Jp2Image::encodeJp2Header subbox: \"<< toAscii(subBox.type) << \" length = \" << subBox.length << std::endl; #endif count += subBox.length; newBox.type = subBox.type; } else { subBox.length=0; newBox.type = kJp2BoxTypeColorHeader; count = length; } int32_t newlen = subBox.length; if ( newBox.type == kJp2BoxTypeColorHeader ) { bWroteColor = true ; if ( ! iccProfileDefined() ) { const char* pad = \"\\x01\\x00\\x00\\x00\\x00\\x00\\x10\\x00\\x00\\x05\\x1cuuid\"; uint32_t psize = 15; newlen = sizeof(newBox) + psize ; ul2Data((byte*)&newBox.length,psize ,bigEndian); ul2Data((byte*)&newBox.type ,newBox.type,bigEndian); ::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox)); ::memcpy(output.pData_+outlen+sizeof(newBox) ,pad ,psize ); } else { const char* pad = \"\\x02\\x00\\x00\"; uint32_t psize = 3; newlen = sizeof(newBox) + psize + iccProfile_.size_; ul2Data((byte*)&newBox.length,newlen,bigEndian); ul2Data((byte*)&newBox.type,newBox.type,bigEndian); ::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox) ); ::memcpy(output.pData_+outlen+sizeof(newBox) , pad ,psize ); ::memcpy(output.pData_+outlen+sizeof(newBox)+psize,iccProfile_.pData_,iccProfile_.size_); } } else { ::memcpy(output.pData_+outlen,boxBuf.pData_+inlen,subBox.length); } outlen += newlen; inlen += subBox.length; } // allocate the correct number of bytes, copy the data and update the box header outBuf.alloc(outlen); ::memcpy(outBuf.pData_,output.pData_,outlen); pBox = (Jp2BoxHeader*) outBuf.pData_; ul2Data((byte*)&pBox->type,kJp2BoxTypeJp2Header,bigEndian); ul2Data((byte*)&pBox->length,outlen,bigEndian); } // Jp2Image::encodeJp2Header", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "Exiv2 is a command-line utility and C++ library for reading, writing, deleting, and modifying the metadata of image files. A heap buffer overflow was found in Exiv2 versions v0.27.3 and earlier. The heap overflow is triggered when Exiv2 is used to write metadata into a crafted image file. An attacker could potentially exploit the vulnerability to gain code execution, if they can trick the victim into running Exiv2 on a crafted image file. Note that this bug is only triggered when writing the metadata, which is a less frequently used Exiv2 operation than reading the metadata. For example, to trigger the bug in the Exiv2 command-line application, you need to add an extra command-line argument such as `insert`. The bug is fixed in version v0.27.4.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2021-29464"}} -{"idx": 262824, "input": "static struct acrn_vcpu *is_single_destination(struct acrn_vm *vm, const struct msi_info *info) { uint64_t vdmask; uint16_t vid; struct acrn_vcpu *vcpu = NULL; vdmask = vlapic_calc_dest_noshort(vm, false, (uint32_t)(info->addr.bits.dest_field), (bool)(info->addr.bits.dest_mode == MSI_ADDR_DESTMODE_PHYS), (bool)(info->data.bits.delivery_mode == MSI_DATA_DELMODE_LOPRI)); vid = ffs64(vdmask); /* Can only post fixed and Lowpri IRQs */ if ((info->data.bits.delivery_mode == MSI_DATA_DELMODE_FIXED) || (info->data.bits.delivery_mode == MSI_DATA_DELMODE_LOPRI)) { /* Can only post single-destination IRQs */ if (vdmask == (1UL << vid)) { vcpu = vcpu_from_vid(vm, vid); } } return vcpu; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432591, "input": "static bool svm_umip_emulated(void) { return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445730, "input": "void tracing_record_tgid(struct task_struct *task) { tracing_record_taskinfo(task, TRACE_RECORD_TGID); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417800, "input": "static OTLookup *CreateLookup(SplineFont1 *sf,uint32 tag, int sli, int flags,enum possub_type type) { OTLookup *otl = chunkalloc(sizeof(OTLookup)); otl->lookup_type = type == pst_position ? gpos_single : type == pst_pair ? gpos_pair : type == pst_contextpos ? gpos_context : type == pst_chainpos ? gpos_contextchain : type == pst_substitution ? gsub_single : type == pst_alternate ? gsub_alternate : type == pst_multiple ? gsub_multiple : type == pst_ligature ? gsub_ligature : type == pst_contextsub ? gsub_context : type == pst_chainsub ? gsub_contextchain : ot_undef; if ( otl->lookup_type == ot_undef ) IError(\"Unknown lookup type\"); if ( otl->lookup_typenext = sf->sf.gsub_lookups; sf->sf.gsub_lookups = otl; } else { otl->next = sf->sf.gpos_lookups; sf->sf.gpos_lookups = otl; } otl->lookup_flags = flags; otl->features = FeaturesFromTagSli(tag,sli,sf); /* We will set the lookup_index after we've ordered the list */ /* We will set the lookup_name after we've assigned the index */ /* We will add subtables as we need them */ return( otl ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416799, "input": "static void cil_reset_genfscon(struct cil_genfscon *genfscon) { if (genfscon->context_str == NULL) { cil_reset_context(genfscon->context); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519593, "input": "static PyObject* patch(PyObject* self, PyObject* args) { char *origData, *newData, *diffBlock, *extraBlock, *diffPtr, *extraPtr; Py_ssize_t origDataLength, newDataLength, diffBlockLength, extraBlockLength; PyObject *controlTuples, *tuple, *results; off_t oldpos, newpos, x, y, z; int i, j, numTuples; if (!PyArg_ParseTuple(args, \"s#nO!s#s#\", &origData, &origDataLength, &newDataLength, &PyList_Type, &controlTuples, &diffBlock, &diffBlockLength, &extraBlock, &extraBlockLength)) return NULL; /* allocate the memory for the new data */ newData = PyMem_Malloc(newDataLength + 1); if (!newData) return PyErr_NoMemory(); oldpos = 0; newpos = 0; diffPtr = diffBlock; extraPtr = extraBlock; numTuples = PyList_GET_SIZE(controlTuples); for (i = 0; i < numTuples; i++) { tuple = PyList_GET_ITEM(controlTuples, i); if (!PyTuple_Check(tuple)) { PyMem_Free(newData); PyErr_SetString(PyExc_TypeError, \"expecting tuple\"); return NULL; } if (PyTuple_GET_SIZE(tuple) != 3) { PyMem_Free(newData); PyErr_SetString(PyExc_TypeError, \"expecting tuple of size 3\"); return NULL; } x = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 0)); y = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 1)); z = PyLong_AsLong(PyTuple_GET_ITEM(tuple, 2)); if (newpos + x > newDataLength || diffPtr + x > diffBlock + diffBlockLength) { PyMem_Free(newData); PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\"); return NULL; } memcpy(newData + newpos, diffPtr, x); diffPtr += x; for (j = 0; j < x; j++) if ((oldpos + j >= 0) && (oldpos + j < origDataLength)) newData[newpos + j] += origData[oldpos + j]; newpos += x; oldpos += x; if (newpos + y > newDataLength || extraPtr + y > extraBlock + extraBlockLength) { PyMem_Free(newData); PyErr_SetString(PyExc_ValueError, \"corrupt patch (overflow)\"); return NULL; } memcpy(newData + newpos, extraPtr, y); extraPtr += y; newpos += y; oldpos += z; } /* confirm that a valid patch was applied */ if (newpos != newDataLength || diffPtr != diffBlock + diffBlockLength || extraPtr != extraBlock + extraBlockLength) { PyMem_Free(newData); PyErr_SetString(PyExc_ValueError, \"corrupt patch (underflow)\"); return NULL; } results = PyBytes_FromStringAndSize(newData, newDataLength); PyMem_Free(newData); return results; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431311, "input": "static int decode_attr_fh_expire_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *type) { __be32 *p; *type = 0; if (unlikely(bitmap[0] & (FATTR4_WORD0_FH_EXPIRE_TYPE - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_FH_EXPIRE_TYPE)) { p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) return -EIO; *type = be32_to_cpup(p); bitmap[0] &= ~FATTR4_WORD0_FH_EXPIRE_TYPE; } dprintk(\"%s: expire type=0x%x\\n\", __func__, *type); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338012, "input": "int imap_cmd_idle (IMAP_DATA* idata) { int rc; if (cmd_start (idata, \"IDLE\", IMAP_CMD_POLL) < 0) { cmd_handle_fatal (idata); return -1; } if ((ImapPollTimeout > 0) && (mutt_socket_poll (idata->conn, ImapPollTimeout)) == 0) { mutt_error (_(\"Connection to %s timed out\"), idata->conn->account.host); mutt_sleep (2); cmd_handle_fatal (idata); return -1; } do rc = imap_cmd_step (idata); while (rc == IMAP_CMD_CONTINUE); if (rc == IMAP_CMD_RESPOND) { /* successfully entered IDLE state */ idata->state = IMAP_IDLE; /* queue automatic exit when next command is issued */ mutt_buffer_printf (idata->cmdbuf, \"DONE\\r\\n\"); rc = IMAP_CMD_OK; } if (rc != IMAP_CMD_OK) { dprint (1, (debugfile, \"imap_cmd_idle: error starting IDLE\\n\")); return -1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224902, "input": "GF_Err gf_isom_box_array_size(GF_Box *parent, GF_List *list) { GF_Err e; u32 count, i; GF_Box *a; if (! list) return GF_BAD_PARAM; count = gf_list_count(list); for (i = 0; i < count; i++) { a = (GF_Box *)gf_list_get(list, i); if (a) { e = gf_isom_box_size(a); if (e) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"ISOBMF: Error %s computing box %s size\\n\", gf_error_to_string(e), gf_4cc_to_str(a->type) )); return e; } parent->size += a->size; } } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 374474, "input": "static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */ { zval obj; zend_object *object; zval *trace; Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC); Z_OBJ_HT(obj) = &default_exception_handlers; object_properties_init(object, class_type); ALLOC_ZVAL(trace); Z_UNSET_ISREF_P(trace); Z_SET_REFCOUNT_P(trace, 0); zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC); zend_update_property_string(default_exception_ce, &obj, \"file\", sizeof(\"file\")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC); zend_update_property_long(default_exception_ce, &obj, \"line\", sizeof(\"line\")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); zend_update_property(default_exception_ce, &obj, \"trace\", sizeof(\"trace\")-1, trace TSRMLS_CC); return Z_OBJVAL(obj); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303437, "input": "static void enable_no_etm(gnutls_priority_t c) { c->no_etm = 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381453, "input": "static int v4l_dbg_g_chip_info(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { #ifdef CONFIG_VIDEO_ADV_DEBUG struct video_device *vfd = video_devdata(file); struct v4l2_dbg_chip_info *p = arg; struct v4l2_subdev *sd; int idx = 0; switch (p->match.type) { case V4L2_CHIP_MATCH_BRIDGE: if (ops->vidioc_s_register) p->flags |= V4L2_CHIP_FL_WRITABLE; if (ops->vidioc_g_register) p->flags |= V4L2_CHIP_FL_READABLE; strscpy(p->name, vfd->v4l2_dev->name, sizeof(p->name)); if (ops->vidioc_g_chip_info) return ops->vidioc_g_chip_info(file, fh, arg); if (p->match.addr) return -EINVAL; return 0; case V4L2_CHIP_MATCH_SUBDEV: if (vfd->v4l2_dev == NULL) break; v4l2_device_for_each_subdev(sd, vfd->v4l2_dev) { if (p->match.addr != idx++) continue; if (sd->ops->core && sd->ops->core->s_register) p->flags |= V4L2_CHIP_FL_WRITABLE; if (sd->ops->core && sd->ops->core->g_register) p->flags |= V4L2_CHIP_FL_READABLE; strscpy(p->name, sd->name, sizeof(p->name)); return 0; } break; } return -EINVAL; #else return -ENOTTY; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446043, "input": "static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1, const char *name, int tree_name_len) { unsigned long size; char *data; enum object_type type; char *to_free = NULL; int hit; data = read_sha1_file(sha1, &type, &size); if (!data) { error(\"'%s': unable to read %s\", name, sha1_to_hex(sha1)); return 0; } if (opt->relative && opt->prefix_length) { static char name_buf[PATH_MAX]; char *cp; int name_len = strlen(name) - opt->prefix_length + 1; if (!tree_name_len) name += opt->prefix_length; else { if (ARRAY_SIZE(name_buf) <= name_len) cp = to_free = xmalloc(name_len); else cp = name_buf; memcpy(cp, name, tree_name_len); strcpy(cp + tree_name_len, name + tree_name_len + opt->prefix_length); name = cp; } } hit = grep_buffer(opt, name, data, size); free(data); free(to_free); return hit; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373792, "input": "qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */ { DEFiRet; uchar pszBuf[64]; size_t lenBuf; ASSERT(pThis != NULL); /* we need to do a quick check if our water marks are set plausible. If not, * we correct the most important shortcomings. TODO: do that!!!! -- rgerhards, 2008-03-14 */ /* finalize some initializations that could not yet be done because it is * influenced by properties which might have been set after queueConstruct () */ if(pThis->pqParent == NULL) { pThis->mut = (pthread_mutex_t *) MALLOC (sizeof (pthread_mutex_t)); pthread_mutex_init(pThis->mut, NULL); } else { /* child queue, we need to use parent's mutex */ DBGOPRINT((obj_t*) pThis, \"I am a child\\n\"); pThis->mut = pThis->pqParent->mut; } pthread_mutex_init(&pThis->mutThrdMgmt, NULL); pthread_cond_init (&pThis->condDAReady, NULL); pthread_cond_init (&pThis->notFull, NULL); pthread_cond_init (&pThis->notEmpty, NULL); pthread_cond_init (&pThis->belowFullDlyWtrMrk, NULL); pthread_cond_init (&pThis->belowLightDlyWtrMrk, NULL); /* call type-specific constructor */ CHKiRet(pThis->qConstruct(pThis)); /* this also sets bIsDA */ DBGOPRINT((obj_t*) pThis, \"type %d, enq-only %d, disk assisted %d, maxFileSz %lld, lqsize %d, pqsize %d, child %d, \" \"full delay %d, light delay %d, deq batch size %d starting\\n\", pThis->qType, pThis->bEnqOnly, pThis->bIsDA, pThis->iMaxFileSize, getLogicalQueueSize(pThis), getPhysicalQueueSize(pThis), pThis->pqParent == NULL ? 0 : 1, pThis->iFullDlyMrk, pThis->iLightDlyMrk, pThis->iDeqBatchSize); if(pThis->qType == QUEUETYPE_DIRECT) FINALIZE; /* with direct queues, we are already finished... */ /* create worker thread pools for regular and DA operation. */ lenBuf = snprintf((char*)pszBuf, sizeof(pszBuf), \"%s:Reg\", obj.GetName((obj_t*) pThis)); CHKiRet(wtpConstruct (&pThis->pWtpReg)); CHKiRet(wtpSetDbgHdr (pThis->pWtpReg, pszBuf, lenBuf)); CHKiRet(wtpSetpfRateLimiter (pThis->pWtpReg, (rsRetVal (*)(void *pUsr)) RateLimiter)); CHKiRet(wtpSetpfChkStopWrkr (pThis->pWtpReg, (rsRetVal (*)(void *pUsr, int)) ChkStopWrkrReg)); CHKiRet(wtpSetpfGetDeqBatchSize (pThis->pWtpReg, (rsRetVal (*)(void *pUsr, int*)) GetDeqBatchSize)); CHKiRet(wtpSetpfDoWork (pThis->pWtpReg, (rsRetVal (*)(void *pUsr, void *pWti)) ConsumerReg)); CHKiRet(wtpSetpfObjProcessed (pThis->pWtpReg, (rsRetVal (*)(void *pUsr, wti_t *pWti)) batchProcessed)); CHKiRet(wtpSetpmutUsr (pThis->pWtpReg, pThis->mut)); CHKiRet(wtpSetpcondBusy (pThis->pWtpReg, &pThis->notEmpty)); CHKiRet(wtpSetiNumWorkerThreads (pThis->pWtpReg, pThis->iNumWorkerThreads)); CHKiRet(wtpSettoWrkShutdown (pThis->pWtpReg, pThis->toWrkShutdown)); CHKiRet(wtpSetpUsr (pThis->pWtpReg, pThis)); CHKiRet(wtpConstructFinalize (pThis->pWtpReg)); /* set up DA system if we have a disk-assisted queue */ if(pThis->bIsDA) InitDA(pThis, LOCK_MUTEX); /* initiate DA mode */ DBGOPRINT((obj_t*) pThis, \"queue finished initialization\\n\"); /* if the queue already contains data, we need to start the correct number of worker threads. This can be * the case when a disk queue has been loaded. If we did not start it here, it would never start. */ qqueueAdviseMaxWorkers(pThis); pThis->bQueueStarted = 1; finalize_it: RETiRet; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263061, "input": "iasecc_card_ctl(struct sc_card *card, unsigned long cmd, void *ptr) { struct sc_context *ctx = card->ctx; struct iasecc_sdo *sdo = (struct iasecc_sdo *) ptr; switch (cmd) { case SC_CARDCTL_GET_SERIALNR: return iasecc_get_serialnr(card, (struct sc_serial_number *)ptr); case SC_CARDCTL_IASECC_SDO_CREATE: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_SDO_CREATE: sdo_class %X\", sdo->sdo_class); return iasecc_sdo_create(card, (struct iasecc_sdo *) ptr); case SC_CARDCTL_IASECC_SDO_DELETE: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_SDO_DELETE: sdo_class %X\", sdo->sdo_class); return iasecc_sdo_delete(card, (struct iasecc_sdo *) ptr); case SC_CARDCTL_IASECC_SDO_PUT_DATA: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_SDO_PUT_DATA: sdo_class %X\", sdo->sdo_class); return iasecc_sdo_put_data(card, (struct iasecc_sdo_update *) ptr); case SC_CARDCTL_IASECC_SDO_KEY_RSA_PUT_DATA: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_SDO_KEY_RSA_PUT_DATA\"); return iasecc_sdo_key_rsa_put_data(card, (struct iasecc_sdo_rsa_update *) ptr); case SC_CARDCTL_IASECC_SDO_GET_DATA: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_SDO_GET_DATA: sdo_class %X\", sdo->sdo_class); return iasecc_sdo_get_data(card, (struct iasecc_sdo *) ptr); case SC_CARDCTL_IASECC_SDO_GENERATE: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_SDO_GET_DATA: sdo_class %X\", sdo->sdo_class); return iasecc_sdo_generate(card, (struct iasecc_sdo *) ptr); case SC_CARDCTL_GET_SE_INFO: sc_log(ctx, \"CMD SC_CARDCTL_GET_SE_INFO: sdo_class %X\", sdo->sdo_class); return iasecc_se_get_info(card, (struct iasecc_se_info *) ptr); case SC_CARDCTL_GET_CHV_REFERENCE_IN_SE: sc_log(ctx, \"CMD SC_CARDCTL_GET_CHV_REFERENCE_IN_SE\"); return iasecc_get_chv_reference_from_se(card, (int *)ptr); case SC_CARDCTL_IASECC_GET_FREE_KEY_REFERENCE: sc_log(ctx, \"CMD SC_CARDCTL_IASECC_GET_FREE_KEY_REFERENCE\"); return iasecc_get_free_reference(card, (struct iasecc_ctl_get_free_reference *)ptr); } return SC_ERROR_NOT_SUPPORTED; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 455264, "input": "PasswordInvalid ( VOID ) { EFI_INPUT_KEY Key; // // Invalid password, prompt error message // do { CreateDialog (&Key, gEmptyString, gPassowordInvalid, gPressEnter, gEmptyString, NULL); } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497608, "input": "void ssh_reseed(void){ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 237597, "input": "GF_AVCConfig *gf_isom_avc_config_get(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex) { GF_TrackBox *trak; GF_MPEGVisualSampleEntryBox *entry; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak || !trak->Media || !DescriptionIndex) return NULL; if (gf_isom_get_avc_svc_type(the_file, trackNumber, DescriptionIndex)==GF_ISOM_AVCTYPE_NONE) return NULL; entry = (GF_MPEGVisualSampleEntryBox*)gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, DescriptionIndex-1); if (!entry) return NULL; if (!entry->avc_config) return NULL; return AVC_DuplicateConfig(entry->avc_config->config); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453358, "input": "*/ static enum hrtimer_restart bfq_idle_slice_timer(struct hrtimer *timer) { struct bfq_data *bfqd = container_of(timer, struct bfq_data, idle_slice_timer); struct bfq_queue *bfqq = bfqd->in_service_queue; /* * Theoretical race here: the in-service queue can be NULL or * different from the queue that was idling if a new request * arrives for the current queue and there is a full dispatch * cycle that changes the in-service queue. This can hardly * happen, but in the worst case we just expire a queue too * early. */ if (bfqq) bfq_idle_slice_timer_body(bfqd, bfqq); return HRTIMER_NORESTART;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364125, "input": "static ssize_t use_zero_page_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return single_hugepage_flag_show(kobj, attr, buf, TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393123, "input": "TEST_F(QueryPlannerTest, OrCollapsesToSingleScan2) { addIndex(BSON(\"a\" << 1)); runQuery(fromjson(\"{$or: [{a:{$lt:2}}, {a:{$lt:4}}]}\")); assertNumSolutions(2U); assertSolutionExists(\"{cscan: {dir: 1}}\"); assertSolutionExists( \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \" \"bounds: {a: [[-Infinity,4,true,false]]}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219109, "input": "static void pcre_log_error(const char* func, int line, int pcre_code, const char* pattern, int pattern_size, const char* subject, int subject_size, const char* repl, int repl_size, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0) { const char* escapedPattern; const char* escapedSubject; const char* escapedRepl; std::string p(pattern, pattern_size); std::string s(subject, subject_size); std::string r(repl, repl_size); escapedPattern = Logger::EscapeString(p); escapedSubject = Logger::EscapeString(s); escapedRepl = Logger::EscapeString(r); const char* errString = (pcre_code == PCRE_ERROR_MATCHLIMIT) ? \"PCRE_ERROR_MATCHLIMIT\" : (pcre_code == PCRE_ERROR_RECURSIONLIMIT) ? \"PCRE_ERROR_RECURSIONLIMIT\" : \"UNKNOWN\"; raise_warning_unsampled( \"REGEXERR: %s/%d: err=%d(%s), pattern='%s', subject='%s', repl='%s', \" \"limits=(%\" PRId64 \", %\" PRId64 \"), extra=(%d, %d, %d, %d)\", func, line, pcre_code, errString, escapedPattern, escapedSubject, escapedRepl, tl_pcre_globals->preg_backtrace_limit, tl_pcre_globals->preg_recursion_limit, arg1, arg2, arg3, arg4); free((void *)escapedPattern); free((void *)escapedSubject); free((void *)escapedRepl); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238847, "input": "explicit CropAndResizeGradBoxesOp(OpKernelConstruction* context) : AsyncOpKernel(context) { string method; OP_REQUIRES_OK(context, context->GetAttr(\"method\", &method)); OP_REQUIRES(context, method == \"bilinear\", errors::InvalidArgument(\"method must be 'bilinear'\", method)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429663, "input": "mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...) { va_list ap; va_start(ap, arg); switch(option) { case MYSQL_OPT_CONNECT_TIMEOUT: *((uint *)arg)= mysql->options.connect_timeout; break; case MYSQL_OPT_COMPRESS: *((my_bool *)arg)= mysql->options.compress; break; case MYSQL_OPT_NAMED_PIPE: *((my_bool *)arg)= mysql->options.named_pipe; break; case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ *((uint *)arg)= test(mysql->options.client_flag & CLIENT_LOCAL_FILES); break; case MYSQL_INIT_COMMAND: /* mysql_get_optionsv(mysql, MYSQL_INIT_COMMAND, commands, elements) */ { unsigned int *elements; if (arg) *((char **)arg)= mysql->options.init_command ? mysql->options.init_command->buffer : NULL; if ((elements= va_arg(ap, unsigned int *))) *elements= mysql->options.init_command ? mysql->options.init_command->elements : 0; } break; case MYSQL_READ_DEFAULT_FILE: *((char **)arg)= mysql->options.my_cnf_file; break; case MYSQL_READ_DEFAULT_GROUP: *((char **)arg)= mysql->options.my_cnf_group; break; case MYSQL_SET_CHARSET_DIR: /* not supported in this version. Since all character sets are internally available, we don't throw an error */ *((char **)arg)= NULL; break; case MYSQL_SET_CHARSET_NAME: if (mysql->charset) *((const char **)arg)= mysql->charset->csname; else *((char **)arg)= mysql->options.charset_name; break; case MYSQL_OPT_RECONNECT: *((my_bool *)arg)= mysql->options.reconnect; break; case MYSQL_OPT_PROTOCOL: *((uint *)arg)= mysql->options.protocol; break; case MYSQL_OPT_READ_TIMEOUT: *((uint *)arg)= mysql->options.read_timeout; break; case MYSQL_OPT_WRITE_TIMEOUT: *((uint *)arg)= mysql->options.write_timeout; break; case MYSQL_REPORT_DATA_TRUNCATION: *((my_bool *)arg)= mysql->options.report_data_truncation; break; case MYSQL_PROGRESS_CALLBACK: *((void (**)(const MYSQL *, uint, uint, double, const char *, uint))arg)= mysql->options.extension ? mysql->options.extension->report_progress : NULL; break; case MYSQL_SERVER_PUBLIC_KEY: *((char **)arg)= mysql->options.extension ? mysql->options.extension->server_public_key : NULL; break; case MYSQL_PLUGIN_DIR: *((char **)arg)= mysql->options.extension ? mysql->options.extension->plugin_dir : NULL; break; case MYSQL_DEFAULT_AUTH: *((char **)arg)= mysql->options.extension ? mysql->options.extension->default_auth : NULL; break; case MYSQL_OPT_NONBLOCK: *((my_bool *)arg)= test(mysql->options.extension && mysql->options.extension->async_context); break; case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS: *((my_bool *)arg)= test(mysql->options.client_flag & CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS); break; case MYSQL_OPT_SSL_ENFORCE: *((my_bool *)arg)= mysql->options.use_ssl; break; case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: *((my_bool *)arg)= test(mysql->options.client_flag & CLIENT_SSL_VERIFY_SERVER_CERT); break; case MYSQL_OPT_SSL_KEY: *((char **)arg)= mysql->options.ssl_key; break; case MYSQL_OPT_SSL_CERT: *((char **)arg)= mysql->options.ssl_cert; break; case MYSQL_OPT_SSL_CA: *((char **)arg)= mysql->options.ssl_ca; break; case MYSQL_OPT_SSL_CAPATH: *((char **)arg)= mysql->options.ssl_capath; break; case MYSQL_OPT_SSL_CIPHER: *((char **)arg)= mysql->options.ssl_cipher; break; case MYSQL_OPT_SSL_CRL: *((char **)arg)= mysql->options.extension ? mysql->options.ssl_cipher : NULL; break; case MYSQL_OPT_SSL_CRLPATH: *((char **)arg)= mysql->options.extension ? mysql->options.extension->ssl_crlpath : NULL; break; case MYSQL_OPT_CONNECT_ATTRS: /* mysql_get_optionsv(mysql, MYSQL_OPT_CONNECT_ATTRS, keys, vals, elements) */ { unsigned int i, *elements; char **key= NULL; void *arg1; char **val= NULL; if (arg) key= *(char ***)arg; arg1= va_arg(ap, char **); if (arg1) val= *(char ***)arg1; if (!(elements= va_arg(ap, unsigned int *))) goto error; *elements= 0; if (!mysql->options.extension || !hash_inited(&mysql->options.extension->connect_attrs)) break; *elements= mysql->options.extension->connect_attrs.records; if (val || key) { for (i=0; i < *elements; i++) { uchar *p= hash_element(&mysql->options.extension->connect_attrs, i); if (key) key[i]= (char *)p; p+= strlen((char *)p) + 1; if (val) val[i]= (char *)p; } } } break; case MYSQL_OPT_MAX_ALLOWED_PACKET: *((unsigned long *)arg)= (mysql) ? mysql->options.max_allowed_packet : max_allowed_packet; break; case MYSQL_OPT_NET_BUFFER_LENGTH: *((unsigned long *)arg)= net_buffer_length; break; case MYSQL_SECURE_AUTH: *((my_bool *)arg)= mysql->options.secure_auth; break; case MYSQL_OPT_BIND: *((char **)arg)= mysql->options.bind_address; break; case MARIADB_OPT_TLS_CIPHER_STRENGTH: *((unsigned int *)arg) = mysql->options.extension ? mysql->options.extension->tls_cipher_strength : 0; break; case MARIADB_OPT_SSL_FP: case MARIADB_OPT_TLS_PEER_FP: *((char **)arg)= mysql->options.extension ? mysql->options.extension->tls_fp : NULL; break; case MARIADB_OPT_SSL_FP_LIST: case MARIADB_OPT_TLS_PEER_FP_LIST: *((char **)arg)= mysql->options.extension ? mysql->options.extension->tls_fp_list : NULL; break; case MARIADB_OPT_TLS_PASSPHRASE: *((char **)arg)= mysql->options.extension ? mysql->options.extension->tls_pw : NULL; break; case MARIADB_OPT_CONNECTION_READ_ONLY: *((my_bool *)arg)= mysql->options.extension ? mysql->options.extension->read_only : 0; break; case MARIADB_OPT_USERDATA: /* nysql_get_optionv(mysql, MARIADB_OPT_USERDATA, key, value) */ { uchar *p; void *data= va_arg(ap, void *); char *key= (char *)arg; if (key && data && mysql->options.extension && hash_inited(&mysql->options.extension->userdata) && (p= (uchar *)hash_search(&mysql->options.extension->userdata, (uchar *)key, (uint)strlen((char *)key)))) { p+= strlen(key) + 1; *((void **)data)= *((void **)p); break; } if (data) *((void **)data)= NULL; } break; case MARIADB_OPT_CONNECTION_HANDLER: *((char **)arg)= mysql->options.extension ? mysql->options.extension->connection_handler : NULL; break; case MARIADB_OPT_IO_WAIT: *((int(**)(my_socket, my_bool, int))arg) = mysql->options.extension ? mysql->options.extension->io_wait : NULL; break; default: va_end(ap); SET_CLIENT_ERROR(mysql, CR_NOT_IMPLEMENTED, SQLSTATE_UNKNOWN, 0); return(1); } va_end(ap); return(0); error: va_end(ap); return(1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 421525, "input": "lka_proc_config(struct processor_instance *pi) { io_printf(pi->io, \"config|smtpd-version|%s\\n\", SMTPD_VERSION); io_printf(pi->io, \"config|smtp-session-timeout|%d\\n\", SMTPD_SESSION_TIMEOUT); if (pi->subsystems & FILTER_SUBSYSTEM_SMTP_IN) io_printf(pi->io, \"config|subsystem|smtp-in\\n\"); if (pi->subsystems & FILTER_SUBSYSTEM_SMTP_OUT) io_printf(pi->io, \"config|subsystem|smtp-out\\n\"); io_printf(pi->io, \"config|admd|%s\\n\", env->sc_admd != NULL ? env->sc_admd : env->sc_hostname); io_printf(pi->io, \"config|ready\\n\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246154, "input": "static int cannotBeFunction(Parse *pParse, struct SrcList_item *pFrom){ if( pFrom->fg.isTabFunc ){ sqlite3ErrorMsg(pParse, \"'%s' is not a function\", pFrom->zName); return 1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273238, "input": "static std::string ToModeLetters(const Modes::ChangeList& changelist) { // TODO: This assumes that std::string::max_size() >= UINT_MAX Modes::ChangeList::List::const_iterator dummy; return ToModeLetters(changelist.getlist(), UINT_MAX, changelist.getlist().begin(), dummy); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318152, "input": "int headerPut(Header h, rpmtd td, headerPutFlags flags) { int rc; assert(td != NULL); if (flags & HEADERPUT_APPEND) { rc = findEntry(h, td->tag, td->type) ? intAppendEntry(h, td) : intAddEntry(h, td); } else { rc = intAddEntry(h, td); } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197404, "input": "explicit ReverseSequenceOp(OpKernelConstruction* context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr(\"batch_dim\", &batch_dim_)); OP_REQUIRES_OK(context, context->GetAttr(\"seq_dim\", &seq_dim_)); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.ReverseSequence` allows for stack overflow and/or `CHECK`-fail based denial of service. The implementation(https://github.com/tensorflow/tensorflow/blob/5b3b071975e01f0d250c928b2a8f901cd53b90a7/tensorflow/core/kernels/reverse_sequence_op.cc#L114-L118) fails to validate that `seq_dim` and `batch_dim` arguments are valid. Negative values for `seq_dim` can result in stack overflow or `CHECK`-failure, depending on the version of Eigen code used to implement the operation. Similar behavior can be exhibited by invalid values of `batch_dim`. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29575"}} -{"idx": 207976, "input": "csnNormalize23( slap_mask_t usage, Syntax *syntax, MatchingRule *mr, struct berval *val, struct berval *normalized, void *ctx ) { struct berval gt, cnt, sid, mod; struct berval bv; char buf[ STRLENOF( \"YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss\" ) + 1 ]; char *ptr; ber_len_t i; assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 ); assert( !BER_BVISEMPTY( val ) ); gt = *val; ptr = ber_bvchr( >, '#' ); if ( ptr == NULL || ptr == >.bv_val[gt.bv_len] ) { return LDAP_INVALID_SYNTAX; } gt.bv_len = ptr - gt.bv_val; if ( gt.bv_len != STRLENOF( \"YYYYmmddHHMMSSZ\" ) ) { return LDAP_INVALID_SYNTAX; } cnt.bv_val = ptr + 1; cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val ); ptr = ber_bvchr( &cnt, '#' ); if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } cnt.bv_len = ptr - cnt.bv_val; if ( cnt.bv_len != STRLENOF( \"000000\" ) ) { return LDAP_INVALID_SYNTAX; } sid.bv_val = ptr + 1; sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val ); ptr = ber_bvchr( &sid, '#' ); if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } sid.bv_len = ptr - sid.bv_val; if ( sid.bv_len != STRLENOF( \"00\" ) ) { return LDAP_INVALID_SYNTAX; } mod.bv_val = ptr + 1; mod.bv_len = val->bv_len - ( mod.bv_val - val->bv_val ); if ( mod.bv_len != STRLENOF( \"000000\" ) ) { return LDAP_INVALID_SYNTAX; } bv.bv_len = STRLENOF( \"YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss\" ); bv.bv_val = buf; ptr = bv.bv_val; ptr = lutil_strncopy( ptr, gt.bv_val, gt.bv_len - 1 ); ptr = lutil_strcopy( ptr, \".000000Z#\" ); ptr = lutil_strbvcopy( ptr, &cnt ); *ptr++ = '#'; *ptr++ = '0'; for ( i = 0; i < sid.bv_len; i++ ) { *ptr++ = TOLOWER( sid.bv_val[ i ] ); } *ptr++ = '#'; for ( i = 0; i < mod.bv_len; i++ ) { *ptr++ = TOLOWER( mod.bv_val[ i ] ); } *ptr = '\\0'; assert( ptr == &bv.bv_val[bv.bv_len] ); if ( csnValidate( syntax, &bv ) != LDAP_SUCCESS ) { return LDAP_INVALID_SYNTAX; } ber_dupbv_x( normalized, &bv, ctx ); return LDAP_SUCCESS; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Reachable Assertion"], "explanation": "A flaw was found in OpenLDAP in versions before 2.4.56. This flaw allows an attacker who sends a malicious packet processed by OpenLDAP to force a failed assertion in csnNormalize23(). The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-617", "cve": "CVE-2020-25710"}} -{"idx": 461589, "input": "static void pop_callee_regs(u8 **pprog, bool *callee_regs_used) { u8 *prog = *pprog; int cnt = 0; if (callee_regs_used[3]) EMIT2(0x41, 0x5F); /* pop r15 */ if (callee_regs_used[2]) EMIT2(0x41, 0x5E); /* pop r14 */ if (callee_regs_used[1]) EMIT2(0x41, 0x5D); /* pop r13 */ if (callee_regs_used[0]) EMIT1(0x5B); /* pop rbx */ *pprog = prog; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 388306, "input": "wStream* cliprdr_packet_lock_clipdata_new(const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData) { wStream* s; if (!lockClipboardData) return NULL; s = cliprdr_packet_new(CB_LOCK_CLIPDATA, 0, 4); if (!s) return NULL; cliprdr_write_lock_clipdata(s, lockClipboardData); return s; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409866, "input": "static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, u32 start_seq, u32 end_seq) { int in_sack, err; unsigned int pkt_len; unsigned int mss; in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq) && !before(end_seq, TCP_SKB_CB(skb)->end_seq); if (tcp_skb_pcount(skb) > 1 && !in_sack && after(TCP_SKB_CB(skb)->end_seq, start_seq)) { mss = tcp_skb_mss(skb); in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq); if (!in_sack) { pkt_len = start_seq - TCP_SKB_CB(skb)->seq; if (pkt_len < mss) pkt_len = mss; } else { pkt_len = end_seq - TCP_SKB_CB(skb)->seq; if (pkt_len < mss) return -EINVAL; } /* Round if necessary so that SACKs cover only full MSSes * and/or the remaining small portion (if present) */ if (pkt_len > mss) { unsigned int new_len = (pkt_len / mss) * mss; if (!in_sack && new_len < pkt_len) { new_len += mss; if (new_len > skb->len) return 0; } pkt_len = new_len; } err = tcp_fragment(sk, skb, pkt_len, mss); if (err < 0) return err; } return in_sack; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234472, "input": "ff_lseg_merge(struct pnfs_layout_segment *new, struct pnfs_layout_segment *old) { u64 new_end, old_end; if (test_bit(NFS_LSEG_LAYOUTRETURN, &old->pls_flags)) return false; if (new->pls_range.iomode != old->pls_range.iomode) return false; old_end = pnfs_calc_offset_end(old->pls_range.offset, old->pls_range.length); if (old_end < new->pls_range.offset) return false; new_end = pnfs_calc_offset_end(new->pls_range.offset, new->pls_range.length); if (new_end < old->pls_range.offset) return false; if (!ff_lseg_match_mirrors(new, old)) return false; /* Mergeable: copy info from 'old' to 'new' */ if (new_end < old_end) new_end = old_end; if (new->pls_range.offset < old->pls_range.offset) new->pls_range.offset = old->pls_range.offset; new->pls_range.length = pnfs_calc_offset_length(new->pls_range.offset, new_end); if (test_bit(NFS_LSEG_ROC, &old->pls_flags)) set_bit(NFS_LSEG_ROC, &new->pls_flags); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197477, "input": "export_desktop_file (const char *app, const char *branch, const char *arch, GKeyFile *metadata, const char * const *previous_ids, int parent_fd, const char *name, struct stat *stat_buf, char **target, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; glnx_autofd int desktop_fd = -1; g_autofree char *tmpfile_name = g_strdup_printf (\"export-desktop-XXXXXX\"); g_autoptr(GOutputStream) out_stream = NULL; g_autofree gchar *data = NULL; gsize data_len; g_autofree gchar *new_data = NULL; gsize new_data_len; g_autoptr(GKeyFile) keyfile = NULL; g_autofree gchar *old_exec = NULL; gint old_argc; g_auto(GStrv) old_argv = NULL; g_auto(GStrv) groups = NULL; GString *new_exec = NULL; g_autofree char *escaped_app = maybe_quote (app); g_autofree char *escaped_branch = maybe_quote (branch); g_autofree char *escaped_arch = maybe_quote (arch); int i; if (!flatpak_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error)) goto out; if (!read_fd (desktop_fd, stat_buf, &data, &data_len, error)) goto out; keyfile = g_key_file_new (); if (!g_key_file_load_from_data (keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, error)) goto out; if (g_str_has_suffix (name, \".service\")) { g_autofree gchar *dbus_name = NULL; g_autofree gchar *expected_dbus_name = g_strndup (name, strlen (name) - strlen (\".service\")); dbus_name = g_key_file_get_string (keyfile, \"D-BUS Service\", \"Name\", NULL); if (dbus_name == NULL || strcmp (dbus_name, expected_dbus_name) != 0) { return flatpak_fail_error (error, FLATPAK_ERROR_EXPORT_FAILED, _(\"D-Bus service file '%s' has wrong name\"), name); } } if (g_str_has_suffix (name, \".desktop\")) { gsize length; g_auto(GStrv) tags = g_key_file_get_string_list (metadata, \"Application\", \"tags\", &length, NULL); if (tags != NULL) { g_key_file_set_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, \"X-Flatpak-Tags\", (const char * const *) tags, length); } /* Add a marker so consumers can easily find out that this launches a sandbox */ g_key_file_set_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, \"X-Flatpak\", app); /* If the app has been renamed, add its old .desktop filename to * X-Flatpak-RenamedFrom in the new .desktop file, taking care not to * introduce duplicates. */ if (previous_ids != NULL) { const char *X_FLATPAK_RENAMED_FROM = \"X-Flatpak-RenamedFrom\"; g_auto(GStrv) renamed_from = g_key_file_get_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, X_FLATPAK_RENAMED_FROM, NULL, NULL); g_autoptr(GPtrArray) merged = g_ptr_array_new_with_free_func (g_free); g_autoptr(GHashTable) seen = g_hash_table_new (g_str_hash, g_str_equal); const char *new_suffix; for (i = 0; renamed_from != NULL && renamed_from[i] != NULL; i++) { if (!g_hash_table_contains (seen, renamed_from[i])) { gchar *copy = g_strdup (renamed_from[i]); g_hash_table_insert (seen, copy, copy); g_ptr_array_add (merged, g_steal_pointer (©)); } } /* If an app was renamed from com.example.Foo to net.example.Bar, and * the new version exports net.example.Bar-suffix.desktop, we assume the * old version exported com.example.Foo-suffix.desktop. * * This assertion is true because * flatpak_name_matches_one_wildcard_prefix() is called on all * exported files before we get here. */ g_assert (g_str_has_prefix (name, app)); /* \".desktop\" for the \"main\" desktop file; something like * \"-suffix.desktop\" for extra ones. */ new_suffix = name + strlen (app); for (i = 0; previous_ids[i] != NULL; i++) { g_autofree gchar *previous_desktop = g_strconcat (previous_ids[i], new_suffix, NULL); if (!g_hash_table_contains (seen, previous_desktop)) { g_hash_table_insert (seen, previous_desktop, previous_desktop); g_ptr_array_add (merged, g_steal_pointer (&previous_desktop)); } } if (merged->len > 0) { g_ptr_array_add (merged, NULL); g_key_file_set_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, X_FLATPAK_RENAMED_FROM, (const char * const *) merged->pdata, merged->len - 1); } } } groups = g_key_file_get_groups (keyfile, NULL); for (i = 0; groups[i] != NULL; i++) { g_auto(GStrv) flatpak_run_opts = g_key_file_get_string_list (keyfile, groups[i], \"X-Flatpak-RunOptions\", NULL, NULL); g_autofree char *flatpak_run_args = format_flatpak_run_args_from_run_opts (flatpak_run_opts); g_key_file_remove_key (keyfile, groups[i], \"X-Flatpak-RunOptions\", NULL); g_key_file_remove_key (keyfile, groups[i], \"TryExec\", NULL); /* Remove this to make sure nothing tries to execute it outside the sandbox*/ g_key_file_remove_key (keyfile, groups[i], \"X-GNOME-Bugzilla-ExtraInfoScript\", NULL); new_exec = g_string_new (\"\"); g_string_append_printf (new_exec, FLATPAK_BINDIR \"/flatpak run --branch=%s --arch=%s\", escaped_branch, escaped_arch); if (flatpak_run_args != NULL) g_string_append_printf (new_exec, \"%s\", flatpak_run_args); old_exec = g_key_file_get_string (keyfile, groups[i], \"Exec\", NULL); if (old_exec && g_shell_parse_argv (old_exec, &old_argc, &old_argv, NULL) && old_argc >= 1) { int j; g_autofree char *command = maybe_quote (old_argv[0]); g_string_append_printf (new_exec, \" --command=%s\", command); for (j = 1; j < old_argc; j++) { if (strcasecmp (old_argv[j], \"%f\") == 0 || strcasecmp (old_argv[j], \"%u\") == 0) { g_string_append (new_exec, \" --file-forwarding\"); break; } } g_string_append (new_exec, \" \"); g_string_append (new_exec, escaped_app); for (j = 1; j < old_argc; j++) { g_autofree char *arg = maybe_quote (old_argv[j]); if (strcasecmp (arg, \"%f\") == 0) g_string_append_printf (new_exec, \" @@ %s @@\", arg); else if (strcasecmp (arg, \"%u\") == 0) g_string_append_printf (new_exec, \" @@u %s @@\", arg); else if (strcmp (arg, \"@@\") == 0 || strcmp (arg, \"@@u\") == 0) g_print (_(\"Skipping invalid Exec argument %s\\n\"), arg); else g_string_append_printf (new_exec, \" %s\", arg); } } else { g_string_append (new_exec, \" \"); g_string_append (new_exec, escaped_app); } g_key_file_set_string (keyfile, groups[i], G_KEY_FILE_DESKTOP_KEY_EXEC, new_exec->str); } new_data = g_key_file_to_data (keyfile, &new_data_len, error); if (new_data == NULL) goto out; if (!flatpak_open_in_tmpdir_at (parent_fd, 0755, tmpfile_name, &out_stream, cancellable, error)) goto out; if (!g_output_stream_write_all (out_stream, new_data, new_data_len, NULL, cancellable, error)) goto out; if (!g_output_stream_close (out_stream, cancellable, error)) goto out; if (target) *target = g_steal_pointer (&tmpfile_name); ret = TRUE; out: if (new_exec != NULL) g_string_free (new_exec, TRUE); return ret; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Control of Generation of Code ('Code Injection')"], "explanation": "Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. In Flatpack since version 0.9.4 and before version 1.10.2 has a vulnerability in the \"file forwarding\" feature which can be used by an attacker to gain access to files that would not ordinarily be allowed by the app's permissions. By putting the special tokens `@@` and/or `@@u` in the Exec field of a Flatpak app's .desktop file, a malicious app publisher can trick flatpak into behaving as though the user had chosen to open a target file with their Flatpak app, which automatically makes that file available to the Flatpak app. This is fixed in version 1.10.2. A minimal solution is the first commit \"`Disallow @@ and @@U usage in desktop files`\". The follow-up commits \"`dir: Reserve the whole @@ prefix`\" and \"`dir: Refuse to export .desktop files with suspicious uses of @@ tokens`\" are recommended, but not strictly required. As a workaround, avoid installing Flatpak apps from untrusted sources, or check the contents of the exported `.desktop` files in `exports/share/applications/*.desktop` (typically `~/.local/share/flatpak/exports/share/applications/*.desktop` and `/var/lib/flatpak/exports/share/applications/*.desktop`) to make sure that literal filenames do not follow `@@` or `@@u`.", "severity_level": "NoInfo", "cwe": "CWE-94", "cve": "CVE-2021-21381"}} -{"idx": 364181, "input": "static int __init hugepage_init_sysfs(struct kobject **hugepage_kobj) { int err; *hugepage_kobj = kobject_create_and_add(\"transparent_hugepage\", mm_kobj); if (unlikely(!*hugepage_kobj)) { pr_err(\"failed to create transparent hugepage kobject\\n\"); return -ENOMEM; } err = sysfs_create_group(*hugepage_kobj, &hugepage_attr_group); if (err) { pr_err(\"failed to register transparent hugepage group\\n\"); goto delete_obj; } err = sysfs_create_group(*hugepage_kobj, &khugepaged_attr_group); if (err) { pr_err(\"failed to register transparent hugepage group\\n\"); goto remove_hp_group; } return 0; remove_hp_group: sysfs_remove_group(*hugepage_kobj, &hugepage_attr_group); delete_obj: kobject_put(*hugepage_kobj); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509430, "input": "Item_ident_for_show(THD *thd, Field *par_field, const char *db_arg, const char *table_name_arg): Item(thd), field(par_field), db_name(db_arg), table_name(table_name_arg) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393284, "input": "TEST_F(QueryPlannerTest, OrTwoInexactFetch) { // true means multikey addIndex(BSON(\"names\" << 1), true); runQuery( fromjson(\"{$or: [{names: {$elemMatch: {$eq: 'alexandra'}}},\" \"{names: {$elemMatch: {$eq: 'thomas'}}}]}\")); assertNumSolutions(2U); assertSolutionExists(\"{cscan: {dir: 1}}\"); assertSolutionExists( \"{fetch: {filter: \" \"{$or: [{names: {$elemMatch: {$eq: 'alexandra'}}},\" \"{names: {$elemMatch: {$eq: 'thomas'}}}]}, \" \"node: {ixscan: {filter: null, pattern: {names: 1}}}}}\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 223167, "input": "void SetAttrValue(gtl::ArraySlice value, AttrValue* out) { out->mutable_list()->Clear(); // Create list() even if value empty. for (const auto& v : value) { *out->mutable_list()->add_func() = v; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 306335, "input": "static void ov7xx0_configure(struct sd *sd) { struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc, high, low; gspca_dbg(gspca_dev, D_PROBE, \"starting OV7xx0 configuration\\n\"); /* Detect sensor (sub)type */ rc = i2c_r(sd, OV7610_REG_COM_I); /* add OV7670 here * it appears to be wrongly detected as a 7610 by default */ if (rc < 0) { gspca_err(gspca_dev, \"Error detecting sensor type\\n\"); return; } if ((rc & 3) == 3) { /* quick hack to make OV7670s work */ high = i2c_r(sd, 0x0a); low = i2c_r(sd, 0x0b); /* info(\"%x, %x\", high, low); */ if (high == 0x76 && (low & 0xf0) == 0x70) { gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV76%02x\\n\", low); sd->sensor = SEN_OV7670; } else { gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV7610\\n\"); sd->sensor = SEN_OV7610; } } else if ((rc & 3) == 1) { /* I don't know what's different about the 76BE yet. */ if (i2c_r(sd, 0x15) & 1) { gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV7620AE\\n\"); sd->sensor = SEN_OV7620AE; } else { gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV76BE\\n\"); sd->sensor = SEN_OV76BE; } } else if ((rc & 3) == 0) { /* try to read product id registers */ high = i2c_r(sd, 0x0a); if (high < 0) { gspca_err(gspca_dev, \"Error detecting camera chip PID\\n\"); return; } low = i2c_r(sd, 0x0b); if (low < 0) { gspca_err(gspca_dev, \"Error detecting camera chip VER\\n\"); return; } if (high == 0x76) { switch (low) { case 0x30: gspca_err(gspca_dev, \"Sensor is an OV7630/OV7635\\n\"); gspca_err(gspca_dev, \"7630 is not supported by this driver\\n\"); return; case 0x40: gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV7645\\n\"); sd->sensor = SEN_OV7640; /* FIXME */ break; case 0x45: gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV7645B\\n\"); sd->sensor = SEN_OV7640; /* FIXME */ break; case 0x48: gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV7648\\n\"); sd->sensor = SEN_OV7648; break; case 0x60: gspca_dbg(gspca_dev, D_PROBE, \"Sensor is a OV7660\\n\"); sd->sensor = SEN_OV7660; break; default: gspca_err(gspca_dev, \"Unknown sensor: 0x76%02x\\n\", low); return; } } else { gspca_dbg(gspca_dev, D_PROBE, \"Sensor is an OV7620\\n\"); sd->sensor = SEN_OV7620; } } else { gspca_err(gspca_dev, \"Unknown image sensor version: %d\\n\", rc & 3); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 477983, "input": "ex_mkspell(exarg_T *eap) { int fcount; char_u **fnames; char_u *arg = eap->arg; int ascii = FALSE; if (STRNCMP(arg, \"-ascii\", 6) == 0) { ascii = TRUE; arg = skipwhite(arg + 6); } /* Expand all the remaining arguments (e.g., $VIMRUNTIME). */ if (get_arglist_exp(arg, &fcount, &fnames, FALSE) == OK) { mkspell(fcount, fnames, ascii, eap->forceit, FALSE); FreeWild(fcount, fnames); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378558, "input": "static void rankValueFunc(sqlite3_context *pCtx){ struct CallCount *p; p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ sqlite3_result_int64(pCtx, p->nValue); p->nValue = 0; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431245, "input": "nfs4_listxattr_nfs4_label(struct inode *inode, char *list, size_t list_len) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219580, "input": "bool HHVM_FUNCTION(imageline, const Resource& image, int64_t x1, int64_t y1, int64_t x2, int64_t y2, int64_t color) { gdImagePtr im = get_valid_image_resource(image); if (!im) return false; color = SetupAntiAliasedColor(im, color); gdImageLine(im, x1, y1, x2, y2, color); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303074, "input": "static int do_job(blosc2_context* context) { int32_t ntbytes; /* Set sentinels */ context->dref_not_init = 1; /* Check whether we need to restart threads */ check_nthreads(context); /* Run the serial version when nthreads is 1 or when the buffers are not larger than blocksize */ if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1) { /* The context for this 'thread' has no been initialized yet */ if (context->serial_context == NULL) { context->serial_context = create_thread_context(context, 0); } else if (context->blocksize != context->serial_context->tmp_blocksize) { free_thread_context(context->serial_context); context->serial_context = create_thread_context(context, 0); } ntbytes = serial_blosc(context->serial_context); } else { ntbytes = parallel_blosc(context); } return ntbytes; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336896, "input": "rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) { VALUE str = rb_str_new(ptr, len); rb_enc_associate(str, enc); return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219604, "input": "template explicit StaticString(const char(&s)[N]) { construct(s, N - 1); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 308314, "input": "XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) { errorCode = XML_ERROR_INVALID_ARGUMENT; return XML_STATUS_ERROR; } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; case XML_INITIALIZED: if (parentParser == NULL && !startParsing(parser)) { errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } default: ps_parsing = XML_PARSING; } if (len == 0) { ps_finalBuffer = (XML_Bool)isFinal; if (!isFinal) return XML_STATUS_OK; positionPtr = bufferPtr; parseEndPtr = bufferEnd; /* If data are left over from last buffer, and we now know that these data are the final chunk of input, then we have to check them again to detect errors based on that fact. */ errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); if (errorCode == XML_ERROR_NONE) { switch (ps_parsing) { case XML_SUSPENDED: XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return XML_STATUS_SUSPENDED; case XML_INITIALIZED: case XML_PARSING: ps_parsing = XML_FINISHED; /* fall through */ default: return XML_STATUS_OK; } } eventEndPtr = eventPtr; processor = errorProcessor; return XML_STATUS_ERROR; } #ifndef XML_CONTEXT_BYTES else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; enum XML_Status result; /* Detect overflow (a+b > MAX <==> b > MAX-a) */ if (len > ((XML_Size)-1) / 2 - parseEndByteIndex) { errorCode = XML_ERROR_NO_MEMORY; eventPtr = eventEndPtr = NULL; processor = errorProcessor; return XML_STATUS_ERROR; } parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; errorCode = processor(parser, s, parseEndPtr = s + len, &end); if (errorCode != XML_ERROR_NONE) { eventEndPtr = eventPtr; processor = errorProcessor; return XML_STATUS_ERROR; } else { switch (ps_parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (isFinal) { ps_parsing = XML_FINISHED; return XML_STATUS_OK; } /* fall through */ default: result = XML_STATUS_OK; } } XmlUpdatePosition(encoding, positionPtr, end, &position); nLeftOver = s + len - end; if (nLeftOver) { if (buffer == NULL || nLeftOver > bufferLim - buffer) { /* avoid _signed_ integer overflow */ char *temp = NULL; const int bytesToAllocate = (int)((unsigned)len * 2U); if (bytesToAllocate > 0) { temp = (buffer == NULL ? (char *)MALLOC(bytesToAllocate) : (char *)REALLOC(buffer, bytesToAllocate)); } if (temp == NULL) { errorCode = XML_ERROR_NO_MEMORY; eventPtr = eventEndPtr = NULL; processor = errorProcessor; return XML_STATUS_ERROR; } buffer = temp; bufferLim = buffer + bytesToAllocate; } memcpy(buffer, end, nLeftOver); } bufferPtr = buffer; bufferEnd = buffer + nLeftOver; positionPtr = bufferPtr; parseEndPtr = bufferEnd; eventPtr = bufferPtr; eventEndPtr = bufferPtr; return result; } #endif /* not defined XML_CONTEXT_BYTES */ else { void *buff = XML_GetBuffer(parser, len); if (buff == NULL) return XML_STATUS_ERROR; else { memcpy(buff, s, len); return XML_ParseBuffer(parser, len, isFinal); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 334485, "input": "cached_module_load (const char *name, int flags, char **err) { MonoDl *res; if (err) *err = NULL; mono_loader_lock (); if (!global_module_map) global_module_map = g_hash_table_new (g_str_hash, g_str_equal); res = g_hash_table_lookup (global_module_map, name); if (res) { mono_loader_unlock (); return res; } res = mono_dl_open (name, flags, NULL); if (res) g_hash_table_insert (global_module_map, g_strdup (name), res); mono_loader_unlock (); return res; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458378, "input": "struct hid_field *hidinput_get_led_field(struct hid_device *hid) { struct hid_report *report; struct hid_field *field; int i, j; list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list) { for (i = 0; i < report->maxfield; i++) { field = report->field[i]; for (j = 0; j < field->maxusage; j++) if (field->usage[j].type == EV_LED) return field; } } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281312, "input": "RGWOp* RGWHandler_REST_Obj_S3Website::get_obj_op(bool get_data) { /** If we are in website mode, then it is explicitly impossible to run GET or * HEAD on the actual directory. We must convert the request to run on the * suffix object instead! */ RGWGetObj_ObjStore_S3Website* op = new RGWGetObj_ObjStore_S3Website; op->set_get_data(get_data); return op; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219624, "input": "Variant HHVM_FUNCTION(mcrypt_ofb, const String& cipher, const String& key, const String& data, const Variant& mode, const Variant& viv /* = null_string */) { raise_deprecated(\"Function mcrypt_ofb() is deprecated\"); String iv = viv.toString(); return php_mcrypt_do_crypt(cipher, key, data, \"ofb\", iv, mode.toInt32(), \"mcrypt_ofb\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325868, "input": "best_effort_strncat_from_utf16(struct archive_string *as, const void *_p, size_t bytes, struct archive_string_conv *sc, int be) { const char *utf16 = (const char *)_p; char *mbs; uint32_t uc; int n, ret; (void)sc; /* UNUSED */ /* * Other case, we should do the best effort. * If all character are ASCII(<0x7f), we can convert it. * if not , we set a alternative character and return -1. */ ret = 0; if (archive_string_ensure(as, as->length + bytes +1) == NULL) return (-1); mbs = as->s + as->length; while ((n = utf16_to_unicode(&uc, utf16, bytes, be)) != 0) { if (n < 0) { n *= -1; ret = -1; } bytes -= n; utf16 += n; if (uc > 127) { /* We cannot handle it. */ *mbs++ = '?'; ret = -1; } else *mbs++ = (char)uc; } as->length = mbs - as->s; as->s[as->length] = '\\0'; return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232132, "input": "static char *hasrefs_cb(void *user, ut64 addr, bool verbose) { return r_core_anal_hasrefs ((RCore *)user, addr, verbose); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230252, "input": "CallResult JSObject::getOwnComputedDescriptor( Handle selfHandle, Runtime *runtime, Handle<> nameValHandle, ComputedPropertyDescriptor &desc, MutableHandle<> &valueOrAccessor) { auto converted = toPropertyKeyIfObject(runtime, nameValHandle); if (LLVM_UNLIKELY(converted == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } // The proxy is ignored here so we can avoid calling // JSProxy::getOwnProperty twice on proxies, since // getOwnComputedPrimitiveDescriptor doesn't pass back the // valueOrAccessor. CallResult res = JSObject::getOwnComputedPrimitiveDescriptor( selfHandle, runtime, *converted, IgnoreProxy::Yes, desc); if (LLVM_UNLIKELY(res == ExecutionStatus::EXCEPTION)) { return ExecutionStatus::EXCEPTION; } if (*res) { valueOrAccessor = getComputedSlotValue(selfHandle.get(), runtime, desc); return true; } if (LLVM_UNLIKELY(selfHandle->isProxyObject())) { return JSProxy::getOwnProperty( selfHandle, runtime, nameValHandle, desc, &valueOrAccessor); } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346361, "input": "evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst, size_t datlen) { /*XXX We should have an option to force this to be zero-copy.*/ /*XXX can fail badly on sendfile case. */ struct evbuffer_chain *chain, *previous; size_t nread = 0; int result; EVBUFFER_LOCK2(src, dst); chain = previous = src->first; if (datlen == 0 || dst == src) { result = 0; goto done; } if (dst->freeze_end || src->freeze_start) { result = -1; goto done; } /* short-cut if there is no more data buffered */ if (datlen >= src->total_len) { datlen = src->total_len; evbuffer_add_buffer(dst, src); result = (int)datlen; /*XXXX should return ev_ssize_t*/ goto done; } /* removes chains if possible */ while (chain->off <= datlen) { /* We can't remove the last with data from src unless we * remove all chains, in which case we would have done the if * block above */ EVUTIL_ASSERT(chain != *src->last_with_datap); nread += chain->off; datlen -= chain->off; previous = chain; if (src->last_with_datap == &chain->next) src->last_with_datap = &src->first; chain = chain->next; } if (nread) { /* we can remove the chain */ struct evbuffer_chain **chp; chp = evbuffer_free_trailing_empty_chains(dst); if (dst->first == NULL) { dst->first = src->first; } else { *chp = src->first; } dst->last = previous; previous->next = NULL; src->first = chain; advance_last_with_data(dst); dst->total_len += nread; dst->n_add_for_cb += nread; } /* we know that there is more data in the src buffer than * we want to read, so we manually drain the chain */ evbuffer_add(dst, chain->buffer + chain->misalign, datlen); chain->misalign += datlen; chain->off -= datlen; nread += datlen; /* You might think we would want to increment dst->n_add_for_cb * here too. But evbuffer_add above already took care of that. */ src->total_len -= nread; src->n_del_for_cb += nread; if (nread) { evbuffer_invoke_callbacks(dst); evbuffer_invoke_callbacks(src); } result = (int)nread;/*XXXX should change return type */ done: EVBUFFER_UNLOCK2(src, dst); return result; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325838, "input": "archive_string_default_conversion_for_write(struct archive *a) { (void)a; /* UNUSED */ return (NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330272, "input": "MagickExport Image *MorphImages(const Image *image,const size_t number_frames, ExceptionInfo *exception) { #define MorphImageTag \"Morph/Image\" double alpha, beta; Image *morph_image, *morph_images; MagickBooleanType status; MagickOffsetType scene; const Image *next; ssize_t n; ssize_t y; /* Clone first frame in sequence. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); morph_images=CloneImage(image,0,0,MagickTrue,exception); if (morph_images == (Image *) NULL) return((Image *) NULL); if (GetNextImageInList(image) == (Image *) NULL) { /* Morph single image. */ for (n=1; n < (ssize_t) number_frames; n++) { morph_image=CloneImage(image,0,0,MagickTrue,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } AppendImageToList(&morph_images,morph_image); if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; proceed=SetImageProgress(image,MorphImageTag,(MagickOffsetType) n, number_frames); if (proceed == MagickFalse) status=MagickFalse; } } return(GetFirstImageInList(morph_images)); } /* Morph image sequence. */ status=MagickTrue; scene=0; next=image; for ( ; GetNextImageInList(next) != (Image *) NULL; next=GetNextImageInList(next)) { for (n=0; n < (ssize_t) number_frames; n++) { CacheView *image_view, *morph_view; beta=(double) (n+1.0)/(double) (number_frames+1.0); alpha=1.0-beta; morph_image=ResizeImage(next,(size_t) (alpha*next->columns+beta* GetNextImageInList(next)->columns+0.5),(size_t) (alpha*next->rows+beta* GetNextImageInList(next)->rows+0.5),next->filter,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } status=SetImageStorageClass(morph_image,DirectClass,exception); if (status == MagickFalse) { morph_image=DestroyImage(morph_image); return((Image *) NULL); } AppendImageToList(&morph_images,morph_image); morph_images=GetLastImageInList(morph_images); morph_image=ResizeImage(GetNextImageInList(next),morph_images->columns, morph_images->rows,GetNextImageInList(next)->filter,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } image_view=AcquireVirtualCacheView(morph_image,exception); morph_view=AcquireAuthenticCacheView(morph_images,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \\ magick_number_threads(morph_image,morph_image,morph_image->rows,1) #endif for (y=0; y < (ssize_t) morph_images->rows; y++) { MagickBooleanType sync; const Quantum *magick_restrict p; ssize_t x; Quantum *magick_restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,morph_image->columns,1, exception); q=GetCacheViewAuthenticPixels(morph_view,0,y,morph_images->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) morph_images->columns; x++) { ssize_t i; for (i=0; i < (ssize_t) GetPixelChannels(morph_image); i++) { PixelChannel channel = GetPixelChannelChannel(morph_image,i); PixelTrait traits = GetPixelChannelTraits(morph_image,channel); PixelTrait morph_traits=GetPixelChannelTraits(morph_images,channel); if ((traits == UndefinedPixelTrait) || (morph_traits == UndefinedPixelTrait)) continue; if ((morph_traits & CopyPixelTrait) != 0) { SetPixelChannel(morph_image,channel,p[i],q); continue; } SetPixelChannel(morph_image,channel,ClampToQuantum(alpha* GetPixelChannel(morph_images,channel,q)+beta*p[i]),q); } p+=GetPixelChannels(morph_image); q+=GetPixelChannels(morph_images); } sync=SyncCacheViewAuthenticPixels(morph_view,exception); if (sync == MagickFalse) status=MagickFalse; } morph_view=DestroyCacheView(morph_view); image_view=DestroyCacheView(image_view); morph_image=DestroyImage(morph_image); } if (n < (ssize_t) number_frames) break; /* Clone last frame in sequence. */ morph_image=CloneImage(GetNextImageInList(next),0,0,MagickTrue,exception); if (morph_image == (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } AppendImageToList(&morph_images,morph_image); morph_images=GetLastImageInList(morph_images); if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; proceed=SetImageProgress(image,MorphImageTag,scene, GetImageListLength(image)); if (proceed == MagickFalse) status=MagickFalse; } scene++; } if (GetNextImageInList(next) != (Image *) NULL) { morph_images=DestroyImageList(morph_images); return((Image *) NULL); } return(GetFirstImageInList(morph_images)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 217254, "input": "static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string& xpath) { xmlXPathObject* result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt); if (!result) { xmlXPathFreeContext(ctxt); xmlFreeDoc(ctxt->doc); throw XMLException(\"Invalid XPath: \" + xpath); } if (result->type != XPATH_NODESET) { xmlXPathFreeObject(result); xmlXPathFreeContext(ctxt); xmlFreeDoc(ctxt->doc); throw XMLException(\"Only nodeset result types are supported.\"); } xmlNodeSet* nodeset = result->nodesetval; XMLSharedNodeList* nodes = new XMLSharedNodeList(); if (nodeset) { for (int i = 0; i < nodeset->nodeNr; ++i) { XMLNode* node = readnode(nodeset->nodeTab[i]); nodes->push_back(boost::shared_ptr(node)); } } else { // return empty set } xmlXPathFreeObject(result); return nodes; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use After Free"], "explanation": "Ardour v5.12 contains a use-after-free vulnerability in the component ardour/libs/pbd/xml++.cc when using xmlFreeDoc and xmlXPathFreeContext.", "severity_level": "NoInfo", "cwe": "CWE-416", "cve": "CVE-2020-22617"}} -{"idx": 508724, "input": "void JOIN::cleanup_item_list(List &items) const { DBUG_ENTER(\"JOIN::cleanup_item_list\"); if (!items.is_empty()) { List_iterator_fast it(items); Item *item; while ((item= it++)) item->cleanup(); } DBUG_VOID_RETURN; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 220472, "input": "void* Init(TfLiteContext* context, const char* buffer, size_t length) { // This is a builtin op, so we don't use the contents in 'buffer', if any. // Instead, we allocate a new object to carry information from Prepare() to // Eval(). auto* op_data = new OpData(); context->AddTensors(context, /*tensors_to_add=*/6, &op_data->scratch_tensor_index); return op_data; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370037, "input": "Value ExpressionSplit::evaluate(const Document& root, Variables* variables) const { Value inputArg = _children[0]->evaluate(root, variables); Value separatorArg = _children[1]->evaluate(root, variables); if (inputArg.nullish() || separatorArg.nullish()) { return Value(BSONNULL); } uassert(40085, str::stream() << \"$split requires an expression that evaluates to a string as a first \" \"argument, found: \" << typeName(inputArg.getType()), inputArg.getType() == BSONType::String); uassert(40086, str::stream() << \"$split requires an expression that evaluates to a string as a second \" \"argument, found: \" << typeName(separatorArg.getType()), separatorArg.getType() == BSONType::String); StringData input = inputArg.getStringData(); StringData separator = separatorArg.getStringData(); uassert(40087, \"$split requires a non-empty separator\", !separator.empty()); std::vector output; const char* needle = separator.rawData(); const char* const needleEnd = needle + separator.size(); const char* remainingHaystack = input.rawData(); const char* const haystackEnd = remainingHaystack + input.size(); const char* it = remainingHaystack; while ((it = std::search(remainingHaystack, haystackEnd, needle, needleEnd)) != haystackEnd) { StringData sd(remainingHaystack, it - remainingHaystack); output.push_back(Value(sd)); remainingHaystack = it + separator.size(); } StringData splitString(remainingHaystack, input.size() - (remainingHaystack - input.rawData())); output.push_back(Value(splitString)); return Value(std::move(output)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 238027, "input": "void ComputeAsync(OpKernelContext* context, DoneCallback done) override { SparseFillEmptyRowsOpImpl(context, done); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 482950, "input": "struct dce_i2c_sw *dce80_i2c_sw_create( struct dc_context *ctx) { struct dce_i2c_sw *dce_i2c_sw = kzalloc(sizeof(struct dce_i2c_sw), GFP_KERNEL); if (!dce_i2c_sw) return NULL; dce_i2c_sw_construct(dce_i2c_sw, ctx); return dce_i2c_sw; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 124851, "input": "void MediaElementAudioSourceNode::dispose() { m_mediaElement->setAudioSourceNode(0); uninitialize(); AudioSourceNode::dispose(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 411994, "input": "init_graphics(PyObject *module) { if (PyType_Ready(&GraphicsManager_Type) < 0) return false; if (PyModule_AddObject(module, \"GraphicsManager\", (PyObject *)&GraphicsManager_Type) != 0) return false; if (PyModule_AddFunctions(module, module_methods) != 0) return false; Py_INCREF(&GraphicsManager_Type); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 478390, "input": "static int as_is_first(const struct host_query* hquery) { char* p; int ndots = 0; for (p = hquery->name; *p; p++) { if (*p == '.') { ndots++; } } return ndots >= hquery->channel->ndots; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431411, "input": "static int nfs4_do_call_sync(struct rpc_clnt *clnt, struct nfs_server *server, struct rpc_message *msg, struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, unsigned short task_flags) { struct nfs_client *clp = server->nfs_client; struct nfs4_call_sync_data data = { .seq_server = server, .seq_args = args, .seq_res = res, }; struct rpc_task_setup task_setup = { .rpc_client = clnt, .rpc_message = msg, .callback_ops = clp->cl_mvops->call_sync_ops, .callback_data = &data, .flags = task_flags, }; return nfs4_call_sync_custom(&task_setup); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445658, "input": "static void eval_map_stop(struct seq_file *m, void *v) { mutex_unlock(&trace_eval_mutex); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232394, "input": "inline void OutputLerp32x4x1(const InterpolationCache& xs, const int64 x_start, const int32 ys_ilerp, const float min, const float max, const qint32* const ys_input_lower_ptr, const qint32* const ys_input_upper_ptr, qint32* output_y_ptr) { #ifdef QUANTIZED_RESIZE_BILINEAR_USE_NEON const int64 xs_lower0 = xs.lower[x_start]; const int64 xs_upper0 = xs.upper[x_start]; const int32* const xs_ilerp0 = &xs.ilerp[x_start]; const int64 xs_lower1 = xs.lower[x_start + 1]; const int64 xs_upper1 = xs.upper[x_start + 1]; const int64 xs_lower2 = xs.lower[x_start + 2]; const int64 xs_upper2 = xs.upper[x_start + 2]; const int32* const xs_ilerp2 = &xs.ilerp[x_start + 2]; const int64 xs_lower3 = xs.lower[x_start + 3]; const int64 xs_upper3 = xs.upper[x_start + 3]; const int32x2_t y_lerpsx = vmov_n_s32(ys_ilerp); const int32x2_t x0x1 = ComputeLerpx2( ys_input_lower_ptr + xs_lower0, ys_input_lower_ptr + xs_upper0, ys_input_upper_ptr + xs_lower0, ys_input_upper_ptr + xs_upper0, ys_input_lower_ptr + xs_lower1, ys_input_lower_ptr + xs_upper1, ys_input_upper_ptr + xs_lower1, ys_input_upper_ptr + xs_upper1, xs_ilerp0, y_lerpsx); const int32x2_t x1x2 = ComputeLerpx2( ys_input_lower_ptr + xs_lower2, ys_input_lower_ptr + xs_upper2, ys_input_upper_ptr + xs_lower2, ys_input_upper_ptr + xs_upper2, ys_input_lower_ptr + xs_lower3, ys_input_lower_ptr + xs_upper3, ys_input_upper_ptr + xs_lower3, ys_input_upper_ptr + xs_upper3, xs_ilerp2, y_lerpsx); const int32x4_t x0x1x2x3 = vcombine_s32(x0x1, x1x2); vst1q_s32(reinterpret_cast(output_y_ptr + x_start), x0x1x2x3); #else for (int x = x_start; x < x_start + 4; ++x) { OutputLerpForChannels( xs, x, ys_ilerp, 1, min, max, ys_input_lower_ptr, ys_input_upper_ptr, output_y_ptr); } #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325905, "input": "add_converter(struct archive_string_conv *sc, int (*converter) (struct archive_string *, const void *, size_t, struct archive_string_conv *)) { if (sc == NULL || sc->nconverter >= 2) __archive_errx(1, \"Programming error\"); sc->converter[sc->nconverter++] = converter; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468992, "input": "static void __ip_flush_pending_frames(struct sock *sk, struct sk_buff_head *queue, struct inet_cork *cork) { struct sk_buff *skb; while ((skb = __skb_dequeue_tail(queue)) != NULL) kfree_skb(skb); ip_cork_release(cork); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269146, "input": "inline const int32_t* DimsData() const { return size_ > kMaxSmallSize ? dims_pointer_ : dims_; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509091, "input": "virtual bool set_fake_select_as_master_processor(void *arg) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445835, "input": "void trace_find_cmdline(int pid, char comm[]) { preempt_disable(); arch_spin_lock(&trace_cmdline_lock); __trace_find_cmdline(pid, comm); arch_spin_unlock(&trace_cmdline_lock); preempt_enable(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 251486, "input": "static void connection_del(server *srv, connection *con) { connections * const conns = &srv->conns; if (-1 == con->ndx) return; uint32_t i = (uint32_t)con->ndx; /* not last element */ if (i != --conns->used) { connection * const temp = conns->ptr[i]; conns->ptr[i] = conns->ptr[conns->used]; conns->ptr[conns->used] = temp; conns->ptr[i]->ndx = i; conns->ptr[conns->used]->ndx = -1; } con->ndx = -1; #if 0 fprintf(stderr, \"%s.%d: del: (%d)\", __FILE__, __LINE__, conns->used); for (i = 0; i < conns->used; i++) { fprintf(stderr, \"%d \", conns->ptr[i]->fd); } fprintf(stderr, \"\\n\"); #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357374, "input": "static OPJ_BOOL opj_j2k_get_end_header(opj_j2k_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager) { /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); OPJ_UNUSED(p_manager); p_j2k->cstr_index->main_head_end = opj_stream_tell(p_stream); return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336230, "input": "static inline int ep_events_available(struct eventpoll *ep) { return !list_empty_careful(&ep->rdllist) || READ_ONCE(ep->ovflist) != EP_UNACTIVE_PTR; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338522, "input": "static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args, u64 __user *tags) { __s32 __user *fds = (__s32 __user *) arg; struct file *file; int fd, ret; unsigned i; struct io_rsrc_data *file_data; if (ctx->file_data) return -EBUSY; if (!nr_args) return -EINVAL; if (nr_args > IORING_MAX_FIXED_FILES) return -EMFILE; ret = io_rsrc_node_switch_start(ctx); if (ret) return ret; file_data = io_rsrc_data_alloc(ctx, io_rsrc_file_put, nr_args); if (!file_data) return -ENOMEM; ctx->file_data = file_data; ret = -ENOMEM; if (!io_alloc_file_tables(&ctx->file_table, nr_args)) goto out_free; for (i = 0; i < nr_args; i++, ctx->nr_user_files++) { u64 tag = 0; if ((tags && copy_from_user(&tag, &tags[i], sizeof(tag))) || copy_from_user(&fd, &fds[i], sizeof(fd))) { ret = -EFAULT; goto out_fput; } /* allow sparse sets */ if (fd == -1) { ret = -EINVAL; if (unlikely(tag)) goto out_fput; continue; } file = fget(fd); ret = -EBADF; if (unlikely(!file)) goto out_fput; /* * Don't allow io_uring instances to be registered. If UNIX * isn't enabled, then this causes a reference cycle and this * instance can never get freed. If UNIX is enabled we'll * handle it just fine, but there's still no point in allowing * a ring fd as it doesn't support regular read/write anyway. */ if (file->f_op == &io_uring_fops) { fput(file); goto out_fput; } ctx->file_data->tags[i] = tag; io_fixed_file_set(io_fixed_file_slot(&ctx->file_table, i), file); } ret = io_sqe_files_scm(ctx); if (ret) { __io_sqe_files_unregister(ctx); return ret; } io_rsrc_node_switch(ctx, NULL); return ret; out_fput: for (i = 0; i < ctx->nr_user_files; i++) { file = io_file_from_index(ctx, i); if (file) fput(file); } io_free_file_tables(&ctx->file_table, nr_args); ctx->nr_user_files = 0; out_free: io_rsrc_data_free(ctx->file_data); ctx->file_data = NULL; return ret;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277954, "input": "ins_comp_get_next_word_or_line( buf_T *ins_buf, // buffer being scanned pos_T *cur_match_pos, // current match position int *match_len, int *cont_s_ipos) // next ^X<> will set initial_pos { char_u *ptr; int len; *match_len = 0; ptr = ml_get_buf(ins_buf, cur_match_pos->lnum, FALSE) + cur_match_pos->col; if (ctrl_x_mode_line_or_eval()) { if (compl_status_adding()) { if (cur_match_pos->lnum >= ins_buf->b_ml.ml_line_count) return NULL; ptr = ml_get_buf(ins_buf, cur_match_pos->lnum + 1, FALSE); if (!p_paste) ptr = skipwhite(ptr); } len = (int)STRLEN(ptr); } else { char_u *tmp_ptr = ptr; if (compl_status_adding() && compl_length <= (int)STRLEN(tmp_ptr)) { tmp_ptr += compl_length; // Skip if already inside a word. if (vim_iswordp(tmp_ptr)) return NULL; // Find start of next word. tmp_ptr = find_word_start(tmp_ptr); } // Find end of this word. tmp_ptr = find_word_end(tmp_ptr); len = (int)(tmp_ptr - ptr); if (compl_status_adding() && len == compl_length) { if (cur_match_pos->lnum < ins_buf->b_ml.ml_line_count) { // Try next line, if any. the new word will be // \"join\" as if the normal command \"J\" was used. // IOSIZE is always greater than // compl_length, so the next STRNCPY always // works -- Acevedo STRNCPY(IObuff, ptr, len); ptr = ml_get_buf(ins_buf, cur_match_pos->lnum + 1, FALSE); tmp_ptr = ptr = skipwhite(ptr); // Find start of next word. tmp_ptr = find_word_start(tmp_ptr); // Find end of next word. tmp_ptr = find_word_end(tmp_ptr); if (tmp_ptr > ptr) { if (*ptr != ')' && IObuff[len - 1] != TAB) { if (IObuff[len - 1] != ' ') IObuff[len++] = ' '; // IObuf =~ \"\\k.* \", thus len >= 2 if (p_js && (IObuff[len - 2] == '.' || (vim_strchr(p_cpo, CPO_JOINSP) == NULL && (IObuff[len - 2] == '?' || IObuff[len - 2] == '!')))) IObuff[len++] = ' '; } // copy as much as possible of the new word if (tmp_ptr - ptr >= IOSIZE - len) tmp_ptr = ptr + IOSIZE - len - 1; STRNCPY(IObuff + len, ptr, tmp_ptr - ptr); len += (int)(tmp_ptr - ptr); *cont_s_ipos = TRUE; } IObuff[len] = NUL; ptr = IObuff; } if (len == compl_length) return NULL; } } *match_len = len; return ptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364176, "input": "static int __init split_huge_pages_debugfs(void) { debugfs_create_file(\"split_huge_pages\", 0200, NULL, NULL, &split_huge_pages_fops); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 413415, "input": "lytype_free(const struct lys_type *type, lyd_val value, const char *value_str) { struct lytype_plugin_list *p; struct lys_node_leaf sleaf; struct lyd_node_leaf_list leaf; struct lys_module *mod; memset(&sleaf, 0, sizeof sleaf); memset(&leaf, 0, sizeof leaf); while (type->base == LY_TYPE_LEAFREF) { type = &type->info.lref.target->type; } if (type->base == LY_TYPE_UNION) { /* create a fake schema node */ sleaf.module = type->parent->module; sleaf.name = \"fake-leaf\"; sleaf.type = *type; sleaf.nodetype = LYS_LEAF; /* and a fake data node */ leaf.schema = (struct lys_node *)&sleaf; leaf.value = value; leaf.value_str = value_str; /* find the original type */ type = lyd_leaf_type(&leaf); if (!type) { LOGINT(sleaf.module->ctx); return; } } mod = type->der->module; if (!mod) { LOGINT(type->parent->module->ctx); return; } p = lytype_find(mod->name, mod->rev_size ? mod->rev[0].date : NULL, type->der->name); if (!p) { LOGINT(mod->ctx); return; } if (p->free_clb) { p->free_clb(value.ptr); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 264836, "input": "GF_Err dac3_box_read(GF_Box *s, GF_BitStream *bs) { GF_AC3ConfigBox *ptr = (GF_AC3ConfigBox *)s; if (ptr == NULL) return GF_BAD_PARAM; return gf_isom_ac3_config_parse_bs(bs, ptr->cfg.is_ec3, &ptr->cfg);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 461561, "input": "static void jit_fill_hole(void *area, unsigned int size) { /* Fill whole space with INT3 instructions */ memset(area, 0xcc, size); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342029, "input": "static void fuse_aio_complete_req(struct fuse_mount *fm, struct fuse_args *args, int err) { struct fuse_io_args *ia = container_of(args, typeof(*ia), ap.args); struct fuse_io_priv *io = ia->io; ssize_t pos = -1; fuse_release_user_pages(&ia->ap, io->should_dirty); if (err) { /* Nothing */ } else if (io->write) { if (ia->write.out.size > ia->write.in.size) { err = -EIO; } else if (ia->write.in.size != ia->write.out.size) { pos = ia->write.in.offset - io->offset + ia->write.out.size; } } else { u32 outsize = args->out_args[0].size; if (ia->read.in.size != outsize) pos = ia->read.in.offset - io->offset + outsize; } fuse_aio_complete(io, err, pos); fuse_io_free(ia); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246141, "input": "KeyInfo *sqlite3KeyInfoRef(KeyInfo *p){ if( p ){ assert( p->nRef>0 ); p->nRef++; } return p; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398309, "input": "static void mcba_usb_process_can(struct mcba_priv *priv, struct mcba_usb_msg_can *msg) { struct can_frame *cf; struct sk_buff *skb; struct net_device_stats *stats = &priv->netdev->stats; u16 sid; skb = alloc_can_skb(priv->netdev, &cf); if (!skb) return; sid = get_unaligned_be16(&msg->sid); if (sid & MCBA_SIDL_EXID_MASK) { /* SIDH | SIDL | EIDH | EIDL * 28 - 21 | 20 19 18 x x x 17 16 | 15 - 8 | 7 - 0 */ cf->can_id = CAN_EFF_FLAG; /* store 28-18 bits */ cf->can_id |= (sid & 0xffe0) << 13; /* store 17-16 bits */ cf->can_id |= (sid & 3) << 16; /* store 15-0 bits */ cf->can_id |= get_unaligned_be16(&msg->eid); } else { /* SIDH | SIDL * 10 - 3 | 2 1 0 x x x x x */ cf->can_id = (sid & 0xffe0) >> 5; } if (msg->dlc & MCBA_DLC_RTR_MASK) cf->can_id |= CAN_RTR_FLAG; cf->can_dlc = get_can_dlc(msg->dlc & MCBA_DLC_MASK); memcpy(cf->data, msg->data, cf->can_dlc); stats->rx_packets++; stats->rx_bytes += cf->can_dlc; can_led_event(priv->netdev, CAN_LED_EVENT_RX); netif_rx(skb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342000, "input": "static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file) { struct fuse_file *ff = file->private_data; struct fuse_mount *fm = ff->fm; struct fuse_args_pages *ap = &ia->ap; loff_t pos = page_offset(ap->pages[0]); size_t count = ap->num_pages << PAGE_SHIFT; ssize_t res; int err; ap->args.out_pages = true; ap->args.page_zeroing = true; ap->args.page_replace = true; /* Don't overflow end offset */ if (pos + (count - 1) == LLONG_MAX) { count--; ap->descs[ap->num_pages - 1].length--; } WARN_ON((loff_t) (pos + count) < 0); fuse_read_args_fill(ia, file, pos, count, FUSE_READ); ia->read.attr_ver = fuse_get_attr_version(fm->fc); if (fm->fc->async_read) { ia->ff = fuse_file_get(ff); ap->args.end = fuse_readpages_end; err = fuse_simple_background(fm, &ap->args, GFP_KERNEL); if (!err) return; } else { res = fuse_simple_request(fm, &ap->args); err = res < 0 ? res : 0; } fuse_readpages_end(fm, &ap->args, err); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 197890, "input": "GF_Err Media_RewriteODFrame(GF_MediaBox *mdia, GF_ISOSample *sample) { GF_Err e; GF_ODCodec *ODdecode; GF_ODCodec *ODencode; GF_ODCom *com; //the commands we proceed GF_ESDUpdate *esdU, *esdU2; GF_ESDRemove *esdR, *esdR2; GF_ODUpdate *odU, *odU2; //the desc they contain GF_ObjectDescriptor *od; GF_IsomObjectDescriptor *isom_od; GF_ESD *esd; GF_ES_ID_Ref *ref; GF_Descriptor *desc; GF_TrackReferenceTypeBox *mpod; u32 i, j, skipped; if (!mdia || !sample || !sample->data || !sample->dataLength) return GF_BAD_PARAM; mpod = NULL; e = Track_FindRef(mdia->mediaTrack, GF_ISOM_BOX_TYPE_MPOD, &mpod); if (e) return e; //no references, nothing to do... if (!mpod || !mpod->trackIDs) return GF_OK; ODdecode = gf_odf_codec_new(); if (!ODdecode) return GF_OUT_OF_MEM; ODencode = gf_odf_codec_new(); if (!ODencode) { gf_odf_codec_del(ODdecode); return GF_OUT_OF_MEM; } e = gf_odf_codec_set_au(ODdecode, sample->data, sample->dataLength); if (e) goto err_exit; e = gf_odf_codec_decode(ODdecode); if (e) goto err_exit; while (1) { com = gf_odf_codec_get_com(ODdecode); if (!com) break; //we only need to rewrite commands with ESDs inside: ESDUpdate and ODUpdate switch (com->tag) { case GF_ODF_OD_UPDATE_TAG: odU = (GF_ODUpdate *) com; odU2 = (GF_ODUpdate *) gf_odf_com_new(GF_ODF_OD_UPDATE_TAG); i=0; while ((desc = (GF_Descriptor*)gf_list_enum(odU->objectDescriptors, &i))) { switch (desc->tag) { case GF_ODF_OD_TAG: case GF_ODF_ISOM_OD_TAG: //IOD can be used in OD streams case GF_ODF_ISOM_IOD_TAG: break; default: return GF_ISOM_INVALID_FILE; } e = gf_odf_desc_copy(desc, (GF_Descriptor **)&isom_od); if (e) goto err_exit; //create our OD... if (desc->tag == GF_ODF_ISOM_IOD_TAG) { od = (GF_ObjectDescriptor *) gf_malloc(sizeof(GF_InitialObjectDescriptor)); } else { od = (GF_ObjectDescriptor *) gf_malloc(sizeof(GF_ObjectDescriptor)); } if (!od) { e = GF_OUT_OF_MEM; goto err_exit; } od->ESDescriptors = gf_list_new(); //and duplicate... od->objectDescriptorID = isom_od->objectDescriptorID; od->tag = GF_ODF_OD_TAG; od->URLString = isom_od->URLString; isom_od->URLString = NULL; od->extensionDescriptors = isom_od->extensionDescriptors; isom_od->extensionDescriptors = NULL; od->IPMP_Descriptors = isom_od->IPMP_Descriptors; isom_od->IPMP_Descriptors = NULL; od->OCIDescriptors = isom_od->OCIDescriptors; isom_od->OCIDescriptors = NULL; //init as IOD if (isom_od->tag == GF_ODF_ISOM_IOD_TAG) { ((GF_InitialObjectDescriptor *)od)->audio_profileAndLevel = ((GF_IsomInitialObjectDescriptor *)isom_od)->audio_profileAndLevel; ((GF_InitialObjectDescriptor *)od)->inlineProfileFlag = ((GF_IsomInitialObjectDescriptor *)isom_od)->inlineProfileFlag; ((GF_InitialObjectDescriptor *)od)->graphics_profileAndLevel = ((GF_IsomInitialObjectDescriptor *)isom_od)->graphics_profileAndLevel; ((GF_InitialObjectDescriptor *)od)->OD_profileAndLevel = ((GF_IsomInitialObjectDescriptor *)isom_od)->OD_profileAndLevel; ((GF_InitialObjectDescriptor *)od)->scene_profileAndLevel = ((GF_IsomInitialObjectDescriptor *)isom_od)->scene_profileAndLevel; ((GF_InitialObjectDescriptor *)od)->visual_profileAndLevel = ((GF_IsomInitialObjectDescriptor *)isom_od)->visual_profileAndLevel; ((GF_InitialObjectDescriptor *)od)->IPMPToolList = ((GF_IsomInitialObjectDescriptor *)isom_od)->IPMPToolList; ((GF_IsomInitialObjectDescriptor *)isom_od)->IPMPToolList = NULL; } //then rewrite the ESDesc j=0; while ((ref = (GF_ES_ID_Ref*)gf_list_enum(isom_od->ES_ID_RefDescriptors, &j))) { //if the ref index is not valid, skip this desc... if (!mpod->trackIDs || gf_isom_get_track_from_id(mdia->mediaTrack->moov, mpod->trackIDs[ref->trackRef - 1]) == NULL) continue; //OK, get the esd e = GetESDForTime(mdia->mediaTrack->moov, mpod->trackIDs[ref->trackRef - 1], sample->DTS, &esd); if (!e) e = gf_odf_desc_add_desc((GF_Descriptor *) od, (GF_Descriptor *) esd); if (e) { gf_odf_desc_del((GF_Descriptor *)od); gf_odf_com_del((GF_ODCom **)&odU2); gf_odf_desc_del((GF_Descriptor *)isom_od); gf_odf_com_del((GF_ODCom **)&odU); goto err_exit; } } //delete our desc gf_odf_desc_del((GF_Descriptor *)isom_od); gf_list_add(odU2->objectDescriptors, od); } //clean a bit gf_odf_com_del((GF_ODCom **)&odU); gf_odf_codec_add_com(ODencode, (GF_ODCom *)odU2); break; case GF_ODF_ESD_UPDATE_TAG: esdU = (GF_ESDUpdate *) com; esdU2 = (GF_ESDUpdate *) gf_odf_com_new(GF_ODF_ESD_UPDATE_TAG); esdU2->ODID = esdU->ODID; i=0; while ((ref = (GF_ES_ID_Ref*)gf_list_enum(esdU->ESDescriptors, &i))) { //if the ref index is not valid, skip this desc... if (gf_isom_get_track_from_id(mdia->mediaTrack->moov, mpod->trackIDs[ref->trackRef - 1]) == NULL) continue; //OK, get the esd e = GetESDForTime(mdia->mediaTrack->moov, mpod->trackIDs[ref->trackRef - 1], sample->DTS, &esd); if (e) goto err_exit; gf_list_add(esdU2->ESDescriptors, esd); } gf_odf_com_del((GF_ODCom **)&esdU); gf_odf_codec_add_com(ODencode, (GF_ODCom *)esdU2); break; //brand new case: the ESRemove follows the same principle according to the spec... case GF_ODF_ESD_REMOVE_REF_TAG: //both commands have the same structure, only the tags change esdR = (GF_ESDRemove *) com; esdR2 = (GF_ESDRemove *) gf_odf_com_new(GF_ODF_ESD_REMOVE_TAG); esdR2->ODID = esdR->ODID; esdR2->NbESDs = esdR->NbESDs; //alloc our stuff esdR2->ES_ID = (unsigned short*)gf_malloc(sizeof(u32) * esdR->NbESDs); if (!esdR2->ES_ID) { e = GF_OUT_OF_MEM; goto err_exit; } skipped = 0; //get the ES_ID in the mpod indicated in the ES_ID[] for (i = 0; i < esdR->NbESDs; i++) { //if the ref index is not valid, remove this desc... if (gf_isom_get_track_from_id(mdia->mediaTrack->moov, mpod->trackIDs[esdR->ES_ID[i] - 1]) == NULL) { skipped ++; } else { //the command in the file has the ref index of the trackID in the mpod esdR2->ES_ID[i - skipped] = mpod->trackIDs[esdR->ES_ID[i] - 1]; } } //gf_realloc... if (skipped && (skipped != esdR2->NbESDs) ) { esdR2->NbESDs -= skipped; esdR2->ES_ID = (unsigned short*)gf_realloc(esdR2->ES_ID, sizeof(u32) * esdR2->NbESDs); } gf_odf_com_del((GF_ODCom **)&esdR); gf_odf_codec_add_com(ODencode, (GF_ODCom *)esdR2); break; default: e = gf_odf_codec_add_com(ODencode, com); if (e) goto err_exit; } } //encode our new AU e = gf_odf_codec_encode(ODencode, 1); if (e) goto err_exit; //and set the buffer in the sample gf_free(sample->data); sample->data = NULL; sample->dataLength = 0; e = gf_odf_codec_get_au(ODencode, &sample->data, &sample->dataLength); err_exit: gf_odf_codec_del(ODdecode); gf_odf_codec_del(ODencode); return e; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "The Media_RewriteODFrame function in GPAC 1.0.1 allows attackers to cause a denial of service (NULL pointer dereference) via a crafted file in the MP4Box command.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-32440"}} -{"idx": 409916, "input": "static void tcp_mtup_probe_success(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); /* FIXME: breaks with very large cwnd */ tp->prior_ssthresh = tcp_current_ssthresh(sk); tp->snd_cwnd = tp->snd_cwnd * tcp_mss_to_mtu(sk, tp->mss_cache) / icsk->icsk_mtup.probe_size; tp->snd_cwnd_cnt = 0; tp->snd_cwnd_stamp = tcp_time_stamp; tp->snd_ssthresh = tcp_current_ssthresh(sk); icsk->icsk_mtup.search_low = icsk->icsk_mtup.probe_size; icsk->icsk_mtup.probe_size = 0; tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263468, "input": "bool FromkLinuxSigset(const klinux_sigset_t *input, sigset_t *output) { if (!input || !output) { output = nullptr; return false; } sigemptyset(output); for (int klinux_sig = 1; klinux_sig < kLinux_NSIG; klinux_sig++) { if (klinux_sigismember(input, klinux_sig)) { int sig = FromkLinuxSignalNumber(klinux_sig); if (sig != -1) { sigaddset(output, sig); } } } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 101635, "input": "void Read(VideoDecoder::DecoderStatus* status, scoped_refptr* video_frame) { EXPECT_CALL(*this, FrameReady(_, _)) .WillOnce(DoAll(SaveArg<0>(status), SaveArg<1>(video_frame))); decoder_->Read(read_cb_); message_loop_.RunAllPending(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432392, "input": "static int rdpmc_interception(struct vcpu_svm *svm) { int err; if (!nrips) return emulate_on_interception(svm); err = kvm_rdpmc(&svm->vcpu); return kvm_complete_insn_gp(&svm->vcpu, err); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 343469, "input": "static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data, bool host) { struct kvm *kvm = vcpu->kvm; struct kvm_hv *hv = to_kvm_hv(kvm); switch (msr) { case HV_X64_MSR_GUEST_OS_ID: hv->hv_guest_os_id = data; /* setting guest os id to zero disables hypercall page */ if (!hv->hv_guest_os_id) hv->hv_hypercall &= ~HV_X64_MSR_HYPERCALL_ENABLE; break; case HV_X64_MSR_HYPERCALL: { u8 instructions[9]; int i = 0; u64 addr; /* if guest os id is not set hypercall should remain disabled */ if (!hv->hv_guest_os_id) break; if (!(data & HV_X64_MSR_HYPERCALL_ENABLE)) { hv->hv_hypercall = data; break; } /* * If Xen and Hyper-V hypercalls are both enabled, disambiguate * the same way Xen itself does, by setting the bit 31 of EAX * which is RsvdZ in the 32-bit Hyper-V hypercall ABI and just * going to be clobbered on 64-bit. */ if (kvm_xen_hypercall_enabled(kvm)) { /* orl $0x80000000, %eax */ instructions[i++] = 0x0d; instructions[i++] = 0x00; instructions[i++] = 0x00; instructions[i++] = 0x00; instructions[i++] = 0x80; } /* vmcall/vmmcall */ static_call(kvm_x86_patch_hypercall)(vcpu, instructions + i); i += 3; /* ret */ ((unsigned char *)instructions)[i++] = 0xc3; addr = data & HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_MASK; if (kvm_vcpu_write_guest(vcpu, addr, instructions, i)) return 1; hv->hv_hypercall = data; break; } case HV_X64_MSR_REFERENCE_TSC: hv->hv_tsc_page = data; if (hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE) kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); break; case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4: return kvm_hv_msr_set_crash_data(kvm, msr - HV_X64_MSR_CRASH_P0, data); case HV_X64_MSR_CRASH_CTL: if (host) return kvm_hv_msr_set_crash_ctl(kvm, data); if (data & HV_CRASH_CTL_CRASH_NOTIFY) { vcpu_debug(vcpu, \"hv crash (0x%llx 0x%llx 0x%llx 0x%llx 0x%llx)\\n\", hv->hv_crash_param[0], hv->hv_crash_param[1], hv->hv_crash_param[2], hv->hv_crash_param[3], hv->hv_crash_param[4]); /* Send notification about crash to user space */ kvm_make_request(KVM_REQ_HV_CRASH, vcpu); } break; case HV_X64_MSR_RESET: if (data == 1) { vcpu_debug(vcpu, \"hyper-v reset requested\\n\"); kvm_make_request(KVM_REQ_HV_RESET, vcpu); } break; case HV_X64_MSR_REENLIGHTENMENT_CONTROL: hv->hv_reenlightenment_control = data; break; case HV_X64_MSR_TSC_EMULATION_CONTROL: hv->hv_tsc_emulation_control = data; break; case HV_X64_MSR_TSC_EMULATION_STATUS: hv->hv_tsc_emulation_status = data; break; case HV_X64_MSR_TIME_REF_COUNT: /* read-only, but still ignore it if host-initiated */ if (!host) return 1; break; case HV_X64_MSR_SYNDBG_OPTIONS: case HV_X64_MSR_SYNDBG_CONTROL ... HV_X64_MSR_SYNDBG_PENDING_BUFFER: return syndbg_set_msr(vcpu, msr, data, host); default: vcpu_unimpl(vcpu, \"Hyper-V unhandled wrmsr: 0x%x data 0x%llx\\n\", msr, data); return 1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431000, "input": "static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, unsigned int len, struct iattr *sattr, struct nfs4_label *label) { struct nfs4_createdata *data; int status = -ENAMETOOLONG; if (len > NFS4_MAXPATHLEN) goto out; status = -ENOMEM; data = nfs4_alloc_createdata(dir, &dentry->d_name, sattr, NF4LNK); if (data == NULL) goto out; data->msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SYMLINK]; data->arg.u.symlink.pages = &page; data->arg.u.symlink.len = len; data->arg.label = label; status = nfs4_do_create(dir, dentry, data); nfs4_free_createdata(data); out: return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446051, "input": "static int exec_grep(int argc, const char **argv) { pid_t pid; int status; argv[argc] = NULL; pid = fork(); if (pid < 0) return pid; if (!pid) { execvp(\"grep\", (char **) argv); exit(255); } while (waitpid(pid, &status, 0) < 0) { if (errno == EINTR) continue; return -1; } if (WIFEXITED(status)) { if (!WEXITSTATUS(status)) return 1; return 0; } return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 371775, "input": "MagickExport void ConvertHSIToRGB(const double hue,const double saturation, const double intensity,Quantum *red,Quantum *green,Quantum *blue) { double b, g, h, r; /* Convert HSI to RGB colorspace. */ assert(red != (Quantum *) NULL); assert(green != (Quantum *) NULL); assert(blue != (Quantum *) NULL); h=360.0*hue; h-=360.0*floor(h/360.0); if (h < 120.0) { b=intensity*(1.0-saturation); r=intensity*(1.0+saturation*cos(h*(MagickPI/180.0))/cos((60.0-h)* (MagickPI/180.0))); g=3.0*intensity-r-b; } else if (h < 240.0) { h-=120.0; r=intensity*(1.0-saturation); g=intensity*(1.0+saturation*cos(h*(MagickPI/180.0))/cos((60.0-h)* (MagickPI/180.0))); b=3.0*intensity-r-g; } else { h-=240.0; g=intensity*(1.0-saturation); b=intensity*(1.0+saturation*cos(h*(MagickPI/180.0))/cos((60.0-h)* (MagickPI/180.0))); r=3.0*intensity-g-b; } *red=ClampToQuantum(QuantumRange*r); *green=ClampToQuantum(QuantumRange*g); *blue=ClampToQuantum(QuantumRange*b); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246186, "input": "void sqlite3KeyInfoUnref(KeyInfo *p){ if( p ){ assert( p->nRef>0 ); p->nRef--; if( p->nRef==0 ) sqlite3DbFreeNN(p->db, p); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 356312, "input": "static int flattenSubquery( Parse *pParse, /* Parsing context */ Select *p, /* The parent or outer SELECT statement */ int iFrom, /* Index in p->pSrc->a[] of the inner subquery */ int isAgg /* True if outer SELECT uses aggregate functions */ ){ const char *zSavedAuthContext = pParse->zAuthContext; Select *pParent; /* Current UNION ALL term of the other query */ Select *pSub; /* The inner query or \"subquery\" */ Select *pSub1; /* Pointer to the rightmost select in sub-query */ SrcList *pSrc; /* The FROM clause of the outer query */ SrcList *pSubSrc; /* The FROM clause of the subquery */ int iParent; /* VDBE cursor number of the pSub result set temp table */ int iNewParent = -1;/* Replacement table for iParent */ int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */ int i; /* Loop counter */ Expr *pWhere; /* The WHERE clause */ struct SrcList_item *pSubitem; /* The subquery */ sqlite3 *db = pParse->db; /* Check to see if flattening is permitted. Return 0 if not. */ assert( p!=0 ); assert( p->pPrior==0 ); if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0; pSrc = p->pSrc; assert( pSrc && iFrom>=0 && iFromnSrc ); pSubitem = &pSrc->a[iFrom]; iParent = pSubitem->iCursor; pSub = pSubitem->pSelect; assert( pSub!=0 ); #ifndef SQLITE_OMIT_WINDOWFUNC if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */ #endif pSubSrc = pSub->pSrc; assert( pSubSrc ); /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET ** became arbitrary expressions, we were forced to add restrictions (13) ** and (14). */ if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */ if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */ if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){ return 0; /* Restriction (15) */ } if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */ if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */ if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){ return 0; /* Restrictions (8)(9) */ } if( p->pOrderBy && pSub->pOrderBy ){ return 0; /* Restriction (11) */ } if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */ if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */ if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){ return 0; /* Restriction (21) */ } if( pSub->selFlags & (SF_Recursive) ){ return 0; /* Restrictions (22) */ } /* ** If the subquery is the right operand of a LEFT JOIN, then the ** subquery may not be a join itself (3a). Example of why this is not ** allowed: ** ** t1 LEFT OUTER JOIN (t2 JOIN t3) ** ** If we flatten the above, we would get ** ** (t1 LEFT OUTER JOIN t2) JOIN t3 ** ** which is not at all the same thing. ** ** If the subquery is the right operand of a LEFT JOIN, then the outer ** query cannot be an aggregate. (3c) This is an artifact of the way ** aggregates are processed - there is no mechanism to determine if ** the LEFT JOIN table should be all-NULL. ** ** See also tickets #306, #350, and #3300. */ if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){ isLeftJoin = 1; if( pSubSrc->nSrc>1 /* (3a) */ || isAgg /* (3b) */ || IsVirtual(pSubSrc->a[0].pTab) /* (3c) */ || (p->selFlags & SF_Distinct)!=0 /* (3d) */ ){ return 0; } } #ifdef SQLITE_EXTRA_IFNULLROW else if( iFrom>0 && !isAgg ){ /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for ** every reference to any result column from subquery in a join, even ** though they are not necessary. This will stress-test the OP_IfNullRow ** opcode. */ isLeftJoin = -1; } #endif /* Restriction (17): If the sub-query is a compound SELECT, then it must ** use only the UNION ALL operator. And none of the simple select queries ** that make up the compound SELECT are allowed to be aggregate or distinct ** queries. */ if( pSub->pPrior ){ if( pSub->pOrderBy ){ return 0; /* Restriction (20) */ } if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){ return 0; /* (17d1), (17d2), or (17d3) */ } for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){ testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct ); testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate ); assert( pSub->pSrc!=0 ); assert( pSub->pEList->nExpr==pSub1->pEList->nExpr ); if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */ || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */ || pSub1->pSrc->nSrc<1 /* (17c) */ ){ return 0; } testcase( pSub1->pSrc->nSrc>1 ); } /* Restriction (18). */ if( p->pOrderBy ){ int ii; for(ii=0; iipOrderBy->nExpr; ii++){ if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0; } } } /* Ex-restriction (23): ** The only way that the recursive part of a CTE can contain a compound ** subquery is for the subquery to be one term of a join. But if the ** subquery is a join, then the flattening has already been stopped by ** restriction (17d3) */ assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 ); /***** If we reach this point, flattening is permitted. *****/ SELECTTRACE(1,pParse,p,(\"flatten %u.%p from term %d\\n\", pSub->selId, pSub, iFrom)); /* Authorize the subquery */ pParse->zAuthContext = pSubitem->zName; TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0); testcase( i==SQLITE_DENY ); pParse->zAuthContext = zSavedAuthContext; /* If the sub-query is a compound SELECT statement, then (by restrictions ** 17 and 18 above) it must be a UNION ALL and the parent query must ** be of the form: ** ** SELECT FROM () ** ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or ** OFFSET clauses and joins them to the left-hand-side of the original ** using UNION ALL operators. In this case N is the number of simple ** select statements in the compound sub-query. ** ** Example: ** ** SELECT a+1 FROM ( ** SELECT x FROM tab ** UNION ALL ** SELECT y FROM tab ** UNION ALL ** SELECT abs(z*2) FROM tab2 ** ) WHERE a!=5 ORDER BY 1 ** ** Transformed into: ** ** SELECT x+1 FROM tab WHERE x+1!=5 ** UNION ALL ** SELECT y+1 FROM tab WHERE y+1!=5 ** UNION ALL ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5 ** ORDER BY 1 ** ** We call this the \"compound-subquery flattening\". */ for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){ Select *pNew; ExprList *pOrderBy = p->pOrderBy; Expr *pLimit = p->pLimit; Select *pPrior = p->pPrior; p->pOrderBy = 0; p->pSrc = 0; p->pPrior = 0; p->pLimit = 0; pNew = sqlite3SelectDup(db, p, 0); p->pLimit = pLimit; p->pOrderBy = pOrderBy; p->pSrc = pSrc; p->op = TK_ALL; if( pNew==0 ){ p->pPrior = pPrior; }else{ pNew->pPrior = pPrior; if( pPrior ) pPrior->pNext = pNew; pNew->pNext = p; p->pPrior = pNew; SELECTTRACE(2,pParse,p,(\"compound-subquery flattener\" \" creates %u as peer\\n\",pNew->selId)); } if( db->mallocFailed ) return 1; } /* Begin flattening the iFrom-th entry of the FROM clause ** in the outer query. */ pSub = pSub1 = pSubitem->pSelect; /* Delete the transient table structure associated with the ** subquery */ sqlite3DbFree(db, pSubitem->zDatabase); sqlite3DbFree(db, pSubitem->zName); sqlite3DbFree(db, pSubitem->zAlias); pSubitem->zDatabase = 0; pSubitem->zName = 0; pSubitem->zAlias = 0; pSubitem->pSelect = 0; /* Defer deleting the Table object associated with the ** subquery until code generation is ** complete, since there may still exist Expr.pTab entries that ** refer to the subquery even after flattening. Ticket #3346. ** ** pSubitem->pTab is always non-NULL by test restrictions and tests above. */ if( ALWAYS(pSubitem->pTab!=0) ){ Table *pTabToDel = pSubitem->pTab; if( pTabToDel->nTabRef==1 ){ Parse *pToplevel = sqlite3ParseToplevel(pParse); pTabToDel->pNextZombie = pToplevel->pZombieTab; pToplevel->pZombieTab = pTabToDel; }else{ pTabToDel->nTabRef--; } pSubitem->pTab = 0; } /* The following loop runs once for each term in a compound-subquery ** flattening (as described above). If we are doing a different kind ** of flattening - a flattening other than a compound-subquery flattening - ** then this loop only runs once. ** ** This loop moves all of the FROM elements of the subquery into the ** the FROM clause of the outer query. Before doing this, remember ** the cursor number for the original outer query FROM element in ** iParent. The iParent cursor will never be used. Subsequent code ** will scan expressions looking for iParent references and replace ** those references with expressions that resolve to the subquery FROM ** elements we are now copying in. */ for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){ int nSubSrc; u8 jointype = 0; assert( pSub!=0 ); pSubSrc = pSub->pSrc; /* FROM clause of subquery */ nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */ pSrc = pParent->pSrc; /* FROM clause of the outer query */ if( pSrc ){ assert( pParent==p ); /* First time through the loop */ jointype = pSubitem->fg.jointype; }else{ assert( pParent!=p ); /* 2nd and subsequent times through the loop */ pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); if( pSrc==0 ) break; pParent->pSrc = pSrc; } /* The subquery uses a single slot of the FROM clause of the outer ** query. If the subquery has more than one element in its FROM clause, ** then expand the outer query to make space for it to hold all elements ** of the subquery. ** ** Example: ** ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB; ** ** The outer query has 3 slots in its FROM clause. One slot of the ** outer query (the middle slot) is used by the subquery. The next ** block of code will expand the outer query FROM clause to 4 slots. ** The middle slot is expanded to two slots in order to make space ** for the two elements in the FROM clause of the subquery. */ if( nSubSrc>1 ){ pSrc = sqlite3SrcListEnlarge(pParse, pSrc, nSubSrc-1,iFrom+1); if( pSrc==0 ) break; pParent->pSrc = pSrc; } /* Transfer the FROM clause terms from the subquery into the ** outer query. */ for(i=0; ia[i+iFrom].pUsing); assert( pSrc->a[i+iFrom].fg.isTabFunc==0 ); pSrc->a[i+iFrom] = pSubSrc->a[i]; iNewParent = pSubSrc->a[i].iCursor; memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i])); } pSrc->a[iFrom].fg.jointype = jointype; /* Now begin substituting subquery result set expressions for ** references to the iParent in the outer query. ** ** Example: ** ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b; ** \\ \\_____________ subquery __________/ / ** \\_____________________ outer query ______________________________/ ** ** We look at every expression in the outer query and every place we see ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\". */ if( pSub->pOrderBy ){ /* At this point, any non-zero iOrderByCol values indicate that the ** ORDER BY column expression is identical to the iOrderByCol'th ** expression returned by SELECT statement pSub. Since these values ** do not necessarily correspond to columns in SELECT statement pParent, ** zero them before transfering the ORDER BY clause. ** ** Not doing this may cause an error if a subsequent call to this ** function attempts to flatten a compound sub-query into pParent ** (the only way this can happen is if the compound sub-query is ** currently part of pSub->pSrc). See ticket [d11a6e908f]. */ ExprList *pOrderBy = pSub->pOrderBy; for(i=0; inExpr; i++){ pOrderBy->a[i].u.x.iOrderByCol = 0; } assert( pParent->pOrderBy==0 ); pParent->pOrderBy = pOrderBy; pSub->pOrderBy = 0; } pWhere = pSub->pWhere; pSub->pWhere = 0; if( isLeftJoin>0 ){ sqlite3SetJoinExpr(pWhere, iNewParent); } pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere); if( db->mallocFailed==0 ){ SubstContext x; x.pParse = pParse; x.iTable = iParent; x.iNewTable = iNewParent; x.isLeftJoin = isLeftJoin; x.pEList = pSub->pEList; substSelect(&x, pParent, 0); } /* The flattened query is a compound if either the inner or the ** outer query is a compound. */ pParent->selFlags |= pSub->selFlags & SF_Compound; assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */ /* ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; ** ** One is tempted to try to add a and b to combine the limits. But this ** does not work if either limit is negative. */ if( pSub->pLimit ){ pParent->pLimit = pSub->pLimit; pSub->pLimit = 0; } } /* Finially, delete what is left of the subquery and return ** success. */ sqlite3SelectDelete(db, pSub1); #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\")); sqlite3TreeViewSelect(0, p, 0); } #endif return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506606, "input": "term_reset() { FPRINTF((stderr, \"term_reset()\\n\")); #ifdef USE_MOUSE /* Make sure that ^C will break out of a wait for 'pause mouse' */ paused_for_mouse = 0; #ifdef _WIN32 kill_pending_Pause_dialog(); #endif #endif if (!term_initialised) return; if (term_suspended) { if (term->resume) { FPRINTF((stderr, \"- calling term->resume()\\n\")); (*term->resume) (); } term_suspended = FALSE; } if (term_graphics) { (*term->text) (); term_graphics = FALSE; } if (term_initialised) { (*term->reset) (); term_initialised = FALSE; /* switch off output to special postscript file (if used) */ gppsfile = NULL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346314, "input": "static void async_cancel(USBPacket *unused, void *opaque) { AsyncURB *aurb = opaque; USBHostDevice *s = aurb->hdev; dprintf(\"husb: async cancel. aurb %p\\n\", aurb); /* Mark it as dead (see async_complete above) */ aurb->packet = NULL; int r = ioctl(s->fd, USBDEVFS_DISCARDURB, aurb); if (r < 0) { dprintf(\"husb: async. discard urb failed errno %d\\n\", errno); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 388316, "input": "static void cliprdr_write_unlock_clipdata(wStream* s, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData) { cliprdr_write_lock_unlock_clipdata(s, unlockClipboardData->clipDataId); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417850, "input": "static int SFD_MIDump(SplineFont *sf,EncMap *map,char *dirname, int mm_pos) { char *instance = malloc(strlen(dirname)+1+10+20); char *fontprops; FILE *ssfd; int err = false; /* I'd like to use the font name, but the order of the instances is */ /* crucial and I must enforce an ordering on them */ sprintf( instance,\"%s/mm%d\" INSTANCE_EXT, dirname, mm_pos ); GFileMkDir(instance, 0755); fontprops = malloc(strlen(instance)+strlen(\"/\" FONT_PROPS)+1); strcpy(fontprops,instance); strcat(fontprops,\"/\" FONT_PROPS); ssfd = fopen( fontprops,\"w\"); if ( ssfd!=NULL ) { err |= SFD_Dump(ssfd,sf,map,NULL,true,instance); if ( ferror(ssfd) ) err = true; if ( fclose(ssfd)) err = true; } else err = true; free(fontprops); free(instance); return( err ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328498, "input": "static int is_branch64_taken(struct bpf_reg_state *reg, u64 val, u8 opcode) { s64 sval = (s64)val; switch (opcode) { case BPF_JEQ: if (tnum_is_const(reg->var_off)) return !!tnum_equals_const(reg->var_off, val); break; case BPF_JNE: if (tnum_is_const(reg->var_off)) return !tnum_equals_const(reg->var_off, val); break; case BPF_JSET: if ((~reg->var_off.mask & reg->var_off.value) & val) return 1; if (!((reg->var_off.mask | reg->var_off.value) & val)) return 0; break; case BPF_JGT: if (reg->umin_value > val) return 1; else if (reg->umax_value <= val) return 0; break; case BPF_JSGT: if (reg->smin_value > sval) return 1; else if (reg->smax_value < sval) return 0; break; case BPF_JLT: if (reg->umax_value < val) return 1; else if (reg->umin_value >= val) return 0; break; case BPF_JSLT: if (reg->smax_value < sval) return 1; else if (reg->smin_value >= sval) return 0; break; case BPF_JGE: if (reg->umin_value >= val) return 1; else if (reg->umax_value < val) return 0; break; case BPF_JSGE: if (reg->smin_value >= sval) return 1; else if (reg->smax_value < sval) return 0; break; case BPF_JLE: if (reg->umax_value <= val) return 1; else if (reg->umin_value > val) return 0; break; case BPF_JSLE: if (reg->smax_value <= sval) return 1; else if (reg->smin_value > sval) return 0; break; } return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295395, "input": "static inline int may_follow_link(struct nameidata *nd) { const struct inode *inode; const struct inode *parent; kuid_t puid; if (!sysctl_protected_symlinks) return 0; /* Allowed if owner and follower match. */ inode = nd->link_inode; if (uid_eq(current_cred()->fsuid, inode->i_uid)) return 0; /* Allowed if parent directory not sticky and world-writable. */ parent = nd->inode; if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH)) return 0; /* Allowed if parent directory and link owner match. */ puid = parent->i_uid; if (uid_valid(puid) && uid_eq(puid, inode->i_uid)) return 0; if (nd->flags & LOOKUP_RCU) return -ECHILD; audit_inode(nd->name, nd->stack[0].link.dentry, 0); audit_log_path_denied(AUDIT_ANOM_LINK, \"follow_link\"); return -EACCES; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330255, "input": "ex_tabnext(exarg_T *eap) { int tab_number; if (ERROR_IF_POPUP_WINDOW) return; switch (eap->cmdidx) { case CMD_tabfirst: case CMD_tabrewind: goto_tabpage(1); break; case CMD_tablast: goto_tabpage(9999); break; case CMD_tabprevious: case CMD_tabNext: if (eap->arg && *eap->arg != NUL) { char_u *p = eap->arg; char_u *p_save = p; tab_number = getdigits(&p); if (p == p_save || *p_save == '-' || *p != NUL || tab_number == 0) { // No numbers as argument. eap->errmsg = ex_errmsg(e_invarg2, eap->arg); return; } } else { if (eap->addr_count == 0) tab_number = 1; else { tab_number = eap->line2; if (tab_number < 1) { eap->errmsg = _(e_invalid_range); return; } } } goto_tabpage(-tab_number); break; default: // CMD_tabnext tab_number = get_tabpage_arg(eap); if (eap->errmsg == NULL) goto_tabpage(tab_number); break; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268084, "input": "static int pfkey_add(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct net *net = sock_net(sk); struct xfrm_state *x; int err; struct km_event c; x = pfkey_msg2xfrm_state(net, hdr, ext_hdrs); if (IS_ERR(x)) return PTR_ERR(x); xfrm_state_hold(x); if (hdr->sadb_msg_type == SADB_ADD) err = xfrm_state_add(x); else err = xfrm_state_update(x); xfrm_audit_state_add(x, err ? 0 : 1, true); if (err < 0) { x->km.state = XFRM_STATE_DEAD; __xfrm_state_put(x); goto out; } if (hdr->sadb_msg_type == SADB_ADD) c.event = XFRM_MSG_NEWSA; else c.event = XFRM_MSG_UPDSA; c.seq = hdr->sadb_msg_seq; c.portid = hdr->sadb_msg_pid; km_state_notify(x, &c); out: xfrm_state_put(x); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 478238, "input": "static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v, struct vhost_iotlb_msg *msg) { struct vhost_dev *dev = &v->vdev; struct vhost_iotlb *iotlb = dev->iotlb; struct page **page_list; unsigned long list_size = PAGE_SIZE / sizeof(struct page *); unsigned int gup_flags = FOLL_LONGTERM; unsigned long npages, cur_base, map_pfn, last_pfn = 0; unsigned long lock_limit, sz2pin, nchunks, i; u64 iova = msg->iova; long pinned; int ret = 0; if (msg->iova < v->range.first || msg->iova + msg->size - 1 > v->range.last) return -EINVAL; if (vhost_iotlb_itree_first(iotlb, msg->iova, msg->iova + msg->size - 1)) return -EEXIST; /* Limit the use of memory for bookkeeping */ page_list = (struct page **) __get_free_page(GFP_KERNEL); if (!page_list) return -ENOMEM; if (msg->perm & VHOST_ACCESS_WO) gup_flags |= FOLL_WRITE; npages = PAGE_ALIGN(msg->size + (iova & ~PAGE_MASK)) >> PAGE_SHIFT; if (!npages) { ret = -EINVAL; goto free; } mmap_read_lock(dev->mm); lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; if (npages + atomic64_read(&dev->mm->pinned_vm) > lock_limit) { ret = -ENOMEM; goto unlock; } cur_base = msg->uaddr & PAGE_MASK; iova &= PAGE_MASK; nchunks = 0; while (npages) { sz2pin = min_t(unsigned long, npages, list_size); pinned = pin_user_pages(cur_base, sz2pin, gup_flags, page_list, NULL); if (sz2pin != pinned) { if (pinned < 0) { ret = pinned; } else { unpin_user_pages(page_list, pinned); ret = -ENOMEM; } goto out; } nchunks++; if (!last_pfn) map_pfn = page_to_pfn(page_list[0]); for (i = 0; i < pinned; i++) { unsigned long this_pfn = page_to_pfn(page_list[i]); u64 csize; if (last_pfn && (this_pfn != last_pfn + 1)) { /* Pin a contiguous chunk of memory */ csize = (last_pfn - map_pfn + 1) << PAGE_SHIFT; ret = vhost_vdpa_map(v, iova, csize, map_pfn << PAGE_SHIFT, msg->perm); if (ret) { /* * Unpin the pages that are left unmapped * from this point on in the current * page_list. The remaining outstanding * ones which may stride across several * chunks will be covered in the common * error path subsequently. */ unpin_user_pages(&page_list[i], pinned - i); goto out; } map_pfn = this_pfn; iova += csize; nchunks = 0; } last_pfn = this_pfn; } cur_base += pinned << PAGE_SHIFT; npages -= pinned; } /* Pin the rest chunk */ ret = vhost_vdpa_map(v, iova, (last_pfn - map_pfn + 1) << PAGE_SHIFT, map_pfn << PAGE_SHIFT, msg->perm); out: if (ret) { if (nchunks) { unsigned long pfn; /* * Unpin the outstanding pages which are yet to be * mapped but haven't due to vdpa_map() or * pin_user_pages() failure. * * Mapped pages are accounted in vdpa_map(), hence * the corresponding unpinning will be handled by * vdpa_unmap(). */ WARN_ON(!last_pfn); for (pfn = map_pfn; pfn <= last_pfn; pfn++) unpin_user_page(pfn_to_page(pfn)); } vhost_vdpa_unmap(v, msg->iova, msg->size); } unlock: mmap_read_unlock(dev->mm); free: free_page((unsigned long)page_list); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 394240, "input": "static int ctnetlink_flush_conntrack(struct net *net, const struct nlattr * const cda[], u32 portid, int report, u8 family) { struct ctnetlink_filter *filter = NULL; if (ctnetlink_needs_filter(family, cda)) { if (cda[CTA_FILTER]) return -EOPNOTSUPP; filter = ctnetlink_alloc_filter(cda, family); if (IS_ERR(filter)) return PTR_ERR(filter); } nf_ct_iterate_cleanup_net(net, ctnetlink_flush_iterate, filter, portid, report); kfree(filter); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259074, "input": "static mf_t *open_mf_single(void *talloc_ctx, struct mp_log *log, char *filename) { mf_t *mf = talloc_zero(talloc_ctx, mf_t); mf->log = log; mf_add(mf, filename); return mf; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 291437, "input": "static void php_openssl_add_method(const OBJ_NAME *name, void *arg) /* {{{ */ { if (name->alias == 0) { add_next_index_string((zval*)arg, (char*)name->name); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431255, "input": "int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, const nfs4_stateid *stateid) { struct nfs_server *server = NFS_SERVER(state->inode); int err; err = nfs4_set_lock_state(state, fl); if (err != 0) return err; err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 210193, "input": "int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length) { size_t item_len; mysql->affected_rows= net_field_length_ll(&pos); mysql->insert_id= net_field_length_ll(&pos); mysql->server_status=uint2korr(pos); pos+=2; mysql->warning_count=uint2korr(pos); pos+=2; if (pos < mysql->net.read_pos+length) { if ((item_len= net_field_length(&pos))) mysql->info=(char*) pos; /* check if server supports session tracking */ if (mysql->server_capabilities & CLIENT_SESSION_TRACKING) { ma_clear_session_state(mysql); pos+= item_len; if (mysql->server_status & SERVER_SESSION_STATE_CHANGED) { int i; if (pos < mysql->net.read_pos + length) { LIST *session_item; MYSQL_LEX_STRING *str= NULL; enum enum_session_state_type si_type; uchar *old_pos= pos; size_t item_len= net_field_length(&pos); /* length for all items */ /* length was already set, so make sure that info will be zero terminated */ if (mysql->info) *old_pos= 0; while (item_len > 0) { size_t plen; char *data; old_pos= pos; si_type= (enum enum_session_state_type)net_field_length(&pos); switch(si_type) { case SESSION_TRACK_SCHEMA: case SESSION_TRACK_STATE_CHANGE: case SESSION_TRACK_TRANSACTION_CHARACTERISTICS: case SESSION_TRACK_SYSTEM_VARIABLES: if (si_type != SESSION_TRACK_STATE_CHANGE) net_field_length(&pos); /* ignore total length, item length will follow next */ plen= net_field_length(&pos); if (!(session_item= ma_multi_malloc(0, &session_item, sizeof(LIST), &str, sizeof(MYSQL_LEX_STRING), &data, plen, NULL))) { ma_clear_session_state(mysql); SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0); return -1; } str->length= plen; str->str= data; memcpy(str->str, (char *)pos, plen); pos+= plen; session_item->data= str; mysql->extension->session_state[si_type].list= list_add(mysql->extension->session_state[si_type].list, session_item); /* in case schema has changed, we have to update mysql->db */ if (si_type == SESSION_TRACK_SCHEMA) { free(mysql->db); mysql->db= malloc(plen + 1); memcpy(mysql->db, str->str, plen); mysql->db[plen]= 0; } else if (si_type == SESSION_TRACK_SYSTEM_VARIABLES) { my_bool set_charset= 0; /* make sure that we update charset in case it has changed */ if (!strncmp(str->str, \"character_set_client\", str->length)) set_charset= 1; plen= net_field_length(&pos); if (!(session_item= ma_multi_malloc(0, &session_item, sizeof(LIST), &str, sizeof(MYSQL_LEX_STRING), &data, plen, NULL))) { ma_clear_session_state(mysql); SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0); return -1; } str->length= plen; str->str= data; memcpy(str->str, (char *)pos, plen); pos+= plen; session_item->data= str; mysql->extension->session_state[si_type].list= list_add(mysql->extension->session_state[si_type].list, session_item); if (set_charset && strncmp(mysql->charset->csname, str->str, str->length) != 0) { char cs_name[64]; MARIADB_CHARSET_INFO *cs_info; memcpy(cs_name, str->str, str->length); cs_name[str->length]= 0; if ((cs_info = (MARIADB_CHARSET_INFO *)mysql_find_charset_name(cs_name))) mysql->charset= cs_info; } } break; default: /* not supported yet */ plen= net_field_length(&pos); pos+= plen; break; } item_len-= (pos - old_pos); } } for (i= SESSION_TRACK_BEGIN; i <= SESSION_TRACK_END; i++) { mysql->extension->session_state[i].list= list_reverse(mysql->extension->session_state[i].list); mysql->extension->session_state[i].current= mysql->extension->session_state[i].list; } } } } /* CONC-351: clear session state information */ else if (mysql->server_capabilities & CLIENT_SESSION_TRACKING) ma_clear_session_state(mysql); return(0); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Input Validation"], "explanation": "libmariadb/mariadb_lib.c in MariaDB Connector/C before 3.1.8 does not properly validate the content of an OK packet received from a server. NOTE: although mariadb_lib.c was originally based on code shipped for MySQL, this issue does not affect any MySQL components supported by Oracle.", "severity_level": "NoInfo", "cwe": "CWE-20", "cve": "CVE-2020-13249"}} -{"idx": 295053, "input": "static BOOL update_send_non_monitored_desktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo) { wStream* s; rdpUpdate* update = context->update; BYTE controlFlags = ORDER_SECONDARY | (ORDER_TYPE_WINDOW << 2); UINT16 orderSize = 7; update_check_flush(context, orderSize); s = update->us; if (!s) return FALSE; Stream_Write_UINT8(s, controlFlags); /* Header (1 byte) */ Stream_Write_UINT16(s, orderSize); /* OrderSize (2 bytes) */ Stream_Write_UINT32(s, orderInfo->fieldFlags); /* FieldsPresentFlags (4 bytes) */ update->numberOrders++; return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 505488, "input": "static void freeString(slist * stk) { slist *sp; while (stk) { sp = stk->next; free(stk); stk = sp; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497500, "input": "ms_escher_header_release (MSEscherHeader *h) { if (h->attrs != NULL) { if (h->release_attrs) ms_obj_attr_bag_destroy (h->attrs); h->attrs = NULL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 408531, "input": "static void emac_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { MSF2EmacState *s = opaque; uint32_t value = val64; uint32_t enreqbits; uint8_t pktcnt; addr >>= 2; switch (addr) { case R_DMA_TX_CTL: s->regs[addr] = value; if (value & R_DMA_TX_CTL_EN_MASK) { msf2_dma_tx(s); } break; case R_DMA_RX_CTL: s->regs[addr] = value; if (value & R_DMA_RX_CTL_EN_MASK) { s->rx_desc = s->regs[R_DMA_RX_DESC]; qemu_flush_queued_packets(qemu_get_queue(s->nic)); } break; case R_CFG1: s->regs[addr] = value; if (value & R_CFG1_RESET_MASK) { msf2_emac_do_reset(s); } break; case R_FIFO_CFG0: /* * For our implementation, turning on modules is instantaneous, * so the states requested via the *ENREQ bits appear in the * *ENRPLY bits immediately. Also the reset bits to reset PE-MCXMAC * module are not emulated here since it deals with start of frames, * inter-packet gap and control frames. */ enreqbits = extract32(value, 8, 5); s->regs[addr] = deposit32(value, 16, 5, enreqbits); break; case R_DMA_TX_DESC: if (value & 0x3) { qemu_log_mask(LOG_GUEST_ERROR, \"Tx Descriptor address should be\" \" 32 bit aligned\\n\"); } /* Ignore [1:0] bits */ s->regs[addr] = value & ~3; break; case R_DMA_RX_DESC: if (value & 0x3) { qemu_log_mask(LOG_GUEST_ERROR, \"Rx Descriptor address should be\" \" 32 bit aligned\\n\"); } /* Ignore [1:0] bits */ s->regs[addr] = value & ~3; break; case R_DMA_TX_STATUS: if (value & R_DMA_TX_STATUS_UNDERRUN_MASK) { s->regs[addr] &= ~R_DMA_TX_STATUS_UNDERRUN_MASK; } if (value & R_DMA_TX_STATUS_PKT_SENT_MASK) { pktcnt = FIELD_EX32(s->regs[addr], DMA_TX_STATUS, PKTCNT); pktcnt--; s->regs[addr] = FIELD_DP32(s->regs[addr], DMA_TX_STATUS, PKTCNT, pktcnt); if (pktcnt == 0) { s->regs[addr] &= ~R_DMA_TX_STATUS_PKT_SENT_MASK; } } break; case R_DMA_RX_STATUS: if (value & R_DMA_RX_STATUS_OVERFLOW_MASK) { s->regs[addr] &= ~R_DMA_RX_STATUS_OVERFLOW_MASK; } if (value & R_DMA_RX_STATUS_PKT_RCVD_MASK) { pktcnt = FIELD_EX32(s->regs[addr], DMA_RX_STATUS, PKTCNT); pktcnt--; s->regs[addr] = FIELD_DP32(s->regs[addr], DMA_RX_STATUS, PKTCNT, pktcnt); if (pktcnt == 0) { s->regs[addr] &= ~R_DMA_RX_STATUS_PKT_RCVD_MASK; } } break; case R_DMA_IRQ: break; case R_MII_CMD: if (value & R_MII_CMD_READ_MASK) { s->regs[R_MII_STS] = read_from_phy(s); } break; case R_MII_CTL: s->regs[addr] = value; write_to_phy(s); break; case R_STA1: s->regs[addr] = value; /* * R_STA1 [31:24] : octet 1 of mac address * R_STA1 [23:16] : octet 2 of mac address * R_STA1 [15:8] : octet 3 of mac address * R_STA1 [7:0] : octet 4 of mac address */ stl_be_p(s->mac_addr, value); break; case R_STA2: s->regs[addr] = value; /* * R_STA2 [31:24] : octet 5 of mac address * R_STA2 [23:16] : octet 6 of mac address */ stw_be_p(s->mac_addr + 4, value >> 16); break; default: if (addr >= ARRAY_SIZE(s->regs)) { qemu_log_mask(LOG_GUEST_ERROR, \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\", __func__, addr * 4); return; } s->regs[addr] = value; break; } emac_update_irq(s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267932, "input": "void ScalarAddition(OpKernelContext* context, const T* full_input, float full_input_min, float full_input_max, int64 num_elements, T scalar_input, float scalar_input_min, float scalar_input_max, float output_min, float output_max, Toutput* output) { const Toutput scalar_in_output_range = RequantizeInNewRange( scalar_input, scalar_input_min, scalar_input_max, output_min, output_max); for (int i = 0; i < num_elements; ++i) { const Toutput full_input_in_output_range = RequantizeInNewRange( full_input[i], full_input_min, full_input_max, output_min, output_max); output[i] = full_input_in_output_range + scalar_in_output_range; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431001, "input": "static void nfs4_lock_release(void *calldata) { struct nfs4_lockdata *data = calldata; dprintk(\"%s: begin!\\n\", __func__); nfs_free_seqid(data->arg.open_seqid); if (data->cancelled && data->rpc_status == 0) { struct rpc_task *task; task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, data->arg.lock_seqid); if (!IS_ERR(task)) rpc_put_task_async(task); dprintk(\"%s: cancelling lock!\\n\", __func__); } else nfs_free_seqid(data->arg.lock_seqid); nfs4_put_lock_state(data->lsp); put_nfs_open_context(data->ctx); kfree(data); dprintk(\"%s: done!\\n\", __func__); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196896, "input": "void Compute(OpKernelContext* context) override { const Tensor& tensor_in = context->input(0); const Tensor& tensor_out = context->input(1); const Tensor& out_grad_backprop = context->input(2); // For maxpooling3d, tensor_in should have 5 dimensions. OP_REQUIRES(context, tensor_in.dims() == 5, errors::InvalidArgument(\"tensor_in must be 5-dimensional\")); OP_REQUIRES(context, tensor_out.dims() == 5, errors::InvalidArgument(\"tensor_out must be 5-dimensional\")); // For maxpooling3d, out_grad_backprop should have 5 dimensions. OP_REQUIRES( context, out_grad_backprop.dims() == 5, errors::InvalidArgument(\"out_grad_backprop must be 5-dimensional\")); Pool3dParameters params{context, ksize_, stride_, padding_, data_format_, tensor_in.shape()}; Tensor* output = nullptr; OP_REQUIRES_OK(context, context->forward_input_or_allocate_output( {2}, 0, tensor_out.shape(), &output)); LaunchMaxPooling3dGradGradOp::launch( context, params, tensor_in, tensor_out, out_grad_backprop, output); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPool3DGradGrad` exhibits undefined behavior by dereferencing null pointers backing attacker-supplied empty tensors. The implementation(https://github.com/tensorflow/tensorflow/blob/72fe792967e7fd25234342068806707bbc116618/tensorflow/core/kernels/pooling_ops_3d.cc#L679-L703) fails to validate that the 3 tensor inputs are not empty. If any of them is empty, then accessing the elements in the tensor results in dereferencing a null pointer. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-29574"}} -{"idx": 379580, "input": "u32toutf8 (wc, s) u_bits32_t wc; char *s; { int l; if (wc < 0x0080) { s[0] = (char)wc; l = 1; } else if (wc < 0x0800) { s[0] = (wc >> 6) | 0xc0; s[1] = (wc & 0x3f) | 0x80; l = 2; } else if (wc < 0x10000) { s[0] = (wc >> 12) | 0xe0; s[1] = ((wc >> 6) & 0x3f) | 0x80; s[2] = (wc & 0x3f) | 0x80; l = 3; } else if (wc < 0x200000) { s[0] = (wc >> 18) | 0xf0; s[1] = ((wc >> 12) & 0x3f) | 0x80; s[2] = ((wc >> 6) & 0x3f) | 0x80; s[3] = (wc & 0x3f) | 0x80; l = 4; } /* Strictly speaking, UTF-8 doesn't have characters longer than 4 bytes */ else if (wc < 0x04000000) { s[0] = (wc >> 24) | 0xf8; s[1] = ((wc >> 18) & 0x3f) | 0x80; s[2] = ((wc >> 12) & 0x3f) | 0x80; s[3] = ((wc >> 6) & 0x3f) | 0x80; s[4] = (wc & 0x3f) | 0x80; l = 5; } else if (wc < 0x080000000) { s[0] = (wc >> 30) | 0xf8; s[1] = ((wc >> 24) & 0x3f) | 0x80; s[2] = ((wc >> 18) & 0x3f) | 0x80; s[3] = ((wc >> 12) & 0x3f) | 0x80; s[4] = ((wc >> 6) & 0x3f) | 0x80; s[5] = (wc & 0x3f) | 0x80; l = 6; } else l = 0; s[l] = '\\0'; return l; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381519, "input": "static void v4l_print_cropcap(const void *arg, bool write_only) { const struct v4l2_cropcap *p = arg; pr_cont(\"type=%s, bounds wxh=%dx%d, x,y=%d,%d, defrect wxh=%dx%d, x,y=%d,%d, pixelaspect %d/%d\\n\", prt_names(p->type, v4l2_type_names), p->bounds.width, p->bounds.height, p->bounds.left, p->bounds.top, p->defrect.width, p->defrect.height, p->defrect.left, p->defrect.top, p->pixelaspect.numerator, p->pixelaspect.denominator); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409675, "input": "static BOOL rdp_write_window_list_capability_set(wStream* s, const rdpSettings* settings) { size_t header; if (!Stream_EnsureRemainingCapacity(s, 32)) return FALSE; header = rdp_capability_set_start(s); Stream_Write_UINT32(s, settings->RemoteWndSupportLevel); /* wndSupportLevel (4 bytes) */ Stream_Write_UINT8(s, settings->RemoteAppNumIconCaches); /* numIconCaches (1 byte) */ Stream_Write_UINT16(s, settings->RemoteAppNumIconCacheEntries); /* numIconCacheEntries (2 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_WINDOW); return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 463020, "input": "static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr, unsigned long ulen, unsigned long *n, int write) { struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; unsigned long npages, size; int npinned; unsigned long locked, lock_limit; struct page **pages; unsigned long first, last; int ret; if (ulen == 0 || uaddr + ulen < uaddr) return ERR_PTR(-EINVAL); /* Calculate number of pages. */ first = (uaddr & PAGE_MASK) >> PAGE_SHIFT; last = ((uaddr + ulen - 1) & PAGE_MASK) >> PAGE_SHIFT; npages = (last - first + 1); locked = sev->pages_locked + npages; lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; if (locked > lock_limit && !capable(CAP_IPC_LOCK)) { pr_err(\"SEV: %lu locked pages exceed the lock limit of %lu.\\n\", locked, lock_limit); return ERR_PTR(-ENOMEM); } if (WARN_ON_ONCE(npages > INT_MAX)) return ERR_PTR(-EINVAL); /* Avoid using vmalloc for smaller buffers. */ size = npages * sizeof(struct page *); if (size > PAGE_SIZE) pages = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_ZERO); else pages = kmalloc(size, GFP_KERNEL_ACCOUNT); if (!pages) return ERR_PTR(-ENOMEM); /* Pin the user virtual address. */ npinned = pin_user_pages_fast(uaddr, npages, write ? FOLL_WRITE : 0, pages); if (npinned != npages) { pr_err(\"SEV: Failure locking %lu pages.\\n\", npages); ret = -ENOMEM; goto err; } *n = npages; sev->pages_locked = locked; return pages; err: if (npinned > 0) unpin_user_pages(pages, npinned); kvfree(pages); return ERR_PTR(ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410419, "input": "int mnt_optstr_get_options(const char *optstr, char **subset, const struct libmnt_optmap *map, int ignore) { struct libmnt_optmap const *maps[1]; struct ul_buffer buf = UL_INIT_BUFFER; char *name, *val, *str = (char *) optstr; size_t namesz, valsz; int rc = 0; if (!optstr || !subset) return -EINVAL; maps[0] = map; ul_buffer_set_chunksize(&buf, strlen(optstr)/2); while (!mnt_optstr_next_option(&str, &name, &namesz, &val, &valsz)) { const struct libmnt_optmap *ent; mnt_optmap_get_entry(maps, 1, name, namesz, &ent); if (!ent || !ent->id) continue; /* ignore undefined options (comments) */ if (ignore && (ent->mask & ignore)) continue; /* ignore name= if options map expects only */ if (valsz && mnt_optmap_entry_novalue(ent)) continue; rc = __buffer_append_option(&buf, name, namesz, val, valsz); if (rc) break; } *subset = rc ? NULL : ul_buffer_get_data(&buf, NULL, NULL); if (rc) ul_buffer_free_data(&buf); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 329990, "input": "fe_op_modrdn( Operation *op, SlapReply *rs ) { struct berval dest_ndn = BER_BVNULL, dest_pndn, pdn = BER_BVNULL; BackendDB *op_be, *bd = op->o_bd; ber_slen_t diff; if( op->o_req_ndn.bv_len == 0 ) { Debug( LDAP_DEBUG_ANY, \"%s do_modrdn: root dse!\\n\", op->o_log_prefix, 0, 0 ); send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, \"cannot rename the root DSE\" ); goto cleanup; } else if ( bvmatch( &op->o_req_ndn, &frontendDB->be_schemandn ) ) { Debug( LDAP_DEBUG_ANY, \"%s do_modrdn: subschema subentry: %s (%ld)\\n\", op->o_log_prefix, frontendDB->be_schemandn.bv_val, (long)frontendDB->be_schemandn.bv_len ); send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, \"cannot rename subschema subentry\" ); goto cleanup; } if( op->orr_nnewSup ) { dest_pndn = *op->orr_nnewSup; } else { dnParent( &op->o_req_ndn, &dest_pndn ); } build_new_dn( &dest_ndn, &dest_pndn, &op->orr_nnewrdn, op->o_tmpmemctx ); diff = (ber_slen_t) dest_ndn.bv_len - (ber_slen_t) op->o_req_ndn.bv_len; if ( diff > 0 ? dnIsSuffix( &dest_ndn, &op->o_req_ndn ) : diff < 0 && dnIsSuffix( &op->o_req_ndn, &dest_ndn ) ) { send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, diff > 0 ? \"cannot place an entry below itself\" : \"cannot place an entry above itself\" ); goto cleanup; } /* * We could be serving multiple database backends. Select the * appropriate one, or send a referral to our \"referral server\" * if we don't hold it. */ op->o_bd = select_backend( &op->o_req_ndn, 1 ); if ( op->o_bd == NULL ) { op->o_bd = bd; rs->sr_ref = referral_rewrite( default_referral, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); if (!rs->sr_ref) rs->sr_ref = default_referral; if ( rs->sr_ref != NULL ) { rs->sr_err = LDAP_REFERRAL; send_ldap_result( op, rs ); if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref ); } else { send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, \"no global superior knowledge\" ); } goto cleanup; } /* If we've got a glued backend, check the real backend */ op_be = op->o_bd; if ( SLAP_GLUE_INSTANCE( op->o_bd )) { op->o_bd = select_backend( &op->o_req_ndn, 0 ); } /* check restrictions */ if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) { send_ldap_result( op, rs ); goto cleanup; } /* check for referrals */ if ( backend_check_referrals( op, rs ) != LDAP_SUCCESS ) { goto cleanup; } /* check that destination DN is in the same backend as source DN */ if ( select_backend( &dest_ndn, 0 ) != op->o_bd ) { send_ldap_error( op, rs, LDAP_AFFECTS_MULTIPLE_DSAS, \"cannot rename between DSAs\" ); goto cleanup; } /* * do the modrdn if 1 && (2 || 3) * 1) there is a modrdn function implemented in this backend; * 2) this backend is the provider for what it holds; * 3) it's a replica and the dn supplied is the update_ndn. */ if ( op->o_bd->be_modrdn ) { /* do the update here */ int repl_user = be_isupdate( op ); if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user ) { op->o_bd = op_be; op->o_bd->be_modrdn( op, rs ); if ( op->o_bd->be_delete ) { struct berval org_req_dn = BER_BVNULL; struct berval org_req_ndn = BER_BVNULL; struct berval org_dn = BER_BVNULL; struct berval org_ndn = BER_BVNULL; int org_managedsait; org_req_dn = op->o_req_dn; org_req_ndn = op->o_req_ndn; org_dn = op->o_dn; org_ndn = op->o_ndn; org_managedsait = get_manageDSAit( op ); op->o_dn = op->o_bd->be_rootdn; op->o_ndn = op->o_bd->be_rootndn; op->o_managedsait = SLAP_CONTROL_NONCRITICAL; while ( rs->sr_err == LDAP_SUCCESS && op->o_delete_glue_parent ) { op->o_delete_glue_parent = 0; if ( !be_issuffix( op->o_bd, &op->o_req_ndn )) { slap_callback cb = { NULL }; cb.sc_response = slap_null_cb; dnParent( &op->o_req_ndn, &pdn ); op->o_req_dn = pdn; op->o_req_ndn = pdn; op->o_callback = &cb; op->o_bd->be_delete( op, rs ); } else { break; } } op->o_managedsait = org_managedsait; op->o_dn = org_dn; op->o_ndn = org_ndn; op->o_req_dn = org_req_dn; op->o_req_ndn = org_req_ndn; op->o_delete_glue_parent = 0; } } else { BerVarray defref = op->o_bd->be_update_refs ? op->o_bd->be_update_refs : default_referral; if ( defref != NULL ) { rs->sr_ref = referral_rewrite( defref, NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT ); if (!rs->sr_ref) rs->sr_ref = defref; rs->sr_err = LDAP_REFERRAL; send_ldap_result( op, rs ); if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref ); } else { send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, \"shadow context; no update referral\" ); } } } else { send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, \"operation not supported within namingContext\" ); } cleanup:; if ( dest_ndn.bv_val != NULL ) ber_memfree_x( dest_ndn.bv_val, op->o_tmpmemctx ); op->o_bd = bd; return rs->sr_err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432625, "input": "static int halt_interception(struct vcpu_svm *svm) { return kvm_emulate_halt(&svm->vcpu); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380002, "input": "* This function can be used by drives like qla4xxx to report to the scsi * layer when the scans it kicked off at module load time are done. */ int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time) { struct iscsi_cls_host *ihost = shost->shost_data; /* * qla4xxx will have kicked off some session unblocks before calling * scsi_scan_host, so just wait for them to complete.", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458416, "input": "static inline void hid_map_usage_clear(struct hid_input *hidinput, struct hid_usage *usage, unsigned long **bit, int *max, __u8 type, __u16 c) { hid_map_usage(hidinput, usage, bit, max, type, c); if (*bit) clear_bit(usage->code, *bit); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508562, "input": "static bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl) { return eliminated_tables && ((tbl->table && (tbl->table->map & eliminated_tables)) || (tbl->nested_join && !(tbl->nested_join->used_tables & ~eliminated_tables))); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230101, "input": "oberthur_detect_card(struct sc_pkcs15_card * p15card) { struct sc_card *card = p15card->card; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (p15card->card->type != SC_CARD_TYPE_OBERTHUR_64K) LOG_FUNC_RETURN(p15card->card->ctx, SC_ERROR_WRONG_CARD); LOG_FUNC_RETURN(p15card->card->ctx, SC_SUCCESS); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224827, "input": "int pep_writeable(struct sock *sk) { struct pep_sock *pn = pep_sk(sk); return atomic_read(&pn->tx_credits); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 285527, "input": "parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree; size_t cur_nsub; cur_nsub = preg->re_nsub++; fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); /* The subexpression may be a null string. */ if (token->type == OP_CLOSE_SUBEXP) tree = NULL; else { tree = parse_reg_exp (regexp, preg, token, syntax, nest, err); if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0)) { if (tree != NULL) postorder (tree, free_tree, NULL); *err = REG_EPAREN; } if (BE (*err != REG_NOERROR, 0)) return NULL; } if (cur_nsub <= '9' - '1') dfa->completed_bkref_map |= 1 << cur_nsub; tree = create_tree (dfa, tree, NULL, SUBEXP); if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; } tree->token.opr.idx = cur_nsub; return tree; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 350361, "input": "pixReadFromMultipageTiff(const char *fname, size_t *poffset) { l_int32 retval; size_t offset; PIX *pix; TIFF *tif; PROCNAME(\"pixReadFromMultipageTiff\"); if (!fname) return (PIX *)ERROR_PTR(\"fname not defined\", procName, NULL); if (!poffset) return (PIX *)ERROR_PTR(\"&offset not defined\", procName, NULL); if ((tif = openTiff(fname, \"r\")) == NULL) { L_ERROR(\"tif open failed for %s\\n\", procName, fname); return NULL; } /* Set ptrs in the TIFF to the beginning of the image */ offset = *poffset; retval = (offset == 0) ? TIFFSetDirectory(tif, 0) : TIFFSetSubDirectory(tif, offset); if (retval == 0) { TIFFCleanup(tif); return NULL; } if ((pix = pixReadFromTiffStream(tif)) == NULL) { TIFFCleanup(tif); return NULL; } /* Advance to the next image and return the new offset */ TIFFReadDirectory(tif); *poffset = TIFFCurrentDirOffset(tif); TIFFClose(tif); return pix; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232989, "input": "virtio_set_modern_pio_bar(struct virtio_base *base, int barnum) { int rc; struct virtio_pci_notify_cap notify_pio = { .cap.cap_vndr = PCIY_VENDOR, .cap.cap_next = 0, .cap.cap_len = sizeof(notify_pio), .cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG, .cap.bar = barnum, .cap.offset = 0, .cap.length = 4, .notify_off_multiplier = 0, }; /* notification capability */ rc = pci_emul_add_capability(base->dev, (u_char *)¬ify_pio, sizeof(notify_pio)); if (rc != 0) { pr_err(\"pci emulation add notification capability for virtio modern PIO BAR failed\\n\"); return -1; } /* allocate and register modern pio bar */ rc = pci_emul_alloc_bar(base->dev, barnum, PCIBAR_IO, 4); if (rc != 0) { pr_err(\"allocate and register modern pio bar failed\\n\"); return -1; } base->modern_pio_bar_idx = barnum; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398212, "input": "static void sctp_wfree(struct sk_buff *skb) { struct sctp_chunk *chunk = skb_shinfo(skb)->destructor_arg; struct sctp_association *asoc = chunk->asoc; struct sock *sk = asoc->base.sk; sk_mem_uncharge(sk, skb->truesize); sk->sk_wmem_queued -= skb->truesize + sizeof(struct sctp_chunk); asoc->sndbuf_used -= skb->truesize + sizeof(struct sctp_chunk); WARN_ON(refcount_sub_and_test(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc)); if (chunk->shkey) { struct sctp_shared_key *shkey = chunk->shkey; /* refcnt == 2 and !list_empty mean after this release, it's * not being used anywhere, and it's time to notify userland * that this shkey can be freed if it's been deactivated. */ if (shkey->deactivated && !list_empty(&shkey->key_list) && refcount_read(&shkey->refcnt) == 2) { struct sctp_ulpevent *ev; ev = sctp_ulpevent_make_authkey(asoc, shkey->key_id, SCTP_AUTH_FREE_KEY, GFP_KERNEL); if (ev) asoc->stream.si->enqueue_event(&asoc->ulpq, ev); } sctp_auth_shkey_release(chunk->shkey); } sock_wfree(skb); sctp_wake_up_waiters(sk, asoc); sctp_association_put(asoc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 350347, "input": "extractG4DataFromFile(const char *filein, l_uint8 **pdata, size_t *pnbytes, l_int32 *pw, l_int32 *ph, l_int32 *pminisblack) { l_uint8 *inarray, *data; l_uint16 minisblack, comptype; /* accessors require l_uint16 */ l_int32 istiff; l_uint32 w, h, rowsperstrip; /* accessors require l_uint32 */ l_uint32 diroff; size_t fbytes, nbytes; FILE *fpin; TIFF *tif; PROCNAME(\"extractG4DataFromFile\"); if (!pdata) return ERROR_INT(\"&data not defined\", procName, 1); if (!pnbytes) return ERROR_INT(\"&nbytes not defined\", procName, 1); if (!pw && !ph && !pminisblack) return ERROR_INT(\"no output data requested\", procName, 1); *pdata = NULL; *pnbytes = 0; if ((fpin = fopenReadStream(filein)) == NULL) return ERROR_INT(\"stream not opened to file\", procName, 1); istiff = fileFormatIsTiff(fpin); fclose(fpin); if (!istiff) return ERROR_INT(\"filein not tiff\", procName, 1); if ((inarray = l_binaryRead(filein, &fbytes)) == NULL) return ERROR_INT(\"inarray not made\", procName, 1); /* Get metadata about the image */ if ((tif = openTiff(filein, \"rb\")) == NULL) { LEPT_FREE(inarray); return ERROR_INT(\"tif not open for read\", procName, 1); } TIFFGetField(tif, TIFFTAG_COMPRESSION, &comptype); if (comptype != COMPRESSION_CCITTFAX4) { LEPT_FREE(inarray); TIFFClose(tif); return ERROR_INT(\"filein is not g4 compressed\", procName, 1); } TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); if (h != rowsperstrip) L_WARNING(\"more than 1 strip\\n\", procName); TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &minisblack); /* for 1 bpp */ /* TIFFPrintDirectory(tif, stderr, 0); */ TIFFClose(tif); if (pw) *pw = (l_int32)w; if (ph) *ph = (l_int32)h; if (pminisblack) *pminisblack = (l_int32)minisblack; /* The header has 8 bytes: the first 2 are the magic number, * the next 2 are the version, and the last 4 are the * offset to the first directory. That's what we want here. * We have to test the byte order before decoding 4 bytes! */ if (inarray[0] == 0x4d) { /* big-endian */ diroff = (inarray[4] << 24) | (inarray[5] << 16) | (inarray[6] << 8) | inarray[7]; } else { /* inarray[0] == 0x49 : little-endian */ diroff = (inarray[7] << 24) | (inarray[6] << 16) | (inarray[5] << 8) | inarray[4]; } /* lept_stderr(\" diroff = %d, %x\\n\", diroff, diroff); */ /* Extract the ccittg4 encoded data from the tiff file. * We skip the 8 byte header and take nbytes of data, * up to the beginning of the directory (at diroff) */ nbytes = diroff - 8; *pnbytes = nbytes; if ((data = (l_uint8 *)LEPT_CALLOC(nbytes, sizeof(l_uint8))) == NULL) { LEPT_FREE(inarray); return ERROR_INT(\"data not allocated\", procName, 1); } *pdata = data; memcpy(data, inarray + 8, nbytes); LEPT_FREE(inarray); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385354, "input": "*/ xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) { if (ctxt->context->node == NULL) return(NULL); if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || (ctxt->context->node->type == XML_NAMESPACE_DECL)) return(NULL); if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc) return(ctxt->context->doc->children); return(ctxt->context->node->children); } if (cur->type == XML_NAMESPACE_DECL) return(NULL); if (cur->children != NULL) { /* * Do not descend on entities declarations */ if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; /* * Skip DTDs */ if (cur->type != XML_DTD_NODE) return(cur); } } if (cur == ctxt->context->node) return(NULL); while (cur->next != NULL) { cur = cur->next; if ((cur->type != XML_ENTITY_DECL) && (cur->type != XML_DTD_NODE)) return(cur); } do { cur = cur->parent; if (cur == NULL) break; if (cur == ctxt->context->node) return(NULL); if (cur->next != NULL) { cur = cur->next; return(cur); } } while (cur != NULL);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267275, "input": "GF_Err gf_isom_new_mpeg4_description(GF_ISOFile *movie, u32 trackNumber, const GF_ESD *esd, const char *URLname, const char *URNname, u32 *outDescriptionIndex) { GF_TrackBox *trak; GF_Err e; u32 dataRefIndex; GF_ESD *new_esd; e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE); if (e) return e; trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak || !trak->Media || !esd || !esd->decoderConfig || !esd->slConfig) return GF_BAD_PARAM; //get or create the data ref e = Media_FindDataRef(trak->Media->information->dataInformation->dref, (char *)URLname, (char *)URNname, &dataRefIndex); if (e) return e; if (!dataRefIndex) { e = Media_CreateDataRef(movie, trak->Media->information->dataInformation->dref, (char *)URLname, (char *)URNname, &dataRefIndex); if (e) return e; } //duplicate our desc e = gf_odf_desc_copy((GF_Descriptor *)esd, (GF_Descriptor **)&new_esd); if (e) return e; if (!movie->keep_utc) trak->Media->mediaHeader->modificationTime = gf_isom_get_mp4time(); e = Track_SetStreamDescriptor(trak, 0, dataRefIndex, new_esd, outDescriptionIndex); if (e) { gf_odf_desc_del((GF_Descriptor *)new_esd); return e; } return e; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273242, "input": "static std::string ToModeLetters(const Modes::ChangeList::List& list, std::string::size_type maxlinelen, Modes::ChangeList::List::const_iterator beginit, Modes::ChangeList::List::const_iterator& lastit) { std::string ret; std::string::size_type paramlength = 0; char output_pm = '\\0'; // current output state, '+' or '-' Modes::ChangeList::List::const_iterator i; for (i = beginit; i != list.end(); ++i) { const Modes::Change& item = *i; const char needed_pm = (item.adding ? '+' : '-'); if (needed_pm != output_pm) { output_pm = needed_pm; ret.push_back(output_pm); } if (!item.param.empty()) paramlength += item.param.length() + 1; if (ret.length() + 1 + paramlength > maxlinelen) { // Mode sequence is getting too long const char c = *ret.rbegin(); if ((c == '+') || (c == '-')) ret.erase(ret.size()-1); break; } ret.push_back(item.mh->GetModeChar()); } lastit = i; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497639, "input": "void hmac_final(HMACCTX c, unsigned char *hashmacbuf, unsigned int *len) { *len = gcry_md_get_algo_dlen(gcry_md_get_algo(c)); memcpy(hashmacbuf, gcry_md_read(c, 0), *len); gcry_md_close(c); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 89028, "input": "void WebGraphicsContext3DDefaultImpl::bindBuffer(unsigned long target, WebGLId buffer) { makeContextCurrent(); if (target == GL_ARRAY_BUFFER) m_boundArrayBuffer = buffer; glBindBuffer(target, buffer); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 456948, "input": "static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, struct list_head *done) { struct req_batch rb; struct io_kiocb *req; LIST_HEAD(again); /* order with ->result store in io_complete_rw_iopoll() */ smp_rmb(); io_init_req_batch(&rb); while (!list_empty(done)) { int cflags = 0; req = list_first_entry(done, struct io_kiocb, inflight_entry); if (READ_ONCE(req->result) == -EAGAIN) { req->iopoll_completed = 0; list_move_tail(&req->inflight_entry, &again); continue; } list_del(&req->inflight_entry); if (req->flags & REQ_F_BUFFER_SELECTED) cflags = io_put_rw_kbuf(req); __io_cqring_fill_event(req, req->result, cflags); (*nr_events)++; if (refcount_dec_and_test(&req->refs)) io_req_free_batch(&rb, req); } io_commit_cqring(ctx); if (ctx->flags & IORING_SETUP_SQPOLL) io_cqring_ev_posted(ctx); io_req_free_batch_finish(ctx, &rb); if (!list_empty(&again)) io_iopoll_queue(&again); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366007, "input": "lyxml_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg, const struct lyxml_elem *elem, int options) { FUN_IN; struct lyout out; if (!writeclb || !elem) { return 0; } memset(&out, 0, sizeof out); out.type = LYOUT_CALLBACK; out.method.clb.f = writeclb; out.method.clb.arg = arg; if (options & LYXML_PRINT_SIBLINGS) { return dump_siblings(&out, elem, options); } else { return dump_elem(&out, elem, 0, options, 1); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 469000, "input": "int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, int (*output)(struct net *, struct sock *, struct sk_buff *)) { struct iphdr *iph; int ptr; struct sk_buff *skb2; unsigned int mtu, hlen, left, len, ll_rs; int offset; __be16 not_last_frag; struct rtable *rt = skb_rtable(skb); int err = 0; /* for offloaded checksums cleanup checksum before fragmentation */ if (skb->ip_summed == CHECKSUM_PARTIAL && (err = skb_checksum_help(skb))) goto fail; /* * Point into the IP datagram header. */ iph = ip_hdr(skb); mtu = ip_skb_dst_mtu(sk, skb); if (IPCB(skb)->frag_max_size && IPCB(skb)->frag_max_size < mtu) mtu = IPCB(skb)->frag_max_size; /* * Setup starting values. */ hlen = iph->ihl * 4; mtu = mtu - hlen; /* Size of data space */ IPCB(skb)->flags |= IPSKB_FRAG_COMPLETE; ll_rs = LL_RESERVED_SPACE(rt->dst.dev); /* When frag_list is given, use it. First, check its validity: * some transformers could create wrong frag_list or break existing * one, it is not prohibited. In this case fall back to copying. * * LATER: this step can be merged to real generation of fragments, * we can switch to copy when see the first bad fragment. */ if (skb_has_frag_list(skb)) { struct sk_buff *frag, *frag2; unsigned int first_len = skb_pagelen(skb); if (first_len - hlen > mtu || ((first_len - hlen) & 7) || ip_is_fragment(iph) || skb_cloned(skb) || skb_headroom(skb) < ll_rs) goto slow_path; skb_walk_frags(skb, frag) { /* Correct geometry. */ if (frag->len > mtu || ((frag->len & 7) && frag->next) || skb_headroom(frag) < hlen + ll_rs) goto slow_path_clean; /* Partially cloned skb? */ if (skb_shared(frag)) goto slow_path_clean; BUG_ON(frag->sk); if (skb->sk) { frag->sk = skb->sk; frag->destructor = sock_wfree; } skb->truesize -= frag->truesize; } /* Everything is OK. Generate! */ err = 0; offset = 0; frag = skb_shinfo(skb)->frag_list; skb_frag_list_init(skb); skb->data_len = first_len - skb_headlen(skb); skb->len = first_len; iph->tot_len = htons(first_len); iph->frag_off = htons(IP_MF); ip_send_check(iph); for (;;) { /* Prepare header of the next frame, * before previous one went down. */ if (frag) { frag->ip_summed = CHECKSUM_NONE; skb_reset_transport_header(frag); __skb_push(frag, hlen); skb_reset_network_header(frag); memcpy(skb_network_header(frag), iph, hlen); iph = ip_hdr(frag); iph->tot_len = htons(frag->len); ip_copy_metadata(frag, skb); if (offset == 0) ip_options_fragment(frag); offset += skb->len - hlen; iph->frag_off = htons(offset>>3); if (frag->next) iph->frag_off |= htons(IP_MF); /* Ready, complete checksum */ ip_send_check(iph); } err = output(net, sk, skb); if (!err) IP_INC_STATS(net, IPSTATS_MIB_FRAGCREATES); if (err || !frag) break; skb = frag; frag = skb->next; skb->next = NULL; } if (err == 0) { IP_INC_STATS(net, IPSTATS_MIB_FRAGOKS); return 0; } while (frag) { skb = frag->next; kfree_skb(frag); frag = skb; } IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS); return err; slow_path_clean: skb_walk_frags(skb, frag2) { if (frag2 == frag) break; frag2->sk = NULL; frag2->destructor = NULL; skb->truesize += frag2->truesize; } } slow_path: iph = ip_hdr(skb); left = skb->len - hlen; /* Space per frame */ ptr = hlen; /* Where to start from */ /* * Fragment the datagram. */ offset = (ntohs(iph->frag_off) & IP_OFFSET) << 3; not_last_frag = iph->frag_off & htons(IP_MF); /* * Keep copying data until we run out. */ while (left > 0) { len = left; /* IF: it doesn't fit, use 'mtu' - the data space left */ if (len > mtu) len = mtu; /* IF: we are not sending up to and including the packet end then align the next start on an eight byte boundary */ if (len < left) { len &= ~7; } /* Allocate buffer */ skb2 = alloc_skb(len + hlen + ll_rs, GFP_ATOMIC); if (!skb2) { err = -ENOMEM; goto fail; } /* * Set up data on packet */ ip_copy_metadata(skb2, skb); skb_reserve(skb2, ll_rs); skb_put(skb2, len + hlen); skb_reset_network_header(skb2); skb2->transport_header = skb2->network_header + hlen; /* * Charge the memory for the fragment to any owner * it might possess */ if (skb->sk) skb_set_owner_w(skb2, skb->sk); /* * Copy the packet header into the new buffer. */ skb_copy_from_linear_data(skb, skb_network_header(skb2), hlen); /* * Copy a block of the IP datagram. */ if (skb_copy_bits(skb, ptr, skb_transport_header(skb2), len)) BUG(); left -= len; /* * Fill in the new header fields. */ iph = ip_hdr(skb2); iph->frag_off = htons((offset >> 3)); if (IPCB(skb)->flags & IPSKB_FRAG_PMTU) iph->frag_off |= htons(IP_DF); /* ANK: dirty, but effective trick. Upgrade options only if * the segment to be fragmented was THE FIRST (otherwise, * options are already fixed) and make it ONCE * on the initial skb, so that all the following fragments * will inherit fixed options. */ if (offset == 0) ip_options_fragment(skb); /* * Added AC : If we are fragmenting a fragment that's not the * last fragment then keep MF on each bit */ if (left > 0 || not_last_frag) iph->frag_off |= htons(IP_MF); ptr += len; offset += len; /* * Put this fragment into the sending queue. */ iph->tot_len = htons(len + hlen); ip_send_check(iph); err = output(net, sk, skb2); if (err) goto fail; IP_INC_STATS(net, IPSTATS_MIB_FRAGCREATES); } consume_skb(skb); IP_INC_STATS(net, IPSTATS_MIB_FRAGOKS); return err; fail: kfree_skb(skb); IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202080, "input": "slap_modrdn2mods( Operation *op, SlapReply *rs ) { int a_cnt, d_cnt; LDAPRDN old_rdn = NULL; LDAPRDN new_rdn = NULL; assert( !BER_BVISEMPTY( &op->oq_modrdn.rs_newrdn ) ); /* if requestDN is empty, silently reset deleteOldRDN */ if ( BER_BVISEMPTY( &op->o_req_dn ) ) op->orr_deleteoldrdn = 0; if ( ldap_bv2rdn_x( &op->oq_modrdn.rs_newrdn, &new_rdn, (char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) ) { Debug( LDAP_DEBUG_TRACE, \"%s slap_modrdn2mods: can't figure out \" \"type(s)/value(s) of newrdn\\n\", op->o_log_prefix ); rs->sr_err = LDAP_INVALID_DN_SYNTAX; rs->sr_text = \"unknown type(s)/value(s) used in RDN\"; goto done; } if ( op->oq_modrdn.rs_deleteoldrdn ) { if ( ldap_bv2rdn_x( &op->o_req_dn, &old_rdn, (char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) ) { Debug( LDAP_DEBUG_TRACE, \"%s slap_modrdn2mods: can't figure out \" \"type(s)/value(s) of oldrdn\\n\", op->o_log_prefix ); rs->sr_err = LDAP_OTHER; rs->sr_text = \"cannot parse RDN from old DN\"; goto done; } } rs->sr_text = NULL; /* Add new attribute values to the entry */ for ( a_cnt = 0; new_rdn[a_cnt]; a_cnt++ ) { AttributeDescription *desc = NULL; Modifications *mod_tmp; rs->sr_err = slap_bv2ad( &new_rdn[a_cnt]->la_attr, &desc, &rs->sr_text ); if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, \"%s slap_modrdn2mods: %s: %s (new)\\n\", op->o_log_prefix, rs->sr_text, new_rdn[ a_cnt ]->la_attr.bv_val ); goto done; } if ( !desc->ad_type->sat_equality ) { Debug( LDAP_DEBUG_TRACE, \"%s slap_modrdn2mods: %s: %s (new)\\n\", op->o_log_prefix, rs->sr_text, new_rdn[ a_cnt ]->la_attr.bv_val ); rs->sr_text = \"naming attribute has no equality matching rule\"; rs->sr_err = LDAP_NAMING_VIOLATION; goto done; } /* Apply modification */ mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications ) ); mod_tmp->sml_desc = desc; BER_BVZERO( &mod_tmp->sml_type ); mod_tmp->sml_numvals = 1; mod_tmp->sml_values = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) ); ber_dupbv( &mod_tmp->sml_values[0], &new_rdn[a_cnt]->la_value ); mod_tmp->sml_values[1].bv_val = NULL; if( desc->ad_type->sat_equality->smr_normalize) { mod_tmp->sml_nvalues = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) ); rs->sr_err = desc->ad_type->sat_equality->smr_normalize( SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX, desc->ad_type->sat_syntax, desc->ad_type->sat_equality, &mod_tmp->sml_values[0], &mod_tmp->sml_nvalues[0], NULL ); if (rs->sr_err != LDAP_SUCCESS) { ch_free(mod_tmp->sml_nvalues); ch_free(mod_tmp->sml_values[0].bv_val); ch_free(mod_tmp->sml_values); ch_free(mod_tmp); goto done; } mod_tmp->sml_nvalues[1].bv_val = NULL; } else { mod_tmp->sml_nvalues = NULL; } mod_tmp->sml_op = SLAP_MOD_SOFTADD; mod_tmp->sml_flags = 0; mod_tmp->sml_next = op->orr_modlist; op->orr_modlist = mod_tmp; } /* Remove old rdn value if required */ if ( op->orr_deleteoldrdn ) { for ( d_cnt = 0; old_rdn[d_cnt]; d_cnt++ ) { AttributeDescription *desc = NULL; Modifications *mod_tmp; rs->sr_err = slap_bv2ad( &old_rdn[d_cnt]->la_attr, &desc, &rs->sr_text ); if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, \"%s slap_modrdn2mods: %s: %s (old)\\n\", op->o_log_prefix, rs->sr_text, old_rdn[d_cnt]->la_attr.bv_val ); goto done; } /* Apply modification */ mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications ) ); mod_tmp->sml_desc = desc; BER_BVZERO( &mod_tmp->sml_type ); mod_tmp->sml_numvals = 1; mod_tmp->sml_values = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) ); ber_dupbv( &mod_tmp->sml_values[0], &old_rdn[d_cnt]->la_value ); mod_tmp->sml_values[1].bv_val = NULL; if( desc->ad_type->sat_equality->smr_normalize) { mod_tmp->sml_nvalues = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) ); (void) (*desc->ad_type->sat_equality->smr_normalize)( SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX, desc->ad_type->sat_syntax, desc->ad_type->sat_equality, &mod_tmp->sml_values[0], &mod_tmp->sml_nvalues[0], NULL ); mod_tmp->sml_nvalues[1].bv_val = NULL; } else { mod_tmp->sml_nvalues = NULL; } mod_tmp->sml_op = LDAP_MOD_DELETE; mod_tmp->sml_flags = 0; mod_tmp->sml_next = op->orr_modlist; op->orr_modlist = mod_tmp; } } done: /* LDAP v2 supporting correct attribute handling. */ if ( rs->sr_err != LDAP_SUCCESS && op->orr_modlist != NULL ) { Modifications *tmp; for ( ; op->orr_modlist != NULL; op->orr_modlist = tmp ) { tmp = op->orr_modlist->sml_next; ch_free( op->orr_modlist ); } } if ( new_rdn != NULL ) { ldap_rdnfree_x( new_rdn, op->o_tmpmemctx ); } if ( old_rdn != NULL ) { ldap_rdnfree_x( old_rdn, op->o_tmpmemctx ); } return rs->sr_err; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "A NULL pointer dereference was found in OpenLDAP server and was fixed in openldap 2.4.55, during a request for renaming RDNs. An unauthenticated attacker could remotely crash the slapd process by sending a specially crafted request, causing a Denial of Service.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2020-25692"}} -{"idx": 437076, "input": "static void update_attr(struct vc_data *vc) { vc->vc_attr = build_attr(vc, vc->vc_color, vc->vc_intensity, vc->vc_blink, vc->vc_underline, vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic); vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' '; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336779, "input": "read_yin_input_output(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options, struct unres_schema *unres) { struct ly_ctx *ctx = module->ctx; struct lyxml_elem *sub, *next, root; struct lys_node *node = NULL; struct lys_node *retval = NULL; struct lys_node_inout *inout; int r; int c_tpdf = 0, c_must = 0, c_ext = 0; /* init */ memset(&root, 0, sizeof root); inout = calloc(1, sizeof *inout); LY_CHECK_ERR_RETURN(!inout, LOGMEM(ctx), NULL); inout->prev = (struct lys_node *)inout; if (!strcmp(yin->name, \"input\")) { inout->nodetype = LYS_INPUT; inout->name = lydict_insert(ctx, \"input\", 0); } else if (!strcmp(yin->name, \"output\")) { inout->nodetype = LYS_OUTPUT; inout->name = lydict_insert(ctx, \"output\", 0); } else { LOGINT(ctx); free(inout); goto error; } retval = (struct lys_node *)inout; retval->module = module; LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name); /* insert the node into the schema tree */ if (lys_node_addchild(parent, lys_main_module(module), retval, options)) { goto error; } /* data statements */ LY_TREE_FOR_SAFE(yin->child, next, sub) { if (!sub->ns) { /* garbage */ lyxml_free(ctx, sub); } else if (strcmp(sub->ns->value, LY_NSYIN)) { /* extension */ YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", inout->nodetype == LYS_INPUT ? \"input\" : \"output\", error); c_ext++; } else if (!strcmp(sub->name, \"container\") || !strcmp(sub->name, \"leaf-list\") || !strcmp(sub->name, \"leaf\") || !strcmp(sub->name, \"list\") || !strcmp(sub->name, \"choice\") || !strcmp(sub->name, \"uses\") || !strcmp(sub->name, \"grouping\") || !strcmp(sub->name, \"anyxml\") || !strcmp(sub->name, \"anydata\")) { lyxml_unlink_elem(ctx, sub, 2); lyxml_add_child(ctx, &root, sub); /* array counters */ } else if (!strcmp(sub->name, \"typedef\")) { YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, inout->tpdf_size, \"typedefs\", inout->nodetype == LYS_INPUT ? \"input\" : \"output\", error); c_tpdf++; } else if ((module->version >= 2) && !strcmp(sub->name, \"must\")) { YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, inout->must_size, \"musts\", inout->nodetype == LYS_INPUT ? \"input\" : \"output\", error); c_must++; } else { LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name); goto error; } } if (!root.child) { LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, retval, \"schema-node\", strnodetype(retval->nodetype)); goto error; } /* middle part - process nodes with cardinality of 0..n except the data nodes */ if (c_tpdf) { inout->tpdf = calloc(c_tpdf, sizeof *inout->tpdf); LY_CHECK_ERR_GOTO(!inout->tpdf, LOGMEM(ctx), error); } if (c_must) { inout->must = calloc(c_must, sizeof *inout->must); LY_CHECK_ERR_GOTO(!inout->must, LOGMEM(ctx), error); } if (c_ext) { inout->ext = calloc(c_ext, sizeof *inout->ext); LY_CHECK_ERR_GOTO(!inout->ext, LOGMEM(ctx), error); } LY_TREE_FOR_SAFE(yin->child, next, sub) { if (strcmp(sub->ns->value, LY_NSYIN)) { /* extension */ r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres); if (r) { goto error; } } else if (!strcmp(sub->name, \"must\")) { r = fill_yin_must(module, sub, &inout->must[inout->must_size], unres); inout->must_size++; if (r) { goto error; } } else { /* typedef */ r = fill_yin_typedef(module, retval, sub, &inout->tpdf[inout->tpdf_size], unres); inout->tpdf_size++; if (r) { goto error; } } } lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size); /* last part - process data nodes */ options |= LYS_PARSE_OPT_CFG_IGNORE; LY_TREE_FOR_SAFE(root.child, next, sub) { if (!strcmp(sub->name, \"container\")) { node = read_yin_container(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"leaf-list\")) { node = read_yin_leaflist(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"leaf\")) { node = read_yin_leaf(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"list\")) { node = read_yin_list(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"choice\")) { node = read_yin_choice(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"uses\")) { node = read_yin_uses(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"grouping\")) { node = read_yin_grouping(module, retval, sub, options, unres); } else if (!strcmp(sub->name, \"anyxml\")) { node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres); } else if (!strcmp(sub->name, \"anydata\")) { node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres); } if (!node) { goto error; } lyxml_free(ctx, sub); } /* check XPath dependencies */ if (!(ctx->models.flags & LY_CTX_TRUSTED) && inout->must) { if (options & LYS_PARSE_OPT_INGRP) { if (lyxp_node_check_syntax(retval)) { goto error; } } else { if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) { goto error; } } } return retval; error: lys_node_free(ctx, retval, NULL, 0); while (root.child) { lyxml_free(ctx, root.child); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370011, "input": "ExpressionDateToParts::ExpressionDateToParts(ExpressionContext* const expCtx, intrusive_ptr date, intrusive_ptr timeZone, intrusive_ptr iso8601) : Expression(expCtx, {std::move(date), std::move(timeZone), std::move(iso8601)}), _date(_children[0]), _timeZone(_children[1]), _iso8601(_children[2]) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267302, "input": "static GF_Err gf_isom_set_ctts_v0(GF_ISOFile *file, GF_TrackBox *trak) { u32 i; s32 shift; GF_CompositionOffsetBox *ctts; GF_CompositionToDecodeBox *cslg; ctts = trak->Media->information->sampleTable->CompositionOffset; if (!trak->Media->information->sampleTable->CompositionToDecode) { shift = 0; for (i=0; inb_entries; i++) { if (-ctts->entries[i].decodingOffset > shift) shift = -ctts->entries[i].decodingOffset; } if (shift > 0) { for (i=0; inb_entries; i++) { ctts->entries[i].decodingOffset += shift; } } } else { cslg = trak->Media->information->sampleTable->CompositionToDecode; shift = cslg->compositionToDTSShift; for (i=0; inb_entries; i++) { ctts->entries[i].decodingOffset += shift; } gf_isom_box_del_parent(&trak->Media->information->sampleTable->child_boxes, (GF_Box *)cslg); trak->Media->information->sampleTable->CompositionToDecode = NULL; } if (shift>0) { //no edits, insert one if (! trak->editBox) { u64 dur = trak->Media->mediaHeader->duration; dur *= file->moov->mvhd->timeScale; dur /= trak->Media->mediaHeader->timeScale; gf_isom_set_edit(file, gf_list_find(file->moov->trackList, trak)+1, 0, dur, shift, GF_ISOM_EDIT_NORMAL); } else { //otherwise shift media times in all entries for (i=0; ieditBox->editList->entryList); i++) { GF_EdtsEntry *ent = (GF_EdtsEntry*)gf_list_get(trak->editBox->editList->entryList, i); //empty edit if (ent->mediaTime<0) continue; ent->mediaTime += shift; } SetTrackDuration(trak); } } ctts->version = 0; gf_isom_modify_alternate_brand(file, GF_ISOM_BRAND_ISO4, GF_FALSE); return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232639, "input": "static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn *insn, struct bpf_reg_state *dst_reg, struct bpf_reg_state src_reg) { struct bpf_reg_state *regs = cur_regs(env); u8 opcode = BPF_OP(insn->code); bool src_known, dst_known; s64 smin_val, smax_val; u64 umin_val, umax_val; u64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32; u32 dst = insn->dst_reg; int ret; if (insn_bitness == 32) { /* Relevant for 32-bit RSH: Information can propagate towards * LSB, so it isn't sufficient to only truncate the output to * 32 bits. */ coerce_reg_to_size(dst_reg, 4); coerce_reg_to_size(&src_reg, 4); } smin_val = src_reg.smin_value; smax_val = src_reg.smax_value; umin_val = src_reg.umin_value; umax_val = src_reg.umax_value; src_known = tnum_is_const(src_reg.var_off); dst_known = tnum_is_const(dst_reg->var_off); if ((src_known && (smin_val != smax_val || umin_val != umax_val)) || smin_val > smax_val || umin_val > umax_val) { /* Taint dst register if offset had invalid bounds derived from * e.g. dead branches. */ __mark_reg_unknown(env, dst_reg); return 0; } if (!src_known && opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND) { __mark_reg_unknown(env, dst_reg); return 0; } switch (opcode) { case BPF_ADD: ret = sanitize_val_alu(env, insn); if (ret < 0) { verbose(env, \"R%d tried to add from different pointers or scalars\\n\", dst); return ret; } scalar_min_max_add(dst_reg, &src_reg); break; case BPF_SUB: ret = sanitize_val_alu(env, insn); if (ret < 0) { verbose(env, \"R%d tried to sub from different pointers or scalars\\n\", dst); return ret; } scalar_min_max_sub(dst_reg, &src_reg); break; case BPF_MUL: scalar_min_max_mul(dst_reg, &src_reg); break; case BPF_AND: if (src_known && dst_known) { __mark_reg_known(dst_reg, dst_reg->var_off.value & src_reg.var_off.value); break; } scalar_min_max_and(dst_reg, &src_reg); break; case BPF_OR: if (src_known && dst_known) { __mark_reg_known(dst_reg, dst_reg->var_off.value | src_reg.var_off.value); break; } scalar_min_max_or(dst_reg, &src_reg); break; case BPF_LSH: if (umax_val >= insn_bitness) { /* Shifts greater than 31 or 63 are undefined. * This includes shifts by a negative number. */ mark_reg_unknown(env, regs, insn->dst_reg); break; } scalar_min_max_lsh(dst_reg, &src_reg); break; case BPF_RSH: if (umax_val >= insn_bitness) { /* Shifts greater than 31 or 63 are undefined. * This includes shifts by a negative number. */ mark_reg_unknown(env, regs, insn->dst_reg); break; } scalar_min_max_rsh(dst_reg, &src_reg); break; case BPF_ARSH: if (umax_val >= insn_bitness) { /* Shifts greater than 31 or 63 are undefined. * This includes shifts by a negative number. */ mark_reg_unknown(env, regs, insn->dst_reg); break; } scalar_min_max_arsh(dst_reg, &src_reg, insn_bitness); break; default: mark_reg_unknown(env, regs, insn->dst_reg); break; } if (BPF_CLASS(insn->code) != BPF_ALU64) { /* 32-bit ALU ops are (32,32)->32 */ coerce_reg_to_size(dst_reg, 4); } __update_reg_bounds(dst_reg); __reg_deduce_bounds(dst_reg); __reg_bound_offset(dst_reg); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 389336, "input": "static void rx_complete(struct usb_ep *ep, struct usb_request *req) { struct printer_dev *dev = ep->driver_data; int status = req->status; unsigned long flags; spin_lock_irqsave(&dev->lock, flags); list_del_init(&req->list); /* Remode from Active List */ switch (status) { /* normal completion */ case 0: if (req->actual > 0) { list_add_tail(&req->list, &dev->rx_buffers); DBG(dev, \"G_Printer : rx length %d\\n\", req->actual); } else { list_add(&req->list, &dev->rx_reqs); } break; /* software-driven interface shutdown */ case -ECONNRESET: /* unlink */ case -ESHUTDOWN: /* disconnect etc */ VDBG(dev, \"rx shutdown, code %d\\n\", status); list_add(&req->list, &dev->rx_reqs); break; /* for hardware automagic (such as pxa) */ case -ECONNABORTED: /* endpoint reset */ DBG(dev, \"rx %s reset\\n\", ep->name); list_add(&req->list, &dev->rx_reqs); break; /* data overrun */ case -EOVERFLOW: fallthrough; default: DBG(dev, \"rx status %d\\n\", status); list_add(&req->list, &dev->rx_reqs); break; } wake_up_interruptible(&dev->rx_wait); spin_unlock_irqrestore(&dev->lock, flags); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 299164, "input": "yaffsfs_jentry_walk(TSK_FS_INFO * /*info*/, int /*entry*/, TSK_FS_JENTRY_WALK_CB /*cb*/, void * /*fn*/) { tsk_error_reset(); tsk_error_set_errno(TSK_ERR_FS_UNSUPFUNC); tsk_error_set_errstr(\"Journal support for YAFFS is not implemented\"); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519155, "input": "static bool MR_primality_test(UnsignedBigInteger n, const Vector& tests) { // Written using Wikipedia: // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test ASSERT(!(n < 4)); auto predecessor = n.minus({ 1 }); auto d = predecessor; size_t r = 0; { auto div_result = d.divided_by(2); while (div_result.remainder == 0) { d = div_result.quotient; div_result = d.divided_by(2); ++r; } } if (r == 0) { // n - 1 is odd, so n was even. But there is only one even prime: return n == 2; } for (auto& a : tests) { // Technically: ASSERT(2 <= a && a <= n - 2) ASSERT(a < n); auto x = ModularPower(a, d, n); if (x == 1 || x == predecessor) continue; bool skip_this_witness = false; // r \u2212 1 iterations. for (size_t i = 0; i < r - 1; ++i) { x = ModularPower(x, 2, n); if (x == predecessor) { skip_this_witness = true; break; } } if (skip_this_witness) continue; return false; // \"composite\" } return true; // \"probably prime\" }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198942, "input": "parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, Idx nest, reg_errcode_t *err) { re_dfa_t *dfa = preg->buffer; bin_tree_t *tree, *branch = NULL; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; while (token->type == OP_ALT) { fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); if (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { branch = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && branch == NULL, 0)) { if (tree != NULL) postorder (tree, free_tree, NULL); return NULL; } } else branch = NULL; tree = create_tree (dfa, tree, branch, OP_ALT); if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; } } return tree; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "In the GNU C Library (aka glibc or libc6) before 2.28, parse_reg_exp in posix/regcomp.c misparses alternatives, which allows attackers to cause a denial of service (assertion failure and application exit) or trigger an incorrect result by attempting a regular-expression match.", "severity_level": "Medium", "cwe": "CWE-19", "cve": "CVE-2009-5155"}} -{"idx": 244716, "input": "static void init_header(struct archive_read* a) { a->archive.archive_format = ARCHIVE_FORMAT_RAR_V5; a->archive.archive_format_name = \"RAR5\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333102, "input": "repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned long long notfound) { unsigned char *dp; Repokey *key; unsigned int high, low; dp = find_key_data(data, solvid, keyname, &key); if (!dp) return notfound; switch (key->type) { case REPOKEY_TYPE_NUM: data_read_num64(dp, &low, &high); return (unsigned long long)high << 32 | low; case REPOKEY_TYPE_CONSTANT: return key->size; default: return notfound; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 305345, "input": "TPM_RESULT SWTPM_NVRAM_DeleteName(uint32_t tpm_number, const char *name, TPM_BOOL mustExist) { TPM_RESULT rc = 0; int irc; char filename[FILENAME_MAX]; /* rooted file name from name */ TPM_DEBUG(\" SWTPM_NVRAM_DeleteName: Name %s\\n\", name); /* map name to the rooted filename */ rc = SWTPM_NVRAM_GetFilenameForName(filename, sizeof(filename), tpm_number, name, false); if (rc == 0) { irc = remove(filename); if ((irc != 0) && /* if the remove failed */ (mustExist || /* if any error is a failure, or */ (errno != ENOENT))) { /* if error other than no such file */ logprintf(STDERR_FILENO, \"SWTPM_NVRAM_DeleteName: Error, (fatal) file \" \"remove failed, errno %d\\n\", errno); rc = TPM_FAIL; } } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244757, "input": "DEFINE_TEST(test_read_format_rar5_set_format) { struct archive *a; struct archive_entry *ae; const char reffile[] = \"test_read_format_rar5_stored.rar\"; extract_reference_file(reffile); assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_filter_all(a)); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_RAR_V5)); assertA(0 == archive_read_open_filename(a, reffile, 10240)); assertA(0 == archive_read_next_header(a, &ae)); EPILOGUE(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 335496, "input": "dnp3_al_obj_quality(tvbuff_t *tvb, int offset, guint8 al_ptflags, proto_tree *point_tree, proto_item *point_item, enum QUALITY_TYPE type) { proto_tree *quality_tree; proto_item *quality_item; int hf0 = 0, hf1 = 0, hf2 = 0, hf3 = 0, hf4 = 0, hf5 = 0, hf6 = 0, hf7 = 0; /* Common code */ proto_item_append_text(point_item, \" (Quality: \"); quality_tree = proto_tree_add_subtree(point_tree, tvb, offset, 1, ett_dnp3_al_obj_quality, &quality_item, \"Quality: \"); if (al_ptflags & AL_OBJ_BI_FLAG0) { dnp3_append_2item_text(point_item, quality_item, \"Online\"); } else { dnp3_append_2item_text(point_item, quality_item, \"Offline\"); } if (al_ptflags & AL_OBJ_BI_FLAG1) dnp3_append_2item_text(point_item, quality_item, \", Restart\"); if (al_ptflags & AL_OBJ_BI_FLAG2) dnp3_append_2item_text(point_item, quality_item, \", Comm Fail\"); if (al_ptflags & AL_OBJ_BI_FLAG3) dnp3_append_2item_text(point_item, quality_item, \", Remote Force\"); if (al_ptflags & AL_OBJ_BI_FLAG4) dnp3_append_2item_text(point_item, quality_item, \", Local Force\"); switch (type) { case BIN_IN: /* Binary Input Quality flags */ if (al_ptflags & AL_OBJ_BI_FLAG5) dnp3_append_2item_text(point_item, quality_item, \", Chatter Filter\"); hf0 = hf_dnp3_al_biq_b0; hf1 = hf_dnp3_al_biq_b1; hf2 = hf_dnp3_al_biq_b2; hf3 = hf_dnp3_al_biq_b3; hf4 = hf_dnp3_al_biq_b4; hf5 = hf_dnp3_al_biq_b5; hf6 = hf_dnp3_al_biq_b6; hf7 = hf_dnp3_al_biq_b7; break; case BIN_OUT: /* Binary Output Quality flags */ hf0 = hf_dnp3_al_boq_b0; hf1 = hf_dnp3_al_boq_b1; hf2 = hf_dnp3_al_boq_b2; hf3 = hf_dnp3_al_boq_b3; hf4 = hf_dnp3_al_boq_b4; hf5 = hf_dnp3_al_boq_b5; hf6 = hf_dnp3_al_boq_b6; hf7 = hf_dnp3_al_boq_b7; break; case ANA_IN: /* Analog Input Quality flags */ if (al_ptflags & AL_OBJ_AI_FLAG5) dnp3_append_2item_text(point_item, quality_item, \", Over-Range\"); if (al_ptflags & AL_OBJ_AI_FLAG6) dnp3_append_2item_text(point_item, quality_item, \", Reference Check\"); hf0 = hf_dnp3_al_aiq_b0; hf1 = hf_dnp3_al_aiq_b1; hf2 = hf_dnp3_al_aiq_b2; hf3 = hf_dnp3_al_aiq_b3; hf4 = hf_dnp3_al_aiq_b4; hf5 = hf_dnp3_al_aiq_b5; hf6 = hf_dnp3_al_aiq_b6; hf7 = hf_dnp3_al_aiq_b7; break; case ANA_OUT: /* Analog Output Quality flags */ hf0 = hf_dnp3_al_aoq_b0; hf1 = hf_dnp3_al_aoq_b1; hf2 = hf_dnp3_al_aoq_b2; hf3 = hf_dnp3_al_aoq_b3; hf4 = hf_dnp3_al_aoq_b4; hf5 = hf_dnp3_al_aoq_b5; hf6 = hf_dnp3_al_aoq_b6; hf7 = hf_dnp3_al_aoq_b7; break; case COUNTER: /* Counter Quality flags */ if (al_ptflags & AL_OBJ_CTR_FLAG5) dnp3_append_2item_text(point_item, quality_item, \", Roll-over\"); if (al_ptflags & AL_OBJ_CTR_FLAG6) dnp3_append_2item_text(point_item, quality_item, \", Discontinuity\"); hf0 = hf_dnp3_al_ctrq_b0; hf1 = hf_dnp3_al_ctrq_b1; hf2 = hf_dnp3_al_ctrq_b2; hf3 = hf_dnp3_al_ctrq_b3; hf4 = hf_dnp3_al_ctrq_b4; hf5 = hf_dnp3_al_ctrq_b5; hf6 = hf_dnp3_al_ctrq_b6; hf7 = hf_dnp3_al_ctrq_b7; break; } if (quality_tree != NULL) { proto_tree_add_item(quality_tree, hf7, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf6, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf5, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf4, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf3, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf2, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf1, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(quality_tree, hf0, tvb, offset, 1, ENC_LITTLE_ENDIAN); } proto_item_append_text(point_item, \")\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379978, "input": "/* * Returns the matching connection to a given sid / cid tuple */ static struct iscsi_cls_conn *iscsi_conn_lookup(uint32_t sid, uint32_t cid) { unsigned long flags; struct iscsi_cls_conn *conn; spin_lock_irqsave(&connlock, flags); list_for_each_entry(conn, &connlist, conn_list) { if ((conn->cid == cid) && (iscsi_conn_get_sid(conn) == sid)) { spin_unlock_irqrestore(&connlock, flags); return conn; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267175, "input": "Bool sg_roll_compare_entry(void *udta, void *entry) { s16 *roll_distance = (s16 *) udta; if (*roll_distance == ((GF_RollRecoveryEntry *)entry)->roll_distance) return GF_TRUE; return GF_FALSE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364963, "input": "static void tipc_lxc_xmit(struct net *peer_net, struct sk_buff_head *list) { struct tipc_msg *hdr = buf_msg(skb_peek(list)); struct sk_buff_head inputq; switch (msg_user(hdr)) { case TIPC_LOW_IMPORTANCE: case TIPC_MEDIUM_IMPORTANCE: case TIPC_HIGH_IMPORTANCE: case TIPC_CRITICAL_IMPORTANCE: if (msg_connected(hdr) || msg_named(hdr) || msg_direct(hdr)) { tipc_loopback_trace(peer_net, list); spin_lock_init(&list->lock); tipc_sk_rcv(peer_net, list); return; } if (msg_mcast(hdr)) { tipc_loopback_trace(peer_net, list); skb_queue_head_init(&inputq); tipc_sk_mcast_rcv(peer_net, list, &inputq); __skb_queue_purge(list); skb_queue_purge(&inputq); return; } return; case MSG_FRAGMENTER: if (tipc_msg_assemble(list)) { tipc_loopback_trace(peer_net, list); skb_queue_head_init(&inputq); tipc_sk_mcast_rcv(peer_net, list, &inputq); __skb_queue_purge(list); skb_queue_purge(&inputq); } return; case GROUP_PROTOCOL: case CONN_MANAGER: tipc_loopback_trace(peer_net, list); spin_lock_init(&list->lock); tipc_sk_rcv(peer_net, list); return; case LINK_PROTOCOL: case NAME_DISTRIBUTOR: case TUNNEL_PROTOCOL: case BCAST_PROTOCOL: return; default: return; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 367027, "input": "static void sm501_realize_sysbus(DeviceState *dev, Error **errp) { SM501SysBusState *s = SYSBUS_SM501(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); DeviceState *usb_dev; MemoryRegion *mr; sm501_init(&s->state, dev, s->vram_size); if (get_local_mem_size(&s->state) != s->vram_size) { error_setg(errp, \"Invalid VRAM size, nearest valid size is %\" PRIu32, get_local_mem_size(&s->state)); return; } sysbus_init_mmio(sbd, &s->state.local_mem_region); sysbus_init_mmio(sbd, &s->state.mmio_region); /* bridge to usb host emulation module */ usb_dev = qdev_create(NULL, \"sysbus-ohci\"); qdev_prop_set_uint32(usb_dev, \"num-ports\", 2); qdev_prop_set_uint64(usb_dev, \"dma-offset\", s->base); qdev_init_nofail(usb_dev); memory_region_add_subregion(&s->state.mmio_region, SM501_USB_HOST, sysbus_mmio_get_region(SYS_BUS_DEVICE(usb_dev), 0)); sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev)); /* bridge to serial emulation module */ qdev_init_nofail(DEVICE(&s->serial)); mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->serial), 0); memory_region_add_subregion(&s->state.mmio_region, SM501_UART0, mr); /* TODO : chain irq to IRL */ }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385215, "input": "dissect_tcpopt_wscale(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint8 val; guint32 shift; proto_item *wscale_pi, *shift_pi, *gen_pi; proto_tree *wscale_tree; proto_item *length_item; int offset = 0; struct tcp_analysis *tcpd; tcpd=get_tcp_conversation_data(NULL,pinfo); wscale_pi = proto_tree_add_item(tree, proto_tcp_option_wscale, tvb, offset, -1, ENC_NA); wscale_tree = proto_item_add_subtree(wscale_pi, ett_tcp_option_wscale); proto_tree_add_item(wscale_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; length_item = proto_tree_add_item(wscale_tree, hf_tcp_option_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_WINDOW)) return tvb_captured_length(tvb); shift_pi = proto_tree_add_item_ret_uint(wscale_tree, hf_tcp_option_wscale_shift, tvb, offset, 1, ENC_BIG_ENDIAN, &shift); if (shift > 14) { /* RFC 1323: \"If a Window Scale option is received with a shift.cnt * value exceeding 14, the TCP should log the error but use 14 instead * of the specified value.\" */ shift = 14; expert_add_info(pinfo, shift_pi, &ei_tcp_option_wscale_shift_invalid); } gen_pi = proto_tree_add_uint(wscale_tree, hf_tcp_option_wscale_multiplier, tvb, offset, 1, 1 << shift); PROTO_ITEM_SET_GENERATED(gen_pi); val = tvb_get_guint8(tvb, offset); proto_item_append_text(wscale_pi, \": %u (multiply by %u)\", val, 1 << shift); tcp_info_append_uint(pinfo, \"WS\", 1 << shift); if(!pinfo->fd->visited) { pdu_store_window_scale_option(shift, tcpd); } return tvb_captured_length(tvb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 335109, "input": "static inline void timerqueue_init_head(struct timerqueue_head *head) { head->rb_root = RB_ROOT_CACHED; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366005, "input": "lyxml_dup(struct ly_ctx *ctx, struct lyxml_elem *root) { FUN_IN; return lyxml_dup_elem(ctx, root, NULL, 1, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437614, "input": "static int invlpg_interception(struct vcpu_svm *svm) { if (!static_cpu_has(X86_FEATURE_DECODEASSISTS)) return emulate_instruction(&svm->vcpu, 0) == EMULATE_DONE; kvm_mmu_invlpg(&svm->vcpu, svm->vmcb->control.exit_info_1); skip_emulated_instruction(&svm->vcpu); return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 447718, "input": "static void oidc_revoke_tokens(request_rec *r, oidc_cfg *c, oidc_session_t *session) { char *response = NULL; char *basic_auth = NULL; char *bearer_auth = NULL; apr_table_t *params = NULL; const char *token = NULL; oidc_provider_t *provider = NULL; oidc_debug(r, \"enter\"); if (oidc_get_provider_from_session(r, c, session, &provider) == FALSE) goto out; oidc_debug(r, \"revocation_endpoint=%s\", provider->revocation_endpoint_url ? provider->revocation_endpoint_url : \"(null)\"); if (provider->revocation_endpoint_url == NULL) goto out; params = apr_table_make(r->pool, 4); // add the token endpoint authentication credentials to the revocation endpoint call... if (oidc_proto_token_endpoint_auth(r, c, provider->token_endpoint_auth, provider->client_id, provider->client_secret, provider->client_signing_keys, provider->token_endpoint_url, params, NULL, &basic_auth, &bearer_auth) == FALSE) goto out; // TODO: use oauth.ssl_validate_server ... token = oidc_session_get_refresh_token(r, session); if (token != NULL) { apr_table_addn(params, \"token_type_hint\", \"refresh_token\"); apr_table_addn(params, \"token\", token); if (oidc_util_http_post_form(r, provider->revocation_endpoint_url, params, basic_auth, bearer_auth, c->oauth.ssl_validate_server, &response, c->http_timeout_long, c->outgoing_proxy, oidc_dir_cfg_pass_cookies(r), NULL, NULL) == FALSE) { oidc_warn(r, \"revoking refresh token failed\"); } apr_table_clear(params); } token = oidc_session_get_access_token(r, session); if (token != NULL) { apr_table_addn(params, \"token_type_hint\", \"access_token\"); apr_table_addn(params, \"token\", token); if (oidc_util_http_post_form(r, provider->revocation_endpoint_url, params, basic_auth, bearer_auth, c->oauth.ssl_validate_server, &response, c->http_timeout_long, c->outgoing_proxy, oidc_dir_cfg_pass_cookies(r), NULL, NULL) == FALSE) { oidc_warn(r, \"revoking access token failed\"); } } out: oidc_debug(r, \"leave\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338793, "input": "void cpu_bugs_smt_update(void) { mutex_lock(&spec_ctrl_mutex); switch (spectre_v2_user_stibp) { case SPECTRE_V2_USER_NONE: break; case SPECTRE_V2_USER_STRICT: case SPECTRE_V2_USER_STRICT_PREFERRED: update_stibp_strict(); break; case SPECTRE_V2_USER_PRCTL: case SPECTRE_V2_USER_SECCOMP: update_indir_branch_cond(); break; } switch (mds_mitigation) { case MDS_MITIGATION_FULL: case MDS_MITIGATION_VMWERV: if (sched_smt_active() && !boot_cpu_has(X86_BUG_MSBDS_ONLY)) pr_warn_once(MDS_MSG_SMT); update_mds_branch_idle(); break; case MDS_MITIGATION_OFF: break; } switch (taa_mitigation) { case TAA_MITIGATION_VERW: case TAA_MITIGATION_UCODE_NEEDED: if (sched_smt_active()) pr_warn_once(TAA_MSG_SMT); break; case TAA_MITIGATION_TSX_DISABLED: case TAA_MITIGATION_OFF: break; } mutex_unlock(&spec_ctrl_mutex); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410381, "input": "openscript( char_u *name, int directly) // when TRUE execute directly { if (curscript + 1 == NSCRIPT) { emsg(_(e_scripts_nested_too_deep)); return; } // Disallow sourcing a file in the sandbox, the commands would be executed // later, possibly outside of the sandbox. if (check_secure()) return; #ifdef FEAT_EVAL if (ignore_script) // Not reading from script, also don't open one. Warning message? return; #endif if (scriptin[curscript] != NULL) // already reading script ++curscript; // use NameBuff for expanded name expand_env(name, NameBuff, MAXPATHL); if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL) { semsg(_(e_cant_open_file_str), name); if (curscript) --curscript; return; } if (save_typebuf() == FAIL) return; /* * Execute the commands from the file right now when using \":source!\" * after \":global\" or \":argdo\" or in a loop. Also when another command * follows. This means the display won't be updated. Don't do this * always, \"make test\" would fail. */ if (directly) { oparg_T oa; int oldcurscript; int save_State = State; int save_restart_edit = restart_edit; int save_insertmode = p_im; int save_finish_op = finish_op; int save_msg_scroll = msg_scroll; State = NORMAL; msg_scroll = FALSE; // no msg scrolling in Normal mode restart_edit = 0; // don't go to Insert mode p_im = FALSE; // don't use 'insertmode' clear_oparg(&oa); finish_op = FALSE; oldcurscript = curscript; do { update_topline_cursor(); // update cursor position and topline normal_cmd(&oa, FALSE); // execute one command (void)vpeekc(); // check for end of file } while (scriptin[oldcurscript] != NULL); State = save_State; msg_scroll = save_msg_scroll; restart_edit = save_restart_edit; p_im = save_insertmode; finish_op = save_finish_op; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508977, "input": "Sql_mode_dependency value_depends_on_sql_mode() const { return Sql_mode_dependency(0, field->value_depends_on_sql_mode()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208640, "input": "mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, int len, bool more) { struct page *page = virt_to_head_page(data); int offset = data - page_address(page); struct sk_buff *skb = q->rx_head; offset += q->buf_offset; skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset, len, q->buf_size); if (more) return; q->rx_head = NULL; dev->drv->rx_skb(dev, q - dev->q_rx, skb); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "An array overflow was discovered in mt76_add_fragment in drivers/net/wireless/mediatek/mt76/dma.c in the Linux kernel before 5.5.10, aka CID-b102f0c522cf. An oversized packet with too many rx fragments can corrupt memory of adjacent pages.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-12465"}} -{"idx": 379414, "input": "restore_stdin (s) int s; { dup2 (s, 0); close (s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 391456, "input": "void CLASS parse_fuji (int offset) { unsigned entries, tag, len, save, c; fseek (ifp, offset, SEEK_SET); entries = get4(); if (entries > 255) return; while (entries--) { tag = get2(); len = get2(); save = ftell(ifp); if (tag == 0x100) { raw_height = get2(); raw_width = get2(); } else if (tag == 0x121) { height = get2(); if ((width = get2()) == 4284) width += 3; } else if (tag == 0x130) { fuji_layout = fgetc(ifp) >> 7; fuji_width = !(fgetc(ifp) & 8); } else if (tag == 0x131) { filters = 9; FORC(36) { int q = fgetc(ifp); xtrans_abs[0][35 - c] = MAX(0,MIN(q,2)); /* & 3;*/ } } else if (tag == 0x2ff0) { FORC4 cam_mul[c ^ 1] = get2(); } // IB start #ifdef LIBRAW_LIBRARY_BUILD else if (tag == 0x9650) { short a = (short)get2(); float b =fMAX(1.0f, get2()); imgdata.makernotes.fuji.FujiExpoMidPointShift = a / b; } else if (tag == 0x2100) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_Daylight][c ^ 1] = get2(); } else if (tag == 0x2200) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_Cloudy][c ^ 1] = get2(); } else if (tag == 0x2300) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_FL_D][c ^ 1] = get2(); } else if (tag == 0x2301) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_FL_N][c ^ 1] = get2(); } else if (tag == 0x2302) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_FL_WW][c ^ 1] = get2(); } else if (tag == 0x2310) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_FL_L][c ^ 1] = get2(); } else if (tag == 0x2400) { FORC4 imgdata.color.WB_Coeffs[LIBRAW_WBI_Tungsten][c ^ 1] = get2(); } #endif // IB end else if (tag == 0xc000) { c = order; order = 0x4949; if ((tag = get4()) > 10000) tag = get4(); if (tag > 10000) tag = get4(); width = tag; height = get4(); #ifdef LIBRAW_LIBRARY_BUILD libraw_internal_data.unpacker_data.posRAFData = save; libraw_internal_data.unpacker_data.lenRAFData = (len>>1); #endif order = c; } fseek (ifp, save+len, SEEK_SET); } height <<= fuji_layout; width >>= fuji_layout; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219672, "input": "void endFrameEx(const TypedValue* /*retval*/, const char* /*given_symbol*/) override { char symbol[512]; HierarchicalProfilerFrame *frame = dynamic_cast(m_stack); frame->getStack(2, symbol, sizeof(symbol)); CountMap &counts = m_stats[symbol]; counts.count++; counts.wall_time += cpuCycles() - frame->m_tsc_start; if (m_flags & TrackCPU) { counts.cpu += cpuTime(m_MHz) - frame->m_vtsc_start; } if (m_flags & TrackMemory) { auto const stats = tl_heap->getStats(); int64_t mu_end = stats.usage(); int64_t pmu_end = stats.peakUsage; counts.memory += mu_end - frame->m_mu_start; counts.peak_memory += pmu_end - frame->m_pmu_start; } else if (m_flags & TrackMalloc) { counts.memory += get_allocs() - frame->m_mu_start; counts.peak_memory += get_frees() - frame->m_pmu_start; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268906, "input": "R_API int r_sys_run_rop(const ut8 *buf, int len) { #if USE_FORK int st; #endif // TODO: define R_SYS_ALIGN_FORWARD in r_util.h ut8 *bufptr = malloc (len); if (!bufptr) { eprintf (\"r_sys_run_rop: Cannot allocate buffer\\n\"); return false; } if (!buf) { eprintf (\"r_sys_run_rop: Cannot execute empty rop chain\\n\"); free (bufptr); return false; } memcpy (bufptr, buf, len); #if USE_FORK #if __UNIX__ pid_t pid = r_sys_fork (); #else pid = -1; #endif if (pid < 0) { R_SYS_ASM_START_ROP (); } else { R_SYS_ASM_START_ROP (); exit (0); return 0; } st = 0; if (waitpid (pid, &st, 0) == -1) { eprintf (\"r_sys_run_rop: waitpid failed\\n\"); free (bufptr); return -1; } if (WIFSIGNALED (st)) { int num = WTERMSIG (st); eprintf (\"Got signal %d\\n\", num); ret = num; } else { ret = WEXITSTATUS (st); } #else R_SYS_ASM_START_ROP (); #endif free (bufptr); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 520937, "input": "Jsi_StructSpec *Jsi_CDataStruct(Jsi_Interp *interp, const char *name) { return (Jsi_StructSpec *)Jsi_HashGet(interp->StructHash, name, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 213025, "input": "ciphertext_to_compressed (gnutls_session_t session, gnutls_datum_t *ciphertext, uint8_t * compress_data, int compress_size, uint8_t type, record_parameters_st * params, uint64* sequence) { uint8_t tag[MAX_HASH_SIZE]; uint8_t pad; int length, length_to_decrypt; uint16_t blocksize; int ret, i, pad_failed = 0; uint8_t preamble[MAX_PREAMBLE_SIZE]; unsigned int preamble_size; unsigned int ver = gnutls_protocol_get_version (session); unsigned int tag_size = _gnutls_auth_cipher_tag_len (¶ms->read.cipher_state); unsigned int explicit_iv = _gnutls_version_has_explicit_iv (session->security_parameters.version); blocksize = gnutls_cipher_get_block_size (params->cipher_algorithm); /* actual decryption (inplace) */ switch (_gnutls_cipher_is_block (params->cipher_algorithm)) { case CIPHER_STREAM: /* The way AEAD ciphers are defined in RFC5246, it allows * only stream ciphers. */ if (explicit_iv && _gnutls_auth_cipher_is_aead(¶ms->read.cipher_state)) { uint8_t nonce[blocksize]; /* Values in AEAD are pretty fixed in TLS 1.2 for 128-bit block */ if (params->read.IV.data == NULL || params->read.IV.size != 4) return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); if (ciphertext->size < tag_size+AEAD_EXPLICIT_DATA_SIZE) return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); memcpy(nonce, params->read.IV.data, AEAD_IMPLICIT_DATA_SIZE); memcpy(&nonce[AEAD_IMPLICIT_DATA_SIZE], ciphertext->data, AEAD_EXPLICIT_DATA_SIZE); _gnutls_auth_cipher_setiv(¶ms->read.cipher_state, nonce, AEAD_EXPLICIT_DATA_SIZE+AEAD_IMPLICIT_DATA_SIZE); ciphertext->data += AEAD_EXPLICIT_DATA_SIZE; ciphertext->size -= AEAD_EXPLICIT_DATA_SIZE; length_to_decrypt = ciphertext->size - tag_size; } else { if (ciphertext->size < tag_size) return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); length_to_decrypt = ciphertext->size; } length = ciphertext->size - tag_size; /* Pass the type, version, length and compressed through * MAC. */ preamble_size = make_preamble (UINT64DATA(*sequence), type, length, ver, preamble); ret = _gnutls_auth_cipher_add_auth (¶ms->read.cipher_state, preamble, preamble_size); if (ret < 0) return gnutls_assert_val(ret); if ((ret = _gnutls_auth_cipher_decrypt2 (¶ms->read.cipher_state, ciphertext->data, length_to_decrypt, ciphertext->data, ciphertext->size)) < 0) return gnutls_assert_val(ret); break; case CIPHER_BLOCK: if (ciphertext->size < MAX(blocksize, tag_size) || (ciphertext->size % blocksize != 0)) return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); /* ignore the IV in TLS 1.1+ */ if (explicit_iv) { _gnutls_auth_cipher_setiv(¶ms->read.cipher_state, ciphertext->data, blocksize); ciphertext->size -= blocksize; ciphertext->data += blocksize; if (ciphertext->size == 0) { gnutls_assert (); return GNUTLS_E_DECRYPTION_FAILED; } } /* we don't use the auth_cipher interface here, since * TLS with block ciphers is impossible to be used under such * an API. (the length of plaintext is required to calculate * auth_data, but it is not available before decryption). */ if ((ret = _gnutls_cipher_decrypt (¶ms->read.cipher_state.cipher, ciphertext->data, ciphertext->size)) < 0) return gnutls_assert_val(ret); pad = ciphertext->data[ciphertext->size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext->size - tag_size) { gnutls_assert (); _gnutls_record_log (\"REC[%p]: Short record length %d > %d - %d (under attack?)\\n\", session, pad, ciphertext->size, tag_size); /* We do not fail here. We check below for the * the pad_failed. If zero means success. */ pad_failed = GNUTLS_E_DECRYPTION_FAILED; pad %= blocksize; } length = ciphertext->size - tag_size - pad; /* Check the pading bytes (TLS 1.x) */ if (ver != GNUTLS_SSL3) for (i = 2; i < pad; i++) { if (ciphertext->data[ciphertext->size - i] != ciphertext->data[ciphertext->size - 1]) pad_failed = GNUTLS_E_DECRYPTION_FAILED; } if (length < 0) { /* Setting a proper length to prevent timing differences in * processing of records with invalid encryption. */ length = ciphertext->size - tag_size; } /* Pass the type, version, length and compressed through * MAC. */ preamble_size = make_preamble (UINT64DATA(*sequence), type, length, ver, preamble); ret = _gnutls_auth_cipher_add_auth (¶ms->read.cipher_state, preamble, preamble_size); if (ret < 0) return gnutls_assert_val(ret); ret = _gnutls_auth_cipher_add_auth (¶ms->read.cipher_state, ciphertext->data, length); if (ret < 0) return gnutls_assert_val(ret); break; default: return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); } ret = _gnutls_auth_cipher_tag(¶ms->read.cipher_state, tag, tag_size); if (ret < 0) return gnutls_assert_val(ret); /* This one was introduced to avoid a timing attack against the TLS * 1.0 protocol. */ /* HMAC was not the same. */ if (memcmp (tag, &ciphertext->data[length], tag_size) != 0 || pad_failed != 0) return gnutls_assert_val(GNUTLS_E_DECRYPTION_FAILED); /* copy the decrypted stuff to compress_data. */ if (compress_size < length) return gnutls_assert_val(GNUTLS_E_DECOMPRESSION_FAILED); if (compress_data != ciphertext->data) memcpy (compress_data, ciphertext->data, length); return length; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "gnutls_cipher.c in libgnutls in GnuTLS before 2.12.17 and 3.x before 3.0.15 does not properly handle data encrypted with a block cipher, which allows remote attackers to cause a denial of service (heap memory corruption and application crash) via a crafted record, as demonstrated by a crafted GenericBlockCipher structure.", "severity_level": "Medium", "cwe": "CWE-310", "cve": "CVE-2012-1573"}} -{"idx": 381938, "input": "static char* oidc_make_sid_iss_unique(request_rec *r, const char *sid, const char *issuer) { return apr_psprintf(r->pool, \"%s@%s\", sid, issuer); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212373, "input": "Pl_ASCIIHexDecoder::flush() { if (this->pos == 0) { QTC::TC(\"libtests\", \"Pl_ASCIIHexDecoder no-op flush\"); return; } int b[2]; for (int i = 0; i < 2; ++i) { if (this->inbuf[i] >= 'A') { b[i] = this->inbuf[i] - 'A' + 10; } else { b[i] = this->inbuf[i] - '0'; } } unsigned char ch = static_cast((b[0] << 4) + b[1]); QTC::TC(\"libtests\", \"Pl_ASCIIHexDecoder partial flush\", (this->pos == 2) ? 0 : 1); getNext()->write(&ch, 1); this->pos = 0; this->inbuf[0] = '0'; this->inbuf[1] = '0'; this->inbuf[2] = '\\0'; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "QPDF 9.x through 9.1.1 and 10.x through 10.0.4 has a heap-based buffer overflow in Pl_ASCII85Decoder::write (called from Pl_AES_PDF::flush and Pl_AES_PDF::finish) when a certain downstream write fails.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-36978"}} -{"idx": 268912, "input": "R_API char* r_str_replace_thunked(char *str, char *clean, int *thunk, int clen, const char *key, const char *val, int g) { int i, klen, vlen, slen, delta = 0, bias; char *newstr, *scnd, *p = clean, *str_p; if (!str || !key || !val || !clean || !thunk) { return NULL; } klen = strlen (key); vlen = strlen (val); if (klen == vlen && !strcmp (key, val)) { return str; } slen = strlen (str) + 1; for (i = 0; i < clen; ) { p = (char *)r_mem_mem ( (const ut8*)clean + i, clen - i, (const ut8*)key, klen); if (!p) { break; } i = (int)(size_t)(p - clean); /* as the original string changes size during replacement * we need delta to keep track of it*/ str_p = str + thunk[i] + delta; int newo = thunk[i + klen] - thunk[i]; r_str_ansi_filter (str_p, NULL, NULL, newo); scnd = strdup (str_p + newo); bias = vlen - newo; slen += bias; // HACK: this 32 avoids overwrites wtf newstr = realloc (str, slen + klen); if (!newstr) { eprintf (\"realloc fail\\n\"); R_FREE (str); free (scnd); break; } str = newstr; str_p = str + thunk[i] + delta; memcpy (str_p, val, vlen); memcpy (str_p + vlen, scnd, strlen (scnd) + 1); i += klen; delta += bias; free (scnd); if (!g) { break; } } return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318156, "input": "static rpmRC hdrblobVerifyLengths(rpmTagVal regionTag, uint32_t il, uint32_t dl, char **emsg) { uint32_t il_max = HEADER_TAGS_MAX; uint32_t dl_max = HEADER_DATA_MAX; if (regionTag == RPMTAG_HEADERSIGNATURES) { il_max = 32; dl_max = 64 * 1024 * 1024; } if (hdrchkRange(il_max, il)) { rasprintf(emsg, _(\"hdr tags: BAD, no. of tags(%\" PRIu32 \") out of range\"), il); return RPMRC_FAIL; } if (hdrchkRange(dl_max, dl)) { rasprintf(emsg, _(\"hdr data: BAD, no. of bytes(%\" PRIu32 \") out of range\"), dl); return RPMRC_FAIL; } return RPMRC_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346315, "input": "static void hostdev_link(USBHostDevice *dev) { dev->next = hostdev_list; hostdev_list = dev; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398116, "input": "static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) { struct net *net = sock_net(sk); struct sctp_sock *sp = sctp_sk(sk); struct sctp_endpoint *ep = sp->ep; struct sctp_bind_addr *bp = &ep->base.bind_addr; struct sctp_af *af; unsigned short snum; int ret = 0; /* Common sockaddr verification. */ af = sctp_sockaddr_af(sp, addr, len); if (!af) { pr_debug(\"%s: sk:%p, newaddr:%p, len:%d EINVAL\\n\", __func__, sk, addr, len); return -EINVAL; } snum = ntohs(addr->v4.sin_port); pr_debug(\"%s: sk:%p, new addr:%pISc, port:%d, new port:%d, len:%d\\n\", __func__, sk, &addr->sa, bp->port, snum, len); /* PF specific bind() address verification. */ if (!sp->pf->bind_verify(sp, addr)) return -EADDRNOTAVAIL; /* We must either be unbound, or bind to the same port. * It's OK to allow 0 ports if we are already bound. * We'll just inhert an already bound port in this case */ if (bp->port) { if (!snum) snum = bp->port; else if (snum != bp->port) { pr_debug(\"%s: new port %d doesn't match existing port \" \"%d\\n\", __func__, snum, bp->port); return -EINVAL; } } if (snum && inet_port_requires_bind_service(net, snum) && !ns_capable(net->user_ns, CAP_NET_BIND_SERVICE)) return -EACCES; /* See if the address matches any of the addresses we may have * already bound before checking against other endpoints. */ if (sctp_bind_addr_match(bp, addr, sp)) return -EINVAL; /* Make sure we are allowed to bind here. * The function sctp_get_port_local() does duplicate address * detection. */ addr->v4.sin_port = htons(snum); if (sctp_get_port_local(sk, addr)) return -EADDRINUSE; /* Refresh ephemeral port. */ if (!bp->port) bp->port = inet_sk(sk)->inet_num; /* Add the address to the bind address list. * Use GFP_ATOMIC since BHs will be disabled. */ ret = sctp_add_bind_addr(bp, addr, af->sockaddr_len, SCTP_ADDR_SRC, GFP_ATOMIC); if (ret) { sctp_put_port(sk); return ret; } /* Copy back into socket for getsockname() use. */ inet_sk(sk)->inet_sport = htons(inet_sk(sk)->inet_num); sp->pf->to_sk_saddr(addr, sk); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385210, "input": "tcp_flags_to_str(wmem_allocator_t *scope, const struct tcpheader *tcph) { static const char flags[][4] = { \"FIN\", \"SYN\", \"RST\", \"PSH\", \"ACK\", \"URG\", \"ECN\", \"CWR\", \"NS\" }; const int maxlength = 64; /* upper bounds, max 53B: 8 * 3 + 2 + strlen(\"Reserved\") + 9 * 2 + 1 */ char *pbuf; const char *buf; int i; buf = pbuf = (char *) wmem_alloc(scope, maxlength); *pbuf = '\\0'; for (i = 0; i < 9; i++) { if (tcph->th_flags & (1 << i)) { if (buf[0]) pbuf = g_stpcpy(pbuf, \", \"); pbuf = g_stpcpy(pbuf, flags[i]); } } if (tcph->th_flags & TH_RES) { if (buf[0]) pbuf = g_stpcpy(pbuf, \", \"); g_stpcpy(pbuf, \"Reserved\"); } if (buf[0] == '\\0') buf = \"\"; return buf; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 496466, "input": "print_line_middle (const char *beg, const char *lim, const char *line_color, const char *match_color) { size_t match_size; size_t match_offset; const char *cur = beg; const char *mid = NULL; while (cur < lim && ((match_offset = execute (beg, lim - beg, &match_size, beg + (cur - beg))) != (size_t) -1)) { char const *b = beg + match_offset; /* Avoid matching the empty line at the end of the buffer. */ if (b == lim) break; /* Avoid hanging on grep --color \"\" foo */ if (match_size == 0) { /* Make minimal progress; there may be further non-empty matches. */ /* XXX - Could really advance by one whole multi-octet character. */ match_size = 1; if (!mid) mid = cur; } else { /* This function is called on a matching line only, but is it selected or rejected/context? */ if (only_matching) print_line_head (b, lim, (out_invert ? SEP_CHAR_REJECTED : SEP_CHAR_SELECTED)); else { pr_sgr_start (line_color); if (mid) { cur = mid; mid = NULL; } fwrite (cur, sizeof (char), b - cur, stdout); } pr_sgr_start_if (match_color); fwrite (b, sizeof (char), match_size, stdout); pr_sgr_end_if (match_color); if (only_matching) fputs (\"\\n\", stdout); } cur = b + match_size; } if (only_matching) cur = lim; else if (mid) cur = mid; return cur; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 356725, "input": "serialize_list(const char *varname, struct list_members *members) { struct list_member *lm, *next; size_t len, result_size; char *result; debug_decl(serialize_list, SUDOERS_DEBUG_PLUGIN); result_size = strlen(varname) + 1; SLIST_FOREACH(lm, members, entries) { result_size += strlen(lm->value) + 1; } if ((result = malloc(result_size)) == NULL) goto bad; /* No need to check len for overflow here. */ len = strlcpy(result, varname, result_size); result[len++] = '='; result[len] = '\\0'; SLIST_FOREACH_SAFE(lm, members, entries, next) { len = strlcat(result, lm->value, result_size); if (len + (next != NULL) >= result_size) { sudo_warnx(U_(\"internal error, %s overflow\"), __func__); goto bad; } if (next != NULL) { result[len++] = ','; result[len] = '\\0'; } } debug_return_str(result); bad: free(result); debug_return_str(NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409938, "input": "static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, struct tcp_sacktag_state *state, u32 start_seq, u32 end_seq, int dup_sack) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *prev; int mss; int pcount = 0; int len; int in_sack; if (!sk_can_gso(sk)) goto fallback; /* Normally R but no L won't result in plain S */ if (!dup_sack && (TCP_SKB_CB(skb)->sacked & (TCPCB_LOST|TCPCB_SACKED_RETRANS)) == TCPCB_SACKED_RETRANS) goto fallback; if (!skb_can_shift(skb)) goto fallback; /* This frame is about to be dropped (was ACKed). */ if (!after(TCP_SKB_CB(skb)->end_seq, tp->snd_una)) goto fallback; /* Can only happen with delayed DSACK + discard craziness */ if (unlikely(skb == tcp_write_queue_head(sk))) goto fallback; prev = tcp_write_queue_prev(sk, skb); if ((TCP_SKB_CB(prev)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) goto fallback; in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq) && !before(end_seq, TCP_SKB_CB(skb)->end_seq); if (in_sack) { len = skb->len; pcount = tcp_skb_pcount(skb); mss = tcp_skb_seglen(skb); /* TODO: Fix DSACKs to not fragment already SACKed and we can * drop this restriction as unnecessary */ if (mss != tcp_skb_seglen(prev)) goto fallback; } else { if (!after(TCP_SKB_CB(skb)->end_seq, start_seq)) goto noop; /* CHECKME: This is non-MSS split case only?, this will * cause skipped skbs due to advancing loop btw, original * has that feature too */ if (tcp_skb_pcount(skb) <= 1) goto noop; in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq); if (!in_sack) { /* TODO: head merge to next could be attempted here * if (!after(TCP_SKB_CB(skb)->end_seq, end_seq)), * though it might not be worth of the additional hassle * * ...we can probably just fallback to what was done * previously. We could try merging non-SACKed ones * as well but it probably isn't going to buy off * because later SACKs might again split them, and * it would make skb timestamp tracking considerably * harder problem. */ goto fallback; } len = end_seq - TCP_SKB_CB(skb)->seq; BUG_ON(len < 0); BUG_ON(len > skb->len); /* MSS boundaries should be honoured or else pcount will * severely break even though it makes things bit trickier. * Optimize common case to avoid most of the divides */ mss = tcp_skb_mss(skb); /* TODO: Fix DSACKs to not fragment already SACKed and we can * drop this restriction as unnecessary */ if (mss != tcp_skb_seglen(prev)) goto fallback; if (len == mss) { pcount = 1; } else if (len < mss) { goto noop; } else { pcount = len / mss; len = pcount * mss; } } if (!skb_shift(prev, skb, len)) goto fallback; if (!tcp_shifted_skb(sk, skb, state, pcount, len, mss, dup_sack)) goto out; /* Hole filled allows collapsing with the next as well, this is very * useful when hole on every nth skb pattern happens */ if (prev == tcp_write_queue_tail(sk)) goto out; skb = tcp_write_queue_next(sk, prev); if (!skb_can_shift(skb) || (skb == tcp_send_head(sk)) || ((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) || (mss != tcp_skb_seglen(skb))) goto out; len = skb->len; if (skb_shift(prev, skb, len)) { pcount += tcp_skb_pcount(skb); tcp_shifted_skb(sk, skb, state, tcp_skb_pcount(skb), len, mss, 0); } out: state->fack_count += pcount; return prev; noop: return skb; fallback: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SACKSHIFTFALLBACK); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206616, "input": "start_input_gif(j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { gif_source_ptr source = (gif_source_ptr)sinfo; U_CHAR hdrbuf[10]; /* workspace for reading control blocks */ unsigned int width, height; /* image dimensions */ int colormaplen, aspectRatio; int c; /* Read and verify GIF Header */ if (!ReadOK(source->pub.input_file, hdrbuf, 6)) ERREXIT(cinfo, JERR_GIF_NOT); if (hdrbuf[0] != 'G' || hdrbuf[1] != 'I' || hdrbuf[2] != 'F') ERREXIT(cinfo, JERR_GIF_NOT); /* Check for expected version numbers. * If unknown version, give warning and try to process anyway; * this is per recommendation in GIF89a standard. */ if ((hdrbuf[3] != '8' || hdrbuf[4] != '7' || hdrbuf[5] != 'a') && (hdrbuf[3] != '8' || hdrbuf[4] != '9' || hdrbuf[5] != 'a')) TRACEMS3(cinfo, 1, JTRC_GIF_BADVERSION, hdrbuf[3], hdrbuf[4], hdrbuf[5]); /* Read and decipher Logical Screen Descriptor */ if (!ReadOK(source->pub.input_file, hdrbuf, 7)) ERREXIT(cinfo, JERR_INPUT_EOF); width = LM_to_uint(hdrbuf, 0); height = LM_to_uint(hdrbuf, 2); /* we ignore the color resolution, sort flag, and background color index */ aspectRatio = UCH(hdrbuf[6]); if (aspectRatio != 0 && aspectRatio != 49) TRACEMS(cinfo, 1, JTRC_GIF_NONSQUARE); /* Allocate space to store the colormap */ source->colormap = (*cinfo->mem->alloc_sarray) ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)MAXCOLORMAPSIZE, (JDIMENSION)NUMCOLORS); colormaplen = 0; /* indicate initialization */ /* Read global colormap if header indicates it is present */ if (BitSet(hdrbuf[4], COLORMAPFLAG)) { colormaplen = 2 << (hdrbuf[4] & 0x07); ReadColorMap(source, colormaplen, source->colormap); } /* Scan until we reach start of desired image. * We don't currently support skipping images, but could add it easily. */ for (;;) { c = ReadByte(source); if (c == ';') /* GIF terminator?? */ ERREXIT(cinfo, JERR_GIF_IMAGENOTFOUND); if (c == '!') { /* Extension */ DoExtension(source); continue; } if (c != ',') { /* Not an image separator? */ WARNMS1(cinfo, JWRN_GIF_CHAR, c); continue; } /* Read and decipher Local Image Descriptor */ if (!ReadOK(source->pub.input_file, hdrbuf, 9)) ERREXIT(cinfo, JERR_INPUT_EOF); /* we ignore top/left position info, also sort flag */ width = LM_to_uint(hdrbuf, 4); height = LM_to_uint(hdrbuf, 6); source->is_interlaced = (BitSet(hdrbuf[8], INTERLACE) != 0); /* Read local colormap if header indicates it is present */ /* Note: if we wanted to support skipping images, */ /* we'd need to skip rather than read colormap for ignored images */ if (BitSet(hdrbuf[8], COLORMAPFLAG)) { colormaplen = 2 << (hdrbuf[8] & 0x07); ReadColorMap(source, colormaplen, source->colormap); } source->input_code_size = ReadByte(source); /* get min-code-size byte */ if (source->input_code_size < 2 || source->input_code_size > 8) ERREXIT1(cinfo, JERR_GIF_CODESIZE, source->input_code_size); /* Reached desired image, so break out of loop */ /* If we wanted to skip this image, */ /* we'd call SkipDataBlocks and then continue the loop */ break; } /* Prepare to read selected image: first initialize LZW decompressor */ source->symbol_head = (UINT16 *) (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, LZW_TABLE_SIZE * sizeof(UINT16)); source->symbol_tail = (UINT8 *) (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, LZW_TABLE_SIZE * sizeof(UINT8)); source->symbol_stack = (UINT8 *) (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE, LZW_TABLE_SIZE * sizeof(UINT8)); InitLZWCode(source); /* * If image is interlaced, we read it into a full-size sample array, * decompressing as we go; then get_interlaced_row selects rows from the * sample array in the proper order. */ if (source->is_interlaced) { /* We request the virtual array now, but can't access it until virtual * arrays have been allocated. Hence, the actual work of reading the * image is postponed until the first call to get_pixel_rows. */ source->interlaced_image = (*cinfo->mem->request_virt_sarray) ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE, (JDIMENSION)width, (JDIMENSION)height, (JDIMENSION)1); if (cinfo->progress != NULL) { cd_progress_ptr progress = (cd_progress_ptr)cinfo->progress; progress->total_extra_passes++; /* count file input as separate pass */ } source->pub.get_pixel_rows = load_interlaced_image; } else { source->pub.get_pixel_rows = get_pixel_rows; } /* Create compressor input buffer. */ source->pub.buffer = (*cinfo->mem->alloc_sarray) ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)width * NUMCOLORS, (JDIMENSION)1); source->pub.buffer_height = 1; /* Pad colormap for safety. */ for (c = colormaplen; c < source->clear_code; c++) { source->colormap[CM_RED][c] = source->colormap[CM_GREEN][c] = source->colormap[CM_BLUE][c] = CENTERJSAMPLE; } /* Return info about the image. */ cinfo->in_color_space = JCS_RGB; cinfo->input_components = NUMCOLORS; cinfo->data_precision = BITS_IN_JSAMPLE; /* we always rescale data to this */ cinfo->image_width = width; cinfo->image_height = height; TRACEMS3(cinfo, 1, JTRC_GIF, width, height, colormaplen); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "Libjpeg-turbo versions 2.0.91 and 2.0.90 is vulnerable to a denial of service vulnerability caused by a divide by zero when processing a crafted GIF image.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2021-20205"}} -{"idx": 497575, "input": "static int des3_1_set_key(struct ssh_cipher_struct *cipher, void *key, void *IV) { if (cipher->key == NULL) { if (alloc_key(cipher) < 0) { return -1; } if (gcry_cipher_open(&cipher->key[0], GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, 0)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_setkey(cipher->key[0], key, 8)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_setiv(cipher->key[0], IV, 8)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_open(&cipher->key[1], GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, 0)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_setkey(cipher->key[1], (unsigned char *)key + 8, 8)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_setiv(cipher->key[1], (unsigned char *)IV + 8, 8)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_open(&cipher->key[2], GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, 0)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_setkey(cipher->key[2], (unsigned char *)key + 16, 8)) { SAFE_FREE(cipher->key); return -1; } if (gcry_cipher_setiv(cipher->key[2], (unsigned char *)IV + 16, 8)) { SAFE_FREE(cipher->key); return -1; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204238, "input": "int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ { char buf[512], *actual_alias = NULL, *p; phar_entry_info entry = {0}; size_t pos = 0, read, totalsize; tar_header *hdr; php_uint32 sum1, sum2, size, old; phar_archive_data *myphar, **actual; int last_was_longlink = 0; if (error) { *error = NULL; } php_stream_seek(fp, 0, SEEK_END); totalsize = php_stream_tell(fp); php_stream_seek(fp, 0, SEEK_SET); read = php_stream_read(fp, buf, sizeof(buf)); if (read != sizeof(buf)) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is not a tar file or is truncated\", fname); } php_stream_close(fp); return FAILURE; } hdr = (tar_header*)buf; old = (memcmp(hdr->magic, \"ustar\", sizeof(\"ustar\")-1) != 0); myphar = (phar_archive_data *) pecalloc(1, sizeof(phar_archive_data), PHAR_G(persist)); myphar->is_persistent = PHAR_G(persist); /* estimate number of entries, can't be certain with tar files */ zend_hash_init(&myphar->manifest, 2 + (totalsize >> 12), zend_get_hash_value, destroy_phar_manifest_entry, (zend_bool)myphar->is_persistent); zend_hash_init(&myphar->mounted_dirs, 5, zend_get_hash_value, NULL, (zend_bool)myphar->is_persistent); zend_hash_init(&myphar->virtual_dirs, 4 + (totalsize >> 11), zend_get_hash_value, NULL, (zend_bool)myphar->is_persistent); myphar->is_tar = 1; /* remember whether this entire phar was compressed with gz/bzip2 */ myphar->flags = compression; entry.is_tar = 1; entry.is_crc_checked = 1; entry.phar = myphar; pos += sizeof(buf); do { phar_entry_info *newentry; pos = php_stream_tell(fp); hdr = (tar_header*) buf; sum1 = phar_tar_number(hdr->checksum, sizeof(hdr->checksum)); if (sum1 == 0 && phar_tar_checksum(buf, sizeof(buf)) == 0) { break; } memset(hdr->checksum, ' ', sizeof(hdr->checksum)); sum2 = phar_tar_checksum(buf, old?sizeof(old_tar_header):sizeof(tar_header)); size = entry.uncompressed_filesize = entry.compressed_filesize = phar_tar_number(hdr->size, sizeof(hdr->size)); /* skip global/file headers (pax) */ if (!old && (hdr->typeflag == TAR_GLOBAL_HDR || hdr->typeflag == TAR_FILE_HDR)) { size = (size+511)&~511; goto next; } if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(\".phar/signature.bin\")-1 && !strncmp(hdr->name, \".phar/signature.bin\", sizeof(\".phar/signature.bin\")-1)) { off_t curloc; if (size > 511) { if (error) { spprintf(error, 4096, \"phar error: tar-based phar \\\"%s\\\" has signature that is larger than 511 bytes, cannot process\", fname); } bail: php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } curloc = php_stream_tell(fp); read = php_stream_read(fp, buf, size); if (read != size) { if (error) { spprintf(error, 4096, \"phar error: tar-based phar \\\"%s\\\" signature cannot be read\", fname); } goto bail; } #ifdef WORDS_BIGENDIAN # define PHAR_GET_32(buffer) \\ (((((unsigned char*)(buffer))[3]) << 24) \\ | ((((unsigned char*)(buffer))[2]) << 16) \\ | ((((unsigned char*)(buffer))[1]) << 8) \\ | (((unsigned char*)(buffer))[0])) #else # define PHAR_GET_32(buffer) (php_uint32) *(buffer) #endif myphar->sig_flags = PHAR_GET_32(buf); if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error TSRMLS_CC)) { if (error) { char *save = *error; spprintf(error, 4096, \"phar error: tar-based phar \\\"%s\\\" signature cannot be verified: %s\", fname, save); efree(save); } goto bail; } php_stream_seek(fp, curloc + 512, SEEK_SET); /* signature checked out, let's ensure this is the last file in the phar */ if (((hdr->typeflag == '\\0') || (hdr->typeflag == TAR_FILE)) && size > 0) { /* this is not good enough - seek succeeds even on truncated tars */ php_stream_seek(fp, 512, SEEK_CUR); if ((uint)php_stream_tell(fp) > totalsize) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } } read = php_stream_read(fp, buf, sizeof(buf)); if (read != sizeof(buf)) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } hdr = (tar_header*) buf; sum1 = phar_tar_number(hdr->checksum, sizeof(hdr->checksum)); if (sum1 == 0 && phar_tar_checksum(buf, sizeof(buf)) == 0) { break; } if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" has entries after signature, invalid phar\", fname); } goto bail; } if (!last_was_longlink && hdr->typeflag == 'L') { last_was_longlink = 1; /* support the ././@LongLink system for storing long filenames */ entry.filename_len = entry.uncompressed_filesize; /* Check for overflow - bug 61065 */ if (entry.filename_len == UINT_MAX) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (invalid entry size)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } entry.filename = pemalloc(entry.filename_len+1, myphar->is_persistent); read = php_stream_read(fp, entry.filename, entry.filename_len); if (read != entry.filename_len) { efree(entry.filename); if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } entry.filename[entry.filename_len] = '\\0'; /* skip blank stuff */ size = ((size+511)&~511) - size; /* this is not good enough - seek succeeds even on truncated tars */ php_stream_seek(fp, size, SEEK_CUR); if ((uint)php_stream_tell(fp) > totalsize) { efree(entry.filename); if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } read = php_stream_read(fp, buf, sizeof(buf)); if (read != sizeof(buf)) { efree(entry.filename); if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } continue; } else if (!last_was_longlink && !old && hdr->prefix[0] != 0) { char name[256]; int i, j; for (i = 0; i < 155; i++) { name[i] = hdr->prefix[i]; if (name[i] == '\\0') { break; } } name[i++] = '/'; for (j = 0; j < 100; j++) { name[i+j] = hdr->name[j]; if (name[i+j] == '\\0') { break; } } entry.filename_len = i+j; if (name[entry.filename_len - 1] == '/') { /* some tar programs store directories with trailing slash */ entry.filename_len--; } entry.filename = pestrndup(name, entry.filename_len, myphar->is_persistent); } else if (!last_was_longlink) { int i; /* calculate strlen, which can be no longer than 100 */ for (i = 0; i < 100; i++) { if (hdr->name[i] == '\\0') { break; } } entry.filename_len = i; entry.filename = pestrndup(hdr->name, i, myphar->is_persistent); if (i > 0 && entry.filename[entry.filename_len - 1] == '/') { /* some tar programs store directories with trailing slash */ entry.filename[entry.filename_len - 1] = '\\0'; entry.filename_len--; } } last_was_longlink = 0; phar_add_virtual_dirs(myphar, entry.filename, entry.filename_len TSRMLS_CC); if (sum1 != sum2) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (checksum mismatch of file \\\"%s\\\")\", fname, entry.filename); } pefree(entry.filename, myphar->is_persistent); php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } entry.tar_type = ((old & (hdr->typeflag == '\\0')) ? TAR_FILE : hdr->typeflag); entry.offset = entry.offset_abs = pos; /* header_offset unused in tar */ entry.fp_type = PHAR_FP; entry.flags = phar_tar_number(hdr->mode, sizeof(hdr->mode)) & PHAR_ENT_PERM_MASK; entry.timestamp = phar_tar_number(hdr->mtime, sizeof(hdr->mtime)); entry.is_persistent = myphar->is_persistent; #ifndef S_ISDIR #define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) #endif if (old && entry.tar_type == TAR_FILE && S_ISDIR(entry.flags)) { entry.tar_type = TAR_DIR; } if (entry.tar_type == TAR_DIR) { entry.is_dir = 1; } else { entry.is_dir = 0; } entry.link = NULL; if (entry.tar_type == TAR_LINK) { if (!zend_hash_exists(&myphar->manifest, hdr->linkname, strlen(hdr->linkname))) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file - hard link to non-existent file \\\"%s\\\"\", fname, hdr->linkname); } pefree(entry.filename, entry.is_persistent); php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } entry.link = estrdup(hdr->linkname); } else if (entry.tar_type == TAR_SYMLINK) { entry.link = estrdup(hdr->linkname); } phar_set_inode(&entry TSRMLS_CC); zend_hash_add(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info), (void **) &newentry); if (entry.is_persistent) { ++entry.manifest_pos; } if (entry.filename_len >= sizeof(\".phar/.metadata\")-1 && !memcmp(entry.filename, \".phar/.metadata\", sizeof(\".phar/.metadata\")-1)) { if (FAILURE == phar_tar_process_metadata(newentry, fp TSRMLS_CC)) { if (error) { spprintf(error, 4096, \"phar error: tar-based phar \\\"%s\\\" has invalid metadata in magic file \\\"%s\\\"\", fname, entry.filename); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } } if (!actual_alias && entry.filename_len == sizeof(\".phar/alias.txt\")-1 && !strncmp(entry.filename, \".phar/alias.txt\", sizeof(\".phar/alias.txt\")-1)) { /* found explicit alias */ if (size > 511) { if (error) { spprintf(error, 4096, \"phar error: tar-based phar \\\"%s\\\" has alias that is larger than 511 bytes, cannot process\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } read = php_stream_read(fp, buf, size); if (read == size) { buf[size] = '\\0'; if (!phar_validate_alias(buf, size)) { if (size > 50) { buf[50] = '.'; buf[51] = '.'; buf[52] = '.'; buf[53] = '\\0'; } if (error) { spprintf(error, 4096, \"phar error: invalid alias \\\"%s\\\" in tar-based phar \\\"%s\\\"\", buf, fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } actual_alias = pestrndup(buf, size, myphar->is_persistent); myphar->alias = actual_alias; myphar->alias_len = size; php_stream_seek(fp, pos, SEEK_SET); } else { if (error) { spprintf(error, 4096, \"phar error: Unable to read alias from tar-based phar \\\"%s\\\"\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } } size = (size+511)&~511; if (((hdr->typeflag == '\\0') || (hdr->typeflag == TAR_FILE)) && size > 0) { next: /* this is not good enough - seek succeeds even on truncated tars */ php_stream_seek(fp, size, SEEK_CUR); if ((uint)php_stream_tell(fp) > totalsize) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } } read = php_stream_read(fp, buf, sizeof(buf)); if (read != sizeof(buf)) { if (error) { spprintf(error, 4096, \"phar error: \\\"%s\\\" is a corrupted tar file (truncated)\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } } while (read != 0); if (zend_hash_exists(&(myphar->manifest), \".phar/stub.php\", sizeof(\".phar/stub.php\")-1)) { myphar->is_data = 0; } else { myphar->is_data = 1; } /* ensure signature set */ if (!myphar->is_data && PHAR_G(require_hash) && !myphar->signature) { php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); if (error) { spprintf(error, 0, \"tar-based phar \\\"%s\\\" does not have a signature\", fname); } return FAILURE; } myphar->fname = pestrndup(fname, fname_len, myphar->is_persistent); #ifdef PHP_WIN32 phar_unixify_path_separators(myphar->fname, fname_len); #endif myphar->fname_len = fname_len; myphar->fp = fp; p = strrchr(myphar->fname, '/'); if (p) { myphar->ext = memchr(p, '.', (myphar->fname + fname_len) - p); if (myphar->ext == p) { myphar->ext = memchr(p + 1, '.', (myphar->fname + fname_len) - p - 1); } if (myphar->ext) { myphar->ext_len = (myphar->fname + fname_len) - myphar->ext; } } phar_request_initialize(TSRMLS_C); if (SUCCESS != zend_hash_add(&(PHAR_GLOBALS->phar_fname_map), myphar->fname, fname_len, (void*)&myphar, sizeof(phar_archive_data*), (void **)&actual)) { if (error) { spprintf(error, 4096, \"phar error: Unable to add tar-based phar \\\"%s\\\" to phar registry\", fname); } php_stream_close(fp); phar_destroy_phar_data(myphar TSRMLS_CC); return FAILURE; } myphar = *actual; if (actual_alias) { phar_archive_data **fd_ptr; myphar->is_temporary_alias = 0; if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), actual_alias, myphar->alias_len, (void **)&fd_ptr)) { if (SUCCESS != phar_free_alias(*fd_ptr, actual_alias, myphar->alias_len TSRMLS_CC)) { if (error) { spprintf(error, 4096, \"phar error: Unable to add tar-based phar \\\"%s\\\", alias is already in use\", fname); } zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), myphar->fname, fname_len); return FAILURE; } } zend_hash_add(&(PHAR_GLOBALS->phar_alias_map), actual_alias, myphar->alias_len, (void*)&myphar, sizeof(phar_archive_data*), NULL); } else { phar_archive_data **fd_ptr; if (alias_len) { if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void **)&fd_ptr)) { if (SUCCESS != phar_free_alias(*fd_ptr, alias, alias_len TSRMLS_CC)) { if (error) { spprintf(error, 4096, \"phar error: Unable to add tar-based phar \\\"%s\\\", alias is already in use\", fname); } zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), myphar->fname, fname_len); return FAILURE; } } zend_hash_add(&(PHAR_GLOBALS->phar_alias_map), alias, alias_len, (void*)&myphar, sizeof(phar_archive_data*), NULL); myphar->alias = pestrndup(alias, alias_len, myphar->is_persistent); myphar->alias_len = alias_len; } else { myphar->alias = pestrndup(myphar->fname, fname_len, myphar->is_persistent); myphar->alias_len = fname_len; } myphar->is_temporary_alias = 1; } if (pphar) { *pphar = myphar; } return SUCCESS; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Restriction of Operations within the Bounds of a Memory Buffer"], "explanation": "Stack-based buffer overflow in ext/phar/tar.c in PHP before 5.5.32, 5.6.x before 5.6.18, and 7.x before 7.0.3 allows remote attackers to cause a denial of service (application crash) or possibly have unspecified other impact via a crafted TAR archive.", "severity_level": "High", "cwe": "CWE-119", "cve": "CVE-2016-2554"}} -{"idx": 410785, "input": "static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops, const struct sock *sk, struct sk_buff *skb, __u16 *mss) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402327, "input": "HttpStateData::processSurrogateControl(HttpReply *reply) { if (request->flags.accelerated && reply->surrogate_control) { HttpHdrScTarget *sctusable = reply->surrogate_control->getMergedTarget(Config.Accel.surrogate_id); if (sctusable) { if (sctusable->hasNoStore() || (Config.onoff.surrogate_is_remote && sctusable->noStoreRemote())) { surrogateNoStore = true; // Be conservative for now and make it non-shareable because // there is no enough information here to make the decision. entry->makePrivate(false); } /* The HttpHeader logic cannot tell if the header it's parsing is a reply to an * accelerated request or not... * Still, this is an abstraction breach. - RC */ if (sctusable->hasMaxAge()) { if (sctusable->maxAge() < sctusable->maxStale()) reply->expires = reply->date + sctusable->maxAge(); else reply->expires = reply->date + sctusable->maxStale(); /* And update the timestamps */ entry->timestampsSet(); } /* We ignore cache-control directives as per the Surrogate specification */ ignoreCacheControl = true; delete sctusable; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259059, "input": "int nbd_client(int fd) { return -ENOTSUP; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208328, "input": "static void msf2_dma_tx(MSF2EmacState *s) { NetClientState *nc = qemu_get_queue(s->nic); hwaddr desc = s->regs[R_DMA_TX_DESC]; uint8_t buf[MAX_PKT_SIZE]; EmacDesc d; int size; uint8_t pktcnt; uint32_t status; if (!(s->regs[R_CFG1] & R_CFG1_TX_EN_MASK)) { return; } while (1) { emac_load_desc(s, &d, desc); if (d.pktsize & EMPTY_MASK) { break; } size = d.pktsize & PKT_SIZE; address_space_read(&s->dma_as, d.pktaddr, MEMTXATTRS_UNSPECIFIED, buf, size); /* * This is very basic way to send packets. Ideally there should be * a FIFO and packets should be sent out from FIFO only when * R_CFG1 bit 0 is set. */ if (s->regs[R_CFG1] & R_CFG1_LB_EN_MASK) { nc->info->receive(nc, buf, size); } else { qemu_send_packet(nc, buf, size); } d.pktsize |= EMPTY_MASK; emac_store_desc(s, &d, desc); /* update sent packets count */ status = s->regs[R_DMA_TX_STATUS]; pktcnt = FIELD_EX32(status, DMA_TX_STATUS, PKTCNT); pktcnt++; s->regs[R_DMA_TX_STATUS] = FIELD_DP32(status, DMA_TX_STATUS, PKTCNT, pktcnt); s->regs[R_DMA_TX_STATUS] |= R_DMA_TX_STATUS_PKT_SENT_MASK; desc = d.next; } s->regs[R_DMA_TX_STATUS] |= R_DMA_TX_STATUS_UNDERRUN_MASK; s->regs[R_DMA_TX_CTL] &= ~R_DMA_TX_CTL_EN_MASK; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Loop with Unreachable Exit Condition ('Infinite Loop')"], "explanation": "A potential stack overflow via infinite loop issue was found in various NIC emulators of QEMU in versions up to and including 5.2.0. The issue occurs in loopback mode of a NIC wherein reentrant DMA checks get bypassed. A guest user/process may use this flaw to consume CPU cycles or crash the QEMU process on the host resulting in DoS scenario.", "severity_level": "NoInfo", "cwe": "CWE-835", "cve": "CVE-2021-3416"}} -{"idx": 367050, "input": "static uint64_t sm501_system_config_read(void *opaque, hwaddr addr, unsigned size) { SM501State *s = (SM501State *)opaque; uint32_t ret = 0; SM501_DPRINTF(\"sm501 system config regs : read addr=%x\\n\", (int)addr); switch (addr) { case SM501_SYSTEM_CONTROL: ret = s->system_control; break; case SM501_MISC_CONTROL: ret = s->misc_control; break; case SM501_GPIO31_0_CONTROL: ret = s->gpio_31_0_control; break; case SM501_GPIO63_32_CONTROL: ret = s->gpio_63_32_control; break; case SM501_DEVICEID: ret = 0x050100A0; break; case SM501_DRAM_CONTROL: ret = (s->dram_control & 0x07F107C0) | s->local_mem_size_index << 13; break; case SM501_ARBTRTN_CONTROL: ret = s->arbitration_control; break; case SM501_COMMAND_LIST_STATUS: ret = 0x00180002; /* FIFOs are empty, everything idle */ break; case SM501_IRQ_MASK: ret = s->irq_mask; break; case SM501_MISC_TIMING: /* TODO : simulate gate control */ ret = s->misc_timing; break; case SM501_CURRENT_GATE: /* TODO : simulate gate control */ ret = 0x00021807; break; case SM501_CURRENT_CLOCK: ret = 0x2A1A0A09; break; case SM501_POWER_MODE_CONTROL: ret = s->power_mode_control; break; case SM501_ENDIAN_CONTROL: ret = 0; /* Only default little endian mode is supported */ break; default: qemu_log_mask(LOG_UNIMP, \"sm501: not implemented system config\" \"register read. addr=%\" HWADDR_PRIx \"\\n\", addr); } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431098, "input": "static bool nfs_need_update_open_stateid(struct nfs4_state *state, const nfs4_stateid *stateid) { if (test_bit(NFS_OPEN_STATE, &state->flags) == 0 || !nfs4_stateid_match_other(stateid, &state->open_stateid)) { if (stateid->seqid == cpu_to_be32(1)) nfs_state_log_update_open_stateid(state); else set_bit(NFS_STATE_CHANGE_WAIT, &state->flags); return true; } if (nfs4_stateid_is_newer(stateid, &state->open_stateid)) { nfs_state_log_out_of_order_open_stateid(state, stateid); return true; } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279691, "input": "static int compare_notify_change_events(const void *p1, const void *p2) { const struct notify_change_event *e1 = p1; const struct notify_change_event *e2 = p2; return timespec_compare(&e1->when, &e2->when); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416661, "input": "static struct st_mysqlnd_packet_greet * MYSQLND_METHOD(mysqlnd_protocol, get_greet_packet)(MYSQLND_PROTOCOL * const protocol, zend_bool persistent TSRMLS_DC) { struct st_mysqlnd_packet_greet * packet = mnd_pecalloc(1, packet_methods[PROT_GREET_PACKET].struct_size, persistent); DBG_ENTER(\"mysqlnd_protocol::get_greet_packet\"); if (packet) { packet->header.m = &packet_methods[PROT_GREET_PACKET]; packet->header.persistent = persistent; } DBG_RETURN(packet);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 296036, "input": "getOctcubeIndexFromRGB(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *rtab, l_uint32 *gtab, l_uint32 *btab, l_uint32 *pindex) { *pindex = rtab[rval] | gtab[gval] | btab[bval]; return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385344, "input": "xmlXPathErrMemory(xmlXPathContextPtr ctxt, const char *extra) { if (ctxt != NULL) { if (extra) { xmlChar buf[200]; xmlStrPrintf(buf, 200, \"Memory allocation failed : %s\\n\", extra); ctxt->lastError.message = (char *) xmlStrdup(buf); } else { ctxt->lastError.message = (char *) xmlStrdup(BAD_CAST \"Memory allocation failed\\n\"); } ctxt->lastError.domain = XML_FROM_XPATH; ctxt->lastError.code = XML_ERR_NO_MEMORY; if (ctxt->error != NULL) ctxt->error(ctxt->userData, &ctxt->lastError); } else { if (extra) __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_XPATH, XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra, NULL, NULL, 0, 0, \"Memory allocation failed : %s\\n\", extra); else __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_XPATH, XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, \"Memory allocation failed\\n\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409896, "input": "static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack, u32 start_seq, u32 end_seq) { /* Too far in future, or reversed (interpretation is ambiguous) */ if (after(end_seq, tp->snd_nxt) || !before(start_seq, end_seq)) return 0; /* Nasty start_seq wrap-around check (see comments above) */ if (!before(start_seq, tp->snd_nxt)) return 0; /* In outstanding window? ...This is valid exit for D-SACKs too. * start_seq == snd_una is non-sensical (see comments above) */ if (after(start_seq, tp->snd_una)) return 1; if (!is_dsack || !tp->undo_marker) return 0; /* ...Then it's D-SACK, and must reside below snd_una completely */ if (after(end_seq, tp->snd_una)) return 0; if (!before(start_seq, tp->undo_marker)) return 1; /* Too old */ if (!after(end_seq, tp->undo_marker)) return 0; /* Undo_marker boundary crossing (overestimates a lot). Known already: * start_seq < undo_marker and end_seq >= undo_marker. */ return !before(start_seq, end_seq - tp->max_window); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 437578, "input": "static bool nested_svm_vmrun(struct vcpu_svm *svm) { struct vmcb *nested_vmcb; struct vmcb *hsave = svm->nested.hsave; struct vmcb *vmcb = svm->vmcb; struct page *page; u64 vmcb_gpa; vmcb_gpa = svm->vmcb->save.rax; nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, &page); if (!nested_vmcb) return false; if (!nested_vmcb_checks(nested_vmcb)) { nested_vmcb->control.exit_code = SVM_EXIT_ERR; nested_vmcb->control.exit_code_hi = 0; nested_vmcb->control.exit_info_1 = 0; nested_vmcb->control.exit_info_2 = 0; nested_svm_unmap(page); return false; } trace_kvm_nested_vmrun(svm->vmcb->save.rip, vmcb_gpa, nested_vmcb->save.rip, nested_vmcb->control.int_ctl, nested_vmcb->control.event_inj, nested_vmcb->control.nested_ctl); trace_kvm_nested_intercepts(nested_vmcb->control.intercept_cr & 0xffff, nested_vmcb->control.intercept_cr >> 16, nested_vmcb->control.intercept_exceptions, nested_vmcb->control.intercept); /* Clear internal status */ kvm_clear_exception_queue(&svm->vcpu); kvm_clear_interrupt_queue(&svm->vcpu); /* * Save the old vmcb, so we don't need to pick what we save, but can * restore everything when a VMEXIT occurs */ hsave->save.es = vmcb->save.es; hsave->save.cs = vmcb->save.cs; hsave->save.ss = vmcb->save.ss; hsave->save.ds = vmcb->save.ds; hsave->save.gdtr = vmcb->save.gdtr; hsave->save.idtr = vmcb->save.idtr; hsave->save.efer = svm->vcpu.arch.efer; hsave->save.cr0 = kvm_read_cr0(&svm->vcpu); hsave->save.cr4 = svm->vcpu.arch.cr4; hsave->save.rflags = kvm_get_rflags(&svm->vcpu); hsave->save.rip = kvm_rip_read(&svm->vcpu); hsave->save.rsp = vmcb->save.rsp; hsave->save.rax = vmcb->save.rax; if (npt_enabled) hsave->save.cr3 = vmcb->save.cr3; else hsave->save.cr3 = kvm_read_cr3(&svm->vcpu); copy_vmcb_control_area(hsave, vmcb); if (kvm_get_rflags(&svm->vcpu) & X86_EFLAGS_IF) svm->vcpu.arch.hflags |= HF_HIF_MASK; else svm->vcpu.arch.hflags &= ~HF_HIF_MASK; if (nested_vmcb->control.nested_ctl) { kvm_mmu_unload(&svm->vcpu); svm->nested.nested_cr3 = nested_vmcb->control.nested_cr3; nested_svm_init_mmu_context(&svm->vcpu); } /* Load the nested guest state */ svm->vmcb->save.es = nested_vmcb->save.es; svm->vmcb->save.cs = nested_vmcb->save.cs; svm->vmcb->save.ss = nested_vmcb->save.ss; svm->vmcb->save.ds = nested_vmcb->save.ds; svm->vmcb->save.gdtr = nested_vmcb->save.gdtr; svm->vmcb->save.idtr = nested_vmcb->save.idtr; kvm_set_rflags(&svm->vcpu, nested_vmcb->save.rflags); svm_set_efer(&svm->vcpu, nested_vmcb->save.efer); svm_set_cr0(&svm->vcpu, nested_vmcb->save.cr0); svm_set_cr4(&svm->vcpu, nested_vmcb->save.cr4); if (npt_enabled) { svm->vmcb->save.cr3 = nested_vmcb->save.cr3; svm->vcpu.arch.cr3 = nested_vmcb->save.cr3; } else (void)kvm_set_cr3(&svm->vcpu, nested_vmcb->save.cr3); /* Guest paging mode is active - reset mmu */ kvm_mmu_reset_context(&svm->vcpu); svm->vmcb->save.cr2 = svm->vcpu.arch.cr2 = nested_vmcb->save.cr2; kvm_register_write(&svm->vcpu, VCPU_REGS_RAX, nested_vmcb->save.rax); kvm_register_write(&svm->vcpu, VCPU_REGS_RSP, nested_vmcb->save.rsp); kvm_register_write(&svm->vcpu, VCPU_REGS_RIP, nested_vmcb->save.rip); /* In case we don't even reach vcpu_run, the fields are not updated */ svm->vmcb->save.rax = nested_vmcb->save.rax; svm->vmcb->save.rsp = nested_vmcb->save.rsp; svm->vmcb->save.rip = nested_vmcb->save.rip; svm->vmcb->save.dr7 = nested_vmcb->save.dr7; svm->vmcb->save.dr6 = nested_vmcb->save.dr6; svm->vmcb->save.cpl = nested_vmcb->save.cpl; svm->nested.vmcb_msrpm = nested_vmcb->control.msrpm_base_pa & ~0x0fffULL; svm->nested.vmcb_iopm = nested_vmcb->control.iopm_base_pa & ~0x0fffULL; /* cache intercepts */ svm->nested.intercept_cr = nested_vmcb->control.intercept_cr; svm->nested.intercept_dr = nested_vmcb->control.intercept_dr; svm->nested.intercept_exceptions = nested_vmcb->control.intercept_exceptions; svm->nested.intercept = nested_vmcb->control.intercept; svm_flush_tlb(&svm->vcpu); svm->vmcb->control.int_ctl = nested_vmcb->control.int_ctl | V_INTR_MASKING_MASK; if (nested_vmcb->control.int_ctl & V_INTR_MASKING_MASK) svm->vcpu.arch.hflags |= HF_VINTR_MASK; else svm->vcpu.arch.hflags &= ~HF_VINTR_MASK; if (svm->vcpu.arch.hflags & HF_VINTR_MASK) { /* We only want the cr8 intercept bits of the guest */ clr_cr_intercept(svm, INTERCEPT_CR8_READ); clr_cr_intercept(svm, INTERCEPT_CR8_WRITE); } /* We don't want to see VMMCALLs from a nested guest */ clr_intercept(svm, INTERCEPT_VMMCALL); svm->vmcb->control.lbr_ctl = nested_vmcb->control.lbr_ctl; svm->vmcb->control.int_vector = nested_vmcb->control.int_vector; svm->vmcb->control.int_state = nested_vmcb->control.int_state; svm->vmcb->control.tsc_offset += nested_vmcb->control.tsc_offset; svm->vmcb->control.event_inj = nested_vmcb->control.event_inj; svm->vmcb->control.event_inj_err = nested_vmcb->control.event_inj_err; nested_svm_unmap(page); /* Enter Guest-Mode */ enter_guest_mode(&svm->vcpu); /* * Merge guest and host intercepts - must be called with vcpu in * guest-mode to take affect here */ recalc_intercepts(svm); svm->nested.vmcb = vmcb_gpa; enable_gif(svm); mark_all_dirty(svm->vmcb); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402244, "input": "int bcf_update_alleles(const bcf_hdr_t *hdr, bcf1_t *line, const char **alleles, int nals) { if ( !(line->unpacked & BCF_UN_STR) ) bcf_unpack(line, BCF_UN_STR); kstring_t tmp = {0,0,0}; char *free_old = NULL; // If the supplied alleles are not pointers to line->d.als, the existing block can be reused. int i; for (i=0; i=line->d.als && alleles[i]d.als+line->d.m_als ) break; if ( i==nals ) { // all alleles point elsewhere, reuse the existing block tmp.l = 0; tmp.s = line->d.als; tmp.m = line->d.m_als; } else free_old = line->d.als; for (i=0; id.als = tmp.s; line->d.m_als = tmp.m; free(free_old); return _bcf1_sync_alleles(hdr,line,nals); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 379423, "input": "maybe_make_export_env () { register char **temp_array; int new_size; VAR_CONTEXT *tcxt; if (array_needs_making) { if (export_env) strvec_flush (export_env); /* Make a guess based on how many shell variables and functions we have. Since there will always be array variables, and array variables are not (yet) exported, this will always be big enough for the exported variables and functions. */ new_size = n_shell_variables () + HASH_ENTRIES (shell_functions) + 1 + HASH_ENTRIES (temporary_env); if (new_size > export_env_size) { export_env_size = new_size; export_env = strvec_resize (export_env, export_env_size); environ = export_env; } export_env[export_env_index = 0] = (char *)NULL; /* Make a dummy variable context from the temporary_env, stick it on the front of shell_variables, call make_var_export_array on the whole thing to flatten it, and convert the list of SHELL_VAR *s to the form needed by the environment. */ if (temporary_env) { tcxt = new_var_context ((char *)NULL, 0); tcxt->table = temporary_env; tcxt->down = shell_variables; } else tcxt = shell_variables; temp_array = make_var_export_array (tcxt); if (temp_array) add_temp_array_to_env (temp_array, 0, 0); if (tcxt != shell_variables) free (tcxt); #if defined (RESTRICTED_SHELL) /* Restricted shells may not export shell functions. */ temp_array = restricted ? (char **)0 : make_func_export_array (); #else temp_array = make_func_export_array (); #endif if (temp_array) add_temp_array_to_env (temp_array, 0, 0); array_needs_making = 0; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448816, "input": "bool RGWFormPost::is_formpost_req(req_state* const s) { std::string content_type; std::map params; parse_boundary_params(s->info.env->get(\"CONTENT_TYPE\", \"\"), content_type, params); return boost::algorithm::iequals(content_type, \"multipart/form-data\") && params.count(\"boundary\") > 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267280, "input": "GF_Err gf_isom_set_JPEG2000(GF_ISOFile *mov, Bool set_on) { if (!mov) return GF_BAD_PARAM; mov->is_jp2 = set_on; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409936, "input": "static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) { const struct inet_connection_sock *icsk = inet_csk(sk); icsk->icsk_ca_ops->cong_avoid(sk, ack, in_flight); tcp_sk(sk)->snd_cwnd_stamp = tcp_time_stamp; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422605, "input": "TEST(ModMatchExpression, MatchesNull) { ModMatchExpression mod(\"a\", 5, 2); ASSERT(!mod.matchesBSON(BSONObj(), NULL)); ASSERT(!mod.matchesBSON(BSON(\"a\" << BSONNULL), NULL)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265788, "input": "CWebSession::~CWebSession() { // Find our entry in mIPSessions pair p = Sessions.m_mIPSessions.equal_range(m_sIP); mIPSessionsIterator it = p.first; mIPSessionsIterator end = p.second; while (it != end) { if (it->second == this) { Sessions.m_mIPSessions.erase(it++); } else { ++it; } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212881, "input": "jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr) { jp2_box_t *box; int found; jas_image_t *image; jp2_dec_t *dec; bool samedtype; int dtype; unsigned int i; jp2_cmap_t *cmapd; jp2_pclr_t *pclrd; jp2_cdef_t *cdefd; unsigned int channo; int newcmptno; int_fast32_t *lutents; #if 0 jp2_cdefchan_t *cdefent; int cmptno; #endif jp2_cmapent_t *cmapent; jas_icchdr_t icchdr; jas_iccprof_t *iccprof; dec = 0; box = 0; image = 0; JAS_DBGLOG(100, (\"jp2_decode(%p, \\\"%s\\\")\\n\", in, optstr)); if (!(dec = jp2_dec_create())) { goto error; } /* Get the first box. This should be a JP box. */ if (!(box = jp2_box_get(in))) { jas_eprintf(\"error: cannot get box\\n\"); goto error; } if (box->type != JP2_BOX_JP) { jas_eprintf(\"error: expecting signature box\\n\"); goto error; } if (box->data.jp.magic != JP2_JP_MAGIC) { jas_eprintf(\"incorrect magic number\\n\"); goto error; } jp2_box_destroy(box); box = 0; /* Get the second box. This should be a FTYP box. */ if (!(box = jp2_box_get(in))) { goto error; } if (box->type != JP2_BOX_FTYP) { jas_eprintf(\"expecting file type box\\n\"); goto error; } jp2_box_destroy(box); box = 0; /* Get more boxes... */ found = 0; while ((box = jp2_box_get(in))) { if (jas_getdbglevel() >= 1) { jas_eprintf(\"got box type %s\\n\", box->info->name); } switch (box->type) { case JP2_BOX_JP2C: found = 1; break; case JP2_BOX_IHDR: if (!dec->ihdr) { dec->ihdr = box; box = 0; } break; case JP2_BOX_BPCC: if (!dec->bpcc) { dec->bpcc = box; box = 0; } break; case JP2_BOX_CDEF: if (!dec->cdef) { dec->cdef = box; box = 0; } break; case JP2_BOX_PCLR: if (!dec->pclr) { dec->pclr = box; box = 0; } break; case JP2_BOX_CMAP: if (!dec->cmap) { dec->cmap = box; box = 0; } break; case JP2_BOX_COLR: if (!dec->colr) { dec->colr = box; box = 0; } break; } if (box) { jp2_box_destroy(box); box = 0; } if (found) { break; } } if (!found) { jas_eprintf(\"error: no code stream found\\n\"); goto error; } if (!(dec->image = jpc_decode(in, optstr))) { jas_eprintf(\"error: cannot decode code stream\\n\"); goto error; } /* An IHDR box must be present. */ if (!dec->ihdr) { jas_eprintf(\"error: missing IHDR box\\n\"); goto error; } /* Does the number of components indicated in the IHDR box match the value specified in the code stream? */ if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) { jas_eprintf(\"warning: number of components mismatch\\n\"); } /* At least one component must be present. */ if (!jas_image_numcmpts(dec->image)) { jas_eprintf(\"error: no components\\n\"); goto error; } /* Determine if all components have the same data type. */ samedtype = true; dtype = jas_image_cmptdtype(dec->image, 0); for (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) { if (jas_image_cmptdtype(dec->image, i) != dtype) { samedtype = false; break; } } /* Is the component data type indicated in the IHDR box consistent with the data in the code stream? */ if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) || (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) { jas_eprintf(\"warning: component data type mismatch\\n\"); } /* Is the compression type supported? */ if (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) { jas_eprintf(\"error: unsupported compression type\\n\"); goto error; } if (dec->bpcc) { /* Is the number of components indicated in the BPCC box consistent with the code stream data? */ if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(jas_uint, jas_image_numcmpts( dec->image))) { jas_eprintf(\"warning: number of components mismatch\\n\"); } /* Is the component data type information indicated in the BPCC box consistent with the code stream data? */ if (!samedtype) { for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) { if (jas_image_cmptdtype(dec->image, i) != JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) { jas_eprintf(\"warning: component data type mismatch\\n\"); } } } else { jas_eprintf(\"warning: superfluous BPCC box\\n\"); } } /* A COLR box must be present. */ if (!dec->colr) { jas_eprintf(\"error: no COLR box\\n\"); goto error; } switch (dec->colr->data.colr.method) { case JP2_COLR_ENUM: jas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr)); break; case JP2_COLR_ICC: iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp, dec->colr->data.colr.iccplen); if (!iccprof) { jas_eprintf(\"error: failed to parse ICC profile\\n\"); goto error; } jas_iccprof_gethdr(iccprof, &icchdr); jas_eprintf(\"ICC Profile CS %08x\\n\", icchdr.colorspc); jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc)); dec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof); if (!dec->image->cmprof_) { jas_iccprof_destroy(iccprof); goto error; } jas_iccprof_destroy(iccprof); break; } /* If a CMAP box is present, a PCLR box must also be present. */ if (dec->cmap && !dec->pclr) { jas_eprintf(\"warning: missing PCLR box or superfluous CMAP box\\n\"); jp2_box_destroy(dec->cmap); dec->cmap = 0; } /* If a CMAP box is not present, a PCLR box must not be present. */ if (!dec->cmap && dec->pclr) { jas_eprintf(\"warning: missing CMAP box or superfluous PCLR box\\n\"); jp2_box_destroy(dec->pclr); dec->pclr = 0; } /* Determine the number of channels (which is essentially the number of components after any palette mappings have been applied). */ dec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans : JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); /* Perform a basic sanity check on the CMAP box if present. */ if (dec->cmap) { for (i = 0; i < dec->numchans; ++i) { /* Is the component number reasonable? */ if (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) { jas_eprintf(\"error: invalid component number in CMAP box\\n\"); goto error; } /* Is the LUT index reasonable? */ if (dec->cmap->data.cmap.ents[i].pcol >= dec->pclr->data.pclr.numchans) { jas_eprintf(\"error: invalid CMAP LUT index\\n\"); goto error; } } } /* Allocate space for the channel-number to component-number LUT. */ if (!(dec->chantocmptlut = jas_alloc2(dec->numchans, sizeof(uint_fast16_t)))) { jas_eprintf(\"error: no memory\\n\"); goto error; } if (!dec->cmap) { for (i = 0; i < dec->numchans; ++i) { dec->chantocmptlut[i] = i; } } else { cmapd = &dec->cmap->data.cmap; pclrd = &dec->pclr->data.pclr; cdefd = &dec->cdef->data.cdef; for (channo = 0; channo < cmapd->numchans; ++channo) { cmapent = &cmapd->ents[channo]; if (cmapent->map == JP2_CMAP_DIRECT) { dec->chantocmptlut[channo] = channo; } else if (cmapent->map == JP2_CMAP_PALETTE) { if (!pclrd->numlutents) { goto error; } lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t)); if (!lutents) { goto error; } for (i = 0; i < pclrd->numlutents; ++i) { lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans]; } newcmptno = jas_image_numcmpts(dec->image); jas_image_depalettize(dec->image, cmapent->cmptno, pclrd->numlutents, lutents, JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno); dec->chantocmptlut[channo] = newcmptno; jas_free(lutents); #if 0 if (dec->cdef) { cdefent = jp2_cdef_lookup(cdefd, channo); if (!cdefent) { abort(); } jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc)); } else { jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1)); } #else /* suppress -Wunused-but-set-variable */ (void)cdefd; #endif } else { jas_eprintf(\"error: invalid MTYP in CMAP box\\n\"); goto error; } } } /* Mark all components as being of unknown type. */ for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) { jas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN); } /* Determine the type of each component. */ if (dec->cdef) { for (i = 0; i < dec->cdef->data.cdef.numchans; ++i) { /* Is the channel number reasonable? */ if (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) { jas_eprintf(\"error: invalid channel number in CDEF box\\n\"); goto error; } jas_image_setcmpttype(dec->image, dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo], jp2_getct(jas_image_clrspc(dec->image), dec->cdef->data.cdef.ents[i].type, dec->cdef->data.cdef.ents[i].assoc)); } } else { for (i = 0; i < dec->numchans; ++i) { jas_image_setcmpttype(dec->image, dec->chantocmptlut[i], jp2_getct(jas_image_clrspc(dec->image), 0, i + 1)); } } /* Delete any components that are not of interest. */ for (i = jas_image_numcmpts(dec->image); i > 0; --i) { if (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) { jas_image_delcmpt(dec->image, i - 1); } } /* Ensure that some components survived. */ if (!jas_image_numcmpts(dec->image)) { jas_eprintf(\"error: no components\\n\"); goto error; } #if 0 jas_eprintf(\"no of components is %d\\n\", jas_image_numcmpts(dec->image)); #endif /* Prevent the image from being destroyed later. */ image = dec->image; dec->image = 0; jp2_dec_destroy(dec); return image; error: if (box) { jp2_box_destroy(box); } if (dec) { jp2_dec_destroy(dec); } return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "jp2_decode in jp2/jp2_dec.c in libjasper in JasPer 2.0.24 has a heap-based buffer over-read when there is an invalid relationship between the number of channels and the number of image components.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-3272"}} -{"idx": 488798, "input": "static inline int dccp_mib_init(void) { return snmp_mib_init((void**)dccp_statistics, sizeof(struct dccp_mib)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378620, "input": "void sqlite3VdbeExplainPop(Parse *pParse){ sqlite3ExplainBreakpoint(\"POP\", 0); pParse->addrExplain = sqlite3VdbeExplainParent(pParse); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267911, "input": "GF_Err stbl_RemovePaddingBits(GF_SampleTableBox *stbl, u32 SampleNumber) { u8 *p; u32 i, k; if (!stbl->PaddingBits) return GF_OK; if (stbl->PaddingBits->SampleCount < SampleNumber) return GF_BAD_PARAM; //last sample - remove the table if (stbl->PaddingBits->SampleCount == 1) { gf_isom_box_del_parent(&stbl->child_boxes, (GF_Box *) stbl->PaddingBits); stbl->PaddingBits = NULL; return GF_OK; } //reallocate and check size by the way... p = (u8 *)gf_malloc(sizeof(u8) * (stbl->PaddingBits->SampleCount - 1)); if (!p) return GF_OUT_OF_MEM; k=0; for (i=0; iPaddingBits->SampleCount; i++) { if (i+1 != SampleNumber) { p[k] = stbl->PaddingBits->padbits[i]; k++; } } stbl->PaddingBits->SampleCount -= 1; gf_free(stbl->PaddingBits->padbits); stbl->PaddingBits->padbits = p; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 444818, "input": "int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, struct host_cmd_ds_command *resp) { int ret = 0; struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_802_11_ad_hoc_start_result *start_result = &resp->params.start_result; struct host_cmd_ds_802_11_ad_hoc_join_result *join_result = &resp->params.join_result; struct mwifiex_bssdescriptor *bss_desc; u16 cmd = le16_to_cpu(resp->command); u8 result; if (!priv->attempted_bss_desc) { mwifiex_dbg(priv->adapter, ERROR, \"ADHOC_RESP: failed, association terminated by host\\n\"); goto done; } if (cmd == HostCmd_CMD_802_11_AD_HOC_START) result = start_result->result; else result = join_result->result; bss_desc = priv->attempted_bss_desc; /* Join result code 0 --> SUCCESS */ if (result) { mwifiex_dbg(priv->adapter, ERROR, \"ADHOC_RESP: failed\\n\"); if (priv->media_connected) mwifiex_reset_connect_state(priv, result, true); memset(&priv->curr_bss_params.bss_descriptor, 0x00, sizeof(struct mwifiex_bssdescriptor)); ret = -1; goto done; } /* Send a Media Connected event, according to the Spec */ priv->media_connected = true; if (le16_to_cpu(resp->command) == HostCmd_CMD_802_11_AD_HOC_START) { mwifiex_dbg(priv->adapter, INFO, \"info: ADHOC_S_RESP %s\\n\", bss_desc->ssid.ssid); /* Update the created network descriptor with the new BSSID */ memcpy(bss_desc->mac_address, start_result->bssid, ETH_ALEN); priv->adhoc_state = ADHOC_STARTED; } else { /* * Now the join cmd should be successful. * If BSSID has changed use SSID to compare instead of BSSID */ mwifiex_dbg(priv->adapter, INFO, \"info: ADHOC_J_RESP %s\\n\", bss_desc->ssid.ssid); /* * Make a copy of current BSSID descriptor, only needed for * join since the current descriptor is already being used * for adhoc start */ memcpy(&priv->curr_bss_params.bss_descriptor, bss_desc, sizeof(struct mwifiex_bssdescriptor)); priv->adhoc_state = ADHOC_JOINED; } mwifiex_dbg(priv->adapter, INFO, \"info: ADHOC_RESP: channel = %d\\n\", priv->adhoc_channel); mwifiex_dbg(priv->adapter, INFO, \"info: ADHOC_RESP: BSSID = %pM\\n\", priv->curr_bss_params.bss_descriptor.mac_address); if (!netif_carrier_ok(priv->netdev)) netif_carrier_on(priv->netdev); mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); mwifiex_save_curr_bcn(priv); done: /* Need to indicate IOCTL complete */ if (adapter->curr_cmd->wait_q_enabled) { if (ret) adapter->cmd_wait_q.status = -1; else adapter->cmd_wait_q.status = 0; } return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 393090, "input": "TEST_F(QueryPlannerTest, IntersectManySelfIntersections) { params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION; // True means multikey. addIndex(BSON(\"a\" << 1), true); // This one goes to 11. runQuery(fromjson(\"{a:1, a:2, a:3, a:4, a:5, a:6, a:7, a:8, a:9, a:10, a:11}\")); // But this one only goes to 10. assertSolutionExists( \"{fetch: {filter: {a:11}, node: {andSorted: {nodes: [\" \"{ixscan: {filter: null, pattern: {a:1}}},\" // 1 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 2 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 3 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 4 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 5 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 6 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 7 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 8 \"{ixscan: {filter: null, pattern: {a:1}}},\" // 9 \"{ixscan: {filter: null, pattern: {a:1}}}]}}}}\"); // 10 }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219692, "input": "static char * exif_get_tagname(int tag_num, char *ret, int len, tag_table_type tag_table) { int i, t; char tmp[32]; for (i = 0; (t = tag_table[i].Tag) != TAG_END_OF_LIST; i++) { if (t == tag_num) { if (ret && len) { string_copy(ret, tag_table[i].Desc, abs(len)); if (len < 0) { memset(ret + strlen(ret), ' ', -len - strlen(ret) - 1); ret[-len - 1] = '\\0'; } return ret; } return tag_table[i].Desc; } } if (ret && len) { snprintf(tmp, sizeof(tmp), \"UndefinedTag:0x%04X\", tag_num); string_copy(ret, tmp, abs(len)); if (len < 0) { memset(ret + strlen(ret), ' ', -len - strlen(ret) - 1); ret[-len - 1] = '\\0'; } return ret; } return \"\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 481068, "input": "static unsigned int xdr_align_pages(struct xdr_stream *xdr, unsigned int len) { struct xdr_buf *buf = xdr->buf; unsigned int nwords = XDR_QUADLEN(len); unsigned int copied; if (xdr->nwords == 0) return 0; xdr_realign_pages(xdr); if (nwords > xdr->nwords) { nwords = xdr->nwords; len = nwords << 2; } if (buf->page_len <= len) len = buf->page_len; else if (nwords < xdr->nwords) { /* Truncate page data and move it into the tail */ copied = xdr_shrink_pagelen(buf, len); trace_rpc_xdr_alignment(xdr, len, copied); } return len; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 468977, "input": "int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) { int err; err = __ip_local_out(net, sk, skb); if (likely(err == 1)) err = dst_output(net, sk, skb); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 346291, "input": "static int usb_host_info_device(void *opaque, int bus_num, int addr, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { usb_info_device(bus_num, addr, class_id, vendor_id, product_id, product_name, speed); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 428216, "input": "int init_aliases(void) { FILE *fp; char alias[MAXALIASLEN + 1U]; char dir[PATH_MAX + 1U]; if ((fp = fopen(ALIASES_FILE, \"r\")) == NULL) { return 0; } while (fgets(alias, sizeof alias, fp) != NULL) { if (*alias == '#' || *alias == '\\n' || *alias == 0) { continue; } { char * const z = alias + strlen(alias) - 1U; if (*z != '\\n') { goto bad; } *z = 0; } do { if (fgets(dir, sizeof dir, fp) == NULL || *dir == 0) { goto bad; } { char * const z = dir + strlen(dir) - 1U; if (*z == '\\n') { *z = 0; } } } while (*dir == '#' || *dir == 0); if (head == NULL) { if ((head = tail = malloc(sizeof *head)) == NULL || (tail->alias = strdup(alias)) == NULL || (tail->dir = strdup(dir)) == NULL) { die_mem(); } } else { DirAlias *curr; if ((curr = malloc(sizeof *curr)) == NULL || (curr->alias = strdup(alias)) == NULL || (curr->dir = strdup(dir)) == NULL) { die_mem(); } tail->next = curr; tail = curr; } tail->next = NULL; } fclose(fp); aliases_up++; return 0; bad: fclose(fp); logfile(LOG_ERR, MSG_ALIASES_BROKEN_FILE \" [\" ALIASES_FILE \"]\"); return -1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453701, "input": "static int tcos_list_files(sc_card_t *card, u8 *buf, size_t buflen) { sc_context_t *ctx; sc_apdu_t apdu; u8 rbuf[SC_MAX_APDU_BUFFER_SIZE], p1; int r, count = 0; assert(card != NULL); ctx = card->ctx; for (p1=1; p1<=2; p1++) { sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xAA, p1, 0); apdu.cla = 0x80; apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); apdu.le = 256; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, r, \"APDU transmit failed\"); if (apdu.sw1==0x6A && (apdu.sw2==0x82 || apdu.sw2==0x88)) continue; r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(ctx, r, \"List Dir failed\"); if (apdu.resplen > buflen) return SC_ERROR_BUFFER_TOO_SMALL; sc_log(ctx, \"got %\"SC_FORMAT_LEN_SIZE_T\"u %s-FileIDs\\n\", apdu.resplen / 2, p1 == 1 ? \"DF\" : \"EF\"); memcpy(buf, apdu.resp, apdu.resplen); buf += apdu.resplen; buflen -= apdu.resplen; count += apdu.resplen; } return count; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336797, "input": "fill_yin_unique(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, struct lys_unique *unique, struct unres_schema *unres) { struct ly_ctx *ctx = module->ctx; int i, j, ret = EXIT_FAILURE; const char *orig; char *value, *vaux, *start = NULL, c = 0; struct unres_list_uniq *unique_info; /* get unique value (list of leafs supposed to be unique */ GETVAL(ctx, orig, yin, \"tag\"); /* count the number of unique leafs in the value */ start = value = vaux = strdup(orig); LY_CHECK_ERR_GOTO(!vaux, LOGMEM(ctx), error); while ((vaux = strpbrk(vaux, \" \\t\\n\"))) { YIN_CHECK_ARRAY_OVERFLOW_CODE(ctx, unique->expr_size, unique->expr_size, \"referenced items\", \"unique\", unique->expr_size = 0; goto error); unique->expr_size++; while (isspace(*vaux)) { vaux++; } } unique->expr_size++; unique->expr = calloc(unique->expr_size, sizeof *unique->expr); LY_CHECK_ERR_GOTO(!unique->expr, LOGMEM(ctx), error); for (i = 0; i < unique->expr_size; i++) { vaux = strpbrk(value, \" \\t\\n\"); if (vaux) { c = *vaux; *vaux = '\\0'; } /* store token into unique structure */ unique->expr[i] = transform_schema2json(module, value); if (vaux) { *vaux = c; } /* check that the expression does not repeat */ for (j = 0; j < i; j++) { if (ly_strequal(unique->expr[j], unique->expr[i], 1)) { LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, unique->expr[i], \"unique\"); LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"The identifier is not unique\"); goto error; } } /* try to resolve leaf */ if (unres) { unique_info = malloc(sizeof *unique_info); LY_CHECK_ERR_GOTO(!unique_info, LOGMEM(ctx), error); unique_info->list = parent; unique_info->expr = unique->expr[i]; unique_info->trg_type = &unique->trg_type; if (unres_schema_add_node(module, unres, unique_info, UNRES_LIST_UNIQ, NULL) == -1){ goto error; } } else { if (resolve_unique(parent, unique->expr[i], &unique->trg_type)) { goto error; } } /* move to next token */ value = vaux; while (value && isspace(*value)) { value++; } } ret = EXIT_SUCCESS; error: free(start); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354738, "input": "void kvm_arch_crypto_clear_masks(struct kvm *kvm) { mutex_lock(&kvm->lock); kvm_s390_vcpu_block_all(kvm); memset(&kvm->arch.crypto.crycb->apcb0, 0, sizeof(kvm->arch.crypto.crycb->apcb0)); memset(&kvm->arch.crypto.crycb->apcb1, 0, sizeof(kvm->arch.crypto.crycb->apcb1)); VM_EVENT(kvm, 3, \"%s\", \"CLR CRYCB:\"); /* recreate the shadow crycb for each vcpu */ kvm_s390_sync_request_broadcast(kvm, KVM_REQ_VSIE_RESTART); kvm_s390_vcpu_unblock_all(kvm); mutex_unlock(&kvm->lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268909, "input": "R_API ut8* r_socket_slurp(RSocket *s, int *len) { int blockSize = 4096; ut8 *ptr, *buf = malloc (blockSize); if (!buf) { return NULL; } int copied = 0; if (len) { *len = 0; } for (;;) { int rc = r_socket_read (s, buf + copied, blockSize); if (rc > 0) { copied += rc; } ptr = realloc (buf, copied + blockSize); if (!ptr) { break; } buf = ptr; if (rc < 1) { break; } } if (copied == 0) { R_FREE (buf); } if (len) { *len = copied; } return buf; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 460766, "input": "getnextac(int c UNUSED, void *cookie, int indent UNUSED) { AutoPatCmd *acp = (AutoPatCmd *)cookie; char_u *retval; AutoCmd *ac; /* Can be called again after returning the last line. */ if (acp->curpat == NULL) return NULL; /* repeat until we find an autocommand to execute */ for (;;) { /* skip removed commands */ while (acp->nextcmd != NULL && acp->nextcmd->cmd == NULL) if (acp->nextcmd->last) acp->nextcmd = NULL; else acp->nextcmd = acp->nextcmd->next; if (acp->nextcmd != NULL) break; /* at end of commands, find next pattern that matches */ if (acp->curpat->last) acp->curpat = NULL; else acp->curpat = acp->curpat->next; if (acp->curpat != NULL) auto_next_pat(acp, TRUE); if (acp->curpat == NULL) return NULL; } ac = acp->nextcmd; if (p_verbose >= 9) { verbose_enter_scroll(); smsg((char_u *)_(\"autocommand %s\"), ac->cmd); msg_puts((char_u *)\"\\n\"); /* don't overwrite this either */ verbose_leave_scroll(); } retval = vim_strsave(ac->cmd); autocmd_nested = ac->nested; #ifdef FEAT_EVAL current_SID = ac->scriptID; #endif if (ac->last) acp->nextcmd = NULL; else acp->nextcmd = ac->next; return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244377, "input": "void PrintImportUsage() { u32 i; gf_sys_format_help(helpout, help_flags, \"# Importing Options\\n\" \"# File importing\\n\" \"Syntax is [-add]() / [-cat]() `filename[#FRAGMENT][:opt1...:optN=val]`\\n\" \"This process will create the destination file if not existing, and add the track(s) to it. If you wish to always create a new destination file, add [-new](MP4B_GEN).\\n\" \"The supported input media types depend on your installation, check [filters documentation](Filters) for more info.\\n\" \" \\n\" \"To select a desired media track from a source, a fragment identifier '#' can be specified, bfore any other options. The following syntax is used:\\n\" \"- `#video`: adds the first video track found in source\\n\" \"- `#audio`: adds the first audio track found in source\\n\" \"- `#auxv`: adds the first auxiliary video track found in source\\n\" \"- `#pict`: adds the first picture track found in source\\n\" \"- `#trackID=ID` or `#ID`: adds the specified track. For IsoMedia files, ID is the track ID. For other media files, ID is the value indicated by `MP4Box -info inputFile`\\n\" \"- `#pid=ID`: number of desired PID for MPEG-2 TS sources\\n\" \"- `#prog_id=ID`: number of desired program for MPEG-2 TS sources\\n\" \"- `#program=NAME`: name of desired program for MPEG-2 TS sources\\n\" \" \\n\" \"By default all imports are performed sequentially, and final interleaving is done at the end; this however requires a temporary file holding original ISOBMF file (if any) and added files before creating the final output. Since this can become quite large, it is possible to add media to a new file without temporary storage, using [-flat](MP4B_GEN) option, but this disables media interleaving.\\n\" \" \\n\" \"If you wish to create an interleaved new file with no temporary storage, use the [-newfs](MP4B_GEN) option. The interleaving might not be as precise as when using [-new]() since it is dependent on muxer input scheduling (each execution might lead to a slightly different result). Additionally in this mode: \\n\" \" - Some muxing options (marked with `X` below) will be activated for all inputs (e.g it is not possible to import one AVC track with `xps_inband` and another without).\\n\" \" - Some muxing options (marked as `D` below) cannot be used as they require temporary storage for file edition.\\n\" \" - Usage of [-cat]() is possible, but concatenated sources will not be interleaved in the output. If you wish to perforom more complex cat/add operations without temp file, use the [gpac application](Filters).\\n\" \" \\n\" \"Note: MP4Box cannot start importing from a random point in the input, it always import from the begining. If you wish to import from another point in the source, use the [gpac application](Filters).\\n\" \" \\n\" \"Note: When importing SRT or SUB files, MP4Box will choose default layout options to make the subtitle appear at the bottom of the video. You SHOULD NOT import such files before any video track is added to the destination file, otherwise the results will likelly not be useful (default SRT/SUB importing uses default serif font, fontSize 18 and display size 400x60). For more details, check [TTXT doc](Subtitling-with-GPAC).\\n\" \" \\n\" \"When importing several tracks/sources in one pass, all options will be applied if relevant to each source. These options are set for all imported streams. If you need to specify these options par stream, set per-file options using the syntax `-add stream[:opt1:...:optN]`. Allowed per-file options:\\n\\n\" ); i=0; while (ImportFileOpts[i].name) { GF_GPACArg *arg = &ImportFileOpts[i]; i++; gf_sys_print_arg(helpout, help_flags | GF_PRINTARG_NO_DASH, arg, \"mp4box-import\"); } gf_sys_format_help(helpout, help_flags, \"\\n\" \"Note: `sopt`, `dopt` and `@@f` must be placed after all other options.\\n\" \"# Global import options\\n\" ); i=0; while (m4b_imp_args[i].name) { GF_GPACArg *arg = &m4b_imp_args[i]; i++; gf_sys_print_arg(helpout, help_flags, arg, \"mp4box-import\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232557, "input": "static int adjust_subprog_starts_after_remove(struct bpf_verifier_env *env, u32 off, u32 cnt) { int i, j; /* find first prog starting at or after off (first to remove) */ for (i = 0; i < env->subprog_cnt; i++) if (env->subprog_info[i].start >= off) break; /* find first prog starting at or after off + cnt (first to stay) */ for (j = i; j < env->subprog_cnt; j++) if (env->subprog_info[j].start >= off + cnt) break; /* if j doesn't start exactly at off + cnt, we are just removing * the front of previous prog */ if (env->subprog_info[j].start != off + cnt) j--; if (j > i) { struct bpf_prog_aux *aux = env->prog->aux; int move; /* move fake 'exit' subprog as well */ move = env->subprog_cnt + 1 - j; memmove(env->subprog_info + i, env->subprog_info + j, sizeof(*env->subprog_info) * move); env->subprog_cnt -= j - i; /* remove func_info */ if (aux->func_info) { move = aux->func_info_cnt - j; memmove(aux->func_info + i, aux->func_info + j, sizeof(*aux->func_info) * move); aux->func_info_cnt -= j - i; /* func_info->insn_off is set after all code rewrites, * in adjust_btf_func() - no need to adjust */ } } else { /* convert i from \"first prog to remove\" to \"first to adjust\" */ if (env->subprog_info[i].start == off) i++; } /* update fake 'exit' subprog as well */ for (; i <= env->subprog_cnt; i++) env->subprog_info[i].start -= cnt; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 375197, "input": "static inline bool kill_as_cred_perm(const struct cred *cred, struct task_struct *target) { const struct cred *pcred = __task_cred(target); return uid_eq(cred->euid, pcred->suid) || uid_eq(cred->euid, pcred->uid) || uid_eq(cred->uid, pcred->suid) || uid_eq(cred->uid, pcred->uid); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416762, "input": "static void cil_reset_classmapping(struct cil_classmapping *cm) { cil_reset_classperms_list(cm->classperms); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219281, "input": "explicit operator std::string () const { return toCppString(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281435, "input": "gen12_csb_parse(const struct intel_engine_execlists *execlists, const u32 *csb) { u32 lower_dw = csb[0]; u32 upper_dw = csb[1]; bool ctx_to_valid = GEN12_CSB_CTX_VALID(lower_dw); bool ctx_away_valid = GEN12_CSB_CTX_VALID(upper_dw); bool new_queue = lower_dw & GEN12_CTX_STATUS_SWITCHED_TO_NEW_QUEUE; /* * The context switch detail is not guaranteed to be 5 when a preemption * occurs, so we can't just check for that. The check below works for * all the cases we care about, including preemptions of WAIT * instructions and lite-restore. Preempt-to-idle via the CTRL register * would require some extra handling, but we don't support that. */ if (!ctx_away_valid || new_queue) { GEM_BUG_ON(!ctx_to_valid); return true; } /* * switch detail = 5 is covered by the case above and we do not expect a * context switch on an unsuccessful wait instruction since we always * use polling mode. */ GEM_BUG_ON(GEN12_CTX_SWITCH_DETAIL(upper_dw)); return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293107, "input": "static int zipfileBufferGrow(ZipfileBuffer *pBuf, int nByte){ if( pBuf->n+nByte>pBuf->nAlloc ){ u8 *aNew; sqlite3_int64 nNew = pBuf->n ? pBuf->n*2 : 512; int nReq = pBuf->n + nByte; while( nNewa, nNew); if( aNew==0 ) return SQLITE_NOMEM; pBuf->a = aNew; pBuf->nAlloc = (int)nNew; } return SQLITE_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 254704, "input": "static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field) { switch (PB_LTYPE(field->type)) { case PB_LTYPE_BOOL: if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_dec_bool(stream, field); case PB_LTYPE_VARINT: case PB_LTYPE_UVARINT: case PB_LTYPE_SVARINT: if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_dec_varint(stream, field); case PB_LTYPE_FIXED32: if (wire_type != PB_WT_32BIT && wire_type != PB_WT_PACKED) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_decode_fixed32(stream, field->pData); case PB_LTYPE_FIXED64: if (wire_type != PB_WT_64BIT && wire_type != PB_WT_PACKED) PB_RETURN_ERROR(stream, \"wrong wire type\"); #ifdef PB_CONVERT_DOUBLE_FLOAT if (field->data_size == sizeof(float)) { return pb_decode_double_as_float(stream, (float*)field->pData); } #endif #ifdef PB_WITHOUT_64BIT PB_RETURN_ERROR(stream, \"invalid data_size\"); #else return pb_decode_fixed64(stream, field->pData); #endif case PB_LTYPE_BYTES: if (wire_type != PB_WT_STRING) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_dec_bytes(stream, field); case PB_LTYPE_STRING: if (wire_type != PB_WT_STRING) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_dec_string(stream, field); case PB_LTYPE_SUBMESSAGE: case PB_LTYPE_SUBMSG_W_CB: if (wire_type != PB_WT_STRING) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_dec_submessage(stream, field); case PB_LTYPE_FIXED_LENGTH_BYTES: if (wire_type != PB_WT_STRING) PB_RETURN_ERROR(stream, \"wrong wire type\"); return pb_dec_fixed_length_bytes(stream, field); default: PB_RETURN_ERROR(stream, \"invalid field type\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273249, "input": "CommandPass(Module* parent) : SplitCommand(parent, \"PASS\", 1, 1) { works_before_reg = true; Penalty = 0; syntax = \"\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499699, "input": "disk_empty_output_buffer (int out_des, bool flush) { ssize_t bytes_written; if (swapping_halfwords || swapping_bytes) { if (swapping_halfwords) { int complete_words; complete_words = output_size / 4; swahw_array (output_buffer, complete_words); if (swapping_bytes) swab_array (output_buffer, 2 * complete_words); } else { int complete_halfwords; complete_halfwords = output_size /2; swab_array (output_buffer, complete_halfwords); } } if (sparse_flag) bytes_written = sparse_write (out_des, output_buffer, output_size, flush); else bytes_written = write (out_des, output_buffer, output_size); if (bytes_written != output_size) { if (bytes_written == -1) error (PAXEXIT_FAILURE, errno, _(\"write error\")); else error (PAXEXIT_FAILURE, 0, _(\"write error: partial write\")); } output_bytes += output_size; out_buff = output_buffer; output_size = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269795, "input": "bool WebContents::IsOffScreen() const { #if BUILDFLAG(ENABLE_OSR) return type_ == Type::OFF_SCREEN; #else return false; #endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281555, "input": "static void __execlists_submission_tasklet(struct intel_engine_cs *const engine) { lockdep_assert_held(&engine->active.lock); if (!engine->execlists.pending[0]) { rcu_read_lock(); /* protect peeking at execlists->active */ execlists_dequeue(engine); rcu_read_unlock(); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196884, "input": "void M_LoadDefaults (void) { int i; int len; FILE* f; char def[80]; char strparm[100]; char* newstring; int parm; boolean isstring; // set everything to base values numdefaults = sizeof(defaults)/sizeof(defaults[0]); for (i=0 ; isignature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); clone_image=CloneImage(image,0,0,MagickTrue,exception); if (clone_image == (Image *) NULL) return((Image *) NULL); if (IsGrayColorspace(image->colorspace) != MagickFalse) (void) SetImageColorspace(clone_image,sRGBColorspace); (void) SetImageVirtualPixelMethod(clone_image,EdgeVirtualPixelMethod); clone_image->compose=OverCompositeOp; border_info.width=(size_t) floor(2.0*sigma+0.5); border_info.height=(size_t) floor(2.0*sigma+0.5); border_info.x=0; border_info.y=0; (void) QueryColorDatabase(\"none\",&clone_image->border_color,exception); border_image=BorderImage(clone_image,&border_info,exception); clone_image=DestroyImage(clone_image); if (border_image == (Image *) NULL) return((Image *) NULL); if (border_image->matte == MagickFalse) (void) SetImageAlphaChannel(border_image,OpaqueAlphaChannel); /* Shadow image. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(border_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \\ magick_number_threads(border_image,border_image,border_image->rows,1) #endif for (y=0; y < (ssize_t) border_image->rows; y++) { PixelPacket *magick_restrict q; ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,border_image->columns,1, exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) border_image->columns; x++) { SetPixelRed(q,border_image->background_color.red); SetPixelGreen(q,border_image->background_color.green); SetPixelBlue(q,border_image->background_color.blue); if (border_image->matte == MagickFalse) SetPixelOpacity(q,border_image->background_color.opacity); else SetPixelOpacity(q,ClampToQuantum((double) (QuantumRange- GetPixelAlpha(q)*opacity/100.0))); q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,ShadowImageTag,progress, border_image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); shadow_image=BlurImageChannel(border_image,AlphaChannel,0.0,sigma,exception); border_image=DestroyImage(border_image); if (shadow_image == (Image *) NULL) return((Image *) NULL); if (shadow_image->page.width == 0) shadow_image->page.width=shadow_image->columns; if (shadow_image->page.height == 0) shadow_image->page.height=shadow_image->rows; shadow_image->page.width+=x_offset-(ssize_t) border_info.width; shadow_image->page.height+=y_offset-(ssize_t) border_info.height; shadow_image->page.x+=x_offset-(ssize_t) border_info.width; shadow_image->page.y+=y_offset-(ssize_t) border_info.height; return(shadow_image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 356724, "input": "sudoers_policy_store_result(bool accepted, char *argv[], char *envp[], mode_t cmnd_umask, char *iolog_path, void *v) { struct sudoers_exec_args *exec_args = v; char **command_info; int info_len = 0; debug_decl(sudoers_policy_store_result, SUDOERS_DEBUG_PLUGIN); if (exec_args == NULL) debug_return_bool(true); /* nothing to do */ /* Increase the length of command_info as needed, it is *not* checked. */ command_info = calloc(55, sizeof(char *)); if (command_info == NULL) goto oom; if (safe_cmnd != NULL) { command_info[info_len] = sudo_new_key_val(\"command\", safe_cmnd); if (command_info[info_len++] == NULL) goto oom; } if (def_log_input || def_log_output) { if (iolog_path) command_info[info_len++] = iolog_path; /* now owned */ if (def_log_input) { if ((command_info[info_len++] = strdup(\"iolog_stdin=true\")) == NULL) goto oom; if ((command_info[info_len++] = strdup(\"iolog_ttyin=true\")) == NULL) goto oom; } if (def_log_output) { if ((command_info[info_len++] = strdup(\"iolog_stdout=true\")) == NULL) goto oom; if ((command_info[info_len++] = strdup(\"iolog_stderr=true\")) == NULL) goto oom; if ((command_info[info_len++] = strdup(\"iolog_ttyout=true\")) == NULL) goto oom; } if (def_compress_io) { if ((command_info[info_len++] = strdup(\"iolog_compress=true\")) == NULL) goto oom; } if (def_iolog_flush) { if ((command_info[info_len++] = strdup(\"iolog_flush=true\")) == NULL) goto oom; } if (def_maxseq != NULL) { if (asprintf(&command_info[info_len++], \"maxseq=%s\", def_maxseq) == -1) goto oom; } } if (ISSET(sudo_mode, MODE_EDIT)) { if ((command_info[info_len++] = strdup(\"sudoedit=true\")) == NULL) goto oom; if (!def_sudoedit_checkdir) { if ((command_info[info_len++] = strdup(\"sudoedit_checkdir=false\")) == NULL) goto oom; } if (def_sudoedit_follow) { if ((command_info[info_len++] = strdup(\"sudoedit_follow=true\")) == NULL) goto oom; } } if (def_runcwd && strcmp(def_runcwd, \"*\") != 0) { /* Set cwd to explicit value in sudoers. */ if (!expand_tilde(&def_runcwd, runas_pw->pw_name)) { sudo_warnx(U_(\"invalid working directory: %s\"), def_runcwd); goto bad; } if ((command_info[info_len++] = sudo_new_key_val(\"cwd\", def_runcwd)) == NULL) goto oom; } else if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) { /* Set cwd to run user's homedir. */ if ((command_info[info_len++] = sudo_new_key_val(\"cwd\", runas_pw->pw_dir)) == NULL) goto oom; if ((command_info[info_len++] = strdup(\"cwd_optional=true\")) == NULL) goto oom; } if ((command_info[info_len++] = sudo_new_key_val(\"runas_user\", runas_pw->pw_name)) == NULL) goto oom; if (runas_gr != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"runas_group\", runas_gr->gr_name)) == NULL) goto oom; } if (def_stay_setuid) { if (asprintf(&command_info[info_len++], \"runas_uid=%u\", (unsigned int)user_uid) == -1) goto oom; if (asprintf(&command_info[info_len++], \"runas_gid=%u\", (unsigned int)user_gid) == -1) goto oom; if (asprintf(&command_info[info_len++], \"runas_euid=%u\", (unsigned int)runas_pw->pw_uid) == -1) goto oom; if (asprintf(&command_info[info_len++], \"runas_egid=%u\", runas_gr ? (unsigned int)runas_gr->gr_gid : (unsigned int)runas_pw->pw_gid) == -1) goto oom; } else { if (asprintf(&command_info[info_len++], \"runas_uid=%u\", (unsigned int)runas_pw->pw_uid) == -1) goto oom; if (asprintf(&command_info[info_len++], \"runas_gid=%u\", runas_gr ? (unsigned int)runas_gr->gr_gid : (unsigned int)runas_pw->pw_gid) == -1) goto oom; } if (def_preserve_groups) { if ((command_info[info_len++] = strdup(\"preserve_groups=true\")) == NULL) goto oom; } else { int i, len; gid_t egid; size_t glsize; char *cp, *gid_list; struct gid_list *gidlist; /* Only use results from a group db query, not the front end. */ gidlist = sudo_get_gidlist(runas_pw, ENTRY_TYPE_QUERIED); /* We reserve an extra spot in the list for the effective gid. */ glsize = sizeof(\"runas_groups=\") - 1 + ((gidlist->ngids + 1) * (MAX_UID_T_LEN + 1)); gid_list = malloc(glsize); if (gid_list == NULL) goto oom; memcpy(gid_list, \"runas_groups=\", sizeof(\"runas_groups=\") - 1); cp = gid_list + sizeof(\"runas_groups=\") - 1; /* On BSD systems the effective gid is the first group in the list. */ egid = runas_gr ? (unsigned int)runas_gr->gr_gid : (unsigned int)runas_pw->pw_gid; len = snprintf(cp, glsize - (cp - gid_list), \"%u\", (unsigned int)egid); if (len < 0 || (size_t)len >= glsize - (cp - gid_list)) { sudo_warnx(U_(\"internal error, %s overflow\"), __func__); free(gid_list); goto bad; } cp += len; for (i = 0; i < gidlist->ngids; i++) { if (gidlist->gids[i] != egid) { len = snprintf(cp, glsize - (cp - gid_list), \",%u\", (unsigned int) gidlist->gids[i]); if (len < 0 || (size_t)len >= glsize - (cp - gid_list)) { sudo_warnx(U_(\"internal error, %s overflow\"), __func__); free(gid_list); goto bad; } cp += len; } } command_info[info_len++] = gid_list; sudo_gidlist_delref(gidlist); } if (def_closefrom >= 0) { if (asprintf(&command_info[info_len++], \"closefrom=%d\", def_closefrom) == -1) goto oom; } if (def_ignore_iolog_errors) { if ((command_info[info_len++] = strdup(\"ignore_iolog_errors=true\")) == NULL) goto oom; } if (def_noexec) { if ((command_info[info_len++] = strdup(\"noexec=true\")) == NULL) goto oom; } if (def_exec_background) { if ((command_info[info_len++] = strdup(\"exec_background=true\")) == NULL) goto oom; } if (def_set_utmp) { if ((command_info[info_len++] = strdup(\"set_utmp=true\")) == NULL) goto oom; } if (def_use_pty) { if ((command_info[info_len++] = strdup(\"use_pty=true\")) == NULL) goto oom; } if (def_utmp_runas) { if ((command_info[info_len++] = sudo_new_key_val(\"utmp_user\", runas_pw->pw_name)) == NULL) goto oom; } if (def_iolog_mode != (S_IRUSR|S_IWUSR)) { if (asprintf(&command_info[info_len++], \"iolog_mode=0%o\", (unsigned int)def_iolog_mode) == -1) goto oom; } if (def_iolog_user != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"iolog_user\", def_iolog_user)) == NULL) goto oom; } if (def_iolog_group != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"iolog_group\", def_iolog_group)) == NULL) goto oom; } if (!SLIST_EMPTY(&def_log_servers)) { char *log_servers = serialize_list(\"log_servers\", &def_log_servers); if (log_servers == NULL) goto oom; command_info[info_len++] = log_servers; if (asprintf(&command_info[info_len++], \"log_server_timeout=%u\", def_log_server_timeout) == -1) goto oom; } if ((command_info[info_len++] = sudo_new_key_val(\"log_server_keepalive\", def_log_server_keepalive ? \"true\" : \"false\")) == NULL) goto oom; if ((command_info[info_len++] = sudo_new_key_val(\"log_server_verify\", def_log_server_verify ? \"true\" : \"false\")) == NULL) goto oom; if (def_log_server_cabundle != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"log_server_cabundle\", def_log_server_cabundle)) == NULL) goto oom; } if (def_log_server_peer_cert != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"log_server_peer_cert\", def_log_server_peer_cert)) == NULL) goto oom; } if (def_log_server_peer_key != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"log_server_peer_key\", def_log_server_peer_key)) == NULL) goto oom; } if (def_command_timeout > 0 || user_timeout > 0) { int timeout = user_timeout; if (timeout == 0 || def_command_timeout < timeout) timeout = def_command_timeout; if (asprintf(&command_info[info_len++], \"timeout=%u\", timeout) == -1) goto oom; } if (def_runchroot != NULL && strcmp(def_runchroot, \"*\") != 0) { if (!expand_tilde(&def_runchroot, runas_pw->pw_name)) { sudo_warnx(U_(\"invalid chroot directory: %s\"), def_runchroot); goto bad; } if ((command_info[info_len++] = sudo_new_key_val(\"chroot\", def_runchroot)) == NULL) goto oom; } if (cmnd_umask != ACCESSPERMS) { if (asprintf(&command_info[info_len++], \"umask=0%o\", (unsigned int)cmnd_umask) == -1) goto oom; } if (force_umask) { if ((command_info[info_len++] = strdup(\"umask_override=true\")) == NULL) goto oom; } if (cmnd_fd != -1) { if (sudo_version < SUDO_API_MKVERSION(1, 9)) { /* execfd only supported by plugin API 1.9 and higher */ close(cmnd_fd); cmnd_fd = -1; } else { if (asprintf(&command_info[info_len++], \"execfd=%d\", cmnd_fd) == -1) goto oom; } } #ifdef HAVE_LOGIN_CAP_H if (def_use_loginclass) { if ((command_info[info_len++] = sudo_new_key_val(\"login_class\", login_class)) == NULL) goto oom; } #endif /* HAVE_LOGIN_CAP_H */ #ifdef HAVE_SELINUX if (def_selinux && user_role != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"selinux_role\", user_role)) == NULL) goto oom; } if (def_selinux && user_type != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"selinux_type\", user_type)) == NULL) goto oom; } #endif /* HAVE_SELINUX */ #ifdef HAVE_PRIV_SET if (runas_privs != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"runas_privs\", runas_privs)) == NULL) goto oom; } if (runas_limitprivs != NULL) { if ((command_info[info_len++] = sudo_new_key_val(\"runas_limitprivs\", runas_limitprivs)) == NULL) goto oom; } #endif /* HAVE_SELINUX */ /* Free on exit; they are not available in the close function. */ sudoers_gc_add(GC_VECTOR, envp); sudoers_gc_add(GC_VECTOR, command_info); /* Fill in exec environment info. */ *(exec_args->argv) = argv; *(exec_args->envp) = envp; *(exec_args->info) = command_info; debug_return_bool(true); oom: sudo_warnx(U_(\"%s: %s\"), __func__, U_(\"unable to allocate memory\")); bad: free(audit_msg); audit_msg = NULL; while (info_len--) free(command_info[info_len]); free(command_info); debug_return_bool(false); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 241533, "input": "void Compute(OpKernelContext* context) override { const Tensor& input_sizes = context->input(0); const Tensor& filter = context->input(1); const Tensor& out_backprop = context->input(2); TensorShape input_shape; OP_REQUIRES_OK(context, Conv2DBackpropComputeInputShape(input_sizes, filter.shape(), out_backprop.shape(), data_format_, &input_shape)); Tensor* in_backprop = nullptr; OP_REQUIRES_OK(context, context->allocate_output(0, input_shape, &in_backprop)); // If there is nothing to compute, return. if (input_shape.num_elements() == 0) { return; } // For now we take the stride from the second and third dimensions only (we // do not support striding on the batch or depth dimension). const int stride_rows = GetTensorDim(strides_, data_format_, 'H'); const int stride_cols = GetTensorDim(strides_, data_format_, 'W'); const int dilation_rows = GetTensorDim(dilations_, data_format_, 'H'); const int dilation_cols = GetTensorDim(dilations_, data_format_, 'W'); VLOG(2) << \"Conv2DBackpropInput:\" << \" input: \" << input_shape.DebugString() << \" filter:\" << filter.shape().DebugString() << \" out_backprop: \" << out_backprop.shape().DebugString() << \" strides: [\" << stride_rows << \", \" << stride_cols << \"]\" << \" dilations: [\" << dilation_rows << \", \" << dilation_cols << \"]\"; LaunchConv2DBackpropInputOp launch; launch(context, use_cudnn_, cudnn_use_autotune_, out_backprop, filter, dilation_rows, dilation_cols, stride_rows, stride_cols, padding_, explicit_paddings_, in_backprop, data_format_); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506487, "input": "test_command() { int what; int save_token = c_token++; if (!term) /* unknown terminal */ int_error(c_token, \"use 'set term' to set terminal type first\"); what = lookup_table(&test_tbl[0], c_token); switch (what) { default: if (!END_OF_COMMAND) int_error(c_token, \"unrecognized test option\"); /* otherwise fall through to test_term */ case TEST_TERMINAL: test_term(); break; case TEST_PALETTE: test_palette_subcommand(); break; } /* prevent annoying error messages if there was no previous plot */ /* and the \"test\" window is resized. */ if (!replot_line || !(*replot_line)) { m_capture( &replot_line, save_token, c_token ); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378681, "input": "static void rankStepFunc( sqlite3_context *pCtx, int nArg, sqlite3_value **apArg ){ struct CallCount *p; p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ){ p->nStep++; if( p->nValue==0 ){ p->nValue = p->nStep; } } UNUSED_PARAMETER(nArg); UNUSED_PARAMETER(apArg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268980, "input": "R_API int r_str_replace_char_once(char *s, int a, int b) { return r_str_replace_ch (s, a, b, false); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219353, "input": "static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad) { register char *s = nullptr; char *p, *rve, c; size_t siz; if (ndigit < 0) { siz = -ndigit + 1; } else { siz = ndigit + 1; } /* __dtoa() doesn't allocate space for 0 so we do it by hand */ if (value == 0.0) { *decpt = 1 - fmode; /* 1 for 'e', 0 for 'f' */ *sign = 0; if ((rve = s = (char *)malloc(ndigit?siz:2)) == nullptr) { return(nullptr); } *rve++ = '0'; *rve = '\\0'; if (!ndigit) { return(s); } } else { p = zend_dtoa(value, fmode + 2, ndigit, decpt, sign, &rve); if (*decpt == 9999) { /* Infinity or Nan, convert to inf or nan like printf */ *decpt = 0; c = *p; zend_freedtoa(p); return strdup(c == 'I' ? \"INF\" : \"NAN\"); } /* Make a local copy and adjust rve to be in terms of s */ if (pad && fmode) { siz += *decpt; } if ((s = (char *)malloc(siz+1)) == nullptr) { zend_freedtoa(p); return(nullptr); } (void)string_copy(s, p, siz); rve = s + (rve - p); zend_freedtoa(p); } /* Add trailing zeros */ if (pad) { siz -= rve - s; while (--siz) { *rve++ = '0'; } *rve = '\\0'; } return(s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446374, "input": "static int chrdev_open(struct inode *inode, struct file *filp) { const struct file_operations *fops; struct cdev *p; struct cdev *new = NULL; int ret = 0; spin_lock(&cdev_lock); p = inode->i_cdev; if (!p) { struct kobject *kobj; int idx; spin_unlock(&cdev_lock); kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx); if (!kobj) return -ENXIO; new = container_of(kobj, struct cdev, kobj); spin_lock(&cdev_lock); /* Check i_cdev again in case somebody beat us to it while we dropped the lock. */ p = inode->i_cdev; if (!p) { inode->i_cdev = p = new; list_add(&inode->i_devices, &p->list); new = NULL; } else if (!cdev_get(p)) ret = -ENXIO; } else if (!cdev_get(p)) ret = -ENXIO; spin_unlock(&cdev_lock); cdev_put(new); if (ret) return ret; ret = -ENXIO; fops = fops_get(p->ops); if (!fops) goto out_cdev_put; replace_fops(filp, fops); if (filp->f_op->open) { ret = filp->f_op->open(inode, filp); if (ret) goto out_cdev_put; } return 0; out_cdev_put: cdev_put(p); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 205900, "input": "unsigned long perf_instruction_pointer(struct pt_regs *regs) { bool use_siar = regs_use_siar(regs); unsigned long siar = mfspr(SPRN_SIAR); if (ppmu->flags & PPMU_P10_DD1) { if (siar) return siar; else return regs->nip; } else if (use_siar && siar_valid(regs)) return mfspr(SPRN_SIAR) + perf_ip_adjust(regs); else if (use_siar) return 0; // no valid instruction pointer else return regs->nip; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NULL Pointer Dereference"], "explanation": "arch/powerpc/perf/core-book3s.c in the Linux kernel before 5.12.13, on systems with perf_event_paranoid=-1 and no specific PMU driver support registered, allows local users to cause a denial of service (perf_instruction_pointer NULL pointer dereference and OOPS) via a \"perf record\" command.", "severity_level": "NoInfo", "cwe": "CWE-476", "cve": "CVE-2021-38200"}} -{"idx": 281448, "input": "static void execlists_reset_prepare(struct intel_engine_cs *engine) { struct intel_engine_execlists * const execlists = &engine->execlists; unsigned long flags; GEM_TRACE(\"%s: depth<-%d\\n\", engine->name, atomic_read(&execlists->tasklet.count)); /* * Prevent request submission to the hardware until we have * completed the reset in i915_gem_reset_finish(). If a request * is completed by one engine, it may then queue a request * to a second via its execlists->tasklet *just* as we are * calling engine->resume() and also writing the ELSP. * Turning off the execlists->tasklet until the reset is over * prevents the race. */ __tasklet_disable_sync_once(&execlists->tasklet); GEM_BUG_ON(!reset_in_progress(execlists)); /* And flush any current direct submission. */ spin_lock_irqsave(&engine->active.lock, flags); spin_unlock_irqrestore(&engine->active.lock, flags); /* * We stop engines, otherwise we might get failed reset and a * dead gpu (on elk). Also as modern gpu as kbl can suffer * from system hang if batchbuffer is progressing when * the reset is issued, regardless of READY_TO_RESET ack. * Thus assume it is best to stop engines on all gens * where we have a gpu reset. * * WaKBLVECSSemaphoreWaitPoll:kbl (on ALL_ENGINES) * * FIXME: Wa for more modern gens needs to be validated */ intel_engine_stop_cs(engine); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 259622, "input": "Status RemapVectorToMap(const TTypes::Vec& remapping, std::vector* id_present, std::unordered_map* old_id_to_new_id) { id_present->clear(); id_present->resize(remapping.size(), false); for (int i = 0; i < remapping.size(); ++i) { const int64 old_id = remapping(i); if (old_id < 0) continue; (*id_present)[i] = true; if (!gtl::InsertIfNotPresent(old_id_to_new_id, old_id, i)) { return errors::Unimplemented( strings::StrCat(\"Old ID \", old_id, \" is mapped to both new ID \", old_id_to_new_id->at(old_id), \" and \", i, \", which is not supported.\")); } } return Status::OK(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232980, "input": "virtio_reset_dev(struct virtio_base *base) { struct virtio_vq_info *vq; int i, nvq; /* if (base->mtx) */ /* assert(pthread_mutex_isowned_np(base->mtx)); */ acrn_timer_deinit(&base->polling_timer); base->polling_in_progress = 0; nvq = base->vops->nvq; for (vq = base->queues, i = 0; i < nvq; vq++, i++) { vq->flags = 0; vq->last_avail = 0; vq->save_used = 0; vq->pfn = 0; vq->msix_idx = VIRTIO_MSI_NO_VECTOR; vq->gpa_desc[0] = 0; vq->gpa_desc[1] = 0; vq->gpa_avail[0] = 0; vq->gpa_avail[1] = 0; vq->gpa_used[0] = 0; vq->gpa_used[1] = 0; vq->enabled = 0; } base->negotiated_caps = 0; base->curq = 0; /* base->status = 0; -- redundant */ if (base->isr) pci_lintr_deassert(base->dev); base->isr = 0; base->msix_cfg_idx = VIRTIO_MSI_NO_VECTOR; base->device_feature_select = 0; base->driver_feature_select = 0; base->config_generation = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514786, "input": "int ram_block_coordinated_discard_require(bool state) { int ret = 0; ram_block_discard_disable_mutex_lock(); if (!state) { ram_block_coordinated_discard_required_cnt--; } else if (ram_block_discard_disabled_cnt) { ret = -EBUSY; } else { ram_block_coordinated_discard_required_cnt++; } ram_block_discard_disable_mutex_unlock(); return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398196, "input": "void sctp_put_port(struct sock *sk) { local_bh_disable(); __sctp_put_port(sk); local_bh_enable(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499998, "input": "int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) { #ifdef CONFIG_X86_IO_APIC if (use_pci_vector() && !platform_legacy_irq(gsi)) *irq = IO_APIC_VECTOR(gsi); else #endif *irq = gsi_irq_sharing(gsi); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204323, "input": "sudoers_policy_deserialize_info(void *v) { struct sudoers_open_info *info = v; char * const *cur; const char *p, *errstr, *groups = NULL; const char *remhost = NULL; int flags = 0; debug_decl(sudoers_policy_deserialize_info, SUDOERS_DEBUG_PLUGIN); #define MATCHES(s, v) \\ (strncmp((s), (v), sizeof(v) - 1) == 0) #define INVALID(v) do { \\ sudo_warn(U_(\"invalid %.*s set by sudo front-end\"), \\ (int)(sizeof(v) - 2), (v)); \\ } while (0) #define CHECK(s, v) do { \\ if ((s)[sizeof(v) - 1] == '\\0') { \\ INVALID(v); \\ goto bad; \\ } \\ } while (0) if (sudo_gettime_real(&sudo_user.submit_time) == -1) { sudo_warn(\"%s\", U_(\"unable to get time of day\")); goto bad; } /* Parse sudo.conf plugin args. */ if (info->plugin_args != NULL) { for (cur = info->plugin_args; *cur != NULL; cur++) { if (MATCHES(*cur, \"error_recovery=\")) { int val = sudo_strtobool(*cur + sizeof(\"error_recovery=\") - 1); if (val == -1) { INVALID(\"error_recovery=\"); /* Not a fatal error. */ } else { sudoers_recovery = val; } continue; } if (MATCHES(*cur, \"sudoers_file=\")) { CHECK(*cur, \"sudoers_file=\"); sudoers_file = *cur + sizeof(\"sudoers_file=\") - 1; continue; } if (MATCHES(*cur, \"sudoers_uid=\")) { p = *cur + sizeof(\"sudoers_uid=\") - 1; sudoers_uid = (uid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"sudoers_gid=\")) { p = *cur + sizeof(\"sudoers_gid=\") - 1; sudoers_gid = (gid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"sudoers_mode=\")) { p = *cur + sizeof(\"sudoers_mode=\") - 1; sudoers_mode = sudo_strtomode(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"ldap_conf=\")) { CHECK(*cur, \"ldap_conf=\"); path_ldap_conf = *cur + sizeof(\"ldap_conf=\") - 1; continue; } if (MATCHES(*cur, \"ldap_secret=\")) { CHECK(*cur, \"ldap_secret=\"); path_ldap_secret = *cur + sizeof(\"ldap_secret=\") - 1; continue; } } } /* Parse command line settings. */ user_closefrom = -1; for (cur = info->settings; *cur != NULL; cur++) { if (MATCHES(*cur, \"closefrom=\")) { errno = 0; p = *cur + sizeof(\"closefrom=\") - 1; user_closefrom = sudo_strtonum(p, 3, INT_MAX, &errstr); if (user_closefrom == 0) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"cmnd_chroot=\")) { CHECK(*cur, \"cmnd_chroot=\"); user_runchroot = *cur + sizeof(\"cmnd_chroot=\") - 1; continue; } if (MATCHES(*cur, \"cmnd_cwd=\")) { CHECK(*cur, \"cmnd_cwd=\"); user_runcwd = *cur + sizeof(\"cmnd_cwd=\") - 1; continue; } if (MATCHES(*cur, \"runas_user=\")) { CHECK(*cur, \"runas_user=\"); sudo_user.runas_user = *cur + sizeof(\"runas_user=\") - 1; SET(sudo_user.flags, RUNAS_USER_SPECIFIED); continue; } if (MATCHES(*cur, \"runas_group=\")) { CHECK(*cur, \"runas_group=\"); sudo_user.runas_group = *cur + sizeof(\"runas_group=\") - 1; SET(sudo_user.flags, RUNAS_GROUP_SPECIFIED); continue; } if (MATCHES(*cur, \"prompt=\")) { /* Allow epmpty prompt. */ user_prompt = *cur + sizeof(\"prompt=\") - 1; def_passprompt_override = true; continue; } if (MATCHES(*cur, \"set_home=\")) { if (parse_bool(*cur, sizeof(\"set_home\") - 1, &flags, MODE_RESET_HOME) == -1) goto bad; continue; } if (MATCHES(*cur, \"preserve_environment=\")) { if (parse_bool(*cur, sizeof(\"preserve_environment\") - 1, &flags, MODE_PRESERVE_ENV) == -1) goto bad; continue; } if (MATCHES(*cur, \"run_shell=\")) { if (parse_bool(*cur, sizeof(\"run_shell\") -1, &flags, MODE_SHELL) == -1) goto bad; continue; } if (MATCHES(*cur, \"login_shell=\")) { if (parse_bool(*cur, sizeof(\"login_shell\") - 1, &flags, MODE_LOGIN_SHELL) == -1) goto bad; continue; } if (MATCHES(*cur, \"implied_shell=\")) { if (parse_bool(*cur, sizeof(\"implied_shell\") - 1, &flags, MODE_IMPLIED_SHELL) == -1) goto bad; continue; } if (MATCHES(*cur, \"preserve_groups=\")) { if (parse_bool(*cur, sizeof(\"preserve_groups\") - 1, &flags, MODE_PRESERVE_GROUPS) == -1) goto bad; continue; } if (MATCHES(*cur, \"ignore_ticket=\")) { if (parse_bool(*cur, sizeof(\"ignore_ticket\") -1, &flags, MODE_IGNORE_TICKET) == -1) goto bad; continue; } if (MATCHES(*cur, \"noninteractive=\")) { if (parse_bool(*cur, sizeof(\"noninteractive\") - 1, &flags, MODE_NONINTERACTIVE) == -1) goto bad; continue; } if (MATCHES(*cur, \"sudoedit=\")) { if (parse_bool(*cur, sizeof(\"sudoedit\") - 1, &flags, MODE_EDIT) == -1) goto bad; continue; } if (MATCHES(*cur, \"login_class=\")) { CHECK(*cur, \"login_class=\"); login_class = *cur + sizeof(\"login_class=\") - 1; def_use_loginclass = true; continue; } #ifdef HAVE_PRIV_SET if (MATCHES(*cur, \"runas_privs=\")) { CHECK(*cur, \"runas_privs=\"); def_privs = *cur + sizeof(\"runas_privs=\") - 1; continue; } if (MATCHES(*cur, \"runas_limitprivs=\")) { CHECK(*cur, \"runas_limitprivs=\"); def_limitprivs = *cur + sizeof(\"runas_limitprivs=\") - 1; continue; } #endif /* HAVE_PRIV_SET */ #ifdef HAVE_SELINUX if (MATCHES(*cur, \"selinux_role=\")) { CHECK(*cur, \"selinux_role=\"); user_role = *cur + sizeof(\"selinux_role=\") - 1; continue; } if (MATCHES(*cur, \"selinux_type=\")) { CHECK(*cur, \"selinux_type=\"); user_type = *cur + sizeof(\"selinux_type=\") - 1; continue; } #endif /* HAVE_SELINUX */ #ifdef HAVE_BSD_AUTH_H if (MATCHES(*cur, \"bsdauth_type=\")) { CHECK(*cur, \"login_style=\"); login_style = *cur + sizeof(\"bsdauth_type=\") - 1; continue; } #endif /* HAVE_BSD_AUTH_H */ if (MATCHES(*cur, \"network_addrs=\")) { interfaces_string = *cur + sizeof(\"network_addrs=\") - 1; if (!set_interfaces(interfaces_string)) { sudo_warn(\"%s\", U_(\"unable to parse network address list\")); goto bad; } continue; } if (MATCHES(*cur, \"max_groups=\")) { errno = 0; p = *cur + sizeof(\"max_groups=\") - 1; sudo_user.max_groups = sudo_strtonum(p, 1, INT_MAX, &errstr); if (sudo_user.max_groups == 0) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"remote_host=\")) { CHECK(*cur, \"remote_host=\"); remhost = *cur + sizeof(\"remote_host=\") - 1; continue; } if (MATCHES(*cur, \"timeout=\")) { p = *cur + sizeof(\"timeout=\") - 1; user_timeout = parse_timeout(p); if (user_timeout == -1) { if (errno == ERANGE) sudo_warnx(U_(\"%s: %s\"), p, U_(\"timeout value too large\")); else sudo_warnx(U_(\"%s: %s\"), p, U_(\"invalid timeout value\")); goto bad; } continue; } #ifdef ENABLE_SUDO_PLUGIN_API if (MATCHES(*cur, \"plugin_dir=\")) { CHECK(*cur, \"plugin_dir=\"); path_plugin_dir = *cur + sizeof(\"plugin_dir=\") - 1; continue; } #endif } user_gid = (gid_t)-1; user_sid = (pid_t)-1; user_uid = (gid_t)-1; user_umask = (mode_t)-1; for (cur = info->user_info; *cur != NULL; cur++) { if (MATCHES(*cur, \"user=\")) { CHECK(*cur, \"user=\"); if ((user_name = strdup(*cur + sizeof(\"user=\") - 1)) == NULL) goto oom; continue; } if (MATCHES(*cur, \"uid=\")) { p = *cur + sizeof(\"uid=\") - 1; user_uid = (uid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"gid=\")) { p = *cur + sizeof(\"gid=\") - 1; user_gid = (gid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"groups=\")) { CHECK(*cur, \"groups=\"); groups = *cur + sizeof(\"groups=\") - 1; continue; } if (MATCHES(*cur, \"cwd=\")) { CHECK(*cur, \"cwd=\"); if ((user_cwd = strdup(*cur + sizeof(\"cwd=\") - 1)) == NULL) goto oom; continue; } if (MATCHES(*cur, \"tty=\")) { CHECK(*cur, \"tty=\"); if ((user_ttypath = strdup(*cur + sizeof(\"tty=\") - 1)) == NULL) goto oom; user_tty = user_ttypath; if (strncmp(user_tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) user_tty += sizeof(_PATH_DEV) - 1; continue; } if (MATCHES(*cur, \"host=\")) { CHECK(*cur, \"host=\"); if ((user_host = strdup(*cur + sizeof(\"host=\") - 1)) == NULL) goto oom; if ((p = strchr(user_host, '.')) != NULL) { user_shost = strndup(user_host, (size_t)(p - user_host)); if (user_shost == NULL) goto oom; } else { user_shost = user_host; } continue; } if (MATCHES(*cur, \"lines=\")) { errno = 0; p = *cur + sizeof(\"lines=\") - 1; sudo_user.lines = sudo_strtonum(p, 1, INT_MAX, &errstr); if (sudo_user.lines == 0) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"cols=\")) { errno = 0; p = *cur + sizeof(\"cols=\") - 1; sudo_user.cols = sudo_strtonum(p, 1, INT_MAX, &errstr); if (sudo_user.cols == 0) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"sid=\")) { p = *cur + sizeof(\"sid=\") - 1; user_sid = (pid_t) sudo_strtoid(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } if (MATCHES(*cur, \"umask=\")) { p = *cur + sizeof(\"umask=\") - 1; sudo_user.umask = sudo_strtomode(p, &errstr); if (errstr != NULL) { sudo_warnx(U_(\"%s: %s\"), *cur, U_(errstr)); goto bad; } continue; } } /* User name, user-ID, group-ID and host name must be specified. */ if (user_name == NULL) { sudo_warnx(\"%s\", U_(\"user name not set by sudo front-end\")); goto bad; } if (user_uid == (uid_t)-1) { sudo_warnx(\"%s\", U_(\"user-ID not set by sudo front-end\")); goto bad; } if (user_gid == (gid_t)-1) { sudo_warnx(\"%s\", U_(\"group-ID not set by sudo front-end\")); goto bad; } if (user_host == NULL) { sudo_warnx(\"%s\", U_(\"host name not set by sudo front-end\")); goto bad; } if ((user_runhost = strdup(remhost ? remhost : user_host)) == NULL) goto oom; if ((p = strchr(user_runhost, '.')) != NULL) { user_srunhost = strndup(user_runhost, (size_t)(p - user_runhost)); if (user_srunhost == NULL) goto oom; } else { user_srunhost = user_runhost; } if (user_cwd == NULL) { if ((user_cwd = strdup(\"unknown\")) == NULL) goto oom; } if (user_runcwd == NULL) { if ((user_runcwd = strdup(user_cwd)) == NULL) goto oom; } if (user_tty == NULL) { if ((user_tty = strdup(\"unknown\")) == NULL) goto oom; /* user_ttypath remains NULL */ } if (groups != NULL) { /* sudo_parse_gids() will print a warning on error. */ user_ngids = sudo_parse_gids(groups, &user_gid, &user_gids); if (user_ngids == -1) goto bad; } /* umask is only set in user_info[] for API 1.10 and above. */ if (user_umask == (mode_t)-1) { user_umask = umask(0); umask(user_umask); } /* Always reset the environment for a login shell. */ if (ISSET(flags, MODE_LOGIN_SHELL)) def_env_reset = true; /* Some systems support fexecve() which we use for digest matches. */ cmnd_fd = -1; /* Dump settings and user info (XXX - plugin args) */ for (cur = info->settings; *cur != NULL; cur++) sudo_debug_printf(SUDO_DEBUG_INFO, \"settings: %s\", *cur); for (cur = info->user_info; *cur != NULL; cur++) sudo_debug_printf(SUDO_DEBUG_INFO, \"user_info: %s\", *cur); #undef MATCHES #undef INVALID #undef CHECK debug_return_int(flags); oom: sudo_warnx(U_(\"%s: %s\"), __func__, U_(\"unable to allocate memory\")); bad: debug_return_int(MODE_ERROR); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Off-by-one Error"], "explanation": "Sudo before 1.9.5p2 contains an off-by-one error that can result in a heap-based buffer overflow, which allows privilege escalation to root via \"sudoedit -s\" and a command-line argument that ends with a single backslash character.", "severity_level": "NoInfo", "cwe": "CWE-193", "cve": "CVE-2021-3156"}} -{"idx": 379586, "input": "initialize_subshell () { #if defined (ALIAS) /* Forget about any aliases that we knew of. We are in a subshell. */ delete_all_aliases (); #endif /* ALIAS */ #if defined (HISTORY) /* Forget about the history lines we have read. This is a non-interactive subshell. */ history_lines_this_session = 0; #endif #if defined (JOB_CONTROL) /* Forget about the way job control was working. We are in a subshell. */ without_job_control (); set_sigchld_handler (); init_job_stats (); #endif /* JOB_CONTROL */ /* Reset the values of the shell flags and options. */ reset_shell_flags (); reset_shell_options (); reset_shopt_options (); /* Zero out builtin_env, since this could be a shell script run from a sourced file with a temporary environment supplied to the `source/.' builtin. Such variables are not supposed to be exported (empirical testing with sh and ksh). Just throw it away; don't worry about a memory leak. */ if (vc_isbltnenv (shell_variables)) shell_variables = shell_variables->down; clear_unwind_protect_list (0); /* XXX -- are there other things we should be resetting here? */ parse_and_execute_level = 0; /* nothing left to restore it */ /* We're no longer inside a shell function. */ variable_context = return_catch_flag = funcnest = 0; executing_list = 0; /* XXX */ /* If we're not interactive, close the file descriptor from which we're reading the current shell script. */ if (interactive_shell == 0) unset_bash_input (0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281550, "input": "static void mark_eio(struct i915_request *rq) { if (i915_request_completed(rq)) return; GEM_BUG_ON(i915_request_signaled(rq)); dma_fence_set_error(&rq->fence, -EIO); i915_request_mark_complete(rq); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508712, "input": "JOIN::destroy() { DBUG_ENTER(\"JOIN::destroy\"); select_lex->join= 0; cond_equal= 0; having_equal= 0; cleanup(1); if (join_tab) { for (JOIN_TAB *tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITH_CONST_TABLES); tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS)) { if (tab->aggr) { free_tmp_table(thd, tab->table); delete tab->tmp_table_param; tab->tmp_table_param= NULL; tab->aggr= NULL; } tab->table= NULL; } } /* Cleanup items referencing temporary table columns */ cleanup_item_list(tmp_all_fields1); cleanup_item_list(tmp_all_fields3); destroy_sj_tmp_tables(this); delete_dynamic(&keyuse); if (save_qep) delete(save_qep); if (ext_keyuses_for_splitting) delete(ext_keyuses_for_splitting); delete procedure; DBUG_RETURN(error); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 206023, "input": "int url_is_local_not_ssh(const char *url) { const char *colon = strchr(url, ':'); const char *slash = strchr(url, '/'); return !colon || (slash && slash < colon) || has_dos_drive_prefix(url); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Use of Incorrectly-Resolved Name or Reference"], "explanation": "A tampering vulnerability exists when Git for Visual Studio improperly handles virtual drive paths, aka 'Git for Visual Studio Tampering Vulnerability'.", "severity_level": "NoInfo", "cwe": "CWE-706", "cve": "CVE-2019-1351"}} -{"idx": 280182, "input": "static inline unsigned int init_tid(int cpu) { return cpu; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381956, "input": "static int oidc_delete_oldest_state_cookies(request_rec *r, int number_of_valid_state_cookies, int max_number_of_state_cookies, oidc_state_cookies_t *first) { oidc_state_cookies_t *cur = NULL, *prev = NULL, *prev_oldest = NULL, *oldest = NULL; while (number_of_valid_state_cookies >= max_number_of_state_cookies) { oldest = first; prev_oldest = NULL; prev = first; cur = first->next; while (cur) { if ((cur->timestamp < oldest->timestamp)) { oldest = cur; prev_oldest = prev; } prev = cur; cur = cur->next; } oidc_warn(r, \"deleting oldest state cookie: %s (time until expiry %\" APR_TIME_T_FMT \" seconds)\", oldest->name, apr_time_sec(oldest->timestamp - apr_time_now())); oidc_util_set_cookie(r, oldest->name, \"\", 0, OIDC_COOKIE_EXT_SAME_SITE_NONE(r)); if (prev_oldest) prev_oldest->next = oldest->next; else first = first->next; number_of_valid_state_cookies--; } return number_of_valid_state_cookies; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 258551, "input": "GF_Err stbl_GetSampleRAP(GF_SyncSampleBox *stss, u32 SampleNumber, GF_ISOSAPType *IsRAP, u32 *prevRAP, u32 *nextRAP) { u32 i; if (prevRAP) *prevRAP = 0; if (nextRAP) *nextRAP = 0; (*IsRAP) = RAP_NO; if (!stss || !SampleNumber) return GF_BAD_PARAM; if (stss->r_LastSyncSample && (stss->r_LastSyncSample < SampleNumber) ) { i = stss->r_LastSampleIndex; } else { i = 0; } for (; i < stss->nb_entries; i++) { //get the entry if (stss->sampleNumbers[i] == SampleNumber) { //update the cache stss->r_LastSyncSample = SampleNumber; stss->r_LastSampleIndex = i; (*IsRAP) = RAP; } else if (stss->sampleNumbers[i] > SampleNumber) { if (nextRAP) *nextRAP = stss->sampleNumbers[i]; return GF_OK; } if (prevRAP) *prevRAP = stss->sampleNumbers[i]; } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 370097, "input": "const char* ExpressionRandom::getOpName() const { return \"$rand\"; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409649, "input": "static BOOL rdp_read_general_capability_set(wStream* s, UINT16 length, rdpSettings* settings) { UINT16 extraFlags; BYTE refreshRectSupport; BYTE suppressOutputSupport; if (length < 24) return FALSE; if (settings->ServerMode) { Stream_Read_UINT16(s, settings->OsMajorType); /* osMajorType (2 bytes) */ Stream_Read_UINT16(s, settings->OsMinorType); /* osMinorType (2 bytes) */ } else { Stream_Seek_UINT16(s); /* osMajorType (2 bytes) */ Stream_Seek_UINT16(s); /* osMinorType (2 bytes) */ } Stream_Seek_UINT16(s); /* protocolVersion (2 bytes) */ Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */ Stream_Seek_UINT16(s); /* generalCompressionTypes (2 bytes) */ Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */ Stream_Seek_UINT16(s); /* updateCapabilityFlag (2 bytes) */ Stream_Seek_UINT16(s); /* remoteUnshareFlag (2 bytes) */ Stream_Seek_UINT16(s); /* generalCompressionLevel (2 bytes) */ Stream_Read_UINT8(s, refreshRectSupport); /* refreshRectSupport (1 byte) */ Stream_Read_UINT8(s, suppressOutputSupport); /* suppressOutputSupport (1 byte) */ settings->NoBitmapCompressionHeader = (extraFlags & NO_BITMAP_COMPRESSION_HDR) ? TRUE : FALSE; settings->LongCredentialsSupported = (extraFlags & LONG_CREDENTIALS_SUPPORTED) ? TRUE : FALSE; if (!(extraFlags & FASTPATH_OUTPUT_SUPPORTED)) settings->FastPathOutput = FALSE; if (!(extraFlags & ENC_SALTED_CHECKSUM)) settings->SaltedChecksum = FALSE; if (!settings->ServerMode) { /** * Note: refreshRectSupport and suppressOutputSupport are * server-only flags indicating to the client weather the * respective PDUs are supported. See MS-RDPBCGR 2.2.7.1.1 */ if (!refreshRectSupport) settings->RefreshRect = FALSE; if (!suppressOutputSupport) settings->SuppressOutput = FALSE; } return TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 490844, "input": "static int irda_find_lsap_sel(struct irda_sock *self, char *name) { IRDA_DEBUG(2, \"%s(%p, %s)\\n\", __func__, self, name); if (self->iriap) { IRDA_WARNING(\"%s(): busy with a previous query\\n\", __func__); return -EBUSY; } self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irda_getvalue_confirm); if(self->iriap == NULL) return -ENOMEM; /* Treat unexpected wakeup as disconnect */ self->errno = -EHOSTUNREACH; /* Query remote LM-IAS */ iriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr, name, \"IrDA:TinyTP:LsapSel\"); /* Wait for answer, if not yet finished (or failed) */ if (wait_event_interruptible(self->query_wait, (self->iriap==NULL))) /* Treat signals as disconnect */ return -EHOSTUNREACH; /* Check what happened */ if (self->errno) { /* Requested object/attribute doesn't exist */ if((self->errno == IAS_CLASS_UNKNOWN) || (self->errno == IAS_ATTRIB_UNKNOWN)) return (-EADDRNOTAVAIL); else return (-EHOSTUNREACH); } /* Get the remote TSAP selector */ switch (self->ias_result->type) { case IAS_INTEGER: IRDA_DEBUG(4, \"%s() int=%d\\n\", __func__, self->ias_result->t.integer); if (self->ias_result->t.integer != -1) self->dtsap_sel = self->ias_result->t.integer; else self->dtsap_sel = 0; break; default: self->dtsap_sel = 0; IRDA_DEBUG(0, \"%s(), bad type!\\n\", __func__); break; } if (self->ias_result) irias_delete_value(self->ias_result); if (self->dtsap_sel) return 0; return -EADDRNOTAVAIL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 263101, "input": "iasecc_keyset_change(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_context *ctx = card->ctx; struct iasecc_sdo_update update; struct iasecc_sdo sdo; unsigned scb; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, \"Change keyset(ref:%i,lengths:%i)\", data->pin_reference, data->pin2.len); if (!data->pin2.data || data->pin2.len < 32) LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Needs at least 32 bytes for a new keyset value\"); memset(&sdo, 0, sizeof(sdo)); sdo.sdo_class = IASECC_SDO_CLASS_KEYSET; sdo.sdo_ref = data->pin_reference; rv = iasecc_sdo_get_data(card, &sdo); LOG_TEST_RET(ctx, rv, \"Cannot get keyset data\"); if (sdo.docp.acls_contact.size == 0) LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Bewildered ... there are no ACLs\"); scb = sdo.docp.scbs[IASECC_ACLS_KEYSET_PUT_DATA]; iasecc_sdo_free_fields(card, &sdo); sc_log(ctx, \"SCB:0x%X\", scb); if (!(scb & IASECC_SCB_METHOD_SM)) LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, \"Other then protected by SM, the keyset change is not supported\"); memset(&update, 0, sizeof(update)); update.magic = SC_CARDCTL_IASECC_SDO_MAGIC_PUT_DATA; update.sdo_class = sdo.sdo_class; update.sdo_ref = sdo.sdo_ref; update.fields[0].parent_tag = IASECC_SDO_KEYSET_TAG; update.fields[0].tag = IASECC_SDO_KEYSET_TAG_MAC; /* FIXME is it safe to modify the const value here? */ update.fields[0].value = (unsigned char *) data->pin2.data; update.fields[0].size = 16; update.fields[1].parent_tag = IASECC_SDO_KEYSET_TAG; update.fields[1].tag = IASECC_SDO_KEYSET_TAG_ENC; /* FIXME is it safe to modify the const value here? */ update.fields[1].value = (unsigned char *) data->pin2.data + 16; update.fields[1].size = 16; rv = iasecc_sm_sdo_update(card, (scb & IASECC_SCB_METHOD_MASK_REF), &update); LOG_FUNC_RETURN(ctx, rv); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445657, "input": "tracing_readme_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { return simple_read_from_buffer(ubuf, cnt, ppos, readme_msg, strlen(readme_msg)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 109019, "input": "void CallWorkerContextDestroyedOnMainThread(int embedded_worker_id) { if (!RenderThreadImpl::current() || !RenderThreadImpl::current()->embedded_worker_dispatcher()) return; RenderThreadImpl::current()->embedded_worker_dispatcher()-> WorkerContextDestroyed(embedded_worker_id); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 330527, "input": "int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp) { Error *local_err = NULL; char *id = (char *)qemu_opts_id(opts); assert(id); vnc_display_init(id); vnc_display_open(id, &local_err); if (local_err != NULL) { error_report(\"Failed to start VNC server: %s\", error_get_pretty(local_err)); error_free(local_err); exit(1); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 448819, "input": "void RGWFormPost::send_response() { std::string redirect = get_part_str(ctrl_parts, \"redirect\"); if (! redirect.empty()) { op_ret = STATUS_REDIRECT; } set_req_state_err(s, op_ret); s->err.err_code = err_msg; dump_errno(s); if (! redirect.empty()) { dump_redirect(s, redirect); } end_header(s, this); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269039, "input": "R_API void r_str_ncpy(char *dst, const char *src, size_t n) { int i; // do not do anything if n is 0 if (n == 0) { return; } n--; for (i = 0; src[i] && n > 0; i++, n--) { dst[i] = src[i]; } dst[i] = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 211502, "input": "bool RGWSwiftWebsiteHandler::is_web_dir() const { std::string subdir_name = url_decode(s->object.name); /* Remove character from the subdir name if it is \"/\". */ if (subdir_name.empty()) { return false; } else if (subdir_name.back() == '/') { subdir_name.pop_back(); } rgw_obj obj(s->bucket, std::move(subdir_name)); /* First, get attrset of the object we'll try to retrieve. */ RGWObjectCtx& obj_ctx = *static_cast(s->obj_ctx); obj_ctx.set_atomic(obj); obj_ctx.set_prefetch_data(obj); RGWObjState* state = nullptr; if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) { return false; } /* A nonexistent object cannot be a considered as a marker representing * the emulation of catalog in FS hierarchy. */ if (! state->exists) { return false; } /* Decode the content type. */ std::string content_type; get_contype_from_attrs(state->attrset, content_type); const auto& ws_conf = s->bucket_info.website_conf; const std::string subdir_marker = ws_conf.subdir_marker.empty() ? \"application/directory\" : ws_conf.subdir_marker; return subdir_marker == content_type && state->size <= 1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Reachable Assertion"], "explanation": "A flaw was found in the Red Hat Ceph Storage RGW in versions before 14.2.21. When processing a GET Request for a swift URL that ends with two slashes it can cause the rgw to crash, resulting in a denial of service. The greatest threat to the system is of availability.", "severity_level": "NoInfo", "cwe": "CWE-617", "cve": "CVE-2021-3531"}} -{"idx": 200632, "input": "urnParseReply(const char *inbuf, const HttpRequestMethod& m) { char *buf = xstrdup(inbuf); char *token; url_entry *list; url_entry *old; int n = 32; int i = 0; debugs(52, 3, \"urnParseReply\"); list = (url_entry *)xcalloc(n + 1, sizeof(*list)); for (token = strtok(buf, crlf); token; token = strtok(NULL, crlf)) { debugs(52, 3, \"urnParseReply: got '\" << token << \"'\"); if (i == n) { old = list; n <<= 2; list = (url_entry *)xcalloc(n + 1, sizeof(*list)); memcpy(list, old, i * sizeof(*list)); safe_free(old); } AnyP::Uri uri; if (!uri.parse(m, SBuf(token)) || !*uri.host()) continue; #if USE_ICMP list[i].rtt = netdbHostRtt(uri.host()); if (0 == list[i].rtt) { debugs(52, 3, \"Pinging \" << uri.host()); netdbPingSite(uri.host()); } #else list[i].rtt = 0; #endif list[i].url = xstrdup(uri.absolute().c_str()); list[i].host = xstrdup(uri.host()); // TODO: Use storeHas() or lock/unlock entry to avoid creating unlocked // ones. list[i].flags.cached = storeGetPublic(list[i].url, m) ? 1 : 0; ++i; } debugs(52, 3, \"urnParseReply: Found \" << i << \" URLs\"); return list; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Missing Release of Memory after Effective Lifetime"], "explanation": "An issue was discovered in Squid before 4.15 and 5.x before 5.0.6. Due to a buffer-management bug, it allows a denial of service. When resolving a request with the urn: scheme, the parser leaks a small amount of memory. However, there is an unspecified attack methodology that can easily trigger a large amount of memory consumption.", "severity_level": "NoInfo", "cwe": "CWE-401", "cve": "CVE-2021-28651"}} -{"idx": 519591, "input": "initcore(void) { Py_InitModule(\"core\", module_functions); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232606, "input": "static void mark_ptr_or_null_regs(struct bpf_verifier_state *vstate, u32 regno, bool is_null) { struct bpf_func_state *state = vstate->frame[vstate->curframe]; struct bpf_reg_state *regs = state->regs; u32 ref_obj_id = regs[regno].ref_obj_id; u32 id = regs[regno].id; int i; if (ref_obj_id && ref_obj_id == id && is_null) /* regs[regno] is in the \" == NULL\" branch. * No one could have freed the reference state before * doing the NULL check. */ WARN_ON_ONCE(release_reference_state(state, id)); for (i = 0; i <= vstate->curframe; i++) __mark_ptr_or_null_regs(vstate->frame[i], id, is_null); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380012, "input": "static void iscsi_endpoint_release(struct device *dev) { struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); kfree(ep); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 458967, "input": "tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){ tsize_t written=0; ttile_t i2=0; tsize_t streamlen=0; uint16 i=0; t2p_read_tiff_init(t2p, input); if(t2p->t2p_error!=T2P_ERR_OK){return(0);} t2p->pdf_xrefoffsets= (uint32*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,t2p->pdf_xrefcount,sizeof(uint32)) ); if(t2p->pdf_xrefoffsets==NULL){ TIFFError( TIFF2PDF_MODULE, \"Can't allocate %u bytes of memory for t2p_write_pdf\", (unsigned int) (t2p->pdf_xrefcount * sizeof(uint32)) ); t2p->t2p_error = T2P_ERR_ERROR; return(written); } t2p->pdf_xrefcount=0; t2p->pdf_catalog=1; t2p->pdf_info=2; t2p->pdf_pages=3; written += t2p_write_pdf_header(t2p, output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; t2p->pdf_catalog=t2p->pdf_xrefcount; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_catalog(t2p, output); written += t2p_write_pdf_obj_end(output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; t2p->pdf_info=t2p->pdf_xrefcount; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_info(t2p, input, output); written += t2p_write_pdf_obj_end(output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; t2p->pdf_pages=t2p->pdf_xrefcount; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_pages(t2p, output); written += t2p_write_pdf_obj_end(output); for(t2p->pdf_page=0;t2p->pdf_pagetiff_pagecount;t2p->pdf_page++){ t2p_read_tiff_data(t2p, input); if(t2p->t2p_error!=T2P_ERR_OK){return(0);} t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_page(t2p->pdf_xrefcount, t2p, output); written += t2p_write_pdf_obj_end(output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_dict_start(output); written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output); written += t2p_write_pdf_stream_dict_end(output); written += t2p_write_pdf_stream_start(output); streamlen=written; written += t2p_write_pdf_page_content_stream(t2p, output); streamlen=written-streamlen; written += t2p_write_pdf_stream_end(output); written += t2p_write_pdf_obj_end(output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_length(streamlen, output); written += t2p_write_pdf_obj_end(output); if(t2p->tiff_transferfunctioncount != 0){ t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_transfer(t2p, output); written += t2p_write_pdf_obj_end(output); for(i=0; i < t2p->tiff_transferfunctioncount; i++){ t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_dict_start(output); written += t2p_write_pdf_transfer_dict(t2p, output, i); written += t2p_write_pdf_stream_dict_end(output); written += t2p_write_pdf_stream_start(output); /* streamlen=written; */ /* value not used */ written += t2p_write_pdf_transfer_stream(t2p, output, i); /* streamlen=written-streamlen; */ /* value not used */ written += t2p_write_pdf_stream_end(output); written += t2p_write_pdf_obj_end(output); } } if( (t2p->pdf_colorspace & T2P_CS_PALETTE) != 0){ t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; t2p->pdf_palettecs=t2p->pdf_xrefcount; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_dict_start(output); written += t2p_write_pdf_stream_dict(t2p->pdf_palettesize, 0, output); written += t2p_write_pdf_stream_dict_end(output); written += t2p_write_pdf_stream_start(output); /* streamlen=written; */ /* value not used */ written += t2p_write_pdf_xobject_palettecs_stream(t2p, output); /* streamlen=written-streamlen; */ /* value not used */ written += t2p_write_pdf_stream_end(output); written += t2p_write_pdf_obj_end(output); } if( (t2p->pdf_colorspace & T2P_CS_ICCBASED) != 0){ t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; t2p->pdf_icccs=t2p->pdf_xrefcount; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_dict_start(output); written += t2p_write_pdf_xobject_icccs_dict(t2p, output); written += t2p_write_pdf_stream_dict_end(output); written += t2p_write_pdf_stream_start(output); /* streamlen=written; */ /* value not used */ written += t2p_write_pdf_xobject_icccs_stream(t2p, output); /* streamlen=written-streamlen; */ /* value not used */ written += t2p_write_pdf_stream_end(output); written += t2p_write_pdf_obj_end(output); } if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount !=0){ for(i2=0;i2tiff_tiles[t2p->pdf_page].tiles_tilecount;i2++){ t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_dict_start(output); written += t2p_write_pdf_xobject_stream_dict( i2+1, t2p, output); written += t2p_write_pdf_stream_dict_end(output); written += t2p_write_pdf_stream_start(output); streamlen=written; t2p_read_tiff_size_tile(t2p, input, i2); written += t2p_readwrite_pdf_image_tile(t2p, input, output, i2); t2p_write_advance_directory(t2p, output); if(t2p->t2p_error!=T2P_ERR_OK){return(0);} streamlen=written-streamlen; written += t2p_write_pdf_stream_end(output); written += t2p_write_pdf_obj_end(output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_length(streamlen, output); written += t2p_write_pdf_obj_end(output); } } else { t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_dict_start(output); written += t2p_write_pdf_xobject_stream_dict( 0, t2p, output); written += t2p_write_pdf_stream_dict_end(output); written += t2p_write_pdf_stream_start(output); streamlen=written; t2p_read_tiff_size(t2p, input); if (t2p->tiff_maxdatasize && (t2p->tiff_datasize > t2p->tiff_maxdatasize)) { TIFFError(TIFF2PDF_MODULE, \"Allocation of \" TIFF_UINT64_FORMAT \" bytes is forbidden. Limit is \" TIFF_UINT64_FORMAT \". Use -m option to change limit\", (uint64)t2p->tiff_datasize, (uint64)t2p->tiff_maxdatasize); t2p->t2p_error = T2P_ERR_ERROR; return (0); } written += t2p_readwrite_pdf_image(t2p, input, output); t2p_write_advance_directory(t2p, output); if(t2p->t2p_error!=T2P_ERR_OK){return(0);} streamlen=written-streamlen; written += t2p_write_pdf_stream_end(output); written += t2p_write_pdf_obj_end(output); t2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written; written += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output); written += t2p_write_pdf_stream_length(streamlen, output); written += t2p_write_pdf_obj_end(output); } } t2p->pdf_startxref = written; written += t2p_write_pdf_xreftable(t2p, output); written += t2p_write_pdf_trailer(t2p, output); t2p_disable(output); return(written); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431450, "input": "static int decode_setattr(struct xdr_stream *xdr) { int status; status = decode_op_hdr(xdr, OP_SETATTR); if (status) return status; if (decode_bitmap4(xdr, NULL, 0) >= 0) return 0; return -EIO; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354503, "input": "static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; kvm_run->s.regs.prefix = kvm_s390_get_prefix(vcpu); memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128); kvm_run->s.regs.cputm = kvm_s390_get_cpu_timer(vcpu); kvm_run->s.regs.ckc = vcpu->arch.sie_block->ckc; kvm_run->s.regs.pft = vcpu->arch.pfault_token; kvm_run->s.regs.pfs = vcpu->arch.pfault_select; kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; save_access_regs(vcpu->run->s.regs.acrs); restore_access_regs(vcpu->arch.host_acrs); /* Save guest register state */ save_fpu_regs(); vcpu->run->s.regs.fpc = current->thread.fpu.fpc; /* Restore will be done lazily at return */ current->thread.fpu.fpc = vcpu->arch.host_fpregs.fpc; current->thread.fpu.regs = vcpu->arch.host_fpregs.regs; if (likely(!kvm_s390_pv_cpu_is_protected(vcpu))) store_regs_fmt2(vcpu, kvm_run); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431344, "input": "encode_setacl(struct xdr_stream *xdr, const struct nfs_setaclargs *arg, struct compound_hdr *hdr) { __be32 *p; encode_op_hdr(xdr, OP_SETATTR, decode_setacl_maxsz, hdr); encode_nfs4_stateid(xdr, &zero_stateid); p = reserve_space(xdr, 2*4); *p++ = cpu_to_be32(1); *p = cpu_to_be32(FATTR4_WORD0_ACL); p = reserve_space(xdr, 4); *p = cpu_to_be32(arg->acl_len); xdr_write_pages(xdr, arg->acl_pages, 0, arg->acl_len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 220885, "input": "static void send_signature(void) { uint8_t hash[32], sig[64]; uint8_t v; layoutProgress(_(\"Signing\"), 1000); /* eip-155 replay protection */ if (chain_id) { /* hash v=chain_id, r=0, s=0 */ hash_rlp_number(chain_id); hash_rlp_length(0, 0); hash_rlp_length(0, 0); } keccak_Final(&keccak_ctx, hash); if (ecdsa_sign_digest(&secp256k1, privkey, hash, sig, &v, ethereum_is_canonic) != 0) { fsm_sendFailure(FailureType_Failure_Other, \"Signing failed\"); ethereum_signing_abort(); return; } memzero(privkey, sizeof(privkey)); /* Send back the result */ msg_tx_request.has_data_length = false; msg_tx_request.has_signature_v = true; if (chain_id > MAX_CHAIN_ID) { msg_tx_request.signature_v = v; } else if (chain_id) { msg_tx_request.signature_v = v + 2 * chain_id + 35; } else { msg_tx_request.signature_v = v + 27; } msg_tx_request.has_signature_r = true; msg_tx_request.signature_r.size = 32; memcpy(msg_tx_request.signature_r.bytes, sig, 32); msg_tx_request.has_signature_s = true; msg_tx_request.signature_s.size = 32; memcpy(msg_tx_request.signature_s.bytes, sig + 32, 32); // KeepKey custom (for the KeepKey Client) msg_tx_request.has_hash = true; msg_tx_request.hash.size = sizeof(msg_tx_request.hash.bytes); memcpy(msg_tx_request.hash.bytes, hash, msg_tx_request.hash.size); msg_tx_request.has_signature_der = true; msg_tx_request.signature_der.size = ecdsa_sig_to_der(sig, msg_tx_request.signature_der.bytes); msg_write(MessageType_MessageType_EthereumTxRequest, &msg_tx_request); ethereum_signing_abort(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 404502, "input": "RSAEP( TPM2B *dInOut, // IN: size of the encrypted block and the size of // the encrypted value. It must be the size of // the modulus. // OUT: the encrypted data. Will receive the // decrypted value OBJECT *key // IN: the key to use ) { TPM2B_TYPE(4BYTES, 4); TPM2B_4BYTES(e) = {{4, {(BYTE)((RSA_DEFAULT_PUBLIC_EXPONENT >> 24) & 0xff), (BYTE)((RSA_DEFAULT_PUBLIC_EXPONENT >> 16) & 0xff), (BYTE)((RSA_DEFAULT_PUBLIC_EXPONENT >> 8) & 0xff), (BYTE)((RSA_DEFAULT_PUBLIC_EXPONENT)& 0xff)}}}; // if(key->publicArea.parameters.rsaDetail.exponent != 0) UINT32_TO_BYTE_ARRAY(key->publicArea.parameters.rsaDetail.exponent, e.t.buffer); return ModExpB(dInOut->size, dInOut->buffer, dInOut->size, dInOut->buffer, e.t.size, e.t.buffer, key->publicArea.unique.rsa.t.size, key->publicArea.unique.rsa.t.buffer); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342119, "input": "void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, u64 attr_valid) { struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_inode *fi = get_fuse_inode(inode); lockdep_assert_held(&fi->lock); fi->attr_version = atomic64_inc_return(&fc->attr_version); fi->i_time = attr_valid; WRITE_ONCE(fi->inval_mask, 0); inode->i_ino = fuse_squash_ino(attr->ino); inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777); set_nlink(inode, attr->nlink); inode->i_uid = make_kuid(fc->user_ns, attr->uid); inode->i_gid = make_kgid(fc->user_ns, attr->gid); inode->i_blocks = attr->blocks; inode->i_atime.tv_sec = attr->atime; inode->i_atime.tv_nsec = attr->atimensec; /* mtime from server may be stale due to local buffered write */ if (!fc->writeback_cache || !S_ISREG(inode->i_mode)) { inode->i_mtime.tv_sec = attr->mtime; inode->i_mtime.tv_nsec = attr->mtimensec; inode->i_ctime.tv_sec = attr->ctime; inode->i_ctime.tv_nsec = attr->ctimensec; } if (attr->blksize != 0) inode->i_blkbits = ilog2(attr->blksize); else inode->i_blkbits = inode->i_sb->s_blocksize_bits; /* * Don't set the sticky bit in i_mode, unless we want the VFS * to check permissions. This prevents failures due to the * check in may_delete(). */ fi->orig_i_mode = inode->i_mode; if (!fc->default_permissions) inode->i_mode &= ~S_ISVTX; fi->orig_ino = attr->ino; /* * We are refreshing inode data and it is possible that another * client set suid/sgid or security.capability xattr. So clear * S_NOSEC. Ideally, we could have cleared it only if suid/sgid * was set or if security.capability xattr was set. But we don't * know if security.capability has been set or not. So clear it * anyway. Its less efficient but should be safe. */ inode->i_flags &= ~S_NOSEC; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445676, "input": "trace_event_setup(struct ring_buffer_event *event, int type, unsigned long flags, int pc) { struct trace_entry *ent = ring_buffer_event_data(event); tracing_generic_entry_update(ent, flags, pc); ent->type = type; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295117, "input": "static int strlen16 (unsigned short *s) { int len = 0; while (*s) { s++; len++; } return len; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 384495, "input": "static void iwl_fw_dbg_stop_recording(struct iwl_trans *trans, struct iwl_fw_dbg_params *params) { if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_7000) { iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100); return; } if (params) { params->in_sample = iwl_read_umac_prph(trans, DBGC_IN_SAMPLE); params->out_ctrl = iwl_read_umac_prph(trans, DBGC_OUT_CTRL); } iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, 0); /* wait for the DBGC to finish writing the internal buffer to DRAM to * avoid halting the HW while writing */ usleep_range(700, 1000); iwl_write_umac_prph(trans, DBGC_OUT_CTRL, 0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214916, "input": "TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) { static const char module[] = \"TIFFWriteDirectorySec\"; uint32 ndir; TIFFDirEntry* dir; uint32 dirsize; void* dirmem; uint32 m; if (tif->tif_mode == O_RDONLY) return (1); _TIFFFillStriles( tif ); /* * Clear write state so that subsequent images with * different characteristics get the right buffers * setup for them. */ if (imagedone) { if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (!(*tif->tif_postencode)(tif)) { TIFFErrorExt(tif->tif_clientdata,module, \"Error post-encoding before directory write\"); return (0); } } (*tif->tif_close)(tif); /* shutdown encoder */ /* * Flush any data that might have been written * by the compression close+cleanup routines. But * be careful not to write stuff if we didn't add data * in the previous steps as the \"rawcc\" data may well be * a previously read tile/strip in mixed read/write mode. */ if (tif->tif_rawcc > 0 && (tif->tif_flags & TIFF_BEENWRITING) != 0 ) { if( !TIFFFlushData1(tif) ) { TIFFErrorExt(tif->tif_clientdata, module, \"Error flushing data before directory write\"); return (0); } } if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) { _TIFFfree(tif->tif_rawdata); tif->tif_rawdata = NULL; tif->tif_rawcc = 0; tif->tif_rawdatasize = 0; tif->tif_rawdataoff = 0; tif->tif_rawdataloaded = 0; } tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP); } dir=NULL; dirmem=NULL; dirsize=0; while (1) { ndir=0; if (isimage) { if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) { if (!TIFFWriteDirectoryTagShortLong(tif,&ndir,dir,TIFFTAG_IMAGEWIDTH,tif->tif_dir.td_imagewidth)) goto bad; if (!TIFFWriteDirectoryTagShortLong(tif,&ndir,dir,TIFFTAG_IMAGELENGTH,tif->tif_dir.td_imagelength)) goto bad; } if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) { if (!TIFFWriteDirectoryTagShortLong(tif,&ndir,dir,TIFFTAG_TILEWIDTH,tif->tif_dir.td_tilewidth)) goto bad; if (!TIFFWriteDirectoryTagShortLong(tif,&ndir,dir,TIFFTAG_TILELENGTH,tif->tif_dir.td_tilelength)) goto bad; } if (TIFFFieldSet(tif,FIELD_RESOLUTION)) { if (!TIFFWriteDirectoryTagRational(tif,&ndir,dir,TIFFTAG_XRESOLUTION,tif->tif_dir.td_xresolution)) goto bad; if (!TIFFWriteDirectoryTagRational(tif,&ndir,dir,TIFFTAG_YRESOLUTION,tif->tif_dir.td_yresolution)) goto bad; } if (TIFFFieldSet(tif,FIELD_POSITION)) { if (!TIFFWriteDirectoryTagRational(tif,&ndir,dir,TIFFTAG_XPOSITION,tif->tif_dir.td_xposition)) goto bad; if (!TIFFWriteDirectoryTagRational(tif,&ndir,dir,TIFFTAG_YPOSITION,tif->tif_dir.td_yposition)) goto bad; } if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) { if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,TIFFTAG_SUBFILETYPE,tif->tif_dir.td_subfiletype)) goto bad; } if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE)) { if (!TIFFWriteDirectoryTagShortPerSample(tif,&ndir,dir,TIFFTAG_BITSPERSAMPLE,tif->tif_dir.td_bitspersample)) goto bad; } if (TIFFFieldSet(tif,FIELD_COMPRESSION)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_COMPRESSION,tif->tif_dir.td_compression)) goto bad; } if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_PHOTOMETRIC,tif->tif_dir.td_photometric)) goto bad; } if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_THRESHHOLDING,tif->tif_dir.td_threshholding)) goto bad; } if (TIFFFieldSet(tif,FIELD_FILLORDER)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_FILLORDER,tif->tif_dir.td_fillorder)) goto bad; } if (TIFFFieldSet(tif,FIELD_ORIENTATION)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_ORIENTATION,tif->tif_dir.td_orientation)) goto bad; } if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_SAMPLESPERPIXEL,tif->tif_dir.td_samplesperpixel)) goto bad; } if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) { if (!TIFFWriteDirectoryTagShortLong(tif,&ndir,dir,TIFFTAG_ROWSPERSTRIP,tif->tif_dir.td_rowsperstrip)) goto bad; } if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE)) { if (!TIFFWriteDirectoryTagShortPerSample(tif,&ndir,dir,TIFFTAG_MINSAMPLEVALUE,tif->tif_dir.td_minsamplevalue)) goto bad; } if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE)) { if (!TIFFWriteDirectoryTagShortPerSample(tif,&ndir,dir,TIFFTAG_MAXSAMPLEVALUE,tif->tif_dir.td_maxsamplevalue)) goto bad; } if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_PLANARCONFIG,tif->tif_dir.td_planarconfig)) goto bad; } if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_RESOLUTIONUNIT,tif->tif_dir.td_resolutionunit)) goto bad; } if (TIFFFieldSet(tif,FIELD_PAGENUMBER)) { if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,TIFFTAG_PAGENUMBER,2,&tif->tif_dir.td_pagenumber[0])) goto bad; } if (TIFFFieldSet(tif,FIELD_STRIPBYTECOUNTS)) { if (!isTiled(tif)) { if (!TIFFWriteDirectoryTagLongLong8Array(tif,&ndir,dir,TIFFTAG_STRIPBYTECOUNTS,tif->tif_dir.td_nstrips,tif->tif_dir.td_stripbytecount)) goto bad; } else { if (!TIFFWriteDirectoryTagLongLong8Array(tif,&ndir,dir,TIFFTAG_TILEBYTECOUNTS,tif->tif_dir.td_nstrips,tif->tif_dir.td_stripbytecount)) goto bad; } } if (TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) { if (!isTiled(tif)) { /* td_stripoffset might be NULL in an odd OJPEG case. See * tif_dirread.c around line 3634. * XXX: OJPEG hack. * If a) compression is OJPEG, b) it's not a tiled TIFF, * and c) the number of strips is 1, * then we tolerate the absence of stripoffsets tag, * because, presumably, all required data is in the * JpegInterchangeFormat stream. * We can get here when using tiffset on such a file. * See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */ if (tif->tif_dir.td_stripoffset != NULL && !TIFFWriteDirectoryTagLongLong8Array(tif,&ndir,dir,TIFFTAG_STRIPOFFSETS,tif->tif_dir.td_nstrips,tif->tif_dir.td_stripoffset)) goto bad; } else { if (!TIFFWriteDirectoryTagLongLong8Array(tif,&ndir,dir,TIFFTAG_TILEOFFSETS,tif->tif_dir.td_nstrips,tif->tif_dir.td_stripoffset)) goto bad; } } if (TIFFFieldSet(tif,FIELD_COLORMAP)) { if (!TIFFWriteDirectoryTagColormap(tif,&ndir,dir)) goto bad; } if (TIFFFieldSet(tif,FIELD_EXTRASAMPLES)) { if (tif->tif_dir.td_extrasamples) { uint16 na; uint16* nb; TIFFGetFieldDefaulted(tif,TIFFTAG_EXTRASAMPLES,&na,&nb); if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,TIFFTAG_EXTRASAMPLES,na,nb)) goto bad; } } if (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) { if (!TIFFWriteDirectoryTagShortPerSample(tif,&ndir,dir,TIFFTAG_SAMPLEFORMAT,tif->tif_dir.td_sampleformat)) goto bad; } if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE)) { if (!TIFFWriteDirectoryTagSampleformatArray(tif,&ndir,dir,TIFFTAG_SMINSAMPLEVALUE,tif->tif_dir.td_samplesperpixel,tif->tif_dir.td_sminsamplevalue)) goto bad; } if (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE)) { if (!TIFFWriteDirectoryTagSampleformatArray(tif,&ndir,dir,TIFFTAG_SMAXSAMPLEVALUE,tif->tif_dir.td_samplesperpixel,tif->tif_dir.td_smaxsamplevalue)) goto bad; } if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH)) { if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,TIFFTAG_IMAGEDEPTH,tif->tif_dir.td_imagedepth)) goto bad; } if (TIFFFieldSet(tif,FIELD_TILEDEPTH)) { if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,TIFFTAG_TILEDEPTH,tif->tif_dir.td_tiledepth)) goto bad; } if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS)) { if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,TIFFTAG_HALFTONEHINTS,2,&tif->tif_dir.td_halftonehints[0])) goto bad; } if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING)) { if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,TIFFTAG_YCBCRSUBSAMPLING,2,&tif->tif_dir.td_ycbcrsubsampling[0])) goto bad; } if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) { if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,TIFFTAG_YCBCRPOSITIONING,tif->tif_dir.td_ycbcrpositioning)) goto bad; } if (TIFFFieldSet(tif,FIELD_REFBLACKWHITE)) { if (!TIFFWriteDirectoryTagRationalArray(tif,&ndir,dir,TIFFTAG_REFERENCEBLACKWHITE,6,tif->tif_dir.td_refblackwhite)) goto bad; } if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) { if (!TIFFWriteDirectoryTagTransferfunction(tif,&ndir,dir)) goto bad; } if (TIFFFieldSet(tif,FIELD_INKNAMES)) { if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,TIFFTAG_INKNAMES,tif->tif_dir.td_inknameslen,tif->tif_dir.td_inknames)) goto bad; } if (TIFFFieldSet(tif,FIELD_SUBIFD)) { if (!TIFFWriteDirectoryTagSubifd(tif,&ndir,dir)) goto bad; } { uint32 n; for (n=0; ntif_nfields; n++) { const TIFFField* o; o = tif->tif_fields[n]; if ((o->field_bit>=FIELD_CODEC)&&(TIFFFieldSet(tif,o->field_bit))) { switch (o->get_field_type) { case TIFF_SETGET_ASCII: { uint32 pa; char* pb; assert(o->field_type==TIFF_ASCII); assert(o->field_readcount==TIFF_VARIABLE); assert(o->field_passcount==0); TIFFGetField(tif,o->field_tag,&pb); pa=(uint32)(strlen(pb)); if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,(uint16)o->field_tag,pa,pb)) goto bad; } break; case TIFF_SETGET_UINT16: { uint16 p; assert(o->field_type==TIFF_SHORT); assert(o->field_readcount==1); assert(o->field_passcount==0); TIFFGetField(tif,o->field_tag,&p); if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,(uint16)o->field_tag,p)) goto bad; } break; case TIFF_SETGET_UINT32: { uint32 p; assert(o->field_type==TIFF_LONG); assert(o->field_readcount==1); assert(o->field_passcount==0); TIFFGetField(tif,o->field_tag,&p); if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,(uint16)o->field_tag,p)) goto bad; } break; case TIFF_SETGET_C32_UINT8: { uint32 pa; void* pb; assert(o->field_type==TIFF_UNDEFINED); assert(o->field_readcount==TIFF_VARIABLE2); assert(o->field_passcount==1); TIFFGetField(tif,o->field_tag,&pa,&pb); if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,(uint16)o->field_tag,pa,pb)) goto bad; } break; default: assert(0); /* we should never get here */ break; } } } } } for (m=0; m<(uint32)(tif->tif_dir.td_customValueCount); m++) { uint16 tag = (uint16)tif->tif_dir.td_customValues[m].info->field_tag; uint32 count = tif->tif_dir.td_customValues[m].count; switch (tif->tif_dir.td_customValues[m].info->field_type) { case TIFF_ASCII: if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_UNDEFINED: if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_BYTE: if (!TIFFWriteDirectoryTagByteArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_SBYTE: if (!TIFFWriteDirectoryTagSbyteArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_SHORT: if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_SSHORT: if (!TIFFWriteDirectoryTagSshortArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_LONG: if (!TIFFWriteDirectoryTagLongArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_SLONG: if (!TIFFWriteDirectoryTagSlongArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_LONG8: if (!TIFFWriteDirectoryTagLong8Array(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_SLONG8: if (!TIFFWriteDirectoryTagSlong8Array(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_RATIONAL: if (!TIFFWriteDirectoryTagRationalArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_SRATIONAL: if (!TIFFWriteDirectoryTagSrationalArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_FLOAT: if (!TIFFWriteDirectoryTagFloatArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_DOUBLE: if (!TIFFWriteDirectoryTagDoubleArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_IFD: if (!TIFFWriteDirectoryTagIfdArray(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; case TIFF_IFD8: if (!TIFFWriteDirectoryTagIfdIfd8Array(tif,&ndir,dir,tag,count,tif->tif_dir.td_customValues[m].value)) goto bad; break; default: assert(0); /* we should never get here */ break; } } if (dir!=NULL) break; dir=_TIFFmalloc(ndir*sizeof(TIFFDirEntry)); if (dir==NULL) { TIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\"); goto bad; } if (isimage) { if ((tif->tif_diroff==0)&&(!TIFFLinkDirectory(tif))) goto bad; } else tif->tif_diroff=(TIFFSeekFile(tif,0,SEEK_END)+1)&(~((toff_t)1)); if (pdiroff!=NULL) *pdiroff=tif->tif_diroff; if (!(tif->tif_flags&TIFF_BIGTIFF)) dirsize=2+ndir*12+4; else dirsize=8+ndir*20+8; tif->tif_dataoff=tif->tif_diroff+dirsize; if (!(tif->tif_flags&TIFF_BIGTIFF)) tif->tif_dataoff=(uint32)tif->tif_dataoff; if ((tif->tif_dataofftif_diroff)||(tif->tif_dataoff<(uint64)dirsize)) { TIFFErrorExt(tif->tif_clientdata,module,\"Maximum TIFF file size exceeded\"); goto bad; } if (tif->tif_dataoff&1) tif->tif_dataoff++; if (isimage) tif->tif_curdir++; } if (isimage) { if (TIFFFieldSet(tif,FIELD_SUBIFD)&&(tif->tif_subifdoff==0)) { uint32 na; TIFFDirEntry* nb; for (na=0, nb=dir; ; na++, nb++) { if( na == ndir ) { TIFFErrorExt(tif->tif_clientdata,module, \"Cannot find SubIFD tag\"); goto bad; } if (nb->tdir_tag==TIFFTAG_SUBIFD) break; } if (!(tif->tif_flags&TIFF_BIGTIFF)) tif->tif_subifdoff=tif->tif_diroff+2+na*12+8; else tif->tif_subifdoff=tif->tif_diroff+8+na*20+12; } } dirmem=_TIFFmalloc(dirsize); if (dirmem==NULL) { TIFFErrorExt(tif->tif_clientdata,module,\"Out of memory\"); goto bad; } if (!(tif->tif_flags&TIFF_BIGTIFF)) { uint8* n; uint32 nTmp; TIFFDirEntry* o; n=dirmem; *(uint16*)n=(uint16)ndir; if (tif->tif_flags&TIFF_SWAB) TIFFSwabShort((uint16*)n); n+=2; o=dir; for (m=0; mtdir_tag; if (tif->tif_flags&TIFF_SWAB) TIFFSwabShort((uint16*)n); n+=2; *(uint16*)n=o->tdir_type; if (tif->tif_flags&TIFF_SWAB) TIFFSwabShort((uint16*)n); n+=2; nTmp = (uint32)o->tdir_count; _TIFFmemcpy(n,&nTmp,4); if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong((uint32*)n); n+=4; /* This is correct. The data has been */ /* swabbed previously in TIFFWriteDirectoryTagData */ _TIFFmemcpy(n,&o->tdir_offset,4); n+=4; o++; } nTmp = (uint32)tif->tif_nextdiroff; if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong(&nTmp); _TIFFmemcpy(n,&nTmp,4); } else { uint8* n; TIFFDirEntry* o; n=dirmem; *(uint64*)n=ndir; if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong8((uint64*)n); n+=8; o=dir; for (m=0; mtdir_tag; if (tif->tif_flags&TIFF_SWAB) TIFFSwabShort((uint16*)n); n+=2; *(uint16*)n=o->tdir_type; if (tif->tif_flags&TIFF_SWAB) TIFFSwabShort((uint16*)n); n+=2; _TIFFmemcpy(n,&o->tdir_count,8); if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong8((uint64*)n); n+=8; _TIFFmemcpy(n,&o->tdir_offset,8); n+=8; o++; } _TIFFmemcpy(n,&tif->tif_nextdiroff,8); if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong8((uint64*)n); } _TIFFfree(dir); dir=NULL; if (!SeekOK(tif,tif->tif_diroff)) { TIFFErrorExt(tif->tif_clientdata,module,\"IO error writing directory\"); goto bad; } if (!WriteOK(tif,dirmem,(tmsize_t)dirsize)) { TIFFErrorExt(tif->tif_clientdata,module,\"IO error writing directory\"); goto bad; } _TIFFfree(dirmem); if (imagedone) { TIFFFreeDirectory(tif); tif->tif_flags &= ~TIFF_DIRTYDIRECT; tif->tif_flags &= ~TIFF_DIRTYSTRIP; (*tif->tif_cleanup)(tif); /* * Reset directory-related state for subsequent * directories. */ TIFFCreateDirectory(tif); } return(1); bad: if (dir!=NULL) _TIFFfree(dir); if (dirmem!=NULL) _TIFFfree(dirmem); return(0); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Reachable Assertion"], "explanation": "The TIFFWriteDirectorySec() function in tif_dirwrite.c in LibTIFF through 4.0.9 allows remote attackers to cause a denial of service (assertion failure and application crash) via a crafted file, a different vulnerability than CVE-2017-13726.", "severity_level": "Medium", "cwe": "CWE-617", "cve": "CVE-2018-10963"}} -{"idx": 269108, "input": "subscription *GetFirstSubscription(service_info *service) { subscription temp; subscription *next = NULL; temp.next = service->subscriptionList; next = GetNextSubscription(service, &temp); service->subscriptionList = temp.next; /* service->subscriptionList = next; */ return next; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402355, "input": "ConnStateData::parseProxy2p0() { static const SBuf::size_type prefixLen = Proxy2p0magic.length(); if (inBuf.length() < prefixLen + 4) return false; // need more bytes if ((inBuf[prefixLen] & 0xF0) != 0x20) // version == 2 is mandatory return proxyProtocolError(\"PROXY/2.0 error: invalid version\"); const char command = (inBuf[prefixLen] & 0x0F); if ((command & 0xFE) != 0x00) // values other than 0x0-0x1 are invalid return proxyProtocolError(\"PROXY/2.0 error: invalid command\"); const char family = (inBuf[prefixLen+1] & 0xF0) >>4; if (family > 0x3) // values other than 0x0-0x3 are invalid return proxyProtocolError(\"PROXY/2.0 error: invalid family\"); const char proto = (inBuf[prefixLen+1] & 0x0F); if (proto > 0x2) // values other than 0x0-0x2 are invalid return proxyProtocolError(\"PROXY/2.0 error: invalid protocol type\"); const char *clen = inBuf.rawContent() + prefixLen + 2; uint16_t len; memcpy(&len, clen, sizeof(len)); len = ntohs(len); if (inBuf.length() < prefixLen + 4 + len) return false; // need more bytes inBuf.consume(prefixLen + 4); // 4 being the extra bytes const SBuf extra = inBuf.consume(len); needProxyProtocolHeader_ = false; // found successfully // LOCAL connections do nothing with the extras if (command == 0x00/* LOCAL*/) return true; union pax { struct { /* for TCP/UDP over IPv4, len = 12 */ struct in_addr src_addr; struct in_addr dst_addr; uint16_t src_port; uint16_t dst_port; } ipv4_addr; struct { /* for TCP/UDP over IPv6, len = 36 */ struct in6_addr src_addr; struct in6_addr dst_addr; uint16_t src_port; uint16_t dst_port; } ipv6_addr; #if NOT_SUPPORTED struct { /* for AF_UNIX sockets, len = 216 */ uint8_t src_addr[108]; uint8_t dst_addr[108]; } unix_addr; #endif }; pax ipu; memcpy(&ipu, extra.rawContent(), sizeof(pax)); // replace the client connection values debugs(33, 5, \"PROXY/2.0 protocol on connection \" << clientConnection); switch (family) { case 0x1: // IPv4 clientConnection->local = ipu.ipv4_addr.dst_addr; clientConnection->local.port(ntohs(ipu.ipv4_addr.dst_port)); clientConnection->remote = ipu.ipv4_addr.src_addr; clientConnection->remote.port(ntohs(ipu.ipv4_addr.src_port)); if ((clientConnection->flags & COMM_TRANSPARENT)) clientConnection->flags ^= COMM_TRANSPARENT; // prevent TPROXY spoofing of this new IP. break; case 0x2: // IPv6 clientConnection->local = ipu.ipv6_addr.dst_addr; clientConnection->local.port(ntohs(ipu.ipv6_addr.dst_port)); clientConnection->remote = ipu.ipv6_addr.src_addr; clientConnection->remote.port(ntohs(ipu.ipv6_addr.src_port)); if ((clientConnection->flags & COMM_TRANSPARENT)) clientConnection->flags ^= COMM_TRANSPARENT; // prevent TPROXY spoofing of this new IP. break; default: // do nothing break; } debugs(33, 5, \"PROXY/2.0 upgrade: \" << clientConnection); return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409891, "input": "static inline void TCP_ECN_withdraw_cwr(struct tcp_sock *tp) { tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303439, "input": "handshake_hash_add_sent(gnutls_session_t session, gnutls_handshake_description_t type, uint8_t * dataptr, uint32_t datalen) { int ret; const version_entry_st *vers = get_version(session); if (unlikely(vers == NULL)) return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); /* We don't check for GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST because it * is not sent via that channel. */ if (type != GNUTLS_HANDSHAKE_HELLO_REQUEST) { CHECK_SIZE(datalen); if (vers->id == GNUTLS_DTLS0_9) { /* Old DTLS doesn't include the header in the MAC */ if (datalen < 12) { gnutls_assert(); return GNUTLS_E_INTERNAL_ERROR; } dataptr += 12; datalen -= 12; if (datalen == 0) return 0; } ret = _gnutls_buffer_append_data(&session->internals. handshake_hash_buffer, dataptr, datalen); if (ret < 0) return gnutls_assert_val(ret); if (type == GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE) session->internals.handshake_hash_buffer_client_kx_len = session->internals.handshake_hash_buffer.length; return 0; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 360760, "input": "static int gap_try(int x, int y, int *run, int *saw, int along_x) { int n, m, i, xt, yt, ct; n = x + y * ntiles_x; if (! tile_has_diff[n]) { if (*saw) { (*run)++; /* extend the gap run. */ } return 0; } if (! *saw || *run == 0 || *run > gaps_fill) { *run = 0; /* unacceptable run. */ *saw = 1; return 0; } for (i=1; i <= *run; i++) { /* iterate thru the run. */ if (along_x) { xt = x - i; yt = y; } else { xt = x; yt = y - i; } m = xt + yt * ntiles_x; if (tile_tried[m]) { /* do not repeat tiles */ continue; } ct = copy_tiles(xt, yt, 1); if (ct < 0) return ct; /* fatal */ } *run = 0; *saw = 1; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 325917, "input": "best_effort_strncat_from_utf16be(struct archive_string *as, const void *_p, size_t bytes, struct archive_string_conv *sc) { return (best_effort_strncat_from_utf16(as, _p, bytes, sc, 1)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219247, "input": "bool HHVM_FUNCTION(HH_is_dict, const Variant& v) { return is_dict(v.asTypedValue()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 519162, "input": "UnsignedBigInteger random_big_prime(size_t bits) { ASSERT(bits >= 33); UnsignedBigInteger min = UnsignedBigInteger::from_base10(\"6074001000\").shift_left(bits - 33); UnsignedBigInteger max = UnsignedBigInteger { 1 }.shift_left(bits).minus(1); for (;;) { auto p = random_number(min, max); if ((p.words()[0] & 1) == 0) { // An even number is definitely not a large prime. continue; } if (is_probably_prime(p)) return p; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204337, "input": "int imap_open_connection(struct ImapAccountData *adata) { if (mutt_socket_open(adata->conn) < 0) return -1; adata->state = IMAP_CONNECTED; if (imap_cmd_step(adata) != IMAP_RES_OK) { imap_close_connection(adata); return -1; } if (mutt_istr_startswith(adata->buf, \"* OK\")) { if (!mutt_istr_startswith(adata->buf, \"* OK [CAPABILITY\") && check_capabilities(adata)) { goto bail; } #ifdef USE_SSL /* Attempt STARTTLS if available and desired. */ if ((adata->conn->ssf == 0) && (C_SslForceTls || (adata->capabilities & IMAP_CAP_STARTTLS))) { enum QuadOption ans; if (C_SslForceTls) ans = MUTT_YES; else if ((ans = query_quadoption(C_SslStarttls, _(\"Secure connection with TLS?\"))) == MUTT_ABORT) { goto err_close_conn; } if (ans == MUTT_YES) { enum ImapExecResult rc = imap_exec(adata, \"STARTTLS\", IMAP_CMD_SINGLE); // Clear any data after the STARTTLS acknowledgement mutt_socket_empty(adata->conn); if (rc == IMAP_EXEC_FATAL) goto bail; if (rc != IMAP_EXEC_ERROR) { if (mutt_ssl_starttls(adata->conn)) { mutt_error(_(\"Could not negotiate TLS connection\")); goto err_close_conn; } else { /* RFC2595 demands we recheck CAPABILITY after TLS completes. */ if (imap_exec(adata, \"CAPABILITY\", IMAP_CMD_NO_FLAGS)) goto bail; } } } } if (C_SslForceTls && (adata->conn->ssf == 0)) { mutt_error(_(\"Encrypted connection unavailable\")); goto err_close_conn; } #endif } else if (mutt_istr_startswith(adata->buf, \"* PREAUTH\")) { #ifdef USE_SSL /* Unless using a secure $tunnel, an unencrypted PREAUTH response may be a * MITM attack. The only way to stop \"STARTTLS\" MITM attacks is via * $ssl_force_tls: an attacker can easily spoof \"* OK\" and strip the * STARTTLS capability. So consult $ssl_force_tls, not $ssl_starttls, to * decide whether to abort. Note that if using $tunnel and * $tunnel_is_secure, adata->conn->ssf will be set to 1. */ if ((adata->conn->ssf == 0) && C_SslForceTls) { mutt_error(_(\"Encrypted connection unavailable\")); goto err_close_conn; } #endif adata->state = IMAP_AUTHENTICATED; if (check_capabilities(adata) != 0) goto bail; FREE(&adata->capstr); } else { imap_error(\"imap_open_connection()\", adata->buf); goto bail; } return 0; #ifdef USE_SSL err_close_conn: imap_close_connection(adata); #endif bail: FREE(&adata->capstr); return -1; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Insufficiently Protected Credentials"], "explanation": "Mutt before 2.0.2 and NeoMutt before 2020-11-20 did not ensure that $ssl_force_tls was processed if an IMAP server's initial server response was invalid. The connection was not properly closed, and the code could continue attempting to authenticate. This could result in authentication credentials being exposed on an unencrypted connection, or to a machine-in-the-middle.", "severity_level": "NoInfo", "cwe": "CWE-522", "cve": "CVE-2020-28896"}} -{"idx": 326064, "input": "int tty_hung_up_p(struct file *filp) { return (filp && filp->f_op == &hung_up_tty_fops); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244769, "input": "static int parse_file_extra_version(struct archive_read* a, struct archive_entry* e, ssize_t* extra_data_size) { size_t flags = 0; size_t version = 0; size_t value_len = 0; struct archive_string version_string; struct archive_string name_utf8_string; const char* cur_filename; /* Flags are ignored. */ if(!read_var_sized(a, &flags, &value_len)) return ARCHIVE_EOF; *extra_data_size -= value_len; if(ARCHIVE_OK != consume(a, value_len)) return ARCHIVE_EOF; if(!read_var_sized(a, &version, &value_len)) return ARCHIVE_EOF; *extra_data_size -= value_len; if(ARCHIVE_OK != consume(a, value_len)) return ARCHIVE_EOF; /* extra_data_size should be zero here. */ cur_filename = archive_entry_pathname_utf8(e); if(cur_filename == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, \"Version entry without file name\"); return ARCHIVE_FATAL; } archive_string_init(&version_string); archive_string_init(&name_utf8_string); /* Prepare a ;123 suffix for the filename, where '123' is the version * value of this file. */ archive_string_sprintf(&version_string, \";%zu\", version); /* Build the new filename. */ archive_strcat(&name_utf8_string, cur_filename); archive_strcat(&name_utf8_string, version_string.s); /* Apply the new filename into this file's context. */ archive_entry_update_pathname_utf8(e, name_utf8_string.s); /* Free buffers. */ archive_string_free(&version_string); archive_string_free(&name_utf8_string); return ARCHIVE_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280184, "input": "static int __init setup_slub_memcg_sysfs(char *str) { int v; if (get_option(&str, &v) > 0) memcg_sysfs_enabled = v; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432529, "input": "static void svm_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa) { struct vcpu_svm *svm = to_svm(vcpu); if (static_cpu_has(X86_FEATURE_FLUSHBYASID)) svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID; else svm->asid_generation--; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230153, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& input = ctx->input(0); const Tensor& input_min_tensor = ctx->input(1); const Tensor& input_max_tensor = ctx->input(2); int num_slices = 1; if (axis_ > -1) { num_slices = input.dim_size(axis_); } OP_REQUIRES(ctx, input_min_tensor.NumElements() == num_slices, errors::InvalidArgument( \"input_min_tensor must have as many elements as input on \" \"the dequantization axis (\", axis_, \"), got \", input_min_tensor.NumElements(), \", expected \", num_slices)); OP_REQUIRES(ctx, input_max_tensor.NumElements() == num_slices, errors::InvalidArgument( \"input_max_tensor must have as many elements as input on \" \"the dequantization axis (\", axis_, \"), got \", input_max_tensor.NumElements(), \", expected \", num_slices)); Tensor* output = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output)); Tensor float_output = need_cast_ ? tensorflow::Tensor(DT_FLOAT, input.shape()) : *output; if (num_slices == 1) { const float min_range = input_min_tensor.flat()(0); const float max_range = input_max_tensor.flat()(0); DequantizeTensor(ctx, input, min_range, max_range, &float_output); } else { OP_REQUIRES(ctx, mode_ != QUANTIZE_MODE_MIN_FIRST, errors::Unimplemented(\"MIN_FIRST mode is not implemented for \" \"Dequantize with axis != -1.\")); int64 pre_dim = 1, post_dim = 1; for (int i = 0; i < axis_; ++i) { pre_dim *= float_output.dim_size(i); } for (int i = axis_ + 1; i < float_output.dims(); ++i) { post_dim *= float_output.dim_size(i); } auto input_tensor = input.template bit_casted_shaped( {pre_dim, num_slices, post_dim}); auto output_tensor = float_output.flat_inner_outer_dims(axis_ - 1); auto min_ranges = input_min_tensor.vec(); auto max_ranges = input_max_tensor.vec(); for (int i = 0; i < num_slices; ++i) { DequantizeSlice(ctx->eigen_device(), ctx, input_tensor.template chip<1>(i), min_ranges(i), max_ranges(i), output_tensor.template chip<1>(i)); } } if (need_cast_) { S* out_ptr = output->flat().data(); float* in_ptr = float_output.flat().data(); for (int64 i = 0; i < float_output.NumElements(); ++i) { out_ptr[i] = static_cast(in_ptr[i]); } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508757, "input": "ha_rows JOIN_TAB::get_examined_rows() { double examined_rows; SQL_SELECT *sel= filesort? filesort->select : this->select; if (sel && sel->quick && use_quick != 2) examined_rows= (double)sel->quick->records; else if (type == JT_NEXT || type == JT_ALL || type == JT_HASH || type ==JT_HASH_NEXT) { if (limit) { /* @todo This estimate is wrong, a LIMIT query may examine much more rows than the LIMIT itself. */ examined_rows= (double)limit; } else { if (table->is_filled_at_execution()) examined_rows= (double)records; else { /* handler->info(HA_STATUS_VARIABLE) has been called in make_join_statistics() */ examined_rows= (double)table->stat_records(); } } } else examined_rows= records_read; if (examined_rows >= (double) HA_ROWS_MAX) return HA_ROWS_MAX; return (ha_rows) examined_rows; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385222, "input": "dissect_tcpopt_user_to(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *tf; proto_tree *field_tree; proto_item *length_item; guint16 to; int offset = 0; tf = proto_tree_add_item(tree, proto_tcp_option_user_to, tvb, offset, -1, ENC_NA); field_tree = proto_item_add_subtree(tf, ett_tcp_option_user_to); proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN); length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN); if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_USER_TO)) return tvb_captured_length(tvb); proto_tree_add_item(field_tree, hf_tcp_option_user_to_granularity, tvb, offset + 2, 2, ENC_BIG_ENDIAN); to = tvb_get_ntohs(tvb, offset + 2) & 0x7FFF; proto_tree_add_item(field_tree, hf_tcp_option_user_to_val, tvb, offset + 2, 2, ENC_BIG_ENDIAN); tcp_info_append_uint(pinfo, \"USER_TO\", to); return tvb_captured_length(tvb); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 265792, "input": "bool CWebSock::SendCookie(const CString& sKey, const CString& sValue) { const CString sPrefixedKey = CString(GetLocalPort()) + \"-\" + sKey; if (!m_sModName.empty()) { return CHTTPSock::SendCookie(\"Mod-\" + m_sModName + \"-\" + sPrefixedKey, sValue); } return CHTTPSock::SendCookie(sPrefixedKey, sValue); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 272250, "input": "mi_prefix(const struct multi_instance *mi) { if (mi && mi->msg_prefix[0]) { return mi->msg_prefix; } else { return \"UNDEF_I\"; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269137, "input": "inline int Offset(const Dims<4>& dims, int i0, int i1, int i2, int i3) { TFLITE_DCHECK(i0 >= 0 && i0 < dims.sizes[0]); TFLITE_DCHECK(i1 >= 0 && i1 < dims.sizes[1]); TFLITE_DCHECK(i2 >= 0 && i2 < dims.sizes[2]); TFLITE_DCHECK(i3 >= 0 && i3 < dims.sizes[3]); return i0 * dims.strides[0] + i1 * dims.strides[1] + i2 * dims.strides[2] + i3 * dims.strides[3]; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453299, "input": "static int bfqq_process_refs(struct bfq_queue *bfqq) { return bfqq->ref - bfqq->allocated - bfqq->entity.on_st_or_in_serv - (bfqq->weight_counter != NULL);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357439, "input": "static OPJ_BOOL opj_j2k_init_info(opj_j2k_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager) { opj_codestream_info_t * l_cstr_info = 00; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); (void)l_cstr_info; OPJ_UNUSED(p_stream); /* TODO mergeV2: check this part which use cstr_info */ /*l_cstr_info = p_j2k->cstr_info; if (l_cstr_info) { OPJ_UINT32 compno; l_cstr_info->tile = (opj_tile_info_t *) opj_malloc(p_j2k->m_cp.tw * p_j2k->m_cp.th * sizeof(opj_tile_info_t)); l_cstr_info->image_w = p_j2k->m_image->x1 - p_j2k->m_image->x0; l_cstr_info->image_h = p_j2k->m_image->y1 - p_j2k->m_image->y0; l_cstr_info->prog = (&p_j2k->m_cp.tcps[0])->prg; l_cstr_info->tw = p_j2k->m_cp.tw; l_cstr_info->th = p_j2k->m_cp.th; l_cstr_info->tile_x = p_j2k->m_cp.tdx;*/ /* new version parser */ /*l_cstr_info->tile_y = p_j2k->m_cp.tdy;*/ /* new version parser */ /*l_cstr_info->tile_Ox = p_j2k->m_cp.tx0;*/ /* new version parser */ /*l_cstr_info->tile_Oy = p_j2k->m_cp.ty0;*/ /* new version parser */ /*l_cstr_info->numcomps = p_j2k->m_image->numcomps; l_cstr_info->numlayers = (&p_j2k->m_cp.tcps[0])->numlayers; l_cstr_info->numdecompos = (OPJ_INT32*) opj_malloc(p_j2k->m_image->numcomps * sizeof(OPJ_INT32)); for (compno=0; compno < p_j2k->m_image->numcomps; compno++) { l_cstr_info->numdecompos[compno] = (&p_j2k->m_cp.tcps[0])->tccps->numresolutions - 1; } l_cstr_info->D_max = 0.0; */ /* ADD Marcela */ /*l_cstr_info->main_head_start = opj_stream_tell(p_stream);*/ /* position of SOC */ /*l_cstr_info->maxmarknum = 100; l_cstr_info->marker = (opj_marker_info_t *) opj_malloc(l_cstr_info->maxmarknum * sizeof(opj_marker_info_t)); l_cstr_info->marknum = 0; }*/ return opj_j2k_calculate_tp(p_j2k, &(p_j2k->m_cp), &p_j2k->m_specific_param.m_encoder.m_total_tile_parts, p_j2k->m_private_image, p_manager); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 450872, "input": "static void lp_release_parport(struct lp_struct *this_lp) { if (test_and_clear_bit(LP_PARPORT_CLAIMED, &this_lp->bits)) { parport_release (this_lp->dev); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280470, "input": "check_NOTE(const struct ofpact_note *a OVS_UNUSED, const struct ofpact_check_params *cp OVS_UNUSED) { return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 429735, "input": "my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, const char *passwd, const char *db) { const MARIADB_CHARSET_INFO *s_cs= mysql->charset; char *s_user= mysql->user, *s_passwd= mysql->passwd, *s_db= mysql->db; int rc; if (mysql->options.charset_name) mysql->charset= mysql_find_charset_name(mysql->options.charset_name); else mysql->charset=mysql_find_charset_name(MARIADB_DEFAULT_CHARSET); mysql->user= strdup(user ? user : \"\"); mysql->passwd= strdup(passwd ? passwd : \"\"); /* db will be set in run_plugin_auth */ mysql->db= 0; rc= run_plugin_auth(mysql, 0, 0, 0, db); /* COM_CHANGE_USER always releases prepared statements, so we need to invalidate them */ ma_invalidate_stmts(mysql, \"mysql_change_user()\"); if (rc==0) { free(s_user); free(s_passwd); free(s_db); if (!mysql->db && db && !(mysql->db= strdup(db))) { SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0); rc= 1; } } else { free(mysql->user); free(mysql->passwd); free(mysql->db); mysql->user= s_user; mysql->passwd= s_passwd; mysql->db= s_db; mysql->charset= s_cs; } return(rc); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 384478, "input": "static int iwl_dump_ini_txf_iter(struct iwl_fw_runtime *fwrt, struct iwl_fw_ini_region_cfg *reg, void *range_ptr, int idx) { struct iwl_fw_ini_error_dump_range *range = range_ptr; struct iwl_txf_iter_data *iter = &fwrt->dump.txf_iter_data; struct iwl_fw_ini_error_dump_register *reg_dump = (void *)range->data; u32 offs = le32_to_cpu(reg->offset), addr; u32 registers_size = le32_to_cpu(reg->fifos.num_of_registers) * sizeof(*reg_dump); __le32 *data; unsigned long flags; int i; if (!iwl_ini_txf_iter(fwrt, reg, idx)) return -EIO; if (!iwl_trans_grab_nic_access(fwrt->trans, &flags)) return -EBUSY; range->fifo_hdr.fifo_num = cpu_to_le32(iter->fifo); range->fifo_hdr.num_of_registers = reg->fifos.num_of_registers; range->range_data_size = cpu_to_le32(iter->fifo_size + registers_size); iwl_write_prph_no_grab(fwrt->trans, TXF_LARC_NUM + offs, iter->fifo); /* * read txf registers. for each register, write to the dump the * register address and its value */ for (i = 0; i < le32_to_cpu(reg->fifos.num_of_registers); i++) { addr = le32_to_cpu(reg->start_addr[i]) + offs; reg_dump->addr = cpu_to_le32(addr); reg_dump->data = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr)); reg_dump++; } if (reg->fifos.header_only) { range->range_data_size = cpu_to_le32(registers_size); goto out; } /* Set the TXF_READ_MODIFY_ADDR to TXF_WR_PTR */ iwl_write_prph_no_grab(fwrt->trans, TXF_READ_MODIFY_ADDR + offs, TXF_WR_PTR + offs); /* Dummy-read to advance the read pointer to the head */ iwl_read_prph_no_grab(fwrt->trans, TXF_READ_MODIFY_DATA + offs); /* Read FIFO */ addr = TXF_READ_MODIFY_DATA + offs; data = (void *)reg_dump; for (i = 0; i < iter->fifo_size; i += sizeof(*data)) *data++ = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr)); out: iwl_trans_release_nic_access(fwrt->trans, &flags); return sizeof(*range) + le32_to_cpu(range->range_data_size); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219793, "input": "Variant HHVM_FUNCTION(mcrypt_module_open, const String& algorithm, const String& algorithm_directory, const String& mode, const String& mode_directory) { MCRYPT td = mcrypt_module_open ((char*)algorithm.data(), (char*)(algorithm_directory.empty() ? MCG(algorithms_dir).data() : algorithm_directory.data()), (char*)mode.data(), (char*)(mode_directory.empty() ? (char*)MCG(modes_dir).data() : mode_directory.data())); if (td == MCRYPT_FAILED) { raise_warning(\"Could not open encryption module\"); return false; } return Variant(req::make(td)); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214409, "input": "opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params) { png_structp png = NULL; png_infop info = NULL; double gamma; int bit_depth, interlace_type, compression_type, filter_type; OPJ_UINT32 i; png_uint_32 width, height = 0U; int color_type; FILE *reader = NULL; OPJ_BYTE** rows = NULL; OPJ_INT32* row32s = NULL; /* j2k: */ opj_image_t *image = NULL; opj_image_cmptparm_t cmptparm[4]; OPJ_UINT32 nr_comp; OPJ_BYTE sigbuf[8]; convert_XXx32s_C1R cvtXXTo32s = NULL; convert_32s_CXPX cvtCxToPx = NULL; OPJ_INT32* planes[4]; if ((reader = fopen(read_idf, \"rb\")) == NULL) { fprintf(stderr, \"pngtoimage: can not open %s\\n\", read_idf); return NULL; } if (fread(sigbuf, 1, MAGIC_SIZE, reader) != MAGIC_SIZE || memcmp(sigbuf, PNG_MAGIC, MAGIC_SIZE) != 0) { fprintf(stderr, \"pngtoimage: %s is no valid PNG file\\n\", read_idf); goto fin; } if ((png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)) == NULL) { goto fin; } if ((info = png_create_info_struct(png)) == NULL) { goto fin; } if (setjmp(png_jmpbuf(png))) { goto fin; } png_init_io(png, reader); png_set_sig_bytes(png, MAGIC_SIZE); png_read_info(png, info); if (png_get_IHDR(png, info, &width, &height, &bit_depth, &color_type, &interlace_type, &compression_type, &filter_type) == 0) { goto fin; } /* png_set_expand(): * expand paletted images to RGB, expand grayscale images of * less than 8-bit depth to 8-bit depth, and expand tRNS chunks * to alpha channels. */ if (color_type == PNG_COLOR_TYPE_PALETTE) { png_set_expand(png); } if (png_get_valid(png, info, PNG_INFO_tRNS)) { png_set_expand(png); } /* We might wan't to expand background */ /* if(png_get_valid(png, info, PNG_INFO_bKGD)) { png_color_16p bgnd; png_get_bKGD(png, info, &bgnd); png_set_background(png, bgnd, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); } */ if (!png_get_gAMA(png, info, &gamma)) { gamma = 1.0; } /* we're not displaying but converting, screen gamma == 1.0 */ png_set_gamma(png, 1.0, gamma); png_read_update_info(png, info); color_type = png_get_color_type(png, info); switch (color_type) { case PNG_COLOR_TYPE_GRAY: nr_comp = 1; break; case PNG_COLOR_TYPE_GRAY_ALPHA: nr_comp = 2; break; case PNG_COLOR_TYPE_RGB: nr_comp = 3; break; case PNG_COLOR_TYPE_RGB_ALPHA: nr_comp = 4; break; default: fprintf(stderr, \"pngtoimage: colortype %d is not supported\\n\", color_type); goto fin; } cvtCxToPx = convert_32s_CXPX_LUT[nr_comp]; bit_depth = png_get_bit_depth(png, info); switch (bit_depth) { case 1: case 2: case 4: case 8: cvtXXTo32s = convert_XXu32s_C1R_LUT[bit_depth]; break; case 16: /* 16 bpp is specific to PNG */ cvtXXTo32s = convert_16u32s_C1R; break; default: fprintf(stderr, \"pngtoimage: bit depth %d is not supported\\n\", bit_depth); goto fin; } rows = (OPJ_BYTE**)calloc(height + 1, sizeof(OPJ_BYTE*)); if (rows == NULL) { fprintf(stderr, \"pngtoimage: memory out\\n\"); goto fin; } for (i = 0; i < height; ++i) { rows[i] = (OPJ_BYTE*)malloc(png_get_rowbytes(png, info)); if (rows[i] == NULL) { fprintf(stderr, \"pngtoimage: memory out\\n\"); goto fin; } } png_read_image(png, rows); /* Create image */ memset(cmptparm, 0, sizeof(cmptparm)); for (i = 0; i < nr_comp; ++i) { cmptparm[i].prec = (OPJ_UINT32)bit_depth; /* bits_per_pixel: 8 or 16 */ cmptparm[i].bpp = (OPJ_UINT32)bit_depth; cmptparm[i].sgnd = 0; cmptparm[i].dx = (OPJ_UINT32)params->subsampling_dx; cmptparm[i].dy = (OPJ_UINT32)params->subsampling_dy; cmptparm[i].w = (OPJ_UINT32)width; cmptparm[i].h = (OPJ_UINT32)height; } image = opj_image_create(nr_comp, &cmptparm[0], (nr_comp > 2U) ? OPJ_CLRSPC_SRGB : OPJ_CLRSPC_GRAY); if (image == NULL) { goto fin; } image->x0 = (OPJ_UINT32)params->image_offset_x0; image->y0 = (OPJ_UINT32)params->image_offset_y0; image->x1 = (OPJ_UINT32)(image->x0 + (width - 1) * (OPJ_UINT32) params->subsampling_dx + 1 + image->x0); image->y1 = (OPJ_UINT32)(image->y0 + (height - 1) * (OPJ_UINT32) params->subsampling_dy + 1 + image->y0); row32s = (OPJ_INT32 *)malloc((size_t)width * nr_comp * sizeof(OPJ_INT32)); if (row32s == NULL) { goto fin; } /* Set alpha channel */ image->comps[nr_comp - 1U].alpha = 1U - (nr_comp & 1U); for (i = 0; i < nr_comp; i++) { planes[i] = image->comps[i].data; } for (i = 0; i < height; ++i) { cvtXXTo32s(rows[i], row32s, (OPJ_SIZE_T)width * nr_comp); cvtCxToPx(row32s, planes, width); planes[0] += width; planes[1] += width; planes[2] += width; planes[3] += width; } fin: if (rows) { for (i = 0; i < height; ++i) if (rows[i]) { free(rows[i]); } free(rows); } if (row32s) { free(row32s); } if (png) { png_destroy_read_struct(&png, &info, NULL); } fclose(reader); return image; }/* pngtoimage() */", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "A flaw was found in OpenJPEG\u2019s encoder. This flaw allows an attacker to pass specially crafted x,y offset input to OpenJPEG to use during encoding. The highest threat from this vulnerability is to confidentiality, integrity, as well as system availability.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2020-27823"}} -{"idx": 281254, "input": "void RGWGetBucketLocation_ObjStore_S3::send_response() { dump_errno(s); end_header(s, this); dump_start(s); RGWZoneGroup zonegroup; string api_name; int ret = store->get_zonegroup(s->bucket_info.zonegroup, zonegroup); if (ret >= 0) { api_name = zonegroup.api_name; } else { if (s->bucket_info.zonegroup != \"default\") { api_name = s->bucket_info.zonegroup; } } s->formatter->dump_format_ns(\"LocationConstraint\", XMLNS_AWS_S3, \"%s\", api_name.c_str()); rgw_flush_formatter_and_reset(s, s->formatter); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 520875, "input": "static Jsi_RC CDataStructGetDfn(Jsi_Interp *interp, Jsi_StructSpec * sl, Jsi_DString *dsPtr) { Jsi_StructSpec *sf; Jsi_DString eStr = {}; sf = jsi_csGetFieldSpec(sl->extData); Jsi_DSPrintf(dsPtr, \"{ \\\"name\\\": \\\"%s\\\", \\\"size\\\":%d\", sl->name, sl->size); if (sl->flags) Jsi_DSPrintf(dsPtr, \", \\\"flags\\\":0x%\" PRIx64, sl->flags); if (sl->help && sl->help[0]) { Jsi_DSAppend(dsPtr, \", \\\"label\\\":\", Jsi_JSONQuote(interp, sl->help, -1, &eStr), NULL); Jsi_DSFree(&eStr); } if (sl->ssig) Jsi_DSPrintf(dsPtr, \", \\\"sig\\\":0x%x\", sl->ssig); Jsi_DSAppend(dsPtr, \", \\\"fields\\\":[\", NULL); #define SSIFNV(s) (s?\"\\\"\":\"\"), (s?s:\"null\"), (s?\"\\\"\":\"\") while (sf->id != JSI_OPTION_END) { Jsi_DSPrintf(dsPtr, \" { \\\"name\\\":\\\"%s\\\", \\\"id\\\":%s%s%s, \\\"size\\\":%d, \\\"bitsize\\\":%d,\" \"\\\"offset\\\":%d, , \\\"bitoffs\\\":%d, \\\"isbit\\\":%d, \\\"label\\\":\", sf->name, SSIFNV(sf->tname), sf->size, sf->bits, sf->offset, sf->boffset, sf->flags&JSI_OPT_IS_BITS?1:0 ); if (sf->help && sf->help[0]) { Jsi_DSAppend(dsPtr, Jsi_JSONQuote(interp, sf->help, -1, &eStr), NULL); Jsi_DSFree(&eStr); } else Jsi_DSAppend(dsPtr,\"\\\"\\\"\", NULL); Jsi_DSAppend(dsPtr, \"}\", NULL); sf++; } Jsi_DSAppend(dsPtr, \"]}\", NULL); return JSI_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 410422, "input": "static int test_dedup(struct libmnt_test *ts, int argc, char *argv[]) { const char *name; char *optstr; int rc; if (argc < 3) return -EINVAL; optstr = xstrdup(argv[1]); name = argv[2]; rc = mnt_optstr_deduplicate_option(&optstr, name); if (!rc) printf(\"result: >%s<\\n\", optstr); free(optstr); return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497627, "input": "void sha1_update(SHACTX c, const void *data, unsigned long len) { SHA1_Update(c,data,len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417845, "input": "static void SCDefaultInterpolation(SplineChar *sc) { SplineSet *cur; SplinePoint *sp; /* We used not to store the dontinterpolate bit. We used to use the */ /* presence or absence of instructions as that flag */ if ( sc->ttf_instrs_len!=0 ) { for ( cur=sc->layers[ly_fore].splines; cur!=NULL; cur=cur->next ) { for ( sp=cur->first; ; ) { if ( sp->ttfindex!=0xffff && SPInterpolate(sp)) sp->dontinterpolate = true; if ( sp->next==NULL ) break; sp=sp->next->to; if ( sp==cur->first ) break; } } } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412009, "input": "handle_delete_command(GraphicsManager *self, const GraphicsCommand *g, Cursor *c, bool *is_dirty, CellPixelSize cell) { static GraphicsCommand d; switch (g->delete_action) { #define I(u, data, func) filter_refs(self, data, g->delete_action == u, func, cell); *is_dirty = true; break #define D(l, u, data, func) case l: case u: I(u, data, func) #define G(l, u, func) D(l, u, g, func) case 0: D('a', 'A', NULL, clear_filter_func); D('i', 'I', &g->id, id_filter_func); G('p', 'P', point_filter_func); G('q', 'Q', point3d_filter_func); G('x', 'X', x_filter_func); G('y', 'Y', y_filter_func); G('z', 'Z', z_filter_func); case 'c': case 'C': d.x_offset = c->x + 1; d.y_offset = c->y + 1; I('C', &d, point_filter_func); default: REPORT_ERROR(\"Unknown graphics command delete action: %c\", g->delete_action); break; #undef G #undef D #undef I } if (!self->image_count && self->count) self->count = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 278032, "input": "set_buflocal_cfu_callback(buf_T *buf UNUSED) { # ifdef FEAT_EVAL copy_global_to_buflocal_cb(&cfu_cb, &buf->b_cfu_cb); # endif }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354513, "input": "static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix); if (kvm_run->kvm_dirty_regs & KVM_SYNC_CRS) { memcpy(&vcpu->arch.sie_block->gcr, &kvm_run->s.regs.crs, 128); /* some control register changes require a tlb flush */ kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); } if (kvm_run->kvm_dirty_regs & KVM_SYNC_ARCH0) { kvm_s390_set_cpu_timer(vcpu, kvm_run->s.regs.cputm); vcpu->arch.sie_block->ckc = kvm_run->s.regs.ckc; } save_access_regs(vcpu->arch.host_acrs); restore_access_regs(vcpu->run->s.regs.acrs); /* save host (userspace) fprs/vrs */ save_fpu_regs(); vcpu->arch.host_fpregs.fpc = current->thread.fpu.fpc; vcpu->arch.host_fpregs.regs = current->thread.fpu.regs; if (MACHINE_HAS_VX) current->thread.fpu.regs = vcpu->run->s.regs.vrs; else current->thread.fpu.regs = vcpu->run->s.regs.fprs; current->thread.fpu.fpc = vcpu->run->s.regs.fpc; if (test_fp_ctl(current->thread.fpu.fpc)) /* User space provided an invalid FPC, let's clear it */ current->thread.fpu.fpc = 0; /* Sync fmt2 only data */ if (likely(!kvm_s390_pv_cpu_is_protected(vcpu))) { sync_regs_fmt2(vcpu, kvm_run); } else { /* * In several places we have to modify our internal view to * not do things that are disallowed by the ultravisor. For * example we must not inject interrupts after specific exits * (e.g. 112 prefix page not secure). We do this by turning * off the machine check, external and I/O interrupt bits * of our PSW copy. To avoid getting validity intercepts, we * do only accept the condition code from userspace. */ vcpu->arch.sie_block->gpsw.mask &= ~PSW_MASK_CC; vcpu->arch.sie_block->gpsw.mask |= kvm_run->psw_mask & PSW_MASK_CC; } kvm_run->kvm_dirty_regs = 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293727, "input": "static int copy_mm(unsigned long clone_flags, struct task_struct *tsk) { struct mm_struct *mm, *oldmm; int retval; tsk->min_flt = tsk->maj_flt = 0; tsk->nvcsw = tsk->nivcsw = 0; #ifdef CONFIG_DETECT_HUNG_TASK tsk->last_switch_count = tsk->nvcsw + tsk->nivcsw; tsk->last_switch_time = 0; #endif tsk->mm = NULL; tsk->active_mm = NULL; /* * Are we cloning a kernel thread? * * We need to steal a active VM for that.. */ oldmm = current->mm; if (!oldmm) return 0; /* initialize the new vmacache entries */ vmacache_flush(tsk); if (clone_flags & CLONE_VM) { mmget(oldmm); mm = oldmm; goto good_mm; } retval = -ENOMEM; mm = dup_mm(tsk, current->mm); if (!mm) goto fail_nomem; good_mm: tsk->mm = mm; tsk->active_mm = mm; return 0; fail_nomem: return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 204826, "input": "lyxml_parse_mem(struct ly_ctx *ctx, const char *data, int options) { FUN_IN; const char *c = data; unsigned int len; struct lyxml_elem *root, *first = NULL, *next; if (!ctx) { LOGARG; return NULL; } if (!data) { /* nothing to parse */ return NULL; } repeat: /* process document */ while (1) { if (!*c) { /* eof */ return first; } else if (is_xmlws(*c)) { /* skip whitespaces */ ign_xmlws(c); } else if (!strncmp(c, \"\", &len)) { goto error; } c += len; } else if (!strncmp(c, \"\", &len)) { goto error; } c += len; } else if (!strncmp(c, \" */ LOGERR(ctx, LY_EINVAL, \"DOCTYPE not supported in XML documents.\"); goto error; } else if (*c == '<') { /* element - process it in next loop to strictly follow XML * format */ break; } else { LOGVAL(ctx, LYE_XML_INCHAR, LY_VLOG_NONE, NULL, c); goto error; } } root = lyxml_parse_elem(ctx, c, &len, NULL, options); if (!root) { goto error; } else if (!first) { first = root; } else { first->prev->next = root; root->prev = first->prev; first->prev = root; } c += len; /* ignore the rest of document where can be comments, PIs and whitespaces, * note that we are not detecting syntax errors in these parts */ ign_xmlws(c); if (*c) { if (options & LYXML_PARSE_MULTIROOT) { goto repeat; } else { LOGWRN(ctx, \"There are some not parsed data:\\n%s\", c); } } return first; error: LY_TREE_FOR_SAFE(first, next, root) { lyxml_free(ctx, root); } return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Uncontrolled Recursion"], "explanation": "A stack overflow in libyang <= v1.0.225 can cause a denial of service through function lyxml_parse_mem(). lyxml_parse_elem() function will be called recursively, which will consume stack space and lead to crash.", "severity_level": "NoInfo", "cwe": "CWE-674", "cve": "CVE-2021-28903"}} -{"idx": 303470, "input": "handshake_hash_buffer_empty(gnutls_session_t session) { _gnutls_buffers_log(\"BUF[HSK]: Emptied buffer\\n\"); session->internals.handshake_hash_buffer_prev_len = 0; session->internals.handshake_hash_buffer.length = 0; return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 89056, "input": "unsigned long WebGraphicsContext3DDefaultImpl::getError() { if (m_syntheticErrors.size() > 0) { ListHashSet::iterator iter = m_syntheticErrors.begin(); unsigned long err = *iter; m_syntheticErrors.remove(iter); return err; } makeContextCurrent(); return glGetError(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417917, "input": "static int SFDOmit(SplineChar *sc) { int layer; BDFFont *bdf; if ( sc==NULL ) return( true ); if ( sc->comment!=NULL || sc->color!=COLOR_DEFAULT ) return( false ); for ( layer = ly_back; layerlayer_cnt; ++layer ) { if ( sc->layers[layer].splines!=NULL || sc->layers[layer].refs!=NULL || sc->layers[layer].images!=NULL ) return( false ); } if ( sc->parent->onlybitmaps ) { for ( bdf = sc->parent->bitmaps; bdf!=NULL; bdf=bdf->next ) { if ( sc->orig_posglyphcnt && bdf->glyphs[sc->orig_pos]!=NULL ) return( false ); } } if ( !sc->widthset ) return(true); return( false ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445671, "input": "static __init int init_trace_selftests(void) { struct trace_selftests *p, *n; struct tracer *t, **last; int ret; selftests_can_run = true; mutex_lock(&trace_types_lock); if (list_empty(&postponed_selftests)) goto out; pr_info(\"Running postponed tracer tests:\\n\"); list_for_each_entry_safe(p, n, &postponed_selftests, list) { ret = run_tracer_selftest(p->type); /* If the test fails, then warn and remove from available_tracers */ if (ret < 0) { WARN(1, \"tracer: %s failed selftest, disabling\\n\", p->type->name); last = &trace_types; for (t = trace_types; t; t = t->next) { if (t == p->type) { *last = t->next; break; } last = &t->next; } } list_del(&p->list); kfree(p); } out: mutex_unlock(&trace_types_lock); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431044, "input": "static int nfs4_xdr_dec_bind_conn_to_session(struct rpc_rqst *rqstp, struct xdr_stream *xdr, void *res) { struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (!status) status = decode_bind_conn_to_session(xdr, res); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381940, "input": "static void oidc_log_session_expires(request_rec *r, const char *msg, apr_time_t session_expires) { char buf[APR_RFC822_DATE_LEN + 1]; apr_rfc822_date(buf, session_expires); oidc_debug(r, \"%s: %s (in %\" APR_TIME_T_FMT \" secs from now)\", msg, buf, apr_time_sec(session_expires - apr_time_now())); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 101630, "input": "void EnterDecodingState() { VideoDecoder::DecoderStatus status; scoped_refptr video_frame; DecodeSingleFrame(i_frame_buffer_, &status, &video_frame); EXPECT_EQ(status, VideoDecoder::kOk); ASSERT_TRUE(video_frame); EXPECT_FALSE(video_frame->IsEndOfStream()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 514563, "input": "TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db, const char *table_name, int *p_error) { TABLE *tab= find_locked_table(thd->open_tables, db, table_name); int error; if (unlikely(!tab)) { error= ER_TABLE_NOT_LOCKED; goto err_exit; } /* It is not safe to upgrade the metadata lock without a global IX lock. This can happen with FLUSH TABLES WITH READ LOCK as we in these cases don't take a global IX lock in order to be compatible with global read lock. */ if (unlikely(!thd->mdl_context.is_lock_owner(MDL_key::BACKUP, \"\", \"\", MDL_BACKUP_DDL))) { error= ER_TABLE_NOT_LOCKED_FOR_WRITE; goto err_exit; } while (tab->mdl_ticket != NULL && !tab->mdl_ticket->is_upgradable_or_exclusive() && (tab= find_locked_table(tab->next, db, table_name))) continue; if (unlikely(!tab)) { error= ER_TABLE_NOT_LOCKED_FOR_WRITE; goto err_exit; } return tab; err_exit: if (p_error) *p_error= error; else my_error(error, MYF(0), table_name); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 381991, "input": "void CServer::SnapSetStaticsize(int ItemType, int Size) { m_SnapshotDelta.SetStaticsize(ItemType, Size); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198174, "input": "Status KernelAndDeviceOp::Run( ScopedStepContainer* step_container, const EagerKernelArgs& inputs, std::vector* outputs, CancellationManager* cancellation_manager, const absl::optional& remote_func_params) { OpKernelContext::Params params; params.device = device_; params.frame_iter = FrameAndIter(0, 0); params.inputs = inputs.GetTensorValues(); params.op_kernel = kernel_.get(); params.resource_manager = device_->resource_manager(); params.input_alloc_attrs = &input_alloc_attrs_; params.output_attr_array = output_alloc_attrs_.data(); params.function_library = flr_; params.slice_reader_cache = &slice_reader_cache_; params.rendezvous = rendezvous_; OpExecutionState* op_execution_state = nullptr; CancellationManager default_cancellation_manager; if (cancellation_manager) { params.cancellation_manager = cancellation_manager; } else if (kernel_->is_deferred()) { op_execution_state = new OpExecutionState; params.cancellation_manager = &op_execution_state->cancellation_manager; params.inc_num_deferred_ops_function = [op_execution_state]() { op_execution_state->Ref(); }; params.dec_num_deferred_ops_function = [op_execution_state]() { op_execution_state->Unref(); }; } else { params.cancellation_manager = &default_cancellation_manager; } params.log_memory = log_memory_; params.runner = get_runner(); params.step_container = step_container == nullptr ? &step_container_ : step_container; auto step_container_cleanup = gtl::MakeCleanup([step_container, this] { if (step_container == nullptr) { this->step_container_.CleanUp(); } }); params.collective_executor = collective_executor_ ? collective_executor_->get() : nullptr; OpKernelContext context(¶ms); { port::ScopedFlushDenormal flush; port::ScopedSetRound round(FE_TONEAREST); // 'AnnotatedTraceMe' will trace both scheduling time on host and execution // time on device of the OpKernel. profiler::AnnotatedTraceMe activity( [&] { return kernel_->TraceString(context, /*verbose=*/false); }, profiler::TraceMeLevel::kInfo); device_->Compute(kernel_.get(), &context); } // Clean up execution op_execution_state if deferred ops aren't running. if (op_execution_state != nullptr) { op_execution_state->Unref(); } if (!context.status().ok()) return context.status(); if (outputs != nullptr) { outputs->clear(); for (int i = 0; i < context.num_outputs(); ++i) { outputs->push_back(Tensor(*context.mutable_output(i))); } } return Status::OK(); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Divide By Zero"], "explanation": "In Tensorflow before versions 1.15.4, 2.0.3, 2.1.2, 2.2.1 and 2.3.1, the `tf.raw_ops.Switch` operation takes as input a tensor and a boolean and outputs two tensors. Depending on the boolean value, one of the tensors is exactly the input tensor whereas the other one should be an empty tensor. However, the eager runtime traverses all tensors in the output. Since only one of the tensors is defined, the other one is `nullptr`, hence we are binding a reference to `nullptr`. This is undefined behavior and reported as an error if compiling with `-fsanitize=null`. In this case, this results in a segmentation fault The issue is patched in commit da8558533d925694483d2c136a9220d6d49d843c, and is released in TensorFlow versions 1.15.4, 2.0.3, 2.1.2, 2.2.1, or 2.3.1.", "severity_level": "NoInfo", "cwe": "CWE-369", "cve": "CVE-2020-15190"}} -{"idx": 330261, "input": "MagickExport Image *VignetteImage(const Image *image,const double radius, const double sigma,const ssize_t x,const ssize_t y,ExceptionInfo *exception) { char ellipse[MagickPathExtent]; DrawInfo *draw_info; Image *canvas, *blur_image, *oval_image, *vignette_image; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); canvas=CloneImage(image,0,0,MagickTrue,exception); if (canvas == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(canvas,DirectClass,exception) == MagickFalse) { canvas=DestroyImage(canvas); return((Image *) NULL); } canvas->alpha_trait=BlendPixelTrait; oval_image=CloneImage(canvas,canvas->columns,canvas->rows,MagickTrue, exception); if (oval_image == (Image *) NULL) { canvas=DestroyImage(canvas); return((Image *) NULL); } (void) QueryColorCompliance(\"#000000\",AllCompliance, &oval_image->background_color,exception); (void) SetImageBackgroundColor(oval_image,exception); draw_info=CloneDrawInfo((const ImageInfo *) NULL,(const DrawInfo *) NULL); (void) QueryColorCompliance(\"#ffffff\",AllCompliance,&draw_info->fill, exception); (void) QueryColorCompliance(\"#ffffff\",AllCompliance,&draw_info->stroke, exception); (void) FormatLocaleString(ellipse,MagickPathExtent,\"ellipse %g,%g,%g,%g,\" \"0.0,360.0\",image->columns/2.0,image->rows/2.0,image->columns/2.0-x, image->rows/2.0-y); draw_info->primitive=AcquireString(ellipse); (void) DrawImage(oval_image,draw_info,exception); draw_info=DestroyDrawInfo(draw_info); blur_image=BlurImage(oval_image,radius,sigma,exception); oval_image=DestroyImage(oval_image); if (blur_image == (Image *) NULL) { canvas=DestroyImage(canvas); return((Image *) NULL); } blur_image->alpha_trait=UndefinedPixelTrait; (void) CompositeImage(canvas,blur_image,IntensityCompositeOp,MagickTrue, 0,0,exception); blur_image=DestroyImage(blur_image); vignette_image=MergeImageLayers(canvas,FlattenLayer,exception); canvas=DestroyImage(canvas); if (vignette_image != (Image *) NULL) (void) TransformImageColorspace(vignette_image,image->colorspace,exception); return(vignette_image); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 440926, "input": "static void shutdown_busid(struct bus_id_priv *busid_priv) { usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED); /* wait for the stop of the event handler */ usbip_stop_eh(&busid_priv->sdev->ud); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 509364, "input": "bool cleanup_excluding_fields_processor(void *arg) { return field ? 0 : cleanup_processor(arg); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 375305, "input": "static bool access_pidfd_pidns(struct pid *pid) { struct pid_namespace *active = task_active_pid_ns(current); struct pid_namespace *p = ns_of_pid(pid); for (;;) { if (!p) return false; if (p == active) break; p = p->parent; } return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 277975, "input": "ins_compl_add_tv(typval_T *tv, int dir, int fast) { char_u *word; int dup = FALSE; int empty = FALSE; int flags = fast ? CP_FAST : 0; char_u *(cptext[CPT_COUNT]); typval_T user_data; int status; user_data.v_type = VAR_UNKNOWN; if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL) { word = dict_get_string(tv->vval.v_dict, \"word\", FALSE); cptext[CPT_ABBR] = dict_get_string(tv->vval.v_dict, \"abbr\", FALSE); cptext[CPT_MENU] = dict_get_string(tv->vval.v_dict, \"menu\", FALSE); cptext[CPT_KIND] = dict_get_string(tv->vval.v_dict, \"kind\", FALSE); cptext[CPT_INFO] = dict_get_string(tv->vval.v_dict, \"info\", FALSE); dict_get_tv(tv->vval.v_dict, \"user_data\", &user_data); if (dict_get_string(tv->vval.v_dict, \"icase\", FALSE) != NULL && dict_get_number(tv->vval.v_dict, \"icase\")) flags |= CP_ICASE; if (dict_get_string(tv->vval.v_dict, \"dup\", FALSE) != NULL) dup = dict_get_number(tv->vval.v_dict, \"dup\"); if (dict_get_string(tv->vval.v_dict, \"empty\", FALSE) != NULL) empty = dict_get_number(tv->vval.v_dict, \"empty\"); if (dict_get_string(tv->vval.v_dict, \"equal\", FALSE) != NULL && dict_get_number(tv->vval.v_dict, \"equal\")) flags |= CP_EQUAL; } else { word = tv_get_string_chk(tv); CLEAR_FIELD(cptext); } if (word == NULL || (!empty && *word == NUL)) { clear_tv(&user_data); return FAIL; } status = ins_compl_add(word, -1, NULL, cptext, &user_data, dir, flags, dup); if (status != OK) clear_tv(&user_data); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373794, "input": "if(pThis->pqDA != NULL) { qqueueDestruct(&pThis->pqDA); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232131, "input": "R_API char *r_core_op_str(RCore *core, ut64 addr) { RAsmOp op = {0}; ut8 buf[64]; r_asm_set_pc (core->assembler, addr); r_io_read_at (core->io, addr, buf, sizeof (buf)); int ret = r_asm_disassemble (core->assembler, &op, buf, sizeof (buf)); char *str = (ret > 0)? strdup (r_strbuf_get (&op.buf_asm)): NULL; r_asm_op_fini (&op); return str; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 460800, "input": "msg_add_fname(buf_T *buf, char_u *fname) { if (fname == NULL) fname = (char_u *)\"-stdin-\"; home_replace(buf, fname, IObuff + 1, IOSIZE - 4, TRUE); IObuff[0] = '\"'; STRCAT(IObuff, \"\\\" \"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333819, "input": "void RGWGetObjLayout_ObjStore_S3::send_response() { if (op_ret) set_req_state_err(s, op_ret); dump_errno(s); end_header(s, this, \"application/json\"); JSONFormatter f; if (op_ret < 0) { return; } f.open_object_section(\"result\"); ::encode_json(\"head\", head_obj, &f); ::encode_json(\"manifest\", *manifest, &f); f.open_array_section(\"data_location\"); for (auto miter = manifest->obj_begin(); miter != manifest->obj_end(); ++miter) { f.open_object_section(\"obj\"); rgw_raw_obj raw_loc = miter.get_location().get_raw_obj(store); uint64_t ofs = miter.get_ofs(); uint64_t left = manifest->get_obj_size() - ofs; ::encode_json(\"ofs\", miter.get_ofs(), &f); ::encode_json(\"loc\", raw_loc, &f); ::encode_json(\"loc_ofs\", miter.location_ofs(), &f); uint64_t loc_size = miter.get_stripe_size(); if (loc_size > left) { loc_size = left; } ::encode_json(\"loc_size\", loc_size, &f); f.close_section(); rgw_flush_formatter(s, &f); } f.close_section(); f.close_section(); rgw_flush_formatter(s, &f); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 445607, "input": "int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) { /* do nothing if flag is already set */ if (!!(tr->trace_flags & mask) == !!enabled) return 0; /* Give the tracer a chance to approve the change */ if (tr->current_trace->flag_changed) if (tr->current_trace->flag_changed(tr, mask, !!enabled)) return -EINVAL; if (enabled) tr->trace_flags |= mask; else tr->trace_flags &= ~mask; if (mask == TRACE_ITER_RECORD_CMD) trace_event_enable_cmd_record(enabled); if (mask == TRACE_ITER_RECORD_TGID) { if (!tgid_map) tgid_map = kzalloc((PID_MAX_DEFAULT + 1) * sizeof(*tgid_map), GFP_KERNEL); if (!tgid_map) { tr->trace_flags &= ~TRACE_ITER_RECORD_TGID; return -ENOMEM; } trace_event_enable_tgid_record(enabled); } if (mask == TRACE_ITER_EVENT_FORK) trace_event_follow_fork(tr, enabled); if (mask == TRACE_ITER_FUNC_FORK) ftrace_pid_follow_fork(tr, enabled); if (mask == TRACE_ITER_OVERWRITE) { ring_buffer_change_overwrite(tr->trace_buffer.buffer, enabled); #ifdef CONFIG_TRACER_MAX_TRACE ring_buffer_change_overwrite(tr->max_buffer.buffer, enabled); #endif } if (mask == TRACE_ITER_PRINTK) { trace_printk_start_stop_comm(enabled); trace_printk_control(enabled); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 341983, "input": "static u64 time_to_jiffies(u64 sec, u32 nsec) { if (sec || nsec) { struct timespec64 ts = { sec, min_t(u32, nsec, NSEC_PER_SEC - 1) }; return get_jiffies_64() + timespec64_to_jiffies(&ts); } else return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385326, "input": "xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { int i; if ((cur == NULL) || (val == NULL)) return(-1); /* @@ with_ns to check whether namespace nodes should be looked at @@ */ /* * prevent duplicates */ for (i = 0;i < cur->nodeNr;i++) if (cur->nodeTab[i] == val) return(0); /* * grow the nodeTab if needed */ if (cur->nodeMax == 0) { cur->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); if (cur->nodeTab == NULL) { xmlXPathErrMemory(NULL, \"growing nodeset\\n\"); return(-1); } memset(cur->nodeTab, 0 , XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); cur->nodeMax = XML_NODESET_DEFAULT; } else if (cur->nodeNr == cur->nodeMax) { xmlNodePtr *temp; if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) { xmlXPathErrMemory(NULL, \"growing nodeset hit limit\\n\"); return(-1); } temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, \"growing nodeset\\n\"); return(-1); } cur->nodeMax *= 2; cur->nodeTab = temp; } if (val->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) val; cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else cur->nodeTab[cur->nodeNr++] = val; return(0); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338010, "input": "int imap_exec (IMAP_DATA* idata, const char* cmdstr, int flags) { int rc; if ((rc = cmd_start (idata, cmdstr, flags)) < 0) { cmd_handle_fatal (idata); return -1; } if (flags & IMAP_CMD_QUEUE) return 0; if ((flags & IMAP_CMD_POLL) && (ImapPollTimeout > 0) && (mutt_socket_poll (idata->conn, ImapPollTimeout)) == 0) { mutt_error (_(\"Connection to %s timed out\"), idata->conn->account.host); mutt_sleep (2); cmd_handle_fatal (idata); return -1; } do rc = imap_cmd_step (idata); while (rc == IMAP_CMD_CONTINUE); if (rc == IMAP_CMD_NO && (flags & IMAP_CMD_FAIL_OK)) return -2; if (rc != IMAP_CMD_OK) { if ((flags & IMAP_CMD_FAIL_OK) && idata->status != IMAP_FATAL) return -2; dprint (1, (debugfile, \"imap_exec: command failed: %s\\n\", idata->buf)); return -1; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208406, "input": "static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) { char command[MagickPathExtent], *density, filename[MagickPathExtent], input_filename[MagickPathExtent], message[MagickPathExtent], *options, postscript_filename[MagickPathExtent]; const char *option; const DelegateInfo *delegate_info; GeometryInfo geometry_info; Image *image, *next, *pdf_image; ImageInfo *read_info; int file; MagickBooleanType fitPage, status; MagickStatusType flags; PDFInfo pdf_info; PointInfo delta; RectangleInfo page; register ssize_t i; size_t scene; assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); /* Open image file. */ image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } status=AcquireUniqueSymbolicLink(image_info->filename,input_filename); if (status == MagickFalse) { ThrowFileException(exception,FileOpenError,\"UnableToCreateTemporaryFile\", image_info->filename); image=DestroyImageList(image); return((Image *) NULL); } /* Set the page density. */ delta.x=DefaultResolution; delta.y=DefaultResolution; if ((image->resolution.x == 0.0) || (image->resolution.y == 0.0)) { flags=ParseGeometry(PSDensityGeometry,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } if (image_info->density != (char *) NULL) { flags=ParseGeometry(image_info->density,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } (void) memset(&page,0,sizeof(page)); (void) ParseAbsoluteGeometry(PSPageGeometry,&page); if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); page.width=(size_t) ((ssize_t) ceil((double) (page.width* image->resolution.x/delta.x)-0.5)); page.height=(size_t) ((ssize_t) ceil((double) (page.height* image->resolution.y/delta.y)-0.5)); /* Determine page geometry from the PDF media box. */ ReadPDFInfo(image_info,image,&pdf_info,exception); (void) CloseBlob(image); /* Set PDF render geometry. */ if ((fabs(pdf_info.bounds.x2-pdf_info.bounds.x1) >= MagickEpsilon) && (fabs(pdf_info.bounds.y2-pdf_info.bounds.y1) >= MagickEpsilon)) { (void) FormatImageProperty(image,\"pdf:HiResBoundingBox\", \"%gx%g%+.15g%+.15g\",pdf_info.bounds.x2-pdf_info.bounds.x1, pdf_info.bounds.y2-pdf_info.bounds.y1,pdf_info.bounds.x1, pdf_info.bounds.y1); page.width=(size_t) ((ssize_t) ceil((double) ((pdf_info.bounds.x2- pdf_info.bounds.x1)*image->resolution.x/delta.x)-0.5)); page.height=(size_t) ((ssize_t) ceil((double) ((pdf_info.bounds.y2- pdf_info.bounds.y1)*image->resolution.y/delta.y)-0.5)); } fitPage=MagickFalse; option=GetImageOption(image_info,\"pdf:fit-page\"); if (option != (char *) NULL) { char *page_geometry; page_geometry=GetPageGeometry(option); flags=ParseMetaGeometry(page_geometry,&page.x,&page.y,&page.width, &page.height); page_geometry=DestroyString(page_geometry); if (flags == NoValue) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \"InvalidGeometry\",\"`%s'\",option); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } page.width=(size_t) ((ssize_t) ceil((double) (page.width* image->resolution.x/delta.x)-0.5)); page.height=(size_t) ((ssize_t) ceil((double) (page.height* image->resolution.y/delta.y)-0.5)); fitPage=MagickTrue; } if ((fabs(pdf_info.angle) == 90.0) || (fabs(pdf_info.angle) == 270.0)) { size_t swap; swap=page.width; page.width=page.height; page.height=swap; } if (IssRGBCompatibleColorspace(image_info->colorspace) != MagickFalse) pdf_info.cmyk=MagickFalse; /* Create Ghostscript control file. */ file=AcquireUniqueFileResource(postscript_filename); if (file == -1) { ThrowFileException(exception,FileOpenError,\"UnableToCreateTemporaryFile\", image_info->filename); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } if (write(file,\" \",1) != 1) { file=close(file)-1; (void) RelinquishUniqueFileResource(postscript_filename); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } file=close(file)-1; /* Render Postscript with the Ghostscript delegate. */ if (image_info->monochrome != MagickFalse) delegate_info=GetDelegateInfo(\"ps:mono\",(char *) NULL,exception); else if (pdf_info.cmyk != MagickFalse) delegate_info=GetDelegateInfo(\"ps:cmyk\",(char *) NULL,exception); else delegate_info=GetDelegateInfo(\"ps:alpha\",(char *) NULL,exception); if (delegate_info == (const DelegateInfo *) NULL) { (void) RelinquishUniqueFileResource(postscript_filename); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } density=AcquireString(\"\"); options=AcquireString(\"\"); (void) FormatLocaleString(density,MagickPathExtent,\"%gx%g\", image->resolution.x,image->resolution.y); if ((image_info->page != (char *) NULL) || (fitPage != MagickFalse)) (void) FormatLocaleString(options,MagickPathExtent,\"-g%.20gx%.20g \",(double) page.width,(double) page.height); if (fitPage != MagickFalse) (void) ConcatenateMagickString(options,\"-dPSFitPage \",MagickPathExtent); if (pdf_info.cropbox != MagickFalse) (void) ConcatenateMagickString(options,\"-dUseCropBox \",MagickPathExtent); if (pdf_info.trimbox != MagickFalse) (void) ConcatenateMagickString(options,\"-dUseTrimBox \",MagickPathExtent); option=GetImageOption(image_info,\"pdf:stop-on-error\"); if (IsStringTrue(option) != MagickFalse) (void) ConcatenateMagickString(options,\"-dPDFSTOPONERROR \", MagickPathExtent); option=GetImageOption(image_info,\"pdf:interpolate\"); if (IsStringTrue(option) != MagickFalse) (void) ConcatenateMagickString(options,\"-dInterpolateControl=-1 \", MagickPathExtent); option=GetImageOption(image_info,\"authenticate\"); if ((option != (char *) NULL) && (strpbrk(option,\"&;<>|\\\"\") == (char *) NULL)) { char passphrase[MagickPathExtent]; (void) FormatLocaleString(passphrase,MagickPathExtent, \"\\\"-sPDFPassword=%s\\\" \",option); (void) ConcatenateMagickString(options,passphrase,MagickPathExtent); } read_info=CloneImageInfo(image_info); *read_info->magick='\\0'; if (read_info->number_scenes != 0) { char pages[MagickPathExtent]; (void) FormatLocaleString(pages,MagickPathExtent,\"-dFirstPage=%.20g \" \"-dLastPage=%.20g\",(double) read_info->scene+1,(double) (read_info->scene+read_info->number_scenes)); (void) ConcatenateMagickString(options,pages,MagickPathExtent); read_info->number_scenes=0; if (read_info->scenes != (char *) NULL) *read_info->scenes='\\0'; } (void) CopyMagickString(filename,read_info->filename,MagickPathExtent); (void) AcquireUniqueFilename(filename); (void) RelinquishUniqueFileResource(filename); (void) ConcatenateMagickString(filename,\"%d\",MagickPathExtent); (void) FormatLocaleString(command,MagickPathExtent, GetDelegateCommands(delegate_info), read_info->antialias != MagickFalse ? 4 : 1, read_info->antialias != MagickFalse ? 4 : 1,density,options,filename, postscript_filename,input_filename); options=DestroyString(options); density=DestroyString(density); *message='\\0'; status=InvokeGhostscriptDelegate(read_info->verbose,command,message, exception); (void) RelinquishUniqueFileResource(postscript_filename); (void) RelinquishUniqueFileResource(input_filename); pdf_image=(Image *) NULL; if (status == MagickFalse) for (i=1; ; i++) { (void) InterpretImageFilename(image_info,image,filename,(int) i, read_info->filename,exception); if (IsGhostscriptRendered(read_info->filename) == MagickFalse) break; (void) RelinquishUniqueFileResource(read_info->filename); } else for (i=1; ; i++) { (void) InterpretImageFilename(image_info,image,filename,(int) i, read_info->filename,exception); if (IsGhostscriptRendered(read_info->filename) == MagickFalse) break; read_info->blob=NULL; read_info->length=0; next=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); if (next == (Image *) NULL) break; AppendImageToList(&pdf_image,next); } read_info=DestroyImageInfo(read_info); if (pdf_image == (Image *) NULL) { if (*message != '\\0') (void) ThrowMagickException(exception,GetMagickModule(),DelegateError, \"PDFDelegateFailed\",\"`%s'\",message); CleanupPDFInfo(&pdf_info); image=DestroyImage(image); return((Image *) NULL); } if (LocaleCompare(pdf_image->magick,\"BMP\") == 0) { Image *cmyk_image; cmyk_image=ConsolidateCMYKImages(pdf_image,exception); if (cmyk_image != (Image *) NULL) { pdf_image=DestroyImageList(pdf_image); pdf_image=cmyk_image; } } if (pdf_info.profile != (StringInfo *) NULL) { char *profile; (void) SetImageProfile(image,\"xmp\",pdf_info.profile,exception); profile=(char *) GetStringInfoDatum(pdf_info.profile); if (strstr(profile,\"Adobe Illustrator\") != (char *) NULL) (void) CopyMagickString(image->magick,\"AI\",MagickPathExtent); } CleanupPDFInfo(&pdf_info); if (image_info->number_scenes != 0) { Image *clone_image; /* Add place holder images to meet the subimage specification requirement. */ for (i=0; i < (ssize_t) image_info->scene; i++) { clone_image=CloneImage(pdf_image,1,1,MagickTrue,exception); if (clone_image != (Image *) NULL) PrependImageToList(&pdf_image,clone_image); } } do { (void) CopyMagickString(pdf_image->filename,filename,MagickPathExtent); (void) CopyMagickString(pdf_image->magick,image->magick,MagickPathExtent); pdf_image->page=page; (void) CloneImageProfiles(pdf_image,image); (void) CloneImageProperties(pdf_image,image); next=SyncNextImageInList(pdf_image); if (next != (Image *) NULL) pdf_image=next; } while (next != (Image *) NULL); image=DestroyImage(image); scene=0; for (next=GetFirstImageInList(pdf_image); next != (Image *) NULL; ) { next->scene=scene++; next=GetNextImageInList(next); } return(GetFirstImageInList(pdf_image)); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["XML Injection (aka Blind XPath Injection)"], "explanation": "ImageMagick before 6.9.11-40 and 7.x before 7.0.10-40 mishandles the -authenticate option, which allows setting a password for password-protected PDF files. The user-controlled password was not properly escaped/sanitized and it was therefore possible to inject additional shell commands via coders/pdf.c.", "severity_level": "NoInfo", "cwe": "CWE-91", "cve": "CVE-2020-29599"}} -{"idx": 232553, "input": "static void clear_caller_saved_regs(struct bpf_verifier_env *env, struct bpf_reg_state *regs) { int i; /* after the call registers r0 - r5 were scratched */ for (i = 0; i < CALLER_SAVED_REGS; i++) { mark_reg_not_init(env, regs, caller_saved[i]); check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 293714, "input": "static struct mm_struct *dup_mm(struct task_struct *tsk, struct mm_struct *oldmm) { struct mm_struct *mm; int err; mm = allocate_mm(); if (!mm) goto fail_nomem; memcpy(mm, oldmm, sizeof(*mm)); if (!mm_init(mm, tsk, mm->user_ns)) goto fail_nomem; err = dup_mmap(mm, oldmm); if (err) goto free_pt; mm->hiwater_rss = get_mm_rss(mm); mm->hiwater_vm = mm->total_vm; if (mm->binfmt && !try_module_get(mm->binfmt->module)) goto free_pt; return mm; free_pt: /* don't put binfmt in mmput, we haven't got module yet */ mm->binfmt = NULL; mm_init_owner(mm, NULL); mmput(mm); fail_nomem: return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219200, "input": "bool HHVM_FUNCTION(mcrypt_generic_deinit, const Resource& td) { auto pm = get_valid_mcrypt_resource(td); if (!pm) { return false; } if (mcrypt_generic_deinit(pm->m_td) < 0) { raise_warning(\"Could not terminate encryption specifier\"); return false; } pm->m_init = false; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 497489, "input": "create_device (ClutterDeviceManagerXI2 *manager_xi2, ClutterBackendX11 *backend_x11, XIDeviceInfo *info) { ClutterInputDeviceType source, touch_source; ClutterInputDevice *retval; ClutterInputMode mode; gboolean is_enabled; guint num_touches = 0; if (info->use == XIMasterKeyboard || info->use == XISlaveKeyboard) source = CLUTTER_KEYBOARD_DEVICE; else if (info->use == XISlavePointer && is_touch_device (info->classes, info->num_classes, &touch_source, &num_touches)) { source = touch_source; } else { gchar *name; name = g_ascii_strdown (info->name, -1); if (strstr (name, \"eraser\") != NULL) source = CLUTTER_ERASER_DEVICE; else if (strstr (name, \"cursor\") != NULL) source = CLUTTER_CURSOR_DEVICE; else if (strstr (name, \"wacom\") != NULL || strstr (name, \"pen\") != NULL) source = CLUTTER_PEN_DEVICE; else source = CLUTTER_POINTER_DEVICE; g_free (name); } switch (info->use) { case XIMasterKeyboard: case XIMasterPointer: mode = CLUTTER_INPUT_MODE_MASTER; is_enabled = TRUE; break; case XISlaveKeyboard: case XISlavePointer: mode = CLUTTER_INPUT_MODE_SLAVE; is_enabled = FALSE; break; case XIFloatingSlave: default: mode = CLUTTER_INPUT_MODE_FLOATING; is_enabled = FALSE; break; } retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_XI2, \"name\", info->name, \"id\", info->deviceid, \"has-cursor\", (info->use == XIMasterPointer), \"device-manager\", manager_xi2, \"device-type\", source, \"device-mode\", mode, \"backend\", backend_x11, \"enabled\", is_enabled, NULL); translate_device_classes (backend_x11->xdpy, retval, info->classes, info->num_classes); CLUTTER_NOTE (BACKEND, \"Created device '%s' (id: %d, has-cursor: %s)\", info->name, info->deviceid, info->use == XIMasterPointer ? \"yes\" : \"no\"); return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364164, "input": "static pmd_t move_soft_dirty_pmd(pmd_t pmd) { #ifdef CONFIG_MEM_SOFT_DIRTY if (unlikely(is_pmd_migration_entry(pmd))) pmd = pmd_swp_mksoft_dirty(pmd); else if (pmd_present(pmd)) pmd = pmd_mksoft_dirty(pmd); #endif return pmd; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 210612, "input": "MagickExport Image *AcquireImage(const ImageInfo *image_info) { const char *option; Image *image; MagickStatusType flags; /* Allocate image structure. */ (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\"); image=(Image *) AcquireCriticalMemory(sizeof(*image)); (void) memset(image,0,sizeof(*image)); /* Initialize Image structure. */ (void) CopyMagickString(image->magick,\"MIFF\",MaxTextExtent); image->storage_class=DirectClass; image->depth=MAGICKCORE_QUANTUM_DEPTH; image->colorspace=sRGBColorspace; image->rendering_intent=PerceptualIntent; image->gamma=1.000f/2.200f; image->chromaticity.red_primary.x=0.6400f; image->chromaticity.red_primary.y=0.3300f; image->chromaticity.red_primary.z=0.0300f; image->chromaticity.green_primary.x=0.3000f; image->chromaticity.green_primary.y=0.6000f; image->chromaticity.green_primary.z=0.1000f; image->chromaticity.blue_primary.x=0.1500f; image->chromaticity.blue_primary.y=0.0600f; image->chromaticity.blue_primary.z=0.7900f; image->chromaticity.white_point.x=0.3127f; image->chromaticity.white_point.y=0.3290f; image->chromaticity.white_point.z=0.3583f; image->interlace=NoInterlace; image->ticks_per_second=UndefinedTicksPerSecond; image->compose=OverCompositeOp; image->blur=1.0; InitializeExceptionInfo(&image->exception); (void) QueryColorDatabase(BackgroundColor,&image->background_color, &image->exception); (void) QueryColorDatabase(BorderColor,&image->border_color,&image->exception); (void) QueryColorDatabase(MatteColor,&image->matte_color,&image->exception); (void) QueryColorDatabase(TransparentColor,&image->transparent_color, &image->exception); GetTimerInfo(&image->timer); image->ping=MagickFalse; image->cache=AcquirePixelCache(0); image->blob=CloneBlobInfo((BlobInfo *) NULL); image->timestamp=time((time_t *) NULL); image->debug=IsEventLogging(); image->reference_count=1; image->semaphore=AllocateSemaphoreInfo(); image->signature=MagickCoreSignature; if (image_info == (ImageInfo *) NULL) return(image); /* Transfer image info. */ SetBlobExempt(image,image_info->file != (FILE *) NULL ? MagickTrue : MagickFalse); (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent); (void) CopyMagickString(image->magick_filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick,image_info->magick,MaxTextExtent); if (image_info->size != (char *) NULL) { (void) ParseAbsoluteGeometry(image_info->size,&image->extract_info); image->columns=image->extract_info.width; image->rows=image->extract_info.height; image->offset=image->extract_info.x; image->extract_info.x=0; image->extract_info.y=0; } if (image_info->extract != (char *) NULL) { RectangleInfo geometry; (void) memset(&geometry,0,sizeof(geometry)); flags=ParseAbsoluteGeometry(image_info->extract,&geometry); if (((flags & XValue) != 0) || ((flags & YValue) != 0)) { image->extract_info=geometry; Swap(image->columns,image->extract_info.width); Swap(image->rows,image->extract_info.height); } } image->compression=image_info->compression; image->quality=image_info->quality; image->endian=image_info->endian; image->interlace=image_info->interlace; image->units=image_info->units; if (image_info->density != (char *) NULL) { GeometryInfo geometry_info; flags=ParseGeometry(image_info->density,&geometry_info); image->x_resolution=geometry_info.rho; image->y_resolution=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->y_resolution=image->x_resolution; } if (image_info->page != (char *) NULL) { char *geometry; image->page=image->extract_info; geometry=GetPageGeometry(image_info->page); (void) ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); } if (image_info->depth != 0) image->depth=image_info->depth; image->dither=image_info->dither; image->background_color=image_info->background_color; image->border_color=image_info->border_color; image->matte_color=image_info->matte_color; image->transparent_color=image_info->transparent_color; image->ping=image_info->ping; image->progress_monitor=image_info->progress_monitor; image->client_data=image_info->client_data; if (image_info->cache != (void *) NULL) ClonePixelCacheMethods(image->cache,image_info->cache); (void) SyncImageSettings(image_info,image); option=GetImageOption(image_info,\"delay\"); if (option != (const char *) NULL) { GeometryInfo geometry_info; flags=ParseGeometry(option,&geometry_info); if ((flags & GreaterValue) != 0) { if (image->delay > (size_t) floor(geometry_info.rho+0.5)) image->delay=(size_t) floor(geometry_info.rho+0.5); } else if ((flags & LessValue) != 0) { if (image->delay < (size_t) floor(geometry_info.rho+0.5)) image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5); } else image->delay=(size_t) floor(geometry_info.rho+0.5); if ((flags & SigmaValue) != 0) image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5); } option=GetImageOption(image_info,\"dispose\"); if (option != (const char *) NULL) image->dispose=(DisposeType) ParseCommandOption(MagickDisposeOptions, MagickFalse,option); return(image); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Initialization"], "explanation": "ImageMagick 7.0.8-34 has a \"use of uninitialized value\" vulnerability in the SyncImageSettings function in MagickCore/image.c. This is related to AcquireImage in magick/image.c.", "severity_level": "NoInfo", "cwe": "CWE-665", "cve": "CVE-2019-12979"}} -{"idx": 269903, "input": "void Commissioner::HandleMgmtCommissionerGetResponse(Coap::Message * aMessage, const Ip6::MessageInfo *aMessageInfo, otError aResult) { OT_UNUSED_VARIABLE(aMessageInfo); VerifyOrExit(aResult == OT_ERROR_NONE && aMessage->GetCode() == OT_COAP_CODE_CHANGED); otLogInfoMeshCoP(\"received MGMT_COMMISSIONER_GET response\"); exit: return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232448, "input": "static int check_btf_line(struct bpf_verifier_env *env, const union bpf_attr *attr, union bpf_attr __user *uattr) { u32 i, s, nr_linfo, ncopy, expected_size, rec_size, prev_offset = 0; struct bpf_subprog_info *sub; struct bpf_line_info *linfo; struct bpf_prog *prog; const struct btf *btf; void __user *ulinfo; int err; nr_linfo = attr->line_info_cnt; if (!nr_linfo) return 0; rec_size = attr->line_info_rec_size; if (rec_size < MIN_BPF_LINEINFO_SIZE || rec_size > MAX_LINEINFO_REC_SIZE || rec_size & (sizeof(u32) - 1)) return -EINVAL; /* Need to zero it in case the userspace may * pass in a smaller bpf_line_info object. */ linfo = kvcalloc(nr_linfo, sizeof(struct bpf_line_info), GFP_KERNEL | __GFP_NOWARN); if (!linfo) return -ENOMEM; prog = env->prog; btf = prog->aux->btf; s = 0; sub = env->subprog_info; ulinfo = u64_to_user_ptr(attr->line_info); expected_size = sizeof(struct bpf_line_info); ncopy = min_t(u32, expected_size, rec_size); for (i = 0; i < nr_linfo; i++) { err = bpf_check_uarg_tail_zero(ulinfo, expected_size, rec_size); if (err) { if (err == -E2BIG) { verbose(env, \"nonzero tailing record in line_info\"); if (put_user(expected_size, &uattr->line_info_rec_size)) err = -EFAULT; } goto err_free; } if (copy_from_user(&linfo[i], ulinfo, ncopy)) { err = -EFAULT; goto err_free; } /* * Check insn_off to ensure * 1) strictly increasing AND * 2) bounded by prog->len * * The linfo[0].insn_off == 0 check logically falls into * the later \"missing bpf_line_info for func...\" case * because the first linfo[0].insn_off must be the * first sub also and the first sub must have * subprog_info[0].start == 0. */ if ((i && linfo[i].insn_off <= prev_offset) || linfo[i].insn_off >= prog->len) { verbose(env, \"Invalid line_info[%u].insn_off:%u (prev_offset:%u prog->len:%u)\\n\", i, linfo[i].insn_off, prev_offset, prog->len); err = -EINVAL; goto err_free; } if (!prog->insnsi[linfo[i].insn_off].code) { verbose(env, \"Invalid insn code at line_info[%u].insn_off\\n\", i); err = -EINVAL; goto err_free; } if (!btf_name_by_offset(btf, linfo[i].line_off) || !btf_name_by_offset(btf, linfo[i].file_name_off)) { verbose(env, \"Invalid line_info[%u].line_off or .file_name_off\\n\", i); err = -EINVAL; goto err_free; } if (s != env->subprog_cnt) { if (linfo[i].insn_off == sub[s].start) { sub[s].linfo_idx = i; s++; } else if (sub[s].start < linfo[i].insn_off) { verbose(env, \"missing bpf_line_info for func#%u\\n\", s); err = -EINVAL; goto err_free; } } prev_offset = linfo[i].insn_off; ulinfo += rec_size; } if (s != env->subprog_cnt) { verbose(env, \"missing bpf_line_info for %u funcs starting from func#%u\\n\", env->subprog_cnt - s, s); err = -EINVAL; goto err_free; } prog->aux->linfo = linfo; prog->aux->nr_linfo = nr_linfo; return 0; err_free: kvfree(linfo); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 281309, "input": "AWSGeneralAbstractor::get_auth_data_v2(const req_state* const s) const { boost::string_view access_key_id; boost::string_view signature; bool qsr = false; const char* http_auth = s->info.env->get(\"HTTP_AUTHORIZATION\"); if (! http_auth || http_auth[0] == '\\0') { /* Credentials are provided in query string. We also need to verify * the \"Expires\" parameter now. */ access_key_id = s->info.args.get(\"AWSAccessKeyId\"); signature = s->info.args.get(\"Signature\"); qsr = true; boost::string_view expires = s->info.args.get(\"Expires\"); if (expires.empty()) { throw -EPERM; } /* It looks we have the guarantee that expires is a null-terminated, * and thus string_view::data() can be safely used. */ const time_t exp = atoll(expires.data()); time_t now; time(&now); if (now >= exp) { throw -EPERM; } } else { /* The \"Authorization\" HTTP header is being used. */ const boost::string_view auth_str(http_auth + strlen(\"AWS \")); const size_t pos = auth_str.rfind(':'); if (pos != boost::string_view::npos) { access_key_id = auth_str.substr(0, pos); signature = auth_str.substr(pos + 1); } } /* Let's canonize the HTTP headers that are covered by the AWS auth v2. */ std::string string_to_sign; utime_t header_time; if (! rgw_create_s3_canonical_header(s->info, &header_time, string_to_sign, qsr)) { ldout(cct, 10) << \"failed to create the canonized auth header\\n\" << rgw::crypt_sanitize::auth{s,string_to_sign} << dendl; throw -EPERM; } ldout(cct, 10) << \"string_to_sign:\\n\" << rgw::crypt_sanitize::auth{s,string_to_sign} << dendl; if (!qsr && !is_time_skew_ok(header_time)) { throw -ERR_REQUEST_TIME_SKEWED; } return { std::move(access_key_id), std::move(signature), std::move(string_to_sign), rgw::auth::s3::get_v2_signature, null_completer_factory }; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195778, "input": "void ComputeEasyCases(OpKernelContext* context, bool* done, std::vector* split_sizes_vec) { const int32_t num_split = context->num_outputs(); const Tensor& input = context->input(0); const TensorShape& input_shape = input.shape(); const Tensor& split_tensor = context->input(1); const Tensor& split_dim_tensor = context->input(2); OP_REQUIRES(context, split_dim_tensor.NumElements() == 1, errors::InvalidArgument(\"split_dim_tensor must have \" \"exactly one element.\")); const int32_t split_dim_orig = split_dim_tensor.flat()(0); const int32_t split_dim = split_dim_orig < 0 ? split_dim_orig + input.dims() : split_dim_orig; OP_REQUIRES( context, split_tensor.dims() == 1 && split_tensor.NumElements() == num_split, errors::InvalidArgument(\"size of the split_tensor must be 1-D and have \" \"the same elements as outputs got \", split_tensor.dims(), \" -D and \", split_tensor.NumElements(), \" elements\")); auto split_sizes_d = split_tensor.vec(); split_sizes_vec->resize(split_sizes_d.size()); std::copy(split_sizes_d.data(), split_sizes_d.data() + split_sizes_d.size(), split_sizes_vec->begin()); OP_REQUIRES( context, num_split > 0, errors::InvalidArgument( \"Number of ways to split should be > 0, but got \", num_split)); OP_REQUIRES( context, 0 <= split_dim && split_dim < input.dims(), errors::InvalidArgument(\"-input rank(-\", input.dims(), \") <= split_dim < input rank (\", input.dims(), \"), but got \", split_dim_orig)); Tlen input_size_split_dim = input_shape.dim_size(split_dim); // Special case 1: num_split == 1. Nothing to do. if (num_split == 1) { context->set_output(0, context->input(0)); OP_REQUIRES( context, (*split_sizes_vec)[0] == input_size_split_dim, errors::InvalidArgument(\"If there is only one output, it must have \" \"the same size as the input. Input size: \", input_size_split_dim, \" output size: \", (*split_sizes_vec)[0])); *done = true; return; } // Determine sizes of output, in case of a -1 input value int neg_one_dim = -1; Tlen determined_size = 0; for (int d = 0; d < split_sizes_vec->size(); ++d) { Tlen size = (*split_sizes_vec)[d]; if (size == -1) { OP_REQUIRES(context, neg_one_dim == -1, errors::InvalidArgument(\"There can only be one -1 in the \" \"input.\")); neg_one_dim = d; } else { determined_size += size; } } OP_REQUIRES( context, (neg_one_dim == -1 && determined_size == input_size_split_dim) || (neg_one_dim >= 0 && determined_size <= input_size_split_dim), errors::InvalidArgument(\"Determined shape must either match \" \"input shape along split_dim exactly if \" \"fully specified, or be less than the size of \" \"the input along split_dim if not fully \" \"specified. Got: \", determined_size)); if (neg_one_dim >= 0) { (*split_sizes_vec)[neg_one_dim] = input_size_split_dim - determined_size; } // Special case 2: split along the 1st dimension. The requirements are that // either we are splitting the outer dimension of two or more such that // every outer subpart is aligned or that the split sizes mean that they are // always aligned. In these cases, we can share the underlying buffer. // // Apply this optimization conservatively: if input is aligned, // the resulting tensors must be aligned. It's conservative // because if the immediate consumer of the resulting tensors are // not using eigen for computation, its perfectly fine to avoid // the copying. if (SplitHasAlignedOutputsInFirstDimension( input_shape, split_dim, absl::MakeConstSpan(*split_sizes_vec))) { Tlen start = 0; for (int i = 0; i < num_split; ++i) { context->set_output(i, input.Slice(start, start + (*split_sizes_vec)[i])); start += (*split_sizes_vec)[i]; } *done = true; return; } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Check or Handling of Exceptional Conditions"], "explanation": "TensorFlow is an open source platform for machine learning. In affected versions the implementation of `SplitV` can trigger a segfault is an attacker supplies negative arguments. This occurs whenever `size_splits` contains more than one value and at least one value is negative. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-703", "cve": "CVE-2021-41222"}} -{"idx": 281251, "input": "void RGWDeleteMultiObj_ObjStore_S3::send_partial_response(rgw_obj_key& key, bool delete_marker, const string& marker_version_id, int ret) { if (!key.empty()) { if (op_ret == 0 && !quiet) { s->formatter->open_object_section(\"Deleted\"); s->formatter->dump_string(\"Key\", key.name); if (!key.instance.empty()) { s->formatter->dump_string(\"VersionId\", key.instance); } if (delete_marker) { s->formatter->dump_bool(\"DeleteMarker\", true); s->formatter->dump_string(\"DeleteMarkerVersionId\", marker_version_id); } s->formatter->close_section(); } else if (op_ret < 0) { struct rgw_http_error r; int err_no; s->formatter->open_object_section(\"Error\"); err_no = -op_ret; rgw_get_errno_s3(&r, err_no); s->formatter->dump_string(\"Key\", key.name); s->formatter->dump_string(\"VersionId\", key.instance); s->formatter->dump_string(\"Code\", r.s3_code); s->formatter->dump_string(\"Message\", r.s3_code); s->formatter->close_section(); } rgw_flush_formatter(s, s->formatter); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269018, "input": "R_API char *r_str_ansi_crop(const char *str, ut32 x, ut32 y, ut32 x2, ut32 y2) { char *r, *r_end, *ret; const char *s, *s_start; size_t r_len, str_len = 0, nr_of_lines = 0; ut32 ch = 0, cw = 0; if (x2 <= x || y2 <= y || !str) { return strdup (\"\"); } s = s_start = str; while (*s) { str_len++; if (*s == '\\n') { nr_of_lines++; } s++; } r_len = str_len + nr_of_lines * strlen (Color_RESET) + 1; r = ret = malloc (r_len); if (!r) { return NULL; } r_end = r + r_len; while (*str) { /* crop height */ if (ch >= y2) { r--; break; } if (*str == '\\n') { if (ch >= y && ch < y2) { const char *reset = Color_RESET \"\\n\"; if (strlen (reset) < (r_end - r)) { const int reset_length = strlen (reset); memcpy (r, reset, reset_length + 1); r += reset_length; } } str++; ch++; cw = 0; } else { if (ch >= y && ch < y2) { if ((*str & 0xc0) == 0x80) { if (cw > x) { *r++ = *str++; } else { str++; } continue; } if (r_str_char_fullwidth (str, str_len - (str - s_start))) { cw++; if (cw == x) { *r++ = ' '; str++; continue; } } if (*str == 0x1b && *(str + 1) == '[') { const char *ptr = str; if ((r_end - r) > 2) { /* copy 0x1b and [ */ *r++ = *str++; *r++ = *str++; for (ptr = str; *ptr && *ptr != 'J' && *ptr != 'm' && *ptr != 'H'; ptr++) { *r++ = *ptr; } *r++ = *ptr++; } str = ptr; continue; } else if (cw >= x && cw < x2) { *r++ = *str; } } /* skip until newline */ if (cw >= x2) { while (*str && *str != '\\n') { str++; } } else { str++; } cw++; } } *r = 0; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 354803, "input": "static int kvm_clock_sync(struct notifier_block *notifier, unsigned long val, void *v) { struct kvm *kvm; struct kvm_vcpu *vcpu; int i; unsigned long long *delta = v; list_for_each_entry(kvm, &vm_list, vm_list) { kvm_for_each_vcpu(i, vcpu, kvm) { kvm_clock_sync_scb(vcpu->arch.sie_block, *delta); if (i == 0) { kvm->arch.epoch = vcpu->arch.sie_block->epoch; kvm->arch.epdx = vcpu->arch.sie_block->epdx; } if (vcpu->arch.cputm_enabled) vcpu->arch.cputm_start += *delta; if (vcpu->arch.vsie_block) kvm_clock_sync_scb(vcpu->arch.vsie_block, *delta); } } return NOTIFY_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 417887, "input": "static struct ttflangname *SFDGetLangName(FILE *sfd,struct ttflangname *old) { struct ttflangname *cur = chunkalloc(sizeof(struct ttflangname)), *prev; int i; getint(sfd,&cur->lang); for ( i=0; inames[i] = SFDReadUTF7Str(sfd); if ( old==NULL ) return( cur ); for ( prev = old; prev->next !=NULL; prev = prev->next ); prev->next = cur; return( old ); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269075, "input": "R_API size_t r_str_utf8_codepoint(const char* s, size_t left) { if ((*s & 0x80) != 0x80) { return 0; } else if ((*s & 0xe0) == 0xc0 && left >= 1) { return ((*s & 0x1f) << 6) + (*(s + 1) & 0x3f); } else if ((*s & 0xf0) == 0xe0 && left >= 2) { return ((*s & 0xf) << 12) + ((*(s + 1) & 0x3f) << 6) + (*(s + 2) & 0x3f); } else if ((*s & 0xf8) == 0xf0 && left >= 3) { return ((*s & 0x7) << 18) + ((*(s + 1) & 0x3f) << 12) + ((*(s + 2) & 0x3f) << 6) + (*(s + 3) & 0x3f); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 318158, "input": "rpmRC hdrblobGet(hdrblob blob, uint32_t tag, rpmtd td) { rpmRC rc = RPMRC_NOTFOUND; struct indexEntry_s entry; struct entryInfo_s einfo; const struct entryInfo_s *pe = blob->pe; uint32_t ntag = htonl(tag); int tsize; memset(&einfo, 0, sizeof(einfo)); rpmtdReset(td); for (int i = 0; i < blob->il; i++, pe++) { if (pe->tag != ntag) continue; ei2h(pe, &einfo); /* We can only handle non-byteswappable data */ tsize = typeSizes[einfo.type]; if (tsize != 1 && tsize != -1) return RPMRC_FAIL; entry.info = einfo; /* struct assignment */ entry.data = blob->dataStart + einfo.offset; entry.length = dataLength(einfo.type, blob->dataStart + einfo.offset, einfo.count, 1, blob->dataEnd); entry.rdlen = 0; td->tag = einfo.tag; rc = copyTdEntry(&entry, td, HEADERGET_MINMEM) ? RPMRC_OK : RPMRC_FAIL; break; } return rc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453298, "input": "static int __init bfq_slab_setup(void) { bfq_pool = KMEM_CACHE(bfq_queue, 0); if (!bfq_pool) return -ENOMEM; return 0;", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338729, "input": "static inline void io_put_req_deferred(struct io_kiocb *req, int refs) { if (req_ref_sub_and_test(req, refs)) io_free_req_deferred(req); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295855, "input": "void rfbIncrClientRef(rfbClientPtr cl) { LOCK(cl->refCountMutex); cl->refCount++; UNLOCK(cl->refCountMutex); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 202739, "input": "static Image *OptimizeLayerFrames(const Image *image,const LayerMethod method, ExceptionInfo *exception) { ExceptionInfo *sans_exception; Image *prev_image, *dup_image, *bgnd_image, *optimized_image; RectangleInfo try_bounds, bgnd_bounds, dup_bounds, *bounds; MagickBooleanType add_frames, try_cleared, cleared; DisposeType *disposals; register const Image *curr; register ssize_t i; assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); assert(method == OptimizeLayer || method == OptimizeImageLayer || method == OptimizePlusLayer); /* Are we allowed to add/remove frames from animation? */ add_frames=method == OptimizePlusLayer ? MagickTrue : MagickFalse; /* Ensure all the images are the same size. */ curr=GetFirstImageInList(image); for (; curr != (Image *) NULL; curr=GetNextImageInList(curr)) { if ((curr->columns != image->columns) || (curr->rows != image->rows)) ThrowImageException(OptionError,\"ImagesAreNotTheSameSize\"); if ((curr->page.x != 0) || (curr->page.y != 0) || (curr->page.width != image->page.width) || (curr->page.height != image->page.height)) ThrowImageException(OptionError,\"ImagePagesAreNotCoalesced\"); } /* Allocate memory (times 2 if we allow the use of frame duplications) */ curr=GetFirstImageInList(image); bounds=(RectangleInfo *) AcquireQuantumMemory((size_t) GetImageListLength(curr),(add_frames != MagickFalse ? 2UL : 1UL)* sizeof(*bounds)); if (bounds == (RectangleInfo *) NULL) ThrowImageException(ResourceLimitError,\"MemoryAllocationFailed\"); disposals=(DisposeType *) AcquireQuantumMemory((size_t) GetImageListLength(image),(add_frames != MagickFalse ? 2UL : 1UL)* sizeof(*disposals)); if (disposals == (DisposeType *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); ThrowImageException(ResourceLimitError,\"MemoryAllocationFailed\"); } /* Initialise Previous Image as fully transparent */ prev_image=CloneImage(curr,curr->columns,curr->rows,MagickTrue,exception); if (prev_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); disposals=(DisposeType *) RelinquishMagickMemory(disposals); return((Image *) NULL); } prev_image->page=curr->page; /* ERROR: <-- should not be need, but is! */ prev_image->page.x=0; prev_image->page.y=0; prev_image->dispose=NoneDispose; prev_image->background_color.alpha_trait=BlendPixelTrait; prev_image->background_color.alpha=(MagickRealType) TransparentAlpha; (void) SetImageBackgroundColor(prev_image,exception); /* Figure out the area of overlay of the first frame No pixel could be cleared as all pixels are already cleared. */ #if DEBUG_OPT_FRAME i=0; (void) FormatLocaleFile(stderr,\"frame %.20g :-\\n\",(double) i); #endif disposals[0]=NoneDispose; bounds[0]=CompareImagesBounds(prev_image,curr,CompareAnyLayer,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"overlay: %.20gx%.20g%+.20g%+.20g\\n\\n\", (double) bounds[i].width,(double) bounds[i].height, (double) bounds[i].x,(double) bounds[i].y ); #endif /* Compute the bounding box of changes for each pair of images. */ i=1; bgnd_image=(Image *) NULL; dup_image=(Image *) NULL; dup_bounds.width=0; dup_bounds.height=0; dup_bounds.x=0; dup_bounds.y=0; curr=GetNextImageInList(curr); for ( ; curr != (const Image *) NULL; curr=GetNextImageInList(curr)) { #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr,\"frame %.20g :-\\n\",(double) i); #endif /* Assume none disposal is the best */ bounds[i]=CompareImagesBounds(curr->previous,curr,CompareAnyLayer,exception); cleared=IsBoundsCleared(curr->previous,curr,&bounds[i],exception); disposals[i-1]=NoneDispose; #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"overlay: %.20gx%.20g%+.20g%+.20g%s%s\\n\", (double) bounds[i].width,(double) bounds[i].height, (double) bounds[i].x,(double) bounds[i].y, bounds[i].x < 0?\" (unchanged)\":\"\", cleared?\" (pixels cleared)\":\"\"); #endif if ( bounds[i].x < 0 ) { /* Image frame is exactly the same as the previous frame! If not adding frames leave it to be cropped down to a null image. Otherwise mark previous image for deleted, transfering its crop bounds to the current image. */ if ( add_frames && i>=2 ) { disposals[i-1]=DelDispose; disposals[i]=NoneDispose; bounds[i]=bounds[i-1]; i++; continue; } } else { /* Compare a none disposal against a previous disposal */ try_bounds=CompareImagesBounds(prev_image,curr,CompareAnyLayer,exception); try_cleared=IsBoundsCleared(prev_image,curr,&try_bounds,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"test_prev: %.20gx%.20g%+.20g%+.20g%s\\n\", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y, try_cleared?\" (pixels were cleared)\":\"\"); #endif if ( (!try_cleared && cleared ) || try_bounds.width * try_bounds.height < bounds[i].width * bounds[i].height ) { cleared=try_cleared; bounds[i]=try_bounds; disposals[i-1]=PreviousDispose; #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr,\"previous: accepted\\n\"); } else { (void) FormatLocaleFile(stderr,\"previous: rejected\\n\"); #endif } /* If we are allowed lets try a complex frame duplication. It is useless if the previous image already clears pixels correctly. This method will always clear all the pixels that need to be cleared. */ dup_bounds.width=dup_bounds.height=0; /* no dup, no pixel added */ if ( add_frames ) { dup_image=CloneImage(curr->previous,0,0,MagickTrue,exception); if (dup_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); disposals=(DisposeType *) RelinquishMagickMemory(disposals); prev_image=DestroyImage(prev_image); return((Image *) NULL); } dup_image->background_color.alpha_trait=BlendPixelTrait; dup_bounds=CompareImagesBounds(dup_image,curr,CompareClearLayer,exception); ClearBounds(dup_image,&dup_bounds,exception); try_bounds=CompareImagesBounds(dup_image,curr,CompareAnyLayer,exception); if ( cleared || dup_bounds.width*dup_bounds.height +try_bounds.width*try_bounds.height < bounds[i].width * bounds[i].height ) { cleared=MagickFalse; bounds[i]=try_bounds; disposals[i-1]=DupDispose; /* to be finalised later, if found to be optimial */ } else dup_bounds.width=dup_bounds.height=0; } /* Now compare against a simple background disposal */ bgnd_image=CloneImage(curr->previous,0,0,MagickTrue,exception); if (bgnd_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); disposals=(DisposeType *) RelinquishMagickMemory(disposals); prev_image=DestroyImage(prev_image); if ( dup_image != (Image *) NULL) dup_image=DestroyImage(dup_image); return((Image *) NULL); } bgnd_image->background_color.alpha_trait=BlendPixelTrait; bgnd_bounds=bounds[i-1]; /* interum bounds of the previous image */ ClearBounds(bgnd_image,&bgnd_bounds,exception); try_bounds=CompareImagesBounds(bgnd_image,curr,CompareAnyLayer,exception); try_cleared=IsBoundsCleared(bgnd_image,curr,&try_bounds,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"background: %s\\n\", try_cleared?\"(pixels cleared)\":\"\"); #endif if ( try_cleared ) { /* Straight background disposal failed to clear pixels needed! Lets try expanding the disposal area of the previous frame, to include the pixels that are cleared. This guaranteed to work, though may not be the most optimized solution. */ try_bounds=CompareImagesBounds(curr->previous,curr,CompareClearLayer,exception); #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"expand_clear: %.20gx%.20g%+.20g%+.20g%s\\n\", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y, try_bounds.x<0?\" (no expand nessary)\":\"\"); #endif if ( bgnd_bounds.x < 0 ) bgnd_bounds = try_bounds; else { #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"expand_bgnd: %.20gx%.20g%+.20g%+.20g\\n\", (double) bgnd_bounds.width,(double) bgnd_bounds.height, (double) bgnd_bounds.x,(double) bgnd_bounds.y ); #endif if ( try_bounds.x < bgnd_bounds.x ) { bgnd_bounds.width+= bgnd_bounds.x-try_bounds.x; if ( bgnd_bounds.width < try_bounds.width ) bgnd_bounds.width = try_bounds.width; bgnd_bounds.x = try_bounds.x; } else { try_bounds.width += try_bounds.x - bgnd_bounds.x; if ( bgnd_bounds.width < try_bounds.width ) bgnd_bounds.width = try_bounds.width; } if ( try_bounds.y < bgnd_bounds.y ) { bgnd_bounds.height += bgnd_bounds.y - try_bounds.y; if ( bgnd_bounds.height < try_bounds.height ) bgnd_bounds.height = try_bounds.height; bgnd_bounds.y = try_bounds.y; } else { try_bounds.height += try_bounds.y - bgnd_bounds.y; if ( bgnd_bounds.height < try_bounds.height ) bgnd_bounds.height = try_bounds.height; } #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \" to : %.20gx%.20g%+.20g%+.20g\\n\", (double) bgnd_bounds.width,(double) bgnd_bounds.height, (double) bgnd_bounds.x,(double) bgnd_bounds.y ); #endif } ClearBounds(bgnd_image,&bgnd_bounds,exception); #if DEBUG_OPT_FRAME /* Something strange is happening with a specific animation * CompareAnyLayers (normal method) and CompareClearLayers returns the whole * image, which is not posibly correct! As verified by previous tests. * Something changed beyond the bgnd_bounds clearing. But without being able * to see, or writet he image at this point it is hard to tell what is wrong! * Only CompareOverlay seemed to return something sensible. */ try_bounds=CompareImagesBounds(bgnd_image,curr,CompareClearLayer,exception); (void) FormatLocaleFile(stderr, \"expand_ctst: %.20gx%.20g%+.20g%+.20g\\n\", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y ); try_bounds=CompareImagesBounds(bgnd_image,curr,CompareAnyLayer,exception); try_cleared=IsBoundsCleared(bgnd_image,curr,&try_bounds,exception); (void) FormatLocaleFile(stderr, \"expand_any : %.20gx%.20g%+.20g%+.20g%s\\n\", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y, try_cleared?\" (pixels cleared)\":\"\"); #endif try_bounds=CompareImagesBounds(bgnd_image,curr,CompareOverlayLayer,exception); #if DEBUG_OPT_FRAME try_cleared=IsBoundsCleared(bgnd_image,curr,&try_bounds,exception); (void) FormatLocaleFile(stderr, \"expand_test: %.20gx%.20g%+.20g%+.20g%s\\n\", (double) try_bounds.width,(double) try_bounds.height, (double) try_bounds.x,(double) try_bounds.y, try_cleared?\" (pixels cleared)\":\"\"); #endif } /* Test if this background dispose is smaller than any of the other methods we tryed before this (including duplicated frame) */ if ( cleared || bgnd_bounds.width*bgnd_bounds.height +try_bounds.width*try_bounds.height < bounds[i-1].width*bounds[i-1].height +dup_bounds.width*dup_bounds.height +bounds[i].width*bounds[i].height ) { cleared=MagickFalse; bounds[i-1]=bgnd_bounds; bounds[i]=try_bounds; if ( disposals[i-1] == DupDispose ) dup_image=DestroyImage(dup_image); disposals[i-1]=BackgroundDispose; #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr,\"expand_bgnd: accepted\\n\"); } else { (void) FormatLocaleFile(stderr,\"expand_bgnd: reject\\n\"); #endif } } /* Finalise choice of dispose, set new prev_image, and junk any extra images as appropriate, */ if ( disposals[i-1] == DupDispose ) { if (bgnd_image != (Image *) NULL) bgnd_image=DestroyImage(bgnd_image); prev_image=DestroyImage(prev_image); prev_image=dup_image, dup_image=(Image *) NULL; bounds[i+1]=bounds[i]; bounds[i]=dup_bounds; disposals[i-1]=DupDispose; disposals[i]=BackgroundDispose; i++; } else { if ( dup_image != (Image *) NULL) dup_image=DestroyImage(dup_image); if ( disposals[i-1] != PreviousDispose ) prev_image=DestroyImage(prev_image); if ( disposals[i-1] == BackgroundDispose ) prev_image=bgnd_image, bgnd_image=(Image *) NULL; if (bgnd_image != (Image *) NULL) bgnd_image=DestroyImage(bgnd_image); if ( disposals[i-1] == NoneDispose ) { prev_image=ReferenceImage(curr->previous); if (prev_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); disposals=(DisposeType *) RelinquishMagickMemory(disposals); return((Image *) NULL); } } } assert(prev_image != (Image *) NULL); disposals[i]=disposals[i-1]; #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"final %.20g : %s %.20gx%.20g%+.20g%+.20g\\n\", (double) i-1, CommandOptionToMnemonic(MagickDisposeOptions,disposals[i-1]), (double) bounds[i-1].width,(double) bounds[i-1].height, (double) bounds[i-1].x,(double) bounds[i-1].y ); #endif #if DEBUG_OPT_FRAME (void) FormatLocaleFile(stderr, \"interum %.20g : %s %.20gx%.20g%+.20g%+.20g\\n\", (double) i, CommandOptionToMnemonic(MagickDisposeOptions,disposals[i]), (double) bounds[i].width,(double) bounds[i].height, (double) bounds[i].x,(double) bounds[i].y ); (void) FormatLocaleFile(stderr,\"\\n\"); #endif i++; } prev_image=DestroyImage(prev_image); /* Optimize all images in sequence. */ sans_exception=AcquireExceptionInfo(); i=0; curr=GetFirstImageInList(image); optimized_image=NewImageList(); while ( curr != (const Image *) NULL ) { prev_image=CloneImage(curr,0,0,MagickTrue,exception); if (prev_image == (Image *) NULL) break; prev_image->background_color.alpha_trait=BlendPixelTrait; if ( disposals[i] == DelDispose ) { size_t time = 0; while ( disposals[i] == DelDispose ) { time += curr->delay*1000/curr->ticks_per_second; curr=GetNextImageInList(curr); i++; } time += curr->delay*1000/curr->ticks_per_second; prev_image->ticks_per_second = 100L; prev_image->delay = time*prev_image->ticks_per_second/1000; } bgnd_image=CropImage(prev_image,&bounds[i],sans_exception); prev_image=DestroyImage(prev_image); if (bgnd_image == (Image *) NULL) break; bgnd_image->dispose=disposals[i]; if ( disposals[i] == DupDispose ) { bgnd_image->delay=0; bgnd_image->dispose=NoneDispose; } else curr=GetNextImageInList(curr); AppendImageToList(&optimized_image,bgnd_image); i++; } sans_exception=DestroyExceptionInfo(sans_exception); bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); disposals=(DisposeType *) RelinquishMagickMemory(disposals); if (curr != (Image *) NULL) { optimized_image=DestroyImageList(optimized_image); return((Image *) NULL); } return(GetFirstImageInList(optimized_image)); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["NVD-CWE-Other"], "explanation": "ImageMagick 7.0.10-34 allows Division by Zero in OptimizeLayerFrames in MagickCore/layer.c, which may cause a denial of service.", "severity_level": "NoInfo", "cwe": "CWE-399", "cve": "CVE-2020-27560"}} -{"idx": 421557, "input": "lka_proc_ready(void) { void *iter; struct processor_instance *pi; iter = NULL; while (dict_iter(&processors, &iter, NULL, (void **)&pi)) if (!pi->ready) return 0; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 487397, "input": "isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) { char *eaz; int si1; int si2; int ematch; int wret; int swapped; int sidx = 0; u_long flags; isdn_net_dev *p; isdn_net_phone *n; char nr[ISDN_MSNLEN]; char *my_eaz; /* Search name in netdev-chain */ if (!setup->phone[0]) { nr[0] = '0'; nr[1] = '\\0'; printk(KERN_INFO \"isdn_net: Incoming call without OAD, assuming '0'\\n\"); } else strlcpy(nr, setup->phone, ISDN_MSNLEN); si1 = (int) setup->si1; si2 = (int) setup->si2; if (!setup->eazmsn[0]) { printk(KERN_WARNING \"isdn_net: Incoming call without CPN, assuming '0'\\n\"); eaz = \"0\"; } else eaz = setup->eazmsn; if (dev->net_verbose > 1) printk(KERN_INFO \"isdn_net: call from %s,%d,%d -> %s\\n\", nr, si1, si2, eaz); /* Accept DATA and VOICE calls at this stage * local eaz is checked later for allowed call types */ if ((si1 != 7) && (si1 != 1)) { if (dev->net_verbose > 1) printk(KERN_INFO \"isdn_net: Service-Indicator not 1 or 7, ignored\\n\"); return 0; } n = (isdn_net_phone *) 0; p = dev->netdev; ematch = wret = swapped = 0; #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: di=%d ch=%d idx=%d usg=%d\\n\", di, ch, idx, dev->usage[idx]); #endif while (p) { int matchret; isdn_net_local *lp = p->local; /* If last check has triggered as binding-swap, revert it */ switch (swapped) { case 2: isdn_net_swap_usage(idx, sidx); /* fall through */ case 1: isdn_net_swapbind(di); break; } swapped = 0; /* check acceptable call types for DOV */ my_eaz = isdn_map_eaz2msn(lp->msn, di); if (si1 == 1) { /* it's a DOV call, check if we allow it */ if (*my_eaz == 'v' || *my_eaz == 'V' || *my_eaz == 'b' || *my_eaz == 'B') my_eaz++; /* skip to allow a match */ else my_eaz = NULL; /* force non match */ } else { /* it's a DATA call, check if we allow it */ if (*my_eaz == 'b' || *my_eaz == 'B') my_eaz++; /* skip to allow a match */ } if (my_eaz) matchret = isdn_msncmp(eaz, my_eaz); else matchret = 1; if (!matchret) ematch = 1; /* Remember if more numbers eventually can match */ if (matchret > wret) wret = matchret; #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\\n\", p->dev->name, lp->msn, lp->flags, lp->dialstate); #endif if ((!matchret) && /* EAZ is matching */ (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */ (USG_NONE(dev->usage[idx]))) || /* and ch. unused or */ ((((lp->dialstate == 4) || (lp->dialstate == 12)) && /* if dialing */ (!(lp->flags & ISDN_NET_CALLBACK))) /* but no callback */ ))) { #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: match1, pdev=%d pch=%d\\n\", lp->pre_device, lp->pre_channel); #endif if (dev->usage[idx] & ISDN_USAGE_EXCLUSIVE) { if ((lp->pre_channel != ch) || (lp->pre_device != di)) { /* Here we got a problem: * If using an ICN-Card, an incoming call is always signaled on * on the first channel of the card, if both channels are * down. However this channel may be bound exclusive. If the * second channel is free, this call should be accepted. * The solution is horribly but it runs, so what: * We exchange the exclusive bindings of the two channels, the * corresponding variables in the interface-structs. */ if (ch == 0) { sidx = isdn_dc2minor(di, 1); #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: ch is 0\\n\"); #endif if (USG_NONE(dev->usage[sidx])) { /* Second Channel is free, now see if it is bound * exclusive too. */ if (dev->usage[sidx] & ISDN_USAGE_EXCLUSIVE) { #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: 2nd channel is down and bound\\n\"); #endif /* Yes, swap bindings only, if the original * binding is bound to channel 1 of this driver */ if ((lp->pre_device == di) && (lp->pre_channel == 1)) { isdn_net_swapbind(di); swapped = 1; } else { /* ... else iterate next device */ p = (isdn_net_dev *) p->next; continue; } } else { #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: 2nd channel is down and unbound\\n\"); #endif /* No, swap always and swap excl-usage also */ isdn_net_swap_usage(idx, sidx); isdn_net_swapbind(di); swapped = 2; } /* Now check for exclusive binding again */ #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: final check\\n\"); #endif if ((dev->usage[idx] & ISDN_USAGE_EXCLUSIVE) && ((lp->pre_channel != ch) || (lp->pre_device != di))) { #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: final check failed\\n\"); #endif p = (isdn_net_dev *) p->next; continue; } } } else { /* We are already on the second channel, so nothing to do */ #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: already on 2nd channel\\n\"); #endif } } } #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: match2\\n\"); #endif n = lp->phone[0]; if (lp->flags & ISDN_NET_SECURE) { while (n) { if (!isdn_msncmp(nr, n->num)) break; n = (isdn_net_phone *) n->next; } } if (n || (!(lp->flags & ISDN_NET_SECURE))) { #ifdef ISDN_DEBUG_NET_ICALL printk(KERN_DEBUG \"n_fi: match3\\n\"); #endif /* matching interface found */ /* * Is the state STOPPED? * If so, no dialin is allowed, * so reject actively. * */ if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) { printk(KERN_INFO \"incoming call, interface %s `stopped' -> rejected\\n\", p->dev->name); return 3; } /* * Is the interface up? * If not, reject the call actively. */ if (!isdn_net_device_started(p)) { printk(KERN_INFO \"%s: incoming call, interface down -> rejected\\n\", p->dev->name); return 3; } /* Interface is up, now see if it's a slave. If so, see if * it's master and parent slave is online. If not, reject the call. */ if (lp->master) { isdn_net_local *mlp = (isdn_net_local *) lp->master->priv; printk(KERN_DEBUG \"ICALLslv: %s\\n\", p->dev->name); printk(KERN_DEBUG \"master=%s\\n\", lp->master->name); if (mlp->flags & ISDN_NET_CONNECTED) { printk(KERN_DEBUG \"master online\\n\"); /* Master is online, find parent-slave (master if first slave) */ while (mlp->slave) { if ((isdn_net_local *) mlp->slave->priv == lp) break; mlp = (isdn_net_local *) mlp->slave->priv; } } else printk(KERN_DEBUG \"master offline\\n\"); /* Found parent, if it's offline iterate next device */ printk(KERN_DEBUG \"mlpf: %d\\n\", mlp->flags & ISDN_NET_CONNECTED); if (!(mlp->flags & ISDN_NET_CONNECTED)) { p = (isdn_net_dev *) p->next; continue; } } if (lp->flags & ISDN_NET_CALLBACK) { int chi; /* * Is the state MANUAL? * If so, no callback can be made, * so reject actively. * */ if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) { printk(KERN_INFO \"incoming call for callback, interface %s `off' -> rejected\\n\", p->dev->name); return 3; } printk(KERN_DEBUG \"%s: call from %s -> %s, start callback\\n\", p->dev->name, nr, eaz); if (lp->phone[1]) { /* Grab a free ISDN-Channel */ spin_lock_irqsave(&dev->lock, flags); if ((chi = isdn_get_free_channel( ISDN_USAGE_NET, lp->l2_proto, lp->l3_proto, lp->pre_device, lp->pre_channel, lp->msn) ) < 0) { printk(KERN_WARNING \"isdn_net_find_icall: No channel for %s\\n\", p->dev->name); spin_unlock_irqrestore(&dev->lock, flags); return 0; } /* Setup dialstate. */ lp->dtimer = 0; lp->dialstate = 11; /* Connect interface with channel */ isdn_net_bind_channel(lp, chi); #ifdef CONFIG_ISDN_PPP if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) if (isdn_ppp_bind(lp) < 0) { spin_unlock_irqrestore(&dev->lock, flags); isdn_net_unbind_channel(lp); return 0; } #endif spin_unlock_irqrestore(&dev->lock, flags); /* Initiate dialing by returning 2 or 4 */ return (lp->flags & ISDN_NET_CBHUP) ? 2 : 4; } else printk(KERN_WARNING \"isdn_net: %s: No phone number\\n\", p->dev->name); return 0; } else { printk(KERN_DEBUG \"%s: call from %s -> %s accepted\\n\", p->dev->name, nr, eaz); /* if this interface is dialing, it does it probably on a different device, so free this device */ if ((lp->dialstate == 4) || (lp->dialstate == 12)) { #ifdef CONFIG_ISDN_PPP if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) isdn_ppp_free(lp); #endif isdn_net_lp_disconnected(lp); isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET); } spin_lock_irqsave(&dev->lock, flags); dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE; dev->usage[idx] |= ISDN_USAGE_NET; strcpy(dev->num[idx], nr); isdn_info_update(); dev->st_netdev[idx] = lp->netdev; lp->isdn_device = di; lp->isdn_channel = ch; lp->ppp_slot = -1; lp->flags |= ISDN_NET_CONNECTED; lp->dialstate = 7; lp->dtimer = 0; lp->outgoing = 0; lp->huptimer = 0; lp->hupflags |= ISDN_WAITCHARGE; lp->hupflags &= ~ISDN_HAVECHARGE; #ifdef CONFIG_ISDN_PPP if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) { if (isdn_ppp_bind(lp) < 0) { isdn_net_unbind_channel(lp); spin_unlock_irqrestore(&dev->lock, flags); return 0; } } #endif spin_unlock_irqrestore(&dev->lock, flags); return 1; } } } p = (isdn_net_dev *) p->next; } /* If none of configured EAZ/MSN matched and not verbose, be silent */ if (!ematch || dev->net_verbose) printk(KERN_INFO \"isdn_net: call from %s -> %d %s ignored\\n\", nr, di, eaz); return (wret == 2)?5:0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 422683, "input": "TEST(BitTestMatchExpression, DoesNotMatchBinary2) { BSONArray bas = BSON_ARRAY(21 << 22 << 23 << 24 << 25); BSONArray bac = BSON_ARRAY(20 << 23 << 21); std::vector bitPositionsSet = bsonArrayToBitPositions(bas); std::vector bitPositionsClear = bsonArrayToBitPositions(bac); BSONObj match1 = fromjson(\"{a: {$binary: 'AANgAAAAAAAAAAAAAAAAAAAAAAAA', $type: '00'}}\"); // Base64 to Binary: 00000000 00000011 01100000 BSONObj match2 = fromjson(\"{a: {$binary: 'JANgqwetkqwklEWRbWERKKJREtbq', $type: '00'}}\"); // Base64 to Binary: ........ 00000011 01100000 BitsAllSetMatchExpression balls(\"a\", bitPositionsSet); BitsAllClearMatchExpression ballc(\"a\", bitPositionsClear); BitsAnySetMatchExpression banys(\"a\", bitPositionsSet); BitsAnyClearMatchExpression banyc(\"a\", bitPositionsClear); ASSERT_EQ((size_t)5, balls.numBitPositions()); ASSERT_EQ((size_t)3, ballc.numBitPositions()); ASSERT_EQ((size_t)5, banys.numBitPositions()); ASSERT_EQ((size_t)3, banyc.numBitPositions()); ASSERT(!balls.matchesSingleElement(match1[\"a\"])); ASSERT(!balls.matchesSingleElement(match2[\"a\"])); ASSERT(!ballc.matchesSingleElement(match1[\"a\"])); ASSERT(!ballc.matchesSingleElement(match2[\"a\"])); ASSERT(banys.matchesSingleElement(match1[\"a\"])); ASSERT(banys.matchesSingleElement(match2[\"a\"])); ASSERT(banyc.matchesSingleElement(match1[\"a\"])); ASSERT(banyc.matchesSingleElement(match2[\"a\"])); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402581, "input": "static void discov_update(struct work_struct *work) { struct hci_dev *hdev = container_of(work, struct hci_dev, discov_update); u8 status = 0; switch (hdev->discovery.state) { case DISCOVERY_STARTING: start_discovery(hdev, &status); mgmt_start_discovery_complete(hdev, status); if (status) hci_discovery_set_state(hdev, DISCOVERY_STOPPED); else hci_discovery_set_state(hdev, DISCOVERY_FINDING); break; case DISCOVERY_STOPPING: hci_req_sync(hdev, stop_discovery, 0, HCI_CMD_TIMEOUT, &status); mgmt_stop_discovery_complete(hdev, status); if (!status) hci_discovery_set_state(hdev, DISCOVERY_STOPPED); break; case DISCOVERY_STOPPED: default: return; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 389225, "input": "static void register_hooks(apr_pool_t * p) { ap_register_output_filter(\"MOD_SESSION_OUT\", session_output_filter, NULL, AP_FTYPE_CONTENT_SET); ap_hook_insert_filter(session_insert_output_filter, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_error_filter(session_insert_output_filter, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_fixups(session_fixups, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_session_encode(session_identity_encode, NULL, NULL, APR_HOOK_REALLY_FIRST); ap_hook_session_decode(session_identity_decode, NULL, NULL, APR_HOOK_REALLY_LAST); APR_REGISTER_OPTIONAL_FN(ap_session_get); APR_REGISTER_OPTIONAL_FN(ap_session_set); APR_REGISTER_OPTIONAL_FN(ap_session_load); APR_REGISTER_OPTIONAL_FN(ap_session_save); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 378617, "input": "void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){ sqlite3VdbeGetOp(p,addr)->p1 = val; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 216634, "input": "int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, int len, int peek) { int al, i, j, ret; unsigned int n, curr_rec, num_recs, read_bytes; SSL3_RECORD *rr; SSL3_BUFFER *rbuf; void (*cb) (const SSL *ssl, int type2, int val) = NULL; rbuf = &s->rlayer.rbuf; if (!SSL3_BUFFER_is_initialised(rbuf)) { /* Not initialized yet */ if (!ssl3_setup_read_buffer(s)) return (-1); } if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE)) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->rlayer.handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->rlayer.handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->rlayer.handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->rlayer.handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->rlayer.handshake_fragment_len; k++) s->rlayer.handshake_fragment[k] = *src++; if (recvd_type != NULL) *recvd_type = SSL3_RT_HANDSHAKE; return n; } /* * Now s->rlayer.handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!ossl_statem_get_in_handshake(s) && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } } start: s->rwstate = SSL_NOTHING; /*- * For each record 'i' up to |num_recs] * rr[i].type - is the type of record * rr[i].data, - data * rr[i].off, - offset into 'data' for next read * rr[i].length, - number of bytes. */ rr = s->rlayer.rrec; num_recs = RECORD_LAYER_get_numrpipes(&s->rlayer); do { /* get new records if necessary */ if (num_recs == 0) { ret = ssl3_get_record(s); if (ret <= 0) return (ret); num_recs = RECORD_LAYER_get_numrpipes(&s->rlayer); if (num_recs == 0) { /* Shouldn't happen */ al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); goto f_err; } } /* Skip over any records we have already read */ for (curr_rec = 0; curr_rec < num_recs && SSL3_RECORD_is_read(&rr[curr_rec]); curr_rec++) ; if (curr_rec == num_recs) { RECORD_LAYER_set_numrpipes(&s->rlayer, 0); num_recs = 0; curr_rec = 0; } } while (num_recs == 0); rr = &rr[curr_rec]; /* * Reset the count of consecutive warning alerts if we've got a non-empty * record that isn't an alert. */ if (SSL3_RECORD_get_type(rr) != SSL3_RT_ALERT && SSL3_RECORD_get_length(rr) != 0) s->rlayer.alert_count = 0; /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (SSL3_RECORD_get_type(rr) != SSL3_RT_HANDSHAKE)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto f_err; } /* * If the other end has shut down, throw anything we read away (even in * 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { SSL3_RECORD_set_length(rr, 0); s->rwstate = SSL_NOTHING; return (0); } if (type == SSL3_RECORD_get_type(rr) || (SSL3_RECORD_get_type(rr) == SSL3_RT_CHANGE_CIPHER_SPEC && type == SSL3_RT_HANDSHAKE && recvd_type != NULL)) { /* * SSL3_RT_APPLICATION_DATA or * SSL3_RT_HANDSHAKE or * SSL3_RT_CHANGE_CIPHER_SPEC */ /* * make sure that we are not getting application data when we are * doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (type == SSL3_RT_HANDSHAKE && SSL3_RECORD_get_type(rr) == SSL3_RT_CHANGE_CIPHER_SPEC && s->rlayer.handshake_fragment_len > 0) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_CCS_RECEIVED_EARLY); goto f_err; } if (recvd_type != NULL) *recvd_type = SSL3_RECORD_get_type(rr); if (len <= 0) return (len); read_bytes = 0; do { if ((unsigned int)len - read_bytes > SSL3_RECORD_get_length(rr)) n = SSL3_RECORD_get_length(rr); else n = (unsigned int)len - read_bytes; memcpy(buf, &(rr->data[rr->off]), n); buf += n; if (!peek) { SSL3_RECORD_sub_length(rr, n); SSL3_RECORD_add_off(rr, n); if (SSL3_RECORD_get_length(rr) == 0) { s->rlayer.rstate = SSL_ST_READ_HEADER; SSL3_RECORD_set_off(rr, 0); SSL3_RECORD_set_read(rr); } } if (SSL3_RECORD_get_length(rr) == 0 || (peek && n == SSL3_RECORD_get_length(rr))) { curr_rec++; rr++; } read_bytes += n; } while (type == SSL3_RT_APPLICATION_DATA && curr_rec < num_recs && read_bytes < (unsigned int)len); if (read_bytes == 0) { /* We must have read empty records. Get more data */ goto start; } if (!peek && curr_rec == num_recs && (s->mode & SSL_MODE_RELEASE_BUFFERS) && SSL3_BUFFER_get_left(rbuf) == 0) ssl3_release_read_buffer(s); return read_bytes; } /* * If we get here, then type != rr->type; if we have a handshake message, * then it was unexpected (Hello Request or Client Hello) or invalid (we * were actually expecting a CCS). */ /* * Lets just double check that we've not got an SSLv2 record */ if (rr->rec_version == SSL2_VERSION) { /* * Should never happen. ssl3_get_record() should only give us an SSLv2 * record back if this is the first packet and we are looking for an * initial ClientHello. Therefore |type| should always be equal to * |rr->type|. If not then something has gone horribly wrong */ al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); goto f_err; } if (s->method->version == TLS_ANY_VERSION && (s->server || rr->type != SSL3_RT_ALERT)) { /* * If we've got this far and still haven't decided on what version * we're using then this must be a client side alert we're dealing with * (we don't allow heartbeats yet). We shouldn't be receiving anything * other than a ClientHello if we are a server. */ s->version = rr->rec_version; al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_MESSAGE); goto f_err; } /* * In case of record types for which we have 'fragment' storage, fill * that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (SSL3_RECORD_get_type(rr) == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->rlayer.handshake_fragment; dest = s->rlayer.handshake_fragment; dest_len = &s->rlayer.handshake_fragment_len; } else if (SSL3_RECORD_get_type(rr) == SSL3_RT_ALERT) { dest_maxlen = sizeof s->rlayer.alert_fragment; dest = s->rlayer.alert_fragment; dest_len = &s->rlayer.alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (SSL3_RECORD_get_length(rr) < n) n = SSL3_RECORD_get_length(rr); /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = SSL3_RECORD_get_data(rr)[SSL3_RECORD_get_off(rr)]; SSL3_RECORD_add_off(rr, 1); SSL3_RECORD_add_length(rr, -1); } if (*dest_len < dest_maxlen) { SSL3_RECORD_set_read(rr); goto start; /* fragment was too small */ } } } /*- * s->rlayer.handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->rlayer.alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->rlayer.handshake_fragment_len >= 4) && (s->rlayer.handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->rlayer.handshake_fragment_len = 0; if ((s->rlayer.handshake_fragment[1] != 0) || (s->rlayer.handshake_fragment[2] != 0) || (s->rlayer.handshake_fragment[3] != 0)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_BAD_HELLO_REQUEST); goto f_err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->rlayer.handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (SSL3_BUFFER_get_left(rbuf) == 0) { /* no read-ahead left? */ BIO *bio; /* * In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate = SSL_READING; bio = SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return (-1); } } } } /* * we either finished a handshake or ignored the request, now try * again to obtain the (application) data we were asked for */ goto start; } /* * If we are a server and get a client hello when renegotiation isn't * allowed send back a no renegotiation alert and carry on. WARNING: * experimental code, needs reviewing (steve) */ if (s->server && SSL_is_init_finished(s) && !s->s3->send_connection_binding && (s->version > SSL3_VERSION) && (s->rlayer.handshake_fragment_len >= 4) && (s->rlayer.handshake_fragment[0] == SSL3_MT_CLIENT_HELLO) && (s->session != NULL) && (s->session->cipher != NULL) && !(s->ctx->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { SSL3_RECORD_set_length(rr, 0); SSL3_RECORD_set_read(rr); ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_NO_RENEGOTIATION); goto start; } if (s->rlayer.alert_fragment_len >= 2) { int alert_level = s->rlayer.alert_fragment[0]; int alert_descr = s->rlayer.alert_fragment[1]; s->rlayer.alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->rlayer.alert_fragment, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; if (cb != NULL) { j = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == SSL3_AL_WARNING) { s->s3->warn_alert = alert_descr; SSL3_RECORD_set_read(rr); s->rlayer.alert_count++; if (s->rlayer.alert_count == MAX_WARN_ALERT_COUNT) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); goto f_err; } if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return (0); } /* * This is a warning but we receive it if we requested * renegotiation and the peer denied it. Terminate with a fatal * alert because if application tried to renegotiate it * presumably had a good reason and expects it to succeed. In * future we might have a renegotiation where we don't care if * the peer refused it where we carry on. */ else if (alert_descr == SSL_AD_NO_RENEGOTIATION) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_NO_RENEGOTIATION); goto f_err; } #ifdef SSL_AD_MISSING_SRP_USERNAME else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME) return (0); #endif } else if (alert_level == SSL3_AL_FATAL) { char tmp[16]; s->rwstate = SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp, sizeof tmp, \"%d\", alert_descr); ERR_add_error_data(2, \"SSL alert number \", tmp); s->shutdown |= SSL_RECEIVED_SHUTDOWN; SSL3_RECORD_set_read(rr); SSL_CTX_remove_session(s->session_ctx, s->session); return (0); } else { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) { /* but we have not received a * shutdown */ s->rwstate = SSL_NOTHING; SSL3_RECORD_set_length(rr, 0); SSL3_RECORD_set_read(rr); return (0); } if (SSL3_RECORD_get_type(rr) == SSL3_RT_CHANGE_CIPHER_SPEC) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_CCS_RECEIVED_EARLY); goto f_err; } /* * Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->rlayer.handshake_fragment_len >= 4) && !ossl_statem_get_in_handshake(s)) { if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { ossl_statem_set_in_init(s, 1); s->renegotiate = 1; s->new_session = 1; } i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (SSL3_BUFFER_get_left(rbuf) == 0) { /* no read-ahead left? */ BIO *bio; /* * In the case where we try to read application data, but we * trigger an SSL handshake, we return -1 with the retry * option set. Otherwise renegotiation may cause nasty * problems in the blocking world */ s->rwstate = SSL_READING; bio = SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return (-1); } } goto start; } switch (SSL3_RECORD_get_type(rr)) { default: /* * TLS up to v1.1 just ignores unknown message types: TLS v1.2 give * an unexpected message alert. */ if (s->version >= TLS1_VERSION && s->version <= TLS1_1_VERSION) { SSL3_RECORD_set_length(rr, 0); SSL3_RECORD_set_read(rr); goto start; } al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* * we already handled all of these, with the possible exception of * SSL3_RT_HANDSHAKE when ossl_statem_get_in_handshake(s) is true, but * that should not happen when type != rr->type */ al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* * At this point, we were expecting handshake data, but have * application data. If the library was running inside ssl3_read() * (i.e. in_read_app_data is set) and it makes sense to read * application data at this point (session renegotiation not yet * started), we will indulge it. */ if (ossl_statem_app_data_allowed(s)) { s->s3->in_read_app_data = 2; return (-1); } else { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); return (-1); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Input Validation"], "explanation": "The ssl3_read_bytes function in record/rec_layer_s3.c in OpenSSL 1.1.0 before 1.1.0a allows remote attackers to cause a denial of service (infinite loop) by triggering a zero-length record in an SSL_peek call.", "severity_level": "Medium", "cwe": "CWE-20", "cve": "CVE-2016-6305"}} -{"idx": 505378, "input": "static void blob_fn(struct cgit_context *ctx) { cgit_print_blob(ctx->qry.sha1, ctx->qry.path, ctx->qry.head); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 385638, "input": "unsigned Utf8::EncodeOneByte(char* str, uint8_t c) { static const int kMask = ~(1 << 6); if (c <= kMaxOneByteChar) { str[0] = c; return 1; } str[0] = 0xC0 | (c >> 6); str[1] = 0x80 | (c & kMask); return 2; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 224893, "input": "u32 gf_isom_solve_uuid_box(char *UUID) { u32 i; char strUUID[33], strChar[3]; strUUID[0] = 0; strUUID[32] = 0; for (i=0; i<16; i++) { snprintf(strChar, 3, \"%02X\", (unsigned char) UUID[i]); strcat(strUUID, strChar); } if (!strnicmp(strUUID, \"8974dbce7be74c5184f97148f9882554\", 32)) return GF_ISOM_BOX_UUID_TENC; if (!strnicmp(strUUID, \"A5D40B30E81411DDBA2F0800200C9A66\", 32)) return GF_ISOM_BOX_UUID_MSSM; if (!strnicmp(strUUID, \"D4807EF2CA3946958E5426CB9E46A79F\", 32)) return GF_ISOM_BOX_UUID_TFRF; if (!strnicmp(strUUID, \"6D1D9B0542D544E680E2141DAFF757B2\", 32)) return GF_ISOM_BOX_UUID_TFXD; if (!strnicmp(strUUID, \"A2394F525A9B4F14A2446C427C648DF4\", 32)) return GF_ISOM_BOX_UUID_PSEC; if (!strnicmp(strUUID, \"D08A4F1810F34A82B6C832D8ABA183D3\", 32)) return GF_ISOM_BOX_UUID_PSSH; return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336264, "input": "static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) { int kcmp; struct rb_node *rbp; struct epitem *epi, *epir = NULL; struct epoll_filefd ffd; ep_set_ffd(&ffd, file, fd); for (rbp = ep->rbr.rb_root.rb_node; rbp; ) { epi = rb_entry(rbp, struct epitem, rbn); kcmp = ep_cmp_ffd(&ffd, &epi->ffd); if (kcmp > 0) rbp = rbp->rb_right; else if (kcmp < 0) rbp = rbp->rb_left; else { epir = epi; break; } } return epir; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380778, "input": "static void vga_pal_blank(struct vgastate *state) { int i; vga_w(state->vgabase, VGA_PEL_MSK, 0xff); for (i = 0; i < 16; i++) { vga_w(state->vgabase, VGA_PEL_IW, i); vga_w(state->vgabase, VGA_PEL_D, 0); vga_w(state->vgabase, VGA_PEL_D, 0); vga_w(state->vgabase, VGA_PEL_D, 0); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 398049, "input": "static int sctp_getsockopt_maxburst(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_assoc_value params; struct sctp_association *asoc; if (len == sizeof(int)) { pr_warn_ratelimited(DEPRECATED \"%s (pid %d) \" \"Use of int in max_burst socket option.\\n\" \"Use struct sctp_assoc_value instead\\n\", current->comm, task_pid_nr(current)); params.assoc_id = SCTP_FUTURE_ASSOC; } else if (len >= sizeof(struct sctp_assoc_value)) { len = sizeof(struct sctp_assoc_value); if (copy_from_user(¶ms, optval, len)) return -EFAULT; } else return -EINVAL; asoc = sctp_id2assoc(sk, params.assoc_id); if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && sctp_style(sk, UDP)) return -EINVAL; params.assoc_value = asoc ? asoc->max_burst : sctp_sk(sk)->max_burst; if (len == sizeof(int)) { if (copy_to_user(optval, ¶ms.assoc_value, len)) return -EFAULT; } else { if (copy_to_user(optval, ¶ms, len)) return -EFAULT; } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508499, "input": "void JOIN::cleanup(bool full) { DBUG_ENTER(\"JOIN::cleanup\"); DBUG_PRINT(\"enter\", (\"full %u\", (uint) full)); if (full) have_query_plan= QEP_DELETED; if (original_join_tab) { /* Free the original optimized join created for the group_by_handler */ join_tab= original_join_tab; original_join_tab= 0; table_count= original_table_count; } if (join_tab) { JOIN_TAB *tab; if (full) { /* Call cleanup() on join tabs used by the join optimization (join->join_tab may now be pointing to result of make_simple_join reading from the temporary table) We also need to check table_count to handle various degenerate joins w/o tables: they don't have some members initialized and WALK_OPTIMIZATION_TABS may not work correctly for them. */ if (top_join_tab_count && tables_list) { for (tab= first_breadth_first_tab(); tab; tab= next_breadth_first_tab(first_breadth_first_tab(), top_join_tab_count, tab)) { tab->cleanup(); delete tab->filesort_result; tab->filesort_result= NULL; } } cleaned= true; //psergey2: added (Q: why not in the above loop?) { JOIN_TAB *curr_tab= join_tab + exec_join_tab_cnt(); for (uint i= 0; i < aggr_tables; i++, curr_tab++) { if (curr_tab->aggr) { free_tmp_table(thd, curr_tab->table); delete curr_tab->tmp_table_param; curr_tab->tmp_table_param= NULL; curr_tab->aggr= NULL; delete curr_tab->filesort_result; curr_tab->filesort_result= NULL; } } aggr_tables= 0; // psergey3 } } else { for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITH_CONST_TABLES); tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS)) { tab->partial_cleanup(); } } } if (full) { cleanup_empty_jtbm_semi_joins(this, join_list); // Run Cached_item DTORs! group_fields.delete_elements(); /* We can't call delete_elements() on copy_funcs as this will cause problems in free_elements() as some of the elements are then deleted. */ tmp_table_param.copy_funcs.empty(); /* If we have tmp_join and 'this' JOIN is not tmp_join and tmp_table_param.copy_field's of them are equal then we have to remove pointer to tmp_table_param.copy_field from tmp_join, because it will be removed in tmp_table_param.cleanup(). */ tmp_table_param.cleanup(); delete pushdown_query; pushdown_query= 0; if (!join_tab) { List_iterator li(*join_list); TABLE_LIST *table_ref; while ((table_ref= li++)) { if (table_ref->table && table_ref->jtbm_subselect && table_ref->jtbm_subselect->is_jtbm_const_tab) { free_tmp_table(thd, table_ref->table); table_ref->table= NULL; } } } } /* Restore ref array to original state */ if (current_ref_ptrs != items0) { set_items_ref_array(items0); set_group_rpa= false; } DBUG_VOID_RETURN; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508593, "input": "Field *create_tmp_field_from_field(THD *thd, Field *org_field, LEX_CSTRING *name, TABLE *table, Item_field *item) { Field *new_field; new_field= org_field->make_new_field(thd->mem_root, table, table == org_field->table); if (new_field) { new_field->init(table); new_field->orig_table= org_field->orig_table; if (item) item->result_field= new_field; else new_field->field_name= *name; new_field->flags|= org_field->flags & NO_DEFAULT_VALUE_FLAG; if (org_field->maybe_null() || (item && item->maybe_null)) new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join if (org_field->type() == MYSQL_TYPE_VAR_STRING || org_field->type() == MYSQL_TYPE_VARCHAR) table->s->db_create_options|= HA_OPTION_PACK_RECORD; else if (org_field->type() == FIELD_TYPE_DOUBLE) ((Field_double *) new_field)->not_fixed= TRUE; new_field->vcol_info= 0; new_field->cond_selectivity= 1.0; new_field->next_equal_field= NULL; new_field->option_list= NULL; new_field->option_struct= NULL; } return new_field; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412286, "input": "test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param, int pipe, struct usb_endpoint_descriptor *desc, unsigned offset) { struct transfer_context context; struct usb_device *udev; unsigned i; unsigned long packets = 0; int status = 0; struct urb *urbs[MAX_SGLEN]; if (!param->sglen || param->iterations > UINT_MAX / param->sglen) return -EINVAL; if (param->sglen > MAX_SGLEN) return -EINVAL; memset(&context, 0, sizeof(context)); context.count = param->iterations * param->sglen; context.dev = dev; context.is_iso = !!desc; init_completion(&context.done); spin_lock_init(&context.lock); udev = testdev_to_usbdev(dev); for (i = 0; i < param->sglen; i++) { if (context.is_iso) urbs[i] = iso_alloc_urb(udev, pipe, desc, param->length, offset); else urbs[i] = complicated_alloc_urb(udev, pipe, param->length, 0); if (!urbs[i]) { status = -ENOMEM; goto fail; } packets += urbs[i]->number_of_packets; urbs[i]->context = &context; } packets *= param->iterations; if (context.is_iso) { int transaction_num; if (udev->speed >= USB_SPEED_SUPER) transaction_num = ss_isoc_get_packet_num(udev, pipe); else transaction_num = usb_endpoint_maxp_mult(desc); dev_info(&dev->intf->dev, \"iso period %d %sframes, wMaxPacket %d, transactions: %d\\n\", 1 << (desc->bInterval - 1), (udev->speed >= USB_SPEED_HIGH) ? \"micro\" : \"\", usb_endpoint_maxp(desc), transaction_num); dev_info(&dev->intf->dev, \"total %lu msec (%lu packets)\\n\", (packets * (1 << (desc->bInterval - 1))) / ((udev->speed >= USB_SPEED_HIGH) ? 8 : 1), packets); } spin_lock_irq(&context.lock); for (i = 0; i < param->sglen; i++) { ++context.pending; status = usb_submit_urb(urbs[i], GFP_ATOMIC); if (status < 0) { ERROR(dev, \"submit iso[%d], error %d\\n\", i, status); if (i == 0) { spin_unlock_irq(&context.lock); goto fail; } simple_free_urb(urbs[i]); urbs[i] = NULL; context.pending--; context.submit_error = 1; break; } } spin_unlock_irq(&context.lock); wait_for_completion(&context.done); for (i = 0; i < param->sglen; i++) { if (urbs[i]) simple_free_urb(urbs[i]); } /* * Isochronous transfers are expected to fail sometimes. As an * arbitrary limit, we will report an error if any submissions * fail or if the transfer failure rate is > 10%. */ if (status != 0) ; else if (context.submit_error) status = -EACCES; else if (context.errors > (context.is_iso ? context.packet_count / 10 : 0)) status = -EIO; return status; fail: for (i = 0; i < param->sglen; i++) { if (urbs[i]) simple_free_urb(urbs[i]); } return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 215492, "input": "static int irda_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct sockaddr_irda saddr; struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); if (peer) { if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; saddr.sir_family = AF_IRDA; saddr.sir_lsap_sel = self->dtsap_sel; saddr.sir_addr = self->daddr; } else { saddr.sir_family = AF_IRDA; saddr.sir_lsap_sel = self->stsap_sel; saddr.sir_addr = self->saddr; } IRDA_DEBUG(1, \"%s(), tsap_sel = %#x\\n\", __func__, saddr.sir_lsap_sel); IRDA_DEBUG(1, \"%s(), addr = %08x\\n\", __func__, saddr.sir_addr); /* uaddr_len come to us uninitialised */ *uaddr_len = sizeof (struct sockaddr_irda); memcpy(uaddr, &saddr, *uaddr_len); return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Sensitive Information to an Unauthorized Actor"], "explanation": "The llc_ui_getname function in net/llc/af_llc.c in the Linux kernel 2.6.31-rc7 and earlier does not initialize a certain data structure, which allows local users to read the contents of some kernel memory locations by calling getsockname on an AF_LLC socket.", "severity_level": "Medium", "cwe": "CWE-200", "cve": "CVE-2009-3001"}} -{"idx": 303484, "input": "static int call_hook_func(gnutls_session_t session, gnutls_handshake_description_t type, int post, unsigned incoming, const uint8_t *data, unsigned data_size) { gnutls_datum_t msg = {(void*)data, data_size}; if (session->internals.h_hook != NULL) { if ((session->internals.h_type == type || session->internals.h_type == GNUTLS_HANDSHAKE_ANY) && (session->internals.h_post == post || session->internals.h_post == GNUTLS_HOOK_BOTH)) return session->internals.h_hook(session, type, post, incoming, &msg); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 462456, "input": "void dw_spi_remove_host(struct dw_spi *dws) { dw_spi_debugfs_remove(dws); if (dws->dma_ops && dws->dma_ops->dma_exit) dws->dma_ops->dma_exit(dws); spi_shutdown_chip(dws); free_irq(dws->irq, dws->master); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268800, "input": "R_API char *r_str_sanitize_sdb_key(const char *s) { if (!s || !*s) { return NULL; } size_t len = strlen (s); char *ret = malloc (len + 1); if (!ret) { return NULL; } char *cur = ret; while (len > 0) { char c = *s; if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != '_' && c != ':') { c = '_'; } *cur = c; s++; cur++; len--; } *cur = '\\0'; return ret; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 506552, "input": "begin_clause() { clause_depth++; c_token++; return; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446307, "input": "ScanLineInputFile::ScanLineInputFile (const Header &header, OPENEXR_IMF_INTERNAL_NAMESPACE::IStream *is, int numThreads) : _data (new Data (numThreads)), _streamData (new InputStreamMutex()) { _streamData->is = is; _data->memoryMapped = is->isMemoryMapped(); try { initialize(header); // // (TODO) this is nasty - we need a better way of working out what type of file has been used. // in any case I believe this constructor only gets used with single part files // and 'version' currently only tracks multipart state, so setting to 0 (not multipart) works for us // _data->version=0; readLineOffsets (*_streamData->is, _data->lineOrder, _data->lineOffsets, _data->fileIsComplete); } catch(...) { if(_data) { if (!_data->memoryMapped) { for (size_t i = 0; i < _data->lineBuffers.size(); i++) { if( _data->lineBuffers[i] ) { EXRFreeAligned(_data->lineBuffers[i]->buffer); _data->lineBuffers[i]->buffer=nullptr; } } } } delete _streamData; delete _data; throw; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431949, "input": "static void hci_cc_remote_name_req_cancel(struct hci_dev *hdev, struct sk_buff *skb) { BT_DBG(\"%s\", hdev->name); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 499992, "input": "static int __init disable_acpi_irq(struct dmi_system_id *d) { if (!acpi_force) { printk(KERN_NOTICE \"%s detected: force use of acpi=noirq\\n\", d->ident); acpi_noirq_set(); } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 357312, "input": "static OPJ_BOOL opj_j2k_write_mco(opj_j2k_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) { OPJ_BYTE * l_current_data = 00; OPJ_UINT32 l_mco_size; opj_tcp_t * l_tcp = 00; opj_simple_mcc_decorrelation_data_t * l_mcc_record; OPJ_UINT32 i; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); l_tcp = &(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]); l_mco_size = 5 + l_tcp->m_nb_mcc_records; if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) { OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc( p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size); if (! new_header_tile_data) { opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data); p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL; p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0; opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to write MCO marker\\n\"); return OPJ_FALSE; } p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data; p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size; } l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data; opj_write_bytes(l_current_data, J2K_MS_MCO, 2); /* MCO */ l_current_data += 2; opj_write_bytes(l_current_data, l_mco_size - 2, 2); /* Lmco */ l_current_data += 2; opj_write_bytes(l_current_data, l_tcp->m_nb_mcc_records, 1); /* Nmco : only one transform stage*/ ++l_current_data; l_mcc_record = l_tcp->m_mcc_records; for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) { opj_write_bytes(l_current_data, l_mcc_record->m_index, 1); /* Imco -> use the mcc indicated by 1*/ ++l_current_data; ++l_mcc_record; } if (opj_stream_write_data(p_stream, p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size, p_manager) != l_mco_size) { return OPJ_FALSE; } return OPJ_TRUE; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402566, "input": "static int active_scan(struct hci_request *req, unsigned long opt) { uint16_t interval = opt; struct hci_dev *hdev = req->hdev; u8 own_addr_type; /* White list is not used for discovery */ u8 filter_policy = 0x00; /* Discovery doesn't require controller address resolution */ bool addr_resolv = false; int err; bt_dev_dbg(hdev, \"\"); /* If controller is scanning, it means the background scanning is * running. Thus, we should temporarily stop it in order to set the * discovery scanning parameters. */ if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) { hci_req_add_le_scan_disable(req, false); cancel_interleave_scan(hdev); } /* All active scans will be done with either a resolvable private * address (when privacy feature has been enabled) or non-resolvable * private address. */ err = hci_update_random_address(req, true, scan_use_rpa(hdev), &own_addr_type); if (err < 0) own_addr_type = ADDR_LE_DEV_PUBLIC; hci_req_start_scan(req, LE_SCAN_ACTIVE, interval, hdev->le_scan_window_discovery, own_addr_type, filter_policy, addr_resolv); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508711, "input": "static COND *build_equal_items(JOIN *join, COND *cond, COND_EQUAL *inherited, List *join_list, bool ignore_on_conds, COND_EQUAL **cond_equal_ref, bool link_equal_fields) { THD *thd= join->thd; *cond_equal_ref= NULL; if (cond) { cond= cond->build_equal_items(thd, inherited, link_equal_fields, cond_equal_ref); if (*cond_equal_ref) { (*cond_equal_ref)->upper_levels= inherited; inherited= *cond_equal_ref; } } if (join_list && !ignore_on_conds) { TABLE_LIST *table; List_iterator li(*join_list); while ((table= li++)) { if (table->on_expr) { List *nested_join_list= table->nested_join ? &table->nested_join->join_list : NULL; /* We can modify table->on_expr because its old value will be restored before re-execution of PS/SP. */ table->on_expr= build_equal_items(join, table->on_expr, inherited, nested_join_list, ignore_on_conds, &table->cond_equal); } } } return cond; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 453383, "input": "static void bfq_completed_request(struct bfq_queue *bfqq, struct bfq_data *bfqd) { u64 now_ns; u32 delta_us; bfq_update_hw_tag(bfqd); bfqd->rq_in_driver--; bfqq->dispatched--; if (!bfqq->dispatched && !bfq_bfqq_busy(bfqq)) { /* * Set budget_timeout (which we overload to store the * time at which the queue remains with no backlog and * no outstanding request; used by the weight-raising * mechanism). */ bfqq->budget_timeout = jiffies; bfq_weights_tree_remove(bfqd, bfqq); } now_ns = ktime_get_ns(); bfqq->ttime.last_end_request = now_ns; /* * Using us instead of ns, to get a reasonable precision in * computing rate in next check. */ delta_us = div_u64(now_ns - bfqd->last_completion, NSEC_PER_USEC); /* * If the request took rather long to complete, and, according * to the maximum request size recorded, this completion latency * implies that the request was certainly served at a very low * rate (less than 1M sectors/sec), then the whole observation * interval that lasts up to this time instant cannot be a * valid time interval for computing a new peak rate. Invoke * bfq_update_rate_reset to have the following three steps * taken: * - close the observation interval at the last (previous) * request dispatch or completion * - compute rate, if possible, for that observation interval * - reset to zero samples, which will trigger a proper * re-initialization of the observation interval on next * dispatch */ if (delta_us > BFQ_MIN_TT/NSEC_PER_USEC && (bfqd->last_rq_max_size<last_completion = now_ns; bfqd->last_completed_rq_bfqq = bfqq; /* * If we are waiting to discover whether the request pattern * of the task associated with the queue is actually * isochronous, and both requisites for this condition to hold * are now satisfied, then compute soft_rt_next_start (see the * comments on the function bfq_bfqq_softrt_next_start()). We * do not compute soft_rt_next_start if bfqq is in interactive * weight raising (see the comments in bfq_bfqq_expire() for * an explanation). We schedule this delayed update when bfqq * expires, if it still has in-flight requests. */ if (bfq_bfqq_softrt_update(bfqq) && bfqq->dispatched == 0 && RB_EMPTY_ROOT(&bfqq->sort_list) && bfqq->wr_coeff != bfqd->bfq_wr_coeff) bfqq->soft_rt_next_start = bfq_bfqq_softrt_next_start(bfqd, bfqq); /* * If this is the in-service queue, check if it needs to be expired, * or if we want to idle in case it has no pending requests. */ if (bfqd->in_service_queue == bfqq) { if (bfq_bfqq_must_idle(bfqq)) { if (bfqq->dispatched == 0) bfq_arm_slice_timer(bfqd); /* * If we get here, we do not expire bfqq, even * if bfqq was in budget timeout or had no * more requests (as controlled in the next * conditional instructions). The reason for * not expiring bfqq is as follows. * * Here bfqq->dispatched > 0 holds, but * bfq_bfqq_must_idle() returned true. This * implies that, even if no request arrives * for bfqq before bfqq->dispatched reaches 0, * bfqq will, however, not be expired on the * completion event that causes bfqq->dispatch * to reach zero. In contrast, on this event, * bfqq will start enjoying device idling * (I/O-dispatch plugging). * * But, if we expired bfqq here, bfqq would * not have the chance to enjoy device idling * when bfqq->dispatched finally reaches * zero. This would expose bfqq to violation * of its reserved service guarantees. */ return; } else if (bfq_may_expire_for_budg_timeout(bfqq)) bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_BUDGET_TIMEOUT); else if (RB_EMPTY_ROOT(&bfqq->sort_list) && (bfqq->dispatched == 0 || !bfq_better_to_idle(bfqq))) bfq_bfqq_expire(bfqd, bfqq, false, BFQQE_NO_MORE_REQUESTS); } if (!bfqd->rq_in_driver) bfq_schedule_dispatch(bfqd);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 364929, "input": "static void tipc_node_link_failover(struct tipc_node *n, struct tipc_link *l, struct tipc_link *tnl, struct sk_buff_head *xmitq) { /* Avoid to be \"self-failover\" that can never end */ if (!tipc_link_is_up(tnl)) return; /* Don't rush, failure link may be in the process of resetting */ if (l && !tipc_link_is_reset(l)) return; tipc_link_fsm_evt(tnl, LINK_SYNCH_END_EVT); tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT); n->sync_point = tipc_link_rcv_nxt(tnl) + (U16_MAX / 2 - 1); tipc_link_failover_prepare(l, tnl, xmitq); if (l) tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT); tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 430254, "input": "virSecuritySELinuxGetBaseLabel(virSecurityManager *mgr, int virtType) { virSecuritySELinuxData *priv = virSecurityManagerGetPrivateData(mgr); if (virtType == VIR_DOMAIN_VIRT_QEMU && priv->alt_domain_context) return priv->alt_domain_context; else return priv->domain_context; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267890, "input": "GF_Err stbl_AddRAP(GF_SyncSampleBox *stss, u32 sampleNumber) { u32 i, k; u32 *newNumbers; if (!stss || !sampleNumber) return GF_BAD_PARAM; if (stss->sampleNumbers == NULL) { ALLOC_INC(stss->alloc_size); stss->sampleNumbers = (u32*)gf_malloc(sizeof(u32)*stss->alloc_size); if (!stss->sampleNumbers) return GF_OUT_OF_MEM; stss->sampleNumbers[0] = sampleNumber; stss->nb_entries = 1; return GF_OK; } if (stss->sampleNumbers[stss->nb_entries-1] == sampleNumber) return GF_OK; if (stss->sampleNumbers[stss->nb_entries-1] < sampleNumber) { if (stss->nb_entries==stss->alloc_size) { ALLOC_INC(stss->alloc_size); stss->sampleNumbers = gf_realloc(stss->sampleNumbers, sizeof(u32) * stss->alloc_size); if (!stss->sampleNumbers) return GF_OUT_OF_MEM; memset(&stss->sampleNumbers[stss->nb_entries], 0, sizeof(u32) * (stss->alloc_size-stss->nb_entries) ); } stss->sampleNumbers[stss->nb_entries] = sampleNumber; } else { newNumbers = (u32*)gf_malloc(sizeof(u32) * (stss->nb_entries + 1)); if (!newNumbers) return GF_OUT_OF_MEM; //the table is in increasing order of sampleNumber k = 0; for (i = 0; i < stss->nb_entries; i++) { if (stss->sampleNumbers[i] >= sampleNumber) { newNumbers[i + k] = sampleNumber; k = 1; } newNumbers[i + k] = stss->sampleNumbers[i] + k; } gf_free(stss->sampleNumbers); stss->sampleNumbers = newNumbers; stss->alloc_size = stss->nb_entries+1; } //update our list stss->nb_entries ++; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 273255, "input": "void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { cmdpart.msgwrap.ReadConfig(\"prefixpart\", \"suffixpart\", \"fixedpart\"); cmdquit.msgwrap.ReadConfig(\"prefixquit\", \"suffixquit\", \"fixedquit\"); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 195663, "input": "void Compute(OpKernelContext* ctx) override { const Tensor& input = ctx->input(0); const Tensor& input_min_tensor = ctx->input(1); const Tensor& input_max_tensor = ctx->input(2); int num_slices = 1; if (axis_ > -1) { num_slices = input.dim_size(axis_); } Tensor* output = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &output)); Tensor float_output = need_cast_ ? tensorflow::Tensor(DT_FLOAT, input.shape()) : *output; if (num_slices == 1) { const float min_range = input_min_tensor.flat()(0); const float max_range = input_max_tensor.flat()(0); DequantizeTensor(ctx, input, min_range, max_range, &float_output); } else { OP_REQUIRES(ctx, mode_ != QUANTIZE_MODE_MIN_FIRST, errors::Unimplemented(\"MIN_FIRST mode is not implemented for \" \"Dequantize with axis != -1.\")); int64 pre_dim = 1, post_dim = 1; for (int i = 0; i < axis_; ++i) { pre_dim *= float_output.dim_size(i); } for (int i = axis_ + 1; i < float_output.dims(); ++i) { post_dim *= float_output.dim_size(i); } auto input_tensor = input.template bit_casted_shaped( {pre_dim, num_slices, post_dim}); auto output_tensor = float_output.flat_inner_outer_dims(axis_ - 1); auto min_ranges = input_min_tensor.vec(); auto max_ranges = input_max_tensor.vec(); for (int i = 0; i < num_slices; ++i) { DequantizeSlice(ctx->eigen_device(), ctx, input_tensor.template chip<1>(i), min_ranges(i), max_ranges(i), output_tensor.template chip<1>(i)); } } if (need_cast_) { S* out_ptr = output->flat().data(); float* in_ptr = float_output.flat().data(); for (int64 i = 0; i < float_output.NumElements(); ++i) { out_ptr[i] = static_cast(in_ptr[i]); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Input Validation"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. Due to lack of validation in `tf.raw_ops.Dequantize`, an attacker can trigger a read from outside of bounds of heap allocated data. The implementation(https://github.com/tensorflow/tensorflow/blob/26003593aa94b1742f34dc22ce88a1e17776a67d/tensorflow/core/kernels/dequantize_op.cc#L106-L131) accesses the `min_range` and `max_range` tensors in parallel but fails to check that they have the same shape. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-20", "cve": "CVE-2021-29582"}} -{"idx": 361274, "input": "int getGenericCommand(client *c) { robj *o; if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp])) == NULL) return C_OK; if (o->type != OBJ_STRING) { addReply(c,shared.wrongtypeerr); return C_ERR; } else { addReplyBulk(c,o); return C_OK; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 302149, "input": "xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { xmlEntitiesTablePtr table; if (doc == NULL) return(NULL); if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { table = (xmlEntitiesTablePtr) doc->extSubset->entities; return(xmlGetEntityFromTable(table, name)); } return(NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328380, "input": "static void __nf_tables_commit_chain_free_rules_old(struct rcu_head *h) { struct nft_rules_old *o = container_of(h, struct nft_rules_old, h); kvfree(o->start); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508956, "input": "Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 230171, "input": "JSObject *JSObject::getNamedDescriptor( Handle selfHandle, Runtime *runtime, SymbolID name, PropertyFlags expectedFlags, NamedPropertyDescriptor &desc) { if (findProperty(selfHandle, runtime, name, expectedFlags, desc)) return *selfHandle; // Check here for host object flag. This means that \"normal\" own // properties above win over host-defined properties, but there's no // cost imposed on own property lookups. This should do what we // need in practice, and we can define host vs js property // disambiguation however we want. This is here in order to avoid // impacting perf for the common case where an own property exists // in normal storage. if (LLVM_UNLIKELY(selfHandle->flags_.hostObject)) { desc.flags.hostObject = true; desc.flags.writable = true; return *selfHandle; } if (LLVM_UNLIKELY(selfHandle->flags_.lazyObject)) { assert( !selfHandle->flags_.proxyObject && \"Proxy objects should never be lazy\"); // Initialize the object and perform the lookup again. JSObject::initializeLazyObject(runtime, selfHandle); if (findProperty(selfHandle, runtime, name, expectedFlags, desc)) return *selfHandle; } if (LLVM_UNLIKELY(selfHandle->flags_.proxyObject)) { desc.flags.proxyObject = true; return *selfHandle; } if (selfHandle->parent_) { MutableHandle mutableSelfHandle{ runtime, selfHandle->parent_.getNonNull(runtime)}; do { // Check the most common case first, at the cost of some code duplication. if (LLVM_LIKELY( !mutableSelfHandle->flags_.lazyObject && !mutableSelfHandle->flags_.hostObject && !mutableSelfHandle->flags_.proxyObject)) { findProp: if (findProperty( mutableSelfHandle, runtime, name, PropertyFlags::invalid(), desc)) { assert( !selfHandle->flags_.proxyObject && \"Proxy object parents should never have own properties\"); return *mutableSelfHandle; } } else if (LLVM_UNLIKELY(mutableSelfHandle->flags_.lazyObject)) { JSObject::initializeLazyObject(runtime, mutableSelfHandle); goto findProp; } else if (LLVM_UNLIKELY(mutableSelfHandle->flags_.hostObject)) { desc.flags.hostObject = true; desc.flags.writable = true; return *mutableSelfHandle; } else { assert( mutableSelfHandle->flags_.proxyObject && \"descriptor flags are impossible\"); desc.flags.proxyObject = true; return *mutableSelfHandle; } } while ((mutableSelfHandle = mutableSelfHandle->parent_.get(runtime))); } return nullptr; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295162, "input": "void gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg) { im->alphaBlendingFlag = alphaBlendingArg; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269095, "input": "R_API bool r_str_range_in(const char *r, ut64 addr) { const char *p = r; ut64 min = UT64_MAX; ut64 max = 0; if (!r) { return false; } for (; *r; r++) { if (*r == ',') { if (max == 0) { if (addr == r_num_get (NULL, p)) { return true; } } else { if (addr >= min && addr <= r_num_get (NULL, p)) { return true; } } p = r + 1; } if (*r == '-') { if (p != r) { ut64 from = r_num_get (NULL, p); ut64 to = r_num_get (NULL, r + 1); if (addr >= from && addr <= to) { return true; } } else { fprintf (stderr, \"Invalid range\\n\"); } for (r++; *r && *r != ',' && *r != '-'; r++) { ; } p = r; } } if (*p) { if (addr == r_num_get (NULL, p)) { return true; } } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 234431, "input": "ff_layout_remove_mirror(struct nfs4_ff_layout_mirror *mirror) { struct inode *inode; if (mirror->layout == NULL) return; inode = mirror->layout->plh_inode; spin_lock(&inode->i_lock); list_del(&mirror->mirrors); spin_unlock(&inode->i_lock); mirror->layout = NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207839, "input": "HttpHeader::chunked() const { return has(Http::HdrType::TRANSFER_ENCODING) && hasListMember(Http::HdrType::TRANSFER_ENCODING, \"chunked\", ','); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling')"], "explanation": "An issue was discovered in Squid before 4.13 and 5.x before 5.0.4. Due to incorrect data validation, HTTP Request Splitting attacks may succeed against HTTP and HTTPS traffic. This leads to cache poisoning. This allows any client, including browser scripts, to bypass local security and poison the browser cache and any downstream caches with content from an arbitrary source. Squid uses a string search instead of parsing the Transfer-Encoding header to find chunked encoding. This allows an attacker to hide a second request inside Transfer-Encoding: it is interpreted by Squid as chunked and split out into a second request delivered upstream. Squid will then deliver two distinct responses to the client, corrupting any downstream caches.", "severity_level": "NoInfo", "cwe": "CWE-444", "cve": "CVE-2020-15811"}} -{"idx": 281388, "input": "void RGWDeleteCORS_ObjStore_S3::send_response() { int r = op_ret; if (!r || r == -ENOENT) r = STATUS_NO_CONTENT; set_req_state_err(s, r); dump_errno(s); end_header(s, NULL); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 383669, "input": "spnego_gss_verify_mic( OM_uint32 *minor_status, const gss_ctx_id_t context_handle, const gss_buffer_t msg_buffer, const gss_buffer_t token_buffer, gss_qop_t *qop_state) { OM_uint32 ret; ret = gss_verify_mic(minor_status, context_handle, msg_buffer, token_buffer, qop_state); return (ret); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 409889, "input": "static int tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, const struct tcphdr *th, int syn_inerr) { const u8 *hash_location; struct tcp_sock *tp = tcp_sk(sk); /* RFC1323: H1. Apply PAWS check first. */ if (tcp_fast_parse_options(skb, th, tp, &hash_location) && tp->rx_opt.saw_tstamp && tcp_paws_discard(sk, skb)) { if (!th->rst) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED); tcp_send_dupack(sk, skb); goto discard; } /* Reset is accepted even if it did not pass PAWS. */ } /* Step 1: check sequence number */ if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq)) { /* RFC793, page 37: \"In all states except SYN-SENT, all reset * (RST) segments are validated by checking their SEQ-fields.\" * And page 69: \"If an incoming segment is not acceptable, * an acknowledgment should be sent in reply (unless the RST * bit is set, if so drop the segment and return)\". */ if (!th->rst) tcp_send_dupack(sk, skb); goto discard; } /* Step 2: check RST bit */ if (th->rst) { tcp_reset(sk); goto discard; } /* ts_recent update must be made after we are sure that the packet * is in window. */ tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); /* step 3: check security and precedence [ignored] */ /* step 4: Check for a SYN in window. */ if (th->syn && !before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) { if (syn_inerr) TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPABORTONSYN); tcp_reset(sk); return -1; } return 1; discard: __kfree_skb(skb); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 489587, "input": "int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos) { struct sock *sk = sk_atm(vcc); DEFINE_WAIT(wait); set_bit(ATM_VF_WAITING, &vcc->flags); prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); sigd_enq2(vcc,as_modify,NULL,NULL,&vcc->local,qos,0); while (test_bit(ATM_VF_WAITING, &vcc->flags) && !test_bit(ATM_VF_RELEASED, &vcc->flags) && sigd) { schedule(); prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); } finish_wait(sk->sk_sleep, &wait); if (!sigd) return -EUNATCH; return -sk->sk_err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431412, "input": "static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) { __be32 *p; int status = 0; *res = 0; if (unlikely(bitmap[0] & (FATTR4_WORD0_FILES_AVAIL - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) { p = xdr_inline_decode(xdr, 8); if (unlikely(!p)) return -EIO; xdr_decode_hyper(p, res); bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; } dprintk(\"%s: files avail=%Lu\\n\", __func__, (unsigned long long)*res); return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 508719, "input": "bool JOIN::inject_cond_into_where(Item *injected_cond) { Item *where_item= injected_cond; List *and_args= NULL; if (conds && conds->type() == Item::COND_ITEM && ((Item_cond*) conds)->functype() == Item_func::COND_AND_FUNC) { and_args= ((Item_cond*) conds)->argument_list(); if (cond_equal) and_args->disjoin((List *) &cond_equal->current_level); } where_item= and_items(thd, conds, where_item); if (where_item->fix_fields_if_needed(thd, 0)) return true; thd->change_item_tree(&select_lex->where, where_item); select_lex->where->top_level_item(); conds= select_lex->where; if (and_args && cond_equal) { and_args= ((Item_cond*) conds)->argument_list(); List_iterator li(cond_equal->current_level); Item_equal *elem; while ((elem= li++)) { and_args->push_back(elem, thd->mem_root); } } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 336235, "input": "struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long toff) { struct file *file_raw; struct eventpoll *ep; struct epitem *epi; if (!is_file_epoll(file)) return ERR_PTR(-EINVAL); ep = file->private_data; mutex_lock(&ep->mtx); epi = ep_find_tfd(ep, tfd, toff); if (epi) file_raw = epi->ffd.file; else file_raw = ERR_PTR(-ENOENT); mutex_unlock(&ep->mtx); return file_raw; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 496458, "input": "reset (int fd, char const *file, struct stats *stats) { if (! pagesize) { pagesize = getpagesize (); if (pagesize == 0 || 2 * pagesize + 1 <= pagesize) abort (); bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1; buffer = xmalloc (bufalloc); } bufbeg = buflim = ALIGN_TO (buffer + 1, pagesize); bufbeg[-1] = eolbyte; bufdesc = fd; if (S_ISREG (stats->stat.st_mode)) { if (file) bufoffset = 0; else { bufoffset = lseek (fd, 0, SEEK_CUR); if (bufoffset < 0) { suppressible_error (_(\"lseek failed\"), errno); return 0; } } } return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 303103, "input": "blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) { blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context)); /* Populate the context, using zeros as default values */ memset(context, 0, sizeof(blosc2_context)); context->do_compress = 1; /* meant for compression */ context->compcode = cparams.compcode; context->clevel = cparams.clevel; context->use_dict = cparams.use_dict; context->typesize = cparams.typesize; for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) { context->filters[i] = cparams.filters[i]; context->filters_meta[i] = cparams.filters_meta[i]; } context->nthreads = cparams.nthreads; context->new_nthreads = context->nthreads; context->blocksize = cparams.blocksize; context->threads_started = 0; context->schunk = cparams.schunk; if (cparams.prefilter != NULL) { context->prefilter = cparams.prefilter; context->pparams = (blosc2_prefilter_params*)my_malloc(sizeof(blosc2_prefilter_params)); memcpy(context->pparams, cparams.pparams, sizeof(blosc2_prefilter_params)); } return context; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 214241, "input": "int main(int argc, char **argv, char **envp) { // dynamically load shared library #ifdef DYNLOAD if (!uc_dyn_load(NULL, 0)) { printf(\"Error dynamically loading shared library.\\n\"); printf(\"Please check that unicorn.dll/unicorn.so is available as well as\\n\"); printf(\"any other dependent dll/so files.\\n\"); printf(\"The easiest way is to place them in the same directory as this app.\\n\"); return 1; } #endif test_arm(); printf(\"==========================\\n\"); test_thumb(); // dynamically free shared library #ifdef DYNLOAD uc_dyn_free(); #endif return 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Improper Certificate Validation"], "explanation": "Unicorn Engine 1.0.2 has an out-of-bounds write in tb_flush_armeb (called from cpu_arm_exec_armeb and tcg_cpu_exec_armeb).", "severity_level": "NoInfo", "cwe": "CWE-295", "cve": "CVE-2021-36979"}} -{"idx": 308288, "input": "XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start) { if (parser != NULL) startDoctypeDeclHandler = start; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 333823, "input": "bool RGWHandler_REST_S3Website::web_dir() const { std::string subdir_name = url_decode(s->object.name); if (subdir_name.empty()) { return false; } else if (subdir_name.back() == '/') { subdir_name.pop_back(); } rgw_obj obj(s->bucket, subdir_name); RGWObjectCtx& obj_ctx = *static_cast(s->obj_ctx); obj_ctx.set_atomic(obj); obj_ctx.set_prefetch_data(obj); RGWObjState* state = nullptr; if (store->get_obj_state(&obj_ctx, s->bucket_info, obj, &state, false) < 0) { return false; } if (! state->exists) { return false; } return state->exists; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 268341, "input": "Options(const ImportGraphDefOptions& in) // NOLINT(runtime/explicit) : allow_internal_ops(false), expect_device_spec(false), prefix(in.prefix.empty() || str_util::EndsWith(in.prefix, \"/\") ? in.prefix : in.prefix + \"/\"), uniquify_names(in.uniquify_names), uniquify_prefix(in.uniquify_prefix), input_map(in.input_map.begin(), in.input_map.end()), skip_mapped_nodes(in.skip_mapped_nodes), control_dependencies(in.control_dependencies), return_tensors(in.return_tensors.begin(), in.return_tensors.end()), return_nodes(in.return_nodes), importing(true), validate_nodes(true), validate_colocation_constraints(in.validate_colocation_constraints), validate_shape(in.validate_shape), default_device(in.default_device) {}", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 244808, "input": "DEFINE_TEST(test_read_format_rar5_nonempty_dir_stream) { uint8_t buf[16]; PROLOGUE(\"test_read_format_rar5_nonempty_dir_stream.rar\"); /* This archive is invalid. However, processing it shouldn't cause any * errors related to buffer overflows when using -fsanitize. */ (void) archive_read_next_header(a, &ae); (void) archive_read_data(a, buf, sizeof(buf)); (void) archive_read_next_header(a, &ae); EPILOGUE(); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 338660, "input": "static struct io_wq *io_init_wq_offload(struct io_ring_ctx *ctx, struct task_struct *task) { struct io_wq_hash *hash; struct io_wq_data data; unsigned int concurrency; hash = ctx->hash_map; if (!hash) { hash = kzalloc(sizeof(*hash), GFP_KERNEL); if (!hash) return ERR_PTR(-ENOMEM); refcount_set(&hash->refs, 1); init_waitqueue_head(&hash->wait); ctx->hash_map = hash; } data.hash = hash; data.task = task; data.free_work = io_free_work; data.do_work = io_wq_submit_work; /* Do QD, or 4 * CPUS, whatever is smallest */ concurrency = min(ctx->sq_entries, 4 * num_online_cpus()); return io_wq_create(concurrency, &data);", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 219670, "input": "bool HHVM_FUNCTION(imagesetinterpolation, const Resource& image, int64_t method /*=GD_BILINEAR_FIXED*/) { gdImagePtr im = get_valid_image_resource(image); if (!im) return false; if (method == -1) method = GD_BILINEAR_FIXED; return gdImageSetInterpolationMethod(im, (gdInterpolationMethod) method); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 279954, "input": "void ItemStackMetadata::serialize(std::ostream &os) const { std::ostringstream os2; os2 << DESERIALIZE_START; for (const auto &stringvar : m_stringvars) { if (!stringvar.first.empty() || !stringvar.second.empty()) os2 << stringvar.first << DESERIALIZE_KV_DELIM << stringvar.second << DESERIALIZE_PAIR_DELIM; } os << serializeJsonStringIfNeeded(os2.str()); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 521642, "input": "static void get_key_authority(const char *ret[3], const char *key) { int i = 0; if (key_equals(key, \"PK\")) { ret[i++] = \"PK\"; } else if (key_equals(key, \"KEK\")) { ret[i++] = \"PK\"; } else if (key_equals(key, \"db\") || key_equals(key, \"dbx\")) { ret[i++] = \"KEK\"; ret[i++] = \"PK\"; } ret[i] = NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 255321, "input": "static bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest) { uint8_t byte; uint32_t result; if (!pb_readbyte(stream, &byte)) return false; if ((byte & 0x80) == 0) { /* Quick case, 1 byte value */ result = byte; } else { /* Multibyte case */ uint8_t bitpos = 7; result = byte & 0x7F; do { if (bitpos >= 32) PB_RETURN_ERROR(stream, \"varint overflow\"); if (!pb_readbyte(stream, &byte)) return false; result |= (uint32_t)(byte & 0x7F) << bitpos; bitpos = (uint8_t)(bitpos + 7); } while (byte & 0x80); } *dest = result; return true; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 207988, "input": "file_rlookup(const char *filename) /* I - Filename */ { int i; /* Looping var */ cache_t *wc; /* Current cache file */ for (i = web_files, wc = web_cache; i > 0; i --, wc ++) if (!strcmp(wc->name, filename)) return (wc->url); return (filename); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Double Free"], "explanation": "A security issue was found in htmldoc v1.9.12 and before. A NULL pointer dereference in the function image_load_jpeg() in image.cxx may result in denial of service.", "severity_level": "NoInfo", "cwe": "CWE-415", "cve": "CVE-2021-23191"}} -{"idx": 318235, "input": "static void rtnl_dump_error(const struct rtnl_handle *rth, struct nlmsghdr *h) { if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) { fprintf(stderr, \"ERROR truncated\\n\"); } else { const struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(h); errno = -err->error; if (rth->proto == NETLINK_SOCK_DIAG && (errno == ENOENT || errno == EOPNOTSUPP)) return; if (!(rth->flags & RTNL_HANDLE_F_SUPPRESS_NLERR)) perror(\"RTNETLINK answers\"); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 402248, "input": "int bcf_enc_vchar(kstring_t *s, int l, const char *a) { bcf_enc_size(s, l, BCF_BT_CHAR); kputsn(a, l, s); return 0; // FIXME: check for errs in this function }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342007, "input": "void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm, struct user_namespace *user_ns, const struct fuse_iqueue_ops *fiq_ops, void *fiq_priv) { memset(fc, 0, sizeof(*fc)); spin_lock_init(&fc->lock); spin_lock_init(&fc->bg_lock); init_rwsem(&fc->killsb); refcount_set(&fc->count, 1); atomic_set(&fc->dev_count, 1); init_waitqueue_head(&fc->blocked_waitq); fuse_iqueue_init(&fc->iq, fiq_ops, fiq_priv); INIT_LIST_HEAD(&fc->bg_queue); INIT_LIST_HEAD(&fc->entry); INIT_LIST_HEAD(&fc->devices); atomic_set(&fc->num_waiting, 0); fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND; fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD; atomic64_set(&fc->khctr, 0); fc->polled_files = RB_ROOT; fc->blocked = 0; fc->initialized = 0; fc->connected = 1; atomic64_set(&fc->attr_version, 1); get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); fc->pid_ns = get_pid_ns(task_active_pid_ns(current)); fc->user_ns = get_user_ns(user_ns); fc->max_pages = FUSE_DEFAULT_MAX_PAGES_PER_REQ; INIT_LIST_HEAD(&fc->mounts); list_add(&fm->fc_entry, &fc->mounts); fm->fc = fc; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 275439, "input": "GF_Err gf_isom_piff_allocate_storage(GF_ISOFile *the_file, u32 trackNumber, u32 AlgorithmID, u8 IV_size, bin128 KID) { GF_TrackBox *trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak) return GF_BAD_PARAM; if (trak->sample_encryption) return GF_OK; trak->sample_encryption = (GF_SampleEncryptionBox *)gf_isom_create_piff_psec_box(1, 0, AlgorithmID, IV_size, KID); //senc will be written and destroyed with the other boxes if (!trak->child_boxes) trak->child_boxes = gf_list_new(); return gf_list_add(trak->child_boxes, trak->sample_encryption); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 446381, "input": "void cd_forget(struct inode *inode) { spin_lock(&cdev_lock); list_del_init(&inode->i_devices); inode->i_cdev = NULL; inode->i_mapping = &inode->i_data; spin_unlock(&cdev_lock); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 366749, "input": "static inline void __init check_numabalancing_enable(void) { }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 284232, "input": "apr_status_t h2_stream_set_request_rec(h2_stream *stream, request_rec *r, int eos) { h2_request *req; apr_status_t status; ap_assert(stream->request == NULL); ap_assert(stream->rtmp == NULL); if (stream->rst_error) { return APR_ECONNRESET; } status = h2_request_rcreate(&req, stream->pool, r); if (status == APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, H2_STRM_LOG(APLOGNO(03058), stream, \"set_request_rec %s host=%s://%s%s\"), req->method, req->scheme, req->authority, req->path); stream->rtmp = req; /* simulate the frames that led to this */ return h2_stream_recv_frame(stream, NGHTTP2_HEADERS, NGHTTP2_FLAG_END_STREAM, 0); } return status; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 196624, "input": "void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct, struct ndpi_flow_struct* flow) { struct ndpi_packet_struct* packet = &flow->packet; const u_int8_t * ovpn_payload = packet->payload; const u_int8_t * session_remote; u_int8_t opcode; u_int8_t alen; int8_t hmac_size; int8_t failed = 0; if(packet->payload_packet_len >= 40) { // skip openvpn TCP transport packet size if(packet->tcp != NULL) ovpn_payload += 2; opcode = ovpn_payload[0] & P_OPCODE_MASK; if(packet->udp) { #ifdef DEBUG printf(\"[packet_id: %u][opcode: %u][Packet ID: %d][%u <-> %u][len: %u]\\n\", flow->num_processed_pkts, opcode, check_pkid_and_detect_hmac_size(ovpn_payload), htons(packet->udp->source), htons(packet->udp->dest), packet->payload_packet_len); #endif if( (flow->num_processed_pkts == 1) && ( ((packet->payload_packet_len == 112) && ((opcode == 168) || (opcode == 192)) ) || ((packet->payload_packet_len == 80) && ((opcode == 184) || (opcode == 88) || (opcode == 160) || (opcode == 168) || (opcode == 200))) )) { NDPI_LOG_INFO(ndpi_struct,\"found openvpn\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN); return; } } if(flow->ovpn_counter < P_HARD_RESET_CLIENT_MAX_COUNT && (opcode == P_CONTROL_HARD_RESET_CLIENT_V1 || opcode == P_CONTROL_HARD_RESET_CLIENT_V2)) { if(check_pkid_and_detect_hmac_size(ovpn_payload) > 0) { memcpy(flow->ovpn_session_id, ovpn_payload+1, 8); NDPI_LOG_DBG2(ndpi_struct, \"session key: %02x%02x%02x%02x%02x%02x%02x%02x\\n\", flow->ovpn_session_id[0], flow->ovpn_session_id[1], flow->ovpn_session_id[2], flow->ovpn_session_id[3], flow->ovpn_session_id[4], flow->ovpn_session_id[5], flow->ovpn_session_id[6], flow->ovpn_session_id[7]); } } else if(flow->ovpn_counter >= 1 && flow->ovpn_counter <= P_HARD_RESET_CLIENT_MAX_COUNT && (opcode == P_CONTROL_HARD_RESET_SERVER_V1 || opcode == P_CONTROL_HARD_RESET_SERVER_V2)) { hmac_size = check_pkid_and_detect_hmac_size(ovpn_payload); if(hmac_size > 0) { alen = ovpn_payload[P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size)]; if (alen > 0) { session_remote = ovpn_payload + P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size) + 1 + alen * 4; if(memcmp(flow->ovpn_session_id, session_remote, 8) == 0) { NDPI_LOG_INFO(ndpi_struct,\"found openvpn\\n\"); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN); return; } else { NDPI_LOG_DBG2(ndpi_struct, \"key mismatch: %02x%02x%02x%02x%02x%02x%02x%02x\\n\", session_remote[0], session_remote[1], session_remote[2], session_remote[3], session_remote[4], session_remote[5], session_remote[6], session_remote[7]); failed = 1; } } else failed = 1; } else failed = 1; } else failed = 1; flow->ovpn_counter++; if(failed) { NDPI_EXCLUDE_PROTO(ndpi_struct, flow); } } }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In nDPI through 3.2, the OpenVPN dissector is vulnerable to a heap-based buffer over-read in ndpi_search_openvpn in lib/protocols/openvpn.c.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-15473"}} -{"idx": 402318, "input": "prepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry::Pointer &aLogEntry) { assert(request); assert(aLogEntry != NULL); if (Config.onoff.log_mime_hdrs) { MemBuf mb; mb.init(); request->header.packInto(&mb); //This is the request after adaptation or redirection aLogEntry->headers.adapted_request = xstrdup(mb.buf); // the virgin request is saved to aLogEntry->request if (aLogEntry->request) { mb.reset(); aLogEntry->request->header.packInto(&mb); aLogEntry->headers.request = xstrdup(mb.buf); } #if USE_ADAPTATION const Adaptation::History::Pointer ah = request->adaptLogHistory(); if (ah != NULL) { mb.reset(); ah->lastMeta.packInto(&mb); aLogEntry->adapt.last_meta = xstrdup(mb.buf); } #endif mb.clean(); } #if ICAP_CLIENT const Adaptation::Icap::History::Pointer ih = request->icapHistory(); if (ih != NULL) ih->processingTime(aLogEntry->icap.processingTime); #endif aLogEntry->http.method = request->method; aLogEntry->http.version = request->http_ver; aLogEntry->hier = request->hier; aLogEntry->cache.extuser = request->extacl_user.termedBuf(); // Adapted request, if any, inherits and then collects all the stats, but // the virgin request gets logged instead; copy the stats to log them. // TODO: avoid losses by keeping these stats in a shared history object? if (aLogEntry->request) { aLogEntry->request->dnsWait = request->dnsWait; aLogEntry->request->errType = request->errType; aLogEntry->request->errDetail = request->errDetail; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 212870, "input": "static void __reg_assign_32_into_64(struct bpf_reg_state *reg) { reg->umin_value = reg->u32_min_value; reg->umax_value = reg->u32_max_value; /* Attempt to pull 32-bit signed bounds into 64-bit bounds * but must be positive otherwise set to worse case bounds * and refine later from tnum. */ if (reg->s32_min_value >= 0 && reg->s32_max_value >= 0) reg->smax_value = reg->s32_max_value; else reg->smax_value = U32_MAX; if (reg->s32_min_value >= 0) reg->smin_value = reg->s32_min_value; else reg->smin_value = 0; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Exposure of Resource to Wrong Sphere"], "explanation": "The check_alu_op() function in kernel/bpf/verifier.c in the Linux kernel through v5.16-rc5 did not properly update bounds while handling the mov32 instruction, which allows local users to obtain potentially sensitive address information, aka a \"pointer leak.\"", "severity_level": "NoInfo", "cwe": "CWE-668", "cve": "CVE-2021-45402"}} -{"idx": 336270, "input": "static bool ep_busy_loop_end(void *p, unsigned long start_time) { struct eventpoll *ep = p; return ep_events_available(ep) || busy_loop_timeout(start_time); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267282, "input": "GF_Err gf_isom_add_user_data(GF_ISOFile *movie, u32 trackNumber, u32 UserDataType, bin128 UUID, u8 *data, u32 DataLength) { GF_Err e; GF_TrackBox *trak; GF_UserDataBox *udta; e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE); if (e) return e; if (UserDataType == GF_ISOM_BOX_TYPE_UUID) UserDataType = 0; if (trackNumber) { trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak) return GF_BAD_PARAM; if (!trak->udta) trak_on_child_box((GF_Box*)trak, gf_isom_box_new_parent(&trak->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE); udta = trak->udta; } else { if (!movie->moov->udta) moov_on_child_box((GF_Box*)movie->moov, gf_isom_box_new_parent(&movie->moov->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE); udta = movie->moov->udta; } if (!udta) return GF_OUT_OF_MEM; //create a default box if (UserDataType) { GF_UnknownBox *a = (GF_UnknownBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_UNKNOWN); if (!a) return GF_OUT_OF_MEM; a->original_4cc = UserDataType; if (DataLength) { a->data = (char*)gf_malloc(sizeof(char)*DataLength); if (!a->data) return GF_OUT_OF_MEM; memcpy(a->data, data, DataLength); a->dataSize = DataLength; } return udta_on_child_box((GF_Box *)udta, (GF_Box *) a, GF_FALSE); } else { GF_UnknownUUIDBox *a = (GF_UnknownUUIDBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_UUID); if (!a) return GF_OUT_OF_MEM; memcpy(a->uuid, UUID, 16); if (DataLength) { a->data = (char*)gf_malloc(sizeof(char)*DataLength); if (!a->data) return GF_OUT_OF_MEM; memcpy(a->data, data, DataLength); a->dataSize = DataLength; } return udta_on_child_box((GF_Box *)udta, (GF_Box *) a, GF_FALSE); } return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 373760, "input": "CHKiRet_Hdlr(qqueuePersist(pThis, QUEUE_NO_CHECKPOINT)) { DBGOPRINT((obj_t*) pThis, \"error %d persisting queue - data lost!\\n\", iRet); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 295352, "input": "static int lookup_open(struct nameidata *nd, struct path *path, struct file *file, const struct open_flags *op, bool got_write) { struct dentry *dir = nd->path.dentry; struct inode *dir_inode = dir->d_inode; int open_flag = op->open_flag; struct dentry *dentry; int error, create_error = 0; umode_t mode = op->mode; DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); if (unlikely(IS_DEADDIR(dir_inode))) return -ENOENT; file->f_mode &= ~FMODE_CREATED; dentry = d_lookup(dir, &nd->last); for (;;) { if (!dentry) { dentry = d_alloc_parallel(dir, &nd->last, &wq); if (IS_ERR(dentry)) return PTR_ERR(dentry); } if (d_in_lookup(dentry)) break; error = d_revalidate(dentry, nd->flags); if (likely(error > 0)) break; if (error) goto out_dput; d_invalidate(dentry); dput(dentry); dentry = NULL; } if (dentry->d_inode) { /* Cached positive dentry: will open in f_op->open */ goto out_no_open; } /* * Checking write permission is tricky, bacuse we don't know if we are * going to actually need it: O_CREAT opens should work as long as the * file exists. But checking existence breaks atomicity. The trick is * to check access and if not granted clear O_CREAT from the flags. * * Another problem is returing the \"right\" error value (e.g. for an * O_EXCL open we want to return EEXIST not EROFS). */ if (open_flag & O_CREAT) { if (!IS_POSIXACL(dir->d_inode)) mode &= ~current_umask(); if (unlikely(!got_write)) { create_error = -EROFS; open_flag &= ~O_CREAT; if (open_flag & (O_EXCL | O_TRUNC)) goto no_open; /* No side effects, safe to clear O_CREAT */ } else { create_error = may_o_create(&nd->path, dentry, mode); if (create_error) { open_flag &= ~O_CREAT; if (open_flag & O_EXCL) goto no_open; } } } else if ((open_flag & (O_TRUNC|O_WRONLY|O_RDWR)) && unlikely(!got_write)) { /* * No O_CREATE -> atomicity not a requirement -> fall * back to lookup + open */ goto no_open; } if (dir_inode->i_op->atomic_open) { error = atomic_open(nd, dentry, path, file, op, open_flag, mode); if (unlikely(error == -ENOENT) && create_error) error = create_error; return error; } no_open: if (d_in_lookup(dentry)) { struct dentry *res = dir_inode->i_op->lookup(dir_inode, dentry, nd->flags); d_lookup_done(dentry); if (unlikely(res)) { if (IS_ERR(res)) { error = PTR_ERR(res); goto out_dput; } dput(dentry); dentry = res; } } /* Negative dentry, just create the file */ if (!dentry->d_inode && (open_flag & O_CREAT)) { file->f_mode |= FMODE_CREATED; audit_inode_child(dir_inode, dentry, AUDIT_TYPE_CHILD_CREATE); if (!dir_inode->i_op->create) { error = -EACCES; goto out_dput; } error = dir_inode->i_op->create(dir_inode, dentry, mode, open_flag & O_EXCL); if (error) goto out_dput; fsnotify_create(dir_inode, dentry); } if (unlikely(create_error) && !dentry->d_inode) { error = create_error; goto out_dput; } out_no_open: path->dentry = dentry; path->mnt = nd->path.mnt; return 0; out_dput: dput(dentry); return error; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 432484, "input": "static void disable_nmi_singlestep(struct vcpu_svm *svm) { svm->nmi_singlestep = false; if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP)) { /* Clear our flags if they were not set by the guest */ if (!(svm->nmi_singlestep_guest_rflags & X86_EFLAGS_TF)) svm->vmcb->save.rflags &= ~X86_EFLAGS_TF; if (!(svm->nmi_singlestep_guest_rflags & X86_EFLAGS_RF)) svm->vmcb->save.rflags &= ~X86_EFLAGS_RF; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 328504, "input": "static int check_ptr_to_map_access(struct bpf_verifier_env *env, struct bpf_reg_state *regs, int regno, int off, int size, enum bpf_access_type atype, int value_regno) { struct bpf_reg_state *reg = regs + regno; struct bpf_map *map = reg->map_ptr; const struct btf_type *t; const char *tname; u32 btf_id; int ret; if (!btf_vmlinux) { verbose(env, \"map_ptr access not supported without CONFIG_DEBUG_INFO_BTF\\n\"); return -ENOTSUPP; } if (!map->ops->map_btf_id || !*map->ops->map_btf_id) { verbose(env, \"map_ptr access not supported for map type %d\\n\", map->map_type); return -ENOTSUPP; } t = btf_type_by_id(btf_vmlinux, *map->ops->map_btf_id); tname = btf_name_by_offset(btf_vmlinux, t->name_off); if (!env->allow_ptr_to_map_access) { verbose(env, \"%s access is allowed only to CAP_PERFMON and CAP_SYS_ADMIN\\n\", tname); return -EPERM; } if (off < 0) { verbose(env, \"R%d is %s invalid negative access: off=%d\\n\", regno, tname, off); return -EACCES; } if (atype != BPF_READ) { verbose(env, \"only read from %s is supported\\n\", tname); return -EACCES; } ret = btf_struct_access(&env->log, t, off, size, atype, &btf_id); if (ret < 0) return ret; if (value_regno >= 0) mark_btf_ld_reg(env, regs, value_regno, ret, btf_id); return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269115, "input": "int getServiceTable( IXML_Node *node, service_table *out, const char *DefaultURLBase) { IXML_Node *root = NULL; IXML_Node *URLBase = NULL; if (getSubElement(\"root\", node, &root)) { if (getSubElement(\"URLBase\", root, &URLBase)) { out->URLBase = getElementValue(URLBase); } else { if (DefaultURLBase) { out->URLBase = ixmlCloneDOMString(DefaultURLBase); } else { out->URLBase = ixmlCloneDOMString(\"\"); } } out->serviceList = getAllServiceList( root, out->URLBase, &out->endServiceList); if (out->serviceList) { return 1; } } return 0; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 262685, "input": "static int check_header_variable(EXRContext *s, const char *value_name, const char *value_type, unsigned int minimum_length) { GetByteContext *gb = &s->gb; int var_size = -1; if (bytestream2_get_bytes_left(gb) >= minimum_length && !strcmp(gb->buffer, value_name)) { // found value_name, jump to value_type (null terminated strings) gb->buffer += strlen(value_name) + 1; if (!strcmp(gb->buffer, value_type)) { gb->buffer += strlen(value_type) + 1; var_size = bytestream2_get_le32(gb); // don't go read past boundaries if (var_size > bytestream2_get_bytes_left(gb)) var_size = 0; } else { // value_type not found, reset the buffer gb->buffer -= strlen(value_name) + 1; av_log(s->avctx, AV_LOG_WARNING, \"Unknown data type %s for header variable %s.\\n\", value_type, value_name); } } return var_size; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 246294, "input": "AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r) { if (r->connection->remote_logname != NULL) { return r->connection->remote_logname; } if (ident_lookup) { return ident_lookup(r); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 431200, "input": "static int nfs4_proc_link(struct inode *inode, struct inode *dir, const struct qstr *name) { struct nfs4_exception exception = { .interruptible = true, }; int err; do { err = nfs4_handle_exception(NFS_SERVER(inode), _nfs4_proc_link(inode, dir, name), &exception); } while (exception.retry); return err; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 280828, "input": "parse_CONTROLLER(char *arg, const struct ofpact_parse_params *pp) { enum ofp_packet_in_reason reason = OFPR_ACTION; uint16_t controller_id = 0; uint16_t max_len = UINT16_MAX; uint32_t meter_id = NX_CTLR_NO_METER; const char *userdata = NULL; bool pause = false; if (!arg[0]) { /* Use defaults. */ } else if (strspn(arg, \"0123456789\") == strlen(arg)) { char *error = str_to_u16(arg, \"max_len\", &max_len); if (error) { return error; } } else { char *name, *value; while (ofputil_parse_key_value(&arg, &name, &value)) { if (!strcmp(name, \"reason\")) { if (!ofputil_packet_in_reason_from_string(value, &reason)) { return xasprintf(\"unknown reason \\\"%s\\\"\", value); } } else if (!strcmp(name, \"max_len\")) { char *error = str_to_u16(value, \"max_len\", &max_len); if (error) { return error; } } else if (!strcmp(name, \"id\")) { char *error = str_to_u16(value, \"id\", &controller_id); if (error) { return error; } } else if (!strcmp(name, \"userdata\")) { userdata = value; } else if (!strcmp(name, \"pause\")) { pause = true; } else if (!strcmp(name, \"meter_id\")) { char *error = str_to_u32(value, &meter_id); if (error) { return error; } } else { return xasprintf(\"unknown key \\\"%s\\\" parsing controller \" \"action\", name); } } } if (reason == OFPR_ACTION && controller_id == 0 && !userdata && !pause && meter_id == NX_CTLR_NO_METER) { struct ofpact_output *output; output = ofpact_put_OUTPUT(pp->ofpacts); output->port = OFPP_CONTROLLER; output->max_len = max_len; } else { struct ofpact_controller *controller; controller = ofpact_put_CONTROLLER(pp->ofpacts); controller->max_len = max_len; controller->reason = reason; controller->controller_id = controller_id; controller->pause = pause; controller->meter_id = meter_id; if (userdata) { size_t start_ofs = pp->ofpacts->size; const char *end = ofpbuf_put_hex(pp->ofpacts, userdata, NULL); if (*end) { return xstrdup(\"bad hex digit in `controller' \" \"action `userdata'\"); } size_t userdata_len = pp->ofpacts->size - start_ofs; controller = pp->ofpacts->header; controller->userdata_len = userdata_len; } ofpact_finish_CONTROLLER(pp->ofpacts, &controller); } return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 454797, "input": "static bool check_request_str(const char* const str, bool (*check) (int c)) { for (size_t i(0); str[i] != '\\0'; ++i) { if (!check(str[i])) { WSREP_WARN(\"Illegal character in state transfer request: %i (%c).\", str[i], str[i]); return true; } } return false; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 416751, "input": "static void cil_reset_selinuxuser(struct cil_selinuxuser *selinuxuser) { if (selinuxuser->range_str == NULL) { cil_reset_levelrange(selinuxuser->range); } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 198409, "input": "void Compute(OpKernelContext *ctx) override { // (0) validations const Tensor *a_indices, *b_indices, *a_values_t, *b_values_t, *a_shape, *b_shape, *thresh_t; OP_REQUIRES_OK(ctx, ctx->input(\"a_indices\", &a_indices)); OP_REQUIRES_OK(ctx, ctx->input(\"b_indices\", &b_indices)); OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(a_indices->shape()) && TensorShapeUtils::IsMatrix(b_indices->shape()), errors::InvalidArgument( \"Input indices should be matrices but received shapes: \", a_indices->shape().DebugString(), \" and \", b_indices->shape().DebugString())); const int64 a_nnz = a_indices->dim_size(0); const int64 b_nnz = b_indices->dim_size(0); OP_REQUIRES_OK(ctx, ctx->input(\"a_values\", &a_values_t)); OP_REQUIRES_OK(ctx, ctx->input(\"b_values\", &b_values_t)); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(a_values_t->shape()) && TensorShapeUtils::IsVector(b_values_t->shape()), errors::InvalidArgument( \"Input values should be vectors but received shapes: \", a_values_t->shape().DebugString(), \" and \", b_values_t->shape().DebugString())); auto a_values = ctx->input(1).vec(); auto b_values = ctx->input(4).vec(); OP_REQUIRES( ctx, a_values.size() == a_nnz && b_values.size() == b_nnz, errors::InvalidArgument(\"Expected \", a_nnz, \" and \", b_nnz, \" non-empty input values, got \", a_values.size(), \" and \", b_values.size())); OP_REQUIRES_OK(ctx, ctx->input(\"a_shape\", &a_shape)); OP_REQUIRES_OK(ctx, ctx->input(\"b_shape\", &b_shape)); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(a_shape->shape()) && TensorShapeUtils::IsVector(b_shape->shape()), errors::InvalidArgument( \"Input shapes should be a vector but received shapes \", a_shape->shape().DebugString(), \" and \", b_shape->shape().DebugString())); OP_REQUIRES( ctx, a_shape->IsSameSize(*b_shape), errors::InvalidArgument( \"Operands do not have the same ranks; got shapes: \", a_shape->SummarizeValue(10), \" and \", b_shape->SummarizeValue(10))); const auto a_shape_flat = a_shape->flat(); const auto b_shape_flat = b_shape->flat(); for (int i = 0; i < a_shape->NumElements(); ++i) { OP_REQUIRES(ctx, a_shape_flat(i) == b_shape_flat(i), errors::InvalidArgument( \"Operands' shapes do not match: got \", a_shape_flat(i), \" and \", b_shape_flat(i), \" for dimension \", i)); } OP_REQUIRES_OK(ctx, ctx->input(\"thresh\", &thresh_t)); OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(thresh_t->shape()), errors::InvalidArgument( \"The magnitude threshold must be a scalar: got shape \", thresh_t->shape().DebugString())); // std::abs() so that it works for complex{64,128} values as well const Treal thresh = thresh_t->scalar()(); // (1) do a pass over inputs, and append values and indices to vectors auto a_indices_mat = a_indices->matrix(); auto b_indices_mat = b_indices->matrix(); std::vector> entries_to_copy; // from_a?, idx entries_to_copy.reserve(a_nnz + b_nnz); std::vector out_values; const int num_dims = a_shape->dim_size(0); OP_REQUIRES(ctx, num_dims > 0, errors::InvalidArgument(\"Invalid input_a shape. Received: \", a_shape->DebugString())); // The input and output sparse tensors are assumed to be ordered along // increasing dimension number. int64 i = 0, j = 0; T s; while (i < a_nnz && j < b_nnz) { switch (sparse::DimComparator::cmp(a_indices_mat, b_indices_mat, i, j, num_dims)) { case -1: entries_to_copy.emplace_back(true, i); out_values.push_back(a_values(i)); ++i; break; case 0: s = a_values(i) + b_values(j); if (thresh <= std::abs(s)) { entries_to_copy.emplace_back(true, i); out_values.push_back(s); } ++i; ++j; break; case 1: entries_to_copy.emplace_back(false, j); out_values.push_back(b_values(j)); ++j; break; } } #define HANDLE_LEFTOVERS(A_OR_B, IDX, IS_A) \\ while (IDX < A_OR_B##_nnz) { \\ entries_to_copy.emplace_back(IS_A, IDX); \\ out_values.push_back(A_OR_B##_values(IDX)); \\ ++IDX; \\ } // at most one of these calls appends new values HANDLE_LEFTOVERS(a, i, true); HANDLE_LEFTOVERS(b, j, false); #undef HANDLE_LEFTOVERS // (2) allocate and fill output tensors const int64 sum_nnz = out_values.size(); Tensor *out_indices_t, *out_values_t; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({sum_nnz, num_dims}), &out_indices_t)); OP_REQUIRES_OK( ctx, ctx->allocate_output(1, TensorShape({sum_nnz}), &out_values_t)); auto out_indices_mat = out_indices_t->matrix(); auto out_values_flat = out_values_t->vec(); for (i = 0; i < sum_nnz; ++i) { const bool from_a = entries_to_copy[i].first; const int64 idx = entries_to_copy[i].second; out_indices_mat.chip<0>(i) = from_a ? a_indices_mat.chip<0>(idx) : b_indices_mat.chip<0>(idx); } if (sum_nnz > 0) { std::copy_n(out_values.begin(), sum_nnz, &out_values_flat(0)); } ctx->set_output(2, *a_shape); }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Write"], "explanation": "TensorFlow is an end-to-end open source platform for machine learning. Incomplete validation in `SparseAdd` results in allowing attackers to exploit undefined behavior (dereferencing null pointers) as well as write outside of bounds of heap allocated data. The implementation(https://github.com/tensorflow/tensorflow/blob/656e7673b14acd7835dc778867f84916c6d1cac2/tensorflow/core/kernels/sparse_add_op.cc) has a large set of validation for the two sparse tensor inputs (6 tensors in total), but does not validate that the tensors are not empty or that the second dimension of `*_indices` matches the size of corresponding `*_shape`. This allows attackers to send tensor triples that represent invalid sparse tensors to abuse code assumptions that are not protected by validation. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.", "severity_level": "NoInfo", "cwe": "CWE-787", "cve": "CVE-2021-29609"}} -{"idx": 429679, "input": "char *ma_send_connect_attr(MYSQL *mysql, unsigned char *buffer) { if (mysql->server_capabilities & CLIENT_CONNECT_ATTRS) { buffer= (unsigned char *)mysql_net_store_length((unsigned char *)buffer, (mysql->options.extension) ? mysql->options.extension->connect_attrs_len : 0); if (mysql->options.extension && hash_inited(&mysql->options.extension->connect_attrs)) { uint i; for (i=0; i < mysql->options.extension->connect_attrs.records; i++) { size_t len; uchar *p= hash_element(&mysql->options.extension->connect_attrs, i); len= strlen((char *)p); buffer= mysql_net_store_length(buffer, len); memcpy(buffer, p, len); buffer+= (len); p+= (len + 1); len= strlen((char *)p); buffer= mysql_net_store_length(buffer, len); memcpy(buffer, p, len); buffer+= len; } } } return (char *)buffer; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 412242, "input": "static void sg_timeout(struct timer_list *t) { struct sg_timeout *timeout = from_timer(timeout, t, timer); usb_sg_cancel(timeout->req); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 232090, "input": "static char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, int depth) { r_return_val_if_fail (core, NULL); if (depth < 1 || value == UT64_MAX) { return NULL; } RStrBuf *s = r_strbuf_new (NULL); char *mapname = NULL; RFlagItem *fi = r_flag_get_i (core->flags, value); ut64 type = r_core_anal_address (core, value); if (value && value != UT64_MAX) { RDebugMap *map = r_debug_map_get (core->dbg, value); if (map && map->name && map->name[0]) { mapname = strdup (map->name); } } if (mapname) { r_strbuf_appendf (s, \" (%s)\", mapname); R_FREE (mapname); } int bits = core->assembler->bits; switch (bits) { case 16: // umf, not in sync with pxr { st16 v = (st16)(value & UT16_MAX); st16 h = UT16_MAX / 0x100; if (v > -h && v < h) { r_strbuf_appendf (s,\" %hd\", v); } } break; case 32: { st32 v = (st32)(value & 0xffffffff); st32 h = UT32_MAX / 0x10000; if (v > -h && v < h) { r_strbuf_appendf (s,\" %d\", v); } } break; case 64: { st64 v = (st64)(value); st64 h = UT64_MAX / 0x1000000; if (v > -h && v < h) { r_strbuf_appendf (s,\" %\"PFMT64d, v); } } break; } RBinSection *sect = value? r_bin_get_section_at (r_bin_cur_object (core->bin), value, true): NULL; if(! ((type&R_ANAL_ADDR_TYPE_HEAP)||(type&R_ANAL_ADDR_TYPE_STACK)) ) { // Do not repeat \"stack\" or \"heap\" words unnecessarily. if (sect && sect->name[0]) { r_strbuf_appendf (s,\" (%s)\", sect->name); } } if (fi) { RRegItem *r = r_reg_get (core->dbg->reg, fi->name, -1); if (!r) { r_strbuf_appendf (s, \" %s\", fi->name); } } RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, value, 0); if (fcn) { r_strbuf_appendf (s, \" %s\", fcn->name); } if (type) { const char *c = r_core_anal_optype_colorfor (core, value, true); const char *cend = (c && *c) ? Color_RESET: \"\"; if (!c) { c = \"\"; } if (type & R_ANAL_ADDR_TYPE_HEAP) { r_strbuf_appendf (s, \" %sheap%s\", c, cend); } else if (type & R_ANAL_ADDR_TYPE_STACK) { r_strbuf_appendf (s, \" %sstack%s\", c, cend); } if (type & R_ANAL_ADDR_TYPE_PROGRAM) { r_strbuf_appendf (s, \" %sprogram%s\", c, cend); } if (type & R_ANAL_ADDR_TYPE_LIBRARY) { r_strbuf_appendf (s, \" %slibrary%s\", c, cend); } if (type & R_ANAL_ADDR_TYPE_ASCII) { r_strbuf_appendf (s, \" %sascii%s ('%c')\", c, cend, value); } if (type & R_ANAL_ADDR_TYPE_SEQUENCE) { r_strbuf_appendf (s, \" %ssequence%s\", c, cend); } if (type & R_ANAL_ADDR_TYPE_READ) { r_strbuf_appendf (s, \" %sR%s\", c, cend); } if (type & R_ANAL_ADDR_TYPE_WRITE) { r_strbuf_appendf (s, \" %sW%s\", c, cend); } if (type & R_ANAL_ADDR_TYPE_EXEC) { RAsmOp op; ut8 buf[32]; r_strbuf_appendf (s, \" %sX%s\", c, cend); /* instruction disassembly */ r_io_read_at (core->io, value, buf, sizeof (buf)); r_asm_set_pc (core->assembler, value); r_asm_disassemble (core->assembler, &op, buf, sizeof (buf)); r_strbuf_appendf (s, \" '%s'\", r_asm_op_get_asm (&op)); /* get library name */ { // NOTE: dup for mapname? RDebugMap *map; RListIter *iter; r_list_foreach (core->dbg->maps, iter, map) { if ((value >= map->addr) && (valueaddr_end)) { const char *lastslash = r_str_lchr (map->name, '/'); r_strbuf_appendf (s, \" '%s'\", lastslash? lastslash+1:map->name); break; } } } } else if (type & R_ANAL_ADDR_TYPE_READ) { ut8 buf[32]; ut32 *n32 = (ut32 *)buf; ut64 *n64 = (ut64*)buf; r_io_read_at (core->io, value, buf, sizeof (buf)); ut64 n = (core->assembler->bits == 64)? *n64: *n32; r_strbuf_appendf (s, \" 0x%\"PFMT64x, n); } } { ut8 buf[128], widebuf[256]; const char *c = r_config_get_i (core->config, \"scr.color\")? core->cons->context->pal.ai_ascii: \"\"; const char *cend = (c && *c) ? Color_RESET: \"\"; int len, r; if (r_io_read_at (core->io, value, buf, sizeof (buf))) { buf[sizeof (buf) - 1] = 0; switch (is_string (buf, sizeof(buf), &len)) { case 1: r_strbuf_appendf (s, \" (%s%s%s)\", c, buf, cend); break; case 2: r = r_utf8_encode_str ((const RRune *)buf, widebuf, sizeof (widebuf) - 1); if (r == -1) { eprintf (\"Something was wrong with refs\\n\"); } else { r_strbuf_appendf (s, \" (%s%s%s)\", c, widebuf, cend); } break; } } } if ((type & R_ANAL_ADDR_TYPE_READ) && !(type & R_ANAL_ADDR_TYPE_EXEC) && depth) { // Try to telescope further, but only several levels deep. ut8 buf[32]; ut32 *n32 = (ut32 *)buf; ut64 *n64 = (ut64*)buf; r_io_read_at (core->io, value, buf, sizeof (buf)); ut64 n = (core->assembler->bits == 64)? *n64: *n32; if(n != value) { char* rrstr = r_core_anal_hasrefs_to_depth (core, n, depth-1); if (rrstr) { if (rrstr[0]) { r_strbuf_appendf (s, \" --> %s\", rrstr); } free (rrstr); } } } free (mapname); return r_strbuf_drain (s); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 201415, "input": "static x3f_huffnode_t *new_node(x3f_hufftree_t *tree) { x3f_huffnode_t *t = &tree->nodes[tree->free_node_index]; t->branch[0] = NULL; t->branch[1] = NULL; t->leaf = UNDEFINED_LEAF; tree->free_node_index++; return t; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "In LibRaw, there is an out-of-bounds write vulnerability within the \"new_node()\" function (libraw\\src\\x3f\\x3f_utils_patched.cpp) that can be triggered via a crafted X3F file.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2020-35530"}} -{"idx": 232390, "input": "inline int32x2_t ComputeLerpx2( const qint32* top_left0, const qint32* top_right0, const qint32* bottom_left0, const qint32* bottom_right0, const qint32* top_left1, const qint32* top_right1, const qint32* bottom_left1, const qint32* bottom_right1, const int32* x_lerp, const int32x2_t y_lerpsx) { const int32x2_t x_lerpsx = X_LERP_SAME ? vld1_dup_s32(reinterpret_cast(x_lerp)) : vld1_s32(reinterpret_cast(x_lerp)); const int32x2_t top_leftsx = ToInt32x2(top_left0, top_left1); const int32x2_t top_rightsx = ToInt32x2(top_right0, top_right1); const int32x2_t bottom_leftsx = ToInt32x2(bottom_left0, bottom_left1); const int32x2_t bottom_rightsx = ToInt32x2(bottom_right0, bottom_right1); const int32x2_t retval = ComputeLerp32x2(top_leftsx, top_rightsx, bottom_leftsx, bottom_rightsx, x_lerpsx, y_lerpsx); return retval; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 258558, "input": "GF_Err stbl_GetSampleShadow(GF_ShadowSyncBox *stsh, u32 *sampleNumber, u32 *syncNum) { u32 i, count; GF_StshEntry *ent; if (stsh->r_LastFoundSample && (stsh->r_LastFoundSample <= *sampleNumber)) { i = stsh->r_LastEntryIndex; } else { i = 0; stsh->r_LastFoundSample = 1; } ent = NULL; (*syncNum) = 0; count = gf_list_count(stsh->entries); for (; ientries, i); //we get the exact desired sample ! if (ent->shadowedSampleNumber == *sampleNumber) { (*syncNum) = ent->syncSampleNumber; stsh->r_LastFoundSample = *sampleNumber; stsh->r_LastEntryIndex = i; return GF_OK; } else if (ent->shadowedSampleNumber > *sampleNumber) { //do we have an entry before ? If not, there is no shadowing available //for this sample if (!i) return GF_OK; //ok, indicate the previous ShadowedSample ent = (GF_StshEntry*)gf_list_get(stsh->entries, i-1); (*syncNum) = ent->syncSampleNumber; //change the sample number (*sampleNumber) = ent->shadowedSampleNumber; //reset the cache to the last ShadowedSample stsh->r_LastEntryIndex = i-1; stsh->r_LastFoundSample = ent->shadowedSampleNumber; } } stsh->r_LastEntryIndex = i-1; stsh->r_LastFoundSample = ent ? ent->shadowedSampleNumber : 0; return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 342148, "input": "static inline u64 fuse_get_attr_version(struct fuse_conn *fc) { return atomic64_read(&fc->attr_version); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 390690, "input": "static int xar_hash_check(int hash, const void * result, const void * expected) { int len; if (!result || !expected) return 1; switch (hash) { case XAR_CKSUM_SHA1: len = CLI_HASHLEN_SHA1; break; case XAR_CKSUM_MD5: len = CLI_HASHLEN_MD5; break; case XAR_CKSUM_OTHER: case XAR_CKSUM_NONE: default: return 1; } return memcmp(result, expected, len); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 267172, "input": "GF_Err gf_isom_update_sample_reference(GF_ISOFile *movie, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, u64 data_offset) { GF_Err e; GF_TrackBox *trak; e = CanAccessMovie(movie, GF_ISOM_OPEN_EDIT); if (e) return e; trak = gf_isom_get_track_from_file(movie, trackNumber); if (!trak) return GF_BAD_PARAM; //block for hint tracks if (trak->Media->handler->handlerType == GF_ISOM_MEDIA_HINT) return GF_BAD_PARAM; if (!sampleNumber || !sample) return GF_BAD_PARAM; e = unpack_track(trak); if (e) return e; //OD is not allowed as a data ref if (trak->Media->handler->handlerType == GF_ISOM_MEDIA_OD) { return GF_BAD_PARAM; } //OK, update it e = Media_UpdateSampleReference(trak->Media, sampleNumber, sample, data_offset); if (e) return e; if (!movie->keep_utc) trak->Media->mediaHeader->modificationTime = gf_isom_get_mp4time(); return GF_OK; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 269105, "input": "service_info *getServiceList(IXML_Node *node, service_info **end, char *URLBase) { IXML_Node *serviceList = NULL; IXML_Node *current_service = NULL; IXML_Node *UDN = NULL; IXML_Node *serviceType = NULL; IXML_Node *serviceId = NULL; IXML_Node *SCPDURL = NULL; IXML_Node *controlURL = NULL; IXML_Node *eventURL = NULL; DOMString tempDOMString = NULL; service_info *head = NULL; service_info *current = NULL; service_info *previous = NULL; IXML_NodeList *serviceNodeList = NULL; long unsigned int NumOfServices = 0lu; long unsigned int i = 0lu; int fail = 0; if (getSubElement(\"UDN\", node, &UDN) && getSubElement(\"serviceList\", node, &serviceList)) { serviceNodeList = ixmlElement_getElementsByTagName( (IXML_Element *)serviceList, \"service\"); if (serviceNodeList) { NumOfServices = ixmlNodeList_length(serviceNodeList); for (i = 0lu; i < NumOfServices; i++) { current_service = ixmlNodeList_item(serviceNodeList, i); fail = 0; if (current) { current->next = malloc(sizeof(service_info)); previous = current; current = current->next; } else { head = malloc(sizeof(service_info)); current = head; } if (!current) { freeServiceList(head); ixmlNodeList_free(serviceNodeList); return NULL; } current->next = NULL; current->controlURL = NULL; current->eventURL = NULL; current->serviceType = NULL; current->serviceId = NULL; current->SCPDURL = NULL; current->active = 1; current->subscriptionList = NULL; current->TotalSubscriptions = 0; if (!(current->UDN = getElementValue(UDN))) fail = 1; if (!getSubElement(\"serviceType\", current_service, &serviceType) || !(current->serviceType = getElementValue( serviceType))) fail = 1; if (!getSubElement(\"serviceId\", current_service, &serviceId) || !(current->serviceId = getElementValue( serviceId))) fail = 1; if (!getSubElement(\"SCPDURL\", current_service, &SCPDURL) || !(tempDOMString = getElementValue( SCPDURL)) || !(current->SCPDURL = resolve_rel_url( URLBase, tempDOMString))) fail = 1; ixmlFreeDOMString(tempDOMString); tempDOMString = NULL; if (!(getSubElement(\"controlURL\", current_service, &controlURL)) || !(tempDOMString = getElementValue( controlURL)) || !(current->controlURL = resolve_rel_url( URLBase, tempDOMString))) { UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \"BAD OR MISSING CONTROL URL\"); UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \"CONTROL URL SET TO NULL IN \" \"SERVICE INFO\"); current->controlURL = NULL; fail = 0; } ixmlFreeDOMString(tempDOMString); tempDOMString = NULL; if (!getSubElement(\"eventSubURL\", current_service, &eventURL) || !(tempDOMString = getElementValue( eventURL)) || !(current->eventURL = resolve_rel_url( URLBase, tempDOMString))) { UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \"BAD OR MISSING EVENT URL\"); UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \"EVENT URL SET TO NULL IN \" \"SERVICE INFO\"); current->eventURL = NULL; fail = 0; } ixmlFreeDOMString(tempDOMString); tempDOMString = NULL; if (fail) { freeServiceList(current); if (previous) previous->next = NULL; else head = NULL; current = previous; } } ixmlNodeList_free(serviceNodeList); } (*end) = current; return head; } else { (*end) = NULL; return NULL; } }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 205584, "input": "hivex_open (const char *filename, int flags) { hive_h *h = NULL; assert (sizeof (struct ntreg_header) == 0x1000); assert (offsetof (struct ntreg_header, csum) == 0x1fc); h = calloc (1, sizeof *h); if (h == NULL) goto error; h->msglvl = flags & HIVEX_OPEN_MSGLVL_MASK; const char *debug = getenv (\"HIVEX_DEBUG\"); if (debug && STREQ (debug, \"1\")) h->msglvl = 2; DEBUG (2, \"created handle %p\", h); h->writable = !!(flags & HIVEX_OPEN_WRITE); h->unsafe = !!(flags & HIVEX_OPEN_UNSAFE); h->filename = strdup (filename); if (h->filename == NULL) goto error; #ifdef O_CLOEXEC h->fd = open (filename, O_RDONLY | O_CLOEXEC | O_BINARY); #else h->fd = open (filename, O_RDONLY | O_BINARY); #endif if (h->fd == -1) goto error; #ifndef O_CLOEXEC fcntl (h->fd, F_SETFD, FD_CLOEXEC); #endif struct stat statbuf; if (fstat (h->fd, &statbuf) == -1) goto error; h->size = statbuf.st_size; if (h->size < 0x2000) { SET_ERRNO (EINVAL, \"%s: file is too small to be a Windows NT Registry hive file\", filename); goto error; } if (!h->writable) { h->addr = mmap (NULL, h->size, PROT_READ, MAP_SHARED, h->fd, 0); if (h->addr == MAP_FAILED) goto error; DEBUG (2, \"mapped file at %p\", h->addr); } else { h->addr = malloc (h->size); if (h->addr == NULL) goto error; if (full_read (h->fd, h->addr, h->size) < h->size) goto error; /* We don't need the file descriptor along this path, since we * have read all the data. */ if (close (h->fd) == -1) goto error; h->fd = -1; } /* Check header. */ if (h->hdr->magic[0] != 'r' || h->hdr->magic[1] != 'e' || h->hdr->magic[2] != 'g' || h->hdr->magic[3] != 'f') { SET_ERRNO (ENOTSUP, \"%s: not a Windows NT Registry hive file\", filename); goto error; } /* Check major version. */ uint32_t major_ver = le32toh (h->hdr->major_ver); if (major_ver != 1) { SET_ERRNO (ENOTSUP, \"%s: hive file major version %\" PRIu32 \" (expected 1)\", filename, major_ver); goto error; } h->bitmap = calloc (1 + h->size / 32, 1); if (h->bitmap == NULL) goto error; /* Header checksum. */ uint32_t sum = header_checksum (h); if (sum != le32toh (h->hdr->csum)) { SET_ERRNO (EINVAL, \"%s: bad checksum in hive header\", filename); goto error; } for (int t=0; ticonv_cache[t].mutex); h->iconv_cache[t].handle = NULL; } /* Last modified time. */ h->last_modified = le64toh ((int64_t) h->hdr->last_modified); if (h->msglvl >= 2) { char *name = _hivex_recode (h, utf16le_to_utf8, h->hdr->name, 64, NULL); fprintf (stderr, \"hivex_open: header fields:\\n\" \" file version %\" PRIu32 \".%\" PRIu32 \"\\n\" \" sequence nos %\" PRIu32 \" %\" PRIu32 \"\\n\" \" (sequences nos should match if hive was synched at shutdown)\\n\" \" last modified %\" PRIi64 \"\\n\" \" (Windows filetime, x 100 ns since 1601-01-01)\\n\" \" original file name %s\\n\" \" (only 32 chars are stored, name is probably truncated)\\n\" \" root offset 0x%x + 0x1000\\n\" \" end of last page 0x%x + 0x1000 (total file size 0x%zx)\\n\" \" checksum 0x%x (calculated 0x%x)\\n\", major_ver, le32toh (h->hdr->minor_ver), le32toh (h->hdr->sequence1), le32toh (h->hdr->sequence2), h->last_modified, name ? name : \"(conversion failed)\", le32toh (h->hdr->offset), le32toh (h->hdr->blocks), h->size, le32toh (h->hdr->csum), sum); free (name); } h->rootoffs = le32toh (h->hdr->offset) + 0x1000; h->endpages = le32toh (h->hdr->blocks) + 0x1000; DEBUG (2, \"root offset = 0x%zx\", h->rootoffs); /* We'll set this flag when we see a block with the root offset (ie. * the root block). */ int seen_root_block = 0, bad_root_block = 0; /* Collect some stats. */ size_t pages = 0; /* Number of hbin pages read. */ size_t smallest_page = SIZE_MAX, largest_page = 0; size_t blocks = 0; /* Total number of blocks found. */ size_t smallest_block = SIZE_MAX, largest_block = 0, blocks_bytes = 0; size_t used_blocks = 0; /* Total number of used blocks found. */ size_t used_size = 0; /* Total size (bytes) of used blocks. */ /* Read the pages and blocks. The aim here is to be robust against * corrupt or malicious registries. So we make sure the loops * always make forward progress. We add the address of each block * we read to a hash table so pointers will only reference the start * of valid blocks. */ size_t off; struct ntreg_hbin_page *page; for (off = 0x1000; off < h->size; off += le32toh (page->page_size)) { if (off >= h->endpages) break; page = (struct ntreg_hbin_page *) ((char *) h->addr + off); if (page->magic[0] != 'h' || page->magic[1] != 'b' || page->magic[2] != 'i' || page->magic[3] != 'n') { if (!h->unsafe) { SET_ERRNO (ENOTSUP, \"%s: trailing garbage at end of file \" \"(at 0x%zx, after %zu pages)\", filename, off, pages); goto error; } DEBUG (2, \"page not found at expected offset 0x%zx, \" \"seeking until one is found or EOF is reached\", off); int found = 0; while (off < h->size) { off += 0x1000; if (off >= h->endpages) break; page = (struct ntreg_hbin_page *) ((char *) h->addr + off); if (page->magic[0] == 'h' && page->magic[1] == 'b' && page->magic[2] == 'i' && page->magic[3] == 'n') { DEBUG (2, \"found next page by seeking at 0x%zx\", off); found = 1; break; } } if (!found) { DEBUG (2, \"page not found and end of pages section reached\"); break; } } size_t page_size = le32toh (page->page_size); DEBUG (2, \"page at 0x%zx, size %zu\", off, page_size); pages++; if (page_size < smallest_page) smallest_page = page_size; if (page_size > largest_page) largest_page = page_size; if (page_size <= sizeof (struct ntreg_hbin_page) || (page_size & 0x0fff) != 0) { SET_ERRNO (ENOTSUP, \"%s: page size %zu at 0x%zx, bad registry\", filename, page_size, off); goto error; } if (off + page_size > h->size) { SET_ERRNO (ENOTSUP, \"%s: page size %zu at 0x%zx extends beyond end of file, bad registry\", filename, page_size, off); goto error; } size_t page_offset = le32toh(page->offset_first) + 0x1000; if (page_offset != off) { SET_ERRNO (ENOTSUP, \"%s: declared page offset (0x%zx) does not match computed \" \"offset (0x%zx), bad registry\", filename, page_offset, off); goto error; } /* Read the blocks in this page. */ size_t blkoff; struct ntreg_hbin_block *block; size_t seg_len; for (blkoff = off + 0x20; blkoff < off + page_size; blkoff += seg_len) { blocks++; int is_root = blkoff == h->rootoffs; if (is_root) seen_root_block = 1; block = (struct ntreg_hbin_block *) ((char *) h->addr + blkoff); int used; seg_len = block_len (h, blkoff, &used); /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78665 */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored \"-Wstrict-overflow\" if (seg_len <= 4 || (seg_len & 3) != 0) { #pragma GCC diagnostic pop if (is_root || !h->unsafe) { SET_ERRNO (ENOTSUP, \"%s, the block at 0x%zx has invalid size %\" PRIu32 \", bad registry\", filename, blkoff, le32toh (block->seg_len)); goto error; } else { DEBUG (2, \"%s: block at 0x%zx has invalid size %\" PRIu32 \", skipping\", filename, blkoff, le32toh (block->seg_len)); break; } } if (h->msglvl >= 2) { unsigned char *id = (unsigned char *) block->id; int id0 = id[0], id1 = id[1]; fprintf (stderr, \"%s: %s: \" \"%s block id %d,%d (%c%c) at 0x%zx size %zu%s\\n\", \"hivex\", __func__, used ? \"used\" : \"free\", id0, id1, c_isprint (id0) ? id0 : '.', c_isprint (id1) ? id1 : '.', blkoff, seg_len, is_root ? \" (root)\" : \"\"); } blocks_bytes += seg_len; if (seg_len < smallest_block) smallest_block = seg_len; if (seg_len > largest_block) largest_block = seg_len; if (is_root && !used) bad_root_block = 1; if (used) { used_blocks++; used_size += seg_len; /* Root block must be an nk-block. */ if (is_root && (block->id[0] != 'n' || block->id[1] != 'k')) bad_root_block = 1; /* Note this blkoff is a valid address. */ BITMAP_SET (h->bitmap, blkoff); } } } if (!seen_root_block) { SET_ERRNO (ENOTSUP, \"%s: no root block found\", filename); goto error; } if (bad_root_block) { SET_ERRNO (ENOTSUP, \"%s: bad root block (free or not nk)\", filename); goto error; } DEBUG (1, \"successfully read Windows Registry hive file:\\n\" \" pages: %zu [sml: %zu, lge: %zu]\\n\" \" blocks: %zu [sml: %zu, avg: %zu, lge: %zu]\\n\" \" blocks used: %zu\\n\" \" bytes used: %zu\", pages, smallest_page, largest_page, blocks, smallest_block, blocks_bytes / blocks, largest_block, used_blocks, used_size); return h; error:; int err = errno; if (h) { free (h->bitmap); if (h->addr && h->size && h->addr != MAP_FAILED) { if (!h->writable) munmap (h->addr, h->size); else free (h->addr); } if (h->fd >= 0) close (h->fd); free (h->filename); free (h); } errno = err; return NULL; }", "output": {"is_vulnerable": "True", "vulnerability_types": ["Out-of-bounds Read"], "explanation": "A flaw was found in the hivex library in versions before 1.3.20. It is caused due to a lack of bounds check within the hivex_open function. An attacker could input a specially crafted Windows Registry (hive) file which would cause hivex to read memory beyond its normal bounds or cause the program to crash. The highest threat from this vulnerability is to system availability.", "severity_level": "NoInfo", "cwe": "CWE-125", "cve": "CVE-2021-3504"}} -{"idx": 481101, "input": "unsigned int xdr_expand_hole(struct xdr_stream *xdr, unsigned int offset, unsigned int length) { struct xdr_buf *buf = xdr->buf; unsigned int from, to, shift; xdr_realign_pages(xdr); from = xdr_page_pos(xdr); to = xdr_align_size(offset + length); /* Could the hole be behind us? */ if (to > from) { unsigned int buflen = buf->len - buf->head->iov_len; shift = to - from; xdr_buf_try_expand(buf, shift); xdr_buf_pages_shift_right(buf, from, buflen, shift); xdr_set_page(xdr, to, xdr_stream_remaining(xdr)); } else if (to != from) xdr_align_data(xdr, to, 0); xdr_buf_pages_zero(buf, offset, length); return length; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 481050, "input": "static __be32 *xdr_copy_to_scratch(struct xdr_stream *xdr, size_t nbytes) { __be32 *p; char *cpdest = xdr->scratch.iov_base; size_t cplen = (char *)xdr->end - (char *)xdr->p; if (nbytes > xdr->scratch.iov_len) goto out_overflow; p = __xdr_inline_decode(xdr, cplen); if (p == NULL) return NULL; memcpy(cpdest, p, cplen); if (!xdr_set_next_buffer(xdr)) goto out_overflow; cpdest += cplen; nbytes -= cplen; p = __xdr_inline_decode(xdr, nbytes); if (p == NULL) return NULL; memcpy(cpdest, p, nbytes); return xdr->scratch.iov_base; out_overflow: trace_rpc_xdr_overflow(xdr, nbytes); return NULL; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 223159, "input": "uint64 TensorProtoHash(const TensorProto& tp) { Tensor tensor(tp.dtype()); bool success = tensor.FromProto(tp); DCHECK(success); TensorProto p; tensor.AsProtoTensorContent(&p); return DeterministicProtoHash64(p); }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 413481, "input": "static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */ { char *error; off_t offset; phar_entry_info *link; if (FAILURE == phar_open_entry_fp(entry, &error, 1 TSRMLS_CC)) { if (error) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Cannot convert phar archive \\\"%s\\\", unable to open entry \\\"%s\\\" contents: %s\", entry->phar->fname, entry->filename, error); efree(error); } else { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Cannot convert phar archive \\\"%s\\\", unable to open entry \\\"%s\\\" contents\", entry->phar->fname, entry->filename); } return FAILURE; } /* copy old contents in entirety */ phar_seek_efp(entry, 0, SEEK_SET, 0, 1 TSRMLS_CC); offset = php_stream_tell(fp); link = phar_get_link_source(entry TSRMLS_CC); if (!link) { link = entry; } if (SUCCESS != phar_stream_copy_to_stream(phar_get_efp(link, 0 TSRMLS_CC), fp, link->uncompressed_filesize, NULL)) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, \"Cannot convert phar archive \\\"%s\\\", unable to copy entry \\\"%s\\\" contents\", entry->phar->fname, entry->filename); return FAILURE; } if (entry->fp_type == PHAR_MOD) { /* save for potential restore on error */ entry->cfp = entry->fp; entry->fp = NULL; } /* set new location of file contents */ entry->fp_type = PHAR_FP; entry->offset = offset; return SUCCESS; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 380798, "input": "static int vgacon_set_origin(struct vc_data *c) { if (vga_is_gfx || /* We don't play origin tricks in graphic modes */ (console_blanked && !vga_palette_blanked)) /* Nor we write to blanked screens */ return 0; c->vc_origin = c->vc_visible_origin = vga_vram_base; vga_set_mem_top(c); vga_rolled_over = 0; return 1; }", "output": {"is_vulnerable": "False", "vulnerability_types": "None", "explanation": "This function is not vulnerable.", "severity_level": "NotVulnerable", "cwe": "None", "cve": "None"}} -{"idx": 208547, "input": "HRESULT Http::HrReadHeaders() { HRESULT hr; std::string strBuffer; ULONG n = 0; std::map::iterator iHeader = mapHeaders.end(); ec_log_debug(\"Receiving headers:\"); do { hr = m_lpChannel->HrReadLine(strBuffer); if (hr != hrSuccess) return hr; if (strBuffer.empty()) break; if (n == 0) { m_strAction = strBuffer; } else { auto pos = strBuffer.find(':'); size_t start = 0; if (strBuffer[0] == ' ' || strBuffer[0] == '\\t') { if (iHeader == mapHeaders.end()) continue; // continue header while (strBuffer[start] == ' ' || strBuffer[start] == '\\t') ++start; iHeader->second += strBuffer.substr(start); } else { // new header auto r = mapHeaders.emplace(strBuffer.substr(0, pos), strBuffer.substr(pos + 2)); iHeader = r.first; } } if (strBuffer.find(\"Authorization\") != std::string::npos) ec_log_debug(\"< Authorization: