diff --git "a/validation.jsonl" "b/validation.jsonl" new file mode 100644--- /dev/null +++ "b/validation.jsonl" @@ -0,0 +1,6454 @@ +{"code": " it 'is valid with valid attributes' do\n notification = build(:notification)\n\n expect(notification).to be_valid\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def test_dump(self):\n node = ast.parse('spam(eggs, \"and cheese\")')\n self.assertEqual(ast.dump(node),\n \"Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), \"\n \"args=[Name(id='eggs', ctx=Load()), Constant(value='and cheese')], \"\n \"keywords=[]))])\"\n )\n self.assertEqual(ast.dump(node, annotate_fields=False),\n \"Module([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), \"\n \"Constant('and cheese')], []))])\"\n )\n self.assertEqual(ast.dump(node, include_attributes=True),\n \"Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), \"\n \"lineno=1, col_offset=0, end_lineno=1, end_col_offset=4), \"\n \"args=[Name(id='eggs', ctx=Load(), lineno=1, col_offset=5, \"\n \"end_lineno=1, end_col_offset=9), Constant(value='and cheese', \"\n \"lineno=1, col_offset=11, end_lineno=1, end_col_offset=23)], keywords=[], \"\n \"lineno=1, col_offset=0, end_lineno=1, end_col_offset=24), \"\n \"lineno=1, col_offset=0, end_lineno=1, end_col_offset=24)])\"\n )", "label": 0, "label_name": "vulnerable"} +{"code": " it { should contain_postgresql__server__config_entry('config_entry') }", "label": 0, "label_name": "vulnerable"} +{"code": " public function setFlashCookieObject($name, $object, $time = 60)\n {\n setcookie($name, json_encode($object, JSON_THROW_ON_ERROR), $this->getCookieOptions($time));\n\n return $this;\n }", "label": 1, "label_name": "safe"} +{"code": "void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_backtick)\n{\n const char *quote = \"`\\\"\\\\\";\n if (!quote_backtick)\n quote++;\n\n char *pt = dest;\n const char *s = src;\n\n *pt++ = '\"';\n /* save room for trailing quote-char */\n dlen -= 2;\n\n for (; *s && dlen; s++)\n {\n if (strchr(quote, *s))\n {\n dlen -= 2;\n if (dlen == 0)\n break;\n *pt++ = '\\\\';\n *pt++ = *s;\n }\n else\n {\n *pt++ = *s;\n dlen--;\n }\n }\n *pt++ = '\"';\n *pt = '\\0';\n}", "label": 1, "label_name": "safe"} +{"code": "function Session(client, info, localChan) {\n this.subtype = undefined;\n\n var ending = false;\n var self = this;\n var outgoingId = info.sender;\n var channel;\n\n var chaninfo = {\n type: 'session',\n incoming: {\n id: localChan,\n window: Channel.MAX_WINDOW,\n packetSize: Channel.PACKET_SIZE,\n state: 'open'\n },\n outgoing: {\n id: info.sender,\n window: info.window,\n packetSize: info.packetSize,\n state: 'open'\n }\n };\n\n function onREQUEST(info) {\n var replied = false;\n var accept;\n var reject;\n\n if (info.wantReply) {\n // \"real session\" requests will have custom accept behaviors\n if (info.request !== 'shell'\n && info.request !== 'exec'\n && info.request !== 'subsystem') {\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n return client._sshstream.channelSuccess(outgoingId);\n };\n }\n\n reject = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n return client._sshstream.channelFailure(outgoingId);\n };\n }\n\n if (ending) {\n reject && reject();\n return;\n }\n\n switch (info.request) {\n // \"pre-real session start\" requests\n case 'env':\n if (listenerCount(self, 'env')) {\n self.emit('env', accept, reject, {\n key: info.key,\n val: info.val\n });\n } else\n reject && reject();\n break;\n case 'pty-req':\n if (listenerCount(self, 'pty')) {\n self.emit('pty', accept, reject, {\n cols: info.cols,\n rows: info.rows,\n width: info.width,\n height: info.height,\n term: info.term,\n modes: info.modes,\n });\n } else\n reject && reject();\n break;\n case 'window-change':\n if (listenerCount(self, 'window-change')) {\n self.emit('window-change', accept, reject, {\n cols: info.cols,\n rows: info.rows,\n width: info.width,\n height: info.height\n });\n } else\n reject && reject();\n break;\n case 'x11-req':\n if (listenerCount(self, 'x11')) {\n self.emit('x11', accept, reject, {\n single: info.single,\n protocol: info.protocol,\n cookie: info.cookie,\n screen: info.screen\n });\n } else\n reject && reject();\n break;\n // \"post-real session start\" requests\n case 'signal':\n if (listenerCount(self, 'signal')) {\n self.emit('signal', accept, reject, {\n name: info.signal\n });\n } else\n reject && reject();\n break;\n // XXX: is `auth-agent-req@openssh.com` really \"post-real session start\"?\n case 'auth-agent-req@openssh.com':\n if (listenerCount(self, 'auth-agent'))\n self.emit('auth-agent', accept, reject);\n else\n reject && reject();\n break;\n // \"real session start\" requests\n case 'shell':\n if (listenerCount(self, 'shell')) {\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n if (info.wantReply)\n client._sshstream.channelSuccess(outgoingId);\n\n channel = new Channel(chaninfo, client, { server: true });\n\n channel.subtype = self.subtype = info.request;\n\n return channel;\n };\n\n self.emit('shell', accept, reject);\n } else\n reject && reject();\n break;\n case 'exec':\n if (listenerCount(self, 'exec')) {\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n if (info.wantReply)\n client._sshstream.channelSuccess(outgoingId);\n\n channel = new Channel(chaninfo, client, { server: true });\n\n channel.subtype = self.subtype = info.request;\n\n return channel;\n };\n\n self.emit('exec', accept, reject, {\n command: info.command\n });\n } else\n reject && reject();\n break;\n case 'subsystem':\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n if (info.wantReply)\n client._sshstream.channelSuccess(outgoingId);\n\n channel = new Channel(chaninfo, client, { server: true });\n\n channel.subtype = self.subtype = (info.request + ':' + info.subsystem);\n\n if (info.subsystem === 'sftp') {\n var sftp = new SFTPStream({\n server: true,\n debug: client._sshstream.debug\n });\n channel.pipe(sftp).pipe(channel);\n\n return sftp;\n } else\n return channel;\n };\n\n if (info.subsystem === 'sftp' && listenerCount(self, 'sftp'))\n self.emit('sftp', accept, reject);\n else if (info.subsystem !== 'sftp' && listenerCount(self, 'subsystem')) {\n self.emit('subsystem', accept, reject, {\n name: info.subsystem\n });\n } else\n reject && reject();\n break;\n default:\n reject && reject();\n }\n }\n function onEOF() {\n ending = true;\n self.emit('eof');\n self.emit('end');\n }\n function onCLOSE() {\n ending = true;\n self.emit('close');\n }\n client._sshstream\n .on('CHANNEL_REQUEST:' + localChan, onREQUEST)\n .once('CHANNEL_EOF:' + localChan, onEOF)\n .once('CHANNEL_CLOSE:' + localChan, onCLOSE);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)\n{\n\tstruct kvm_pit *pit = vcpu->kvm->arch.vpit;\n\tstruct hrtimer *timer;\n\n\tif (!kvm_vcpu_is_bsp(vcpu) || !pit)\n\t\treturn;\n\n\ttimer = &pit->pit_state.timer;\n\tmutex_lock(&pit->pit_state.lock);\n\tif (hrtimer_cancel(timer))\n\t\thrtimer_start_expires(timer, HRTIMER_MODE_ABS);\n\tmutex_unlock(&pit->pit_state.lock);\n}", "label": 1, "label_name": "safe"} +{"code": " public function splice($t, $delete, $replacement) {\n // delete\n $old = array();\n $r = $t;\n for ($i = $delete; $i > 0; $i--) {\n $old[] = $r;\n $r = $this->delete();\n }\n // insert\n for ($i = count($replacement)-1; $i >= 0; $i--) {\n $this->insertAfter($r);\n $r = $replacement[$i];\n }\n return array($old, $r);\n }", "label": 1, "label_name": "safe"} +{"code": "null);z.apply(this,arguments)};var L=EditorUi.prototype.setGraphEnabled;EditorUi.prototype.setGraphEnabled=function(B){L.apply(this,arguments);if(B){var F=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;1E3<=F&&null!=this.sidebarWindow&&\"1\"!=urlParams.sketch&&this.sidebarWindow.window.setVisible(!0);null!=this.formatWindow&&(1E3<=F||\"1\"==urlParams.sketch)&&this.formatWindow.window.setVisible(!0)}else null!=this.sidebarWindow&&this.sidebarWindow.window.setVisible(!1),\nnull!=this.formatWindow&&this.formatWindow.window.setVisible(!1)};EditorUi.prototype.chromelessWindowResize=function(){};var M=DiagramFormatPanel.prototype.addView;DiagramFormatPanel.prototype.addView=function(B){B=M.apply(this,arguments);var F=this.editorUi,G=F.editor.graph;if(G.isEnabled()&&\"1\"==urlParams.sketch){var N=this.createOption(mxResources.get(\"sketch\"),function(){return Editor.sketchMode},function(J,E){F.setSketchMode(!Editor.sketchMode);null!=E&&mxEvent.isShiftDown(E)||G.updateCellStyles({sketch:J?", "label": 1, "label_name": "safe"} +{"code": " public function next($t) {\n if ($t !== NULL) array_push($this->front, $t);\n return empty($this->back) ? NULL : array_pop($this->back);\n }", "label": 1, "label_name": "safe"} +{"code": " protected function getDeprecatedServiceService()\n {\n @trigger_error('The \"deprecated_service\" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);\n\n return $this->services['deprecated_service'] = new \\stdClass();\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testSendSuccess()\n {\n $this->setMockHttpResponse('DeleteCustomerSuccess.txt');\n $response = $this->request->send();\n\n $this->assertTrue($response->isSuccessful());\n $this->assertFalse($response->isRedirect());\n $this->assertNull($response->getTransactionReference());\n $this->assertNull($response->getCustomerReference());\n $this->assertNull($response->getMessage());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)\n{\n\tstruct file *file = iocb->ki_filp;\n\tstruct inode *inode = file->f_mapping->host;\n\tstruct ocfs2_super *osb = OCFS2_SB(inode->i_sb);\n\tget_block_t *get_block;\n\n\t/*\n\t * Fallback to buffered I/O if we see an inode without\n\t * extents.\n\t */\n\tif (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)\n\t\treturn 0;\n\n\t/* Fallback to buffered I/O if we do not support append dio. */\n\tif (iocb->ki_pos + iter->count > i_size_read(inode) &&\n\t !ocfs2_supports_append_dio(osb))\n\t\treturn 0;\n\n\tif (iov_iter_rw(iter) == READ)\n\t\tget_block = ocfs2_lock_get_block;\n\telse\n\t\tget_block = ocfs2_dio_wr_get_block;\n\n\treturn __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,\n\t\t\t\t iter, get_block,\n\t\t\t\t ocfs2_dio_end_io, NULL, 0);\n}", "label": 1, "label_name": "safe"} +{"code": "function AJchangeUserGroupPrivs() {\n\tglobal $user;\n\t$node = processInputVar(\"activeNode\", ARG_NUMERIC);\n\tif(! checkUserHasPriv(\"userGrant\", $user[\"id\"], $node)) {\n\t\t$text = \"You do not have rights to modify user privileges at this node.\";\n\t\tprint \"alert('$text');\";\n\t\treturn;\n\t}\n\t$newusergrpid = processInputVar(\"item\", ARG_NUMERIC);\n\t$newusergrp = getUserGroupName($newusergrpid);\n\t$newpriv = processInputVar('priv', ARG_STRING);\n\t$newprivval = processInputVar('value', ARG_STRING);\n\t//print \"alert('node: $node; newuser:grp $newuser;grp newpriv: $newpriv; newprivval: $newprivval');\";\n\n\t# get cascade privs at this node\n\t$cascadePrivs = getNodeCascadePrivileges($node, \"usergroups\");\n\n\t// if $newprivval is true and $newusergrp already has $newpriv\n\t// cascaded to it, do nothing\n\tif($newprivval == 'true') {\n\t\tif(array_key_exists($newusergrp, $cascadePrivs['usergroups']) &&\n\t\t in_array($newpriv, $cascadePrivs['usergroups'][$newusergrp]['privs']))\n\t\t\treturn;\n\t\t// add priv\n\t\t$adds = array($newpriv);\n\t\t$removes = array();\n\t}\n\telse {\n\t\t// remove priv\n\t\t$adds = array();\n\t\t$removes = array($newpriv);\n\t}\n\tupdateUserOrGroupPrivs($newusergrpid, $node, $adds, $removes, \"group\");\n\t$_SESSION['dirtyprivs'] = 1;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getTrackingId()\n { \n if(isset($this->ectid)) return $this->ectid;\n else return '';\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private void updateSecureSessionFlag() {\n try {\n ServletContext context = Jenkins.getInstance().servletContext;\n Method m;\n try {\n m = context.getClass().getMethod(\"getSessionCookieConfig\");\n } catch (NoSuchMethodException x) { // 3.0+\n LOGGER.log(Level.FINE, \"Failed to set secure cookie flag\", x);\n return;\n }\n Object sessionCookieConfig = m.invoke(context);\n\n Class scc = Class.forName(\"javax.servlet.SessionCookieConfig\");\n Method setSecure = scc.getMethod(\"setSecure\", boolean.class);\n boolean v = fixNull(jenkinsUrl).startsWith(\"https\");\n setSecure.invoke(sessionCookieConfig, v);\n } catch (InvocationTargetException e) {\n if (e.getTargetException() instanceof IllegalStateException) {\n // servlet 3.0 spec seems to prohibit this from getting set at runtime,\n // though Winstone is happy to accept i. see JENKINS-25019\n return;\n }\n LOGGER.log(Level.WARNING, \"Failed to set secure cookie flag\", e);\n } catch (Exception e) {\n LOGGER.log(Level.WARNING, \"Failed to set secure cookie flag\", e);\n }\n }", "label": 1, "label_name": "safe"} +{"code": " def format_type(self):\n format_type = self.type.lower()\n if format_type == 'amazon':\n return u\"Amazon\"\n elif format_type.startswith(\"amazon_\"):\n return u\"Amazon.{0}\".format(format_type[7:])\n elif format_type == \"isbn\":\n return u\"ISBN\"\n elif format_type == \"doi\":\n return u\"DOI\"\n elif format_type == \"douban\":\n return u\"Douban\"\n elif format_type == \"goodreads\":\n return u\"Goodreads\"\n elif format_type == \"babelio\":\n return u\"Babelio\"\n elif format_type == \"google\":\n return u\"Google Books\"\n elif format_type == \"kobo\":\n return u\"Kobo\"\n elif format_type == \"litres\":\n return u\"\u041b\u0438\u0442\u0420\u0435\u0441\"\n elif format_type == \"issn\":\n return u\"ISSN\"\n elif format_type == \"isfdb\":\n return u\"ISFDB\"\n if format_type == \"lubimyczytac\":\n return u\"Lubimyczytac\"\n else:\n return self.type", "label": 1, "label_name": "safe"} +{"code": "chrand_principal3_2_svc(chrand3_arg *arg, struct svc_req *rqstp)\n{\n static chrand_ret ret;\n krb5_keyblock *k;\n int nkeys;\n char *prime_arg, *funcname;\n gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER;\n gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_chrand_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n funcname = \"kadm5_randkey_principal\";\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) {\n ret.code = randkey_principal_wrapper_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n &k, &nkeys);\n } else if (!(CHANGEPW_SERVICE(rqstp)) &&\n kadm5int_acl_check(handle->context, rqst2name(rqstp),\n ACL_CHANGEPW, arg->princ, NULL)) {\n ret.code = kadm5_randkey_principal_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n &k, &nkeys);\n } else {\n log_unauth(funcname, prime_arg,\n &client_name, &service_name, rqstp);\n ret.code = KADM5_AUTH_CHANGEPW;\n }\n\n if(ret.code == KADM5_OK) {\n ret.keys = k;\n ret.n_keys = nkeys;\n }\n\n if(ret.code != KADM5_AUTH_CHANGEPW) {\n if( ret.code != 0 )\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(funcname, prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n free(prime_arg);\nexit_func:\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n free_server_handle(handle);\n return &ret;\n}", "label": 1, "label_name": "safe"} +{"code": " def _deny_hook(self, resource=None):\n app = self.get_app()\n if current_user.is_authenticated:\n status = 403\n else:\n status = 401\n #abort(status)\n\n if app.config.get('FRONTED_BY_NGINX'):\n url = \"https://{}:{}{}\".format(app.config.get('FQDN'), app.config.get('NGINX_PORT'), '/login')\n else:\n url = \"http://{}:{}{}\".format(app.config.get('FQDN'), app.config.get('API_PORT'), '/login')\n if current_user.is_authenticated:\n auth_dict = {\n \"authenticated\": True,\n \"user\": current_user.email,\n \"roles\": current_user.role,\n }\n else:\n auth_dict = {\n \"authenticated\": False,\n \"user\": None,\n \"url\": url\n }\n\n return Response(response=json.dumps({\"auth\": auth_dict}), status=status, mimetype=\"application/json\")", "label": 1, "label_name": "safe"} +{"code": "struct ipv6_txoptions *ipv6_update_options(struct sock *sk,\n\t\t\t\t\t struct ipv6_txoptions *opt)\n{\n\tif (inet_sk(sk)->is_icsk) {\n\t\tif (opt &&\n\t\t !((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) &&\n\t\t inet_sk(sk)->inet_daddr != LOOPBACK4_IPV6) {\n\t\t\tstruct inet_connection_sock *icsk = inet_csk(sk);\n\t\t\ticsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen;\n\t\t\ticsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie);\n\t\t}\n\t}\n\topt = xchg(&inet6_sk(sk)->opt, opt);\n\tsk_dst_reset(sk);\n\n\treturn opt;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " $scope.reset = function() {\n bootbox.confirm('Are you sure you want to reset the foreign source definition to the default ?', function(ok) {\n if (ok) {\n RequisitionsService.startTiming();\n RequisitionsService.deleteForeignSourceDefinition($scope.foreignSource).then(\n function() { // success\n growl.success('The foreign source definition for ' + _.escape($scope.foreignSource) + 'has been reseted.');\n $scope.initialize();\n },\n $scope.errorHandler\n );\n }\n });\n };", "label": 1, "label_name": "safe"} +{"code": "mxTooltipHandler.prototype.reset=function(a,b,c){if(!this.ignoreTouchEvents||mxEvent.isMouseEvent(a.getEvent()))if(this.resetTimer(),c=null!=c?c:this.getStateForEvent(a),b&&this.isEnabled()&&null!=c&&(null==this.div||\"hidden\"==this.div.style.visibility)){var d=a.getSource(),e=a.getX(),f=a.getY(),g=a.isSource(c.shape)||a.isSource(c.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.popupMenuHandler.isMenuShowing()&&!this.graph.isMouseDown){var k=\nthis.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerHTML=\"\")};", "label": 0, "label_name": "vulnerable"} +{"code": "DECLAREreadFunc(readContigTilesIntoBuffer)\n{\n\tint status = 1;\n\ttsize_t tilesize = TIFFTileSize(in);\n\ttdata_t tilebuf;\n\tuint32 imagew = TIFFScanlineSize(in);\n\tuint32 tilew = TIFFTileRowSize(in);\n\tint64 iskew = (int64)imagew - (int64)tilew;\n\tuint8* bufp = (uint8*) buf;\n\tuint32 tw, tl;\n\tuint32 row;\n\n\t(void) spp;\n\ttilebuf = _TIFFmalloc(tilesize);\n\tif (tilebuf == 0)\n\t\treturn 0;\n\t_TIFFmemset(tilebuf, 0, tilesize);\n\t(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n \n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth && colb < imagew; col += tw) {\n\t\t\tif (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0\n\t\t\t && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t \"Error, can't read tile at %lu %lu\",\n\t\t\t\t (unsigned long) col,\n\t\t\t\t (unsigned long) row);\n\t\t\t\tstatus = 0;\n\t\t\t\tgoto done;\n\t\t\t}\n\t\t\tif (colb > iskew) {\n\t\t\t\tuint32 width = imagew - colb;\n\t\t\t\tuint32 oskew = tilew - width;\n\t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, width,\n\t\t\t\t oskew + iskew, oskew );\n\t\t\t} else\n\t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, tilew,\n\t\t\t\t iskew, 0);\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += imagew * nrow;\n\t}\ndone:\n\t_TIFFfree(tilebuf);\n\treturn status;\n}", "label": 1, "label_name": "safe"} +{"code": "-1;d=b.parent?b.getIndex():-1}return c>d?1:-1})},param:function(a){a.children=[];a.isEmpty=true;return a},span:function(a){a.attributes[\"class\"]==\"Apple-style-span\"&&delete a.name},html:function(a){delete a.attributes.contenteditable;delete a.attributes[\"class\"]},body:function(a){delete a.attributes.spellcheck;delete a.attributes.contenteditable},style:function(a){var b=a.children[0];if(b&&b.value)b.value=CKEDITOR.tools.trim(b.value);if(!a.attributes.type)a.attributes.type=\"text/css\"},title:function(a){var b=", "label": 1, "label_name": "safe"} +{"code": " free() {\n this._dead = true;\n }", "label": 1, "label_name": "safe"} +{"code": "this.customFonts)))}finally{U.getModel().endUpdate()}}}));this.editorUi.showDialog(W.container,380,Editor.enableWebFonts?250:180,!0,!0);W.init()}),y,null,!0)})))}})();function DiagramPage(b,f){this.node=b;null!=f?this.node.setAttribute(\"id\",f):null==this.getId()&&this.node.setAttribute(\"id\",Editor.guid())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute(\"id\")};DiagramPage.prototype.getName=function(){return this.node.getAttribute(\"name\")};", "label": 0, "label_name": "vulnerable"} +{"code": " public static function tearDownAfterClass()\n {\n @unlink(self::$cacheFile);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function getResourceGroupID($groupdname) {\n\tlist($type, $name) = explode('/', $groupdname);\n\t$query = \"SELECT g.id \"\n\t . \"FROM resourcegroup g, \"\n\t . \"resourcetype t \"\n\t . \"WHERE g.name = '$name' AND \"\n\t . \"t.name = '$type' AND \"\n\t . \"g.resourcetypeid = t.id\";\n\t$qh = doQuery($query, 371);\n\tif($row = mysql_fetch_row($qh))\n\t\treturn $row[0];\n\telse\n\t\treturn NULL;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public void translate(ServerEntityTeleportPacket packet, GeyserSession session) {\n Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());\n if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {\n entity = session.getPlayerEntity();\n }\n if (entity == null) return;\n\n entity.teleport(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), packet.isOnGround());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "def remove_acl_remote(params, request, session)\n if not allowed_for_local_cluster(session, Permissions::GRANT)\n return 403, 'Permission denied'\n end\n if params[\"item\"] == \"permission\"\n retval = remove_acl_permission(session, params[\"acl_perm_id\"])\n elsif params[\"item\"] == \"usergroup\"\n retval = remove_acl_usergroup(\n session, params[\"role_id\"],params[\"usergroup_id\"]\n )\n else\n retval = \"Error: Unknown removal request\"\n end\n\n if retval == \"\"\n return [200, \"Successfully removed permission from role\"]\n else\n return [400, retval]\n end\nend", "label": 0, "label_name": "vulnerable"} +{"code": " public static function sanitizeGetParams () {\n //sanitize get params\n $whitelist = array(\n 'fg', 'bgc', 'font', 'bs', 'bc', 'iframeHeight'\n );\n $_GET = array_intersect_key($_GET, array_flip($whitelist));\n //restrict param values, alphanumeric, # for color vals, comma for tag list, . for decimals\n $_GET = preg_replace('/[^a-zA-Z0-9#,.]/', '', $_GET);\n return $_GET;\n }", "label": 1, "label_name": "safe"} +{"code": " public function loadFiles($dir, $name, $method) {\n return parent::loadFiles($dir, $name, $method);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static void hugepage_subpool_put_pages(struct hugepage_subpool *spool,\n\t\t\t\t long delta)\n{\n\tif (!spool)\n\t\treturn;\n\n\tspin_lock(&spool->lock);\n\tspool->used_hpages -= delta;\n\t/* If hugetlbfs_put_super couldn't free spool due to\n\t* an outstanding quota reference, free it now. */\n\tunlock_or_release_subpool(spool);\n}", "label": 1, "label_name": "safe"} +{"code": "f.appendChild(e);this.container=f},NewDialog=function(b,f,l,d,u,t,D,c,e,g,k,m,q,v,x,A,z,L){function M(pa){null!=pa&&(Fa=xa=pa?135:140);pa=!0;if(null!=Ma)for(;H {\n if (err) {\n cb(err);\n return;\n }\n\n reqSubsystem(chan, name, (err, stream) => {\n if (err) {\n cb(err);\n return;\n }\n\n cb(undefined, stream);\n });\n });\n\n return this;\n }", "label": 1, "label_name": "safe"} +{"code": "c,b){var e=function(h,f,l){var p=function(n){n&&(this.res=n)};p.prototype=h;p.prototype.constructor=p;h=new p(l);for(var k in f||{})l=f[k],h[k]=l.slice?l.slice():l;return h},g={res:e(c.res,b.res)};g.formatter=e(c.formatter,b.formatter,g.res);g.parser=e(c.parser,b.parser,g.res);t[a]=g};d.compile=function(a){for(var c=/\\[([^\\[\\]]*|\\[[^\\[\\]]*\\])*\\]|([A-Za-z])\\2+|\\.{3}|./g,b,e=[a];b=c.exec(a);)e[e.length]=b[0];return e};d.format=function(a,c,b){c=\"string\"===typeof c?d.compile(c):c;a=d.addMinutes(a,b?\na.getTimezoneOffset():0);var e=t[m].formatter,g=\"\";a.utc=b||!1;b=1;for(var h=c.length,f;bencodepfunc != NULL);\n\tassert(sp->encodetile != NULL);\n\n /* \n * Do predictor manipulation in a working buffer to avoid altering\n * the callers buffer. http://trac.osgeo.org/gdal/ticket/1965\n */\n working_copy = (uint8*) _TIFFmalloc(cc0);\n if( working_copy == NULL )\n {\n TIFFErrorExt(tif->tif_clientdata, module, \n \"Out of memory allocating \" TIFF_SSIZE_FORMAT \" byte temp buffer.\",\n cc0 );\n return 0;\n }\n memcpy( working_copy, bp0, cc0 );\n bp = working_copy;\n\n\trowsize = sp->rowsize;\n\tassert(rowsize > 0);\n\tif((cc0%rowsize)!=0)\n {\n TIFFErrorExt(tif->tif_clientdata, \"PredictorEncodeTile\",\n \"%s\", \"(cc0%rowsize)!=0\");\n _TIFFfree( working_copy );\n return 0;\n }\n\twhile (cc > 0) {\n\t\t(*sp->encodepfunc)(tif, bp, rowsize);\n\t\tcc -= rowsize;\n\t\tbp += rowsize;\n\t}\n\tresult_code = (*sp->encodetile)(tif, working_copy, cc0, s);\n\n _TIFFfree( working_copy );\n\n return result_code;\n}", "label": 1, "label_name": "safe"} +{"code": "size_t TLSInStream::overrun(size_t itemSize, size_t nItems, bool wait)\n{\n if (itemSize > bufSize)\n throw Exception(\"TLSInStream overrun: max itemSize exceeded\");\n\n if (end - ptr != 0)\n memmove(start, ptr, end - ptr);\n\n offset += ptr - start;\n end -= ptr - start;\n ptr = start;\n\n while (end < start + itemSize) {\n size_t n = readTLS((U8*) end, start + bufSize - end, wait);\n if (!wait && n == 0)\n return 0;\n end += n;\n }\n\n if (itemSize * nItems > (size_t)(end - ptr))\n nItems = (end - ptr) / itemSize;\n\n return nItems;\n}", "label": 1, "label_name": "safe"} +{"code": " it 'squeezes strings' do\n pp = <<-EOS\n $a = \"wallless laparohysterosalpingooophorectomy brrr goddessship\"\n $o = squeeze($a)\n notice(inline_template('squeeze is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/squeeze is \"wales laparohysterosalpingophorectomy br godeship\"/)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "func canonicalMIMEHeaderKey(a []byte) string {\n\tupper := true\n\tfor i, c := range a {\n\t\t// Canonicalize: first letter upper case\n\t\t// and upper case after each dash.\n\t\t// (Host, User-Agent, If-Modified-Since).\n\t\t// MIME headers are ASCII only, so no Unicode issues.\n\t\tif c == ' ' {\n\t\t\tc = '-'\n\t\t} else if upper && 'a' <= c && c <= 'z' {\n\t\t\tc -= toLower\n\t\t} else if !upper && 'A' <= c && c <= 'Z' {\n\t\t\tc += toLower\n\t\t}\n\t\ta[i] = c\n\t\tupper = c == '-' // for next time\n\t}\n\t// The compiler recognizes m[string(byteSlice)] as a special\n\t// case, so a copy of a's bytes into a new string does not\n\t// happen in this map lookup:\n\tif v := commonHeader[string(a)]; v != \"\" {\n\t\treturn v\n\t}\n\treturn string(a)\n}", "label": 0, "label_name": "vulnerable"} +{"code": "c.executeLayoutList(L);c.customLayoutConfig=L}catch(C){c.handleError(C),null!=window.console&&console.error(C)}},null,null,null,null,null,!0,null,null,\"https://www.diagrams.net/doc/faq/apply-layouts\");c.showDialog(t.container,620,460,!0,!0);t.init()});l=this.get(\"layout\");var y=l.funct;l.funct=function(t,z){y.apply(this,arguments);t.addItem(mxResources.get(\"orgChart\"),null,function(){function L(){\"undefined\"!==typeof mxOrgChartLayout||c.loadingOrgChart||c.isOffline(!0)?K():c.spinner.spin(document.body,\nmxResources.get(\"loading\"))&&(c.loadingOrgChart=!0,\"1\"==urlParams.dev?mxscript(\"js/orgchart/bridge.min.js\",function(){mxscript(\"js/orgchart/bridge.collections.min.js\",function(){mxscript(\"js/orgchart/OrgChart.Layout.min.js\",function(){mxscript(\"js/orgchart/mxOrgChartLayout.js\",K)})})}):mxscript(\"js/extensions.min.js\",K))}var C=null,D=20,G=20,P=!0,K=function(){c.loadingOrgChart=!1;c.spinner.stop();if(\"undefined\"!==typeof mxOrgChartLayout&&null!=C&&P){var X=c.editor.graph,u=new mxOrgChartLayout(X,C,", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tprivate byte[] ReadClientHelloV2 (Stream record)\n\t\t{\n\t\t\tint msgLength = record.ReadByte ();\n\t\t\t// process further only if the whole record is available\n\t\t\tif (record.CanSeek && (msgLength + 1 > record.Length)) \n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tbyte[] message = new byte[msgLength];\n\t\t\trecord.Read (message, 0, msgLength);\n\n\t\t\tint msgType\t\t= message [0];\n\t\t\tif (msgType != 1)\n\t\t\t{\n\t\t\t\tthrow new TlsException(AlertDescription.DecodeError);\n\t\t\t}\n\t\t\tint protocol = (message [1] << 8 | message [2]);\n\t\t\tint cipherSpecLength = (message [3] << 8 | message [4]);\n\t\t\tint sessionIdLength = (message [5] << 8 | message [6]);\n\t\t\tint challengeLength = (message [7] << 8 | message [8]);\n\t\t\tint length = (challengeLength > 32) ? 32 : challengeLength;\n\n\t\t\t// Read CipherSpecs\n\t\t\tbyte[] cipherSpecV2 = new byte[cipherSpecLength];\n\t\t\tBuffer.BlockCopy (message, 9, cipherSpecV2, 0, cipherSpecLength);\n\n\t\t\t// Read session ID\n\t\t\tbyte[] sessionId = new byte[sessionIdLength];\n\t\t\tBuffer.BlockCopy (message, 9 + cipherSpecLength, sessionId, 0, sessionIdLength);\n\n\t\t\t// Read challenge ID\n\t\t\tbyte[] challenge = new byte[challengeLength];\n\t\t\tBuffer.BlockCopy (message, 9 + cipherSpecLength + sessionIdLength, challenge, 0, challengeLength);\n\t\t\n\t\t\tif (challengeLength < 16 || cipherSpecLength == 0 || (cipherSpecLength % 3) != 0)\n\t\t\t{\n\t\t\t\tthrow new TlsException(AlertDescription.DecodeError);\n\t\t\t}\n\n\t\t\t// Updated the Session ID\n\t\t\tif (sessionId.Length > 0)\n\t\t\t{\n\t\t\t\tthis.context.SessionId = sessionId;\n\t\t\t}\n\n\t\t\t// Update the protocol version\n\t\t\tthis.Context.ChangeProtocol((short)protocol);\n\n\t\t\t// Select the Cipher suite\n\t\t\tthis.ProcessCipherSpecV2Buffer(this.Context.SecurityProtocol, cipherSpecV2);\n\n\t\t\t// Updated the Client Random\n\t\t\tthis.context.ClientRandom = new byte [32]; // Always 32\n\t\t\t// 1. if challenge is bigger than 32 bytes only use the last 32 bytes\n\t\t\t// 2. right justify (0) challenge in ClientRandom if less than 32\n\t\t\tBuffer.BlockCopy (challenge, challenge.Length - length, this.context.ClientRandom, 32 - length, length);\n\n\t\t\t// Set \n\t\t\tthis.context.LastHandshakeMsg = HandshakeType.ClientHello;\n\t\t\tthis.context.ProtocolNegotiated = true;\n\n\t\t\treturn message;\n\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": " def _handle_carbon_received(self, msg):\n if msg['from'].bare == self.xmpp.boundjid.bare:\n self.xmpp.event('carbon_received', msg)", "label": 1, "label_name": "safe"} +{"code": "TagSearch.prototype.makeKeyUpHandler = function() {\n var me = this;\n return function(evt) {\n var keyCode = getKeyCode(evt);\n if (me.getIsRunning() === false) {\n me.runSearch();\n }\n };\n};", "label": 1, "label_name": "safe"} +{"code": "\tpublic static function endReset( &$parser, $text ) {\n\t\tif ( !self::$createdLinks['resetdone'] ) {\n\t\t\tself::$createdLinks['resetdone'] = true;\n\t\t\tforeach ( $parser->getOutput()->mCategories as $key => $val ) {\n\t\t\t\tif ( array_key_exists( $key, self::$fixedCategories ) ) {\n\t\t\t\t\tself::$fixedCategories[$key] = $val;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// $text .= self::dumpParsedRefs($parser,\"before final reset\");\n\t\t\tif ( self::$createdLinks['resetLinks'] ) {\n\t\t\t\t$parser->getOutput()->mLinks = [];\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetCategories'] ) {\n\t\t\t\t$parser->getOutput()->mCategories = self::$fixedCategories;\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetTemplates'] ) {\n\t\t\t\t$parser->getOutput()->mTemplates = [];\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetImages'] ) {\n\t\t\t\t$parser->getOutput()->mImages = [];\n\t\t\t}\n\t\t\t// $text .= self::dumpParsedRefs( $parser, 'after final reset' );\n\t\t\tself::$fixedCategories = [];\n\t\t}\n\t\treturn true;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " async def test_char_fuzz(self):\n for char in DODGY_STRINGS:\n # print(repr(char))\n\n # Create\n obj1 = await CharFields.create(char=char)\n\n # Get-by-pk, and confirm that reading is correct\n obj2 = await CharFields.get(pk=obj1.pk)\n self.assertEqual(char, obj2.char)\n\n # Update data using a queryset, confirm that update is correct\n await CharFields.filter(pk=obj1.pk).update(char=\"a\")\n await CharFields.filter(pk=obj1.pk).update(char=char)\n obj3 = await CharFields.get(pk=obj1.pk)\n self.assertEqual(char, obj3.char)\n\n # Filter by value in queryset, and confirm that it fetched the right one\n obj4 = await CharFields.get(pk=obj1.pk, char=char)\n self.assertEqual(obj1.pk, obj4.pk)\n self.assertEqual(char, obj4.char)\n\n # LIKE statements are not strict, so require all of these to match\n obj5 = await CharFields.get(\n pk=obj1.pk,\n char__startswith=char,\n char__endswith=char,\n char__contains=char,\n char__istartswith=char,\n char__iendswith=char,\n char__icontains=char,\n )\n self.assertEqual(obj1.pk, obj5.pk)\n self.assertEqual(char, obj5.char)", "label": 1, "label_name": "safe"} +{"code": "var cleanUrl = function(url) { \r\n\turl = decodeURIComponent(url);\r\n\twhile(url.indexOf('..').length > 0) { url = url.replace('..', ''); }\r\n\treturn url;\r\n};\r", "label": 0, "label_name": "vulnerable"} +{"code": " it \"returns the count\" do\n database.stub(command: { \"n\" => 4 })\n\n query.count.should eq 4\n end", "label": 0, "label_name": "vulnerable"} +{"code": " async def check_credentials(username: str, password: str) -> bool:\n return (username, password) == credentials", "label": 0, "label_name": "vulnerable"} +{"code": " public void translate(ServerSetTitleTextPacket packet, GeyserSession session) {\n String text;\n if (packet.getText() == null) { //TODO 1.17 can this happen?\n text = \" \";\n } else {\n text = MessageTranslator.convertMessage(packet.getText(), session.getLocale());\n }\n\n SetTitlePacket titlePacket = new SetTitlePacket();\n titlePacket.setType(SetTitlePacket.Type.TITLE);\n titlePacket.setText(text);\n titlePacket.setXuid(\"\");\n titlePacket.setPlatformOnlineId(\"\");\n session.sendUpstreamPacket(titlePacket);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "Renderer.prototype.del = function(text) {\n return '' + text + '';\n};", "label": 1, "label_name": "safe"} +{"code": "cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,\n const void *p, size_t tail, int line)\n{\n\tconst char *b = (const char *)sst->sst_tab;\n\tconst char *e = ((const char *)p) + tail;\n\tsize_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?\n\t CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);\n\t(void)&line;\n\tif (e >= b && (size_t)(e - b) <= ss * sst->sst_len)\n\t\treturn 0;\n\tDPRINTF((\"%d: offset begin %p < end %p || %\" SIZE_T_FORMAT \"u\"\n\t \" > %\" SIZE_T_FORMAT \"u [%\" SIZE_T_FORMAT \"u %\"\n\t SIZE_T_FORMAT \"u]\\n\", line, b, e, (size_t)(e - b),\n\t ss * sst->sst_len, ss, sst->sst_len));\n\terrno = EFTYPE;\n\treturn -1;\n}", "label": 1, "label_name": "safe"} +{"code": " void onComplete(const Status& status, ContextImpl& context) const override {\n auto& completion_state = context.getCompletionState(this);\n if (completion_state.is_completed_) {\n return;\n }\n\n // If any of children is OK, return OK\n if (Status::Ok == status) {\n completion_state.is_completed_ = true;\n completeWithStatus(status, context);\n return;\n }\n\n // Then wait for all children to be done.\n if (++completion_state.number_completed_children_ == verifiers_.size()) {\n // Aggregate all children status into a final status.\n // JwtMissed and JwtUnknownIssuer should be treated differently than other errors.\n // JwtMissed means not Jwt token for the required provider.\n // JwtUnknownIssuer means wrong issuer for the required provider.\n Status final_status = Status::JwtMissed;\n for (const auto& it : verifiers_) {\n // Prefer errors which are not JwtMissed nor JwtUnknownIssuer.\n // Prefer JwtUnknownIssuer between JwtMissed and JwtUnknownIssuer.\n Status child_status = context.getCompletionState(it.get()).status_;\n if ((child_status != Status::JwtMissed && child_status != Status::JwtUnknownIssuer) ||\n final_status == Status::JwtMissed) {\n final_status = child_status;\n }\n }\n\n if (is_allow_missing_or_failed_) {\n final_status = Status::Ok;\n } else if (is_allow_missing_ && final_status == Status::JwtMissed) {\n final_status = Status::Ok;\n }\n completion_state.is_completed_ = true;\n completeWithStatus(final_status, context);\n }\n }", "label": 1, "label_name": "safe"} +{"code": "\tthis.getstate = function() {\n\t\tvar sel = this.fm.selectedFiles();\n\n\t\treturn !this._disabled && sel.length == 1 && sel[0].phash && !sel[0].locked ? 0 : -1;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "int processCommand(redisClient *c) {\n struct redisCommand *cmd;\n\n /* The QUIT command is handled separately. Normal command procs will\n * go through checking for replication and QUIT will cause trouble\n * when FORCE_REPLICATION is enabled and would be implemented in\n * a regular command proc. */\n if (!strcasecmp(c->argv[0]->ptr,\"quit\")) {\n addReply(c,shared.ok);\n c->flags |= REDIS_CLOSE_AFTER_REPLY;\n return REDIS_ERR;\n }\n\n /* Now lookup the command and check ASAP about trivial error conditions\n * such wrong arity, bad command name and so forth. */\n cmd = lookupCommand(c->argv[0]->ptr);\n if (!cmd) {\n addReplyErrorFormat(c,\"unknown command '%s'\",\n (char*)c->argv[0]->ptr);\n return REDIS_OK;\n } else if ((cmd->arity > 0 && cmd->arity != c->argc) ||\n (c->argc < -cmd->arity)) {\n addReplyErrorFormat(c,\"wrong number of arguments for '%s' command\",\n cmd->name);\n return REDIS_OK;\n }\n\n /* Check if the user is authenticated */\n if (server.requirepass && !c->authenticated && cmd->proc != authCommand) {\n addReplyError(c,\"operation not permitted\");\n return REDIS_OK;\n }\n\n /* Handle the maxmemory directive.\n *\n * First we try to free some memory if possible (if there are volatile\n * keys in the dataset). If there are not the only thing we can do\n * is returning an error. */\n if (server.maxmemory) freeMemoryIfNeeded();\n if (server.maxmemory && (cmd->flags & REDIS_CMD_DENYOOM) &&\n zmalloc_used_memory() > server.maxmemory)\n {\n addReplyError(c,\"command not allowed when used memory > 'maxmemory'\");\n return REDIS_OK;\n }\n\n /* Only allow SUBSCRIBE and UNSUBSCRIBE in the context of Pub/Sub */\n if ((dictSize(c->pubsub_channels) > 0 || listLength(c->pubsub_patterns) > 0)\n &&\n cmd->proc != subscribeCommand && cmd->proc != unsubscribeCommand &&\n cmd->proc != psubscribeCommand && cmd->proc != punsubscribeCommand) {\n addReplyError(c,\"only (P)SUBSCRIBE / (P)UNSUBSCRIBE / QUIT allowed in this context\");\n return REDIS_OK;\n }\n\n /* Only allow INFO and SLAVEOF when slave-serve-stale-data is no and\n * we are a slave with a broken link with master. */\n if (server.masterhost && server.replstate != REDIS_REPL_CONNECTED &&\n server.repl_serve_stale_data == 0 &&\n cmd->proc != infoCommand && cmd->proc != slaveofCommand)\n {\n addReplyError(c,\n \"link with MASTER is down and slave-serve-stale-data is set to no\");\n return REDIS_OK;\n }\n\n /* Loading DB? Return an error if the command is not INFO */\n if (server.loading && cmd->proc != infoCommand) {\n addReply(c, shared.loadingerr);\n return REDIS_OK;\n }\n\n /* Exec the command */\n if (c->flags & REDIS_MULTI &&\n cmd->proc != execCommand && cmd->proc != discardCommand &&\n cmd->proc != multiCommand && cmd->proc != watchCommand)\n {\n queueMultiCommand(c,cmd);\n addReply(c,shared.queued);\n } else {\n if (server.vm_enabled && server.vm_max_threads > 0 &&\n blockClientOnSwappedKeys(c,cmd)) return REDIS_ERR;\n call(c,cmd);\n }\n return REDIS_OK;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,\n\t\t char *const argv[])\n{\n\tuint\tchip;\n\tuint\tdevaddr, length;\n\tuint\talen;\n\tu_char *memaddr;\n\tint ret;\n#if CONFIG_IS_ENABLED(DM_I2C)\n\tstruct udevice *dev;\n#endif\n\n\tif (argc != 5)\n\t\treturn CMD_RET_USAGE;\n\n\t/*\n\t * I2C chip address\n\t */\n\tchip = hextoul(argv[1], NULL);\n\n\t/*\n\t * I2C data address within the chip. This can be 1 or\n\t * 2 bytes long. Some day it might be 3 bytes long :-).\n\t */\n\tdevaddr = hextoul(argv[2], NULL);\n\talen = get_alen(argv[2], DEFAULT_ADDR_LEN);\n\tif (alen > 3)\n\t\treturn CMD_RET_USAGE;\n\n\t/*\n\t * Length is the number of objects, not number of bytes.\n\t */\n\tlength = hextoul(argv[3], NULL);\n\n\t/*\n\t * memaddr is the address where to store things in memory\n\t */\n\tmemaddr = (u_char *)hextoul(argv[4], NULL);\n\n#if CONFIG_IS_ENABLED(DM_I2C)\n\tret = i2c_get_cur_bus_chip(chip, &dev);\n\tif (!ret && alen != -1)\n\t\tret = i2c_set_chip_offset_len(dev, alen);\n\tif (!ret)\n\t\tret = dm_i2c_read(dev, devaddr, memaddr, length);\n#else\n\tret = i2c_read(chip, devaddr, alen, memaddr, length);\n#endif\n\tif (ret)\n\t\treturn i2c_report_err(ret, I2C_ERR_READ);\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "static int pgx_gethdr(jas_stream_t *in, pgx_hdr_t *hdr)\n{\n\tint c;\n\tuchar buf[2];\n\n\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\tgoto error;\n\t}\n\tbuf[0] = c;\n\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\tgoto error;\n\t}\n\tbuf[1] = c;\n\thdr->magic = buf[0] << 8 | buf[1];\n\tif (hdr->magic != PGX_MAGIC) {\n\t\tjas_eprintf(\"invalid PGX signature\\n\");\n\t\tgoto error;\n\t}\n\tif ((c = pgx_getc(in)) == EOF || !isspace(c)) {\n\t\tgoto error;\n\t}\n\tif (pgx_getbyteorder(in, &hdr->bigendian)) {\n\t\tjas_eprintf(\"cannot get byte order\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getsgnd(in, &hdr->sgnd)) {\n\t\tjas_eprintf(\"cannot get signedness\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getuint32(in, &hdr->prec)) {\n\t\tjas_eprintf(\"cannot get precision\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getuint32(in, &hdr->width)) {\n\t\tjas_eprintf(\"cannot get width\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getuint32(in, &hdr->height)) {\n\t\tjas_eprintf(\"cannot get height\\n\");\n\t\tgoto error;\n\t}\n\treturn 0;\n\nerror:\n\treturn -1;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function provideGenerateInt() {\n return array(\n array(1, 1, 1),\n array(0, 1, 0),\n array(0, 255, 0),\n array(400, 655, 400),\n array(0, 65535, 257),\n array(65535, 131070, 65792),\n array(0, 16777215, (2<<16) + 2),\n array(-10, 0, -10),\n array(-655, -400, -655),\n array(-131070, -65535, -130813),\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tfunction edit() {\n\t if (empty($this->params['content_id'])) {\n\t flash('message',gt('An error occurred: No content id set.'));\n expHistory::back(); \n\t } \n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n \n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $comment = new expComment($id);\n //FIXME here is where we might sanitize the comment before displaying/editing it\n\t\tassign_to_template(array(\n\t\t 'content_id'=>$this->params['content_id'],\n 'content_type'=>$this->params['content_type'],\n\t\t 'comment'=>$comment\n\t\t));\n\t}\t", "label": 0, "label_name": "vulnerable"} +{"code": " public function setBeforeRemovingPasses(array $passes)\n {\n $this->beforeRemovingPasses = $passes;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC)\n{\n\tsize_t retlen;\n\tchar *ret;\n\tenum entity_charset charset;\n\tconst entity_ht *inverse_map = NULL;\n\tsize_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen);\n\n\tif (all) {\n\t\tcharset = determine_charset(hint_charset TSRMLS_CC);\n\t} else {\n\t\tcharset = cs_8859_1; /* charset shouldn't matter, use ISO-8859-1 for performance */\n\t}\n\n\t/* don't use LIMIT_ALL! */\n\n\tif (oldlen > new_size) {\n\t\t/* overflow, refuse to do anything */\n\t\tret = estrndup((char*)old, oldlen);\n\t\tretlen = oldlen;\n\t\tgoto empty_source;\n\t}\n\tret = emalloc(new_size);\n\t*ret = '\\0';\n\tretlen = oldlen;\n\tif (retlen == 0) {\n\t\tgoto empty_source;\n\t}\n\t\n\tinverse_map = unescape_inverse_map(all, flags);\n\t\n\t/* replace numeric entities */\n\ttraverse_for_entities(old, oldlen, ret, &retlen, all, flags, inverse_map, charset);\n\nempty_source:\t\n\t*newlen = retlen;\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function thmList()\n {\n //$mod = '';\n $handle = dir(GX_THEME);\n while (false !== ($entry = $handle->read())) {\n if ($entry != '.' && $entry != '..') {\n $dir = GX_THEME.$entry;\n if (is_dir($dir) == true) {\n $thm[] = basename($dir);\n }\n }\n }\n\n $handle->close();\n\n return $thm;\n }", "label": 1, "label_name": "safe"} +{"code": "bool ArcMemory::Unload()\n{\n if (!Loaded)\n return false;\n Loaded=false;\n return true;\n}", "label": 1, "label_name": "safe"} +{"code": " protected function assertValidation($uri, $expect_uri = true)\n {\n if ($expect_uri === true) $expect_uri = $uri;\n $uri = $this->createURI($uri);\n $result = $uri->validate($this->config, $this->context);\n if ($expect_uri === false) {\n $this->assertFalse($result);\n } else {\n $this->assertTrue($result);\n $this->assertIdentical($uri->toString(), $expect_uri);\n }\n }", "label": 1, "label_name": "safe"} +{"code": " ->orWhereExists(function(QueryBuilder $query) use ($tableDetails, $pageMorphClass) {\n $query->select('id')->from('pages')\n ->whereColumn('pages.id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->where($tableDetails['tableName'] . '.' . $tableDetails['entityTypeColumn'], '=', $pageMorphClass)\n ->where('pages.draft', '=', false);\n });", "label": 1, "label_name": "safe"} +{"code": "static int pop_sync_mailbox(struct Context *ctx, int *index_hint)\n{\n int i, j, ret = 0;\n char buf[LONG_STRING];\n struct PopData *pop_data = (struct PopData *) ctx->data;\n struct Progress progress;\n#ifdef USE_HCACHE\n header_cache_t *hc = NULL;\n#endif\n\n pop_data->check_time = 0;\n\n while (true)\n {\n if (pop_reconnect(ctx) < 0)\n return -1;\n\n mutt_progress_init(&progress, _(\"Marking messages deleted...\"),\n MUTT_PROGRESS_MSG, WriteInc, ctx->deleted);\n\n#ifdef USE_HCACHE\n hc = pop_hcache_open(pop_data, ctx->path);\n#endif\n\n for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->msgcount; i++)\n {\n if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->refno != -1)\n {\n j++;\n if (!ctx->quiet)\n mutt_progress_update(&progress, j, -1);\n snprintf(buf, sizeof(buf), \"DELE %d\\r\\n\", ctx->hdrs[i]->refno);\n ret = pop_query(pop_data, buf, sizeof(buf));\n if (ret == 0)\n {\n mutt_bcache_del(pop_data->bcache, ctx->hdrs[i]->data);\n#ifdef USE_HCACHE\n mutt_hcache_delete(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data));\n#endif\n }\n }\n\n#ifdef USE_HCACHE\n if (ctx->hdrs[i]->changed)\n {\n mutt_hcache_store(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data),\n ctx->hdrs[i], 0);\n }\n#endif\n }\n\n#ifdef USE_HCACHE\n mutt_hcache_close(hc);\n#endif\n\n if (ret == 0)\n {\n mutt_str_strfcpy(buf, \"QUIT\\r\\n\", sizeof(buf));\n ret = pop_query(pop_data, buf, sizeof(buf));\n }\n\n if (ret == 0)\n {\n pop_data->clear_cache = true;\n pop_clear_cache(pop_data);\n pop_data->status = POP_DISCONNECTED;\n return 0;\n }\n\n if (ret == -2)\n {\n mutt_error(\"%s\", pop_data->err_msg);\n return -1;\n }\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static String htmlEscape(String text) {\n StringBuilder buf = new StringBuilder(text.length()+64);\n for( int i=0; iaddElement('form', 'Form',\n 'Required: Heading | List | Block | fieldset', 'Common', array(\n 'accept' => 'ContentTypes',\n 'accept-charset' => 'Charsets',\n 'action*' => 'URI',\n 'method' => 'Enum#get,post',\n // really ContentType, but these two are the only ones used today\n 'enctype' => 'Enum#application/x-www-form-urlencoded,multipart/form-data',\n ));\n $form->excludes = array('form' => true);\n\n $input = $this->addElement('input', 'Formctrl', 'Empty', 'Common', array(\n 'accept' => 'ContentTypes',\n 'accesskey' => 'Character',\n 'alt' => 'Text',\n 'checked' => 'Bool#checked',\n 'disabled' => 'Bool#disabled',\n 'maxlength' => 'Number',\n 'name' => 'CDATA',\n 'readonly' => 'Bool#readonly',\n 'size' => 'Number',\n 'src' => 'URI#embedded',\n 'tabindex' => 'Number',\n 'type' => 'Enum#text,password,checkbox,button,radio,submit,reset,file,hidden,image',\n 'value' => 'CDATA',\n ));\n $input->attr_transform_post[] = new HTMLPurifier_AttrTransform_Input();\n\n $this->addElement('select', 'Formctrl', 'Required: optgroup | option', 'Common', array(\n 'disabled' => 'Bool#disabled',\n 'multiple' => 'Bool#multiple',\n 'name' => 'CDATA',\n 'size' => 'Number',\n 'tabindex' => 'Number',\n ));\n\n $this->addElement('option', false, 'Optional: #PCDATA', 'Common', array(\n 'disabled' => 'Bool#disabled',\n 'label' => 'Text',\n 'selected' => 'Bool#selected',\n 'value' => 'CDATA',\n ));\n // It's illegal for there to be more than one selected, but not\n // be multiple. Also, no selected means undefined behavior. This might\n // be difficult to implement; perhaps an injector, or a context variable.\n\n $textarea = $this->addElement('textarea', 'Formctrl', 'Optional: #PCDATA', 'Common', array(\n 'accesskey' => 'Character',\n 'cols*' => 'Number',\n 'disabled' => 'Bool#disabled',\n 'name' => 'CDATA',\n 'readonly' => 'Bool#readonly',\n 'rows*' => 'Number',\n 'tabindex' => 'Number',\n ));\n $textarea->attr_transform_pre[] = new HTMLPurifier_AttrTransform_Textarea();\n\n $button = $this->addElement('button', 'Formctrl', 'Optional: #PCDATA | Heading | List | Block | Inline', 'Common', array(\n 'accesskey' => 'Character',\n 'disabled' => 'Bool#disabled',\n 'name' => 'CDATA',\n 'tabindex' => 'Number',\n 'type' => 'Enum#button,submit,reset',\n 'value' => 'CDATA',\n ));\n\n // For exclusions, ideally we'd specify content sets, not literal elements\n $button->excludes = $this->makeLookup(\n 'form', 'fieldset', // Form\n 'input', 'select', 'textarea', 'label', 'button', // Formctrl\n 'a', // as per HTML 4.01 spec, this is omitted by modularization\n 'isindex', 'iframe' // legacy items\n );\n\n // Extra exclusion: img usemap=\"\" is not permitted within this element.\n // We'll omit this for now, since we don't have any good way of\n // indicating it yet.\n\n // This is HIGHLY user-unfriendly; we need a custom child-def for this\n $this->addElement('fieldset', 'Form', 'Custom: (#WS?,legend,(Flow|#PCDATA)*)', 'Common');\n\n $label = $this->addElement('label', 'Formctrl', 'Optional: #PCDATA | Inline', 'Common', array(\n 'accesskey' => 'Character',\n // 'for' => 'IDREF', // IDREF not implemented, cannot allow\n ));\n $label->excludes = array('label' => true);\n\n $this->addElement('legend', false, 'Optional: #PCDATA | Inline', 'Common', array(\n 'accesskey' => 'Character',\n ));\n\n $this->addElement('optgroup', false, 'Required: option', 'Common', array(\n 'disabled' => 'Bool#disabled',\n 'label*' => 'Text',\n ));\n\n // Don't forget an injector for . This one's a little complex\n // because it maps to multiple elements.\n\n }", "label": 1, "label_name": "safe"} +{"code": " def test_unlimited_security_groups(self):\n self.flags(quota_security_groups=10)\n security_groups = quota.allowed_security_groups(self.context, 100)\n self.assertEqual(security_groups, 10)\n db.quota_create(self.context, self.project_id, 'security_groups', -1)\n security_groups = quota.allowed_security_groups(self.context, 100)\n self.assertEqual(security_groups, 100)\n security_groups = quota.allowed_security_groups(self.context, 101)\n self.assertEqual(security_groups, 101)", "label": 1, "label_name": "safe"} +{"code": " public function actionUpdate($id){\n $model = $this->loadModel($id);\n if (!$this->checkPermissions ($model, 'edit')) $this->denied ();\n\n if(isset($_POST['Media'])){\n // save media info\n $model->lastUpdated = time();\n $model->associationType = $_POST['Media']['associationType'];\n $model->associationId = $_POST['Media']['associationId'];\n $model->private = $_POST['Media']['private'];\n if($_POST['Media']['description'])\n $model->description = $_POST['Media']['description'];\n if (! $model->drive) {\n // Handle setting the name if the Media isn't stored on Drive\n $model->name = $_POST['Media']['name'];\n if (empty($model->name))\n $model->name = $model->fileName;\n }\n if($model->save())\n $this->redirect(array('view', 'id' => $model->id));\n }\n\n $this->render('update', array(\n 'model' => $model,\n ));\n }", "label": 1, "label_name": "safe"} +{"code": " public async Task SerializeToStreamAsync(IRequest req, object response, Stream outputStream)\n {\n var res = req.Response;\n if (req.GetItem(\"HttpResult\") is IHttpResult httpResult && httpResult.Headers.ContainsKey(HttpHeaders.Location) \n && httpResult.StatusCode != System.Net.HttpStatusCode.Created) \n return;\n\n try\n {\n if (res.StatusCode >= 400)\n {\n var responseStatus = response.GetResponseStatus();\n req.Items[ErrorStatusKey] = responseStatus;\n }\n\n if (response is CompressedResult)\n {\n if (res.Dto != null)\n response = res.Dto;\n else \n throw new ArgumentException(\"Cannot use Cached Result as ViewModel\");\n }\n\n foreach (var viewEngine in AppHost.ViewEngines)\n {\n var handled = await viewEngine.ProcessRequestAsync(req, response, outputStream);\n if (handled)\n return;\n }\n }\n catch (Exception ex)\n {\n if (res.StatusCode < 400)\n throw;\n\n //If there was an exception trying to render a Error with a View, \n //It can't handle errors so just write it out here.\n response = DtoUtils.CreateErrorResponse(req.Dto, ex);\n }\n\n //Handle Exceptions returning string\n if (req.ResponseContentType == MimeTypes.PlainText)\n {\n req.ResponseContentType = MimeTypes.Html;\n res.ContentType = MimeTypes.Html;\n }\n\n if (req.ResponseContentType != MimeTypes.Html && req.ResponseContentType != MimeTypes.JsonReport) \n return;\n\n var dto = response.GetDto();\n if (!(dto is string html))\n {\n // Serialize then escape any potential script tags to avoid XSS when displaying as HTML\n var json = JsonDataContractSerializer.Instance.SerializeToString(dto) ?? \"null\";\n json = json.HtmlEncode();\n\n var url = req.ResolveAbsoluteUrl()\n .Replace(\"format=html\", \"\")\n .Replace(\"format=shtm\", \"\")\n .TrimEnd('?', '&')\n .HtmlEncode();\n\n url += url.Contains(\"?\") ? \"&\" : \"?\";\n\n var now = DateTime.UtcNow;\n var requestName = req.OperationName ?? dto.GetType().GetOperationName();\n\n html = HtmlTemplates.GetHtmlFormatTemplate()\n .Replace(\"${Dto}\", json)\n .Replace(\"${Title}\", string.Format(TitleFormat, requestName, now))\n .Replace(\"${MvcIncludes}\", MiniProfiler.Profiler.RenderIncludes().ToString())\n .Replace(\"${Header}\", string.Format(HtmlTitleFormat, requestName, now))\n .Replace(\"${ServiceUrl}\", url)\n .Replace(\"${Humanize}\", Humanize.ToString().ToLower());\n }\n\n var utf8Bytes = html.ToUtf8Bytes();\n await outputStream.WriteAsync(utf8Bytes, 0, utf8Bytes.Length);\n }", "label": 1, "label_name": "safe"} +{"code": " def get_pos_tagger(self):\n from nltk.corpus import brown\n\n regexp_tagger = RegexpTagger(\n [\n (r\"^-?[0-9]+(\\.[0-9]+)?$\", \"CD\"), # cardinal numbers\n (r\"(The|the|A|a|An|an)$\", \"AT\"), # articles\n (r\".*able$\", \"JJ\"), # adjectives\n (r\".*ness$\", \"NN\"), # nouns formed from adjectives\n (r\".*ly$\", \"RB\"), # adverbs\n (r\".*s$\", \"NNS\"), # plural nouns\n (r\".*ing$\", \"VBG\"), # gerunds\n (r\".*ed$\", \"VBD\"), # past tense verbs\n (r\".*\", \"NN\"), # nouns (default)\n ]\n )\n brown_train = brown.tagged_sents(categories=\"news\")\n unigram_tagger = UnigramTagger(brown_train, backoff=regexp_tagger)\n bigram_tagger = BigramTagger(brown_train, backoff=unigram_tagger)\n trigram_tagger = TrigramTagger(brown_train, backoff=bigram_tagger)\n\n # Override particular words\n main_tagger = RegexpTagger(\n [(r\"(A|a|An|an)$\", \"ex_quant\"), (r\"(Every|every|All|all)$\", \"univ_quant\")],\n backoff=trigram_tagger,\n )\n\n return main_tagger", "label": 1, "label_name": "safe"} +{"code": " public function testPutRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId, $expectedCode)\n {\n $request = new Enlight_Controller_Request_RequestTestCase();\n $request->setMethod('PUT');\n\n $response = new Enlight_Controller_Response_ResponseTestCase();\n\n $request->setPathInfo($uri);\n $this->router->assembleRoute($request, $response);\n\n static::assertEquals($expectedController, $request->getControllerName());\n static::assertEquals($expectedAction, $request->getActionName());\n static::assertEquals($expectedVersion, $request->getParam('version'));\n static::assertEquals($expectedId, $request->getParam('id'));\n static::assertEquals($expectedCode, $response->getHttpResponseCode());\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testRegular()\n {\n $this->assertParsing(\n 'http://www.example.com/webhp?q=foo#result2',\n 'http', null, 'www.example.com', null, '/webhp', 'q=foo', 'result2'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " public function testSelectOptgroup()\n {\n $this->config->set('HTML.Doctype', 'HTML 4.01 Strict');\n $this->assertResult('\n
\n

\n \n

\n
\n ');\n }", "label": 1, "label_name": "safe"} +{"code": "static void renameTableFunc(\n sqlite3_context *context,\n int NotUsed,\n sqlite3_value **argv\n){\n sqlite3 *db = sqlite3_context_db_handle(context);\n const char *zDb = (const char*)sqlite3_value_text(argv[0]);\n const char *zInput = (const char*)sqlite3_value_text(argv[3]);\n const char *zOld = (const char*)sqlite3_value_text(argv[4]);\n const char *zNew = (const char*)sqlite3_value_text(argv[5]);\n int bTemp = sqlite3_value_int(argv[6]);\n UNUSED_PARAMETER(NotUsed);\n\n if( zInput && zOld && zNew ){\n Parse sParse;\n int rc;\n int bQuote = 1;\n RenameCtx sCtx;\n Walker sWalker;\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n sqlite3_xauth xAuth = db->xAuth;\n db->xAuth = 0;\n#endif\n\n sqlite3BtreeEnterAll(db);\n\n memset(&sCtx, 0, sizeof(RenameCtx));\n sCtx.pTab = sqlite3FindTable(db, zOld, zDb);\n memset(&sWalker, 0, sizeof(Walker));\n sWalker.pParse = &sParse;\n sWalker.xExprCallback = renameTableExprCb;\n sWalker.xSelectCallback = renameTableSelectCb;\n sWalker.u.pRename = &sCtx;\n\n rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);\n\n if( rc==SQLITE_OK ){\n int isLegacy = (db->flags & SQLITE_LegacyAlter);\n if( sParse.pNewTable ){\n Table *pTab = sParse.pNewTable;\n\n if( pTab->pSelect ){\n if( isLegacy==0 ){\n Select *pSelect = pTab->pSelect;\n NameContext sNC;\n memset(&sNC, 0, sizeof(sNC));\n sNC.pParse = &sParse;\n\n assert( pSelect->selFlags & SF_View );\n pSelect->selFlags &= ~SF_View;\n sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);\n if( sParse.nErr ) rc = sParse.rc;\n sqlite3WalkSelect(&sWalker, pTab->pSelect);\n }\n }else{\n /* Modify any FK definitions to point to the new table. */\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n if( isLegacy==0 || (db->flags & SQLITE_ForeignKeys) ){\n FKey *pFKey;\n for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){\n if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){\n renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo);\n }\n }\n }\n#endif\n\n /* If this is the table being altered, fix any table refs in CHECK\n ** expressions. Also update the name that appears right after the\n ** \"CREATE [VIRTUAL] TABLE\" bit. */\n if( sqlite3_stricmp(zOld, pTab->zName)==0 ){\n sCtx.pTab = pTab;\n if( isLegacy==0 ){\n sqlite3WalkExprList(&sWalker, pTab->pCheck);\n }\n renameTokenFind(&sParse, &sCtx, pTab->zName);\n }\n }\n }\n\n else if( sParse.pNewIndex ){\n renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName);\n if( isLegacy==0 ){\n sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);\n }\n }\n\n#ifndef SQLITE_OMIT_TRIGGER\n else{\n Trigger *pTrigger = sParse.pNewTrigger;\n TriggerStep *pStep;\n if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) \n && sCtx.pTab->pSchema==pTrigger->pTabSchema\n ){\n renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table);\n }\n\n if( isLegacy==0 ){\n rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);\n if( rc==SQLITE_OK ){\n renameWalkTrigger(&sWalker, pTrigger);\n for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){\n if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){\n renameTokenFind(&sParse, &sCtx, pStep->zTarget);\n }\n }\n }\n }\n }\n#endif\n }\n\n if( rc==SQLITE_OK ){\n rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);\n }\n if( rc!=SQLITE_OK ){\n if( sParse.zErrMsg ){\n renameColumnParseError(context, 0, argv[1], argv[2], &sParse);\n }else{\n sqlite3_result_error_code(context, rc);\n }\n }\n\n renameParseCleanup(&sParse);\n renameTokenFree(db, sCtx.pList);\n sqlite3BtreeLeaveAll(db);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n db->xAuth = xAuth;\n#endif\n }\n\n return;\n}", "label": 1, "label_name": "safe"} +{"code": " public function testDeleteTemplateAction()\n {\n $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);\n\n $fixture = new InvoiceTemplateFixtures();\n $template = $this->importFixture($fixture);\n $id = $template[0]->getId();\n\n $this->request($client, '/invoice/template/' . $id . '/delete');\n $this->assertIsRedirect($client, '/invoice/template');\n $client->followRedirect();\n\n $this->assertTrue($client->getResponse()->isSuccessful());\n $this->assertHasFlashSuccess($client);\n\n $this->assertEquals(0, $this->getEntityManager()->getRepository(InvoiceTemplate::class)->count([]));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testRemoveExpiredOnUnserialize()\n {\n $dt = new DateTime();\n $dt->setTimezone(new DateTimeZone('UTC'));\n $dt->modify('+2 seconds');\n\n $this->jar->store(array(\n 'name' => 'foo',\n 'value' => 'bar',\n 'domain' => '.example.com',\n 'path' => '/',\n 'expires' => $dt->format(DateTime::COOKIE),\n ));\n\n $serialized = serialize($this->jar);\n sleep(2);\n $newJar = unserialize($serialized);\n $this->assertEquals(array(), $newJar->getAll());\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should return a 403 if a user attempts to get at the _diagnostics path\" do\n get \"/message-bus/_diagnostics\"\n last_response.status.must_equal 403\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should fail if mask value is more than 32 bits' do\n lambda { @resource[:set_mark] = '1/4294967296'}.should raise_error(\n Puppet::Error, /MARK mask must be integer or hex between 0 and 0xffffffff$/\n )\n end", "label": 0, "label_name": "vulnerable"} +{"code": "function binl2b64(binarray)\n{\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i += 3)\n {\n var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)\n | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )\n | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);\n for(var j = 0; j < 4; j++)\n {\n if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;\n else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);\n }\n }\n return str;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function(O){O=da.apply(this,arguments);var X=this.editorUi,ea=X.editor.graph;if(ea.isEnabled()&&\"1\"==urlParams.sketch){var ka=this.createOption(mxResources.get(\"sketch\"),function(){return Editor.sketchMode},function(ja,U){X.setSketchMode(!Editor.sketchMode);null!=U&&mxEvent.isShiftDown(U)||ea.updateCellStyles({sketch:ja?\"1\":null},ea.getVerticesAndEdges())},{install:function(ja){this.listener=function(){ja(Editor.sketchMode)};X.addListener(\"sketchModeChanged\",this.listener)},destroy:function(){X.removeListener(this.listener)}});", "label": 0, "label_name": "vulnerable"} +{"code": " def gemset_name\n resource[:name]\n end", "label": 0, "label_name": "vulnerable"} +{"code": "def remote(params, request, auth_user)\n remote_cmd_without_pacemaker = {\n :status => method(:node_status),\n :status_all => method(:status_all),\n :cluster_status => method(:cluster_status_remote),\n :auth => method(:auth),\n :check_auth => method(:check_auth),\n :setup_cluster => method(:setup_cluster),\n :create_cluster => method(:create_cluster),\n :get_quorum_info => method(:get_quorum_info),\n :get_cib => method(:get_cib),\n :get_corosync_conf => method(:get_corosync_conf_remote),\n :set_cluster_conf => method(:set_cluster_conf),\n :set_corosync_conf => method(:set_corosync_conf),\n :get_sync_capabilities => method(:get_sync_capabilities),\n :set_sync_options => method(:set_sync_options),\n :get_configs => method(:get_configs),\n :set_configs => method(:set_configs),\n :set_certs => method(:set_certs),\n :pcsd_restart => method(:remote_pcsd_restart),\n :get_permissions => method(:get_permissions_remote),\n :set_permissions => method(:set_permissions_remote),\n :cluster_start => method(:cluster_start),\n :cluster_stop => method(:cluster_stop),\n :config_backup => method(:config_backup),\n :config_restore => method(:config_restore),\n :node_restart => method(:node_restart),\n :node_standby => method(:node_standby),\n :node_unstandby => method(:node_unstandby),\n :cluster_enable => method(:cluster_enable),\n :cluster_disable => method(:cluster_disable),\n :resource_status => method(:resource_status),\n :get_sw_versions => method(:get_sw_versions),\n :node_available => method(:remote_node_available),\n :add_node_all => lambda { |params_, request_, auth_user_|\n remote_add_node(params_, request_, auth_user_, true)\n },\n :add_node => lambda { |params_, request_, auth_user_|\n remote_add_node(params_, request_, auth_user_, false)\n },\n :remove_nodes => method(:remote_remove_nodes),\n :remove_node => method(:remote_remove_node),\n :cluster_destroy => method(:cluster_destroy),\n :get_wizard => method(:get_wizard),\n :wizard_submit => method(:wizard_submit),\n :get_tokens => method(:get_tokens),\n :get_cluster_tokens => method(:get_cluster_tokens),\n :save_tokens => method(:save_tokens),\n :get_cluster_properties_definition => method(:get_cluster_properties_definition)\n }\n remote_cmd_with_pacemaker = {\n :resource_start => method(:resource_start),\n :resource_stop => method(:resource_stop),\n :resource_cleanup => method(:resource_cleanup),\n :resource_form => method(:resource_form),\n :fence_device_form => method(:fence_device_form),\n :update_resource => method(:update_resource),\n :update_fence_device => method(:update_fence_device),\n :resource_metadata => method(:resource_metadata),\n :fence_device_metadata => method(:fence_device_metadata),\n :get_avail_resource_agents => method(:get_avail_resource_agents),\n :get_avail_fence_agents => method(:get_avail_fence_agents),\n :remove_resource => method(:remove_resource),\n :add_constraint_remote => method(:add_constraint_remote),\n :add_constraint_rule_remote => method(:add_constraint_rule_remote),\n :add_constraint_set_remote => method(:add_constraint_set_remote),\n :remove_constraint_remote => method(:remove_constraint_remote),\n :remove_constraint_rule_remote => method(:remove_constraint_rule_remote),\n :add_meta_attr_remote => method(:add_meta_attr_remote),\n :add_group => method(:add_group),\n :update_cluster_settings => method(:update_cluster_settings),\n :add_fence_level_remote => method(:add_fence_level_remote),\n :add_node_attr_remote => method(:add_node_attr_remote),\n :add_acl_role => method(:add_acl_role_remote),\n :remove_acl_roles => method(:remove_acl_roles_remote),\n :add_acl => method(:add_acl_remote),\n :remove_acl => method(:remove_acl_remote),\n :resource_change_group => method(:resource_change_group),\n :resource_master => method(:resource_master),\n :resource_clone => method(:resource_clone),\n :resource_unclone => method(:resource_unclone),\n :resource_ungroup => method(:resource_ungroup),\n :set_resource_utilization => method(:set_resource_utilization),\n :set_node_utilization => method(:set_node_utilization)\n }\n\n command = params[:command].to_sym\n\n if remote_cmd_without_pacemaker.include? command\n return remote_cmd_without_pacemaker[command].call(\n params, request, auth_user\n )\n elsif remote_cmd_with_pacemaker.include? command\n if pacemaker_running?\n return remote_cmd_with_pacemaker[command].call(params, request, auth_user)\n else\n return [200,'{\"pacemaker_not_running\":true}']\n end\n else\n return [404, \"Unknown Request\"]\n end\nend", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus PreluPrepare(TfLiteContext* context, TfLiteNode* node) {\n TFLITE_DCHECK(node->user_data != nullptr);\n PreluParams* params = static_cast(node->user_data);\n\n const TfLiteTensor* input = GetInput(context, node, 0);\n TF_LITE_ENSURE(context, input != nullptr);\n const TfLiteTensor* alpha = GetInput(context, node, 1);\n TF_LITE_ENSURE(context, alpha != nullptr);\n TfLiteTensor* output = GetOutput(context, node, 0);\n TF_LITE_ENSURE(context, output != nullptr);\n\n return CalculatePreluParams(input, alpha, output, params);\n}", "label": 1, "label_name": "safe"} +{"code": " protected function prepareExport($model) {\n $this->openX2 ('/admin/exportModels?model='.ucfirst($model));\n }", "label": 1, "label_name": "safe"} +{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_restriction/show', array(\n 'status_list' => array(\n SubtaskModel::STATUS_TODO => t('Todo'),\n SubtaskModel::STATUS_DONE => t('Done'),\n ),\n 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function read($path)\n {\n if ( ! $object = $this->readStream($path)) {\n return false;\n }\n\n $object['contents'] = stream_get_contents($object['stream']);\n fclose($object['stream']);\n unset($object['stream']);\n\n return $object;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static inline void sem_getref(struct sem_array *sma)\n{\n\tsem_lock(sma, NULL, -1);\n\tWARN_ON_ONCE(!ipc_rcu_getref(sma));\n\tsem_unlock(sma, -1);\n}", "label": 1, "label_name": "safe"} +{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_converter/show', array(\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func clearKey(key []byte) {\n\tfor i := range key {\n\t\tkey[i] = 0\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n filename[MagickPathExtent];\n\n FILE\n *file;\n\n Image\n *image,\n *next_image,\n *pwp_image;\n\n ImageInfo\n *read_info;\n\n int\n c,\n unique_file;\n\n MagickBooleanType\n status;\n\n register Image\n *p;\n\n register ssize_t\n i;\n\n size_t\n filesize,\n length;\n\n ssize_t\n count;\n\n unsigned char\n magick[MagickPathExtent];\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImage(image);\n return((Image *) NULL);\n }\n pwp_image=image;\n memset(magick,0,sizeof(magick));\n count=ReadBlob(pwp_image,5,magick);\n if ((count != 5) || (LocaleNCompare((char *) magick,\"SFW95\",5) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n read_info=CloneImageInfo(image_info);\n (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,\n (void *) NULL);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n unique_file=AcquireUniqueFileResource(filename);\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\"sfw:%s\",\n filename);\n for ( ; ; )\n {\n (void) memset(magick,0,sizeof(magick));\n for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))\n {\n for (i=0; i < 17; i++)\n magick[i]=magick[i+1];\n magick[17]=(unsigned char) c;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) == 0)\n break;\n }\n if (c == EOF)\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n }\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) != 0)\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Dump SFW image to a temporary file.\n */\n file=(FILE *) NULL;\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if ((unique_file == -1) || (file == (FILE *) NULL))\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowFileException(exception,FileOpenError,\"UnableToWriteFile\",\n image->filename);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n length=fwrite(\"SFW94A\",1,6,file);\n (void) length;\n filesize=65535UL*magick[2]+256L*magick[1]+magick[0];\n for (i=0; i < (ssize_t) filesize; i++)\n {\n c=ReadBlobByte(pwp_image);\n if (c == EOF)\n break;\n (void) fputc(c,file);\n }\n (void) fclose(file);\n if (c == EOF)\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n }\n next_image=ReadImage(read_info,exception);\n if (next_image == (Image *) NULL)\n break;\n (void) FormatLocaleString(next_image->filename,MagickPathExtent,\n \"slide_%02ld.sfw\",(long) next_image->scene);\n if (image == (Image *) NULL)\n image=next_image;\n else\n {\n /*\n Link image into image list.\n */\n for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;\n next_image->previous=p;\n next_image->scene=p->scene+1;\n p->next=next_image;\n }\n if (image_info->number_scenes != 0)\n if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),\n GetBlobSize(pwp_image));\n if (status == MagickFalse)\n break;\n }\n if (unique_file != -1)\n (void) close(unique_file);\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n if (image != (Image *) NULL)\n {\n if (EOFBlob(image) != MagickFalse)\n {\n char\n *message;\n\n message=GetExceptionMessage(errno);\n (void) ThrowMagickException(exception,GetMagickModule(),\n CorruptImageError,\"UnexpectedEndOfFile\",\"`%s': %s\",image->filename,\n message);\n message=DestroyString(message);\n }\n (void) CloseBlob(image);\n }\n return(GetFirstImageInList(image));\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testMultiRowIndexFile()\n {\n $iteration = 3;\n for ($i = 0; $i < $iteration; ++$i) {\n $profile = new Profile('token'.$i);\n $profile->setIp('127.0.0.'.$i);\n $profile->setUrl('http://foo.bar/'.$i);\n\n $this->storage->write($profile);\n $this->storage->write($profile);\n $this->storage->write($profile);\n }\n\n $handle = fopen($this->tmpDir.'/index.csv', 'r');\n for ($i = 0; $i < $iteration; ++$i) {\n $row = fgetcsv($handle);\n $this->assertEquals('token'.$i, $row[0]);\n $this->assertEquals('127.0.0.'.$i, $row[1]);\n $this->assertEquals('http://foo.bar/'.$i, $row[3]);\n }\n $this->assertFalse(fgetcsv($handle));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static void mbochs_remove(struct mdev_device *mdev)\n{\n\tstruct mdev_state *mdev_state = dev_get_drvdata(&mdev->dev);\n\n\tvfio_unregister_group_dev(&mdev_state->vdev);\n\tatomic_add(mdev_state->type->mbytes, &mbochs_avail_mbytes);\n\tkfree(mdev_state->pages);\n\tkfree(mdev_state->vconfig);\n\tkfree(mdev_state);\n}", "label": 1, "label_name": "safe"} +{"code": "\tdef is_whitelisted(self, method):\n\t\tfn = getattr(self, method, None)\n\t\tif not fn:\n\t\t\traise NotFound(\"Method {0} not found\".format(method))\n\t\telif not getattr(fn, \"whitelisted\", False):\n\t\t\traise Forbidden(\"Method {0} not whitelisted\".format(method))", "label": 0, "label_name": "vulnerable"} +{"code": "static const struct usb_cdc_union_desc *\nims_pcu_get_cdc_union_desc(struct usb_interface *intf)\n{\n\tconst void *buf = intf->altsetting->extra;\n\tsize_t buflen = intf->altsetting->extralen;\n\tstruct usb_cdc_union_desc *union_desc;\n\n\tif (!buf) {\n\t\tdev_err(&intf->dev, \"Missing descriptor data\\n\");\n\t\treturn NULL;\n\t}\n\n\tif (!buflen) {\n\t\tdev_err(&intf->dev, \"Zero length descriptor\\n\");\n\t\treturn NULL;\n\t}\n\n\twhile (buflen > 0) {\n\t\tunion_desc = (struct usb_cdc_union_desc *)buf;\n\n\t\tif (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&\n\t\t union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {\n\t\t\tdev_dbg(&intf->dev, \"Found union header\\n\");\n\t\t\treturn union_desc;\n\t\t}\n\n\t\tbuflen -= union_desc->bLength;\n\t\tbuf += union_desc->bLength;\n\t}\n\n\tdev_err(&intf->dev, \"Missing CDC union descriptor\\n\");\n\treturn NULL;", "label": 0, "label_name": "vulnerable"} +{"code": "static int validate_user_key(struct fscrypt_info *crypt_info,\n\t\t\tstruct fscrypt_context *ctx, u8 *raw_key,\n\t\t\tconst char *prefix)\n{\n\tchar *description;\n\tstruct key *keyring_key;\n\tstruct fscrypt_key *master_key;\n\tconst struct user_key_payload *ukp;\n\tint res;\n\n\tdescription = kasprintf(GFP_NOFS, \"%s%*phN\", prefix,\n\t\t\t\tFS_KEY_DESCRIPTOR_SIZE,\n\t\t\t\tctx->master_key_descriptor);\n\tif (!description)\n\t\treturn -ENOMEM;\n\n\tkeyring_key = request_key(&key_type_logon, description, NULL);\n\tkfree(description);\n\tif (IS_ERR(keyring_key))\n\t\treturn PTR_ERR(keyring_key);\n\n\tif (keyring_key->type != &key_type_logon) {\n\t\tprintk_once(KERN_WARNING\n\t\t\t\t\"%s: key type must be logon\\n\", __func__);\n\t\tres = -ENOKEY;\n\t\tgoto out;\n\t}\n\tdown_read(&keyring_key->sem);\n\tukp = user_key_payload(keyring_key);\n\tif (ukp->datalen != sizeof(struct fscrypt_key)) {\n\t\tres = -EINVAL;\n\t\tup_read(&keyring_key->sem);\n\t\tgoto out;\n\t}\n\tmaster_key = (struct fscrypt_key *)ukp->data;\n\tBUILD_BUG_ON(FS_AES_128_ECB_KEY_SIZE != FS_KEY_DERIVATION_NONCE_SIZE);\n\n\tif (master_key->size != FS_AES_256_XTS_KEY_SIZE) {\n\t\tprintk_once(KERN_WARNING\n\t\t\t\t\"%s: key size incorrect: %d\\n\",\n\t\t\t\t__func__, master_key->size);\n\t\tres = -ENOKEY;\n\t\tup_read(&keyring_key->sem);\n\t\tgoto out;\n\t}\n\tres = derive_key_aes(ctx->nonce, master_key->raw, raw_key);\n\tup_read(&keyring_key->sem);\n\tif (res)\n\t\tgoto out;\n\n\tcrypt_info->ci_keyring_key = keyring_key;\n\treturn 0;\nout:\n\tkey_put(keyring_key);\n\treturn res;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " getItemHtml: function (value) {\n var translatedValue = this.translatedOptions[value] || value;\n\n var html = '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '

' +\n '
';\n\n return html;\n },", "label": 0, "label_name": "vulnerable"} +{"code": "static int gss_iakerbmechglue_init(void)\n{\n struct gss_mech_config mech_iakerb;\n struct gss_config iakerb_mechanism = krb5_mechanism;\n\n /* IAKERB mechanism mirrors krb5, but with different context SPIs */\n iakerb_mechanism.gss_accept_sec_context = iakerb_gss_accept_sec_context;\n iakerb_mechanism.gss_init_sec_context = iakerb_gss_init_sec_context;\n iakerb_mechanism.gss_delete_sec_context = iakerb_gss_delete_sec_context;\n iakerb_mechanism.gss_acquire_cred = iakerb_gss_acquire_cred;\n iakerb_mechanism.gssspi_acquire_cred_with_password\n = iakerb_gss_acquire_cred_with_password;\n\n memset(&mech_iakerb, 0, sizeof(mech_iakerb));\n mech_iakerb.mech = &iakerb_mechanism;\n\n mech_iakerb.mechNameStr = \"iakerb\";\n mech_iakerb.mech_type = (gss_OID)gss_mech_iakerb;\n gssint_register_mechinfo(&mech_iakerb);\n\n return 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "(function($,e,t){\"$:nomunge\";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s=\"setTimeout\",u=\"resize\",m=u+\"-special-event\",o=\"pendingDelay\",l=\"activeDelay\",f=\"throttleWindow\";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(\":visible\")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);", "label": 0, "label_name": "vulnerable"} +{"code": " public function uploadCustomLogoAction(Request $request)\n {\n $fileExt = File::getFileExtension($_FILES['Filedata']['name']);\n if (!in_array($fileExt, ['svg', 'png', 'jpg'])) {\n throw new \\Exception('Unsupported file format');\n }\n\n if($fileExt === 'svg') {\n if(strpos(file_get_contents($_FILES['Filedata']['tmp_name']), 'writeStream(self::CUSTOM_LOGO_PATH, fopen($_FILES['Filedata']['tmp_name'], 'rb'));\n\n // set content-type to text/html, otherwise (when application/json is sent) chrome will complain in\n // Ext.form.Action.Submit and mark the submission as failed\n\n $response = $this->adminJson(['success' => true]);\n $response->headers->set('Content-Type', 'text/html');\n\n return $response;\n }", "label": 1, "label_name": "safe"} +{"code": " $scope.deleteNode = function(node) {\n bootbox.confirm('Are you sure you want to remove the node ' + node.nodeLabel + '?', function(ok) {\n if (ok) {\n RequisitionsService.startTiming();\n RequisitionsService.deleteNode(node).then(\n function() { // success\n var index = -1;\n for(var i = 0; i < $scope.filteredNodes.length; i++) {\n if ($scope.filteredNodes[i].foreignId === node.foreignId) {\n index = i;\n }\n }\n if (index > -1) {\n $scope.filteredNodes.splice(index,1);\n }\n growl.success('The node ' + node.nodeLabel + ' has been deleted.');\n },\n $scope.errorHandler\n );\n }\n });\n };", "label": 0, "label_name": "vulnerable"} +{"code": " public RecurlyList GetAdjustments(Adjustment.AdjustmentType type = Adjustment.AdjustmentType.All,\n Adjustment.AdjustmentState state = Adjustment.AdjustmentState.Any)\n {\n var adjustments = new AdjustmentList();\n var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,\n UrlPrefix + Uri.EscapeUriString(AccountCode) + \"/adjustments/\"\n + Build.QueryStringWith(Adjustment.AdjustmentState.Any == state ? \"\" : \"state=\" + state.ToString().EnumNameToTransportCase())\n .AndWith(Adjustment.AdjustmentType.All == type ? \"\" : \"type=\" + type.ToString().EnumNameToTransportCase())\n , adjustments.ReadXmlList);\n\n return statusCode == HttpStatusCode.NotFound ? null : adjustments;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testImgRemoveInvalidAlign()\n {\n $this->assertResult(\n '\"foobar\"',\n '\"foobar\"'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) {\n if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {\n if (!session.getUpstream().isInitialized()) {\n session.getUpstream().setInitialized(true);\n session.login();\n\n for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) {\n if (!entity.isValid()) {\n SkinManager.requestAndHandleSkinAndCape(entity, session, null);\n entity.sendPlayer(session);\n }\n }\n\n // Send Skulls\n for (PlayerEntity entity : session.getSkullCache().values()) {\n entity.spawnEntity(session);\n\n SkullSkinManager.requestAndHandleSkin(entity, session, (skin) -> {\n entity.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false);\n entity.updateBedrockMetadata(session);\n });\n }\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": "find_start_brace(void)\t // XXX\n{\n pos_T\t cursor_save;\n pos_T\t *trypos;\n pos_T\t *pos;\n static pos_T pos_copy;\n\n cursor_save = curwin->w_cursor;\n while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)\n {\n\tpos_copy = *trypos;\t// copy pos_T, next findmatch will change it\n\ttrypos = &pos_copy;\n\tcurwin->w_cursor = *trypos;\n\tpos = NULL;\n\t// ignore the { if it's in a // or / * * / comment\n\tif ((colnr_T)cin_skip2pos(trypos) == trypos->col\n\t\t && (pos = ind_find_start_CORS(NULL)) == NULL) // XXX\n\t break;\n\tif (pos != NULL)\n\t curwin->w_cursor = *pos;\n }\n curwin->w_cursor = cursor_save;\n return trypos;\n}", "label": 1, "label_name": "safe"} +{"code": "func signatureFromJTI(jti string) string {\n\treturn fmt.Sprintf(\"%x\", sha256.Sum256([]byte(jti)))\n}", "label": 1, "label_name": "safe"} +{"code": " public function edit_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n \n //grab all user groups\n $group = new group();\n \n //create two 'default' groups:\n $groups = array( \n -1 => 'ALL LOGGED IN USERS',\n -2 => 'ALL NON-LOGGED IN USERS'\n );\n //loop our groups and append them to the array\n // foreach ($group->find() as $g){\n //this is a workaround for older code. Use the previous line if possible:\n $allGroups = group::getAllGroups();\n if (count($allGroups))\n {\n foreach ($allGroups as $g)\n {\n $groups[$g->id] = $g->name;\n };\n }\n //find our selected groups for this discount already\n // eDebug($discount); \n $selected_groups = array();\n if (!empty($discount->group_ids))\n {\n $selected_groups = expUnserialize($discount->group_ids);\n }\n \n if ($discount->minimum_order_amount == \"\") $discount->minimum_order_amount = 0;\n if ($discount->discount_amount == \"\") $discount->discount_amount = 0;\n if ($discount->discount_percent == \"\") $discount->discount_percent = 0;\n \n // get the shipping options and their methods\n $shipping_services = array();\n $shipping_methods = array();\n// $shipping = new shipping();\n foreach (shipping::listAvailableCalculators() as $calcid=>$name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }\n \n assign_to_template(array(\n 'discount'=>$discount,\n 'groups'=>$groups,\n 'selected_groups'=>$selected_groups,\n 'shipping_services'=>$shipping_services,\n 'shipping_methods'=>$shipping_methods\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " print_r($single_error);\n }\n\n echo '';\n }", "label": 0, "label_name": "vulnerable"} +{"code": "def get_wizard(params, request, auth_user)\n if not allowed_for_local_cluster(auth_user, Permissions::READ)\n return 403, 'Permission denied'\n end\n wizard = PCSDWizard.getWizard(params[\"wizard\"])\n if wizard != nil\n return erb wizard.collection_page\n else\n return \"Error finding Wizard - #{params[\"wizard\"]}\"\n end\nend", "label": 1, "label_name": "safe"} +{"code": "Blamer.prototype.blameByFile = function blameByFile(file, args) {\n if (!blamerVCS.hasOwnProperty(this.type)) {\n throw new Error('VCS \"' + this.type + '\" don\\'t supported');\n }\n args = typeof args === 'string' ? args : this.args;\n return blamerVCS[this.type](file, args);\n};", "label": 0, "label_name": "vulnerable"} +{"code": " void testSetOrdersPseudoHeadersCorrectly() {\n final HttpHeadersBase headers = newHttp2Headers();\n final HttpHeadersBase other = newEmptyHeaders();\n other.add(\"name2\", \"value2\");\n other.add(\"name3\", \"value3\");\n other.add(\"name4\", \"value4\");\n other.authority(\"foo\");\n\n final int headersSizeBefore = headers.size();\n headers.set(other);\n verifyPseudoHeadersFirst(headers);\n verifyAllPseudoHeadersPresent(headers);\n assertThat(headers.size()).isEqualTo(headersSizeBefore + 1);\n assertThat(headers.authority()).isEqualTo(\"foo\");\n assertThat(headers.get(\"name2\")).isEqualTo(\"value2\");\n assertThat(headers.get(\"name3\")).isEqualTo(\"value3\");\n assertThat(headers.get(\"name4\")).isEqualTo(\"value4\");\n }", "label": 1, "label_name": "safe"} +{"code": " public function __construct()\n {\n $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();\n $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();\n }", "label": 1, "label_name": "safe"} +{"code": "E=C.createElement(\"output\");C.appendChild(E);C=new mxXmlCanvas2D(E);C.translate(Math.floor((1-z.x)/L),Math.floor((1-z.y)/L));C.scale(1/L);var G=0,P=C.save;C.save=function(){G++;P.apply(this,arguments)};var J=C.restore;C.restore=function(){G--;J.apply(this,arguments)};var F=t.drawShape;t.drawShape=function(H){mxLog.debug(\"entering shape\",H,G);F.apply(this,arguments);mxLog.debug(\"leaving shape\",H,G)};t.drawState(m.getView().getState(m.model.root),C);mxLog.show();mxLog.debug(mxUtils.getXml(E));mxLog.debug(\"stateCounter\",", "label": 1, "label_name": "safe"} +{"code": "func (svc *Service) GetHost(ctx context.Context, id uint) (*fleet.HostDetail, error) {\n\talreadyAuthd := svc.authz.IsAuthenticatedWith(ctx, authz_ctx.AuthnDeviceToken)\n\tif !alreadyAuthd {\n\t\t// First ensure the user has access to list hosts, then check the specific\n\t\t// host once team_id is loaded.\n\t\tif err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionList); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\thost, err := svc.ds.Host(ctx, id, false)\n\tif err != nil {\n\t\treturn nil, ctxerr.Wrap(ctx, err, \"get host\")\n\t}\n\n\tif !alreadyAuthd {\n\t\t// Authorize again with team loaded now that we have team_id\n\t\tif err := svc.authz.Authorize(ctx, host, fleet.ActionRead); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn svc.getHostDetails(ctx, host)\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function test()\n {\n $this->def = new HTMLPurifier_AttrDef_CSS_Color();\n\n $this->assertDef('#F00');\n $this->assertDef('#fff');\n $this->assertDef('#eeeeee');\n $this->assertDef('#808080');\n\n $this->assertDef('rgb(255, 0, 0)', 'rgb(255,0,0)'); // rm spaces\n $this->assertDef('rgb(100%,0%,0%)');\n $this->assertDef('rgb(50.5%,23.2%,43.9%)'); // decimals okay\n $this->assertDef('rgb(-5,0,0)', 'rgb(0,0,0)'); // negative values\n $this->assertDef('rgb(295,0,0)', 'rgb(255,0,0)'); // max values\n $this->assertDef('rgb(12%,150%,0%)', 'rgb(12%,100%,0%)'); // percentage max values\n\n $this->assertDef('rgba(255, 0, 0, 0)', 'rgba(255,0,0,0)'); // rm spaces\n $this->assertDef('rgba(100%,0%,0%,0.4)');\n $this->assertDef('rgba(38.1%,59.7%,1.8%,0.7)', 'rgba(38.1%,59.7%,1.8%,0.7)'); // decimals okay\n\n $this->assertDef('hsl(275, 45%, 81%)', 'hsl(275,45%,81%)'); // rm spaces\n $this->assertDef('hsl(100,0%,0%)');\n $this->assertDef('hsl(38,59.7%,1.8%)', 'hsl(38,59.7%,1.8%)'); // decimals okay\n $this->assertDef('hsl(-11,-15%,25%)', 'hsl(0,0%,25%)'); // negative values\n $this->assertDef('hsl(380,125%,0%)', 'hsl(360,100%,0%)'); // max values\n\n $this->assertDef('hsla(100, 74%, 29%, 0)', 'hsla(100,74%,29%,0)'); // rm spaces\n $this->assertDef('hsla(154,87%,21%,0.4)');\n $this->assertDef('hsla(45,94.3%,4.1%,0.7)', 'hsla(45,94.3%,4.1%,0.7)'); // decimals okay\n\n $this->assertDef('#G00', false);\n $this->assertDef('cmyk(40, 23, 43, 23)', false);\n $this->assertDef('rgb(0%, 23, 68%)', false); // no mixed type\n $this->assertDef('rgb(231, 144, 28.2%)', false); // no mixed type\n $this->assertDef('hsl(18%,12%,89%)', false); // integer, percentage, percentage\n\n // clip numbers outside sRGB gamut\n $this->assertDef('rgb(200%, -10%, 0%)', 'rgb(100%,0%,0%)');\n $this->assertDef('rgb(256,-23,34)', 'rgb(255,0,34)');\n\n // color keywords, of course\n $this->assertDef('red', '#FF0000');\n\n // malformed hex declaration\n $this->assertDef('808080', '#808080');\n $this->assertDef('000000', '#000000');\n $this->assertDef('fed', '#fed');\n\n // maybe hex transformations would be another nice feature\n // at the very least transform rgb percent to rgb integer\n\n }", "label": 1, "label_name": "safe"} +{"code": "void BlockCodec::runPull()\n{\n\tAFframecount framesToRead = m_outChunk->frameCount;\n\tAFframecount framesRead = 0;\n\n\tassert(framesToRead % m_framesPerPacket == 0);\n\tint blockCount = framesToRead / m_framesPerPacket;\n\n\t// Read the compressed data.\n\tssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);\n\tint blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0;\n\n\t// Decompress into m_outChunk.\n\tfor (int i=0; i(m_inChunk->buffer) + i * m_bytesPerPacket,\n\t\t\tstatic_cast(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount);\n\n\t\tframesRead += m_framesPerPacket;\n\t}\n\n\tm_track->nextfframe += framesRead;\n\n\tassert(tell() == m_track->fpos_next_frame);\n\n\tif (framesRead < framesToRead)\n\t\treportReadError(framesRead, framesToRead);\n\n\tm_outChunk->frameCount = framesRead;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " var VideoDialog = function (context) {\n var self = this;\n var ui = $.summernote.ui;\n\n var $editor = context.layoutInfo.editor;\n var options = context.options;\n var lang = options.langInfo;\n\n this.initialize = function () {\n var $container = options.dialogsInBody ? $(document.body) : $editor;\n\n var body = '
' +\n '' +\n '' +\n '
';\n var footer = '';\n\n this.$dialog = ui.dialog({\n title: lang.video.insert,\n fade: options.dialogsFade,\n body: body,\n footer: footer\n }).render().appendTo($container);\n };\n\n this.destroy = function () {\n ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n };\n\n this.bindEnterKey = function ($input, $btn) {\n $input.on('keypress', function (event) {\n if (event.keyCode === key.code.ENTER) {\n $btn.trigger('click');\n }\n });\n };\n\n this.createVideoNode = function (url) {\n // video url patterns(youtube, instagram, vimeo, dailymotion, youku, mp4, ogg, webm)\n var ytRegExp = /^(?:https?:\\/\\/)?(?:www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))((\\w|-){11})(?:\\S+)?$/;\n var ytMatch = url.match(ytRegExp);\n\n var igRegExp = /\\/\\/instagram.com\\/p\\/(.[a-zA-Z0-9_-]*)/;\n var igMatch = url.match(igRegExp);\n\n var vRegExp = /\\/\\/vine.co\\/v\\/(.[a-zA-Z0-9]*)/;\n var vMatch = url.match(vRegExp);\n\n var vimRegExp = /\\/\\/(player.)?vimeo.com\\/([a-z]*\\/)*([0-9]{6,11})[?]?.*/;\n var vimMatch = url.match(vimRegExp);\n\n var dmRegExp = /.+dailymotion.com\\/(video|hub)\\/([^_]+)[^#]*(#video=([^_&]+))?/;\n var dmMatch = url.match(dmRegExp);\n\n var youkuRegExp = /\\/\\/v\\.youku\\.com\\/v_show\\/id_(\\w+)=*\\.html/;\n var youkuMatch = url.match(youkuRegExp);\n\n var mp4RegExp = /^.+.(mp4|m4v)$/;\n var mp4Match = url.match(mp4RegExp);\n\n var oggRegExp = /^.+.(ogg|ogv)$/;\n var oggMatch = url.match(oggRegExp);\n\n var webmRegExp = /^.+.(webm)$/;\n var webmMatch = url.match(webmRegExp);\n\n var $video;\n if (ytMatch && ytMatch[1].length === 11) {\n var youtubeId = ytMatch[1];\n $video = $('';\r\n core_terminate();\r\n break;\r\n\r\n case 'remove':\r\n // check the theme is not actually used in any website\r\n $usages = $DB->query_single(\r\n 'COUNT(*)',\r\n 'nv_websites',\r\n ' theme = :theme',\r\n null,\r\n array(\r\n ':theme' => $_REQUEST['theme']\r\n )\r\n );\r\n if($usages == 0)\r\n {\r\n try\r\n {\r\n $theme = new theme();\r\n $theme->load($_REQUEST['theme']);\r\n $status = $theme->delete();\r\n echo json_encode($status);\r\n }\r\n catch(Exception $e)\r\n {\r\n echo $e->getMessage();\r\n }\r\n }\r\n else\r\n {\r\n $status = t(537, \"Can't remove the theme because it is currently being used by another website.\");\r\n echo $status;\r\n }\r\n core_terminate();\r\n break;\r\n\r\n /*\r\n case 'export':\r\n $out = themes_export_form();\r\n break;\r\n */\r\n\r\n case 'theme_sample_content_import':\r\n try\r\n {\r\n $theme->import_sample();\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n catch(Exception $e)\r\n {\r\n $layout->navigate_notification($e->getMessage(), true, true);\r\n }\r\n\r\n $themes = theme::list_available();\r\n $out = themes_grid($themes);\r\n break;\r\n\r\n case 'theme_sample_content_export':\r\n if(empty($_POST))\r\n $out = themes_sample_content_export_form();\r\n else\r\n {\r\n $categories = explode(',', $_POST['categories']);\r\n $folder = $_POST['folder'];\r\n $items = explode(',', $_POST['elements']);\r\n $block_groups = explode(',', $_POST['block_groups']);\r\n $blocks = explode(',', $_POST['blocks']);\r\n $comments = explode(',', $_POST['comments']);\r\n\r\n theme::export_sample($categories, $items, $block_groups, $blocks, $comments, $folder);\r\n\r\n core_terminate();\r\n }\r\n break;\r\n\r\n case 'install_from_hash':\r\n $url = base64_decode($_GET['hash']);\r\n\r\n if(!empty($url) && $user->permission(\"themes.install\")==\"true\")\r\n {\r\n $error = false;\r\n parse_str(parse_url($url, PHP_URL_QUERY), $query);\r\n\r\n $tmp_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $query['code'] . '.zip';\r\n @core_file_curl($url, $tmp_file);\r\n if(@filesize($tmp_file) == 0)\r\n {\r\n @unlink($tmp_file);\r\n // core file curl failed, try using file_get_contents...\r\n $tmp = @file_get_contents($url);\r\n if(!empty($tmp))\r\n {\r\n @file_put_contents($tmp_file, $tmp);\r\n }\r\n unset($tmp);\r\n }\r\n\r\n if(@filesize($tmp_file) > 0)\r\n {\r\n // uncompress ZIP and copy it to the themes dir\r\n @mkdir(NAVIGATE_PATH.'/themes/'.$query['code']);\r\n\r\n $zip = new ZipArchive();\r\n $zip_open_status = $zip->open($tmp_file);\r\n if($zip_open_status === TRUE)\r\n {\r\n $zip->extractTo(NAVIGATE_PATH.'/themes/'.$query['code']);\r\n $zip->close();\r\n\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n else // zip extraction failed\r\n {\r\n $layout->navigate_notification('ERROR '.$zip_open_status, true, true);\r\n $error = true;\r\n }\r\n }\r\n else\r\n {\r\n $layout->navigate_notification(t(56, 'Unexpected error'), true, true);\r\n $error = true;\r\n }\r\n\r\n if($error)\r\n {\r\n $layout->add_content('\r\n
\r\n

'.t(529, \"It has not been possible to download the item you have just bought from the marketplace.\").'

\r\n

'.t(530, \"You have to visit your Marketplace Dashboard and download the file, then use the Install from file button you'll find in the actions bar on the right.\").'

\r\n

'.t(531, \"Sorry for the inconvenience.\").'

\r\n '.t(532, \"Navigate CMS Marketplace\").'\r\n
\r\n ');\r\n $layout->add_script('\r\n $(\"#navigate_marketplace_install_from_hash_error\").dialog({\r\n modal: true,\r\n title: \"'.t(56, \"Unexpected error\").'\"\r\n });\r\n ');\r\n }\r\n }\r\n // don't break, we want to show the themes grid right now (theme_upload by browser upload won't trigger)\r\n\r\n case 'theme_upload':\r\n if(isset($_FILES['theme-upload']) && $_FILES['theme-upload']['error']==0 && $user->permission(\"themes.install\")==\"true\")\r\n {\r\n // uncompress ZIP and copy it to the themes dir\r\n $tmp = trim(substr($_FILES['theme-upload']['name'], 0, strpos($_FILES['theme-upload']['name'], '.')));\r\n $theme_name = filter_var($tmp, FILTER_SANITIZE_EMAIL);\r\n\r\n if($tmp!=$theme_name) // INVALID file name\r\n {\r\n $layout->navigate_notification(t(344, 'Security error'), true, true);\r\n }\r\n else\r\n {\r\n @mkdir(NAVIGATE_PATH.'/themes/'.$theme_name);\r\n\r\n $zip = new ZipArchive;\r\n if($zip->open($_FILES['theme-upload']['tmp_name']) === TRUE)\r\n {\r\n $zip->extractTo(NAVIGATE_PATH.'/themes/'.$theme_name);\r\n $zip->close();\r\n\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n else // zip extraction failed\r\n {\r\n $layout->navigate_notification(t(262, 'Error uploading file'), true, true);\r\n }\r\n }\r\n }\r\n // don't break, we want to show the themes grid right now\r\n\r\n case 'themes':\r\n default:\r\n if(@$_REQUEST['opt']=='install')\r\n {\r\n $ntheme = new theme();\r\n $ntheme->load($_REQUEST['theme']);\r\n\r\n $website->theme = $ntheme->name;\r\n\r\n if(!empty($ntheme->styles))\r\n {\r\n $nst = get_object_vars($ntheme->styles);\r\n $nst = array_keys($nst);\r\n\r\n if(!isset($website->theme_options) || empty($website->theme_options))\r\n $website->theme_options = json_decode('{\"style\": \"\"}');\r\n $website->theme_options->style = array_shift($nst);\r\n }\r\n else\r\n {\r\n if(!isset($website->theme_options) || empty($website->theme_options))\r\n $website->theme_options = json_decode('{\"style\": \"\"}');\r\n else\r\n $website->theme_options->style = \"\";\r\n }\r\n\r\n try\r\n {\r\n $website->update();\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n catch(Exception $e)\r\n {\r\n $layout->navigate_notification($e->getMessage(), true, true);\r\n }\r\n }\r\n\r\n $themes = theme::list_available();\r\n\r\n $out = themes_grid($themes);\r\n break;\r\n\r\n }\r\n\t\r\n\treturn $out;\r\n}\r", "label": 1, "label_name": "safe"} +{"code": "apiUsers.createPublicAccount = function (req, res) {\n const SettingSchema = require('../../../models/setting')\n\n const response = {}\n response.success = true\n const postData = req.body\n if (!_.isObject(postData)) return res.status(400).json({ success: false, error: 'Invalid Post Data' })\n\n let user, group\n\n async.waterfall(\n [\n function (next) {\n SettingSchema.getSetting('allowUserRegistration:enable', function (err, allowUserRegistration) {\n if (err) return next(err)\n if (!allowUserRegistration) {\n winston.warn('Public account creation was attempted while disabled!')\n return next({ message: 'Public account creation is disabled.' })\n }\n\n return next()\n })\n },\n function (next) {\n SettingSchema.getSetting('role:user:default', function (err, roleDefault) {\n if (err) return next(err)\n if (!roleDefault) {\n winston.error('No Default User Role Set. (Settings > Permissions > Default User Role)')\n return next({ message: 'No Default Role Set. Please contact administrator.' })\n }\n\n return next(null, roleDefault)\n })\n },\n function (roleDefault, next) {\n SettingSchema.getSetting('accountsPasswordComplexity:enable', function (err, passwordComplexitySetting) {\n if (err) return next(err)\n if (!passwordComplexitySetting || passwordComplexitySetting.value === true) {\n const passwordComplexity = require('../../../settings/passwordComplexity')\n if (!passwordComplexity.validate(postData.user.password))\n return next({ message: 'Password does not minimum requirements.' })\n\n return next(null, roleDefault)\n }\n\n return next(null, roleDefault)\n })\n },\n function (roleDefault, next) {\n const UserSchema = require('../../../models/user')\n user = new UserSchema({\n username: postData.user.email,\n password: postData.user.password,\n fullname: postData.user.fullname,\n email: postData.user.email,\n role: roleDefault.value\n })\n\n user.save(function (err, savedUser) {\n if (err) return next(err)\n\n return next(null, savedUser)\n })\n },\n function (savedUser, next) {\n const GroupSchema = require('../../../models/group')\n group = new GroupSchema({\n name: savedUser.email,\n members: [savedUser._id],\n sendMailTo: [savedUser._id],\n public: true\n })\n\n group.save(function (err, savedGroup) {\n if (err) return next(err)\n\n return next(null, { user: savedUser, group: savedGroup })\n })\n }\n ],\n function (err, result) {\n if (err) winston.debug(err)\n if (err) return res.status(400).json({ success: false, error: err.message })\n\n delete result.user.password\n result.user.password = undefined\n\n return res.json({\n success: true,\n userData: { user: result.user, group: result.group }\n })\n }\n )\n}", "label": 1, "label_name": "safe"} +{"code": " is: function(ch, chars) {\n return chars.indexOf(ch) !== -1;\n },", "label": 0, "label_name": "vulnerable"} +{"code": "Graph.fileSupport&&(D.addEventListener(\"dragover\",function(v){v.stopPropagation();v.preventDefault()},!1),D.addEventListener(\"drop\",function(v){v.stopPropagation();v.preventDefault();if(0nicEvent = TRUE;\n //Notify the TCP/IP stack of the event\n flag |= osSetEventFromIsr(&netEvent);\n }\n\n //Packet received?\n if((status & EIR_PKTIF) != 0)\n {\n //Disable PKTIE interrupt\n enc28j60ClearBit(interface, ENC28J60_REG_EIE, EIE_PKTIE);\n\n //Set event flag\n interface->nicEvent = TRUE;\n //Notify the TCP/IP stack of the event\n flag |= osSetEventFromIsr(&netEvent);\n }\n\n //Packet transmission complete?\n if((status & (EIR_TXIF | EIE_TXERIE)) != 0)\n {\n //Clear interrupt flags\n enc28j60ClearBit(interface, ENC28J60_REG_EIR, EIR_TXIF | EIE_TXERIE);\n\n //Notify the TCP/IP stack that the transmitter is ready to send\n flag |= osSetEventFromIsr(&interface->nicTxEvent);\n }\n\n //Once the interrupt has been serviced, the INTIE bit\n //is set again to re-enable interrupts\n enc28j60SetBit(interface, ENC28J60_REG_EIE, EIE_INTIE);\n\n //A higher priority task must be woken?\n return flag;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\tlocked : !phash ? true : file.rm === void(0) ? false : !file.rm\n\t\t\t};\n\t\t\n\t\tif (file.mime == 'application/x-empty' || file.mime == 'inode/x-empty') {\n\t\t\tinfo.mime = 'text/plain';\n\t\t}\n\t\tif (file.linkTo) {\n\t\t\tinfo.alias = file.linkTo;\n\t\t}\n\n\t\tif (file.linkTo) {\n\t\t\tinfo.linkTo = file.linkTo;\n\t\t}\n\t\t\n\t\tif (file.tmb) {\n\t\t\tinfo.tmb = file.tmb;\n\t\t} else if (info.mime.indexOf('image/') === 0 && tmb) {\n\t\t\tinfo.tmb = 1;\n\t\t\t\n\t\t}\n\n\t\tif (file.dirs && file.dirs.length) {\n\t\t\tinfo.dirs = true;\n\t\t}\n\t\tif (file.dim) {\n\t\t\tinfo.dim = file.dim;\n\t\t}\n\t\tif (file.resize) {\n\t\t\tinfo.resize = file.resize;\n\t\t}\n\t\treturn info;\n\t}", "label": 1, "label_name": "safe"} +{"code": "int ntlm_read_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)\n{\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn -1;\n\n\tStream_Read_UINT16(s, fields->Len); /* Len (2 bytes) */\n\tStream_Read_UINT16(s, fields->MaxLen); /* MaxLen (2 bytes) */\n\tStream_Read_UINT32(s, fields->BufferOffset); /* BufferOffset (4 bytes) */\n\treturn 1;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " private function elementInScope($el, $table = false) {\n if(is_array($el)) {\n foreach($el as $element) {\n if($this->elementInScope($element, $table)) {\n return true;\n }\n }\n\n return false;\n }\n\n $leng = count($this->stack);\n\n for($n = 0; $n < $leng; $n++) {\n /* 1. Initialise node to be the current node (the bottommost node of\n the stack). */\n $node = $this->stack[$leng - 1 - $n];\n\n if($node->tagName === $el) {\n /* 2. If node is the target node, terminate in a match state. */\n return true;\n\n } elseif($node->tagName === 'table') {\n /* 3. Otherwise, if node is a table element, terminate in a failure\n state. */\n return false;\n\n } elseif($table === true && in_array($node->tagName, array('caption', 'td',\n 'th', 'button', 'marquee', 'object'))) {\n /* 4. Otherwise, if the algorithm is the \"has an element in scope\"\n variant (rather than the \"has an element in table scope\" variant),\n and node is one of the following, terminate in a failure state. */\n return false;\n\n } elseif($node === $node->ownerDocument->documentElement) {\n /* 5. Otherwise, if node is an html element (root element), terminate\n in a failure state. (This can only happen if the node is the topmost\n node of the stack of open elements, and prevents the next step from\n being invoked if there are no more elements in the stack.) */\n return false;\n }\n\n /* Otherwise, set node to the previous entry in the stack of open\n elements and return to step 2. (This will never fail, since the loop\n will always terminate in the previous step if the top of the stack\n is reached.) */\n }\n }", "label": 1, "label_name": "safe"} +{"code": " it \"does not raise error if record is not pending\" do\n reviewable = ReviewableUser.needs_review!(target: Fabricate(:user, email: invite.email), created_by: invite.invited_by)\n reviewable.status = Reviewable.statuses[:ignored]\n reviewable.save!\n invite_redeemer.redeem\n\n reviewable.reload\n expect(reviewable.status).to eq(Reviewable.statuses[:ignored])\n end", "label": 0, "label_name": "vulnerable"} +{"code": " title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource),\n buttons: {\n fullSync: {\n label: 'Yes',\n className: 'btn-primary',\n callback: function() {\n doSynchronize(requisition, 'true');\n }\n },\n dbOnlySync: {\n label: 'DB Only',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'dbonly');\n }\n },\n ignoreExistingSync: {\n label: 'No',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'false');\n }\n },\n main: {\n label: 'Cancel',\n className: 'btn-secondary'\n }\n }\n });\n }", "label": 1, "label_name": "safe"} +{"code": "\tprivate function _notlinksto( $option ) {\n\t\tif ( $this->parameters->getParameter( 'distinct' ) == 'strict' ) {\n\t\t\t$this->addGroupBy( 'page_title' );\n\t\t}\n\t\tif ( count( $option ) ) {\n\t\t\t$where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['pagelinks'] . '.pl_from FROM ' . $this->tableNames['pagelinks'] . ' WHERE ';\n\t\t\t$ors = [];\n\t\t\tforeach ( $option as $linkGroup ) {\n\t\t\t\tforeach ( $linkGroup as $link ) {\n\t\t\t\t\t$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . intval( $link->getNamespace() );\n\t\t\t\t\tif ( strpos( $link->getDbKey(), '%' ) >= 0 ) {\n\t\t\t\t\t\t$operator = 'LIKE';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$operator = '=';\n\t\t\t\t\t}\n\t\t\t\t\tif ( $this->parameters->getParameter( 'ignorecase' ) ) {\n\t\t\t\t\t\t$_or .= ' AND LOWER(CAST(' . $this->tableNames['pagelinks'] . '.pl_title AS char)) ' . $operator . ' LOWER(' . $this->DB->addQuotes( $link->getDbKey() ) . '))';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_or .= ' AND ' . $this->tableNames['pagelinks'] . '.pl_title ' . $operator . ' ' . $this->DB->addQuotes( $link->getDbKey() ) . ')';\n\t\t\t\t\t}\n\t\t\t\t\t$ors[] = $_or;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$where .= '(' . implode( ' OR ', $ors ) . '))';\n\t\t}\n\t\t$this->addWhere( $where );\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " default List getPermissions() {\n List permissions = new ArrayList<>();\n permissions.add(\"*:*\");\n permissions.add(this.getName().replace('_', ':'));\n permissions.add(this.getName().substring(0, this.getName().indexOf('_')) + \":*\");\n return permissions;\n };", "label": 0, "label_name": "vulnerable"} +{"code": " $this->stack[0]->appendChild($comment);\n\n /* An end tag with the tag name \"html\" */\n } elseif($token['type'] === HTML5::ENDTAG && $token['name'] === 'html') {\n /* If the parser was originally created in order to handle the\n setting of an element's innerHTML attribute, this is a parse error;\n ignore the token. (The element will be an html element in this\n case.) (innerHTML case) */\n\n /* Otherwise, switch to the trailing end phase. */\n $this->phase = self::END_PHASE;\n\n /* Anything else */\n } else {\n /* Parse error. Set the insertion mode to \"in body\" and reprocess\n the token. */\n $this->mode = self::IN_BODY;\n return $this->inBody($token);\n }\n }", "label": 1, "label_name": "safe"} +{"code": " def read_config(self, config, **kwargs):\n self.recaptcha_private_key = config.get(\"recaptcha_private_key\")\n self.recaptcha_public_key = config.get(\"recaptcha_public_key\")\n self.enable_registration_captcha = config.get(\n \"enable_registration_captcha\", False\n )\n self.recaptcha_siteverify_api = config.get(\n \"recaptcha_siteverify_api\",\n \"https://www.recaptcha.net/recaptcha/api/siteverify\",\n )\n self.recaptcha_template = self.read_template(\"recaptcha.html\")", "label": 1, "label_name": "safe"} +{"code": " def initialize(string)\n super(\"'#{string}' is not a valid object id.\")\n end", "label": 0, "label_name": "vulnerable"} +{"code": "config_monitor(\n\tconfig_tree *ptree\n\t)\n{\n\tint_node *pfilegen_token;\n\tconst char *filegen_string;\n\tconst char *filegen_file;\n\tFILEGEN *filegen;\n\tfilegen_node *my_node;\n\tattr_val *my_opts;\n\tint filegen_type;\n\tint filegen_flag;\n\n\t/* Set the statistics directory */\n\tif (ptree->stats_dir)\n\t\tstats_config(STATS_STATSDIR, ptree->stats_dir);\n\n\t/* NOTE:\n\t * Calling filegen_get is brain dead. Doing a string\n\t * comparison to find the relavant filegen structure is\n\t * expensive.\n\t *\n\t * Through the parser, we already know which filegen is\n\t * being specified. Hence, we should either store a\n\t * pointer to the specified structure in the syntax tree\n\t * or an index into a filegen array.\n\t *\n\t * Need to change the filegen code to reflect the above.\n\t */\n\n\t/* Turn on the specified statistics */\n\tpfilegen_token = HEAD_PFIFO(ptree->stats_list);\n\tfor (; pfilegen_token != NULL; pfilegen_token = pfilegen_token->link) {\n\t\tfilegen_string = keyword(pfilegen_token->i);\n\t\tfilegen = filegen_get(filegen_string);\n\t\tif (NULL == filegen) {\n\t\t\tmsyslog(LOG_ERR,\n\t\t\t\t\"stats %s unrecognized\",\n\t\t\t\tfilegen_string);\n\t\t\tcontinue;\n\t\t}\n\t\tDPRINTF(4, (\"enabling filegen for %s statistics '%s%s'\\n\",\n\t\t\t filegen_string, filegen->prefix, \n\t\t\t filegen->basename));\n\t\tfilegen->flag |= FGEN_FLAG_ENABLED;\n\t}\n\n\t/* Configure the statistics with the options */\n\tmy_node = HEAD_PFIFO(ptree->filegen_opts);\n\tfor (; my_node != NULL; my_node = my_node->link) {\n\t\tfilegen_file = keyword(my_node->filegen_token);\n\t\tfilegen = filegen_get(filegen_file);\n\t\tif (NULL == filegen) {\n\t\t\tmsyslog(LOG_ERR,\n\t\t\t\t\"filegen category '%s' unrecognized\",\n\t\t\t\tfilegen_file);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Initialize the filegen variables to their pre-configuration states */\n\t\tfilegen_flag = filegen->flag;\n\t\tfilegen_type = filegen->type;\n\n\t\t/* \"filegen ... enabled\" is the default (when filegen is used) */\n\t\tfilegen_flag |= FGEN_FLAG_ENABLED;\n\n\t\tmy_opts = HEAD_PFIFO(my_node->options);\n\t\tfor (; my_opts != NULL; my_opts = my_opts->link) {\n\t\t\tswitch (my_opts->attr) {\n\n\t\t\tcase T_File:\n\t\t\t\tfilegen_file = my_opts->value.s;\n\t\t\t\tbreak;\n\n\t\t\tcase T_Type:\n\t\t\t\tswitch (my_opts->value.i) {\n\n\t\t\t\tdefault:\n\t\t\t\t\tNTP_INSIST(0);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_None:\n\t\t\t\t\tfilegen_type = FILEGEN_NONE;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Pid:\n\t\t\t\t\tfilegen_type = FILEGEN_PID;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Day:\n\t\t\t\t\tfilegen_type = FILEGEN_DAY;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Week:\n\t\t\t\t\tfilegen_type = FILEGEN_WEEK;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Month:\n\t\t\t\t\tfilegen_type = FILEGEN_MONTH;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Year:\n\t\t\t\t\tfilegen_type = FILEGEN_YEAR;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Age:\n\t\t\t\t\tfilegen_type = FILEGEN_AGE;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase T_Flag:\n\t\t\t\tswitch (my_opts->value.i) {\n\n\t\t\t\tcase T_Link:\n\t\t\t\t\tfilegen_flag |= FGEN_FLAG_LINK;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Nolink:\n\t\t\t\t\tfilegen_flag &= ~FGEN_FLAG_LINK;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Enable:\n\t\t\t\t\tfilegen_flag |= FGEN_FLAG_ENABLED;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Disable:\n\t\t\t\t\tfilegen_flag &= ~FGEN_FLAG_ENABLED;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tmsyslog(LOG_ERR, \n\t\t\t\t\t\t\"Unknown filegen flag token %d\",\n\t\t\t\t\t\tmy_opts->value.i);\n\t\t\t\t\texit(1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmsyslog(LOG_ERR,\n\t\t\t\t\t\"Unknown filegen option token %d\",\n\t\t\t\t\tmy_opts->attr);\n\t\t\t\texit(1);\n\t\t\t}\n\t\t}\n\t\tfilegen_config(filegen, filegen_file, filegen_type,\n\t\t\t filegen_flag);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "CKEDITOR.ui.prototype={add:function(a,e,b){b.name=a.toLowerCase();var c=this.items[a]={type:e,command:b.command||null,args:Array.prototype.slice.call(arguments,2)};CKEDITOR.tools.extend(c,b)},get:function(a){return this.instances[a]},create:function(a){var e=this.items[a],b=e&&this._.handlers[e.type],c=e&&e.command&&this.editor.getCommand(e.command),b=b&&b.create.apply(this,e.args);this.instances[a]=b;c&&c.uiItems.push(b);if(b&&!b.type)b.type=e.type;return b},addHandler:function(a,e){this._.handlers[a]=\ne},space:function(a){return CKEDITOR.document.getById(this.spaceId(a))},spaceId:function(a){return this.editor.id+\"_\"+a}};CKEDITOR.event.implementOn(CKEDITOR.ui);", "label": 1, "label_name": "safe"} +{"code": " Button.prototype.setState = function (state) {\n var d = 'disabled'\n var $el = this.$element\n var val = $el.is('input') ? 'val' : 'html'\n var data = $el.data()\n\n state += 'Text'\n\n if (data.resetText == null) $el.data('resetText', $el[val]())\n\n // push to event loop to allow forms to submit\n setTimeout($.proxy(function () {\n $el[val](data[state] == null ? this.options[state] : data[state])\n\n if (state == 'loadingText') {\n this.isLoading = true\n $el.addClass(d).attr(d, d)\n } else if (this.isLoading) {\n this.isLoading = false\n $el.removeClass(d).removeAttr(d)\n }\n }, this), 0)\n }", "label": 0, "label_name": "vulnerable"} +{"code": " html: Buffer.from('

Tere, tere

vana kere!

\\n')\n }\n };\n shared.resolveContent(mail.data, 'html', function (err, value) {\n expect(err).to.not.exist;\n expect(value).to.deep.equal(mail.data.html);\n done();\n });\n });", "label": 1, "label_name": "safe"} +{"code": " public static function checkPermissions($permission,$location) {\r\n global $exponent_permissions_r, $router;\r\n\r\n // only applies to the 'manage' method\r\n if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) {\r\n if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {\r\n foreach ($page as $pageperm) {\r\n if (!empty($pageperm['manage'])) return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "\twp.updates.requestForCredentialsModalCancel = function() {\n\t\t// no updateLock and no updateQueue means we already have cleared things up\n\t\tvar data, $message;\n\n\t\tif( wp.updates.updateLock === false && wp.updates.updateQueue.length === 0 ){\n\t\t\treturn;\n\t\t}\n\n\t\tdata = wp.updates.updateQueue[0].data;\n\n\t\t// remove the lock, and clear the queue\n\t\twp.updates.updateLock = false;\n\t\twp.updates.updateQueue = [];\n\n\t\twp.updates.requestForCredentialsModalClose();\n\t\tif ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {\n\t\t\t$message = $( '[data-plugin=\"' + data.plugin + '\"]' ).next().find( '.update-message' );\n\t\t} else if ( 'plugin-install' === pagenow ) {\n\t\t\t$message = $( '.plugin-card-' + data.slug ).find( '.update-now' );\n\t\t}\n\n\t\t$message.removeClass( 'updating-message' );\n\t\t$message.html( $message.data( 'originaltext' ) );\n\t\twp.a11y.speak( wp.updates.l10n.updateCancel );\n\t};", "label": 0, "label_name": "vulnerable"} +{"code": "struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)\n{\n\tstruct tcp_options_received tcp_opt;\n\tstruct inet_request_sock *ireq;\n\tstruct tcp_request_sock *treq;\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct tcp_sock *tp = tcp_sk(sk);\n\tconst struct tcphdr *th = tcp_hdr(skb);\n\t__u32 cookie = ntohl(th->ack_seq) - 1;\n\tstruct sock *ret = sk;\n\tstruct request_sock *req;\n\tint mss;\n\tstruct dst_entry *dst;\n\t__u8 rcv_wscale;\n\n\tif (!sysctl_tcp_syncookies || !th->ack || th->rst)\n\t\tgoto out;\n\n\tif (tcp_synq_no_recent_overflow(sk))\n\t\tgoto out;\n\n\tmss = __cookie_v6_check(ipv6_hdr(skb), th, cookie);\n\tif (mss == 0) {\n\t\tNET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESFAILED);\n\t\tgoto out;\n\t}\n\n\tNET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESRECV);\n\n\t/* check for timestamp cookie support */\n\tmemset(&tcp_opt, 0, sizeof(tcp_opt));\n\ttcp_parse_options(skb, &tcp_opt, 0, NULL);\n\n\tif (!cookie_timestamp_decode(&tcp_opt))\n\t\tgoto out;\n\n\tret = NULL;\n\treq = inet_reqsk_alloc(&tcp6_request_sock_ops, sk, false);\n\tif (!req)\n\t\tgoto out;\n\n\tireq = inet_rsk(req);\n\ttreq = tcp_rsk(req);\n\ttreq->tfo_listener = false;\n\n\tif (security_inet_conn_request(sk, skb, req))\n\t\tgoto out_free;\n\n\treq->mss = mss;\n\tireq->ir_rmt_port = th->source;\n\tireq->ir_num = ntohs(th->dest);\n\tireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;\n\tireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;\n\tif (ipv6_opt_accepted(sk, skb, &TCP_SKB_CB(skb)->header.h6) ||\n\t np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||\n\t np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {\n\t\tatomic_inc(&skb->users);\n\t\tireq->pktopts = skb;\n\t}\n\n\tireq->ir_iif = sk->sk_bound_dev_if;\n\t/* So that link locals have meaning */\n\tif (!sk->sk_bound_dev_if &&\n\t ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)\n\t\tireq->ir_iif = tcp_v6_iif(skb);\n\n\tireq->ir_mark = inet_request_mark(sk, skb);\n\n\treq->num_retrans = 0;\n\tireq->snd_wscale\t= tcp_opt.snd_wscale;\n\tireq->sack_ok\t\t= tcp_opt.sack_ok;\n\tireq->wscale_ok\t\t= tcp_opt.wscale_ok;\n\tireq->tstamp_ok\t\t= tcp_opt.saw_tstamp;\n\treq->ts_recent\t\t= tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;\n\ttreq->snt_synack.v64\t= 0;\n\ttreq->rcv_isn = ntohl(th->seq) - 1;\n\ttreq->snt_isn = cookie;\n\n\t/*\n\t * We need to lookup the dst_entry to get the correct window size.\n\t * This is taken from tcp_v6_syn_recv_sock. Somebody please enlighten\n\t * me if there is a preferred way.\n\t */\n\t{\n\t\tstruct in6_addr *final_p, final;\n\t\tstruct flowi6 fl6;\n\t\tmemset(&fl6, 0, sizeof(fl6));\n\t\tfl6.flowi6_proto = IPPROTO_TCP;\n\t\tfl6.daddr = ireq->ir_v6_rmt_addr;\n\t\tfinal_p = fl6_update_dst(&fl6, np->opt, &final);\n\t\tfl6.saddr = ireq->ir_v6_loc_addr;\n\t\tfl6.flowi6_oif = sk->sk_bound_dev_if;\n\t\tfl6.flowi6_mark = ireq->ir_mark;\n\t\tfl6.fl6_dport = ireq->ir_rmt_port;\n\t\tfl6.fl6_sport = inet_sk(sk)->inet_sport;\n\t\tsecurity_req_classify_flow(req, flowi6_to_flowi(&fl6));\n\n\t\tdst = ip6_dst_lookup_flow(sk, &fl6, final_p);\n\t\tif (IS_ERR(dst))\n\t\t\tgoto out_free;\n\t}\n\n\treq->rsk_window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);\n\ttcp_select_initial_window(tcp_full_space(sk), req->mss,\n\t\t\t\t &req->rsk_rcv_wnd, &req->rsk_window_clamp,\n\t\t\t\t ireq->wscale_ok, &rcv_wscale,\n\t\t\t\t dst_metric(dst, RTAX_INITRWND));\n\n\tireq->rcv_wscale = rcv_wscale;\n\tireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), dst);\n\n\tret = tcp_get_cookie_sock(sk, skb, req, dst);\nout:\n\treturn ret;\nout_free:\n\treqsk_free(req);\n\treturn NULL;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "export function updateGlobalState(key: string, value: any) {\n\tif (!globalState) {\n\t\treturn;\n\t}\n\treturn globalState.update(key, value);\n}", "label": 1, "label_name": "safe"} +{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"upcase\")).to eq(\"function_upcase\")\n end", "label": 0, "label_name": "vulnerable"} +{"code": " Status FillCollectiveParams(CollectiveParams* col_params,\n CollectiveType collective_type,\n const Tensor& group_size, const Tensor& group_key,\n const Tensor& instance_key) {\n if (group_size.dims() > 0) {\n return errors::InvalidArgument(\n \"Unexpected dimensions on input group_size, got \",\n group_size.shape().DebugString());\n }\n if (group_key.dims() > 0) {\n return errors::InvalidArgument(\n \"Unexpected dimensions on input group_key, got \",\n group_key.shape().DebugString());\n }\n if (instance_key.dims() > 0) {\n return errors::InvalidArgument(\n \"Unexpected dimensions on input instance_key, got \",\n instance_key.shape().DebugString());\n }\n col_params->name = name_;\n col_params->group.device_type = device_type_;\n col_params->group.group_size = group_size.unaligned_flat()(0);\n if (col_params->group.group_size <= 0) {\n return errors::InvalidArgument(\n \"group_size must be positive integer but got \",\n col_params->group.group_size);\n }\n col_params->group.group_key = group_key.unaligned_flat()(0);\n col_params->instance.type = collective_type;\n col_params->instance.instance_key = instance_key.unaligned_flat()(0);\n col_params->instance.data_type = data_type_;\n col_params->instance.impl_details.communication_hint = communication_hint_;\n col_params->instance.impl_details.timeout_seconds = timeout_seconds_;\n return Status::OK();\n }", "label": 1, "label_name": "safe"} +{"code": " public static Adjustment Get(string uuid)\n {\n var adjustment = new Adjustment();\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,\n \"/adjustments/\" + Uri.EscapeUriString(uuid),\n adjustment.ReadXml);\n return adjustment;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function(k){this.actions.get(\"shapes\").funct();mxEvent.consume(k)}));c.appendChild(e);return c};EditorUi.prototype.handleError=function(c,e,g,k,m,p,v){var x=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},z=null!=c&&null!=c.error?c.error:c;if(null!=c&&(\"1\"==urlParams.test||null!=c.stack)&&null!=c.message)try{v?null!=window.console&&console.error(\"EditorUi.handleError:\",c):EditorUi.logError(\"Caught: \"+(\"\"==c.message&&null!=c.name)?c.name:c.message,c.filename,c.lineNumber,\nc.columnNumber,c,\"INFO\")}catch(q){}if(null!=z||null!=e){v=mxUtils.htmlEntities(mxResources.get(\"unknownError\"));var y=mxResources.get(\"ok\"),L=null;e=null!=e?e:mxResources.get(\"error\");if(null!=z){null!=z.retry&&(y=mxResources.get(\"cancel\"),L=function(){x();z.retry()});if(404==z.code||404==z.status||403==z.code){v=403==z.code?null!=z.message?mxUtils.htmlEntities(z.message):mxUtils.htmlEntities(mxResources.get(\"accessDenied\")):null!=m?m:mxUtils.htmlEntities(mxResources.get(\"fileNotFoundOrDenied\")+(null!=\nthis.drive&&null!=this.drive.user?\" (\"+this.drive.user.displayName+\", \"+this.drive.user.email+\")\":\"\"));var N=null!=m?null:null!=p?p:window.location.hash;if(null!=N&&(\"#G\"==N.substring(0,2)||\"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D\"==N.substring(0,45))&&(null!=c&&null!=c.error&&(null!=c.error.errors&&0\");H.setAttribute(\"disabled\",\"disabled\");G.appendChild(H)}H=document.createElement(\"option\");mxUtils.write(H,mxResources.get(\"addAccount\"));H.value=C.length;G.appendChild(H)}var C=this.drive.getUsersList(),A=document.createElement(\"div\"),B=document.createElement(\"span\");B.style.marginTop=\"6px\";mxUtils.write(B,mxResources.get(\"changeUser\")+\": \");A.appendChild(B);var G=document.createElement(\"select\");G.style.width=\"200px\";q();mxEvent.addListener(G,\"change\",mxUtils.bind(this,\nfunction(){var M=G.value,H=C.length!=M;H&&this.drive.setUser(C[M]);this.drive.authorize(H,mxUtils.bind(this,function(){H||(C=this.drive.getUsersList(),q())}),mxUtils.bind(this,function(F){this.handleError(F)}),!0)}));A.appendChild(G);A=new CustomDialog(this,A,mxUtils.bind(this,function(){this.loadFile(window.location.hash.substr(1),!0)}));this.showDialog(A.container,300,100,!0,!0)}),mxResources.get(\"cancel\"),mxUtils.bind(this,function(){this.hideDialog();null!=g&&g()}),480,150);return}}null!=z.message?\nv=\"\"==z.message&&null!=z.name?mxUtils.htmlEntities(z.name):mxUtils.htmlEntities(z.message):null!=z.response&&null!=z.response.error?v=mxUtils.htmlEntities(z.response.error):\"undefined\"!==typeof window.App&&(z.code==App.ERROR_TIMEOUT?v=mxUtils.htmlEntities(mxResources.get(\"timeout\")):z.code==App.ERROR_BUSY?v=mxUtils.htmlEntities(mxResources.get(\"busy\")):\"string\"===typeof z&&0faqRecord['id']) && ($this->faqRecord['id'] == $id)) {\n return $this->faqRecord['title'];\n }\n\n $question = '';\n\n $query = sprintf(\n \"SELECT\n thema AS question\n FROM\n %sfaqdata\n WHERE\n id = %d AND lang = '%s'\",\n PMF_Db::getTablePrefix(),\n $id,\n $this->_config->getLanguage()->getLanguage()\n );\n $result = $this->_config->getDb()->query($query);\n\n if ($this->_config->getDb()->numRows($result) > 0) {\n while ($row = $this->_config->getDb()->fetchObject($result)) {\n $question = PMF_String::htmlspecialchars($row->question);\n }\n } else {\n $question = $this->pmf_lang['no_cats'];\n }\n\n return $question;\n }", "label": 1, "label_name": "safe"} +{"code": "m=P.name;v=\"\";O(null,!0)})));k.appendChild(F)})(D[G],G)}100==D.length&&(k.appendChild(A),B=function(){k.scrollTop>=k.scrollHeight-k.offsetHeight&&C()},mxEvent.addListener(k,\"scroll\",B))}),y)});t()};GitHubClient.prototype.logout=function(){this.clearPersistentToken();this.setUser(null);b=null}})();TrelloFile=function(b,e,f){DrawioFile.call(this,b,e);this.meta=f;this.saveNeededCounter=0};mxUtils.extend(TrelloFile,DrawioFile);TrelloFile.prototype.getHash=function(){return\"T\"+encodeURIComponent(this.meta.compoundId)};TrelloFile.prototype.getMode=function(){return App.MODE_TRELLO};TrelloFile.prototype.isAutosave=function(){return!0};TrelloFile.prototype.getTitle=function(){return this.meta.name};TrelloFile.prototype.isRenamable=function(){return!1};TrelloFile.prototype.getSize=function(){return this.meta.bytes};", "label": 0, "label_name": "vulnerable"} +{"code": " public function onKernelRequest(GetResponseEvent $event)\n {\n if (!$event->isMasterRequest()) {\n return;\n }\n\n $request = $event->getRequest();\n $session = $this->getSession();\n if (null === $session || $request->hasSession()) {\n return;\n }\n\n $request->setSession($session);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function edit_externalalias() {\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\n if ($section->parent == -1) {\n notfoundController::handle_not_found();\n exit;\n } // doesn't work for standalone pages\n if (empty($section->id)) {\n $section->public = 1;\n if (!isset($section->parent)) {\n // This is another precaution. The parent attribute\n // should ALWAYS be set by the caller.\n //FJD - if that's the case, then we should die.\n notfoundController::handle_not_authorized();\n exit;\n //$section->parent = 0;\n }\n }\n assign_to_template(array(\n 'section' => $section,\n 'glyphs' => self::get_glyphs(),\n ));\n }", "label": 1, "label_name": "safe"} +{"code": "Ta3Parser_ParseStringObject(const char *s, PyObject *filename,\n grammar *g, int start,\n perrdetail *err_ret, int *flags)\n{\n struct tok_state *tok;\n int exec_input = start == file_input;\n\n if (initerr(err_ret, filename) < 0)\n return NULL;\n\n if (*flags & PyPARSE_IGNORE_COOKIE)\n tok = Ta3Tokenizer_FromUTF8(s, exec_input);\n else\n tok = Ta3Tokenizer_FromString(s, exec_input);\n if (tok == NULL) {\n err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;\n return NULL;\n }\n\n#ifndef PGEN\n Py_INCREF(err_ret->filename);\n tok->filename = err_ret->filename;\n#endif\n if (*flags & PyPARSE_ASYNC_ALWAYS)\n tok->async_always = 1;\n return parsetok(tok, g, start, err_ret, flags);\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct(BarClass $bar)\n {\n $this->bar = $bar;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testGetDropdownConnect($params, $expected, $session_params = []) {\n $this->login();\n\n $bkp_params = [];\n //set session params if any\n if (count($session_params)) {\n foreach ($session_params as $param => $value) {\n if (isset($_SESSION[$param])) {\n $bkp_params[$param] = $_SESSION[$param];\n }\n $_SESSION[$param] = $value;\n }\n }\n\n $params['_idor_token'] = $this->generateIdor($params);\n\n $result = \\Dropdown::getDropdownConnect($params, false);\n\n //reset session params before executing test\n if (count($session_params)) {\n foreach ($session_params as $param => $value) {\n if (isset($bkp_params[$param])) {\n $_SESSION[$param] = $bkp_params[$param];\n } else {\n unset($_SESSION[$param]);\n }\n }\n }\n\n $this->array($result)->isIdenticalTo($expected);\n }", "label": 1, "label_name": "safe"} +{"code": "func (mr *MockAccessTokenStrategyMockRecorder) GenerateAccessToken(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GenerateAccessToken\", reflect.TypeOf((*MockAccessTokenStrategy)(nil).GenerateAccessToken), arg0, arg1)\n}", "label": 1, "label_name": "safe"} +{"code": " public IESCipher(IESEngine engine, int ivLength)\n {\n this.engine = engine;\n this.ivLength = ivLength;\n }", "label": 1, "label_name": "safe"} +{"code": "0;N>>8;return u};Editor.crc32=function(u){for(var E=-1,J=0;J>>8^Editor.crcTable[(E^u.charCodeAt(J))&255];return(E^-1)>>>0};Editor.writeGraphModelToPng=function(u,E,J,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label": 0, "label_name": "vulnerable"} +{"code": "function top_panel($user, $TAB)\n{\n global $panel;\n $command = HESTIA_CMD . 'v-list-user ' . escapeshellarg($user) . \" 'json'\";\n exec($command, $output, $return_var);\n if ($return_var > 0) {\n echo 'ERROR: Unable to retrieve account details.
Please log in again.
';\n destroy_sessions();\n header('Location: /login/');\n exit;\n }\n $panel = json_decode(implode('', $output), true);\n unset($output);\n\n // Log out active sessions for suspended users\n if (($panel[$user]['SUSPENDED'] === 'yes') && ($_SESSION['POLICY_USER_VIEW_SUSPENDED'] !== 'yes')) {\n if(empty($_SESSION['look'])){\n $_SESSION['error_msg'] = 'You have been logged out. Please log in again.';\n destroy_sessions();\n header('Location: /login/');\n }\n }\n\n // Reset user permissions if changed while logged in\n if (($panel[$user]['ROLE']) !== ($_SESSION['userContext']) && (!isset($_SESSION['look']))) {\n unset($_SESSION['userContext']);\n $_SESSION['userContext'] = $panel[$user]['ROLE'];\n }\n\n // Load user's selected theme and do not change it when impersonting user\n if ((isset($panel[$user]['THEME'])) && (!isset($_SESSION['look']))) {\n $_SESSION['userTheme'] = $panel[$user]['THEME'];\n }\n\n // Unset userTheme override variable if POLICY_USER_CHANGE_THEME is set to no\n if ($_SESSION['POLICY_USER_CHANGE_THEME'] === 'no') {\n unset($_SESSION['userTheme']);\n }\n\n // Set preferred sort order\n if (!isset($_SESSION['look'])) {\n $_SESSION['userSortOrder'] = $panel[$user]['PREF_UI_SORT'];\n }\n\n // Set home location URLs\n if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) {\n // Display users list for administrators unless they are impersonating a user account\n $home_url = '/list/user/';\n } else {\n // Set home location URL based on available package features from account\n if ($panel[$user]['WEB_DOMAINS'] != '0') {\n $home_url = '/list/web/';\n } elseif ($panel[$user]['DNS_DOMAINS'] != '0') {\n $home_url = '/list/dns/';\n } elseif ($panel[$user]['MAIL_DOMAINS'] != '0') {\n $home_url = '/list/mail/';\n } elseif ($panel[$user]['DATABASES'] != '0') {\n $home_url = '/list/db/';\n } elseif ($panel[$user]['CRON_JOBS'] != '0') {\n $home_url = '/list/cron/';\n } elseif ($panel[$user]['BACKUPS'] != '0') {\n $home_url = '/list/backups/';\n }\n }\n\n include(dirname(__FILE__) . '/../templates/includes/panel.html');\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function test_nntp_regular()\n {\n $this->assertValidation(\n 'nntp://news.example.com/alt.misc/42#frag'\n );\n }", "label": 1, "label_name": "safe"} +{"code": "error_t httpParseParam(const char_t **pos, HttpParam *param)\n{\n error_t error;\n size_t i;\n uint8_t c;\n bool_t escapeFlag;\n bool_t separatorFound;\n const char_t *p;\n\n //Check parameters\n if(pos == NULL || param == NULL)\n return ERROR_INVALID_PARAMETER;\n\n //Initialize structure\n param->name = NULL;\n param->nameLen = 0;\n param->value = NULL;\n param->valueLen = 0;\n\n //Initialize variables\n escapeFlag = FALSE;\n separatorFound = FALSE;\n\n //Initialize status code\n error = ERROR_IN_PROGRESS;\n\n //Point to the first character\n i = 0;\n p = *pos;\n\n //Loop through the list of parameters\n while(error == ERROR_IN_PROGRESS)\n {\n //Get current character\n c = (uint8_t) p[i];\n\n //Check current state\n if(param->name == NULL)\n {\n //Check current character\n if(c == '\\0')\n {\n //The list of parameters is empty\n error = ERROR_NOT_FOUND;\n }\n else if(c == ' ' || c == '\\t' || c == ',' || c == ';')\n {\n //Discard whitespace and separator characters\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Point to the first character of the parameter name\n param->name = p + i;\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else if(param->nameLen == 0)\n {\n //Check current character\n if(c == '\\0' || c == ',' || c == ';')\n {\n //Save the length of the parameter name\n param->nameLen = p + i - param->name;\n //Successful processing\n error = NO_ERROR;\n }\n else if(c == ' ' || c == '\\t')\n {\n //Save the length of the parameter name\n param->nameLen = p + i - param->name;\n }\n else if(c == '=')\n {\n //The key/value separator has been found\n separatorFound = TRUE;\n //Save the length of the parameter name\n param->nameLen = p + i - param->name;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Advance data pointer\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else if(!separatorFound)\n {\n //Check current character\n if(c == '\\0' || c == ',' || c == ';')\n {\n //Successful processing\n error = NO_ERROR;\n }\n else if(c == ' ' || c == '\\t')\n {\n //Discard whitespace characters\n }\n else if(c == '=')\n {\n //The key/value separator has been found\n separatorFound = TRUE;\n }\n else if(c == '\\\"')\n {\n //Point to the first character that follows the parameter name\n i = param->name + param->nameLen - p;\n //Successful processing\n error = NO_ERROR;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Point to the first character that follows the parameter name\n i = param->name + param->nameLen - p;\n //Successful processing\n error = NO_ERROR;\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else if(param->value == NULL)\n {\n //Check current character\n if(c == '\\0' || c == ',' || c == ';')\n {\n //Successful processing\n error = NO_ERROR;\n }\n else if(c == ' ' || c == '\\t')\n {\n //Discard whitespace characters\n }\n else if(c == '\\\"')\n {\n //A string of text is parsed as a single word if it is quoted\n //using double-quote marks (refer to RFC 7230, section 3.2.6)\n param->value = p + i;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Point to the first character of the parameter value\n param->value = p + i;\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else\n {\n //Quoted string?\n if(param->value[0] == '\\\"')\n {\n //Check current character\n if(c == '\\0')\n {\n //The second double quote is missing\n error = ERROR_INVALID_SYNTAX;\n }\n else if(escapeFlag)\n {\n //Recipients that process the value of a quoted-string must\n //handle a quoted-pair as if it were replaced by the octet\n //following the backslash\n escapeFlag = FALSE;\n }\n else if(c == '\\\\')\n {\n //The backslash octet can be used as a single-octet quoting\n //mechanism within quoted-string and comment constructs\n escapeFlag = TRUE;\n }\n else if(c == '\\\"')\n {\n //Advance pointer over the double quote\n i++;\n //Save the length of the parameter value\n param->valueLen = p + i - param->value;\n //Successful processing\n error = NO_ERROR;\n }\n else if(isprint(c) || c == '\\t' || c >= 128)\n {\n //Advance data pointer\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else\n {\n //Check current character\n if(c == '\\0' || c == ' ' || c == '\\t' || c == ',' || c == ';')\n {\n //Save the length of the parameter value\n param->valueLen = p + i - param->value;\n //Successful processing\n error = NO_ERROR;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Advance data pointer\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n }\n\n //Point to the next character of the string\n if(error == ERROR_IN_PROGRESS)\n i++;\n }\n\n //Check whether the parameter value is a quoted string\n if(param->valueLen >= 2 && param->value[0] == '\\\"')\n {\n //Discard the surrounding quotes\n param->value++;\n param->valueLen -= 2;\n }\n\n //Actual position if the list of parameters\n *pos = p + i;\n\n //Return status code\n return error;\n}", "label": 1, "label_name": "safe"} +{"code": "mxDualRuler.prototype.setUnit=function(b){this.vRuler.setUnit(b);this.hRuler.setUnit(b)};mxDualRuler.prototype.setStyle=function(b){this.vRuler.setStyle(b);this.hRuler.setStyle(b)};mxDualRuler.prototype.destroy=function(){this.vRuler.destroy();this.hRuler.destroy();this.ui.refresh=this.editorUiRefresh;mxGuide.prototype.move=this.origGuideMove;mxGuide.prototype.destroy=this.origGuideDestroy;this.ui.getDiagramContainerOffset=this.editorUiGetDiagContOffset};function mxFreehand(b){var e=null!=b.view&&null!=b.view.canvas?b.view.canvas.ownerSVGElement:null;if(null!=b.container&&null!=e){b.addListener(mxEvent.ESCAPE,mxUtils.bind(this,function(){this.stopDrawing()}));var f=mxFreehand.prototype.NORMAL_SMOOTHING,c=null,m=[],n,v=[],d,g=!1,k=!0,l=!0,p=!0,q=!0,x=[],y=!1,A=!0,B=!1,I={size:12,thinning:.5,smoothing:.5,streamline:.5,start:{taper:0,cap:!0},end:{taper:0,cap:!0}},O=!1;this.setClosedPath=function(K){g=K};this.setAutoClose=function(K){k=K};this.setAutoInsert=", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t\t\t\t\t .draggable('option', 'cursorAt', {left: 50 - parseInt($(e.currentTarget).css('margin-left')), top: 47});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.on('dragstart', function(e) {\n\t\t\t\t\t\t\tvar dt = e.dataTransfer || e.originalEvent.dataTransfer || null;\n\t\t\t\t\t\t\thelper = null;\n\t\t\t\t\t\t\tif (dt && !fm.UA.IE) {\n\t\t\t\t\t\t\t\tvar p = this.id ? $(this) : $(this).parents('[id]:first'),\n\t\t\t\t\t\t\t\t\telm = $(''),\n\t\t\t\t\t\t\t\t\turl = '',\n\t\t\t\t\t\t\t\t\tdurl = null,\n\t\t\t\t\t\t\t\t\tmurl = null,\n\t\t\t\t\t\t\t\t\tfiles = [],\n\t\t\t\t\t\t\t\t\ticon = function(f) {\n\t\t\t\t\t\t\t\t\t\tvar mime = f.mime, i, tmb = fm.tmb(f);\n\t\t\t\t\t\t\t\t\t\ti = '
';\n\t\t\t\t\t\t\t\t\t\tif (tmb) {\n\t\t\t\t\t\t\t\t\t\t\ti = $(i).addClass(tmb.className).css('background-image', \"url('\"+tmb.url+\"')\").get(0).outerHTML;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t\t\t\t}, l, geturl = [];\n\t\t\t\t\t\t\t\tp.trigger(evtSelect);\n\t\t\t\t\t\t\t\ttrigger();\n\t\t\t\t\t\t\t\t$.each(selectedFiles, function(i, v) {\n\t\t\t\t\t\t\t\t\tvar file = fm.file(v),\n\t\t\t\t\t\t\t\t\t\tfurl = file.url;\n\t\t\t\t\t\t\t\t\tif (file && file.mime !== 'directory') {\n\t\t\t\t\t\t\t\t\t\tif (!furl) {\n\t\t\t\t\t\t\t\t\t\t\tfurl = fm.url(file.hash);\n\t\t\t\t\t\t\t\t\t\t} else if (furl == '1') {\n\t\t\t\t\t\t\t\t\t\t\tgeturl.push(v);\n\t\t\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (furl) {\n\t\t\t\t\t\t\t\t\t\t\tfurl = fm.convAbsUrl(furl);\n\t\t\t\t\t\t\t\t\t\t\tfiles.push(v);\n\t\t\t\t\t\t\t\t\t\t\t$('').attr('href', furl).text(furl).appendTo(elm);\n\t\t\t\t\t\t\t\t\t\t\turl += furl + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\tif (!durl) {\n\t\t\t\t\t\t\t\t\t\t\t\tdurl = file.mime + ':' + file.name + ':' + furl;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (!murl) {\n\t\t\t\t\t\t\t\t\t\t\t\tmurl = furl + \"\\n\" + file.name;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (geturl.length) {\n\t\t\t\t\t\t\t\t\t$.each(geturl, function(i, v) {\n\t\t\t\t\t\t\t\t\t\tvar rfile = fm.file(v);\n\t\t\t\t\t\t\t\t\t\trfile.url = '';\n\t\t\t\t\t\t\t\t\t\tfm.request({\n\t\t\t\t\t\t\t\t\t\t\tdata : {cmd : 'url', target : v},\n\t\t\t\t\t\t\t\t\t\t\tnotify : {type : 'url', cnt : 1},\n\t\t\t\t\t\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t.always(function(data) {\n\t\t\t\t\t\t\t\t\t\t\trfile.url = data.url? data.url : '1';\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t} else if (url) {\n\t\t\t\t\t\t\t\t\tif (dt.setDragImage) {\n\t\t\t\t\t\t\t\t\t\thelper = $('
').append(icon(fm.file(files[0]))).appendTo($(document.body));\n\t\t\t\t\t\t\t\t\t\tif ((l = files.length) > 1) {\n\t\t\t\t\t\t\t\t\t\t\thelper.append(icon(fm.file(files[l-1])) + ''+l+'');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdt.setDragImage(helper.get(0), 50, 47);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdt.effectAllowed = 'copyLink';\n\t\t\t\t\t\t\t\t\tdt.setData('DownloadURL', durl);\n\t\t\t\t\t\t\t\t\tdt.setData('text/x-moz-url', murl);\n\t\t\t\t\t\t\t\t\tdt.setData('text/uri-list', url);\n\t\t\t\t\t\t\t\t\tdt.setData('text/plain', url);\n\t\t\t\t\t\t\t\t\tdt.setData('text/html', elm.html());\n\t\t\t\t\t\t\t\t\tdt.setData('elfinderfrom', window.location.href + fm.cwd().hash);\n\t\t\t\t\t\t\t\t\tdt.setData('elfinderfrom:' + dt.getData('elfinderfrom'), '');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.on('dragend', function(e) {\n\t\t\t\t\t\t\tunselectAll();\n\t\t\t\t\t\t\thelper && helper.remove();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.draggable(fm.draggable);\n\t\t\t\t\t}", "label": 1, "label_name": "safe"} +{"code": " void validSave() throws Exception\n {\n when(mockClonedDocument.getRCSVersion()).thenReturn(new Version(\"1.2\"));\n when(mockClonedDocument.getComment()).thenReturn(\"My Changes\");\n when(mockClonedDocument.getLock(this.context)).thenReturn(mock(XWikiLock.class));\n when(mockForm.getTemplate()).thenReturn(\"\");\n assertFalse(saveAction.save(this.context));\n assertEquals(new Version(\"1.2\"), this.context.get(\"SaveAction.savedObjectVersion\"));\n\n verify(mockClonedDocument).readFromTemplate(\"\", this.context);\n verify(mockClonedDocument).setAuthor(\"XWiki.FooBar\");\n verify(mockClonedDocument).setMetaDataDirty(true);\n verify(this.xWiki).checkSavingDocument(USER_REFERENCE, mockClonedDocument, \"My Changes\", false, this.context);\n verify(this.xWiki).saveDocument(mockClonedDocument, \"My Changes\", false, this.context);\n verify(mockClonedDocument).removeLock(this.context);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate)\n{\n\tjpc_ms_t *ms;\n\tjpc_mstabent_t *mstabent;\n\tjas_stream_t *tmpstream;\n\n\tif (!(ms = jpc_ms_create(0))) {\n\t\treturn 0;\n\t}\n\n\t/* Get the marker type. */\n\tif (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN ||\n\t ms->id > JPC_MS_MAX) {\n\t\tjpc_ms_destroy(ms);\n\t\treturn 0;\n\t}\n\n\tmstabent = jpc_mstab_lookup(ms->id);\n\tms->ops = &mstabent->ops;\n\n\t/* Get the marker segment length and parameters if present. */\n\t/* Note: It is tacitly assumed that a marker segment cannot have\n\t parameters unless it has a length field. That is, there cannot\n\t be a parameters field without a length field and vice versa. */\n\tif (JPC_MS_HASPARMS(ms->id)) {\n\t\t/* Get the length of the marker segment. */\n\t\tif (jpc_getuint16(in, &ms->len) || ms->len < 3) {\n\t\t\tjpc_ms_destroy(ms);\n\t\t\treturn 0;\n\t\t}\n\t\t/* Calculate the length of the marker segment parameters. */\n\t\tms->len -= 2;\n\t\t/* Create and prepare a temporary memory stream from which to\n\t\t read the marker segment parameters. */\n\t\t/* Note: This approach provides a simple way of ensuring that\n\t\t we never read beyond the end of the marker segment (even if\n\t\t the marker segment length is errantly set too small). */\n\t\tif (!(tmpstream = jas_stream_memopen(0, 0))) {\n\t\t\tjpc_ms_destroy(ms);\n\t\t\treturn 0;\n\t\t}\n\t\tif (jas_stream_copy(tmpstream, in, ms->len) ||\n\t\t jas_stream_seek(tmpstream, 0, SEEK_SET) < 0) {\n\t\t\tjas_stream_close(tmpstream);\n\t\t\tjpc_ms_destroy(ms);\n\t\t\treturn 0;\n\t\t}\n\t\t/* Get the marker segment parameters. */\n\t\tif ((*ms->ops->getparms)(ms, cstate, tmpstream)) {\n\t\t\tms->ops = 0;\n\t\t\tjpc_ms_destroy(ms);\n\t\t\tjas_stream_close(tmpstream);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (jas_getdbglevel() > 0) {\n\t\t\tjpc_ms_dump(ms, stderr);\n\t\t}\n\n\t\tif (JAS_CAST(ulong, jas_stream_tell(tmpstream)) != ms->len) {\n\t\t\tjas_eprintf(\n\t\t\t \"warning: trailing garbage in marker segment (%ld bytes)\\n\",\n\t\t\t ms->len - jas_stream_tell(tmpstream));\n\t\t}\n\n\t\t/* Close the temporary stream. */\n\t\tjas_stream_close(tmpstream);\n\n\t} else {\n\t\t/* There are no marker segment parameters. */\n\t\tms->len = 0;\n\n\t\tif (jas_getdbglevel() > 0) {\n\t\t\tjpc_ms_dump(ms, stderr);\n\t\t}\n\t}\n\n\t/* Update the code stream state information based on the type of\n\t marker segment read. */\n\t/* Note: This is a bit of a hack, but I'm not going to define another\n\t type of virtual function for this one special case. */\n\tif (ms->id == JPC_MS_SIZ) {\n\t\tcstate->numcomps = ms->parms.siz.numcomps;\n\t}\n\n\treturn ms;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method)\n{\n char ibuf[LONG_STRING * 2], obuf[LONG_STRING];\n unsigned char hmac_response[MD5_DIGEST_LEN];\n int len;\n int rc;\n\n if (!mutt_bit_isset(idata->capabilities, ACRAM_MD5))\n return IMAP_AUTH_UNAVAIL;\n\n mutt_message(_(\"Authenticating (CRAM-MD5)...\"));\n\n /* get auth info */\n if (mutt_account_getlogin(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n if (mutt_account_getpass(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n\n imap_cmd_start(idata, \"AUTHENTICATE CRAM-MD5\");\n\n /* From RFC2195:\n * The data encoded in the first ready response contains a presumptively\n * arbitrary string of random digits, a timestamp, and the fully-qualified\n * primary host name of the server. The syntax of the unencoded form must\n * correspond to that of an RFC822 'msg-id' [RFC822] as described in [POP3].\n */\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_RESPOND)\n {\n mutt_debug(1, \"Invalid response from server: %s\\n\", ibuf);\n goto bail;\n }\n\n len = mutt_b64_decode(obuf, idata->buf + 2);\n if (len == -1)\n {\n mutt_debug(1, \"Error decoding base64 response.\\n\");\n goto bail;\n }\n\n obuf[len] = '\\0';\n mutt_debug(2, \"CRAM challenge: %s\\n\", obuf);\n\n /* The client makes note of the data and then responds with a string\n * consisting of the user name, a space, and a 'digest'. The latter is\n * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where the\n * key is a shared secret and the digested text is the timestamp (including\n * angle-brackets).\n *\n * Note: The user name shouldn't be quoted. Since the digest can't contain\n * spaces, there is no ambiguity. Some servers get this wrong, we'll work\n * around them when the bug report comes in. Until then, we'll remain\n * blissfully RFC-compliant.\n */\n hmac_md5(idata->conn->account.pass, obuf, hmac_response);\n /* dubious optimisation I saw elsewhere: make the whole string in one call */\n int off = snprintf(obuf, sizeof(obuf), \"%s \", idata->conn->account.user);\n mutt_md5_toascii(hmac_response, obuf + off);\n mutt_debug(2, \"CRAM response: %s\\n\", obuf);\n\n /* ibuf must be long enough to store the base64 encoding of obuf,\n * plus the additional debris */\n mutt_b64_encode(ibuf, obuf, strlen(obuf), sizeof(ibuf) - 2);\n mutt_str_strcat(ibuf, sizeof(ibuf), \"\\r\\n\");\n mutt_socket_send(idata->conn, ibuf);\n\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_OK)\n {\n mutt_debug(1, \"Error receiving server response.\\n\");\n goto bail;\n }\n\n if (imap_code(idata->buf))\n return IMAP_AUTH_SUCCESS;\n\nbail:\n mutt_error(_(\"CRAM-MD5 authentication failed.\"));\n return IMAP_AUTH_FAILURE;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " forwardIn(bindAddr, bindPort, cb) {\n if (!this._sock || !this._sock.writable)\n throw new Error('Not connected');\n\n // Send a request for the server to start forwarding TCP connections to us\n // on a particular address and port\n\n const wantReply = (typeof cb === 'function');\n\n if (wantReply) {\n this._callbacks.push((had_err, data) => {\n if (had_err) {\n cb(had_err !== true\n ? had_err\n : new Error(`Unable to bind to ${bindAddr}:${bindPort}`));\n return;\n }\n\n let realPort = bindPort;\n if (bindPort === 0 && data && data.length >= 4) {\n realPort = readUInt32BE(data, 0);\n if (!(this._protocol._compatFlags & COMPAT.DYN_RPORT_BUG))\n bindPort = realPort;\n }\n\n this._forwarding[`${bindAddr}:${bindPort}`] = realPort;\n\n cb(undefined, realPort);\n });\n }\n\n this._protocol.tcpipForward(bindAddr, bindPort, wantReply);\n\n return this;\n }", "label": 1, "label_name": "safe"} +{"code": " public function setup()\n {\n $this->parser = new HTMLPurifier_StringHashParser();\n }", "label": 1, "label_name": "safe"} +{"code": "\tprepend: function() {\n\t\treturn this.domManip(arguments, true, function(elem){\n\t\t\tif (this.nodeType == 1)\n\t\t\t\tthis.insertBefore( elem, this.firstChild );\n\t\t});\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " async function doIt() {\n await test.server.serverCertificateManager.trustCertificate(certificate);\n const issuerCertificateFile = m(\"CA/public/cacert.pem\");\n const issuerCertificateRevocationListFile = m(\"CA/crl/revocation_list.der\");\n const issuerCertificate = readCertificate(issuerCertificateFile);\n const issuerCrl = await readCertificateRevocationList(issuerCertificateRevocationListFile);\n await test.server.serverCertificateManager.addIssuer(issuerCertificate);\n await test.server.serverCertificateManager.addRevocationList(issuerCrl);\n callback();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void PngImg::InitStorage_() {\n rowPtrs_.resize(info_.height, nullptr);\n data_ = new png_byte[info_.height * info_.rowbytes];\n\n for(size_t i = 0; i < info_.height; ++i) {\n rowPtrs_[i] = data_ + i * info_.rowbytes;\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "func (e *Environment) resources() container.Resources {\n\tl := e.Configuration.Limits()\n\tpids := l.ProcessLimit()\n\n\treturn container.Resources{\n\t\tMemory: l.BoundedMemoryLimit(),\n\t\tMemoryReservation: l.MemoryLimit * 1_000_000,\n\t\tMemorySwap: l.ConvertedSwap(),\n\t\tCPUQuota: l.ConvertedCpuLimit(),\n\t\tCPUPeriod: 100_000,\n\t\tCPUShares: 1024,\n\t\tBlkioWeight: l.IoWeight,\n\t\tOomKillDisable: &l.OOMDisabled,\n\t\tCpusetCpus: l.Threads,\n\t\tPidsLimit: &pids,\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "process_demand_active(STREAM s)\n{\n\tuint8 type;\n\tuint16 len_src_descriptor, len_combined_caps;\n\tstruct stream packet = *s;\n\n\t/* at this point we need to ensure that we have ui created */\n\trd_create_ui();\n\n\tin_uint32_le(s, g_rdp_shareid);\n\tin_uint16_le(s, len_src_descriptor);\n\tin_uint16_le(s, len_combined_caps);\n\n\tif (!s_check_rem(s, len_src_descriptor))\n\t{\n\t\trdp_protocol_error(\"rdp_demand_active(), consume of source descriptor from stream would overrun\", &packet);\n\t}\n\tin_uint8s(s, len_src_descriptor);\n\n\tlogger(Protocol, Debug, \"process_demand_active(), shareid=0x%x\", g_rdp_shareid);\n\n\trdp_process_server_caps(s, len_combined_caps);\n\n\trdp_send_confirm_active();\n\trdp_send_synchronise();\n\trdp_send_control(RDP_CTL_COOPERATE);\n\trdp_send_control(RDP_CTL_REQUEST_CONTROL);\n\trdp_recv(&type);\t/* RDP_PDU_SYNCHRONIZE */\n\trdp_recv(&type);\t/* RDP_CTL_COOPERATE */\n\trdp_recv(&type);\t/* RDP_CTL_GRANT_CONTROL */\n\trdp_send_input(0, RDP_INPUT_SYNCHRONIZE, 0,\n\t\t g_numlock_sync ? ui_get_numlock_state(read_keyboard_state()) : 0, 0);\n\n\tif (g_rdp_version >= RDP_V5)\n\t{\n\t\trdp_enum_bmpcache2();\n\t\trdp_send_fonts(3);\n\t}\n\telse\n\t{\n\t\trdp_send_fonts(1);\n\t\trdp_send_fonts(2);\n\t}\n\n\trdp_recv(&type);\t/* RDP_PDU_UNKNOWN 0x28 (Fonts?) */\n\treset_order_state();\n}", "label": 1, "label_name": "safe"} +{"code": "mxActor);Za.prototype.arrowWidth=.3;Za.prototype.arrowSize=.2;Za.prototype.redrawPath=function(c,l,x,p,v){var A=v*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowWidth\",this.arrowWidth))));l=p*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowSize\",this.arrowSize))));x=(v-A)/2;A=x+A;var B=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(c,[new mxPoint(0,x),new mxPoint(p-l,x),new mxPoint(p-l,0),new mxPoint(p,v/2),new mxPoint(p-\nl,v),new mxPoint(p-l,A),new mxPoint(0,A)],this.isRounded,B,!0);c.end()};mxCellRenderer.registerShape(\"singleArrow\",Za);mxUtils.extend(z,mxActor);z.prototype.redrawPath=function(c,l,x,p,v){var A=v*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowWidth\",Za.prototype.arrowWidth))));l=p*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowSize\",Za.prototype.arrowSize))));x=(v-A)/2;A=x+A;var B=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/", "label": 0, "label_name": "vulnerable"} +{"code": " protected function getDefaultParameters()\n {\n return array(\n 'baz_class' => 'BazClass',\n 'foo_class' => 'Bar\\\\FooClass',\n 'foo' => 'bar',\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testChameleonRemoveBlockInNodeInInline()\n {\n $this->assertResult(\n '
Not allowed!
',\n 'Not allowed!'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " it { is_expected.to be_enabled }", "label": 0, "label_name": "vulnerable"} +{"code": "def check_against_blacklist(\n ip_address: IPAddress, ip_whitelist: Optional[IPSet], ip_blacklist: IPSet", "label": 1, "label_name": "safe"} +{"code": "archive_read_format_zip_cleanup(struct archive_read *a)\n{\n\tstruct zip *zip;\n\tstruct zip_entry *zip_entry, *next_zip_entry;\n\n\tzip = (struct zip *)(a->format->data);\n\n#ifdef HAVE_ZLIB_H\n\tif (zip->stream_valid)\n\t\tinflateEnd(&zip->stream);\n#endif\n\n#if HAVA_LZMA_H && HAVE_LIBLZMA\n if (zip->zipx_lzma_valid) {\n\t\tlzma_end(&zip->zipx_lzma_stream);\n\t}\n#endif\n\n#ifdef HAVE_BZLIB_H\n\tif (zip->bzstream_valid) {\n\t\tBZ2_bzDecompressEnd(&zip->bzstream);\n\t}\n#endif\n\n\tfree(zip->uncompressed_buffer);\n\n\tif (zip->ppmd8_valid)\n\t\t__archive_ppmd8_functions.Ppmd8_Free(&zip->ppmd8);\n\n\tif (zip->zip_entries) {\n\t\tzip_entry = zip->zip_entries;\n\t\twhile (zip_entry != NULL) {\n\t\t\tnext_zip_entry = zip_entry->next;\n\t\t\tarchive_string_free(&zip_entry->rsrcname);\n\t\t\tfree(zip_entry);\n\t\t\tzip_entry = next_zip_entry;\n\t\t}\n\t}\n\tfree(zip->decrypted_buffer);\n\tif (zip->cctx_valid)\n\t\tarchive_decrypto_aes_ctr_release(&zip->cctx);\n\tif (zip->hctx_valid)\n\t\tarchive_hmac_sha1_cleanup(&zip->hctx);\n\tfree(zip->iv);\n\tfree(zip->erd);\n\tfree(zip->v_data);\n\tarchive_string_free(&zip->format_name);\n\tfree(zip);\n\t(a->format->data) = NULL;\n\treturn (ARCHIVE_OK);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function transform($attr, $config, $context)\n {\n if (!isset($attr['background'])) {\n return $attr;\n }\n\n $background = $this->confiscateAttr($attr, 'background');\n // some validation should happen here\n\n $this->prependCSS($attr, \"background-image:url($background);\");\n return $attr;\n }", "label": 1, "label_name": "safe"} +{"code": "RemoteFsDevice::Details RemoteDevicePropertiesWidget::details()\n{\n int t=type->itemData(type->currentIndex()).toInt();\n RemoteFsDevice::Details det;\n\n det.name=name->text().trimmed();\n switch (t) {\n case Type_SshFs: {\n det.url.setHost(sshHost->text().trimmed());\n det.url.setUserName(sshUser->text().trimmed());\n det.url.setPath(sshFolder->text().trimmed());\n det.url.setPort(sshPort->value());\n det.url.setScheme(RemoteFsDevice::constSshfsProtocol);\n det.extraOptions=sshExtra->text().trimmed();\n break;\n }\n case Type_File: {\n QString path=fileFolder->text().trimmed();\n if (path.isEmpty()) {\n path=\"/\";\n }\n det.url.setPath(path);\n det.url.setScheme(RemoteFsDevice::constFileProtocol);\n break;\n }\n case Type_Samba:\n det.url.setHost(smbHost->text().trimmed());\n det.url.setUserName(smbUser->text().trimmed());\n det.url.setPath(smbShare->text().trimmed());\n det.url.setPort(smbPort->value());\n det.url.setScheme(RemoteFsDevice::constSambaProtocol);\n det.url.setPassword(smbPassword->text().trimmed());\n if (!smbDomain->text().trimmed().isEmpty()) {\n QUrlQuery q;\n q.addQueryItem(RemoteFsDevice::constDomainQuery, smbDomain->text().trimmed());\n det.url.setQuery(q);\n }\n break;\n case Type_SambaAvahi:\n det.url.setUserName(smbAvahiUser->text().trimmed());\n det.url.setPath(smbAvahiShare->text().trimmed());\n det.url.setPort(0);\n det.url.setScheme(RemoteFsDevice::constSambaAvahiProtocol);\n det.url.setPassword(smbAvahiPassword->text().trimmed());\n if (!smbDomain->text().trimmed().isEmpty() || !smbAvahiName->text().trimmed().isEmpty()) {\n QUrlQuery q;\n if (!smbDomain->text().trimmed().isEmpty()) {\n q.addQueryItem(RemoteFsDevice::constDomainQuery, smbAvahiDomain->text().trimmed());\n }\n if (!smbAvahiName->text().trimmed().isEmpty()) {\n det.serviceName=smbAvahiName->text().trimmed();\n q.addQueryItem(RemoteFsDevice::constServiceNameQuery, det.serviceName);\n }\n det.url.setQuery(q);\n }\n break;\n }\n return det;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function remove()\n {\n $project = $this->getProject();\n $this->checkCSRFParam();\n $column_id = $this->request->getIntegerParam('column_id');\n\n if ($this->columnModel->remove($column_id)) {\n $this->flash->success(t('Column removed successfully.'));\n } else {\n $this->flash->failure(t('Unable to remove this column.'));\n }\n\n $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public static function is_same($p1, $p2){\r\n if($p1 == $p2){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " $return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\\\'.ltrim($class, '\\\\'), ltrim($class, '\\\\'));\n } elseif ($definition->getFactory()) {", "label": 0, "label_name": "vulnerable"} +{"code": " def test_underscore_traversal(self):\n # Prevent traversal to names starting with an underscore (_)\n ec = self._makeContext()\n\n with self.assertRaises(NotFound):\n ec.evaluate(\"context/__class__\")\n\n with self.assertRaises(NotFound):\n ec.evaluate(\"nocall: random/_itertools/repeat\")\n\n with self.assertRaises(NotFound):\n ec.evaluate(\"random/_itertools/repeat/foobar\")", "label": 1, "label_name": "safe"} +{"code": " echo '';\n $i++;\n }\n echo '';\n // }\n echo '';\n $j++;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int gemsafe_get_cert_len(sc_card_t *card)\n{\n\tint r;\n\tu8 ibuf[GEMSAFE_MAX_OBJLEN];\n\tu8 *iptr;\n\tstruct sc_path path;\n\tstruct sc_file *file;\n\tsize_t objlen, certlen;\n\tunsigned int ind, i=0;\n\n\tsc_format_path(GEMSAFE_PATH, &path);\n\tr = sc_select_file(card, &path, &file);\n\tif (r != SC_SUCCESS || !file)\n\t\treturn SC_ERROR_INTERNAL;\n\n\t/* Initial read */\n\tr = sc_read_binary(card, 0, ibuf, GEMSAFE_READ_QUANTUM, 0);\n\tif (r < 0)\n\t\treturn SC_ERROR_INTERNAL;\n\n\t/* Actual stored object size is encoded in first 2 bytes\n\t * (allocated EF space is much greater!)\n\t */\n\tobjlen = (((size_t) ibuf[0]) << 8) | ibuf[1];\n\tsc_log(card->ctx, \"Stored object is of size: %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t objlen);\n\tif (objlen < 1 || objlen > GEMSAFE_MAX_OBJLEN) {\n\t sc_log(card->ctx, \"Invalid object size: %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t\t objlen);\n\t return SC_ERROR_INTERNAL;\n\t}\n\n\t/* It looks like the first thing in the block is a table of\n\t * which keys are allocated. The table is small and is in the\n\t * first 248 bytes. Example for a card with 10 key containers:\n\t * 01 f0 00 03 03 b0 00 03 <= 1st key unallocated\n\t * 01 f0 00 04 03 b0 00 04 <= 2nd key unallocated\n\t * 01 fe 14 00 05 03 b0 00 05 <= 3rd key allocated\n\t * 01 fe 14 01 06 03 b0 00 06 <= 4th key allocated\n\t * 01 f0 00 07 03 b0 00 07 <= 5th key unallocated\n\t * ...\n\t * 01 f0 00 0c 03 b0 00 0c <= 10th key unallocated\n\t * For allocated keys, the fourth byte seems to indicate the\n\t * default key and the fifth byte indicates the key_ref of\n\t * the private key.\n\t */\n\tind = 2; /* skip length */\n\twhile (ibuf[ind] == 0x01) {\n\t\tif (ibuf[ind+1] == 0xFE) {\n\t\t\tgemsafe_prkeys[i].ref = ibuf[ind+4];\n\t\t\tsc_log(card->ctx, \"Key container %d is allocated and uses key_ref %d\",\n\t\t\t\t\ti+1, gemsafe_prkeys[i].ref);\n\t\t\tind += 9;\n\t\t}\n\t\telse {\n\t\t\tgemsafe_prkeys[i].label = NULL;\n\t\t\tgemsafe_cert[i].label = NULL;\n\t\t\tsc_log(card->ctx, \"Key container %d is unallocated\", i+1);\n\t\t\tind += 8;\n\t\t}\n\t\ti++;\n\t}\n\n\t/* Delete additional key containers from the data structures if\n\t * this card can't accommodate them.\n\t */\n\tfor (; i < gemsafe_cert_max; i++) {\n\t\tgemsafe_prkeys[i].label = NULL;\n\t\tgemsafe_cert[i].label = NULL;\n\t}\n\n\t/* Read entire file, then dissect in memory.\n\t * Gemalto ClassicClient seems to do it the same way.\n\t */\n\tiptr = ibuf + GEMSAFE_READ_QUANTUM;\n\twhile ((size_t)(iptr - ibuf) < objlen) {\n\t\tr = sc_read_binary(card, iptr - ibuf, iptr,\n\t\t\t\t MIN(GEMSAFE_READ_QUANTUM, objlen - (iptr - ibuf)), 0);\n\t\tif (r < 0) {\n\t\t\tsc_log(card->ctx, \"Could not read cert object\");\n\t\t\treturn SC_ERROR_INTERNAL;\n\t\t}\n\t\tiptr += GEMSAFE_READ_QUANTUM;\n\t}\n\n\t/* Search buffer for certificates, they start with 0x3082. */\n\ti = 0;\n\twhile (ind < objlen - 1) {\n\t\tif (ibuf[ind] == 0x30 && ibuf[ind+1] == 0x82) {\n\t\t\t/* Find next allocated key container */\n\t\t\twhile (i < gemsafe_cert_max && gemsafe_cert[i].label == NULL)\n\t\t\t\ti++;\n\t\t\tif (i == gemsafe_cert_max) {\n\t\t\t\tsc_log(card->ctx, \"Warning: Found orphaned certificate at offset %d\", ind);\n\t\t\t\treturn SC_SUCCESS;\n\t\t\t}\n\t\t\t/* DER cert len is encoded this way */\n\t\t\tif (ind+3 >= sizeof ibuf)\n\t\t\t\treturn SC_ERROR_INVALID_DATA;\n\t\t\tcertlen = ((((size_t) ibuf[ind+2]) << 8) | ibuf[ind+3]) + 4;\n\t\t\tsc_log(card->ctx,\n\t\t\t \"Found certificate of key container %d at offset %d, len %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t\t\t i+1, ind, certlen);\n\t\t\tgemsafe_cert[i].index = ind;\n\t\t\tgemsafe_cert[i].count = certlen;\n\t\t\tind += certlen;\n\t\t\ti++;\n\t\t} else\n\t\t\tind++;\n\t}\n\n\t/* Delete additional key containers from the data structures if\n\t * they're missing on the card.\n\t */\n\tfor (; i < gemsafe_cert_max; i++) {\n\t\tif (gemsafe_cert[i].label) {\n\t\t\tsc_log(card->ctx, \"Warning: Certificate of key container %d is missing\", i+1);\n\t\t\tgemsafe_prkeys[i].label = NULL;\n\t\t\tgemsafe_cert[i].label = NULL;\n\t\t}\n\t}\n\n\treturn SC_SUCCESS;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static long restore_tm_user_regs(struct pt_regs *regs,\n\t\t\t\t struct mcontext __user *sr,\n\t\t\t\t struct mcontext __user *tm_sr)\n{\n\tlong err;\n\tunsigned long msr, msr_hi;\n#ifdef CONFIG_VSX\n\tint i;\n#endif\n\n\t/*\n\t * restore general registers but not including MSR or SOFTE. Also\n\t * take care of keeping r2 (TLS) intact if not a signal.\n\t * See comment in signal_64.c:restore_tm_sigcontexts();\n\t * TFHAR is restored from the checkpointed NIP; TEXASR and TFIAR\n\t * were set by the signal delivery.\n\t */\n\terr = restore_general_regs(regs, tm_sr);\n\terr |= restore_general_regs(¤t->thread.ckpt_regs, sr);\n\n\terr |= __get_user(current->thread.tm_tfhar, &sr->mc_gregs[PT_NIP]);\n\n\terr |= __get_user(msr, &sr->mc_gregs[PT_MSR]);\n\tif (err)\n\t\treturn 1;\n\n\t/* Restore the previous little-endian mode */\n\tregs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);\n\n\t/*\n\t * Do this before updating the thread state in\n\t * current->thread.fpr/vr/evr. That way, if we get preempted\n\t * and another task grabs the FPU/Altivec/SPE, it won't be\n\t * tempted to save the current CPU state into the thread_struct\n\t * and corrupt what we are writing there.\n\t */\n\tdiscard_lazy_cpu_state();\n\n#ifdef CONFIG_ALTIVEC\n\tregs->msr &= ~MSR_VEC;\n\tif (msr & MSR_VEC) {\n\t\t/* restore altivec registers from the stack */\n\t\tif (__copy_from_user(¤t->thread.vr_state, &sr->mc_vregs,\n\t\t\t\t sizeof(sr->mc_vregs)) ||\n\t\t __copy_from_user(¤t->thread.transact_vr,\n\t\t\t\t &tm_sr->mc_vregs,\n\t\t\t\t sizeof(sr->mc_vregs)))\n\t\t\treturn 1;\n\t} else if (current->thread.used_vr) {\n\t\tmemset(¤t->thread.vr_state, 0,\n\t\t ELF_NVRREG * sizeof(vector128));\n\t\tmemset(¤t->thread.transact_vr, 0,\n\t\t ELF_NVRREG * sizeof(vector128));\n\t}\n\n\t/* Always get VRSAVE back */\n\tif (__get_user(current->thread.vrsave,\n\t\t (u32 __user *)&sr->mc_vregs[32]) ||\n\t __get_user(current->thread.transact_vrsave,\n\t\t (u32 __user *)&tm_sr->mc_vregs[32]))\n\t\treturn 1;\n\tif (cpu_has_feature(CPU_FTR_ALTIVEC))\n\t\tmtspr(SPRN_VRSAVE, current->thread.vrsave);\n#endif /* CONFIG_ALTIVEC */\n\n\tregs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1);\n\n\tif (copy_fpr_from_user(current, &sr->mc_fregs) ||\n\t copy_transact_fpr_from_user(current, &tm_sr->mc_fregs))\n\t\treturn 1;\n\n#ifdef CONFIG_VSX\n\tregs->msr &= ~MSR_VSX;\n\tif (msr & MSR_VSX) {\n\t\t/*\n\t\t * Restore altivec registers from the stack to a local\n\t\t * buffer, then write this out to the thread_struct\n\t\t */\n\t\tif (copy_vsx_from_user(current, &sr->mc_vsregs) ||\n\t\t copy_transact_vsx_from_user(current, &tm_sr->mc_vsregs))\n\t\t\treturn 1;\n\t} else if (current->thread.used_vsr)\n\t\tfor (i = 0; i < 32 ; i++) {\n\t\t\tcurrent->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;\n\t\t\tcurrent->thread.transact_fp.fpr[i][TS_VSRLOWOFFSET] = 0;\n\t\t}\n#endif /* CONFIG_VSX */\n\n#ifdef CONFIG_SPE\n\t/* SPE regs are not checkpointed with TM, so this section is\n\t * simply the same as in restore_user_regs().\n\t */\n\tregs->msr &= ~MSR_SPE;\n\tif (msr & MSR_SPE) {\n\t\tif (__copy_from_user(current->thread.evr, &sr->mc_vregs,\n\t\t\t\t ELF_NEVRREG * sizeof(u32)))\n\t\t\treturn 1;\n\t} else if (current->thread.used_spe)\n\t\tmemset(current->thread.evr, 0, ELF_NEVRREG * sizeof(u32));\n\n\t/* Always get SPEFSCR back */\n\tif (__get_user(current->thread.spefscr, (u32 __user *)&sr->mc_vregs\n\t\t + ELF_NEVRREG))\n\t\treturn 1;\n#endif /* CONFIG_SPE */\n\n\t/* Get the top half of the MSR from the user context */\n\tif (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))\n\t\treturn 1;\n\tmsr_hi <<= 32;\n\t/* If TM bits are set to the reserved value, it's an invalid context */\n\tif (MSR_TM_RESV(msr_hi))\n\t\treturn 1;\n\t/* Pull in the MSR TM bits from the user context */\n\tregs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK);\n\t/* Now, recheckpoint. This loads up all of the checkpointed (older)\n\t * registers, including FP and V[S]Rs. After recheckpointing, the\n\t * transactional versions should be loaded.\n\t */\n\ttm_enable();\n\t/* Make sure the transaction is marked as failed */\n\tcurrent->thread.tm_texasr |= TEXASR_FS;\n\t/* This loads the checkpointed FP/VEC state, if used */\n\ttm_recheckpoint(¤t->thread, msr);\n\n\t/* This loads the speculative FP/VEC state, if used */\n\tif (msr & MSR_FP) {\n\t\tdo_load_up_transact_fpu(¤t->thread);\n\t\tregs->msr |= (MSR_FP | current->thread.fpexc_mode);\n\t}\n#ifdef CONFIG_ALTIVEC\n\tif (msr & MSR_VEC) {\n\t\tdo_load_up_transact_altivec(¤t->thread);\n\t\tregs->msr |= MSR_VEC;\n\t}\n#endif\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "func (m *A) Unmarshal(dAtA []byte) error {\n\tvar hasFields [1]uint64\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowVanity\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: A: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: A: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Strings\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowVanity\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.Strings = string(dAtA[iNdEx:postIndex])\n\t\t\tiNdEx = postIndex\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Int\", wireType)\n\t\t\t}\n\t\t\tm.Int = 0\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowVanity\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tm.Int |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\thasFields[0] |= uint64(0x00000001)\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipVanity(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\tif hasFields[0]&uint64(0x00000001) == 0 {\n\t\treturn github_com_gogo_protobuf_proto.NewRequiredNotSetError(\"Int\")\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it \"succeeds\" do\n connection.write auth\n reply = Protocol::Reply.deserialize(connection).documents[0]\n reply[\"ok\"].should eq 1.0\n end", "label": 0, "label_name": "vulnerable"} +{"code": " $this->inBody($token);\n\n /* Anything else */\n } else {\n /* Parse error. Ignore the token. */\n }\n }", "label": 1, "label_name": "safe"} +{"code": "void ff_h264_free_tables(H264Context *h, int free_rbsp)\n{\n int i;\n H264Context *hx;\n\n av_freep(&h->intra4x4_pred_mode);\n av_freep(&h->chroma_pred_mode_table);\n av_freep(&h->cbp_table);\n av_freep(&h->mvd_table[0]);\n av_freep(&h->mvd_table[1]);\n av_freep(&h->direct_table);\n av_freep(&h->non_zero_count);\n av_freep(&h->slice_table_base);\n h->slice_table = NULL;\n av_freep(&h->list_counts);\n\n av_freep(&h->mb2b_xy);\n av_freep(&h->mb2br_xy);\n\n av_buffer_pool_uninit(&h->qscale_table_pool);\n av_buffer_pool_uninit(&h->mb_type_pool);\n av_buffer_pool_uninit(&h->motion_val_pool);\n av_buffer_pool_uninit(&h->ref_index_pool);\n\n if (free_rbsp && h->DPB) {\n for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)\n ff_h264_unref_picture(h, &h->DPB[i]);\n memset(h->delayed_pic, 0, sizeof(h->delayed_pic));\n av_freep(&h->DPB);\n } else if (h->DPB) {\n for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)\n h->DPB[i].needs_realloc = 1;\n }\n\n h->cur_pic_ptr = NULL;\n\n for (i = 0; i < H264_MAX_THREADS; i++) {\n hx = h->thread_context[i];\n if (!hx)\n continue;\n av_freep(&hx->top_borders[1]);\n av_freep(&hx->top_borders[0]);\n av_freep(&hx->bipred_scratchpad);\n av_freep(&hx->edge_emu_buffer);\n av_freep(&hx->dc_val_base);\n av_freep(&hx->er.mb_index2xy);\n av_freep(&hx->er.error_status_table);\n av_freep(&hx->er.er_temp_buffer);\n av_freep(&hx->er.mbintra_table);\n av_freep(&hx->er.mbskip_table);\n\n if (free_rbsp) {\n av_freep(&hx->rbsp_buffer[1]);\n av_freep(&hx->rbsp_buffer[0]);\n hx->rbsp_buffer_size[0] = 0;\n hx->rbsp_buffer_size[1] = 0;\n }\n if (i)\n av_freep(&h->thread_context[i]);\n }\n}", "label": 1, "label_name": "safe"} +{"code": " public function testWith()\n {\n $token = new HTMLPurifier_Token_Start('tag');\n $this->context->register('CurrentToken', $token);\n $this->with->expectOnce('validate');\n $this->with->returns('validate', 'foo');\n $this->assertDef('bar', 'foo');\n }", "label": 1, "label_name": "safe"} +{"code": " public function getConfiguration(array $config, ContainerBuilder $container)\n {\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testProcess()\n {\n $container = new ContainerBuilder();\n $def = $container\n ->register('foo')\n ->setArguments(array(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE)))\n ->addMethodCall('foo', array(new Reference('moo', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))\n ;\n\n $this->process($container);\n\n $arguments = $def->getArguments();\n $this->assertNull($arguments[0]);\n $this->assertCount(0, $def->getMethodCalls());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "Status ShapeRefiner::InferShapesForFunctionSubNode(\n const Node* node, InferenceContext* outer_context) {\n TF_RETURN_IF_ERROR(AddNodeInternal(node, outer_context));\n InferenceContext* node_context = CHECK_NOTNULL(GetContext(node));\n\n if (StringPiece(node->type_string()) == kArgOp) {\n // Handle special node: function input.\n // Shapes for these nodes are provided in the outer inference\n // context.\n\n int index;\n TF_RETURN_IF_ERROR(GetNodeAttr(AttrSlice(node->def()), \"index\", &index));\n\n if (index < 0 || outer_context->num_inputs() <= index) {\n return errors::Internal(\n \"Function instantiation included invalid input index: \", index,\n \" not in [0, \", outer_context->num_inputs(), \").\");\n }\n\n // TODO(b/134547156): TEMPORARY WORKAROUND. If input shape handle is not set\n // in outer context, set _Arg node output shape to unknown.\n if (outer_context->input(index).SameHandle(ShapeHandle())) {\n VLOG(1) << \"Function instantiation has undefined input shape at \"\n << \"index: \" << index << \" in the outer inference context.\";\n node_context->set_output(0, node_context->UnknownShape());\n } else {\n node_context->set_output(0, outer_context->input(index));\n }\n\n auto* resource = outer_context->input_handle_shapes_and_types(index);\n if (resource) {\n node_context->set_output_handle_shapes_and_types(0, *resource);\n }\n } else if (StringPiece(node->type_string()) == kRetvalOp) {\n // Handle special node: function output.\n // Shapes inferred for these nodes go into the outer inference\n // context.\n\n int index;\n TF_RETURN_IF_ERROR(GetNodeAttr(AttrSlice(node->def()), \"index\", &index));\n\n if (index < 0 || outer_context->num_outputs() <= index) {\n return errors::Internal(\n \"Function instantiation included invalid output index: \", index,\n \" not in [0, \", outer_context->num_outputs(), \").\");\n }\n\n // outer_context outlives node_context, therefore we need to create\n // a new shape handle owned by outer_context instead.\n ShapeHandle handle;\n TensorShapeProto proto;\n node_context->ShapeHandleToProto(node_context->input(0), &proto);\n TF_RETURN_IF_ERROR(outer_context->MakeShapeFromShapeProto(proto, &handle));\n outer_context->set_output(index, handle);\n\n auto* resource = node_context->input_handle_shapes_and_types(0);\n if (resource) {\n outer_context->set_output_handle_shapes_and_types(index, *resource);\n }\n }\n\n return Status::OK();\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function comments_count()\r\n {\r\n global $DB;\r\n\r\n if(empty($this->_comments_count))\r\n {\r\n $DB->query('\r\n SELECT COUNT(*) as total\r\n FROM nv_comments\r\n WHERE website = ' . intval($this->website) . '\r\n AND object_type = \"product\"\r\n AND object_id = ' . intval($this->id) . '\r\n AND status = 0'\r\n );\r\n\r\n $out = $DB->result('total');\r\n $this->_comments_count = $out[0];\r\n }\r\n\r\n return $this->_comments_count;\r\n }\r", "label": 1, "label_name": "safe"} +{"code": "win_new_tabpage(int after)\n{\n tabpage_T\t*tp = curtab;\n tabpage_T\t*prev_tp = curtab;\n tabpage_T\t*newtp;\n int\t\tn;\n\n#ifdef FEAT_CMDWIN\n if (cmdwin_type != 0)\n {\n\temsg(_(e_invalid_in_cmdline_window));\n\treturn FAIL;\n }\n#endif\n\n newtp = alloc_tabpage();\n if (newtp == NULL)\n\treturn FAIL;\n\n // Remember the current windows in this Tab page.\n if (leave_tabpage(curbuf, TRUE) == FAIL)\n {\n\tvim_free(newtp);\n\treturn FAIL;\n }\n curtab = newtp;\n\n newtp->tp_localdir = (tp->tp_localdir == NULL)\n\t\t\t\t ? NULL : vim_strsave(tp->tp_localdir);\n // Create a new empty window.\n if (win_alloc_firstwin(tp->tp_curwin) == OK)\n {\n\t// Make the new Tab page the new topframe.\n\tif (after == 1)\n\t{\n\t // New tab page becomes the first one.\n\t newtp->tp_next = first_tabpage;\n\t first_tabpage = newtp;\n\t}\n\telse\n\t{\n\t if (after > 0)\n\t {\n\t\t// Put new tab page before tab page \"after\".\n\t\tn = 2;\n\t\tfor (tp = first_tabpage; tp->tp_next != NULL\n\t\t\t\t\t && n < after; tp = tp->tp_next)\n\t\t ++n;\n\t }\n\t newtp->tp_next = tp->tp_next;\n\t tp->tp_next = newtp;\n\t}\n\tnewtp->tp_firstwin = newtp->tp_lastwin = newtp->tp_curwin = curwin;\n\n\twin_init_size();\n\tfirstwin->w_winrow = tabline_height();\n\twin_comp_scroll(curwin);\n\n\tnewtp->tp_topframe = topframe;\n\tlast_status(FALSE);\n\n\tlastused_tabpage = prev_tp;\n\n#if defined(FEAT_GUI)\n\t// When 'guioptions' includes 'L' or 'R' may have to remove or add\n\t// scrollbars. Have to update them anyway.\n\tgui_may_update_scrollbars();\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\tentering_window(curwin);\n#endif\n\n\tredraw_all_later(NOT_VALID);\n\tapply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\treturn OK;\n }\n\n // Failed, get back the previous Tab page\n enter_tabpage(curtab, curbuf, TRUE, TRUE);\n return FAIL;\n}", "label": 1, "label_name": "safe"} +{"code": " def handle_delete_user(self, req):\n \"\"\"Handles the DELETE v2// call for deleting a user from an\n account.\n\n Can only be called by an account .admin.\n\n :param req: The swob.Request to process.\n :returns: swob.Response, 2xx on success.\n \"\"\"\n # Validate path info\n account = req.path_info_pop()\n user = req.path_info_pop()\n if req.path_info or not account or account[0] == '.' or not user or \\\n user[0] == '.':\n return HTTPBadRequest(request=req)\n\n # if user to be deleted is reseller_admin, then requesting\n # user must be the super_admin\n is_reseller_admin = self.is_user_reseller_admin(req, account, user)\n if not is_reseller_admin and not req.credentials_valid:\n # if user to be deleted can't be found, return 404\n return HTTPNotFound(request=req)\n elif is_reseller_admin and not self.is_super_admin(req):\n return HTTPForbidden(request=req)\n\n if not self.is_account_admin(req, account):\n return self.denied_response(req)\n\n # Delete the user's existing token, if any.\n path = quote('/v1/%s/%s/%s' % (self.auth_account, account, user))\n resp = self.make_pre_authed_request(\n req.environ, 'HEAD', path).get_response(self.app)\n if resp.status_int == 404:\n return HTTPNotFound(request=req)\n elif resp.status_int // 100 != 2:\n raise Exception('Could not obtain user details: %s %s' %\n (path, resp.status))\n candidate_token = resp.headers.get('x-object-meta-auth-token')\n if candidate_token:\n object_name = self._get_concealed_token(candidate_token)\n path = quote('/v1/%s/.token_%s/%s' %\n (self.auth_account, object_name[-1], object_name))\n resp = self.make_pre_authed_request(\n req.environ, 'DELETE', path).get_response(self.app)\n if resp.status_int // 100 != 2 and resp.status_int != 404:\n raise Exception('Could not delete possibly existing token: '\n '%s %s' % (path, resp.status))\n # Delete the user entry itself.\n path = quote('/v1/%s/%s/%s' % (self.auth_account, account, user))\n resp = self.make_pre_authed_request(\n req.environ, 'DELETE', path).get_response(self.app)\n if resp.status_int // 100 != 2 and resp.status_int != 404:\n raise Exception('Could not delete the user object: %s %s' %\n (path, resp.status))\n return HTTPNoContent(request=req)", "label": 1, "label_name": "safe"} +{"code": " async exec () {\n if (this.npm.config.get('global')) {\n const err = new Error('`npm ci` does not work for global packages')\n err.code = 'ECIGLOBAL'\n throw err\n }\n\n const where = this.npm.prefix\n const opts = {\n ...this.npm.flatOptions,\n path: where,\n log,\n save: false, // npm ci should never modify the lockfile or package.json\n workspaces: this.workspaceNames,\n }\n\n const arb = new Arborist(opts)\n await Promise.all([\n arb.loadVirtual().catch(er => {\n log.verbose('loadVirtual', er.stack)\n const msg =\n 'The `npm ci` command can only install with an existing package-lock.json or\\n' +\n 'npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or\\n' +\n 'later to generate a package-lock.json file, then try again.'\n throw new Error(msg)\n }),\n removeNodeModules(where),\n ])\n\n // retrieves inventory of packages from loaded virtual tree (lock file)\n const virtualInventory = new Map(arb.virtualTree.inventory)\n\n // build ideal tree step needs to come right after retrieving the virtual\n // inventory since it's going to erase the previous ref to virtualTree\n await arb.buildIdealTree()\n\n // verifies that the packages from the ideal tree will match\n // the same versions that are present in the virtual tree (lock file)\n // throws a validation error in case of mismatches\n const errors = validateLockfile(virtualInventory, arb.idealTree.inventory)\n if (errors.length) {\n throw new Error(\n '`npm ci` can only install packages when your package.json and ' +\n 'package-lock.json or npm-shrinkwrap.json are in sync. Please ' +\n 'update your lock file with `npm install` ' +\n 'before continuing.\\n\\n' +\n errors.join('\\n') + '\\n'\n )\n }\n\n await arb.reify(opts)\n\n const ignoreScripts = this.npm.config.get('ignore-scripts')\n // run the same set of scripts that `npm install` runs.\n if (!ignoreScripts) {\n const scripts = [\n 'preinstall',\n 'install',\n 'postinstall',\n 'prepublish', // XXX should we remove this finally??\n 'preprepare',\n 'prepare',\n 'postprepare',\n ]\n const scriptShell = this.npm.config.get('script-shell') || undefined\n for (const event of scripts) {\n await runScript({\n path: where,\n args: [],\n scriptShell,\n stdio: 'inherit',\n stdioString: true,\n banner: log.level !== 'silent',\n event,\n })\n }\n }\n await reifyFinish(this.npm, arb)\n }", "label": 1, "label_name": "safe"} +{"code": "def test_unicode_url():\n mw = _get_mw()\n req = SplashRequest(\n # note unicode URL\n u\"http://example.com/\", endpoint='execute')\n req2 = mw.process_request(req, None) or req\n res = {'html': 'Hello'}\n res_body = json.dumps(res)\n response = TextResponse(\"http://mysplash.example.com/execute\",\n # Scrapy doesn't pass request to constructor\n # request=req2,\n headers={b'Content-Type': b'application/json'},\n body=res_body.encode('utf8'))\n response2 = mw.process_response(req2, response, None)\n assert response2.url == \"http://example.com/\"", "label": 1, "label_name": "safe"} +{"code": "\"1\":null},ea.getVerticesAndEdges())},{install:function(ja){this.listener=function(){ja(Editor.sketchMode)};X.addListener(\"sketchModeChanged\",this.listener)},destroy:function(){X.removeListener(this.listener)}});O.appendChild(ka)}return O};var ba=Menus.prototype.init;Menus.prototype.init=function(){ba.apply(this,arguments);var O=this.editorUi,X=O.editor.graph;O.actions.get(\"editDiagram\").label=mxResources.get(\"formatXml\")+\"...\";O.actions.get(\"createShape\").label=mxResources.get(\"shape\")+\"...\";O.actions.get(\"outline\").label=", "label": 1, "label_name": "safe"} +{"code": " public bool UpdateNotes(Dictionary notes)\n {\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,\n UrlPrefix + Uri.EscapeUriString(Uuid) + \"/notes\",\n WriteSubscriptionNotesXml(notes),\n ReadXml);\n\n CustomerNotes = notes[\"CustomerNotes\"];\n TermsAndConditions = notes[\"TermsAndConditions\"];\n VatReverseChargeNotes = notes[\"VatReverseChargeNotes\"];\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "async function mockStdInForAuthExpectError(t, mockLogger, ...text) {\n const stdin = stream.Readable.from(text);\n await t.throwsAsync(async () => util.getGitHubAuth(mockLogger, undefined, true, stdin));\n}", "label": 1, "label_name": "safe"} +{"code": "NO_INLINE JsVar *jspeStatement() {\n#ifdef USE_DEBUGGER\n if (execInfo.execute&EXEC_DEBUGGER_NEXT_LINE &&\n lex->tk!=';' &&\n JSP_SHOULD_EXECUTE) {\n lex->tokenLastStart = jsvStringIteratorGetIndex(&lex->tokenStart.it)-1;\n jsiDebuggerLoop();\n }\n#endif\n if (lex->tk==LEX_ID ||\n lex->tk==LEX_INT ||\n lex->tk==LEX_FLOAT ||\n lex->tk==LEX_STR ||\n lex->tk==LEX_TEMPLATE_LITERAL ||\n lex->tk==LEX_REGEX ||\n lex->tk==LEX_R_NEW ||\n lex->tk==LEX_R_NULL ||\n lex->tk==LEX_R_UNDEFINED ||\n lex->tk==LEX_R_TRUE ||\n lex->tk==LEX_R_FALSE ||\n lex->tk==LEX_R_THIS ||\n lex->tk==LEX_R_DELETE ||\n lex->tk==LEX_R_TYPEOF ||\n lex->tk==LEX_R_VOID ||\n lex->tk==LEX_R_SUPER ||\n lex->tk==LEX_PLUSPLUS ||\n lex->tk==LEX_MINUSMINUS ||\n lex->tk=='!' ||\n lex->tk=='-' ||\n lex->tk=='+' ||\n lex->tk=='~' ||\n lex->tk=='[' ||\n lex->tk=='(') {\n /* Execute a simple statement that only contains basic arithmetic... */\n return jspeExpression();\n } else if (lex->tk=='{') {\n /* A block of code */\n if (!jspCheckStackPosition()) return 0;\n jspeBlock();\n return 0;\n } else if (lex->tk==';') {\n /* Empty statement - to allow things like ;;; */\n JSP_ASSERT_MATCH(';');\n return 0;\n } else if (lex->tk==LEX_R_VAR ||\n lex->tk==LEX_R_LET ||\n lex->tk==LEX_R_CONST) {\n return jspeStatementVar();\n } else if (lex->tk==LEX_R_IF) {\n return jspeStatementIf();\n } else if (lex->tk==LEX_R_DO) {\n return jspeStatementDoOrWhile(false);\n } else if (lex->tk==LEX_R_WHILE) {\n return jspeStatementDoOrWhile(true);\n } else if (lex->tk==LEX_R_FOR) {\n return jspeStatementFor();\n } else if (lex->tk==LEX_R_TRY) {\n return jspeStatementTry();\n } else if (lex->tk==LEX_R_RETURN) {\n return jspeStatementReturn();\n } else if (lex->tk==LEX_R_THROW) {\n return jspeStatementThrow();\n } else if (lex->tk==LEX_R_FUNCTION) {\n return jspeStatementFunctionDecl(false/* function */);\n#ifndef SAVE_ON_FLASH\n } else if (lex->tk==LEX_R_CLASS) {\n return jspeStatementFunctionDecl(true/* class */);\n#endif\n } else if (lex->tk==LEX_R_CONTINUE) {\n JSP_ASSERT_MATCH(LEX_R_CONTINUE);\n if (JSP_SHOULD_EXECUTE) {\n if (!(execInfo.execute & EXEC_IN_LOOP))\n jsExceptionHere(JSET_SYNTAXERROR, \"CONTINUE statement outside of FOR or WHILE loop\");\n else\n execInfo.execute = (execInfo.execute & (JsExecFlags)~EXEC_RUN_MASK) | EXEC_CONTINUE;\n }\n } else if (lex->tk==LEX_R_BREAK) {\n JSP_ASSERT_MATCH(LEX_R_BREAK);\n if (JSP_SHOULD_EXECUTE) {\n if (!(execInfo.execute & (EXEC_IN_LOOP|EXEC_IN_SWITCH)))\n jsExceptionHere(JSET_SYNTAXERROR, \"BREAK statement outside of SWITCH, FOR or WHILE loop\");\n else\n execInfo.execute = (execInfo.execute & (JsExecFlags)~EXEC_RUN_MASK) | EXEC_BREAK;\n }\n } else if (lex->tk==LEX_R_SWITCH) {\n return jspeStatementSwitch();\n } else if (lex->tk==LEX_R_DEBUGGER) {\n JSP_ASSERT_MATCH(LEX_R_DEBUGGER);\n#ifdef USE_DEBUGGER\n if (JSP_SHOULD_EXECUTE)\n jsiDebuggerLoop();\n#endif\n } else JSP_MATCH(LEX_EOF);\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t\t: function oneTimeInterceptedExpression(\n\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\tlocals,\n\t\t\t\t\t\t\tassign,\n\t\t\t\t\t\t\tinputs\n\t\t\t\t\t ) {\n\t\t\t\t\t\t\tvar value = parsedExpression(scope, locals, assign, inputs);\n\t\t\t\t\t\t\tvar result = interceptorFn(value, scope, locals);\n\t\t\t\t\t\t\t// we only return the interceptor's result if the\n\t\t\t\t\t\t\t// initial value is defined (for bind-once)\n\t\t\t\t\t\t\treturn isDefined(value) ? result : value;\n\t\t\t\t\t };", "label": 1, "label_name": "safe"} +{"code": " didSet {\n guard stream != oldValue else { return }\n updateCaptureState()\n }", "label": 1, "label_name": "safe"} +{"code": "file_rlookup(const char *filename)\t/* I - Filename */\n{\n int\t\ti;\t\t\t/* Looping var */\n cache_t\t*wc;\t\t\t/* Current cache file */\n\n\n for (i = web_files, wc = web_cache; i > 0; i --, wc ++)\n {\n if (!strcmp(wc->name, filename))\n {\n if (!strncmp(wc->url, \"data:\", 5))\n return (\"data URL\");\n else\n return (wc->url);\n }\n }\n\n return (filename);\n}", "label": 1, "label_name": "safe"} +{"code": "bool WebSocketProtocol::handleFragment(char *data, size_t length, unsigned int remainingBytes, int opCode, bool fin, void *user) {\n uS::Socket s((uv_poll_t *) user);\n typename WebSocket::Data *webSocketData = (typename WebSocket::Data *) s.getSocketData();\n\n if (opCode < 3) {\n if (!remainingBytes && fin && !webSocketData->fragmentBuffer.length()) {\n if (webSocketData->compressionStatus == WebSocket::Data::CompressionStatus::COMPRESSED_FRAME) {\n webSocketData->compressionStatus = WebSocket::Data::CompressionStatus::ENABLED;\n Hub *hub = ((Group *) s.getSocketData()->nodeData)->hub;\n data = hub->inflate(data, length);\n if (!data) {\n forceClose(user);\n return true;\n }\n }\n\n if (opCode == 1 && !isValidUtf8((unsigned char *) data, length)) {\n forceClose(user);\n return true;\n }\n\n ((Group *) s.getSocketData()->nodeData)->messageHandler(WebSocket(s), data, length, (OpCode) opCode);\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n } else {\n webSocketData->fragmentBuffer.append(data, length);\n if (!remainingBytes && fin) {\n length = webSocketData->fragmentBuffer.length();\n if (webSocketData->compressionStatus == WebSocket::Data::CompressionStatus::COMPRESSED_FRAME) {\n webSocketData->compressionStatus = WebSocket::Data::CompressionStatus::ENABLED;\n Hub *hub = ((Group *) s.getSocketData()->nodeData)->hub;\n webSocketData->fragmentBuffer.append(\"....\");\n data = hub->inflate((char *) webSocketData->fragmentBuffer.data(), length);\n if (!data) {\n forceClose(user);\n return true;\n }\n } else {\n data = (char *) webSocketData->fragmentBuffer.data();\n }\n\n if (opCode == 1 && !isValidUtf8((unsigned char *) data, length)) {\n forceClose(user);\n return true;\n }\n\n ((Group *) s.getSocketData()->nodeData)->messageHandler(WebSocket(s), data, length, (OpCode) opCode);\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n webSocketData->fragmentBuffer.clear();\n }\n }\n } else {\n // todo: we don't need to buffer up in most cases!\n webSocketData->controlBuffer.append(data, length);\n if (!remainingBytes && fin) {\n if (opCode == CLOSE) {\n CloseFrame closeFrame = parseClosePayload((char *) webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length());\n WebSocket(s).close(closeFrame.code, closeFrame.message, closeFrame.length);\n return true;\n } else {\n if (opCode == PING) {\n WebSocket(s).send(webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length(), (OpCode) OpCode::PONG);\n ((Group *) s.getSocketData()->nodeData)->pingHandler(WebSocket(s), (char *) webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length());\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n } else if (opCode == PONG) {\n ((Group *) s.getSocketData()->nodeData)->pongHandler(WebSocket(s), (char *) webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length());\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n }\n }\n webSocketData->controlBuffer.clear();\n }\n }\n\n return false;\n}", "label": 1, "label_name": "safe"} +{"code": "TEST_F(ListenerManagerImplQuicOnlyTest, QuicListenerFactoryWithWrongCodec) {\n const std::string yaml = TestEnvironment::substitute(R\"EOF(\naddress:\n socket_address:\n address: 127.0.0.1\n protocol: UDP\n port_value: 1234\nfilter_chains:\n- filter_chain_match:\n transport_protocol: \"quic\"\n filters: []\n transport_socket:\n name: envoy.transport_sockets.quic\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.transport_sockets.quic.v3.QuicDownstreamTransport\n downstream_tls_context:\n common_tls_context:\n tls_certificates:\n - certificate_chain:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem\"\n private_key:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem\"\n validation_context:\n trusted_ca:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem\"\n match_typed_subject_alt_names:\n - matcher:\n exact: localhost\n san_type: URI\n - matcher:\n exact: 127.0.0.1\n san_type: IP_ADDRESS\nudp_listener_config:\n quic_options: {}\n )EOF\",\n Network::Address::IpVersion::v4);\n\n envoy::config::listener::v3::Listener listener_proto = parseListenerFromV3Yaml(yaml);\n\n#if defined(ENVOY_ENABLE_QUIC)\n EXPECT_THROW_WITH_REGEX(manager_->addOrUpdateListener(listener_proto, \"\", true), EnvoyException,\n \"error building network filter chain for quic listener: requires exactly \"\n \"one http_connection_manager filter.\");\n#else\n EXPECT_THROW_WITH_REGEX(manager_->addOrUpdateListener(listener_proto, \"\", true), EnvoyException,\n \"QUIC is configured but not enabled in the build.\");\n#endif\n}", "label": 1, "label_name": "safe"} +{"code": " this.disableChatSoundUser = function(inst)\n {\n \tif (inst.find('> i').text() == 'volume_off') {\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/1');\n \t\tconfLH.new_message_sound_user_enabled = 1;\n \t\tinst.find('> i').text('volume_up');\n \t} else {\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/0');\n \t\tconfLH.new_message_sound_user_enabled = 0;\n \t\tinst.find('> i').text('volume_off');\n \t};\n\n \tif (!!window.postMessage && parent) {\n \t\tif (inst.find('> i').text() == 'volume_off') {\n \t\t\tparent.postMessage(\"lhc_ch:s:0\", '*');\n \t\t} else {\n \t\t\tparent.postMessage(\"lhc_ch:s:1\", '*');\n \t\t}\n \t};\n\n \treturn false;\n };", "label": 0, "label_name": "vulnerable"} +{"code": " void Compute(OpKernelContext* c) override {\n PartialTensorShape element_shape;\n OP_REQUIRES_OK(c, TensorShapeFromTensor(c->input(0), &element_shape));\n int32 num_elements = c->input(1).scalar()();\n OP_REQUIRES(c, num_elements >= 0,\n errors::InvalidArgument(\"The num_elements to reserve must be a \"\n \"non negative number, but got \",\n num_elements));\n TensorList output;\n output.element_shape = element_shape;\n output.element_dtype = element_dtype_;\n output.tensors().resize(num_elements, Tensor(DT_INVALID));\n Tensor* result;\n AllocatorAttributes attr;\n attr.set_on_host(true);\n OP_REQUIRES_OK(c, c->allocate_output(0, TensorShape{}, &result, attr));\n result->scalar()() = std::move(output);\n }", "label": 1, "label_name": "safe"} +{"code": "def main(req: func.HttpRequest) -> func.HttpResponse:\n response = ok(\n Info(\n resource_group=get_base_resource_group(),\n region=get_base_region(),\n subscription=get_subscription(),\n versions=versions(),\n instance_id=get_instance_id(),\n insights_appid=get_insights_appid(),\n insights_instrumentation_key=get_insights_instrumentation_key(),\n )\n )\n\n return response", "label": 0, "label_name": "vulnerable"} +{"code": " public function getSourceKey()\n {\n return $this->sourceKey;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private static void testInvalidHeaders0(String requestStr) {\n EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder());\n assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII)));\n HttpRequest request = channel.readInbound();\n assertTrue(request.decoderResult().isFailure());\n assertTrue(request.decoderResult().cause() instanceof IllegalArgumentException);\n assertFalse(channel.finish());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "cosine_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,\n\tBuffer *buf, int *err, gchar **err_info)\n{\n\tchar\tline[COSINE_LINE_LENGTH];\n\n\tif (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)\n\t\treturn FALSE;\n\n\tif (file_gets(line, COSINE_LINE_LENGTH, wth->random_fh) == NULL) {\n\t\t*err = file_error(wth->random_fh, err_info);\n\t\tif (*err == 0) {\n\t\t\t*err = WTAP_ERR_SHORT_READ;\n\t\t}\n\t\treturn FALSE;\n\t}\n\n\t/* Parse the header and convert the ASCII hex dump to binary data */\n\treturn parse_cosine_packet(wth->random_fh, phdr, buf, line, err,\n\t err_info);\n}", "label": 1, "label_name": "safe"} +{"code": " public function make($string)\n {\n return new HTMLPurifier_AttrDef_HTML_Bool($string);\n }", "label": 1, "label_name": "safe"} +{"code": " public String resolveDriverClassName(DriverClassNameResolveRequest request) {\n return driverResources.resolveDriverClassName(request.getJdbcDriverFileUrl());\n }", "label": 1, "label_name": "safe"} +{"code": "function(qb,yb){var ub=tb.apply(this,arguments);return null==ub||qb.view.graph.isCustomLink(ub)?null:ub};pa.getLinkTargetForCellState=function(qb,yb){return qb.view.graph.getLinkTargetForCell(qb.cell)};pa.drawCellState=function(qb,yb){for(var ub=qb.view.graph,vb=null!=Ta?Ta.get(qb.cell):ub.isCellSelected(qb.cell),wb=ub.model.getParent(qb.cell);!(ia&&null==Ta||vb)&&null!=wb;)vb=null!=Ta?Ta.get(wb):ub.isCellSelected(wb),wb=ub.model.getParent(wb);(ia&&null==Ta||vb)&&gb.apply(this,arguments)};pa.drawState(this.getView().getState(this.model.root),", "label": 0, "label_name": "vulnerable"} +{"code": "var M=mxText.prototype.redraw;mxText.prototype.redraw=function(){M.apply(this,arguments);null!=this.node&&\"DIV\"==this.node.nodeName&&Graph.processFontAttributes(this.node)};Graph.prototype.createTagsDialog=function(p,C,I){function T(){for(var la=R.getSelectionCells(),Aa=[],Fa=0;FagenerateFilePath($config);\n if (!file_exists($file)) {\n return false;\n }\n return unlink($file);\n }", "label": 1, "label_name": "safe"} +{"code": "func (m *MyType) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowAsym\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: MyType: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: MyType: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipAsym(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthAsym\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthAsym\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def make_homeserver(self, reactor, clock):\n hs = self.setup_test_homeserver(\n \"server\", http_client=None, federation_sender=Mock()\n )\n return hs", "label": 0, "label_name": "vulnerable"} +{"code": " public function doValidate(&$uri, $config, $context)\n {\n $uri->query = null;\n\n // typecode check\n $semicolon_pos = strrpos($uri->path, ';'); // reverse\n if ($semicolon_pos !== false) {\n $type = substr($uri->path, $semicolon_pos + 1); // no semicolon\n $uri->path = substr($uri->path, 0, $semicolon_pos);\n $type_ret = '';\n if (strpos($type, '=') !== false) {\n // figure out whether or not the declaration is correct\n list($key, $typecode) = explode('=', $type, 2);\n if ($key !== 'type') {\n // invalid key, tack it back on encoded\n $uri->path .= '%3B' . $type;\n } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') {\n $type_ret = \";type=$typecode\";\n }\n } else {\n $uri->path .= '%3B' . $type;\n }\n $uri->path = str_replace(';', '%3B', $uri->path);\n $uri->path .= $type_ret;\n }\n return true;\n }", "label": 1, "label_name": "safe"} +{"code": "func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint32, netNSPath string, containerName string,\n\tconfig *runtime.ContainerConfig, sandboxConfig *runtime.PodSandboxConfig, imageConfig *imagespec.ImageConfig,\n\textraMounts []*runtime.Mount, ociRuntime config.Runtime) (_ *runtimespec.Spec, retErr error) {\n\n\tspecOpts := []oci.SpecOpts{\n\t\tcustomopts.WithoutRunMount,\n\t}\n\t// only clear the default security settings if the runtime does not have a custom\n\t// base runtime spec spec. Admins can use this functionality to define\n\t// default ulimits, seccomp, or other default settings.\n\tif ociRuntime.BaseRuntimeSpec == \"\" {\n\t\tspecOpts = append(specOpts, customopts.WithoutDefaultSecuritySettings)\n\t}\n\tspecOpts = append(specOpts,\n\t\tcustomopts.WithRelativeRoot(relativeRootfsPath),\n\t\tcustomopts.WithProcessArgs(config, imageConfig),\n\t\toci.WithDefaultPathEnv,\n\t\t// this will be set based on the security context below\n\t\toci.WithNewPrivileges,\n\t)\n\tif config.GetWorkingDir() != \"\" {\n\t\tspecOpts = append(specOpts, oci.WithProcessCwd(config.GetWorkingDir()))\n\t} else if imageConfig.WorkingDir != \"\" {\n\t\tspecOpts = append(specOpts, oci.WithProcessCwd(imageConfig.WorkingDir))\n\t}\n\n\tif config.GetTty() {\n\t\tspecOpts = append(specOpts, oci.WithTTY)\n\t}\n\n\t// Add HOSTNAME env.\n\tvar (\n\t\terr error\n\t\thostname = sandboxConfig.GetHostname()\n\t)\n\tif hostname == \"\" {\n\t\tif hostname, err = c.os.Hostname(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tspecOpts = append(specOpts, oci.WithEnv([]string{hostnameEnv + \"=\" + hostname}))\n\n\t// Apply envs from image config first, so that envs from container config\n\t// can override them.\n\tenv := imageConfig.Env\n\tfor _, e := range config.GetEnvs() {\n\t\tenv = append(env, e.GetKey()+\"=\"+e.GetValue())\n\t}\n\tspecOpts = append(specOpts, oci.WithEnv(env))\n\n\tsecurityContext := config.GetLinux().GetSecurityContext()\n\tlabelOptions, err := toLabel(securityContext.GetSelinuxOptions())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(labelOptions) == 0 {\n\t\t// Use pod level SELinux config\n\t\tif sandbox, err := c.sandboxStore.Get(sandboxID); err == nil {\n\t\t\tlabelOptions, err = selinux.DupSecOpt(sandbox.ProcessLabel)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tprocessLabel, mountLabel, err := label.InitLabels(labelOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to init selinux options %+v\", securityContext.GetSelinuxOptions())\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\t_ = label.ReleaseLabel(processLabel)\n\t\t}\n\t}()\n\n\tspecOpts = append(specOpts, customopts.WithMounts(c.os, config, extraMounts, mountLabel))\n\n\tif !c.config.DisableProcMount {\n\t\t// Apply masked paths if specified.\n\t\t// If the container is privileged, this will be cleared later on.\n\t\tif maskedPaths := securityContext.GetMaskedPaths(); maskedPaths != nil {\n\t\t\tspecOpts = append(specOpts, oci.WithMaskedPaths(maskedPaths))\n\t\t}\n\n\t\t// Apply readonly paths if specified.\n\t\t// If the container is privileged, this will be cleared later on.\n\t\tif readonlyPaths := securityContext.GetReadonlyPaths(); readonlyPaths != nil {\n\t\t\tspecOpts = append(specOpts, oci.WithReadonlyPaths(readonlyPaths))\n\t\t}\n\t}\n\n\tif securityContext.GetPrivileged() {\n\t\tif !sandboxConfig.GetLinux().GetSecurityContext().GetPrivileged() {\n\t\t\treturn nil, errors.New(\"no privileged container allowed in sandbox\")\n\t\t}\n\t\tspecOpts = append(specOpts, oci.WithPrivileged)\n\t\tif !ociRuntime.PrivilegedWithoutHostDevices {\n\t\t\tspecOpts = append(specOpts, oci.WithHostDevices, oci.WithAllDevicesAllowed)\n\t\t} else {\n\t\t\t// add requested devices by the config as host devices are not automatically added\n\t\t\tspecOpts = append(specOpts, customopts.WithDevices(c.os, config), customopts.WithCapabilities(securityContext))\n\t\t}\n\t} else { // not privileged\n\t\tspecOpts = append(specOpts, customopts.WithDevices(c.os, config), customopts.WithCapabilities(securityContext))\n\t}\n\n\t// Clear all ambient capabilities. The implication of non-root + caps\n\t// is not clearly defined in Kubernetes.\n\t// See https://github.com/kubernetes/kubernetes/issues/56374\n\t// Keep docker's behavior for now.\n\tspecOpts = append(specOpts,\n\t\tcustomopts.WithoutAmbientCaps,\n\t\tcustomopts.WithSelinuxLabels(processLabel, mountLabel),\n\t)\n\n\t// TODO: Figure out whether we should set no new privilege for sandbox container by default\n\tif securityContext.GetNoNewPrivs() {\n\t\tspecOpts = append(specOpts, oci.WithNoNewPrivileges)\n\t}\n\t// TODO(random-liu): [P1] Set selinux options (privileged or not).\n\tif securityContext.GetReadonlyRootfs() {\n\t\tspecOpts = append(specOpts, oci.WithRootFSReadonly())\n\t}\n\n\tif c.config.DisableCgroup {\n\t\tspecOpts = append(specOpts, customopts.WithDisabledCgroups)\n\t} else {\n\t\tspecOpts = append(specOpts, customopts.WithResources(config.GetLinux().GetResources(), c.config.TolerateMissingHugetlbController, c.config.DisableHugetlbController))\n\t\tif sandboxConfig.GetLinux().GetCgroupParent() != \"\" {\n\t\t\tcgroupsPath := getCgroupsPath(sandboxConfig.GetLinux().GetCgroupParent(), id)\n\t\t\tspecOpts = append(specOpts, oci.WithCgroup(cgroupsPath))\n\t\t}\n\t}\n\n\tsupplementalGroups := securityContext.GetSupplementalGroups()\n\n\tfor pKey, pValue := range getPassthroughAnnotations(sandboxConfig.Annotations,\n\t\tociRuntime.PodAnnotations) {\n\t\tspecOpts = append(specOpts, customopts.WithAnnotation(pKey, pValue))\n\t}\n\n\tfor pKey, pValue := range getPassthroughAnnotations(config.Annotations,\n\t\tociRuntime.ContainerAnnotations) {\n\t\tspecOpts = append(specOpts, customopts.WithAnnotation(pKey, pValue))\n\t}\n\n\tspecOpts = append(specOpts,\n\t\tcustomopts.WithOOMScoreAdj(config, c.config.RestrictOOMScoreAdj),\n\t\tcustomopts.WithPodNamespaces(securityContext, sandboxPid),\n\t\tcustomopts.WithSupplementalGroups(supplementalGroups),\n\t\tcustomopts.WithAnnotation(annotations.ContainerType, annotations.ContainerTypeContainer),\n\t\tcustomopts.WithAnnotation(annotations.SandboxID, sandboxID),\n\t\tcustomopts.WithAnnotation(annotations.ContainerName, containerName),\n\t)\n\t// cgroupns is used for hiding /sys/fs/cgroup from containers.\n\t// For compatibility, cgroupns is not used when running in cgroup v1 mode or in privileged.\n\t// https://github.com/containers/libpod/issues/4363\n\t// https://github.com/kubernetes/enhancements/blob/0e409b47497e398b369c281074485c8de129694f/keps/sig-node/20191118-cgroups-v2.md#cgroup-namespace\n\tif cgroups.Mode() == cgroups.Unified && !securityContext.GetPrivileged() {\n\t\tspecOpts = append(specOpts, oci.WithLinuxNamespace(\n\t\t\truntimespec.LinuxNamespace{\n\t\t\t\tType: runtimespec.CgroupNamespace,\n\t\t\t}))\n\t}\n\treturn c.runtimeSpec(id, ociRuntime.BaseRuntimeSpec, specOpts...)\n}", "label": 0, "label_name": "vulnerable"} +{"code": "eb);this.updateSvgLinks(Da,ua,!0);this.addForeignObjectWarning(eb,Da);return Da}finally{Pa&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.addForeignObjectWarning=function(z,L){if(\"0\"!=urlParams[\"svg-warning\"]&&0_width 1234 */\n\tgdCtxPuts(out, \"#define \");\n\tgdCtxPuts(out, name);\n\tgdCtxPuts(out, \"_width \");\n\tgdCtxPrintf(out, \"%d\\n\", gdImageSX(image));\n\n\t/* #define _height 1234 */\n\tgdCtxPuts(out, \"#define \");\n\tgdCtxPuts(out, name);\n\tgdCtxPuts(out, \"_height \");\n\tgdCtxPrintf(out, \"%d\\n\", gdImageSY(image));\n\n\t/* static unsigned char _bits[] = {\\n */\n\tgdCtxPuts(out, \"static unsigned char \");\n\tgdCtxPuts(out, name);\n\tgdCtxPuts(out, \"_bits[] = {\\n \");\n\n\tfree(name);\n\n\tb = 1;\n\tp = 0;\n\tc = 0;\n\tsx = gdImageSX(image);\n\tsy = gdImageSY(image);\n\tfor (y = 0; y < sy; y++) {\n\t\tfor (x = 0; x < sx; x++) {\n\t\t\tif (gdImageGetPixel(image, x, y) == fg) {\n\t\t\t\tc |= b;\n\t\t\t}\n\t\t\tif ((b == 128) || (x == sx && y == sy)) {\n\t\t\t\tb = 1;\n\t\t\t\tif (p) {\n\t\t\t\t\tgdCtxPuts(out, \", \");\n\t\t\t\t\tif (!(p%12)) {\n\t\t\t\t\t\tgdCtxPuts(out, \"\\n \");\n\t\t\t\t\t\tp = 12;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp++;\n\t\t\t\tgdCtxPrintf(out, \"0x%02X\", c);\n\t\t\t\tc = 0;\n\t\t\t} else {\n\t\t\t\tb <<= 1;\n\t\t\t}\n\t\t}\n\t}\n\tgdCtxPuts(out, \"};\\n\");\n}", "label": 1, "label_name": "safe"} +{"code": " internal static bool ValidateHeaders( \n KeyValuePair>[] requestHeaders, \n string cookieToken,\n out string failedReason)\n {\n failedReason = \"\";\n\n if (requestHeaders.Any(z => z.Key.InvariantEquals(AngularHeadername)) == false)\n {\n failedReason = \"Missing token\";\n return false;\n }\n\n var headerToken = requestHeaders\n .Where(z => z.Key.InvariantEquals(AngularHeadername))\n .Select(z => z.Value)\n .SelectMany(z => z)\n .FirstOrDefault();\n \n // both header and cookie must be there\n if (cookieToken == null || headerToken == null)\n {\n failedReason = \"Missing token null\";\n return false;\n }\n\n if (ValidateTokens(cookieToken, headerToken) == false)\n {\n failedReason = \"Invalid token\";\n return false;\n }\n\n return true;\n }", "label": 1, "label_name": "safe"} +{"code": " Status check_index_ordering(const Tensor& indices) {\n if (indices.NumElements() == 0) {\n return errors::InvalidArgument(\"Indices are empty\");\n }\n\n auto findices = indices.flat();\n\n for (std::size_t i = 0; i < findices.dimension(0) - 1; ++i) {\n if (findices(i) < findices(i + 1)) {\n continue;\n }\n\n return errors::InvalidArgument(\"Indices are not strictly ordered\");\n }\n\n return Status::OK();\n }", "label": 1, "label_name": "safe"} +{"code": "this.showDialog(d.container,300,(p?25:0)+(l?125:210),!0,!0)};EditorUi.prototype.showExportDialog=function(d,g,k,l,p,q,x,y,A){x=null!=x?x:Editor.defaultIncludeDiagram;var B=document.createElement(\"div\");B.style.whiteSpace=\"nowrap\";var I=this.editor.graph,O=\"jpeg\"==y?220:300,t=document.createElement(\"h3\");mxUtils.write(t,d);t.style.cssText=\"width:100%;text-align:center;margin-top:0px;margin-bottom:10px\";B.appendChild(t);mxUtils.write(B,mxResources.get(\"zoom\")+\":\");var z=document.createElement(\"input\");\nz.setAttribute(\"type\",\"text\");z.style.marginRight=\"16px\";z.style.width=\"60px\";z.style.marginLeft=\"4px\";z.style.marginRight=\"12px\";z.value=this.lastExportZoom||\"100%\";B.appendChild(z);mxUtils.write(B,mxResources.get(\"borderWidth\")+\":\");var L=document.createElement(\"input\");L.setAttribute(\"type\",\"text\");L.style.marginRight=\"16px\";L.style.width=\"60px\";L.style.marginLeft=\"4px\";L.value=this.lastExportBorder||\"0\";B.appendChild(L);mxUtils.br(B);var C=this.addCheckbox(B,mxResources.get(\"selectionOnly\"),!1,\nI.isSelectionEmpty()),E=document.createElement(\"input\");E.style.marginTop=\"16px\";E.style.marginRight=\"8px\";E.style.marginLeft=\"24px\";E.setAttribute(\"disabled\",\"disabled\");E.setAttribute(\"type\",\"checkbox\");var G=document.createElement(\"select\");G.style.marginTop=\"16px\";G.style.marginLeft=\"8px\";d=[\"selectionOnly\",\"diagram\",\"page\"];var P={};for(t=0;tprivate_data;\n\tstruct perf_event_context *ctx;\n\tlong ret;\n\n\tctx = perf_event_ctx_lock(event);\n\tret = _perf_ioctl(event, cmd, arg);\n\tperf_event_ctx_unlock(event, ctx);\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "this.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerText=\"\")};", "label": 1, "label_name": "safe"} +{"code": " it \"inherits the query's database\" do\n cursor.get_more_op.database.should eq query_operation.database\n end", "label": 0, "label_name": "vulnerable"} +{"code": " protected function getIcon()\n {\n try {\n $adapter = $this->fs->getAdapter();\n } catch (\\Exception $e) {\n $adapter = null;\n }\n\n if ($adapter instanceof League\\Flysystem\\Adapter\\AbstractFtpAdapter) {\n $icon = 'volume_icon_ftp.png';\n } elseif ($adapter instanceof League\\Flysystem\\Dropbox\\DropboxAdapter) {\n $icon = 'volume_icon_dropbox.png';\n } else {\n $icon = 'volume_icon_local.png';\n }\n\n $parentUrl = defined('ELFINDER_IMG_PARENT_URL')? (rtrim(ELFINDER_IMG_PARENT_URL, '/').'/') : '';\n return $parentUrl . 'img/' . $icon;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public static function client()\n {\n if (is_null(self::$client)) new CertificateAuthenticate();\n return self::$client;\n }", "label": 1, "label_name": "safe"} +{"code": "c.getMode())try{this.addRecent({id:c.getHash(),title:c.getTitle(),mode:c.getMode()})}catch(v){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+1),mxSettings.save()}catch(v){}}catch(v){this.fileLoadedError=v;if(null!=c)try{c.close()}catch(x){}if(EditorUi.enableLogging&&!this.isOffline())try{EditorUi.logEvent({category:\"ERROR-LOAD-FILE-\"+(null!=c?c.getHash():\"none\"),action:\"message_\"+v.message,label:\"stack_\"+v.stack})}catch(x){}c=mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,\nmxResources.get(\"reconnecting\"))?window.location.search=this.getSearch([\"url\"]):null!=g?this.fileLoaded(g)||m():m()});e?c():this.handleError(v,mxResources.get(\"errorLoadingFile\"),c,!0,null,null,!0)}else m();return k};EditorUi.prototype.getHashValueForPages=function(c,e){var g=0,k=new mxGraphModel,m=new mxCodec;null!=e&&(e.byteCount=0,e.attrCount=0,e.eltCount=0,e.nodeCount=0);for(var q=0;qcolumns*tile_image->rows),sizeof(*xcfdata));\n if (xcfdata == (XCFPixelInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n xcfodata=xcfdata;\n graydata=(unsigned char *) xcfdata; /* used by gray and indexed */\n count=ReadBlob(image,data_length,(unsigned char *) xcfdata);\n if (count != (ssize_t) data_length)\n ThrowBinaryException(CorruptImageError,\"NotEnoughPixelData\",\n image->filename);\n for (y=0; y < (ssize_t) tile_image->rows; y++)\n {\n q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n if (inDocInfo->image_type == GIMP_GRAY)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelGray(tile_image,ScaleCharToQuantum(*graydata),q);\n SetPixelAlpha(tile_image,ScaleCharToQuantum((unsigned char)\n inLayerInfo->alpha),q);\n graydata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n else\n if (inDocInfo->image_type == GIMP_RGB)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelRed(tile_image,ScaleCharToQuantum(xcfdata->red),q);\n SetPixelGreen(tile_image,ScaleCharToQuantum(xcfdata->green),q);\n SetPixelBlue(tile_image,ScaleCharToQuantum(xcfdata->blue),q);\n SetPixelAlpha(tile_image,xcfdata->alpha == 255U ? TransparentAlpha :\n ScaleCharToQuantum((unsigned char) inLayerInfo->alpha),q);\n xcfdata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)\n break;\n }\n xcfodata=(XCFPixelInfo *) RelinquishMagickMemory(xcfodata);\n return MagickTrue;\n}", "label": 1, "label_name": "safe"} +{"code": " synchronize: function(requisition, errorHandler) {\n /**\n * @param {object} requisition The requisition object\n * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan\n */\n var doSynchronize = function(requisition, rescanExisting) {\n RequisitionsService.startTiming();\n RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(\n function() { // success\n growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')
Use refresh to update the deployed statistics');\n requisition.setDeployed(true);\n },\n errorHandler\n );\n };\n bootbox.dialog({\n message: 'Do you want to rescan existing nodes ?

' +\n 'Choose yes to synchronize all the nodes with the database executing the scan phase.
' +\n 'Choose no to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.
' +\n 'Choose dbonly to synchronize all the nodes with the database skipping the scan phase.
' +\n 'Choose cancel to abort the request.',\n title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource),\n buttons: {\n fullSync: {\n label: 'Yes',\n className: 'btn-primary',\n callback: function() {\n doSynchronize(requisition, 'true');\n }\n },\n dbOnlySync: {\n label: 'DB Only',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'dbonly');\n }\n },\n ignoreExistingSync: {\n label: 'No',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'false');\n }\n },\n main: {\n label: 'Cancel',\n className: 'btn-secondary'\n }\n }\n });\n }\n };\n }]);", "label": 1, "label_name": "safe"} +{"code": " public function isQmail()\n {\n $ini_sendmail_path = ini_get('sendmail_path');\n\n if (!stristr($ini_sendmail_path, 'qmail')) {\n $this->Sendmail = '/var/qmail/bin/qmail-inject';\n } else {\n $this->Sendmail = $ini_sendmail_path;\n }\n $this->Mailer = 'qmail';\n }", "label": 1, "label_name": "safe"} +{"code": " func loadSecret(_ command: CDVInvokedUrlCommand) {\n let data = command.arguments[0] as AnyObject?;\n var prompt = \"Authentication\"\n if let description = data?[\"description\"] as! String? {\n prompt = description;\n }\n var pluginResult: CDVPluginResult\n do {\n let result = try Secret().load(prompt)\n pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result);\n } catch {\n var code = PluginError.BIOMETRIC_UNKNOWN_ERROR.rawValue\n var message = error.localizedDescription\n if let err = error as? KeychainError {\n code = err.pluginError.rawValue\n message = err.localizedDescription\n }\n let errorResult = [\"code\": code, \"message\": message] as [String : Any]\n pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: errorResult);\n }\n self.commandDelegate.send(pluginResult, callbackId:command.callbackId)\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\tresize = function() {\n\t\t\t\t! dialog.data('draged') && dialog.is(':visible') && dialog.elfinderdialog('posInit');\n\t\t\t};", "label": 1, "label_name": "safe"} +{"code": "TEE_Result syscall_asymm_operate(unsigned long state,\n\t\t\tconst struct utee_attribute *usr_params,\n\t\t\tsize_t num_params, const void *src_data, size_t src_len,\n\t\t\tvoid *dst_data, uint64_t *dst_len)\n{\n\tTEE_Result res;\n\tstruct tee_cryp_state *cs;\n\tstruct tee_ta_session *sess;\n\tuint64_t dlen64;\n\tsize_t dlen;\n\tstruct tee_obj *o;\n\tvoid *label = NULL;\n\tsize_t label_len = 0;\n\tsize_t n;\n\tint salt_len;\n\tTEE_Attribute *params = NULL;\n\tstruct user_ta_ctx *utc;\n\n\tres = tee_ta_get_current_session(&sess);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\tutc = to_user_ta_ctx(sess->ctx);\n\n\tres = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\n\tres = tee_mmu_check_access_rights(\n\t\tutc,\n\t\tTEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER,\n\t\t(uaddr_t) src_data, src_len);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\n\tres = tee_svc_copy_from_user(&dlen64, dst_len, sizeof(dlen64));\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\tdlen = dlen64;\n\n\tres = tee_mmu_check_access_rights(\n\t\tutc,\n\t\tTEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE |\n\t\t\tTEE_MEMORY_ACCESS_ANY_OWNER,\n\t\t(uaddr_t) dst_data, dlen);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\n\tsize_t alloc_size = 0;\n\n\tif (MUL_OVERFLOW(sizeof(TEE_Attribute), num_params, &alloc_size))\n\t\treturn TEE_ERROR_OVERFLOW;\n\n\tparams = malloc(alloc_size);\n\tif (!params)\n\t\treturn TEE_ERROR_OUT_OF_MEMORY;\n\tres = copy_in_attrs(utc, usr_params, num_params, params);\n\tif (res != TEE_SUCCESS)\n\t\tgoto out;\n\n\tres = tee_obj_get(utc, cs->key1, &o);\n\tif (res != TEE_SUCCESS)\n\t\tgoto out;\n\tif ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) {\n\t\tres = TEE_ERROR_GENERIC;\n\t\tgoto out;\n\t}\n\n\tswitch (cs->algo) {\n\tcase TEE_ALG_RSA_NOPAD:\n\t\tif (cs->mode == TEE_MODE_ENCRYPT) {\n\t\t\tres = crypto_acipher_rsanopad_encrypt(o->attr, src_data,\n\t\t\t\t\t\t\t src_len, dst_data,\n\t\t\t\t\t\t\t &dlen);\n\t\t} else if (cs->mode == TEE_MODE_DECRYPT) {\n\t\t\tres = crypto_acipher_rsanopad_decrypt(o->attr, src_data,\n\t\t\t\t\t\t\t src_len, dst_data,\n\t\t\t\t\t\t\t &dlen);\n\t\t} else {\n\t\t\t/*\n\t\t\t * We will panic because \"the mode is not compatible\n\t\t\t * with the function\"\n\t\t\t */\n\t\t\tres = TEE_ERROR_GENERIC;\n\t\t}\n\t\tbreak;\n\n\tcase TEE_ALG_RSAES_PKCS1_V1_5:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512:\n\t\tfor (n = 0; n < num_params; n++) {\n\t\t\tif (params[n].attributeID == TEE_ATTR_RSA_OAEP_LABEL) {\n\t\t\t\tlabel = params[n].content.ref.buffer;\n\t\t\t\tlabel_len = params[n].content.ref.length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (cs->mode == TEE_MODE_ENCRYPT) {\n\t\t\tres = crypto_acipher_rsaes_encrypt(cs->algo, o->attr,\n\t\t\t\t\t\t\t label, label_len,\n\t\t\t\t\t\t\t src_data, src_len,\n\t\t\t\t\t\t\t dst_data, &dlen);\n\t\t} else if (cs->mode == TEE_MODE_DECRYPT) {\n\t\t\tres = crypto_acipher_rsaes_decrypt(\n\t\t\t\t\tcs->algo, o->attr, label, label_len,\n\t\t\t\t\tsrc_data, src_len, dst_data, &dlen);\n\t\t} else {\n\t\t\tres = TEE_ERROR_BAD_PARAMETERS;\n\t\t}\n\t\tbreak;\n\n#if defined(CFG_CRYPTO_RSASSA_NA1)\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5:\n#endif\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_MD5:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA1:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA224:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA256:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA384:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA512:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512:\n\t\tif (cs->mode != TEE_MODE_SIGN) {\n\t\t\tres = TEE_ERROR_BAD_PARAMETERS;\n\t\t\tbreak;\n\t\t}\n\t\tsalt_len = pkcs1_get_salt_len(params, num_params, src_len);\n\t\tres = crypto_acipher_rsassa_sign(cs->algo, o->attr, salt_len,\n\t\t\t\t\t\t src_data, src_len, dst_data,\n\t\t\t\t\t\t &dlen);\n\t\tbreak;\n\n\tcase TEE_ALG_DSA_SHA1:\n\tcase TEE_ALG_DSA_SHA224:\n\tcase TEE_ALG_DSA_SHA256:\n\t\tres = crypto_acipher_dsa_sign(cs->algo, o->attr, src_data,\n\t\t\t\t\t src_len, dst_data, &dlen);\n\t\tbreak;\n\tcase TEE_ALG_ECDSA_P192:\n\tcase TEE_ALG_ECDSA_P224:\n\tcase TEE_ALG_ECDSA_P256:\n\tcase TEE_ALG_ECDSA_P384:\n\tcase TEE_ALG_ECDSA_P521:\n\t\tres = crypto_acipher_ecc_sign(cs->algo, o->attr, src_data,\n\t\t\t\t\t src_len, dst_data, &dlen);\n\t\tbreak;\n\n\tdefault:\n\t\tres = TEE_ERROR_BAD_PARAMETERS;\n\t\tbreak;\n\t}\n\nout:\n\tfree(params);\n\n\tif (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) {\n\t\tTEE_Result res2;\n\n\t\tdlen64 = dlen;\n\t\tres2 = tee_svc_copy_to_user(dst_len, &dlen64, sizeof(*dst_len));\n\t\tif (res2 != TEE_SUCCESS)\n\t\t\treturn res2;\n\t}\n\n\treturn res;\n}", "label": 1, "label_name": "safe"} +{"code": "func (m *NinOptEnumDefault) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: NinOptEnumDefault: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: NinOptEnumDefault: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field1\", wireType)\n\t\t\t}\n\t\t\tvar v TheTestEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= TheTestEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field1 = &v\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field2\", wireType)\n\t\t\t}\n\t\t\tvar v YetAnotherTestEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= YetAnotherTestEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field2 = &v\n\t\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field3\", wireType)\n\t\t\t}\n\t\t\tvar v YetYetAnotherTestEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= YetYetAnotherTestEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field3 = &v\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def validate_url\n return unless trigger_rules['url']\n\n errors.add(:url, 'invalid') if inbox.inbox_type == 'Website' && !url_valid?(trigger_rules['url'])\n end", "label": 1, "label_name": "safe"} +{"code": "def run_cmd(auth_user, *args)\n options = {}\n return run_cmd_options(auth_user, options, *args)\nend", "label": 1, "label_name": "safe"} +{"code": "static int handle_exception(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_vmx *vmx = to_vmx(vcpu);\n\tstruct kvm_run *kvm_run = vcpu->run;\n\tu32 intr_info, ex_no, error_code;\n\tunsigned long cr2, rip, dr6;\n\tu32 vect_info;\n\tenum emulation_result er;\n\n\tvect_info = vmx->idt_vectoring_info;\n\tintr_info = vmx->exit_intr_info;\n\n\tif (is_machine_check(intr_info))\n\t\treturn handle_machine_check(vcpu);\n\n\tif ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)\n\t\treturn 1; /* already handled by vmx_vcpu_run() */\n\n\tif (is_no_device(intr_info)) {\n\t\tvmx_fpu_activate(vcpu);\n\t\treturn 1;\n\t}\n\n\tif (is_invalid_opcode(intr_info)) {\n\t\tif (is_guest_mode(vcpu)) {\n\t\t\tkvm_queue_exception(vcpu, UD_VECTOR);\n\t\t\treturn 1;\n\t\t}\n\t\ter = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);\n\t\tif (er != EMULATE_DONE)\n\t\t\tkvm_queue_exception(vcpu, UD_VECTOR);\n\t\treturn 1;\n\t}\n\n\terror_code = 0;\n\tif (intr_info & INTR_INFO_DELIVER_CODE_MASK)\n\t\terror_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);\n\n\t/*\n\t * The #PF with PFEC.RSVD = 1 indicates the guest is accessing\n\t * MMIO, it is better to report an internal error.\n\t * See the comments in vmx_handle_exit.\n\t */\n\tif ((vect_info & VECTORING_INFO_VALID_MASK) &&\n\t !(is_page_fault(intr_info) && !(error_code & PFERR_RSVD_MASK))) {\n\t\tvcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;\n\t\tvcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;\n\t\tvcpu->run->internal.ndata = 3;\n\t\tvcpu->run->internal.data[0] = vect_info;\n\t\tvcpu->run->internal.data[1] = intr_info;\n\t\tvcpu->run->internal.data[2] = error_code;\n\t\treturn 0;\n\t}\n\n\tif (is_page_fault(intr_info)) {\n\t\t/* EPT won't cause page fault directly */\n\t\tBUG_ON(enable_ept);\n\t\tcr2 = vmcs_readl(EXIT_QUALIFICATION);\n\t\ttrace_kvm_page_fault(cr2, error_code);\n\n\t\tif (kvm_event_needs_reinjection(vcpu))\n\t\t\tkvm_mmu_unprotect_page_virt(vcpu, cr2);\n\t\treturn kvm_mmu_page_fault(vcpu, cr2, error_code, NULL, 0);\n\t}\n\n\tex_no = intr_info & INTR_INFO_VECTOR_MASK;\n\n\tif (vmx->rmode.vm86_active && rmode_exception(vcpu, ex_no))\n\t\treturn handle_rmode_exception(vcpu, ex_no, error_code);\n\n\tswitch (ex_no) {\n\tcase AC_VECTOR:\n\t\tkvm_queue_exception_e(vcpu, AC_VECTOR, error_code);\n\t\treturn 1;\n\tcase DB_VECTOR:\n\t\tdr6 = vmcs_readl(EXIT_QUALIFICATION);\n\t\tif (!(vcpu->guest_debug &\n\t\t (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {\n\t\t\tvcpu->arch.dr6 &= ~15;\n\t\t\tvcpu->arch.dr6 |= dr6 | DR6_RTM;\n\t\t\tif (!(dr6 & ~DR6_RESERVED)) /* icebp */\n\t\t\t\tskip_emulated_instruction(vcpu);\n\n\t\t\tkvm_queue_exception(vcpu, DB_VECTOR);\n\t\t\treturn 1;\n\t\t}\n\t\tkvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1;\n\t\tkvm_run->debug.arch.dr7 = vmcs_readl(GUEST_DR7);\n\t\t/* fall through */\n\tcase BP_VECTOR:\n\t\t/*\n\t\t * Update instruction length as we may reinject #BP from\n\t\t * user space while in guest debugging mode. Reading it for\n\t\t * #DB as well causes no harm, it is not used in that case.\n\t\t */\n\t\tvmx->vcpu.arch.event_exit_inst_len =\n\t\t\tvmcs_read32(VM_EXIT_INSTRUCTION_LEN);\n\t\tkvm_run->exit_reason = KVM_EXIT_DEBUG;\n\t\trip = kvm_rip_read(vcpu);\n\t\tkvm_run->debug.arch.pc = vmcs_readl(GUEST_CS_BASE) + rip;\n\t\tkvm_run->debug.arch.exception = ex_no;\n\t\tbreak;\n\tdefault:\n\t\tkvm_run->exit_reason = KVM_EXIT_EXCEPTION;\n\t\tkvm_run->ex.exception = ex_no;\n\t\tkvm_run->ex.error_code = error_code;\n\t\tbreak;\n\t}\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "generic_ret *init_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)\n{\n static generic_ret ret;\n gss_buffer_desc client_name,\n service_name;\n kadm5_server_handle_t handle;\n OM_uint32 minor_stat;\n const char *errmsg = NULL;\n size_t clen, slen;\n char *cdots, *sdots;\n\n xdr_free(xdr_generic_ret, &ret);\n\n if ((ret.code = new_server_handle(*arg, rqstp, &handle)))\n goto exit_func;\n if (! (ret.code = check_handle((void *)handle))) {\n ret.api_version = handle->api_version;\n }\n\n free_server_handle(handle);\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n\n if (ret.code != 0)\n errmsg = krb5_get_error_message(NULL, ret.code);\n\n clen = client_name.length;\n trunc_name(&clen, &cdots);\n slen = service_name.length;\n trunc_name(&slen, &sdots);\n /* okay to cast lengths to int because trunc_name limits max value */\n krb5_klog_syslog(LOG_NOTICE, _(\"Request: kadm5_init, %.*s%s, %s, \"\n \"client=%.*s%s, service=%.*s%s, addr=%s, \"\n \"vers=%d, flavor=%d\"),\n (int)clen, (char *)client_name.value, cdots,\n errmsg ? errmsg : _(\"success\"),\n (int)clen, (char *)client_name.value, cdots,\n (int)slen, (char *)service_name.value, sdots,\n client_addr(rqstp->rq_xprt),\n ret.api_version & ~(KADM5_API_VERSION_MASK),\n rqstp->rq_cred.oa_flavor);\n if (errmsg != NULL)\n krb5_free_error_message(NULL, errmsg);\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n\nexit_func:\n return(&ret);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t\tfunction updateGraph(xml)\n\t\t\t\t\t{\n\t\t\t\t\t\tspinner.stop();\n\t\t\t\t\t\terrorNode.innerHTML = '';\n\t\t\t\t\t\tvar doc = mxUtils.parseXml(xml);\n\t\t\t\t\t\tvar node = editorUi.editor.extractGraphModel(doc.documentElement, true);\n\n\t\t\t\t\t\tif (node != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpageSelect.style.display = 'none';\n\t\t\t\t\t\t\tpageSelect.innerHTML = '';\n\t\t\t\t\t\t\tcurrentDoc = doc;\n\t\t\t\t\t\t\tcurrentXml = xml;\n\t\t\t\t\t\t\tparseSelectFunction = null;\n\t\t\t\t\t\t\tdiagrams = null;\n\t\t\t\t\t\t\trealPage = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction parseGraphModel(dataNode)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar bg = dataNode.getAttribute('background');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (bg == null || bg == '' || bg == mxConstants.NONE)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tbg = graph.defaultPageBackgroundColor;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcontainer.style.backgroundColor = bg;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar codec = new mxCodec(dataNode.ownerDocument);\n\t\t\t\t\t\t\t\tcodec.decode(dataNode, graph.getModel());\n\t\t\t\t\t\t\t\tgraph.maxFitScale = 1;\n\t\t\t\t\t\t\t\tgraph.fit(8);\n\t\t\t\t\t\t\t\tgraph.center();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\treturn dataNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction parseDiagram(diagramNode)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (diagramNode != null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdiagramNode = parseGraphModel(Editor.parseDiagramNode(diagramNode));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\treturn diagramNode;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (node.nodeName == 'mxfile')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Workaround for \"invalid calling object\" error in IE\n\t\t\t\t\t\t\t\tvar tmp = node.getElementsByTagName('diagram');\n\t\t\t\t\t\t\t\tdiagrams = [];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfor (var i = 0; i < tmp.length; i++)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdiagrams.push(tmp[i]);\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\trealPage = Math.min(currentPage, diagrams.length - 1);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (diagrams.length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tparseDiagram(diagrams[realPage]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (diagrams.length > 1)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpageSelect.removeAttribute('disabled');\n\t\t\t\t\t\t\t\t\tpageSelect.style.display = '';\n\n\t\t\t\t\t\t\t\t\tfor (var i = 0; i < diagrams.length; i++)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar pageOption = document.createElement('option');\n\t\t\t\t\t\t\t\t\t\tmxUtils.write(pageOption, diagrams[i].getAttribute('name') ||\n\t\t\t\t\t\t\t\t\t\t\tmxResources.get('pageWithNumber', [i + 1]));\n\t\t\t\t\t\t\t\t\t\tpageOption.setAttribute('value', i);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (i == realPage)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageOption.setAttribute('selected', 'selected');\n\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\tpageSelect.appendChild(pageOption);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tpageSelectFunction = function()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttry\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar temp = parseInt(pageSelect.value);\n\t\t\t\t\t\t\t\t\t\tcurrentPage = temp;\n\t\t\t\t\t\t\t\t\t\trealPage = currentPage;\n\t\t\t\t\t\t\t\t\t\tparseDiagram(diagrams[temp]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcatch (e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tpageSelect.value = currentPage;\n\t\t\t\t\t\t\t\t\t\teditorUi.handleError(e);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tparseGraphModel(node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar shortUser = item.lastModifyingUserName;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (shortUser != null && shortUser.length > 20)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tshortUser = shortUser.substring(0, 20) + '...';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfileInfo.innerHTML = '';\n\t\t\t\t\t\t\tmxUtils.write(fileInfo, ((shortUser != null) ?\n\t\t\t\t\t\t\t\t(shortUser + ' ') : '') + ts.toLocaleDateString() +\n\t\t\t\t\t\t\t\t' ' + ts.toLocaleTimeString());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfileInfo.setAttribute('title', row.getAttribute('title'));\n\t\t\t\t\t\t\tzoomInBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tzoomOutBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tzoomFitBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tzoomActualBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tcompareBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (file == null || !file.isRestricted())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (editorUi.editor.graph.isEnabled())\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\trestoreBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdownloadBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\tshowBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\tnewBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomInBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomOutBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomFitBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomActualBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(compareBtn, 60);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpageSelect.style.display = 'none';\n\t\t\t\t\t\t\tpageSelect.innerHTML = '';\n\t\t\t\t\t\t\tfileInfo.innerHTML = '';\n\t\t\t\t\t\t\tmxUtils.write(fileInfo, mxResources.get('errorLoadingFile'));\n\t\t\t\t\t\t\tmxUtils.write(errorNode, mxResources.get('errorLoadingFile'));\n\t\t\t\t\t\t}\n\t\t\t\t\t};", "label": 0, "label_name": "vulnerable"} +{"code": " public function testAddTags () {\n $contact = $this->contacts ('testAnyone');\n $tags = array ('test', 'test2', 'test3');\n $contact->addTags ($tags);\n $contactTags = $contact->getTags (true);\n $this->assertEquals (\n Tags::normalizeTags ($tags), ArrayUtil::sort ($contactTags));\n // disallow duplicates\n $contact->addTags ($tags);\n $contactTags = $contact->getTags (true);\n $this->assertEquals (\n Tags::normalizeTags ($tags), ArrayUtil::sort ($contactTags));\n // disallow duplicates after normalization\n $tags = array ('te,st', 'test2,', '#test3');\n $contact->addTags ($tags);\n $contactTags = $contact->getTags (true);\n $this->assertEquals (\n Tags::normalizeTags ($tags), ArrayUtil::sort ($contactTags));\n }", "label": 1, "label_name": "safe"} +{"code": " it \"returns a stepped number range given a negative step\" do\n result = scope.function_range([\"1\",\"4\",\"-2\"])\n expect(result).to eq [1,3]\n end", "label": 0, "label_name": "vulnerable"} +{"code": "printone(FILE *out, const char* msg, size_t value)\n{\n int i, k;\n char buf[100];\n size_t origvalue = value;\n\n fputs(msg, out);\n for (i = (int)strlen(msg); i < 35; ++i)\n fputc(' ', out);\n fputc('=', out);\n\n /* Write the value with commas. */\n i = 22;\n buf[i--] = '\\0';\n buf[i--] = '\\n';\n k = 3;\n do {\n size_t nextvalue = value / 10;\n unsigned int digit = (unsigned int)(value - nextvalue * 10);\n value = nextvalue;\n buf[i--] = (char)(digit + '0');\n --k;\n if (k == 0 && value && i >= 0) {\n k = 3;\n buf[i--] = ',';\n }\n } while (value && i >= 0);\n\n while (i >= 0)\n buf[i--] = ' ';\n fputs(buf, out);\n\n return origvalue;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def test_request_body_too_large_chunked_encoding(self):\n control_line = \"20;\\r\\n\" # 20 hex = 32 dec\n s = \"This string has 32 characters.\\r\\n\"\n to_send = \"GET / HTTP/1.1\\nTransfer-Encoding: chunked\\n\\n\"\n repeat = control_line + s\n to_send += repeat * ((self.toobig // len(repeat)) + 1)\n to_send = tobytes(to_send)\n self.connect()\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n # body bytes counter caught a max_request_body_size overrun\n self.assertline(line, \"413\", \"Request Entity Too Large\", \"HTTP/1.1\")\n cl = int(headers[\"content-length\"])\n self.assertEqual(cl, len(response_body))\n self.assertEqual(headers[\"content-type\"], \"text/plain\")\n # connection has been closed\n self.send_check_error(to_send)\n self.assertRaises(ConnectionClosed, read_http, fp)", "label": 0, "label_name": "vulnerable"} +{"code": "l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat)\n{\n\tconst uint32_t *ptr = (const uint32_t *)dat;\n\n\tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {\n\t\tND_PRINT((ndo, \"A\"));\n\t}\n\tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {\n\t\tND_PRINT((ndo, \"D\"));\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int parse_multipart(\n ogs_sbi_message_t *message, ogs_sbi_http_message_t *http)\n{\n char *boundary = NULL;\n int i;\n\n multipart_parser_settings settings;\n multipart_parser_data_t data;\n\n multipart_parser *parser = NULL;\n\n ogs_assert(message);\n ogs_assert(http);\n\n memset(&settings, 0, sizeof(settings));\n settings.on_header_field = &on_header_field;\n settings.on_header_value = &on_header_value;\n settings.on_part_data = &on_part_data;\n settings.on_part_data_end = &on_part_data_end;\n\n for (i = 0; i < http->content_length; i++) {\n if (http->content[i] == '\\r' && http->content[i+1] == '\\n')\n break;\n }\n\n if (i >= http->content_length) {\n ogs_error(\"Invalid HTTP content [%d]\", i);\n ogs_log_hexdump(OGS_LOG_ERROR,\n (unsigned char *)http->content, http->content_length);\n return OGS_ERROR;\n }\n\n boundary = ogs_strndup(http->content, i);\n ogs_assert(boundary);\n\n parser = multipart_parser_init(boundary, &settings);\n ogs_assert(parser);\n\n memset(&data, 0, sizeof(data));\n multipart_parser_set_data(parser, &data);\n multipart_parser_execute(parser, http->content, http->content_length);\n\n multipart_parser_free(parser);\n ogs_free(boundary);\n\n for (i = 0; i < data.num_of_part; i++) {\n SWITCH(data.part[i].content_type)\n CASE(OGS_SBI_CONTENT_JSON_TYPE)\n parse_json(message,\n data.part[i].content_type, data.part[i].content);\n\n if (data.part[i].content_id)\n ogs_free(data.part[i].content_id);\n if (data.part[i].content_type)\n ogs_free(data.part[i].content_type);\n if (data.part[i].content)\n ogs_free(data.part[i].content);\n\n break;\n\n CASE(OGS_SBI_CONTENT_5GNAS_TYPE)\n CASE(OGS_SBI_CONTENT_NGAP_TYPE)\n http->part[http->num_of_part].content_id =\n data.part[i].content_id;\n http->part[http->num_of_part].content_type =\n data.part[i].content_type;\n http->part[http->num_of_part].pkbuf =\n ogs_pkbuf_alloc(NULL, data.part[i].content_length);\n ogs_expect_or_return_val(\n http->part[http->num_of_part].pkbuf, OGS_ERROR);\n ogs_pkbuf_put_data(http->part[http->num_of_part].pkbuf,\n data.part[i].content, data.part[i].content_length);\n\n message->part[message->num_of_part].content_id =\n http->part[http->num_of_part].content_id;\n message->part[message->num_of_part].content_type =\n http->part[http->num_of_part].content_type;\n message->part[message->num_of_part].pkbuf =\n ogs_pkbuf_copy(http->part[http->num_of_part].pkbuf);\n ogs_expect_or_return_val(\n message->part[message->num_of_part].pkbuf, OGS_ERROR);\n\n http->num_of_part++;\n message->num_of_part++;\n\n if (data.part[i].content)\n ogs_free(data.part[i].content);\n break;\n\n DEFAULT\n ogs_error(\"Unknown content-type[%s]\", data.part[i].content_type);\n END\n }\n\n if (data.part[i].content_id)\n ogs_free(data.part[i].content_id);\n if (data.part[i].content_type)\n ogs_free(data.part[i].content_type);\n\n if (data.header_field)\n ogs_free(data.header_field);\n\n return OGS_OK;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "didset_options2(void)\n{\n // Initialize the highlight_attr[] table.\n (void)highlight_changed();\n\n // Parse default for 'wildmode'\n check_opt_wim();\n\n // Parse default for 'listchars'.\n (void)set_chars_option(curwin, &curwin->w_p_lcs);\n\n // Parse default for 'fillchars'.\n (void)set_chars_option(curwin, &p_fcs);\n\n#ifdef FEAT_CLIPBOARD\n // Parse default for 'clipboard'\n (void)check_clipboard_option();\n#endif\n#ifdef FEAT_VARTABS\n vim_free(curbuf->b_p_vsts_array);\n (void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);\n vim_free(curbuf->b_p_vts_array);\n (void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);\n#endif\n}", "label": 1, "label_name": "safe"} +{"code": " def testInputPreprocessExampleWithCodeInjection(self):\n input_examples_str = 'inputs=os.system(\"echo hacked\")'\n with self.assertRaisesRegex(RuntimeError, 'not a valid python literal.'):\n saved_model_cli.preprocess_input_examples_arg_string(input_examples_str)", "label": 1, "label_name": "safe"} +{"code": "func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\taction := vars[\"action\"]\n\ttoken := vars[\"token\"]\n\tfilename := vars[\"filename\"]\n\n\tmetadata, err := s.CheckMetadata(token, filename, true)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error metadata: %s\", err.Error())\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tcontentType := metadata.ContentType\n\treader, contentLength, err := s.storage.Get(token, filename)\n\tif s.storage.IsNotExist(err) {\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Printf(\"%s\", err.Error())\n\t\thttp.Error(w, \"Could not retrieve file.\", 500)\n\t\treturn\n\t}\n\n\tdefer reader.Close()\n\n\tvar disposition string\n\n\tif action == \"inline\" {\n\t\tdisposition = \"inline\"\n\t} else {\n\t\tdisposition = \"attachment\"\n\t}\n\n\tremainingDownloads, remainingDays := metadata.remainingLimitHeaderValues()\n\n\tw.Header().Set(\"Content-Type\", contentType)\n\tw.Header().Set(\"Content-Length\", strconv.FormatUint(contentLength, 10))\n\tw.Header().Set(\"Content-Disposition\", fmt.Sprintf(\"%s; filename=\\\"%s\\\"\", disposition, filename))\n\tw.Header().Set(\"Connection\", \"keep-alive\")\n\tw.Header().Set(\"X-Remaining-Downloads\", remainingDownloads)\n\tw.Header().Set(\"X-Remaining-Days\", remainingDays)\n\n\tif disposition == \"inline\" && strings.Contains(contentType, \"html\") {\n\t\treader = ioutil.NopCloser(bluemonday.UGCPolicy().SanitizeReader(reader))\n\t}\n\n\tif w.Header().Get(\"Range\") == \"\" {\n\t\tif _, err = io.Copy(w, reader); err != nil {\n\t\t\tlog.Printf(\"%s\", err.Error())\n\t\t\thttp.Error(w, \"Error occurred copying to output stream\", 500)\n\t\t\treturn\n\t\t}\n\n\t\treturn\n\t}\n\n\tfile, err := ioutil.TempFile(s.tempPath, \"range-\")\n\tif err != nil {\n\t\tlog.Printf(\"%s\", err.Error())\n\t\thttp.Error(w, \"Error occurred copying to output stream\", 500)\n\t\treturn\n\t}\n\n\tdefer cleanTmpFile(file)\n\n\ttee := io.TeeReader(reader, file)\n\tfor {\n\t\tb := make([]byte, _5M)\n\t\t_, err = tee.Read(b)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s\", err.Error())\n\t\t\thttp.Error(w, \"Error occurred copying to output stream\", 500)\n\t\t\treturn\n\t\t}\n\t}\n\n\thttp.ServeContent(w, r, filename, time.Now(), file)\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_str2bool([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} +{"code": "SFTPWrapper.prototype.ext_openssh_statvfs = function(path, cb) {\n return this._stream.ext_openssh_statvfs(path, cb);\n};", "label": 0, "label_name": "vulnerable"} +{"code": " def check_both_ways(source):\n ast.parse(source, type_comments=False)\n with self.assertRaises(SyntaxError):\n ast.parse(source, type_comments=True)", "label": 1, "label_name": "safe"} +{"code": " it \"should return true if a float\" do\n result = scope.function_is_float([\"0.12\"])\n expect(result).to(eq(true))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testRemoveTags () {\n $contact = $this->contacts ('testAnyone');\n Yii::app()->db->createCommand (\"\n delete from x2_tags where type='Contacts' and itemId=:id\n \")->execute (array (':id' => $contact->id));\n $tags = array ('test', 'test2', 'test3');\n $contact->addTags ($tags);\n $contact->removeTags ($tags);\n $this->assertEquals (array (), $contact->getTags (true));\n\n $tags = array ('test', 'test2', 'test3');\n $contact->addTags ($tags);\n $tags = array ('t,est', 'test2,');\n $contact->removeTags ($tags);\n $this->assertEquals (array ('#test3'), $contact->getTags (true));\n }", "label": 1, "label_name": "safe"} +{"code": "static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies,\n size_t mincodes, size_t numcodes, unsigned maxbitlen)\n{\n unsigned error = 0;\n while(!frequencies[numcodes - 1] && numcodes > mincodes) numcodes--; /*trim zeroes*/\n tree->maxbitlen = maxbitlen;\n tree->numcodes = (unsigned)numcodes; /*number of symbols*/\n tree->lengths = (unsigned*)realloc(tree->lengths, numcodes * sizeof(unsigned));\n if(!tree->lengths) return 83; /*alloc fail*/\n /*initialize all lengths to 0*/\n memset(tree->lengths, 0, numcodes * sizeof(unsigned));\n\n error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen);\n if(!error) error = HuffmanTree_makeFromLengths2(tree);\n return error;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function __destruct()\n {\n fclose($this->socket);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "horizontalDifference16(unsigned short *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From14)\n{\n register int r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n/* assumption is unsigned pixel values */\n#undef CLAMP\n#define CLAMP(v) From14[(v) >> 2]\n\n mask = CODE_MASK;\n if (n >= stride) {\n\tif (stride == 3) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]);\n\t n -= 3;\n\t while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\tip += 3;\n\t\tr1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;\n\t }\n\t} else if (stride == 4) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);\n\t n -= 4;\n\t while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\tip += 4;\n\t\tr1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\ta1 = CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;\n\t }\n\t} else {\n REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)\n\t n -= stride;\n\t while (n > 0) {\n REPEAT(stride,\n wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);\n wp++; ip++)\n n -= stride;\n }\n\t}\n }\n}", "label": 1, "label_name": "safe"} +{"code": " self::removeLevel($kid->id);\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " protected function _extract($path, $arc)\n {\n return false;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public boolean isOriginAllowed(String pOrigin, boolean pIsStrictCheck) {\n return checkRestrictorService(CORS_CHECK,pOrigin,pIsStrictCheck);\n }", "label": 1, "label_name": "safe"} +{"code": "Suite.prototype.addSuite = function(suite){\n suite.parent = this;\n suite.timeout(this.timeout());\n suite.slow(this.slow());\n suite.bail(this.bail());\n this.suites.push(suite);\n this.emit('suite', suite);\n return this;\n};", "label": 0, "label_name": "vulnerable"} +{"code": " def test_jail_instances_should_have_limited_methods\n expected = [\"class\", \"inspect\", \"method_missing\", \"methods\", \"respond_to?\", \"respond_to_missing?\", \"to_jail\", \"to_s\", \"instance_variable_get\"]\n expected.delete('respond_to_missing?') if RUBY_VERSION > '1.9.3' # respond_to_missing? is private in rubies above 1.9.3\n objects.each do |object|\n assert_equal expected.sort, reject_pretty_methods(object.to_jail.methods.map(&:to_s).sort)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); }", "label": 1, "label_name": "safe"} +{"code": "CodingReturnValue VP8ComponentDecoder::decode_chunk(UncompressedComponents * const colldata)\n{\n mux_splicer.init(spin_workers_);\n /* cmpc is a global variable with the component count */\n\n\n /* construct 4x4 VP8 blocks to hold 8x8 JPEG blocks */\n if ( thread_state_[0] == nullptr || thread_state_[0]->context_[0].isNil() ) {\n /* first call */\n BlockBasedImagePerChannel framebuffer;\n framebuffer.memset(0);\n for (size_t i = 0; i < framebuffer.size() && int( i ) < colldata->get_num_components(); ++i) {\n framebuffer[i] = &colldata->full_component_write((BlockType)i);\n }\n Sirikata::Array1d, MAX_NUM_THREADS> all_framebuffers;\n for (size_t i = 0; i < all_framebuffers.size(); ++i) {\n all_framebuffers[i] = framebuffer;\n }\n size_t num_threads_needed = initialize_decoder_state(colldata,\n all_framebuffers).size();\n\n\n for (size_t i = 0;i < num_threads_needed; ++i) {\n map_logical_thread_to_physical_thread(i, i);\n }\n for (size_t i = 0;i < num_threads_needed; ++i) {\n initialize_thread_id(i, i, framebuffer);\n if (!do_threading_) {\n break;\n }\n }\n if (num_threads_needed > NUM_THREADS || num_threads_needed == 0) {\n return CODING_ERROR;\n }\n }\n if (do_threading_) {\n for (unsigned int thread_id = 0; thread_id < NUM_THREADS; ++thread_id) {\n unsigned int cur_spin_worker = thread_id;\n spin_workers_[cur_spin_worker].work\n = std::bind(worker_thread,\n thread_state_[thread_id],\n thread_id,\n colldata,\n mux_splicer.thread_target,\n getWorker(cur_spin_worker),\n &send_to_actual_thread_state);\n spin_workers_[cur_spin_worker].activate_work();\n }\n flush();\n for (unsigned int thread_id = 0; thread_id < NUM_THREADS; ++thread_id) {\n unsigned int cur_spin_worker = thread_id;\n TimingHarness::timing[thread_id][TimingHarness::TS_THREAD_WAIT_STARTED] = TimingHarness::get_time_us();\n spin_workers_[cur_spin_worker].main_wait_for_done();\n TimingHarness::timing[thread_id][TimingHarness::TS_THREAD_WAIT_FINISHED] = TimingHarness::get_time_us();\n }\n // join on all threads\n } else {\n if (virtual_thread_id_ != -1) {\n TimingHarness::timing[0][TimingHarness::TS_ARITH_STARTED] = TimingHarness::get_time_us();\n CodingReturnValue ret = thread_state_[0]->vp8_decode_thread(0, colldata);\n if (ret == CODING_PARTIAL) {\n return ret;\n }\n TimingHarness::timing[0][TimingHarness::TS_ARITH_FINISHED] = TimingHarness::get_time_us();\n }\n // wait for \"threads\"\n virtual_thread_id_ += 1; // first time's a charm\n for (unsigned int thread_id = virtual_thread_id_; thread_id < NUM_THREADS; ++thread_id, ++virtual_thread_id_) {\n BlockBasedImagePerChannel framebuffer;\n framebuffer.memset(0);\n for (size_t i = 0; i < framebuffer.size() && int( i ) < colldata->get_num_components(); ++i) {\n framebuffer[i] = &colldata->full_component_write((BlockType)i);\n }\n\n initialize_thread_id(thread_id, 0, framebuffer);\n thread_state_[0]->bool_decoder_.init(new VirtualThreadPacketReader(thread_id, &mux_reader_, &mux_splicer));\n TimingHarness::timing[thread_id][TimingHarness::TS_ARITH_STARTED] = TimingHarness::get_time_us();\n CodingReturnValue ret;\n if ((ret = thread_state_[0]->vp8_decode_thread(0, colldata)) == CODING_PARTIAL) {\n return ret;\n }\n TimingHarness::timing[thread_id][TimingHarness::TS_ARITH_FINISHED] = TimingHarness::get_time_us();\n }\n }\n TimingHarness::timing[0][TimingHarness::TS_JPEG_RECODE_STARTED] = TimingHarness::get_time_us();\n for (int component = 0; component < colldata->get_num_components(); ++component) {\n colldata->worker_mark_cmp_finished((BlockType)component);\n }\n colldata->worker_update_coefficient_position_progress( 64 );\n colldata->worker_update_bit_progress( 16 );\n write_byte_bill(Billing::DELIMITERS, true, mux_reader_.getOverhead());\n return CODING_DONE;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "def server_socket(fun, request_count=1, timeout=5, scheme=\"\", tls=None):\n \"\"\"Base socket server for tests.\n Likely you want to use server_request or other higher level helpers.\n All arguments except fun can be passed to other server_* helpers.\n\n :param fun: fun(client_sock, tick) called after successful accept().\n :param request_count: test succeeds after exactly this number of requests, triggered by tick(request)\n :param timeout: seconds.\n :param scheme: affects yielded value\n \"\" - build normal http/https URI.\n string - build normal URI using supplied scheme.\n None - yield (addr, port) tuple.\n :param tls:\n None (default) - plain HTTP.\n True - HTTPS with reasonable defaults. Likely you want httplib2.Http(ca_certs=tests.CA_CERTS)\n string - path to custom server cert+key PEM file.\n callable - function(context, listener, skip_errors) -> ssl_wrapped_listener\n \"\"\"\n gresult = [None]\n gcounter = [0]\n tls_skip_errors = [\n \"TLSV1_ALERT_UNKNOWN_CA\",\n ]\n\n def tick(request):\n gcounter[0] += 1\n keep = True\n keep &= gcounter[0] < request_count\n if request is not None:\n keep &= request.headers.get(\"connection\", \"\").lower() != \"close\"\n return keep\n\n def server_socket_thread(srv):\n try:\n while gcounter[0] < request_count:\n try:\n client, _ = srv.accept()\n except ssl.SSLError as e:\n if e.reason in tls_skip_errors:\n return\n raise\n\n try:\n client.settimeout(timeout)\n fun(client, tick)\n finally:\n try:\n client.shutdown(socket.SHUT_RDWR)\n except (IOError, socket.error):\n pass\n # FIXME: client.close() introduces connection reset by peer\n # at least in other/connection_close test\n # should not be a problem since socket would close upon garbage collection\n if gcounter[0] > request_count:\n gresult[0] = Exception(\n \"Request count expected={0} actual={1}\".format(\n request_count, gcounter[0]\n )\n )\n except Exception as e:\n # traceback.print_exc caused IOError: concurrent operation on sys.stderr.close() under setup.py test\n print(traceback.format_exc(), file=sys.stderr)\n gresult[0] = e\n\n bind_hostname = \"localhost\"\n server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n server.bind((bind_hostname, 0))\n try:\n server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n except socket.error as ex:\n print(\"non critical error on SO_REUSEADDR\", ex)\n server.listen(10)\n server.settimeout(timeout)\n server_port = server.getsockname()[1]\n if tls is True:\n tls = SERVER_CHAIN\n if tls:\n context = ssl_context()\n if callable(tls):\n context.load_cert_chain(SERVER_CHAIN)\n server = tls(context, server, tls_skip_errors)\n else:\n context.load_cert_chain(tls)\n server = context.wrap_socket(server, server_side=True)\n if scheme == \"\":\n scheme = \"https\" if tls else \"http\"\n\n t = threading.Thread(target=server_socket_thread, args=(server,))\n t.daemon = True\n t.start()\n if scheme is None:\n yield (bind_hostname, server_port)\n else:\n yield u\"{scheme}://{host}:{port}/\".format(scheme=scheme, host=bind_hostname, port=server_port)\n server.close()\n t.join()\n if gresult[0] is not None:\n raise gresult[0]", "label": 0, "label_name": "vulnerable"} +{"code": " private XMSSPrivateKeyParameters(Builder builder)\n {\n super(true);\n params = builder.params;\n if (params == null)\n {\n throw new NullPointerException(\"params == null\");\n }\n int n = params.getDigestSize();\n byte[] privateKey = builder.privateKey;\n if (privateKey != null)\n {\n if (builder.xmss == null)\n {\n throw new NullPointerException(\"xmss == null\");\n }\n /* import */\n int height = params.getHeight();\n int indexSize = 4;\n int secretKeySize = n;\n int secretKeyPRFSize = n;\n int publicSeedSize = n;\n int rootSize = n;\n\t\t\t/*\n\t\t\tint totalSize = indexSize + secretKeySize + secretKeyPRFSize + publicSeedSize + rootSize;\n\t\t\tif (privateKey.length != totalSize) {\n\t\t\t\tthrow new ParseException(\"private key has wrong size\", 0);\n\t\t\t}\n\t\t\t*/\n int position = 0;\n int index = Pack.bigEndianToInt(privateKey, position);\n if (!XMSSUtil.isIndexValid(height, index))\n {\n throw new IllegalArgumentException(\"index out of bounds\");\n }\n position += indexSize;\n secretKeySeed = XMSSUtil.extractBytesAtOffset(privateKey, position, secretKeySize);\n position += secretKeySize;\n secretKeyPRF = XMSSUtil.extractBytesAtOffset(privateKey, position, secretKeyPRFSize);\n position += secretKeyPRFSize;\n publicSeed = XMSSUtil.extractBytesAtOffset(privateKey, position, publicSeedSize);\n position += publicSeedSize;\n root = XMSSUtil.extractBytesAtOffset(privateKey, position, rootSize);\n position += rootSize;\n\t\t\t/* import BDS state */\n byte[] bdsStateBinary = XMSSUtil.extractBytesAtOffset(privateKey, position, privateKey.length - position);\n BDS bdsImport = null;\n try\n {\n bdsImport = (BDS)XMSSUtil.deserialize(bdsStateBinary);\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n catch (ClassNotFoundException e)\n {\n e.printStackTrace();\n }\n bdsImport.setXMSS(builder.xmss);\n bdsImport.validate();\n if (bdsImport.getIndex() != index)\n {\n throw new IllegalStateException(\"serialized BDS has wrong index\");\n }\n bdsState = bdsImport;\n }\n else\n {\n\t\t\t/* set */\n byte[] tmpSecretKeySeed = builder.secretKeySeed;\n if (tmpSecretKeySeed != null)\n {\n if (tmpSecretKeySeed.length != n)\n {\n throw new IllegalArgumentException(\"size of secretKeySeed needs to be equal size of digest\");\n }\n secretKeySeed = tmpSecretKeySeed;\n }\n else\n {\n secretKeySeed = new byte[n];\n }\n byte[] tmpSecretKeyPRF = builder.secretKeyPRF;\n if (tmpSecretKeyPRF != null)\n {\n if (tmpSecretKeyPRF.length != n)\n {\n throw new IllegalArgumentException(\"size of secretKeyPRF needs to be equal size of digest\");\n }\n secretKeyPRF = tmpSecretKeyPRF;\n }\n else\n {\n secretKeyPRF = new byte[n];\n }\n byte[] tmpPublicSeed = builder.publicSeed;\n if (tmpPublicSeed != null)\n {\n if (tmpPublicSeed.length != n)\n {\n throw new IllegalArgumentException(\"size of publicSeed needs to be equal size of digest\");\n }\n publicSeed = tmpPublicSeed;\n }\n else\n {\n publicSeed = new byte[n];\n }\n byte[] tmpRoot = builder.root;\n if (tmpRoot != null)\n {\n if (tmpRoot.length != n)\n {\n throw new IllegalArgumentException(\"size of root needs to be equal size of digest\");\n }\n root = tmpRoot;\n }\n else\n {\n root = new byte[n];\n }\n BDS tmpBDSState = builder.bdsState;\n if (tmpBDSState != null)\n {\n bdsState = tmpBDSState;\n }\n else\n {\n if (builder.index < ((1 << params.getHeight()) - 2) && tmpPublicSeed != null && tmpSecretKeySeed != null)\n {\n bdsState = new BDS(params, tmpPublicSeed, tmpSecretKeySeed, (OTSHashAddress)new OTSHashAddress.Builder().build(), builder.index);\n }\n else\n {\n bdsState = new BDS(params, builder.index);\n }\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testSerialize()\n {\n $config = HTMLPurifier_Config::createDefault();\n $config->set('HTML.Allowed', 'a');\n $config2 = unserialize($config->serialize());\n $this->assertIdentical($config->get('HTML.Allowed'), $config2->get('HTML.Allowed'));\n }", "label": 1, "label_name": "safe"} +{"code": "getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector &_publicKeys,\n int _t,\n int _n) {\n\n CHECK_STATE(_encryptedPolyHex);\n\n vector hexEncrKey(BUF_LEN, 0);\n vector errMsg1(BUF_LEN, 0);\n vector encrDKGPoly(BUF_LEN, 0);\n int errStatus = 0;\n uint64_t encLen = 0;\n\n\n\n if (!hex2carray(_encryptedPolyHex, &encLen, encrDKGPoly.data(), BUF_LEN)) {\n throw SGXException(INVALID_HEX, \"Invalid encryptedPolyHex\");\n }\n\n sgx_status_t status = trustedSetEncryptedDkgPolyAES(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), encLen);\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg1.data());\n\n string result;\n\n for (int i = 0; i < _n; i++) {\n vector encryptedSkey(BUF_LEN, 0);\n uint32_t decLen;\n vector currentShare(193, 0);\n vector sShareG2(320, 0);\n\n string pub_keyB = _publicKeys.at(i);\n vector pubKeyB(129, 0);\n\n strncpy(pubKeyB.data(), pub_keyB.c_str(), 128);\n pubKeyB.at(128) = 0;\n\n spdlog::debug(\"pubKeyB is {}\", pub_keyB);\n\n sgx_status_t status = trustedGetEncryptedSecretShareAES(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen,\n currentShare.data(), sShareG2.data(), pubKeyB.data(), _t, _n, i + 1);\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg1.data());\n\n spdlog::debug(\"cur_share is {}\", currentShare.data());\n\n result += string(currentShare.data());\n\n spdlog::debug(\"dec len is {}\", decLen);\n carray2Hex(encryptedSkey.data(), decLen, hexEncrKey.data(), BUF_LEN);\n string dhKeyName = \"DKG_DH_KEY_\" + _polyName + \"_\" + to_string(i) + \":\";\n\n spdlog::debug(\"hexEncr DH Key: { }\", hexEncrKey.data());\n spdlog::debug(\"name to write to db is {}\", dhKeyName);\n SGXWalletServer::writeDataToDB(dhKeyName, hexEncrKey.data());\n\n string shareG2_name = \"shareG2_\" + _polyName + \"_\" + to_string(i) + \":\";\n spdlog::debug(\"name to write to db is {}\", shareG2_name);\n spdlog::debug(\"s_shareG2: {}\", sShareG2.data());\n\n SGXWalletServer::writeDataToDB(shareG2_name, sShareG2.data());\n\n\n }\n\n return result;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " foreach ($usr as $u) {\r\n # code...\r\n $msgs = str_replace('{{userid}}', $u->userid, $msg);\r\n $vars = array(\r\n 'to' => $u->email,\r\n 'to_name' => $u->userid,\r\n 'message' => $msgs,\r\n 'subject' => $subject,\r\n 'msgtype' => $_POST['type']\r\n );\r\n $mailsend = Mail::send($vars);\r\n if ($mailsend !== null) {\r\n $alermailsend[] = $mailsend;\r\n }\r\n sleep(3);\r\n }\r", "label": 1, "label_name": "safe"} +{"code": " $this->set($namespace .'.'. $directive, $value2);\n }\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": " protected string EscapeName(string name)\n {\n return SqlFormatProvider().Escape(name);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"base64\")).to eq(\"function_base64\")\n end", "label": 0, "label_name": "vulnerable"} +{"code": " private function set_environment($environment)\n {\n $environment = !empty($environment) ? (array) $environment : array();\n $path = (isset($environment['path']) && !is_empty_string($environment['path'])) ? $environment['path'] : $this->home_directory;\n\n if (!is_empty_string($path)) {\n if (is_dir($path)) {\n if (!@chdir($path)) { return array('output' => \"Unable to change directory to current working directory, updating current directory\",\n 'environment' => $this->get_environment());\n }\n }\n else { return array('output' => \"Current working directory not found, updating current directory\",\n 'environment' => $this->get_environment());\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " data: {config_calibre_dir: $(\"#config_calibre_dir\").val(), csrf_token: $(\"input[name='csrf_token']\").val()},\n success: function success(data) {\n if ( data.change ) {\n if ( data.valid ) {\n confirmDialog(\n \"db_submit\",\n \"GeneralChangeModal\",\n 0,\n changeDbSettings\n );\n }\n else {\n $(\"#InvalidDialog\").modal('show');\n }\n } else { \t\n changeDbSettings();\n }\n }\n });\n });", "label": 0, "label_name": "vulnerable"} +{"code": "void traverse_commit_list(struct rev_info *revs,\n\t\t\t show_commit_fn show_commit,\n\t\t\t show_object_fn show_object,\n\t\t\t void *data)\n{\n\tint i;\n\tstruct commit *commit;\n\tstruct strbuf base;\n\n\tstrbuf_init(&base, PATH_MAX);\n\twhile ((commit = get_revision(revs)) != NULL) {\n\t\t/*\n\t\t * an uninteresting boundary commit may not have its tree\n\t\t * parsed yet, but we are not going to show them anyway\n\t\t */\n\t\tif (commit->tree)\n\t\t\tadd_pending_tree(revs, commit->tree);\n\t\tshow_commit(commit, data);\n\t}\n\tfor (i = 0; i < revs->pending.nr; i++) {\n\t\tstruct object_array_entry *pending = revs->pending.objects + i;\n\t\tstruct object *obj = pending->item;\n\t\tconst char *name = pending->name;\n\t\tconst char *path = pending->path;\n\t\tif (obj->flags & (UNINTERESTING | SEEN))\n\t\t\tcontinue;\n\t\tif (obj->type == OBJ_TAG) {\n\t\t\tobj->flags |= SEEN;\n\t\t\tshow_object(obj, name, data);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!path)\n\t\t\tpath = \"\";\n\t\tif (obj->type == OBJ_TREE) {\n\t\t\tprocess_tree(revs, (struct tree *)obj, show_object,\n\t\t\t\t &base, path, data);\n\t\t\tcontinue;\n\t\t}\n\t\tif (obj->type == OBJ_BLOB) {\n\t\t\tprocess_blob(revs, (struct blob *)obj, show_object,\n\t\t\t\t &base, path, data);\n\t\t\tcontinue;\n\t\t}\n\t\tdie(\"unknown pending object %s (%s)\",\n\t\t oid_to_hex(&obj->oid), name);\n\t}\n\tobject_array_clear(&revs->pending);\n\tstrbuf_release(&base);\n}", "label": 1, "label_name": "safe"} +{"code": " public function setUp()\n {\n $this->request = new UpdateCardRequest($this->getHttpClient(), $this->getHttpRequest());\n $this->request->setCustomerReference('cus_1MZSEtqSghKx99');\n $this->request->setCardReference('card_15Wg7vIobxWFFmzdvC5fVY67');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function setLoggerChannel($channel = 'Organizr', $username = null)\n\t{\n\t\tif ($this->hasDB()) {\n\t\t\t$setLogger = false;\n\t\t\tif ($username) {\n\t\t\t\t$username = htmlspecialchars($username);\n\t\t\t}\n\t\t\tif ($this->logger) {\n\t\t\t\tif ($channel) {\n\t\t\t\t\tif (strtolower($this->logger->getChannel()) !== strtolower($channel)) {\n\t\t\t\t\t\t$setLogger = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($username) {\n\t\t\t\t\tif (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {\n\t\t\t\t\t\t$setLogger = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$setLogger = true;\n\t\t\t}\n\t\t\tif ($setLogger) {\n\t\t\t\t$channel = $channel ?: 'Organizr';\n\t\t\t\treturn $this->setupLogger($channel, $username);\n\t\t\t} else {\n\t\t\t\treturn $this->logger;\n\t\t\t}\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " private function getInlineStrategy($called = false)\n {\n $inline = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer')->disableOriginalConstructor()->getMock();\n\n if ($called) {\n $inline->expects($this->once())->method('render');\n }\n\n return $inline;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function isBooted()\n {\n return $this->booted;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void ipc_rcu_putref(void *ptr)\n{\n\tif (!atomic_dec_and_test(&container_of(ptr, struct ipc_rcu_hdr, data)->refcount))\n\t\treturn;\n\n\tif (container_of(ptr, struct ipc_rcu_hdr, data)->is_vmalloc) {\n\t\tcall_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,\n\t\t\t\tipc_schedule_free);\n\t} else {\n\t\tkfree_rcu(container_of(ptr, struct ipc_rcu_grace, data), rcu);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "b,c,d,e){var f;if(a){a=a.toLowerCase();b&&(f=this.icons[a+\"-rtl\"]);f||(f=this.icons[a])}a=c||f&&f.path||\"\";d=d||f&&f.offset;e=e||f&&f.bgsize||\"16px\";return a&&\"background-image:url(\"+CKEDITOR.getUrl(a)+\");background-position:0 \"+d+\"px;background-size:\"+e+\";\"}};CKEDITOR.tools.extend(CKEDITOR.editor.prototype,{getUiColor:function(){return this.uiColor},setUiColor:function(a){var b=c(CKEDITOR.document);return(this.setUiColor=function(a){var c=CKEDITOR.skin.chameleon,e=[[j,a]];this.uiColor=a;d([b],c(this,\n\"editor\"),e);d(m,c(this,\"panel\"),e)}).call(this,a)}});var h=\"cke_ui_color\",m=[],j=/\\$color/g;CKEDITOR.on(\"instanceLoaded\",function(a){if(!CKEDITOR.env.ie||!CKEDITOR.env.quirks){var b=a.editor,a=function(a){a=(a.data[0]||a.data).element.getElementsByTag(\"iframe\").getItem(0).getFrameDocument();if(!a.getById(\"cke_ui_color\")){a=c(a);m.push(a);var e=b.getUiColor();e&&d([a],CKEDITOR.skin.chameleon(b,\"panel\"),[[j,e]])}};b.on(\"panelShow\",a);b.on(\"menuShow\",a);b.config.uiColor&&b.setUiColor(b.config.uiColor)}})})();", "label": 1, "label_name": "safe"} +{"code": " public function manage_sitemap() {\n global $db, $user, $sectionObj, $sections;\n\n expHistory::set('viewable', $this->params);\n $id = $sectionObj->id;\n $current = null;\n // all we need to do is determine the current section\n $navsections = $sections;\n if ($sectionObj->parent == -1) {\n $current = $sectionObj;\n } else {\n foreach ($navsections as $section) {\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n assign_to_template(array(\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\n 'sections' => $navsections,\n 'current' => $current,\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\n ));\n }", "label": 1, "label_name": "safe"} +{"code": "static int ras_getdatastd(jas_stream_t *in, ras_hdr_t *hdr, ras_cmap_t *cmap,\n jas_image_t *image)\n{\n\tint pad;\n\tint nz;\n\tint z;\n\tint c;\n\tint y;\n\tint x;\n\tint v;\n\tint i;\n\tjas_matrix_t *data[3];\n\n/* Note: This function does not properly handle images with a colormap. */\n\t/* Avoid compiler warnings about unused parameters. */\n\tcmap = 0;\n\n\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\tdata[i] = jas_matrix_create(1, jas_image_width(image));\n\t\tassert(data[i]);\n\t}\n\n\tpad = RAS_ROWSIZE(hdr) - (hdr->width * hdr->depth + 7) / 8;\n\n\tfor (y = 0; y < hdr->height; y++) {\n\t\tnz = 0;\n\t\tz = 0;\n\t\tfor (x = 0; x < hdr->width; x++) {\n\t\t\twhile (nz < hdr->depth) {\n\t\t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tz = (z << 8) | c;\n\t\t\t\tnz += 8;\n\t\t\t}\n\n\t\t\tv = (z >> (nz - hdr->depth)) & RAS_ONES(hdr->depth);\n\t\t\tz &= RAS_ONES(nz - hdr->depth);\n\t\t\tnz -= hdr->depth;\n\n\t\t\tif (jas_image_numcmpts(image) == 3) {\n\t\t\t\tjas_matrix_setv(data[0], x, (RAS_GETRED(v)));\n\t\t\t\tjas_matrix_setv(data[1], x, (RAS_GETGREEN(v)));\n\t\t\t\tjas_matrix_setv(data[2], x, (RAS_GETBLUE(v)));\n\t\t\t} else {\n\t\t\t\tjas_matrix_setv(data[0], x, (v));\n\t\t\t}\n\t\t}\n\t\tif (pad) {\n\t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\t\tif (jas_image_writecmpt(image, i, 0, y, hdr->width, 1,\n\t\t\t data[i])) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\tjas_matrix_destroy(data[i]);\n\t}\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "0;N>>8;return u};Editor.crc32=function(u){for(var D=-1,K=0;K>>8^Editor.crcTable[(D^u.charCodeAt(K))&255];return(D^-1)>>>0};Editor.writeGraphModelToPng=function(u,D,K,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label": 1, "label_name": "safe"} +{"code": " it 'should return the right response' do\n email_token.update!(created_at: 999.years.ago)\n\n post \"/session/email-login/#{email_token.token}.json\"\n\n expect(response.status).to eq(200)\n\n expect(JSON.parse(response.body)[\"error\"]).to eq(\n I18n.t('email_login.invalid_token')\n )\n end", "label": 1, "label_name": "safe"} +{"code": "function add (args, where, cb) {\n // this is hot code. almost everything passes through here.\n // the args can be any of:\n // ['url']\n // ['pkg', 'version']\n // ['pkg@version']\n // ['pkg', 'url']\n // This is tricky, because urls can contain @\n // Also, in some cases we get [name, null] rather\n // that just a single argument.\n\n var usage = 'Usage:\\n' +\n ' npm cache add \\n' +\n ' npm cache add @\\n' +\n ' npm cache add \\n' +\n ' npm cache add \\n'\n var spec\n\n log.silly('cache add', 'args', args)\n\n if (args[1] === undefined) args[1] = null\n\n // at this point the args length must ==2\n if (args[1] !== null) {\n spec = args[0] + '@' + args[1]\n } else if (args.length === 2) {\n spec = args[0]\n }\n\n log.verbose('cache add', 'spec', spec)\n\n if (!spec) return cb(usage)\n\n adding++\n cb = afterAdd(cb)\n\n realizePackageSpecifier(spec, where, function (err, p) {\n if (err) return cb(err)\n\n log.silly('cache add', 'parsed spec', p)\n\n switch (p.type) {\n case 'local':\n case 'directory':\n addLocal(p, null, cb)\n break\n case 'remote':\n // get auth, if possible\n mapToRegistry(spec, npm.config, function (err, uri, auth) {\n if (err) return cb(err)\n\n addRemoteTarball(p.spec, { name: p.name }, null, auth, cb)\n })\n break\n case 'git':\n case 'hosted':\n addRemoteGit(p.rawSpec, cb)\n break\n default:\n if (p.name) return addNamed(p.name, p.spec, null, cb)\n\n cb(new Error(\"couldn't figure out how to install \" + spec))\n }\n })\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function rewind()\n {\n $this->doSleep = true;\n parent::rewind();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,\n struct _7z_folder *f, size_t numFolders)\n{\n\tconst unsigned char *p;\n\tuint64_t *usizes;\n\tsize_t unpack_streams;\n\tint type;\n\tunsigned i;\n\tuint32_t numDigests;\n\n\tmemset(ss, 0, sizeof(*ss));\n\n\tfor (i = 0; i < numFolders; i++)\n\t\tf[i].numUnpackStreams = 1;\n\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\ttype = *p;\n\n\tif (type == kNumUnPackStream) {\n\t\tunpack_streams = 0;\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0)\n\t\t\t\treturn (-1);\n\t\t\tif (UMAX_ENTRY < f[i].numUnpackStreams)\n\t\t\t\treturn (-1);\n\t\t\tif (unpack_streams > SIZE_MAX - UMAX_ENTRY) {\n\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tunpack_streams += (size_t)f[i].numUnpackStreams;\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t} else\n\t\tunpack_streams = numFolders;\n\n\tss->unpack_streams = unpack_streams;\n\tif (unpack_streams) {\n\t\tss->unpackSizes = calloc(unpack_streams,\n\t\t sizeof(*ss->unpackSizes));\n\t\tss->digestsDefined = calloc(unpack_streams,\n\t\t sizeof(*ss->digestsDefined));\n\t\tss->digests = calloc(unpack_streams,\n\t\t sizeof(*ss->digests));\n\t\tif (ss->unpackSizes == NULL || ss->digestsDefined == NULL ||\n\t\t ss->digests == NULL)\n\t\t\treturn (-1);\n\t}\n\n\tusizes = ss->unpackSizes;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tunsigned pack;\n\t\tuint64_t sum;\n\n\t\tif (f[i].numUnpackStreams == 0)\n\t\t\tcontinue;\n\n\t\tsum = 0;\n\t\tif (type == kSize) {\n\t\t\tfor (pack = 1; pack < f[i].numUnpackStreams; pack++) {\n\t\t\t\tif (parse_7zip_uint64(a, usizes) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t\tsum += *usizes++;\n\t\t\t}\n\t\t}\n\t\t*usizes++ = folder_uncompressed_size(&f[i]) - sum;\n\t}\n\n\tif (type == kSize) {\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\tfor (i = 0; i < unpack_streams; i++) {\n\t\tss->digestsDefined[i] = 0;\n\t\tss->digests[i] = 0;\n\t}\n\n\tnumDigests = 0;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tif (f[i].numUnpackStreams != 1 || !f[i].digest_defined)\n\t\t\tnumDigests += (uint32_t)f[i].numUnpackStreams;\n\t}\n\n\tif (type == kCRC) {\n\t\tstruct _7z_digests tmpDigests;\n\t\tunsigned char *digestsDefined = ss->digestsDefined;\n\t\tuint32_t * digests = ss->digests;\n\t\tint di = 0;\n\n\t\tmemset(&tmpDigests, 0, sizeof(tmpDigests));\n\t\tif (read_Digests(a, &(tmpDigests), numDigests) < 0) {\n\t\t\tfree_Digest(&tmpDigests);\n\t\t\treturn (-1);\n\t\t}\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (f[i].numUnpackStreams == 1 && f[i].digest_defined) {\n\t\t\t\t*digestsDefined++ = 1;\n\t\t\t\t*digests++ = f[i].digest;\n\t\t\t} else {\n\t\t\t\tunsigned j;\n\n\t\t\t\tfor (j = 0; j < f[i].numUnpackStreams;\n\t\t\t\t j++, di++) {\n\t\t\t\t\t*digestsDefined++ =\n\t\t\t\t\t tmpDigests.defineds[di];\n\t\t\t\t\t*digests++ =\n\t\t\t\t\t tmpDigests.digests[di];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree_Digest(&tmpDigests);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\t/*\n\t * Must be kEnd.\n\t */\n\tif (type != kEnd)\n\t\treturn (-1);\n\treturn (0);\n}", "label": 1, "label_name": "safe"} +{"code": " function render_menu_page() \r\n {\r\n echo '
';\r\n echo '

'.__('Blacklist Manager','all-in-one-wp-security-and-firewall').'

';//Interface title\r\n $this->set_menu_tabs();\r\n $tab = $this->get_current_tab();\r\n $this->render_menu_tabs();\r\n ?> \r\n
\r\n menu_tabs);\r\n call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));\r\n ?>\r\n
\r\n
\r\n self,\n :user => user,\n :role => role )\n end", "label": 1, "label_name": "safe"} +{"code": "error_t tcpCheckSeqNum(Socket *socket, TcpHeader *segment, size_t length)\n{\n //Acceptability test for an incoming segment\n bool_t acceptable = FALSE;\n\n //Case where both segment length and receive window are zero\n if(!length && !socket->rcvWnd)\n {\n //Make sure that SEG.SEQ = RCV.NXT\n if(segment->seqNum == socket->rcvNxt)\n {\n acceptable = TRUE;\n }\n }\n //Case where segment length is zero and receive window is non zero\n else if(!length && socket->rcvWnd)\n {\n //Make sure that RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND\n if(TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt) >= 0 &&\n TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt + socket->rcvWnd) < 0)\n {\n acceptable = TRUE;\n }\n }\n //Case where both segment length and receive window are non zero\n else if(length && socket->rcvWnd)\n {\n //Check whether RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND\n if(TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt) >= 0 &&\n TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt + socket->rcvWnd) < 0)\n {\n acceptable = TRUE;\n }\n //or RCV.NXT <= SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND\n else if(TCP_CMP_SEQ(segment->seqNum + length - 1, socket->rcvNxt) >= 0 &&\n TCP_CMP_SEQ(segment->seqNum + length - 1, socket->rcvNxt + socket->rcvWnd) < 0)\n {\n acceptable = TRUE;\n }\n }\n\n //Non acceptable sequence number?\n if(!acceptable)\n {\n //Debug message\n TRACE_WARNING(\"Sequence number is not acceptable!\\r\\n\");\n\n //If an incoming segment is not acceptable, an acknowledgment\n //should be sent in reply (unless the RST bit is set)\n if(!(segment->flags & TCP_FLAG_RST))\n tcpSendSegment(socket, TCP_FLAG_ACK, socket->sndNxt, socket->rcvNxt, 0, FALSE);\n\n //Return status code\n return ERROR_FAILURE;\n }\n\n //Sequence number is acceptable\n return NO_ERROR;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function upload($_files , $file_key , $uid , $item_id = 0 , $page_id = 0 ){\n\t\t$uploadFile = $_files[$file_key] ;\n\n\t\tif( !$this->isAllowedFilename($_files[$file_key]['name']) ){\n\t\t\treturn false;\n\t\t}\n\n\t\t$oss_open = D(\"Options\")->get(\"oss_open\" ) ;\n\t\tif ($oss_open) {\n\t\t\t\t$url = $this->uploadOss($uploadFile);\n\t\t\t\tif ($url) {\n\t\t\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign)); \n\t\t\t\t\t return $url ;\n\t\t\t\t}\n\t\t}else{\n\t\t\t$upload = new \\Think\\Upload();// \u5b9e\u4f8b\u5316\u4e0a\u4f20\u7c7b\n\t\t\t$upload->maxSize = 1003145728 ;// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5927\u5c0f\n\t\t\t$upload->rootPath = './../Public/Uploads/';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u76ee\u5f55\n\t\t\t$upload->savePath = '';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5b50\u76ee\u5f55\n\t\t\t$info = $upload->uploadOne($uploadFile) ;\n\t\t\tif(!$info) {// \u4e0a\u4f20\u9519\u8bef\u63d0\u793a\u9519\u8bef\u4fe1\u606f\n\t\t\t\tvar_dump($upload->getError());\n\t\t\t\treturn;\n\t\t\t}else{// \u4e0a\u4f20\u6210\u529f \u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u4fe1\u606f\n\t\t\t\t$url = site_url().'/Public/Uploads/'.$info['savepath'].$info['savename'] ;\n\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t$insert = array(\n\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t);\n\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign));\n\t\t\t\treturn $url ;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, unsigned length)\n{\n\tunsigned i = 0, o;\n\tint q = 0;\n\tint curanswer;\n\tResourceRecord rr;\n \tunsigned short ptr;\n\n\t/* This is just to keep _FORTIFY_SOURCE happy */\n\trr.type = DNS_QUERY_NONE;\n\trr.rdlength = 0;\n\trr.ttl = 1;\t/* GCC is a whiney bastard -- see the XXX below. */\n\trr.rr_class = 0; /* Same for VC++ */\n\n\tif (!(header.flags1 & FLAGS_MASK_QR))\n\t\treturn std::make_pair((unsigned char*)NULL,\"Not a query result\");\n\n\tif (header.flags1 & FLAGS_MASK_OPCODE)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Unexpected value in DNS reply packet\");\n\n\tif (header.flags2 & FLAGS_MASK_RCODE)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Domain name not found\");\n\n\tif (header.ancount < 1)\n\t\treturn std::make_pair((unsigned char*)NULL,\"No resource records returned\");\n\n\t/* Subtract the length of the header from the length of the packet */\n\tlength -= 12;\n\n\twhile ((unsigned int)q < header.qdcount && i < length)\n\t{\n\t\tif (header.payload[i] > 63)\n\t\t{\n\t\t\ti += 6;\n\t\t\tq++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (header.payload[i] == 0)\n\t\t\t{\n\t\t\t\tq++;\n\t\t\t\ti += 5;\n\t\t\t}\n\t\t\telse i += header.payload[i] + 1;\n\t\t}\n\t}\n\tcuranswer = 0;\n\twhile ((unsigned)curanswer < header.ancount)\n\t{\n\t\tq = 0;\n\t\twhile (q == 0 && i < length)\n\t\t{\n\t\t\tif (header.payload[i] > 63)\n\t\t\t{\n\t\t\t\ti += 2;\n\t\t\t\tq = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (header.payload[i] == 0)\n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t\tq = 1;\n\t\t\t\t}\n\t\t\t\telse i += header.payload[i] + 1; /* skip length and label */\n\t\t\t}\n\t\t}\n\t\tif (static_cast(length - i) < 10)\n\t\t\treturn std::make_pair((unsigned char*)NULL,\"Incorrectly sized DNS reply\");\n\n\t\t/* XXX: We actually initialise 'rr' here including its ttl field */\n\t\tDNS::FillResourceRecord(&rr,&header.payload[i]);\n\n\t\ti += 10;\n\t\tServerInstance->Logs->Log(\"RESOLVER\",DEBUG,\"Resolver: rr.type is %d and this.type is %d rr.class %d this.class %d\", rr.type, this->type, rr.rr_class, this->rr_class);\n\t\tif (rr.type != this->type)\n\t\t{\n\t\t\tcuranswer++;\n\t\t\ti += rr.rdlength;\n\t\t\tcontinue;\n\t\t}\n\t\tif (rr.rr_class != this->rr_class)\n\t\t{\n\t\t\tcuranswer++;\n\t\t\ti += rr.rdlength;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tif ((unsigned int)curanswer == header.ancount)\n\t\treturn std::make_pair((unsigned char*)NULL,\"No A, AAAA or PTR type answers (\" + ConvToStr(header.ancount) + \" answers)\");\n\n\tif (i + rr.rdlength > (unsigned int)length)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Resource record larger than stated\");\n\n\tif (rr.rdlength > 1023)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Resource record too large\");\n\n\tthis->ttl = rr.ttl;\n\n\tswitch (rr.type)\n\t{\n\t\t/*\n\t\t * CNAME and PTR are compressed. We need to decompress them.\n\t\t */\n\t\tcase DNS_QUERY_CNAME:\n\t\tcase DNS_QUERY_PTR:\n\t\t\to = 0;\n\t\t\tq = 0;\n\t\t\twhile (q == 0 && i < length && o + 256 < 1023)\n\t\t\t{\n\t\t\t\t/* DN label found (byte over 63) */\n\t\t\t\tif (header.payload[i] > 63)\n\t\t\t\t{\n\t\t\t\t\tmemcpy(&ptr,&header.payload[i],2);\n\n\t\t\t\t\ti = ntohs(ptr);\n\n\t\t\t\t\t/* check that highest two bits are set. if not, we've been had */\n\t\t\t\t\tif (!(i & DN_COMP_BITMASK))\n\t\t\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"DN label decompression header is bogus\");\n\n\t\t\t\t\t/* mask away the two highest bits. */\n\t\t\t\t\ti &= ~DN_COMP_BITMASK;\n\n\t\t\t\t\t/* and decrease length by 12 bytes. */\n\t\t\t\t\ti =- 12;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (header.payload[i] == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tq = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tres[o] = 0;\n\t\t\t\t\t\tif (o != 0)\n\t\t\t\t\t\t\tres[o++] = '.';\n\n\t\t\t\t\t\tif (o + header.payload[i] > sizeof(DNSHeader))\n\t\t\t\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"DN label decompression is impossible -- malformed/hostile packet?\");\n\n\t\t\t\t\t\tmemcpy(&res[o], &header.payload[i + 1], header.payload[i]);\n\t\t\t\t\t\to += header.payload[i];\n\t\t\t\t\t\ti += header.payload[i] + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tres[o] = 0;\n\t\tbreak;\n\t\tcase DNS_QUERY_AAAA:\n\t\t\tif (rr.rdlength != sizeof(struct in6_addr))\n\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"rr.rdlength is larger than 16 bytes for an ipv6 entry -- malformed/hostile packet?\");\n\n\t\t\tmemcpy(res,&header.payload[i],rr.rdlength);\n\t\t\tres[rr.rdlength] = 0;\n\t\tbreak;\n\t\tcase DNS_QUERY_A:\n\t\t\tif (rr.rdlength != sizeof(struct in_addr))\n\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"rr.rdlength is larger than 4 bytes for an ipv4 entry -- malformed/hostile packet?\");\n\n\t\t\tmemcpy(res,&header.payload[i],rr.rdlength);\n\t\t\tres[rr.rdlength] = 0;\n\t\tbreak;\n\t\tdefault:\n\t\t\treturn std::make_pair((unsigned char *) NULL, \"don't know how to handle undefined type (\" + ConvToStr(rr.type) + \") -- rejecting\");\n\t\tbreak;\n\t}\n\treturn std::make_pair(res,\"No error\");\n}", "label": 1, "label_name": "safe"} +{"code": " var update_selected_labels = function() {\n var count = 0;\n $(\".ui-selected\", div_all_tags).not(\".filtered\").each(function() {\n var $this = $(this);\n if ($this.hasClass('alltags-tagset')) {\n count += $this.nextUntil(\":not(.alltags-childtag)\").not(\n \".filtered, .ui-selected\").length;\n } else {\n count++;\n }\n });\n $(\"#id_tags_selected\").text(count ? count + \" selected\" : \"\");\n var tagset = get_selected_tagset();\n if (tagset) {\n $(\"#id_selected_tag_set\").html(\n \"Add a new tag in \" +\n tagset.text() + \" tag set and select it immediately:\");\n } else {\n $(\"#id_selected_tag_set\").text(\n \"Add a new tag and select it immediately:\");\n }\n };", "label": 0, "label_name": "vulnerable"} +{"code": "this.menus.addPopupMenuEditItems=function(E,G,P){d.editor.graph.isSelectionEmpty()?B.apply(this,arguments):d.menus.addMenuItems(E,\"delete - cut copy copyAsImage - duplicate\".split(\" \"),null,P)}}d.actions.get(\"print\").funct=function(){d.showDialog((new PrintDialog(d)).container,360,null!=d.pages&&1 'test_sql', 'enforce_sql' => false})\n should contain_exec('test_db-import').with_refreshonly(true)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "p[C]}catch(I){null!=window.console&&console.log(\"Error in vars URL parameter: \"+I)}};Graph.prototype.getExportVariables=function(){return null!=this.globalVars?mxUtils.clone(this.globalVars):{}};var x=Graph.prototype.getGlobalVariable;Graph.prototype.getGlobalVariable=function(p){var C=x.apply(this,arguments);null==C&&null!=this.globalVars&&(C=this.globalVars[p]);return C};Graph.prototype.getDefaultStylesheet=function(){if(null==this.defaultStylesheet){var p=this.themes[\"default-style2\"];this.defaultStylesheet=", "label": 1, "label_name": "safe"} +{"code": " private ServletFileUpload getServletFileUpload() {\n FileItemFactory factory = new DiskFileItemFactory();\n ServletFileUpload upload = new ServletFileUpload( factory );\n upload.setHeaderEncoding( \"UTF-8\" );\n return upload;\n }", "label": 1, "label_name": "safe"} +{"code": "function setupWebSocketProxy (fastify, options) {\n const server = new WebSocket.Server({\n path: options.prefix,\n server: fastify.server,\n ...options.wsServerOptions\n })\n\n fastify.addHook('onClose', (instance, done) => server.close(done))\n\n // To be able to close the HTTP server,\n // all WebSocket clients need to be disconnected.\n // Fastify is missing a pre-close event, or the ability to\n // add a hook before the server.close call. We need to resort\n // to monkeypatching for now.\n const oldClose = fastify.server.close\n fastify.server.close = function (done) {\n for (const client of server.clients) {\n client.close()\n }\n oldClose.call(this, done)\n }\n\n server.on('error', (err) => {\n fastify.log.error(err)\n })\n\n server.on('connection', (source, request) => {\n const url = createWebSocketUrl(options, request)\n\n const target = new WebSocket(url, options.wsClientOptions)\n\n fastify.log.debug({ url: url.href }, 'proxy websocket')\n proxyWebSockets(source, target)\n })\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def __init__(self):\r\n keys = [key for key in list(request.form.keys()) + list(request.files.keys())]\r\n field_infos = [FieldInfo.factory(key) for key in keys if key != \"csrf_token\"]\r\n # important to sort them so they will be in expected order on command line\r\n self.field_infos = list(sorted(field_infos))\r", "label": 1, "label_name": "safe"} +{"code": "function teampass_whitelist() {\n $bdd = teampass_connect();\n\t$apiip_pool = teampass_get_ips();\n\tif (count($apiip_pool) > 0 && array_search($_SERVER['REMOTE_ADDR'], $apiip_pool) === false) {\n\t\trest_error('IPWHITELIST');\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "function is_proper_view_name( $string )\n{\n if(preg_match(\"/[^a-zA-z0-9_\\-\\ ]/\", $string)){\n return false;\n } else {\n return true;\n }\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic function load_by_hash($hash)\r\n\t{\r\n\t\tglobal $DB;\r\n\t\tglobal $session;\r\n global $events;\r\n\r\n $ok = $DB->query(\r\n 'SELECT * FROM nv_webusers WHERE cookie_hash = :hash',\r\n 'object',\r\n array(\r\n ':hash' => $hash\r\n )\r\n );\r\n\r\n if($ok)\r\n {\r\n $data = $DB->result();\r\n }\r\n\r\n if(!empty($data))\r\n\t\t{\r\n\t\t\t$this->load_from_resultset($data);\r\n\r\n\t\t\t// check if the user is still allowed to sign in\r\n\t\t\t$blocked = 1;\r\n\t\t\tif( $this->access == 0 ||\r\n ( $this->access == 2 &&\r\n ($this->access_begin==0 || $this->access_begin < time()) &&\r\n ($this->access_end==0 || $this->access_end > time())\r\n )\r\n )\r\n\t\t\t{\r\n\t\t\t\t$blocked = 0;\r\n\t\t\t}\r\n\r\n\t\t\tif($blocked==1)\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t$session['webuser'] = $this->id;\r\n\r\n // maybe this function is called without initializing $events\r\n if(method_exists($events, 'trigger'))\r\n {\r\n $events->trigger(\r\n 'webuser',\r\n 'sign_in',\r\n array(\r\n 'webuser' => $this,\r\n 'by' => 'cookie'\r\n )\r\n );\r\n }\r\n\t\t}\r\n\r\n\t}\r", "label": 1, "label_name": "safe"} +{"code": "perf_event_read_event(struct perf_event *event,\n\t\t\tstruct task_struct *task)\n{\n\tstruct perf_output_handle handle;\n\tstruct perf_sample_data sample;\n\tstruct perf_read_event read_event = {\n\t\t.header = {\n\t\t\t.type = PERF_RECORD_READ,\n\t\t\t.misc = 0,\n\t\t\t.size = sizeof(read_event) + event->read_size,\n\t\t},\n\t\t.pid = perf_event_pid(event, task),\n\t\t.tid = perf_event_tid(event, task),\n\t};\n\tint ret;\n\n\tperf_event_header__init_id(&read_event.header, &sample, event);\n\tret = perf_output_begin(&handle, event, read_event.header.size, 0, 0);\n\tif (ret)\n\t\treturn;\n\n\tperf_output_put(&handle, read_event);\n\tperf_output_read(&handle, event);\n\tperf_event__output_id_sample(event, &handle, &sample);\n\n\tperf_output_end(&handle);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "(window.webpackJsonpLHCReactAPP=window.webpackJsonpLHCReactAPP||[]).push([[7],{481:function(t,e,a){\"use strict\";a.r(e),a.d(e,\"nodeJSChat\",(function(){return d}));var n=a(6),i=a.n(n),s=a(7),c=a.n(s),h=a(2),o=a(5),d=new(function(){function t(){var e=this;i()(this,t),this.socket=null,h.a.eventEmitter.addListener(\"endedChat\",(function(){null!==e.socket&&e.socket.destroy()}))}return c()(t,[{key:\"bootstrap\",value:function(t,e,n){var i=n(),s=i.chatwidget.getIn([\"chatData\",\"id\"]),c=(i.chatwidget.getIn([\"chatData\",\"hash\"]),i.chatwidget.getIn([\"chat_ui\",\"sync_interval\"])),d={hostname:t.hostname,path:t.path,autoReconnectOptions:{initialDelay:5e3,randomness:5e3}};\"\"!=t.port&&(d.port=parseInt(t.port)),1==t.secure&&(d.secure=!0),t.instance_id>0&&t.instance_id;var r=a(490),g=this.socket=r.connect(d),_=null;function l(e){1==e.status?t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vt\",msg:e.msg}):g.publish(\"chat_\"+s,{op:\"vt\",msg:e.msg}):t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vts\"}):g.publish(\"chat_\"+s,{op:\"vts\"})}function u(e){t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vt\",msg:\"\u2709\ufe0f \"+e.msg}):g.publish(\"chat_\"+s,{op:\"vt\",msg:\"\u2709\ufe0f \"+e.msg})}function p(e){t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vt\",msg:\"\ud83d\udcd5\ufe0f error happened while sending visitor message, please inform your administrator!\"}):g.publish(\"chat_\"+s,{op:\"vt\",msg:\"\ud83d\udcd5\ufe0f error happened while sending visitor message, please inform your administrator!\"})}function m(){if(null!==_)try{_.destroy()}catch(t){}h.a.eventEmitter.removeListener(\"visitorTyping\",l),h.a.eventEmitter.removeListener(\"messageSend\",u),h.a.eventEmitter.removeListener(\"messageSendError\",p),e({type:\"CHAT_UI_UPDATE\",data:{sync_interval:c}}),e({type:\"CHAT_REMOVE_OVERRIDE\",data:\"typing\"})}function w(){(_=t.instance_id>0?g.subscribe(\"chat_\"+t.instance_id+\"_\"+s):g.subscribe(\"chat_\"+s)).on(\"subscribeFail\",(function(t){console.error(\"Failed to subscribe to the sample channel due to error: \"+t)})),_.on(\"subscribe\",(function(){g.publish(t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+s:\"chat_\"+s,{op:\"vi_online\",status:!0})})),_.watch((function(a){if(\"ot\"==a.op)1==a.data.status?e({type:\"chat_status_changed\",data:{text:a.data.ttx}}):e({type:\"chat_status_changed\",data:{text:\"\"}});else if(\"cmsg\"==a.op||\"schange\"==a.op){var i=n();i.chatwidget.hasIn([\"chatData\",\"id\"])&&e(Object(o.d)({chat_id:i.chatwidget.getIn([\"chatData\",\"id\"]),hash:i.chatwidget.getIn([\"chatData\",\"hash\"]),lmgsid:i.chatwidget.getIn([\"chatLiveData\",\"lmsgid\"]),theme:i.chatwidget.get(\"theme\")}))}else if(\"umsg\"==a.op){var s=n();s.chatwidget.hasIn([\"chatData\",\"id\"])&&Object(o.s)({msg_id:a.msid,id:s.chatwidget.getIn([\"chatData\",\"id\"]),hash:s.chatwidget.getIn([\"chatData\",\"hash\"])})(e,n)}else if(\"schange\"==a.op||\"cclose\"==a.op){var c=n();c.chatwidget.hasIn([\"chatData\",\"id\"])&&e(Object(o.b)({chat_id:c.chatwidget.getIn([\"chatData\",\"id\"]),hash:c.chatwidget.getIn([\"chatData\",\"hash\"]),mode:c.chatwidget.get(\"mode\"),theme:c.chatwidget.get(\"theme\")}))}else if(\"vo\"==a.op){var h=n();h.chatwidget.hasIn([\"chatData\",\"id\"])&&g.publish(t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+h.chatwidget.getIn([\"chatData\",\"id\"]):\"chat_\"+h.chatwidget.getIn([\"chatData\",\"id\"]),{op:\"vi_online\",status:!0})}})),h.a.eventEmitter.addListener(\"visitorTyping\",l),h.a.eventEmitter.addListener(\"messageSend\",u),h.a.eventEmitter.addListener(\"messageSendError\",p),e({type:\"CHAT_UI_UPDATE\",data:{sync_interval:1e4}}),e({type:\"CHAT_ADD_OVERRIDE\",data:\"typing\"})}g.on(\"error\",(function(t){console.error(t)})),g.on(\"close\",(function(){m()})),g.on(\"deauthenticate\",(function(){var e=n(),a=e.chatwidget.getIn([\"chatData\",\"id\"]);window.lhcAxios.post(window.lhcChat.base_url+\"nodejshelper/tokenvisitor/\"+a+\"/\"+e.chatwidget.getIn([\"chatData\",\"hash\"]),null,{headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"}}).then((function(e){g.emit(\"login\",{hash:e.data,chanelName:t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+a:\"chat_\"+a},(function(t){t&&(console.log(t),m())}))}))})),g.on(\"connect\",(function(e){if(e.isAuthenticated&&s>0)w();else{var a=n(),i=a.chatwidget.getIn([\"chatData\",\"id\"]);window.lhcAxios.post(window.lhcChat.base_url+\"nodejshelper/tokenvisitor/\"+i+\"/\"+a.chatwidget.getIn([\"chatData\",\"hash\"]),null,{headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"}}).then((function(e){g.emit(\"login\",{hash:e.data,chanelName:t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+i:\"chat_\"+i},(function(t){t?(console.log(t),g.destroy()):w()}))}))}}))}}]),t}())}}]);", "label": 0, "label_name": "vulnerable"} +{"code": "static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)\n{\n\tstruct crypto_report_cipher rcipher;\n\n\tstrncpy(rcipher.type, \"cipher\", sizeof(rcipher.type));\n\n\trcipher.blocksize = alg->cra_blocksize;\n\trcipher.min_keysize = alg->cra_cipher.cia_min_keysize;\n\trcipher.max_keysize = alg->cra_cipher.cia_max_keysize;\n\n\tif (nla_put(skb, CRYPTOCFGA_REPORT_CIPHER,\n\t\t sizeof(struct crypto_report_cipher), &rcipher))\n\t\tgoto nla_put_failure;\n\treturn 0;\n\nnla_put_failure:\n\treturn -EMSGSIZE;\n}", "label": 1, "label_name": "safe"} +{"code": "void libxsmm_sparse_csr_reader( libxsmm_generated_code* io_generated_code,\n const char* i_csr_file_in,\n unsigned int** o_row_idx,\n unsigned int** o_column_idx,\n double** o_values,\n unsigned int* o_row_count,\n unsigned int* o_column_count,\n unsigned int* o_element_count ) {\n FILE *l_csr_file_handle;\n const unsigned int l_line_length = 512;\n char l_line[512/*l_line_length*/+1];\n unsigned int l_header_read = 0;\n unsigned int* l_row_idx_id = NULL;\n unsigned int l_i = 0;\n\n l_csr_file_handle = fopen( i_csr_file_in, \"r\" );\n if ( l_csr_file_handle == NULL ) {\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_INPUT );\n return;\n }\n\n while (fgets(l_line, l_line_length, l_csr_file_handle) != NULL) {\n if ( strlen(l_line) == l_line_length ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n fclose(l_csr_file_handle); /* close mtx file */\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_READ_LEN );\n return;\n }\n /* check if we are still reading comments header */\n if ( l_line[0] == '%' ) {\n continue;\n } else {\n /* if we are the first line after comment header, we allocate our data structures */\n if ( l_header_read == 0 ) {\n if (3 == sscanf(l_line, \"%u %u %u\", o_row_count, o_column_count, o_element_count) &&\n 0 != *o_row_count && 0 != *o_column_count && 0 != *o_element_count)\n {\n /* allocate CSC data-structure matching mtx file */\n *o_column_idx = (unsigned int*) malloc(sizeof(unsigned int) * (*o_element_count));\n *o_row_idx = (unsigned int*) malloc(sizeof(unsigned int) * ((size_t)(*o_row_count) + 1));\n *o_values = (double*) malloc(sizeof(double) * (*o_element_count));\n l_row_idx_id = (unsigned int*) malloc(sizeof(unsigned int) * (*o_row_count));\n\n /* check if mallocs were successful */\n if ( ( *o_row_idx == NULL ) ||\n ( *o_column_idx == NULL ) ||\n ( *o_values == NULL ) ||\n ( l_row_idx_id == NULL ) ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n fclose(l_csr_file_handle); /* close mtx file */\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_ALLOC_DATA );\n return;\n }\n\n /* set everything to zero for init */\n memset(*o_row_idx, 0, sizeof(unsigned int) * ((size_t)(*o_row_count) + 1));\n memset(*o_column_idx, 0, sizeof(unsigned int) * (*o_element_count));\n memset(*o_values, 0, sizeof(double) * (*o_element_count));\n memset(l_row_idx_id, 0, sizeof(unsigned int) * (*o_row_count));\n\n /* init column idx */\n for ( l_i = 0; l_i <= *o_row_count; ++l_i )\n (*o_row_idx)[l_i] = (*o_element_count);\n\n /* init */\n (*o_row_idx)[0] = 0;\n l_i = 0;\n l_header_read = 1;\n } else {\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_READ_DESC );\n fclose( l_csr_file_handle ); /* close mtx file */\n return;\n }\n /* now we read the actual content */\n } else {\n unsigned int l_row = 0, l_column = 0;\n double l_value = 0;\n /* read a line of content */\n if ( sscanf(l_line, \"%u %u %lf\", &l_row, &l_column, &l_value) != 3 ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n fclose(l_csr_file_handle); /* close mtx file */\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_READ_ELEMS );\n return;\n }\n /* adjust numbers to zero termination */\n LIBXSMM_ASSERT(0 != l_row && 0 != l_column);\n l_row--; l_column--;\n /* add these values to row and value structure */\n (*o_column_idx)[l_i] = l_column;\n (*o_values)[l_i] = l_value;\n l_i++;\n /* handle columns, set id to own for this column, yeah we need to handle empty columns */\n l_row_idx_id[l_row] = 1;\n (*o_row_idx)[l_row+1] = l_i;\n }\n }\n }\n\n /* close mtx file */\n fclose( l_csr_file_handle );\n\n /* check if we read a file which was consistent */\n if ( l_i != (*o_element_count) ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_LEN );\n return;\n }\n\n if ( l_row_idx_id != NULL ) {\n /* let's handle empty rows */\n for ( l_i = 0; l_i < (*o_row_count); l_i++) {\n if ( l_row_idx_id[l_i] == 0 ) {\n (*o_row_idx)[l_i+1] = (*o_row_idx)[l_i];\n }\n }\n\n /* free helper data structure */\n free( l_row_idx_id );\n }\n}", "label": 1, "label_name": "safe"} +{"code": "CKEDITOR.plugins.link={getSelectedLink:function(b){var a=b.getSelection(),d=a.getSelectedElement();return d&&d.is(\"a\")?d:(a=a.getRanges()[0])?(a.shrink(CKEDITOR.SHRINK_TEXT),b.elementPath(a.getCommonAncestor()).contains(\"a\",1)):null},fakeAnchor:CKEDITOR.env.opera||CKEDITOR.env.webkit,synAnchorSelector:CKEDITOR.env.ie,emptyAnchorFix:CKEDITOR.env.ie&&8>CKEDITOR.env.version,tryRestoreFakeAnchor:function(b,a){if(a&&a.data(\"cke-real-element-type\")&&\"anchor\"==a.data(\"cke-real-element-type\")){var d=b.restoreRealElement(a);", "label": 1, "label_name": "safe"} +{"code": "static void vgacon_flush_scrollback(struct vc_data *c)\n{\n\tsize_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;\n\n\tvgacon_scrollback_reset(c->vc_num, size);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getToken()\n {\n if (isset($this->data['object']) && 'token' === $this->data['object']) {\n return $this->data['id'];\n }\n\n return;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tmime2class : function(mime) {\n\t\tvar prefix = 'elfinder-cwd-icon-';\n\t\t\n\t\tmime = mime.split('/');\n\t\t\n\t\treturn prefix+mime[0]+(mime[0] != 'image' && mime[1] ? ' '+prefix+mime[1].replace(/(\\.|\\+)/g, '-') : '');\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\n try {\n if (request.getParameter(\"path\") != null) {\n writeFile(ioService.get(new URI(request.getParameter(\"path\"))), getFileItem(request));\n\n writeResponse(response, \"OK\");\n } else if (request.getParameter(\"folder\") != null) {\n writeFile(\n ioService.get(new URI(request.getParameter(\"folder\") + \"/\" + request.getParameter(\"fileName\"))),\n getFileItem(request));\n\n writeResponse(response, \"OK\");\n }\n\n } catch (FileUploadException e) {\n logError(e);\n writeResponse(response, \"FAIL\");\n } catch (URISyntaxException e) {\n logError(e);\n writeResponse(response, \"FAIL\");\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *MockRequester) SetRequestedScopes(arg0 fosite.Arguments) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetRequestedScopes\", arg0)\n}", "label": 1, "label_name": "safe"} +{"code": "static int swevent_hlist_get_cpu(struct perf_event *event, int cpu)\n{\n\tstruct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);\n\tint err = 0;\n\n\tmutex_lock(&swhash->hlist_mutex);\n\n\tif (!swevent_hlist_deref(swhash) && cpu_online(cpu)) {\n\t\tstruct swevent_hlist *hlist;\n\n\t\thlist = kzalloc(sizeof(*hlist), GFP_KERNEL);\n\t\tif (!hlist) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto exit;\n\t\t}\n\t\trcu_assign_pointer(swhash->swevent_hlist, hlist);\n\t}\n\tswhash->hlist_refcount++;\nexit:\n\tmutex_unlock(&swhash->hlist_mutex);\n\n\treturn err;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " protected int addFileNames(String[] file) { // This appears to only be used by unit tests\n for (int i = 0; file != null && i < file.length; i++) {\n workUnitList.add(new WorkUnit(file[i]));\n }\n return size();\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testEmpty()\n {\n $this->assertParsing(\n '',\n null, null, null, null, '', null, null\n );\n }", "label": 1, "label_name": "safe"} +{"code": " def query\n gemlist(:justme => resource[:name], :local => true)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function setFragmentPath($path)\n {\n $this->fragmentPath = $path;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def verify_files gem\n gem.each do |entry|\n verify_entry entry\n end\n\n unless @spec then\n raise Gem::Package::FormatError.new 'package metadata is missing', @gem\n end\n\n unless @files.include? 'data.tar.gz' then\n raise Gem::Package::FormatError.new \\\n 'package content (data.tar.gz) is missing', @gem\n end\n\n if duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first) and duplicates.any?\n raise Gem::Security::Exception, \"duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})\"\n end\n end", "label": 1, "label_name": "safe"} +{"code": " it 'applies the manifest with resource failures' do\n apply_manifest(pp, :expect_failures => true)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should be able to mysql_deepmerge two hashes' do\n new_hash = scope.function_mysql_deepmerge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])\n new_hash['one'].should == '1'\n new_hash['two'].should == '2'\n new_hash['three'].should == '2'\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\t public void doFilter(ServletRequest srequest, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {\n\n\t \t\tHttpServletRequest request = (HttpServletRequest) srequest;\n\t \t\tfilterChain.doFilter(new XssHttpServletRequestWrapper(request) {}, response);\n\n\t }", "label": 1, "label_name": "safe"} +{"code": "CKEDITOR.command.prototype={enable:function(){this.state==CKEDITOR.TRISTATE_DISABLED&&this.checkAllowed()&&this.setState(!this.preserveState||typeof this.previousState==\"undefined\"?CKEDITOR.TRISTATE_OFF:this.previousState)},disable:function(){this.setState(CKEDITOR.TRISTATE_DISABLED)},setState:function(a){if(this.state==a||a!=CKEDITOR.TRISTATE_DISABLED&&!this.checkAllowed())return false;this.previousState=this.state;this.state=a;this.fire(\"state\");return true},toggleState:function(){this.state==CKEDITOR.TRISTATE_OFF?", "label": 1, "label_name": "safe"} +{"code": " Status ValidateInputTensor(const Tensor& tensor,\n const std::string& tensor_name,\n const Tensor& rhs) {\n const int ndims = rhs.dims();\n if (tensor.dims() != ndims) {\n return errors::InvalidArgument(tensor_name,\n \" must have same rank as rhs, but got \",\n tensor.dims(), \" and \", ndims);\n }\n for (int i = 0; i < ndims - 2; i++) {\n if (tensor.dim_size(i) != rhs.dim_size(i)) {\n return errors::InvalidArgument(\n tensor_name,\n \" must have same outer dimensions as rhs, but for index \", i,\n \", got \", tensor.dim_size(i), \" and \", rhs.dim_size(i));\n }\n }\n if (tensor.dim_size(ndims - 2) != 1) {\n return errors::InvalidArgument(\n tensor_name, \"'s second-to-last dimension must be 1, but got \",\n tensor.dim_size(ndims - 2));\n }\n if (tensor.dim_size(ndims - 1) != rhs.dim_size(ndims - 2)) {\n return errors::InvalidArgument(tensor_name,\n \"'s last dimension size must be rhs's \"\n \"second-to-last dimension size, but got \",\n tensor.dim_size(ndims - 1), \" and \",\n rhs.dim_size(ndims - 2));\n }\n return Status::OK();\n }", "label": 1, "label_name": "safe"} +{"code": " protected void deactivateConversationContext(HttpServletRequest request) {\n try {\n ConversationContext conversationContext = httpConversationContext();\n if (conversationContext.isActive()) {\n // Only deactivate the context if one is already active, otherwise we get Exceptions\n if (conversationContext instanceof LazyHttpConversationContextImpl) {\n LazyHttpConversationContextImpl lazyConversationContext = (LazyHttpConversationContextImpl) conversationContext;\n if (!lazyConversationContext.isInitialized()) {\n // if this lazy conversation has not been touched yet, just deactivate it\n lazyConversationContext.deactivate();\n return;\n }\n }\n boolean isTransient = conversationContext.getCurrentConversation().isTransient();\n if (ConversationLogger.LOG.isTraceEnabled()) {\n if (isTransient) {\n ConversationLogger.LOG.cleaningUpTransientConversation();\n } else {\n ConversationLogger.LOG.cleaningUpConversation(conversationContext.getCurrentConversation().getId());\n }\n }\n conversationContext.invalidate();\n conversationContext.deactivate();\n if (isTransient) {\n conversationDestroyedEvent.fire(request);\n }\n }\n } catch (Exception e) {\n ServletLogger.LOG.unableToDeactivateContext(httpConversationContext(), request);\n ServletLogger.LOG.catchingDebug(e);\n }\n }", "label": 1, "label_name": "safe"} +{"code": " public Task ParseArchiveFileKeyAsync(string archiveFileKey)\n {\n var tempDirPath = Path.GetTempPath();\n\n return Task.FromResult(Path.Combine(tempDirPath, archiveFileKey));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " filters.push({'condition': 'AND', 'filters': this.filterPanels[id].getValue(), 'id': id, label: Ext.util.Format.htmlDecode(this.filterPanels[id].title)});\n }\n }\n \n // NOTE: always trigger a OR condition, otherwise we sould loose inactive FilterPanles\n //return filters.length == 1 ? filters[0].filters : [{'condition': 'OR', 'filters': filters}];\n return [{'condition': 'OR', 'filters': filters}];\n },", "label": 1, "label_name": "safe"} +{"code": "return function(g,e){var a=g.uiColor,a={id:\".\"+g.id,defaultBorder:b(a,-0.1),defaultGradient:c(b(a,0.9),a),lightGradient:c(b(a,1),b(a,0.7)),mediumGradient:c(b(a,0.8),b(a,0.5)),ckeButtonOn:c(b(a,0.6),b(a,0.7)),ckeResizer:b(a,-0.4),ckeToolbarSeparator:b(a,0.5),ckeColorauto:b(a,0.8),dialogBody:b(a,0.7),dialogTabSelected:c(\"#FFFFFF\",\"#FFFFFF\"),dialogTabSelectedBorder:\"#FFF\",elementsPathColor:b(a,-0.6),elementsPathBg:a,menubuttonIcon:b(a,0.5),menubuttonIconHover:b(a,0.3)};return f[e].output(a).replace(/\\[/g,", "label": 1, "label_name": "safe"} +{"code": " private function getCategory()\n {\n $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));\n\n if (empty($category)) {\n throw new PageNotFoundException();\n }\n\n return $category;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "m.style.top=e+\"px\";m.style.left=g+\"px\";m.style.width=Math.max(0,q-3)+\"px\";m.style.height=Math.max(0,k-3)+\"px\";null!=c&&c.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(m):document.body.appendChild(m);return m};EditorUi.prototype.stringToCells=function(c){c=mxUtils.parseXml(c);var e=this.editor.extractGraphModel(c.documentElement);c=[];if(null!=e){var g=new mxCodec(e.ownerDocument),k=new mxGraphModel;g.decode(e,k);e=k.getChildAt(k.getRoot(),0);for(g=0;gblacklist as $blacklisted_host_fragment) {\n if (strpos($uri->host, $blacklisted_host_fragment) !== false) {\n return false;\n }\n }\n return true;\n }", "label": 1, "label_name": "safe"} +{"code": "main(void)\n{\n\t/* exec sql begin declare section */\n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\n#line 52 \"dt_test2.pgc\"\n date date1 ;\n \n#line 53 \"dt_test2.pgc\"\n timestamp ts1 , ts2 ;\n \n#line 54 \"dt_test2.pgc\"\n char * text ;\n \n#line 55 \"dt_test2.pgc\"\n interval * i1 ;\n \n#line 56 \"dt_test2.pgc\"\n date * dc ;\n/* exec sql end declare section */\n#line 57 \"dt_test2.pgc\"\n\n\n\tint i, j;\n\tchar *endptr;\n\n\tECPGdebug(1, stderr);\n\n\tts1 = PGTYPEStimestamp_from_asc(\"2003-12-04 17:34:29\", NULL);\n\ttext = PGTYPEStimestamp_to_asc(ts1);\n\n\tprintf(\"timestamp: %s\\n\", text);\n\tfree(text);\n\n\tdate1 = PGTYPESdate_from_timestamp(ts1);\n\tdc = PGTYPESdate_new();\n\t*dc = date1;\n\ttext = PGTYPESdate_to_asc(*dc);\n\tprintf(\"Date of timestamp: %s\\n\", text);\n\tfree(text);\n\tPGTYPESdate_free(dc);\n\n\tfor (i = 0; dates[i]; i++)\n\t{\n\t\tbool err = false;\n\t\tdate1 = PGTYPESdate_from_asc(dates[i], &endptr);\n\t\tif (date1 == INT_MIN) {\n\t\t\terr = true;\n\t\t}\n\t\ttext = PGTYPESdate_to_asc(date1);\n\t\tprintf(\"Date[%d]: %s (%c - %c)\\n\",\n\t\t\t\t\ti, err ? \"-\" : text,\n\t\t\t\t\tendptr ? 'N' : 'Y',\n\t\t\t\t\terr ? 'T' : 'F');\n\t\tfree(text);\n\t\tif (!err)\n\t\t{\n\t\t\tfor (j = 0; times[j]; j++)\n\t\t\t{\n\t\t\t\tint length = strlen(dates[i])\n\t\t\t\t\t\t+ 1\n\t\t\t\t\t\t+ strlen(times[j])\n\t\t\t\t\t\t+ 1;\n\t\t\t\tchar* t = malloc(length);\n\t\t\t\tsprintf(t, \"%s %s\", dates[i], times[j]);\n\t\t\t\tts1 = PGTYPEStimestamp_from_asc(t, NULL);\n\t\t\t\ttext = PGTYPEStimestamp_to_asc(ts1);\n\t\t\t\tif (i != 19 || j != 3) /* timestamp as integer or double differ for this case */\n\t\t\t\t\tprintf(\"TS[%d,%d]: %s\\n\",\n\t\t\t\t\t\ti, j, errno ? \"-\" : text);\n\t\t\t\tfree(text);\n\t\t\t\tfree(t);\n\t\t\t}\n\t\t}\n\t}\n\n\tts1 = PGTYPEStimestamp_from_asc(\"2004-04-04 23:23:23\", NULL);\n\n\tfor (i = 0; intervals[i]; i++)\n\t{\n\t\tinterval *ic;\n\t\ti1 = PGTYPESinterval_from_asc(intervals[i], &endptr);\n\t\tif (*endptr)\n\t\t\tprintf(\"endptr set to %s\\n\", endptr);\n\t\tif (!i1)\n\t\t{\n\t\t\tprintf(\"Error parsing interval %d\\n\", i);\n\t\t\tcontinue;\n\t\t}\n\t\tj = PGTYPEStimestamp_add_interval(&ts1, i1, &ts2);\n\t\tif (j < 0)\n\t\t\tcontinue;\n\t\ttext = PGTYPESinterval_to_asc(i1);\n\t\tprintf(\"interval[%d]: %s\\n\", i, text ? text : \"-\");\n\t\tfree(text);\n\n\t\tic = PGTYPESinterval_new();\n\t\tPGTYPESinterval_copy(i1, ic);\n\t\ttext = PGTYPESinterval_to_asc(i1);\n\t\tprintf(\"interval_copy[%d]: %s\\n\", i, text ? text : \"-\");\n\t\tfree(text);\n\t\tPGTYPESinterval_free(ic);\n\t\tPGTYPESinterval_free(i1);\n\t}\n\n\treturn (0);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "E=J}return E};Graph.prototype.getCellsById=function(u){var E=[];if(null!=u)for(var J=0;JassertPresent($path);\n $this->assertAbsent($newpath);\n\n return (bool) $this->getAdapter()->rename($path, $newpath);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "(new mxCodec(p.ownerDocument)).decode(p)}return this.defaultStylesheet};Graph.prototype.isViewer=function(){return urlParams.viewer};var K=Graph.prototype.getSvg;Graph.prototype.getSvg=function(p,C,I,T,P,O,R,Y,da,ha,Z,ea,aa,ua){var la=null,Aa=null,Fa=null;ea||null==this.themes||\"darkTheme\"!=this.defaultThemeName||(la=this.stylesheet,Aa=this.shapeForegroundColor,Fa=this.shapeBackgroundColor,this.shapeForegroundColor=\"darkTheme\"==this.defaultThemeName?\"#000000\":Editor.lightColor,this.shapeBackgroundColor=\n\"darkTheme\"==this.defaultThemeName?\"#ffffff\":Editor.darkColor,this.stylesheet=this.getDefaultStylesheet(),this.refresh());var xa=K.apply(this,arguments),Da=this.getCustomFonts();if(Z&&0findBy('calculator_name', $s);\n $paymentQuery = 'billingcalculator_id = ' . $calc->id;\n }\n\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND ( \" . $paymentQuery;\n } else {\n $sqltmp .= \" OR \" . $paymentQuery;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }\n\n //echo $sql . $sqlwhere . \"
\";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products\n [date-startdate] => \n [time-h-startdate] => \n [time-m-startdate] => \n [ampm-startdate] => am\n [date-enddate] => \n [time-h-enddate] => \n [time-m-enddate] => \n [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )\n\n [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )\n\n [order-range-op] => e\n [order-range-num] => \n [order-price-op] => l\n [order-price-num] => \n [pnam] => \n [sku] => \n [discounts] => Array\n (\n [0] => -1\n )\n\n [blshpname] => \n [email] => \n [bl-sp-zip] => s\n [zip] => \n [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )\n\n [status] => Array\n (\n [0] => -1\n )\n\n )\n */\n\n //$sqlwhere .= \" ORDER BY purchased_date DESC\";\n $count_sql .= $sql . $sqlwhere;\n $sql = $start_sql . $sql;\n expSession::set('order_print_query', $sql . $sqlwhere);\n $reportRecords = $db->selectObjectsBySql($sql . $sqlwhere);\n expSession::set('order_export_values', $reportRecords);\n\n //eDebug(expSession::get('order_export_values'));\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();\n //$items = $prod->find('all', 1, 'id DESC',25); \n //$items = $order->find('all', 1, 'id DESC',25); \n //$res = $mod->find('all',$sql,'id',25);\n //eDebug($items);\n //eDebug($sql . $sqlwhere); \n\n $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'count_sql' => $count_sql,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status Changed Date') => 'status_changed_date',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n\n //strftime(\"%a %d-%m-%Y\", get_first_day(3, 1, 2007)); Thursday, 1 April 2010 \n //$d_month_previous = date('n', mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n\n $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV',\n 'export_status_report' => 'Export Order Status Data to CSV',\n 'export_inventory' => 'Export Inventory Data to CSV',\n 'export_user_input_report' => 'Export User Input Data to CSV',\n 'export_order_items' => 'Export Order Items Data to CSV',\n 'show_payment_summary' => 'Show Payment & Tax Summary'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tchangeclipboard : function() { this.update(); }", "label": 0, "label_name": "vulnerable"} +{"code": "d[c]=e,\"o\"===b[1]&&Y(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||Y(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))\"o\"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Fa(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&\"No data available in table\"===b.sEmptyTable)&&F(a,a,\"sZeroRecords\",\"sEmptyTable\");!a.sLoadingRecords&&(c&&\"Loading...\"===b.sLoadingRecords)&&F(a,a,\"sZeroRecords\",\"sLoadingRecords\");", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length)\n\t\t\tthrows ShortBufferException {\n\t\tint space;\n\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tencryptCTR(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\tghash.update(ciphertext, ciphertextOffset, length);\n\t\tghash.pad(ad != null ? ad.length : 0, length);\n\t\tghash.finish(ciphertext, ciphertextOffset + length, 16);\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\tciphertext[ciphertextOffset + length + index] ^= hashKey[index];\n\t\treturn length + 16;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)\n{\n int prev,i,j;\n // we use right&left (the start of the right- and left-window sin()-regions)\n // to determine how much to return, rather than inferring from the rules\n // (same result, clearer code); 'left' indicates where our sin() window\n // starts, therefore where the previous window's right edge starts, and\n // therefore where to start mixing from the previous buffer. 'right'\n // indicates where our sin() ending-window starts, therefore that's where\n // we start saving, and where our returned-data ends.\n\n // mixin from previous window\n if (f->previous_length) {\n int i,j, n = f->previous_length;\n float *w = get_window(f, n);\n if (w == NULL) return 0;\n for (i=0; i < f->channels; ++i) {\n for (j=0; j < n; ++j)\n f->channel_buffers[i][left+j] =\n f->channel_buffers[i][left+j]*w[ j] +\n f->previous_window[i][ j]*w[n-1-j];\n }\n }\n\n prev = f->previous_length;\n\n // last half of this data becomes previous window\n f->previous_length = len - right;\n\n // @OPTIMIZE: could avoid this copy by double-buffering the\n // output (flipping previous_window with channel_buffers), but\n // then previous_window would have to be 2x as large, and\n // channel_buffers couldn't be temp mem (although they're NOT\n // currently temp mem, they could be (unless we want to level\n // performance by spreading out the computation))\n for (i=0; i < f->channels; ++i)\n for (j=0; right+j < len; ++j)\n f->previous_window[i][j] = f->channel_buffers[i][right+j];\n\n if (!prev)\n // there was no previous packet, so this data isn't valid...\n // this isn't entirely true, only the would-have-overlapped data\n // isn't valid, but this seems to be what the spec requires\n return 0;\n\n // truncate a short frame\n if (len < right) right = len;\n\n f->samples_output += right-left;\n\n return right - left;\n}", "label": 1, "label_name": "safe"} +{"code": " def test_should_sanitize_illegal_style_properties\n raw = %(display:block; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1; background-color:black; background-image:url(http://www.ragingplatypus.com/i/cam-full.jpg); background-x:center; background-y:center; background-repeat:repeat;)\n expected = %(display:block;width:100%;height:100%;background-color:black;background-x:center;background-y:center;)\n assert_equal expected, sanitize_css(raw)\n end", "label": 1, "label_name": "safe"} +{"code": " public static Object instantiate(String classname, Properties info, boolean tryString,\n @Nullable String stringarg)\n throws ClassNotFoundException, SecurityException, NoSuchMethodException,\n IllegalArgumentException, InstantiationException, IllegalAccessException,\n InvocationTargetException {\n @Nullable Object[] args = {info};\n Constructor ctor = null;\n Class cls = Class.forName(classname);\n try {\n ctor = cls.getConstructor(Properties.class);\n } catch (NoSuchMethodException ignored) {\n }\n if (tryString && ctor == null) {\n try {\n ctor = cls.getConstructor(String.class);\n args = new String[]{stringarg};\n } catch (NoSuchMethodException ignored) {\n }\n }\n if (ctor == null) {\n ctor = cls.getConstructor();\n args = new Object[0];\n }\n return ctor.newInstance(args);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t\t\t\t.attr({href: '#', title: fm.i18n('getLink'), draggable: 'false'})\n\t\t\t\t\t\t\t.text(file.name)\n\t\t\t\t\t\t\t.on('click', function(e){\n\t\t\t\t\t\t\t\tvar parent = node.parent();\n\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tparent.removeClass('ui-state-disabled').addClass('elfinder-button-icon-spinner');\n\t\t\t\t\t\t\t\tfm.request({\n\t\t\t\t\t\t\t\t\tdata : {cmd : 'url', target : file.hash},\n\t\t\t\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.always(function(data) {\n\t\t\t\t\t\t\t\t\tparent.removeClass('elfinder-button-icon-spinner');\n\t\t\t\t\t\t\t\t\tif (data.url) {\n\t\t\t\t\t\t\t\t\t\tvar rfile = fm.file(file.hash);\n\t\t\t\t\t\t\t\t\t\trfile.url = data.url;\n\t\t\t\t\t\t\t\t\t\tnode.replaceWith(getExtra(file).node);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tparent.addClass('ui-state-disabled');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t})\n\t\t\t\t\t};\n\t\t\t\t\tnode = self.extra.node;\n\t\t\t\t\tnode.ready(function(){\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\tnode.parent().addClass('ui-state-disabled').css('pointer-events', 'auto');\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": " var record_messages = function (msg, opts) {\n console.log(\"HTML Sanitizer\", msg, opts);\n };", "label": 0, "label_name": "vulnerable"} +{"code": "int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message, uint64_t msgLen) {\n\n if (!message) {\n LOG_ERROR(\"Null message in AES_encrypt\");\n return -1;\n }\n\n if (!encr_message) {\n LOG_ERROR(\"Null encr message in AES_encrypt\");\n return -2;\n }\n\n\n if (length < SGX_AESGCM_MAC_SIZE + SGX_AESGCM_IV_SIZE) {\n LOG_ERROR(\"length < SGX_AESGCM_MAC_SIZE - SGX_AESGCM_IV_SIZE\");\n return -1;\n }\n\n\n\n uint64_t len = length - SGX_AESGCM_MAC_SIZE - SGX_AESGCM_IV_SIZE;\n\n if (msgLen < len) {\n LOG_ERROR(\"Output buffer not large enough\");\n return -2;\n }\n\n sgx_status_t status = sgx_rijndael128GCM_decrypt(&AES_key,\n encr_message + SGX_AESGCM_MAC_SIZE + SGX_AESGCM_IV_SIZE, len,\n (unsigned char*) message,\n encr_message + SGX_AESGCM_MAC_SIZE, SGX_AESGCM_IV_SIZE,\n NULL, 0,\n (sgx_aes_gcm_128bit_tag_t *)encr_message);\n\n return status;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tgetHasOwnProperty: function(element, property) {\n\t\tvar key = element + \".\" + property;\n\t\tvar own = this.current().own;\n\t\tif (!own.hasOwnProperty(key)) {\n\t\t\town[key] = this.nextId(\n\t\t\t\tfalse,\n\t\t\t\telement + \"&&(\" + this.escape(property) + \" in \" + element + \")\"\n\t\t\t);\n\t\t}\n\t\treturn own[key];\n\t},", "label": 1, "label_name": "safe"} +{"code": " async def act(self, ctx: commands.Context, *, target: Union[discord.Member, str] = None):\r\n \"\"\"\r\n Acts on the specified user.\r\n \"\"\"\r\n if not target or isinstance(target, str):\r\n return # no help text\r\n\r\n try:\r\n if not ctx.guild:\r\n raise KeyError()\r\n message = await self.config.guild(ctx.guild).get_raw(\"custom\", ctx.invoked_with)\r\n except KeyError:\r\n try:\r\n message = await self.config.get_raw(\"custom\", ctx.invoked_with)\r\n except KeyError:\r\n message = NotImplemented\r\n\r\n if message is None: # ignored command\r\n return\r\n elif message is NotImplemented: # default\r\n # humanize action text\r\n action = inflection.humanize(ctx.invoked_with).split()\r\n iverb = -1\r\n\r\n for cycle in range(2):\r\n if iverb > -1:\r\n break\r\n for i, act in enumerate(action):\r\n act = act.lower()\r\n if (\r\n act in NOLY_ADV\r\n or act in CONJ\r\n or (act.endswith(\"ly\") and act not in LY_VERBS)\r\n or (not cycle and act in SOFT_VERBS)\r\n ):\r\n continue\r\n action[i] = inflection.pluralize(action[i])\r\n iverb = max(iverb, i)\r\n\r\n if iverb < 0:\r\n return\r\n action.insert(iverb + 1, target.mention)\r\n message = italics(\" \".join(action))\r\n else:\r\n assert isinstance(message, str)\r\n message = fmt_re.sub(functools.partial(self.repl, target), message)\r\n\r\n # add reaction gif\r\n if self.try_after and ctx.message.created_at < self.try_after:\r\n return await ctx.send(message)\r\n if not await ctx.embed_requested():\r\n return await ctx.send(message)\r\n key = (await ctx.bot.get_shared_api_tokens(\"tenor\")).get(\"api_key\")\r\n if not key:\r\n return await ctx.send(message)\r\n async with aiohttp.request(\r\n \"GET\",\r\n \"https://api.tenor.com/v1/search\",\r\n params={\r\n \"q\": ctx.invoked_with,\r\n \"key\": key,\r\n \"anon_id\": str(ctx.author.id ^ ctx.me.id),\r\n \"media_filter\": \"minimal\",\r\n \"contentfilter\": \"off\" if getattr(ctx.channel, \"nsfw\", False) else \"low\",\r\n \"ar_range\": \"wide\",\r\n \"limit\": \"8\",\r\n \"locale\": get_locale(),\r\n },\r\n ) as response:\r\n json: dict\r\n if response.status == 429:\r\n self.try_after = ctx.message.created_at + 30\r\n json = {}\r\n elif response.status >= 400:\r\n json = {}\r\n else:\r\n json = await response.json()\r\n if not json.get(\"results\"):\r\n return await ctx.send(message)\r\n message = f\"{message}\\n\\n{random.choice(json['results'])['itemurl']}\"\r\n await ctx.send(\r\n message,\r\n allowed_mentions=discord.AllowedMentions(\r\n users=False if target in ctx.message.mentions else [target]\r\n ),\r\n )\r", "label": 1, "label_name": "safe"} +{"code": " it \"should reject a non-critical extension that isn't on the whitelist\" do\n @request.stubs(:request_extensions).returns [{ \"oid\" => \"peach\",\n \"value\" => \"meh\",\n \"critical\" => false }]\n expect { @ca.sign(@name) }.to raise_error(\n Puppet::SSL::CertificateAuthority::CertificateSigningError,\n /request extensions that are not permitted/\n )\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testNull() {\n $context = new HTMLPurifier_Context();\n $var = NULL;\n $context->register('var', $var);\n $this->assertNull($context->get('var'));\n $context->destroy('var');\n }", "label": 1, "label_name": "safe"} +{"code": "void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)\n{\n\tunsigned long pc = regs->tpc;\n\tunsigned long tstate = regs->tstate;\n\tu32 insn;\n\tu64 value;\n\tu8 freg;\n\tint flag;\n\tstruct fpustate *f = FPUSTATE;\n\n\tif (tstate & TSTATE_PRIV)\n\t\tdie_if_kernel(\"lddfmna from kernel\", regs);\n\tperf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, sfar);\n\tif (test_thread_flag(TIF_32BIT))\n\t\tpc = (u32)pc;\n\tif (get_user(insn, (u32 __user *) pc) != -EFAULT) {\n\t\tint asi = decode_asi(insn, regs);\n\t\tu32 first, second;\n\t\tint err;\n\n\t\tif ((asi > ASI_SNFL) ||\n\t\t (asi < ASI_P))\n\t\t\tgoto daex;\n\t\tfirst = second = 0;\n\t\terr = get_user(first, (u32 __user *)sfar);\n\t\tif (!err)\n\t\t\terr = get_user(second, (u32 __user *)(sfar + 4));\n\t\tif (err) {\n\t\t\tif (!(asi & 0x2))\n\t\t\t\tgoto daex;\n\t\t\tfirst = second = 0;\n\t\t}\n\t\tsave_and_clear_fpu();\n\t\tfreg = ((insn >> 25) & 0x1e) | ((insn >> 20) & 0x20);\n\t\tvalue = (((u64)first) << 32) | second;\n\t\tif (asi & 0x8) /* Little */\n\t\t\tvalue = __swab64p(&value);\n\t\tflag = (freg < 32) ? FPRS_DL : FPRS_DU;\n\t\tif (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) {\n\t\t\tcurrent_thread_info()->fpsaved[0] = FPRS_FEF;\n\t\t\tcurrent_thread_info()->gsr[0] = 0;\n\t\t}\n\t\tif (!(current_thread_info()->fpsaved[0] & flag)) {\n\t\t\tif (freg < 32)\n\t\t\t\tmemset(f->regs, 0, 32*sizeof(u32));\n\t\t\telse\n\t\t\t\tmemset(f->regs+32, 0, 32*sizeof(u32));\n\t\t}\n\t\t*(u64 *)(f->regs + freg) = value;\n\t\tcurrent_thread_info()->fpsaved[0] |= flag;\n\t} else {\ndaex:\n\t\tif (tlb_type == hypervisor)\n\t\t\tsun4v_data_access_exception(regs, sfar, sfsr);\n\t\telse\n\t\t\tspitfire_data_access_exception(regs, sfsr, sfar);\n\t\treturn;\n\t}\n\tadvance(regs);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function testCanLoadRegisteredAjaxView() {\n\t\t$request = $this->prepareHttpRequest('ajax/view/ajax_test/registered', 'GET', [], 1);\n\t\t\n\t\t$response = $this->executeRequest($request);\n\t\t$this->assertInstanceOf(\\Elgg\\Http\\OkResponse::class, $response);\n\t\t$this->assertEquals('registered', $response->getContent());\n\t}", "label": 1, "label_name": "safe"} +{"code": "function(){b.hideDialog(!0)});f.className=\"geBtn\";d=null!=d?mxUtils.button(mxResources.get(\"ignore\"),d):null;null!=d&&(d.className=\"geBtn\");b.editor.cancelFirst?(y.appendChild(f),null!=d&&y.appendChild(d),y.appendChild(v),y.appendChild(n)):(y.appendChild(n),y.appendChild(v),null!=d&&y.appendChild(d),y.appendChild(f));k.appendChild(y);k.appendChild(A);this.container=k},FindWindow=function(b,e,f,c,m,n){function v(U,X,u,D){if(\"object\"===typeof X.value&&null!=X.value.attributes){X=X.value.attributes;\nfor(var K=0;K rsMode = r\n case _ => sys.error(\"Invalid output config packet %s to config %s\".format(m, this))\n }\n\n}", "label": 1, "label_name": "safe"} +{"code": " public function testUnclosedTags()\n {\n $code = '[b]bold';\n $codeOutput = '[b]bold[/b]';\n $this->assertBBCodeOutput($code, $codeOutput);\n }", "label": 1, "label_name": "safe"} +{"code": " function quickfinder() {\n global $db;\n\n $search = $this->params['ordernum'];\n $searchInv = intval($search);\n\n $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";\n\n $sqlwhere = \"WHERE o.purchased != 0\";\n if ($searchInv != 0) $sqlwhere .= \" AND (o.invoice_id LIKE '%\" . $searchInv . \"%' OR\";\n else $sqlwhere .= \" AND (\";\n $sqlwhere .= \" b.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.email LIKE '%\" . $search . \"%')\";\n\n $limit = empty($this->config['limit']) ? 350 : $this->config['limit'];\n //eDebug($sql . $sqlwhere) ;\n $page = new expPaginator(array(\n 'sql' => $sql . $sqlwhere,\n 'limit' => $limit,\n 'order' => 'o.invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date')=> 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'term'=> $search\n ));\n\n //eDebug($this->params);\n /*$o = new order();\n $b = new billingmethod();\n $s = new shippingmethod();\n \n $search = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $orders = $o->find('all',\"invoice_id LIKE '%\".$oid.\"%'\");\n if(count($orders == 1))\n {\n redirect_to(array('controller'=>'order','action'=>'show','id'=>$order[0]->id)); \n }\n else\n {\n flashAndFlow('message',\"Orders containing \" . $search . \" in the order number not found.\");\n }\n }\n else\n {\n //lookup just a customer\n $bms = $b->find('all', )\n }*/\n /*$o = new order();\n $oid = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $order = $o->find('first','invoice_id='.$oid);\n if(!empty($order->id))\n {\n redirect_to(array('controller'=>'order','action'=>'show','id'=>$order->id)); \n }\n else\n {\n flashAndFlow('message',\"Order #\" . intval($this->params['ordernum']) . \" not found.\");\n }\n }\n else\n {\n flashAndFlow('message','Invalid order number.'); \n }*/\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def CreateID(self):\n \"\"\"Create a packet ID. All RADIUS requests have a ID which is used to\n identify a request. This is used to detect retries and replay attacks.\n This function returns a suitable random number that can be used as ID.\n\n :return: ID number\n :rtype: integer\n\n \"\"\"\n return random_generator.randrange(0, 256)", "label": 1, "label_name": "safe"} +{"code": "function(K){var F=x.length;if(1===F%2||F>=f){var H=0,S=0,V,M=0;for(V=K;Vupdate($this);\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private function _pLookAhead() {\n $this->current($i, $current);\n if ($current instanceof HTMLPurifier_Token_Start) $nesting = 1;\n else $nesting = 0;\n $ok = false;\n while ($this->forwardUntilEndToken($i, $current, $nesting)) {\n $result = $this->_checkNeedsP($current);\n if ($result !== null) {\n $ok = $result;\n break;\n }\n }\n return $ok;\n }", "label": 1, "label_name": "safe"} +{"code": " public function handleRequest() {\n /* Load error handling class */\n $this->loadErrorHandler();\n\n $this->modx->invokeEvent('OnHandleRequest');\n\n /* save page to manager object. allow custom actionVar choice for extending classes. */\n $this->action = isset($_REQUEST[$this->actionVar]) ? $_REQUEST[$this->actionVar] : $this->defaultAction;\n\n /* invoke OnManagerPageInit event */\n $this->modx->invokeEvent('OnManagerPageInit',array('action' => $this->action));\n $this->prepareResponse();\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def primary?\n !!@primary\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\tfunction formatValue( $name, $value ) {\n\t\t$row = $this->mCurrentRow;\n\n\t\tswitch ( $name ) {\n\t\t\tcase 'files_timestamp':\n\t\t\t\t$formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $row->files_timestamp, $this->getUser() ) );\n\t\t\t\tbreak;\n\t\t\tcase 'files_dbname':\n\t\t\t\t$formatted = $row->files_dbname;\n\t\t\t\tbreak;\n\t\t\tcase 'files_url':\n\t\t\t\t$formatted = Html::element(\n\t\t\t\t\t'img',\n\t\t\t\t\t[\n\t\t\t\t\t\t'src' => $row->files_url,\n\t\t\t\t\t\t'style' => 'width: 135px; height: 135px;'\n\t\t\t\t\t]\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase 'files_name':\n\t\t\t\t$formatted = Html::element(\n\t\t\t\t\t'a',\n\t\t\t\t\t[\n\t\t\t\t\t\t'href' => $row->files_page,\n\t\t\t\t\t],\n\t\t\t\t\t$row->files_name\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\tcase 'files_user':\n\t\t\t\t$formatted = $this->linkRenderer->makeLink(\n\t\t\t\t\tSpecialPage::getTitleFor( 'CentralAuth', $row->files_user ),\n\t\t\t\t\t$row->files_user\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$formatted = \"Unable to format $name\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn $formatted;\n\t}", "label": 1, "label_name": "safe"} +{"code": "\t\t([ key, value ]) => ({ [key]: async () => (await spawn(value)).split('\\n') }),", "label": 1, "label_name": "safe"} +{"code": " public function confirm()\n {\n $project = $this->getProject();\n $category = $this->getCategory($project);\n\n $this->response->html($this->helper->layout->project('category/remove', array(\n 'project' => $project,\n 'category' => $category,\n )));\n }", "label": 1, "label_name": "safe"} +{"code": " def latest?\n debug \"Checking for updates because 'ensure => latest'\"\n at_path do\n # We cannot use -P to prune empty dirs, otherwise\n # CVS would report those as \"missing\", regardless\n # if they have contents or updates.\n is_current = (runcvs('-nq', 'update', '-d').strip == \"\")\n if (!is_current) then debug \"There are updates available on the checkout's current branch/tag.\" end\n return is_current\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "if(null!=X&&0 0xFFFF)\n\t\tgoto out;\n\n\t/*\n\t *\tCheck the flags.\n\t */\n\n\terr = -EOPNOTSUPP;\n\tif (msg->msg_flags & MSG_OOB)\t/* Mirror BSD error message */\n\t\tgoto out; /* compatibility */\n\n\t/*\n\t *\tGet and verify the address.\n\t */\n\n\tif (msg->msg_namelen) {\n\t\tDECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name);\n\t\terr = -EINVAL;\n\t\tif (msg->msg_namelen < sizeof(*usin))\n\t\t\tgoto out;\n\t\tif (usin->sin_family != AF_INET) {\n\t\t\tpr_info_once(\"%s: %s forgot to set AF_INET. Fix it!\\n\",\n\t\t\t\t __func__, current->comm);\n\t\t\terr = -EAFNOSUPPORT;\n\t\t\tif (usin->sin_family)\n\t\t\t\tgoto out;\n\t\t}\n\t\tdaddr = usin->sin_addr.s_addr;\n\t\t/* ANK: I did not forget to get protocol from port field.\n\t\t * I just do not know, who uses this weirdness.\n\t\t * IP_HDRINCL is much more convenient.\n\t\t */\n\t} else {\n\t\terr = -EDESTADDRREQ;\n\t\tif (sk->sk_state != TCP_ESTABLISHED)\n\t\t\tgoto out;\n\t\tdaddr = inet->inet_daddr;\n\t}\n\n\tipc.sockc.tsflags = sk->sk_tsflags;\n\tipc.addr = inet->inet_saddr;\n\tipc.opt = NULL;\n\tipc.tx_flags = 0;\n\tipc.ttl = 0;\n\tipc.tos = -1;\n\tipc.oif = sk->sk_bound_dev_if;\n\n\tif (msg->msg_controllen) {\n\t\terr = ip_cmsg_send(sk, msg, &ipc, false);\n\t\tif (unlikely(err)) {\n\t\t\tkfree(ipc.opt);\n\t\t\tgoto out;\n\t\t}\n\t\tif (ipc.opt)\n\t\t\tfree = 1;\n\t}\n\n\tsaddr = ipc.addr;\n\tipc.addr = daddr;\n\n\tif (!ipc.opt) {\n\t\tstruct ip_options_rcu *inet_opt;\n\n\t\trcu_read_lock();\n\t\tinet_opt = rcu_dereference(inet->inet_opt);\n\t\tif (inet_opt) {\n\t\t\tmemcpy(&opt_copy, inet_opt,\n\t\t\t sizeof(*inet_opt) + inet_opt->opt.optlen);\n\t\t\tipc.opt = &opt_copy.opt;\n\t\t}\n\t\trcu_read_unlock();\n\t}\n\n\tif (ipc.opt) {\n\t\terr = -EINVAL;\n\t\t/* Linux does not mangle headers on raw sockets,\n\t\t * so that IP options + IP_HDRINCL is non-sense.\n\t\t */\n\t\tif (inet->hdrincl)\n\t\t\tgoto done;\n\t\tif (ipc.opt->opt.srr) {\n\t\t\tif (!daddr)\n\t\t\t\tgoto done;\n\t\t\tdaddr = ipc.opt->opt.faddr;\n\t\t}\n\t}\n\ttos = get_rtconn_flags(&ipc, sk);\n\tif (msg->msg_flags & MSG_DONTROUTE)\n\t\ttos |= RTO_ONLINK;\n\n\tif (ipv4_is_multicast(daddr)) {\n\t\tif (!ipc.oif)\n\t\t\tipc.oif = inet->mc_index;\n\t\tif (!saddr)\n\t\t\tsaddr = inet->mc_addr;\n\t} else if (!ipc.oif)\n\t\tipc.oif = inet->uc_index;\n\n\tflowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,\n\t\t\t RT_SCOPE_UNIVERSE,\n\t\t\t inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,\n\t\t\t inet_sk_flowi_flags(sk) |\n\t\t\t (inet->hdrincl ? FLOWI_FLAG_KNOWN_NH : 0),\n\t\t\t daddr, saddr, 0, 0, sk->sk_uid);\n\n\tif (!inet->hdrincl) {\n\t\trfv.msg = msg;\n\t\trfv.hlen = 0;\n\n\t\terr = raw_probe_proto_opt(&rfv, &fl4);\n\t\tif (err)\n\t\t\tgoto done;\n\t}\n\n\tsecurity_sk_classify_flow(sk, flowi4_to_flowi(&fl4));\n\trt = ip_route_output_flow(net, &fl4, sk);\n\tif (IS_ERR(rt)) {\n\t\terr = PTR_ERR(rt);\n\t\trt = NULL;\n\t\tgoto done;\n\t}\n\n\terr = -EACCES;\n\tif (rt->rt_flags & RTCF_BROADCAST && !sock_flag(sk, SOCK_BROADCAST))\n\t\tgoto done;\n\n\tif (msg->msg_flags & MSG_CONFIRM)\n\t\tgoto do_confirm;\nback_from_confirm:\n\n\tif (inet->hdrincl)\n\t\terr = raw_send_hdrinc(sk, &fl4, msg, len,\n\t\t\t\t &rt, msg->msg_flags, &ipc.sockc);\n\n\t else {\n\t\tsock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);\n\n\t\tif (!ipc.addr)\n\t\t\tipc.addr = fl4.daddr;\n\t\tlock_sock(sk);\n\t\terr = ip_append_data(sk, &fl4, raw_getfrag,\n\t\t\t\t &rfv, len, 0,\n\t\t\t\t &ipc, &rt, msg->msg_flags);\n\t\tif (err)\n\t\t\tip_flush_pending_frames(sk);\n\t\telse if (!(msg->msg_flags & MSG_MORE)) {\n\t\t\terr = ip_push_pending_frames(sk, &fl4);\n\t\t\tif (err == -ENOBUFS && !inet->recverr)\n\t\t\t\terr = 0;\n\t\t}\n\t\trelease_sock(sk);\n\t}\ndone:\n\tif (free)\n\t\tkfree(ipc.opt);\n\tip_rt_put(rt);\n\nout:\n\tif (err < 0)\n\t\treturn err;\n\treturn len;\n\ndo_confirm:\n\tif (msg->msg_flags & MSG_PROBE)\n\t\tdst_confirm_neigh(&rt->dst, &fl4.daddr);\n\tif (!(msg->msg_flags & MSG_PROBE) || len)\n\t\tgoto back_from_confirm;\n\terr = 0;\n\tgoto done;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "zephyr_print(netdissect_options *ndo, const u_char *cp, int length)\n{\n struct z_packet z;\n const char *parse = (const char *) cp;\n int parselen = length;\n const char *s;\n int lose = 0;\n int truncated = 0;\n\n /* squelch compiler warnings */\n\n z.kind = 0;\n z.class = 0;\n z.inst = 0;\n z.opcode = 0;\n z.sender = 0;\n z.recipient = 0;\n\n#define PARSE_STRING\t\t\t\t\t\t\\\n\ts = parse_field(ndo, &parse, &parselen, &truncated);\t\\\n\tif (truncated) goto trunc;\t\t\t\t\\\n\tif (!s) lose = 1;\n\n#define PARSE_FIELD_INT(field)\t\t\t\\\n\tPARSE_STRING\t\t\t\t\\\n\tif (!lose) field = strtol(s, 0, 16);\n\n#define PARSE_FIELD_STR(field)\t\t\t\\\n\tPARSE_STRING\t\t\t\t\\\n\tif (!lose) field = s;\n\n PARSE_FIELD_STR(z.version);\n if (lose) return;\n if (strncmp(z.version, \"ZEPH\", 4))\n\treturn;\n\n PARSE_FIELD_INT(z.numfields);\n PARSE_FIELD_INT(z.kind);\n PARSE_FIELD_STR(z.uid);\n PARSE_FIELD_INT(z.port);\n PARSE_FIELD_INT(z.auth);\n PARSE_FIELD_INT(z.authlen);\n PARSE_FIELD_STR(z.authdata);\n PARSE_FIELD_STR(z.class);\n PARSE_FIELD_STR(z.inst);\n PARSE_FIELD_STR(z.opcode);\n PARSE_FIELD_STR(z.sender);\n PARSE_FIELD_STR(z.recipient);\n PARSE_FIELD_STR(z.format);\n PARSE_FIELD_INT(z.cksum);\n PARSE_FIELD_INT(z.multi);\n PARSE_FIELD_STR(z.multi_uid);\n\n if (lose)\n goto trunc;\n\n ND_PRINT((ndo, \" zephyr\"));\n if (strncmp(z.version+4, \"0.2\", 3)) {\n\tND_PRINT((ndo, \" v%s\", z.version+4));\n\treturn;\n }\n\n ND_PRINT((ndo, \" %s\", tok2str(z_types, \"type %d\", z.kind)));\n if (z.kind == Z_PACKET_SERVACK) {\n\t/* Initialization to silence warnings */\n\tconst char *ackdata = NULL;\n\tPARSE_FIELD_STR(ackdata);\n\tif (!lose && strcmp(ackdata, \"SENT\"))\n\t ND_PRINT((ndo, \"/%s\", str_to_lower(ackdata)));\n }\n if (*z.sender) ND_PRINT((ndo, \" %s\", z.sender));\n\n if (!strcmp(z.class, \"USER_LOCATE\")) {\n\tif (!strcmp(z.opcode, \"USER_HIDE\"))\n\t ND_PRINT((ndo, \" hide\"));\n\telse if (!strcmp(z.opcode, \"USER_UNHIDE\"))\n\t ND_PRINT((ndo, \" unhide\"));\n\telse\n\t ND_PRINT((ndo, \" locate %s\", z.inst));\n\treturn;\n }\n\n if (!strcmp(z.class, \"ZEPHYR_ADMIN\")) {\n\tND_PRINT((ndo, \" zephyr-admin %s\", str_to_lower(z.opcode)));\n\treturn;\n }\n\n if (!strcmp(z.class, \"ZEPHYR_CTL\")) {\n\tif (!strcmp(z.inst, \"CLIENT\")) {\n\t if (!strcmp(z.opcode, \"SUBSCRIBE\") ||\n\t\t!strcmp(z.opcode, \"SUBSCRIBE_NODEFS\") ||\n\t\t!strcmp(z.opcode, \"UNSUBSCRIBE\")) {\n\n\t\tND_PRINT((ndo, \" %ssub%s\", strcmp(z.opcode, \"SUBSCRIBE\") ? \"un\" : \"\",\n\t\t\t\t strcmp(z.opcode, \"SUBSCRIBE_NODEFS\") ? \"\" :\n\t\t\t\t\t\t\t\t \"-nodefs\"));\n\t\tif (z.kind != Z_PACKET_SERVACK) {\n\t\t /* Initialization to silence warnings */\n\t\t const char *c = NULL, *i = NULL, *r = NULL;\n\t\t PARSE_FIELD_STR(c);\n\t\t PARSE_FIELD_STR(i);\n\t\t PARSE_FIELD_STR(r);\n\t\t if (!lose) ND_PRINT((ndo, \" %s\", z_triple(c, i, r)));\n\t\t}\n\t\treturn;\n\t }\n\n\t if (!strcmp(z.opcode, \"GIMME\")) {\n\t\tND_PRINT((ndo, \" ret\"));\n\t\treturn;\n\t }\n\n\t if (!strcmp(z.opcode, \"GIMMEDEFS\")) {\n\t\tND_PRINT((ndo, \" gimme-defs\"));\n\t\treturn;\n\t }\n\n\t if (!strcmp(z.opcode, \"CLEARSUB\")) {\n\t\tND_PRINT((ndo, \" clear-subs\"));\n\t\treturn;\n\t }\n\n\t ND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\t return;\n\t}\n\n\tif (!strcmp(z.inst, \"HM\")) {\n\t ND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\t return;\n\t}\n\n\tif (!strcmp(z.inst, \"REALM\")) {\n\t if (!strcmp(z.opcode, \"ADD_SUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm add-subs\"));\n\t if (!strcmp(z.opcode, \"REQ_SUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm req-subs\"));\n\t if (!strcmp(z.opcode, \"RLM_SUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm rlm-sub\"));\n\t if (!strcmp(z.opcode, \"RLM_UNSUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm rlm-unsub\"));\n\t return;\n\t}\n }\n\n if (!strcmp(z.class, \"HM_CTL\")) {\n\tND_PRINT((ndo, \" hm_ctl %s\", str_to_lower(z.inst)));\n\tND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\treturn;\n }\n\n if (!strcmp(z.class, \"HM_STAT\")) {\n\tif (!strcmp(z.inst, \"HMST_CLIENT\") && !strcmp(z.opcode, \"GIMMESTATS\")) {\n\t ND_PRINT((ndo, \" get-client-stats\"));\n\t return;\n\t}\n }\n\n if (!strcmp(z.class, \"WG_CTL\")) {\n\tND_PRINT((ndo, \" wg_ctl %s\", str_to_lower(z.inst)));\n\tND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\treturn;\n }\n\n if (!strcmp(z.class, \"LOGIN\")) {\n\tif (!strcmp(z.opcode, \"USER_FLUSH\")) {\n\t ND_PRINT((ndo, \" flush_locs\"));\n\t return;\n\t}\n\n\tif (!strcmp(z.opcode, \"NONE\") ||\n\t !strcmp(z.opcode, \"OPSTAFF\") ||\n\t !strcmp(z.opcode, \"REALM-VISIBLE\") ||\n\t !strcmp(z.opcode, \"REALM-ANNOUNCED\") ||\n\t !strcmp(z.opcode, \"NET-VISIBLE\") ||\n\t !strcmp(z.opcode, \"NET-ANNOUNCED\")) {\n\t ND_PRINT((ndo, \" set-exposure %s\", str_to_lower(z.opcode)));\n\t return;\n\t}\n }\n\n if (!*z.recipient)\n\tz.recipient = \"*\";\n\n ND_PRINT((ndo, \" to %s\", z_triple(z.class, z.inst, z.recipient)));\n if (*z.opcode)\n\tND_PRINT((ndo, \" op %s\", z.opcode));\n return;\n\ntrunc:\n ND_PRINT((ndo, \" [|zephyr] (%d)\", length));\n return;\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct($definition, $parent = null)\n {\n $parent = $parent ? $parent : $definition->defaultPlist;\n $this->plist = new HTMLPurifier_PropertyList($parent);\n $this->def = $definition; // keep a copy around for checking\n $this->parser = new HTMLPurifier_VarParser_Flexible();\n }", "label": 1, "label_name": "safe"} +{"code": " public void testExposedCiphertext() throws Exception {\n boolean saveEnabled = Item.EXTENDED_READ.getEnabled();\n try {\n jenkins.setSecurityRealm(createDummySecurityRealm());\n // TODO 1.645+ use MockAuthorizationStrategy\n GlobalMatrixAuthorizationStrategy pmas = new GlobalMatrixAuthorizationStrategy();\n pmas.add(Jenkins.ADMINISTER, \"admin\");\n pmas.add(Jenkins.READ, \"dev\");\n pmas.add(Item.READ, \"dev\");\n Item.EXTENDED_READ.setEnabled(true);\n pmas.add(Item.EXTENDED_READ, \"dev\");\n pmas.add(Item.CREATE, \"dev\"); // so we can show CopyJobCommand would barf; more realistic would be to grant it only in a subfolder\n jenkins.setAuthorizationStrategy(pmas);\n Secret s = Secret.fromString(\"s3cr3t\");\n String sEnc = s.getEncryptedValue();\n FreeStyleProject p = createFreeStyleProject(\"p\");\n p.setDisplayName(\"Unicode here \u2190\");\n p.setDescription(\"This+looks+like+Base64+but+is+not+a+secret\");\n p.addProperty(new VulnerableProperty(s));\n WebClient wc = createWebClient();\n // Control case: an administrator can read and write configuration freely.\n wc.login(\"admin\");\n HtmlPage configure = wc.getPage(p, \"configure\");\n assertThat(configure.getWebResponse().getContentAsString(), containsString(sEnc));\n submit(configure.getFormByName(\"config\"));\n VulnerableProperty vp = p.getProperty(VulnerableProperty.class);\n assertNotNull(vp);\n assertEquals(s, vp.secret);\n Page configXml = wc.goTo(p.getUrl() + \"config.xml\", \"application/xml\");\n String xmlAdmin = configXml.getWebResponse().getContentAsString();\n assertThat(xmlAdmin, containsString(\"\" + sEnc + \"\"));\n assertThat(xmlAdmin, containsString(\"\" + p.getDisplayName() + \"\"));\n assertThat(xmlAdmin, containsString(\"\" + p.getDescription() + \"\"));\n // CLICommandInvoker does not work here, as it sets up its own SecurityRealm + AuthorizationStrategy.\n GetJobCommand getJobCommand = new GetJobCommand();\n Authentication adminAuth = User.get(\"admin\").impersonate();\n getJobCommand.setTransportAuth(adminAuth);\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n String pName = p.getFullName();\n getJobCommand.main(Collections.singletonList(pName), Locale.ENGLISH, System.in, new PrintStream(baos), System.err);\n assertEquals(xmlAdmin, baos.toString(configXml.getWebResponse().getContentCharset()));\n CopyJobCommand copyJobCommand = new CopyJobCommand();\n copyJobCommand.setTransportAuth(adminAuth);\n String pAdminName = pName + \"-admin\";\n assertEquals(0, copyJobCommand.main(Arrays.asList(pName, pAdminName), Locale.ENGLISH, System.in, System.out, System.err));\n FreeStyleProject pAdmin = jenkins.getItemByFullName(pAdminName, FreeStyleProject.class);\n assertNotNull(pAdmin);\n pAdmin.setDisplayName(p.getDisplayName()); // counteract DisplayNameListener\n assertEquals(p.getConfigFile().asString(), pAdmin.getConfigFile().asString());\n // Test case: another user with EXTENDED_READ but not CONFIGURE should not get access even to encrypted secrets.\n wc.login(\"dev\");\n configure = wc.getPage(p, \"configure\");\n assertThat(configure.getWebResponse().getContentAsString(), not(containsString(sEnc)));\n configXml = wc.goTo(p.getUrl() + \"config.xml\", \"application/xml\");\n String xmlDev = configXml.getWebResponse().getContentAsString();\n assertThat(xmlDev, not(containsString(sEnc)));\n assertEquals(xmlAdmin.replace(sEnc, \"********\"), xmlDev);\n getJobCommand = new GetJobCommand();\n Authentication devAuth = User.get(\"dev\").impersonate();\n getJobCommand.setTransportAuth(devAuth);\n baos = new ByteArrayOutputStream();\n getJobCommand.main(Collections.singletonList(pName), Locale.ENGLISH, System.in, new PrintStream(baos), System.err);\n assertEquals(xmlDev, baos.toString(configXml.getWebResponse().getContentCharset()));\n copyJobCommand = new CopyJobCommand();\n copyJobCommand.setTransportAuth(devAuth);\n String pDevName = pName + \"-dev\";\n assertThat(copyJobCommand.main(Arrays.asList(pName, pDevName), Locale.ENGLISH, System.in, System.out, System.err), not(0));\n assertNull(jenkins.getItemByFullName(pDevName, FreeStyleProject.class));\n\n } finally {\n Item.EXTENDED_READ.setEnabled(saveEnabled);\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static bool read_phdr(ELFOBJ *bin, bool linux_kernel_hack) {\n\tbool phdr_found = false;\n\tint i;\n#if R_BIN_ELF64\n\tconst bool is_elf64 = true;\n#else\n\tconst bool is_elf64 = false;\n#endif\n\tut64 phnum = Elf_(r_bin_elf_get_phnum) (bin);\n\tfor (i = 0; i < phnum; i++) {\n\t\tut8 phdr[sizeof (Elf_(Phdr))] = {0};\n\t\tint j = 0;\n\t\tconst size_t rsize = bin->ehdr.e_phoff + i * sizeof (Elf_(Phdr));\n\t\tint len = r_buf_read_at (bin->b, rsize, phdr, sizeof (Elf_(Phdr)));\n\t\tif (len < 1) {\n\t\t\tR_LOG_ERROR (\"read (phdr)\");\n\t\t\tR_FREE (bin->phdr);\n\t\t\treturn false;\n\t\t}\n\t\tbin->phdr[i].p_type = READ32 (phdr, j);\n\t\tif (bin->phdr[i].p_type == PT_PHDR) {\n\t\t\tphdr_found = true;\n\t\t}\n\n\t\tif (is_elf64) {\n\t\t\tbin->phdr[i].p_flags = READ32 (phdr, j);\n\t\t}\n\t\tbin->phdr[i].p_offset = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_vaddr = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_paddr = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_filesz = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_memsz = R_BIN_ELF_READWORD (phdr, j);\n\t\tif (!is_elf64) {\n\t\t\tbin->phdr[i].p_flags = READ32 (phdr, j);\n\t\t//\tbin->phdr[i].p_flags |= 1; tiny.elf needs this somehow :? LOAD0 is always +x for linux?\n\t\t}\n\t\tbin->phdr[i].p_align = R_BIN_ELF_READWORD (phdr, j);\n\t}\n\t/* Here is the where all the fun starts.\n\t * Linux kernel since 2005 calculates phdr offset wrongly\n\t * adding it to the load address (va of the LOAD0).\n\t * See `fs/binfmt_elf.c` file this line:\n\t * NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff);\n\t * So after the first read, we fix the address and read it again\n\t */\n\tif (linux_kernel_hack && phdr_found) {\n\t\tut64 load_addr = Elf_(r_bin_elf_get_baddr) (bin);\n\t\tbin->ehdr.e_phoff = Elf_(r_bin_elf_v2p) (bin, load_addr + bin->ehdr.e_phoff);\n\t\treturn read_phdr (bin, false);\n\t}\n\n\treturn true;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it 'loadyamls array of values' do\n shell(\"echo '---\n aaa: 1\n bbb: 2\n ccc: 3\n ddd: 4' > #{tmpdir}/testyaml.yaml\")\n pp = <<-EOS\n $o = loadyaml('#{tmpdir}/testyaml.yaml')\n notice(inline_template('loadyaml[aaa] is <%= @o[\"aaa\"].inspect %>'))\n notice(inline_template('loadyaml[bbb] is <%= @o[\"bbb\"].inspect %>'))\n notice(inline_template('loadyaml[ccc] is <%= @o[\"ccc\"].inspect %>'))\n notice(inline_template('loadyaml[ddd] is <%= @o[\"ddd\"].inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/loadyaml\\[aaa\\] is 1/)\n expect(r.stdout).to match(/loadyaml\\[bbb\\] is 2/)\n expect(r.stdout).to match(/loadyaml\\[ccc\\] is 3/)\n expect(r.stdout).to match(/loadyaml\\[ddd\\] is 4/)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "typeof k?k:j).call(this);this.fire(\"focus\")};c.isFocusable&&(this.isFocusable=this.isFocusable);this.keyboardFocusable=!0}CKEDITOR.ui.dialog.uiElement.call(this,e,c,h,\"span\",null,null,\"\");h=h.join(\"\").match(b);g=g.match(a)||[\"\",\"\",\"\"];d.test(g[1])&&(g[1]=g[1].slice(0,-1),g[2]=\"/\"+g[2]);f.push([g[1],\" \",h[1]||\"\",g[2]].join(\"\"))}}}(),fieldset:function(b,a,d,e,c){var f=c.label;this._={children:a};CKEDITOR.ui.dialog.uiElement.call(this,b,c,e,\"fieldset\",null,null,function(){var a=[];f&&a.push(\"\"+f+\"\");for(var b=0;ba.getChildCount()?(new CKEDITOR.dom.text(b,CKEDITOR.document)).appendTo(a):a.getChild(0).$.nodeValue=b;return this},getLabel:function(){var b=", "label": 1, "label_name": "safe"} +{"code": "\teach: function( callback, args ) {\n\t\treturn jQuery.each( this, callback, args );\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " function displayRecoveryResetForm($id, $errormessage = '')\n {\n if (!empty($errormessage)) {\n echo \"
\";\n echo \"{$errormessage}
\";\n }\n\n echo \"
\\n\";\n echo \"\";\n echo \"\\n\";\n\n echo \"
\".$GLOBALS['strPwdRecEnterPassword'].\"
\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"
\".$GLOBALS['strPassword'].\": 
\".$GLOBALS['strRepeatPassword'].\": 
 
\";\n\n echo \"
\\n\";\n }", "label": 1, "label_name": "safe"} +{"code": "cssp_read_tsrequest(STREAM token, STREAM pubkey)\n{\n\tSTREAM s;\n\tint length;\n\tint tagval;\n\n\ts = tcp_recv(NULL, 4);\n\n\tif (s == NULL)\n\t\treturn False;\n\n\t// verify ASN.1 header\n\tif (s->p[0] != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t{\n\t\tlogger(Protocol, Error,\n\t\t \"cssp_read_tsrequest(), expected BER_TAG_SEQUENCE|BER_TAG_CONSTRUCTED, got %x\",\n\t\t s->p[0]);\n\t\treturn False;\n\t}\n\n\t// peek at first 4 bytes to get full message length\n\tif (s->p[1] < 0x80)\n\t\tlength = s->p[1] - 2;\n\telse if (s->p[1] == 0x81)\n\t\tlength = s->p[2] - 1;\n\telse if (s->p[1] == 0x82)\n\t\tlength = (s->p[2] << 8) | s->p[3];\n\telse\n\t\treturn False;\n\n\t// receive the remainings of message\n\ts = tcp_recv(s, length);\n\n\t// parse the response and into nego token\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\treturn False;\n\n\t// version [0]\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\treturn False;\n\tin_uint8s(s, length);\n\n\t// negoToken [1]\n\tif (token)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\ttoken->end = token->p = token->data;\n\t\tout_uint8p(token, s->p, length);\n\t\ts_mark_end(token);\n\t}\n\n\t// pubKey [3]\n\tif (pubkey)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\tpubkey->data = pubkey->p = s->p;\n\t\tpubkey->end = pubkey->data + length;\n\t\tpubkey->size = length;\n\t}\n\n\n\treturn True;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function dialog_ajax(a,b,c,d,e,f,g,h){b=\"undefined\"==typeof b||!1===b?alert(\"You send an invalid url\"):b;d=\"undefined\"==typeof d||!1===d?\"POST\":d;e=\"undefined\"==typeof e||!1===e?\"JSON\":e;h=\"undefined\"==typeof h||!1===h?$(\"document.body\"):h;a=\"undefined\"==typeof a||!1===a?set_popup_title():a;c._cat_ajax=1;$.ajax({type:d,url:b,dataType:e,context:h,data:c,beforeSend:function(b){$(\".fc_popup\").remove();b.process=set_activity(a);\"undefined\"!=typeof f&&!1!==f&&f.call(this)},success:function(a,b,c){return_success(c.process,", "label": 1, "label_name": "safe"} +{"code": " def test_modify_access_allow(self):\n url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})\n response = self.client.get(url, {\n 'unique_student_identifier': self.other_user.email,\n 'rolename': 'staff',\n 'action': 'allow',\n })\n self.assertEqual(response.status_code, 200)", "label": 0, "label_name": "vulnerable"} +{"code": "(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ga(a,b) {var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:H.createElement(\"th\"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:\"\",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);la(a,d,h(b).data())}function la(a,b,c) {var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if (!b.sWidthOrig) {b.sWidthOrig=e.attr(\"width\")||null;var f=\n(e.attr(\"style\")||\"\").match(/width:\\s*(\\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),J(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),F(b,c,\"sWidth\",\"sWidthOrig\"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),F(b,c,\"aDataSort\"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a) {return\"string\"===typeof a&&-1!==a.indexOf(\"@\")};b._bAttrSrc=h.isPlainObject(g)&&\n(c(g.sort)||c(g.type)||c(g.filter));b.fnGetData=function(a,b,c) {var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c) {return R(g)(a,b,c)};\"number\"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray(\"asc\",b.asSorting);c=-1!==h.inArray(\"desc\",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=\"\"):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=\nd.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function U(a) {if (!1!==a.oFeatures.bAutoWidth) {var b=a.aoColumns;Ha(a);for(var c=0,d=b.length;c= 0; i--, j++) {\n if (!fp_is_bit_set(e, i) || j == CT_INV_MOD_PRE_CNT)\n break;\n }\n fp_copy(&pre[j-1], t);\n for (j = 0; i >= 0; i--) {\n int set = fp_is_bit_set(e, i);\n\n if ((j == CT_INV_MOD_PRE_CNT) || (!set && j > 0)) {\n fp_mul(t, &pre[j-1], t);\n fp_montgomery_reduce(t, b, mp);\n j = 0;\n }\n fp_sqr(t, t);\n fp_montgomery_reduce(t, b, mp);\n j += set;\n }\n if (j > 0) {\n fp_mul(t, &pre[j-1], c);\n fp_montgomery_reduce(c, b, mp);\n }\n else \n fp_copy(t, c);\n\n#ifdef WOLFSSL_SMALL_STACK\n XFREE(t, NULL, DYNAMIC_TYPE_BIGINT);\n#endif\n return FP_OKAY;\n}", "label": 1, "label_name": "safe"} +{"code": " public static function BBCode2Html($text) {\n $text = trim($text);\n\n $text = self::parseEmoji($text);\n\n // Smileys to find...\n $in = array(\n );\n\n // And replace them by...\n $out = array(\n );\n\n $in[] = '[/*]';\n $in[] = '[*]';\n $out[] = '';\n $out[] = '
  • ';\n\n $text = str_replace($in, $out, $text);\n\n // BBCode to find...\n $in = array( \t '/\\[b\\](.*?)\\[\\/b\\]/ms',\n '/\\[i\\](.*?)\\[\\/i\\]/ms',\n '/\\[u\\](.*?)\\[\\/u\\]/ms',\n '/\\[mark\\](.*?)\\[\\/mark\\]/ms',\n '/\\[s\\](.*?)\\[\\/s\\]/ms',\n '/\\[list\\=(.*?)\\](.*?)\\[\\/list\\]/ms',\n '/\\[list\\](.*?)\\[\\/list\\]/ms',\n '/\\[\\*\\]\\s?(.*?)\\n/ms',\n '/\\[fs(.*?)\\](.*?)\\[\\/fs(.*?)\\]/ms',\n '/\\[color\\=(.*?)\\](.*?)\\[\\/color\\]/ms'\n );\n\n // And replace them by...\n $out = array(\t '\\1',\n '\\1',\n '\\1',\n '\\1',\n '\\1',\n '\\2',\n '\\1',\n '\\1',\n '\\2',\n '\\2'\n );\n\n $text = preg_replace($in, $out, $text);\n\n // Prepare quote's\n $text = str_replace(\"\\r\\n\",\"\\n\",$text);\n\n // paragraphs\n $text = str_replace(\"\\r\", \"\", $text);\n\n return $text;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def destroy_workflow\n Log.add_info(request, params.inspect)\n\n return unless request.post?\n\n Item.find(params[:id]).destroy\n\n @tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS)\n\n @group_id = params[:group_id]\n SqlHelper.validate_token([@group_id])\n\n if @group_id.blank?\n @group_id = '0' # '0' for ROOT\n end\n\n render(:partial => 'groups/ajax_group_workflows', :layout => false)\n end", "label": 1, "label_name": "safe"} +{"code": "mxUtils.convertPoint(m.container,mxEvent.getClientX(E),mxEvent.getClientY(E));mxEvent.consume(E);E=m.view.scale;var S=m.view.translate;m.setSelectionCell(t((H.x-3*E)/E-S.x,(H.y-3*E)/E-S.y))}};u=new mxKeyHandler(m);u.bindKey(46,D);u.bindKey(8,D);m.getRubberband().isForceRubberbandEvent=function(E){return 0==E.evt.button&&(null==E.getCell()||E.getCell()==q)};m.panningHandler.isForcePanningEvent=function(E){return 2==E.evt.button};var v=m.isCellSelectable;m.isCellSelectable=function(E){return E==q?!1:\nv.apply(this,arguments)};m.getLinkForCell=function(){return null};var y=m.view.getState(q);k=m.getAllConnectionConstraints(y);for(var A=0;null!=k&&AIsDefault()) {\n\t\tthrow RuntimeGenericError(\"NativeModule may only be instantiated from default nodejs isolate\");\n\t}\n\tif (uv_dlopen(filename.c_str(), &lib) != 0) {\n\t\tthrow RuntimeGenericError(\"Failed to load module\");\n\t}\n\tif (uv_dlsym(&lib, \"InitForContext\", reinterpret_cast(&init)) != 0 || init == nullptr) {\n\t\tuv_dlclose(&lib);\n\t\tthrow RuntimeGenericError(\"Module is not isolated-vm compatible\");\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "\tint lazy_bdecode(char const* start, char const* end, lazy_entry& ret\n\t\t, error_code& ec, int* error_pos, int depth_limit, int item_limit)\n\t{\n\t\tchar const* const orig_start = start;\n\t\tret.clear();\n\t\tif (start == end) return 0;\n\n\t\tstd::vector stack;\n\n\t\tstack.push_back(&ret);\n\t\twhile (start < end)\n\t\t{\n\t\t\tif (stack.empty()) break; // done!\n\n\t\t\tlazy_entry* top = stack.back();\n\n\t\t\tif (int(stack.size()) > depth_limit) TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);\n\t\t\tif (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\tchar t = *start;\n\t\t\t++start;\n\t\t\tif (start >= end && t != 'e') TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\n\t\t\tswitch (top->type())\n\t\t\t{\n\t\t\t\tcase lazy_entry::dict_t:\n\t\t\t\t{\n\t\t\t\t\tif (t == 'e')\n\t\t\t\t\t{\n\t\t\t\t\t\ttop->set_end(start);\n\t\t\t\t\t\tstack.pop_back();\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!is_digit(t)) TORRENT_FAIL_BDECODE(bdecode_errors::expected_string);\n\t\t\t\t\tboost::int64_t len = t - '0';\n\t\t\t\t\tstart = parse_int(start, end, ':', len);\n\t\t\t\t\tif (start == 0 || start + len + 3 > end || *start != ':')\n\t\t\t\t\t\tTORRENT_FAIL_BDECODE(bdecode_errors::expected_colon);\n\t\t\t\t\t++start;\n\t\t\t\t\tif (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\t\t\tlazy_entry* ent = top->dict_append(start);\n\t\t\t\t\tif (ent == 0) TORRENT_FAIL_BDECODE(boost::system::errc::not_enough_memory);\n\t\t\t\t\tstart += len;\n\t\t\t\t\tif (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\t\t\tstack.push_back(ent);\n\t\t\t\t\tt = *start;\n\t\t\t\t\t++start;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase lazy_entry::list_t:\n\t\t\t\t{\n\t\t\t\t\tif (t == 'e')\n\t\t\t\t\t{\n\t\t\t\t\t\ttop->set_end(start);\n\t\t\t\t\t\tstack.pop_back();\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlazy_entry* ent = top->list_append();\n\t\t\t\t\tif (ent == 0) TORRENT_FAIL_BDECODE(boost::system::errc::not_enough_memory);\n\t\t\t\t\tstack.push_back(ent);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: break;\n\t\t\t}\n\n\t\t\t--item_limit;\n\t\t\tif (item_limit <= 0) TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);\n\n\t\t\ttop = stack.back();\n\t\t\tswitch (t)\n\t\t\t{\n\t\t\t\tcase 'd':\n\t\t\t\t\ttop->construct_dict(start - 1);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'l':\n\t\t\t\t\ttop->construct_list(start - 1);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'i':\n\t\t\t\t{\n\t\t\t\t\tchar const* int_start = start;\n\t\t\t\t\tstart = find_char(start, end, 'e');\n\t\t\t\t\ttop->construct_int(int_start, start - int_start);\n\t\t\t\t\tif (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\t\t\tTORRENT_ASSERT(*start == 'e');\n\t\t\t\t\t++start;\n\t\t\t\t\tstack.pop_back();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t{\n\t\t\t\t\tif (!is_digit(t))\n\t\t\t\t\t\tTORRENT_FAIL_BDECODE(bdecode_errors::expected_value);\n\n\t\t\t\t\tboost::int64_t len = t - '0';\n\t\t\t\t\tstart = parse_int(start, end, ':', len);\n\t\t\t\t\tif (start == 0 || start + len + 1 > end || *start != ':')\n\t\t\t\t\t\tTORRENT_FAIL_BDECODE(bdecode_errors::expected_colon);\n\t\t\t\t\t++start;\n\t\t\t\t\ttop->construct_string(start, int(len));\n\t\t\t\t\tstack.pop_back();\n\t\t\t\t\tstart += len;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t\treturn 0;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "static int async_polkit_defer(sd_event_source *s, void *userdata) {\n AsyncPolkitQuery *q = userdata;\n\n assert(s);\n\n /* This is called as idle event source after we processed the async polkit reply, hopefully after the\n * method call we re-enqueued has been properly processed. */\n\n async_polkit_query_free(q);\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": " private function _mergeAssocArray(&$a1, $a2) {\n foreach ($a2 as $k => $v) {\n if ($v === false) {\n if (isset($a1[$k])) unset($a1[$k]);\n continue;\n }\n $a1[$k] = $v;\n }\n }", "label": 1, "label_name": "safe"} +{"code": "void AnnotateCondVarSignal(const char *file, int line,\n const volatile void *cv){}", "label": 0, "label_name": "vulnerable"} +{"code": "for(ja=ma=0;ja
  • '+", "label": 0, "label_name": "vulnerable"} +{"code": "qemuProcessHandleMonitorEOF(qemuMonitorPtr mon,\n virDomainObjPtr vm,\n void *opaque)\n{\n virQEMUDriverPtr driver = opaque;\n qemuDomainObjPrivatePtr priv;\n struct qemuProcessEvent *processEvent;\n\n virObjectLock(vm);\n\n VIR_DEBUG(\"Received EOF on %p '%s'\", vm, vm->def->name);\n\n priv = vm->privateData;\n if (priv->beingDestroyed) {\n VIR_DEBUG(\"Domain is being destroyed, EOF is expected\");\n goto cleanup;\n }\n\n processEvent = g_new0(struct qemuProcessEvent, 1);\n\n processEvent->eventType = QEMU_PROCESS_EVENT_MONITOR_EOF;\n processEvent->vm = virObjectRef(vm);\n\n if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {\n virObjectUnref(vm);\n qemuProcessEventFree(processEvent);\n goto cleanup;\n }\n\n /* We don't want this EOF handler to be called over and over while the\n * thread is waiting for a job.\n */\n virObjectLock(mon);\n qemuMonitorUnregister(mon);\n virObjectUnlock(mon);\n\n /* We don't want any cleanup from EOF handler (or any other\n * thread) to enter qemu namespace. */\n qemuDomainDestroyNamespace(driver, vm);\n\n cleanup:\n virObjectUnlock(vm);\n}", "label": 1, "label_name": "safe"} +{"code": "(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget(\"ui.mouse\",{options:{cancel:\":input,option\",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind(\"mousedown.\"+this.widgetName,function(a){return b._mouseDown(a)}).bind(\"click.\"+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+\".preventClickEvent\"))return a.removeData(c.target,b.widgetName+\".preventClickEvent\"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind(\".\"+this.widgetName),this._mouseMoveDelegate&&a(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel==\"string\"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+\".preventClickEvent\")&&a.removeData(b.target,this.widgetName+\".preventClickEvent\"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).bind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+\".preventClickEvent\",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15", "label": 0, "label_name": "vulnerable"} +{"code": "void DDGifSlurp(GifInfo *info, bool decode, bool exitAfterFrame) {\n\tGifRecordType RecordType;\n\tGifByteType *ExtData;\n\tint ExtFunction;\n\tGifFileType *gifFilePtr;\n\tgifFilePtr = info->gifFilePtr;\n\tuint_fast32_t lastAllocatedGCBIndex = 0;\n\tdo {\n\t\tif (DGifGetRecordType(gifFilePtr, &RecordType) == GIF_ERROR) {\n\t\t\tbreak;\n\t\t}\n\t\tbool isInitialPass = !decode && !exitAfterFrame;\n\t\tswitch (RecordType) {\n\t\t\tcase IMAGE_DESC_RECORD_TYPE:\n\n\t\t\t\tif (DGifGetImageDesc(gifFilePtr, isInitialPass) == GIF_ERROR) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (isInitialPass) {\n\t\t\t\t\tint_fast32_t widthOverflow = gifFilePtr->Image.Width - gifFilePtr->SWidth;\n\t\t\t\t\tint_fast32_t heightOverflow = gifFilePtr->Image.Height - gifFilePtr->SHeight;\n\t\t\t\t\tif (widthOverflow > 0 || heightOverflow > 0) {\n\t\t\t\t\t\tgifFilePtr->SWidth += widthOverflow;\n\t\t\t\t\t\tgifFilePtr->SHeight += heightOverflow;\n\t\t\t\t\t}\n\t\t\t\t\tSavedImage *sp = &gifFilePtr->SavedImages[gifFilePtr->ImageCount - 1];\n\t\t\t\t\tint_fast32_t topOverflow = gifFilePtr->Image.Top + gifFilePtr->Image.Height - gifFilePtr->SHeight;\n\t\t\t\t\tif (topOverflow > 0) {\n\t\t\t\t\t\tsp->ImageDesc.Top -= topOverflow;\n\t\t\t\t\t}\n\n\t\t\t\t\tint_fast32_t leftOverflow = gifFilePtr->Image.Left + gifFilePtr->Image.Width - gifFilePtr->SWidth;\n\t\t\t\t\tif (leftOverflow > 0) {\n\t\t\t\t\t\tsp->ImageDesc.Left -= leftOverflow;\n\t\t\t\t\t}\n\t\t\t\t\tif (!updateGCB(info, &lastAllocatedGCBIndex)) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (decode) {\n\t\t\t\t\tconst uint_fast32_t newRasterSize = gifFilePtr->Image.Width * gifFilePtr->Image.Height;\n\t\t\t\t\tif (newRasterSize == 0) {\n\t\t\t\t\t\tfree(info->rasterBits);\n\t\t\t\t\t\tinfo->rasterBits = NULL;\n\t\t\t\t\t\tinfo->rasterSize = newRasterSize;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst int_fast32_t widthOverflow = gifFilePtr->Image.Width - info->originalWidth;\n\t\t\t\t\tconst int_fast32_t heightOverflow = gifFilePtr->Image.Height - info->originalHeight;\n\t\t\t\t\tif (newRasterSize > info->rasterSize || widthOverflow > 0 || heightOverflow > 0) {\n\t\t\t\t\t\tvoid *tmpRasterBits = reallocarray(info->rasterBits, newRasterSize, sizeof(GifPixelType));\n\t\t\t\t\t\tif (tmpRasterBits == NULL) {\n\t\t\t\t\t\t\tgifFilePtr->Error = D_GIF_ERR_NOT_ENOUGH_MEM;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfo->rasterBits = tmpRasterBits;\n\t\t\t\t\t\tinfo->rasterSize = newRasterSize;\n\t\t\t\t\t}\n\t\t\t\t\tif (gifFilePtr->Image.Interlace) {\n\t\t\t\t\t\tuint_fast16_t i, j;\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * The way an interlaced image should be read -\n\t\t\t\t\t\t * offsets and jumps...\n\t\t\t\t\t\t */\n\t\t\t\t\t\tuint_fast8_t InterlacedOffset[] = {0, 4, 2, 1};\n\t\t\t\t\t\tuint_fast8_t InterlacedJumps[] = {8, 8, 4, 2};\n\t\t\t\t\t\t/* Need to perform 4 passes on the image */\n\t\t\t\t\t\tfor (i = 0; i < 4; i++)\n\t\t\t\t\t\t\tfor (j = InterlacedOffset[i]; j < gifFilePtr->Image.Height; j += InterlacedJumps[i]) {\n\t\t\t\t\t\t\t\tif (DGifGetLine(gifFilePtr, info->rasterBits + j * gifFilePtr->Image.Width, gifFilePtr->Image.Width) == GIF_ERROR)\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (DGifGetLine(gifFilePtr, info->rasterBits, gifFilePtr->Image.Width * gifFilePtr->Image.Height) == GIF_ERROR) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (info->sampleSize > 1) {\n\t\t\t\t\t\tunsigned char *dst = info->rasterBits;\n\t\t\t\t\t\tunsigned char *src = info->rasterBits;\n\t\t\t\t\t\tunsigned char *const srcEndImage = info->rasterBits + gifFilePtr->Image.Width * gifFilePtr->Image.Height;\n\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\tunsigned char *srcNextLineStart = src + gifFilePtr->Image.Width * info->sampleSize;\n\t\t\t\t\t\t\tunsigned char *const srcEndLine = src + gifFilePtr->Image.Width;\n\t\t\t\t\t\t\tunsigned char *dstEndLine = dst + gifFilePtr->Image.Width / info->sampleSize;\n\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\t*dst = *src;\n\t\t\t\t\t\t\t\tdst++;\n\t\t\t\t\t\t\t\tsrc += info->sampleSize;\n\t\t\t\t\t\t\t} while (src < srcEndLine);\n\t\t\t\t\t\t\tdst = dstEndLine;\n\t\t\t\t\t\t\tsrc = srcNextLineStart;\n\t\t\t\t\t\t} while (src < srcEndImage);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (DGifGetCodeNext(gifFilePtr, &ExtData) == GIF_ERROR) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while (ExtData != NULL);\n\t\t\t\t\tif (exitAfterFrame) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase EXTENSION_RECORD_TYPE:\n\t\t\t\tif (DGifGetExtension(gifFilePtr, &ExtFunction, &ExtData) == GIF_ERROR) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (isInitialPass) {\n\t\t\t\t\tupdateGCB(info, &lastAllocatedGCBIndex);\n\t\t\t\t\tif (readExtensions(ExtFunction, ExtData, info) == GIF_ERROR) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\twhile (ExtData != NULL) {\n\t\t\t\t\tif (DGifGetExtensionNext(gifFilePtr, &ExtData) == GIF_ERROR) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (isInitialPass && readExtensions(ExtFunction, ExtData, info) == GIF_ERROR) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase TERMINATE_RECORD_TYPE:\n\t\t\t\tbreak;\n\n\t\t\tdefault: /* Should be trapped by DGifGetRecordType */\n\t\t\t\tbreak;\n\t\t}\n\t} while (RecordType != TERMINATE_RECORD_TYPE);\n\n\tinfo->rewindFunction(info);\n}", "label": 1, "label_name": "safe"} +{"code": " where: { userId: Not(adminUser.id), organizationId: org.id },\n });\n expect(organizationUserUpdated.status).toEqual('active');\n });", "label": 1, "label_name": "safe"} +{"code": " public void translate(ServerEntityMetadataPacket packet, GeyserSession session) {\n Entity entity;\n if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {\n entity = session.getPlayerEntity();\n } else {\n entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());\n }\n if (entity == null) return;\n\n for (EntityMetadata metadata : packet.getMetadata()) {\n try {\n entity.updateBedrockMetadata(metadata, session);\n } catch (ClassCastException e) {\n // Class cast exceptions are really the only ones we're going to get in normal gameplay\n // Because some entity rewriters forget about some values\n // Any other errors are actual bugs\n session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog(\"geyser.network.translator.metadata.failed\", metadata, entity.getEntityType()));\n session.getConnector().getLogger().debug(\"Entity Java ID: \" + entity.getEntityId() + \", Geyser ID: \" + entity.getGeyserId());\n if (session.getConnector().getConfig().isDebugMode()) {\n e.printStackTrace();\n }\n }\n }\n\n entity.updateBedrockMetadata(session);\n\n // Update the interactive tag, if necessary\n if (session.getMouseoverEntity() != null && session.getMouseoverEntity().getEntityId() == entity.getEntityId()) {\n InteractiveTagManager.updateTag(session, entity);\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "0),!1,null,0,v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,.5*v));return c};Ka.prototype.getConstraints=function(c,l,x){c=[];var p=Math.max(0,Math.min(l,parseFloat(mxUtils.getValue(this.style,\"dx\",this.dx)))),v=Math.max(0,Math.min(x,parseFloat(mxUtils.getValue(this.style,\"dy\",this.dy))));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1));c.push(new mxConnectionConstraint(new mxPoint(.5,0),!1));c.push(new mxConnectionConstraint(new mxPoint(1,0),!1));c.push(new mxConnectionConstraint(new mxPoint(0,\n0),!1,null,l,.5*v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,l,v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*(l+p),v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,p,v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,p,.5*(x+v)));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,p,x));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*p,x));c.push(new mxConnectionConstraint(new mxPoint(0,.5),!1));c.push(new mxConnectionConstraint(new mxPoint(0,\n1),!1));return c};bb.prototype.constraints=[new mxConnectionConstraint(new mxPoint(0,0),!1),new mxConnectionConstraint(new mxPoint(0,.5),!1),new mxConnectionConstraint(new mxPoint(0,1),!1),new mxConnectionConstraint(new mxPoint(.25,.5),!1),new mxConnectionConstraint(new mxPoint(.5,.5),!1),new mxConnectionConstraint(new mxPoint(.75,.5),!1),new mxConnectionConstraint(new mxPoint(1,0),!1),new mxConnectionConstraint(new mxPoint(1,.5),!1),new mxConnectionConstraint(new mxPoint(1,1),!1)];$a.prototype.getConstraints=", "label": 1, "label_name": "safe"} +{"code": "static cJSON *cJSON_New_Item(void)\n{\n\tcJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON));\n\tif (node) memset(node,0,sizeof(cJSON));\n\treturn node;\n}", "label": 1, "label_name": "safe"} +{"code": " public ECIESwithAESCBC()\n {\n super(new CBCBlockCipher(new AESEngine()), 16);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function isOpenReferenceConflict( $parameter ) {\n\t\tif ( array_key_exists( $parameter, $this->data ) ) {\n\t\t\tif ( array_key_exists( 'open_ref_conflict', $this->data[$parameter] ) ) {\n\t\t\t\treturn (bool)$this->data[$parameter]['open_ref_conflict'];\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow new MWException( __METHOD__ . \": Attempted to load a parameter that does not exist.\" );\n\t}", "label": 1, "label_name": "safe"} +{"code": "usage (int status)\n{\n if (status != EXIT_SUCCESS)\n fprintf (stderr, _(\"Try `%s --help' for more information.\\n\"),\n\t program_name);\n else\n {\n printf (_(\"\\\nUsage: %s [OPTION]... [STRINGS]...\\n\\\n\"), program_name);\n fputs (_(\"\\\nInternationalized Domain Name (IDNA2008) convert STRINGS, or standard input.\\n\\\n\\n\\\n\"), stdout);\n fputs (_(\"\\\nCommand line interface to the Libidn2 implementation of IDNA2008.\\n\\\n\\n\\\nAll strings are expected to be encoded in the locale charset.\\n\\\n\\n\\\nTo process a string that starts with `-', for example `-foo', use `--'\\n\\\nto signal the end of parameters, as in `idn2 --quiet -- -foo'.\\n\\\n\\n\\\nMandatory arguments to long options are mandatory for short options too.\\n\\\n\"), stdout);\n fputs (_(\"\\\n -h, --help Print help and exit\\n\\\n -V, --version Print version and exit\\n\\\n\"), stdout);\n fputs (_(\"\\\n -d, --decode Decode (punycode) domain name\\n\\\n -l, --lookup Lookup domain name (default)\\n\\\n -r, --register Register label\\n\\\n\"), stdout);\n fputs (_(\"\\\n -T, --tr46t Enable TR46 transitional processing\\n\\\n -N, --tr46nt Enable TR46 non-transitional processing\\n\\\n --no-tr46 Disable TR46 processing\\n\\\n\"), stdout);\n fputs (_(\"\\\n --usestd3asciirules Enable STD3 ASCII rules\\n\\\n --debug Print debugging information\\n\\\n --quiet Silent operation\\n\\\n\"), stdout);\n emit_bug_reporting_address ();\n }\n exit (status);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "for(var J=0;JonRequestMetadata_) {\n return Http::FilterMetadataStatus::Continue;\n }\n if (wasm_->onRequestMetadata_(this, id_).u64_ == 0) {\n return Http::FilterMetadataStatus::Continue;\n }\n return Http::FilterMetadataStatus::Continue; // This is currently the only return code.\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic function updateTab($id, $array)\n\t{\n\t\tif (!$id || $id == '') {\n\t\t\t$this->setAPIResponse('error', 'id was not set', 422);\n\t\t\treturn null;\n\t\t}\n\t\tif (!$array) {\n\t\t\t$this->setAPIResponse('error', 'no data was sent', 422);\n\t\t\treturn null;\n\t\t}\n\t\t$tabInfo = $this->getTabById($id);\n\t\tif ($tabInfo) {\n\t\t\t$array = $this->checkKeys($tabInfo, $array);\n\t\t} else {\n\t\t\t$this->setAPIResponse('error', 'No tab info found', 404);\n\t\t\treturn false;\n\t\t}\n\t\tif (array_key_exists('name', $array)) {\n\t\t\t$array['name'] = $this->sanitizeUserString($array['name']);\n\t\t\tif ($this->isTabNameTaken($array['name'], $id)) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!$this->qualifyLength($array['name'], 50, true)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('default', $array)) {\n\t\t\tif ($array['default']) {\n\t\t\t\t$this->clearTabDefault();\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id_min', $array)) ? $array['group_id_min'] : $tabInfo['group_id_min'];\n\t\t\tif ($array['group_id'] < $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a lower Group Id Max than Group Id Min', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id_min', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id', $array)) ? $array['group_id'] : $tabInfo['group_id'];\n\t\t\tif ($array['group_id_min'] > $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a higher Group Id Min than Group Id Max', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t$response = [\n\t\t\tarray(\n\t\t\t\t'function' => 'query',\n\t\t\t\t'query' => array(\n\t\t\t\t\t'UPDATE tabs SET',\n\t\t\t\t\t$array,\n\t\t\t\t\t'WHERE id = ?',\n\t\t\t\t\t$id\n\t\t\t\t)\n\t\t\t),\n\t\t];\n\t\t$this->setAPIResponse(null, 'Tab info updated');\n\t\t$this->setLoggerChannel('Tab Management');\n\t\t$this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']');\n\t\treturn $this->processQueries($response);\n\t}", "label": 1, "label_name": "safe"} +{"code": " def readOptInt(json: JsValue, fieldName: String, altName: String = \"\",\n min: Opt[i32] = None, max: Opt[i32] = None): Option[Int] = {\n readOptLong(json, fieldName).orElse(readOptLong(json, altName)) map { valueAsLong =>\n val maxVal = max getOrElse Int.MaxValue\n val minVal = min getOrElse Int.MinValue\n if (valueAsLong > maxVal)\n throwBadJson(\"TyEJSNGTMX\", s\"$fieldName too large: $valueAsLong, max is: $maxVal\")\n if (valueAsLong < minVal)\n throwBadJson(\"TyEJSNLTMN\", s\"$fieldName too small: $valueAsLong, min is: $minVal\")\n valueAsLong.toInt\n }\n }\n\n\n def readLong(json: JsValue, fieldName: String): Long =", "label": 0, "label_name": "vulnerable"} +{"code": " spl_autoload_register($func);\n }\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": "function loadGXCodeHighLib($class_name)\n{\n Mod::inc($class_name.'.lib', '', dirname(__FILE__).'/inc/');\n}", "label": 1, "label_name": "safe"} +{"code": " }elseif($k == \"error\"){\r\n\r\n self::error($v);\r\n\r\n }elseif(!in_array($k, $arr) && $k != 'paging'){\r", "label": 0, "label_name": "vulnerable"} +{"code": " protected function postFilterCallback($matches) {\n $url = $this->armorUrl($matches[1]);\n return ''.\n ''.\n ''.\n '';\n\n }", "label": 1, "label_name": "safe"} +{"code": "def test_digest():\n # Test that we support Digest Authentication\n http = httplib2.Http()\n password = tests.gen_password()\n handler = tests.http_reflect_with_auth(allow_scheme=\"digest\", allow_credentials=((\"joe\", password),))\n with tests.server_request(handler, request_count=3) as uri:\n response, content = http.request(uri, \"GET\")\n assert response.status == 401\n http.add_credentials(\"joe\", password)\n response, content = http.request(uri, \"GET\")\n assert response.status == 200, content.decode()", "label": 1, "label_name": "safe"} +{"code": "if(\"function\"!=typeof a)throw new TypeError(\"parseInputDate() sholud be as function\");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledTimeIntervals() expects an array parameter\");return d.disabledTimeIntervals=b,$(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledHours() expects an array parameter\");if(d.disabledHours=na(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"enabledHours() expects an array parameter\");if(d.enabledHours=na(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!(\"string\"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError(\"viewDate() parameter must be one of [string, moment or Date]\");return f=ga(a),J(),l},c.is(\"input\"))g=c;else if(g=c.find(d.datepickerInput),0===g.size())g=c.find(\"input\");else if(!g.is(\"input\"))throw new Error('CSS class \"'+d.datepickerInput+'\" cannot be applied to non input element');if(c.hasClass(\"input-group\")&&(n=0===c.find(\".datepickerbutton\").size()?c.find(\".input-group-addon\"):c.find(\".datepickerbutton\")),!d.inline&&!g.is(\"input\"))throw new Error(\"Could not initialize DateTimePicker without an input element\");return e=x(),f=e.clone(),a.extend(!0,d,G()),l.options(d),oa(),ka(),g.prop(\"disabled\")&&l.disable(),g.is(\"input\")&&0!==g.val().trim().length?_(ga(g.val().trim())):d.defaultDate&&void 0===g.attr(\"placeholder\")&&_(d.defaultDate),d.inline&&ea(),l};a.fn.datetimepicker=function(b){return this.each(function(){var d=a(this);d.data(\"DateTimePicker\")||(b=a.extend(!0,{},a.fn.datetimepicker.defaults,b),d.data(\"DateTimePicker\",c(d,b)))})},a.fn.datetimepicker.defaults={timeZone:\"Etc/UTC\",format:!1,dayViewHeaderFormat:\"MMMM YYYY\",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:\"glyphicon glyphicon-time\",date:\"glyphicon glyphicon-calendar\",up:\"glyphicon glyphicon-chevron-up\",down:\"glyphicon glyphicon-chevron-down\",previous:\"glyphicon glyphicon-chevron-left\",next:\"glyphicon glyphicon-chevron-right\",today:\"glyphicon glyphicon-screenshot\",clear:\"glyphicon glyphicon-trash\",close:\"glyphicon glyphicon-remove\"},tooltips:{today:\"Go to today\",clear:\"Clear selection\",close:\"Close the picker\",selectMonth:\"Select Month\",prevMonth:\"Previous Month\",nextMonth:\"Next Month\",selectYear:\"Select Year\",prevYear:\"Previous Year\",nextYear:\"Next Year\",selectDecade:\"Select Decade\",prevDecade:\"Previous Decade\",nextDecade:\"Next Decade\",prevCentury:\"Previous Century\",nextCentury:\"Next Century\",pickHour:\"Pick Hour\",incrementHour:\"Increment Hour\",decrementHour:\"Decrement Hour\",pickMinute:\"Pick Minute\",incrementMinute:\"Increment Minute\",decrementMinute:\"Decrement Minute\",pickSecond:\"Pick Second\",incrementSecond:\"Increment Second\",decrementSecond:\"Decrement Second\",togglePeriod:\"Toggle Period\",selectTime:\"Select Time\"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:\"days\",toolbarPlacement:\"default\",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:\"auto\",vertical:\"auto\"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:\".datepickerinput\",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(7,\"d\")):this.date(b.clone().add(this.stepping(),\"m\"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(7,\"d\")):this.date(b.clone().subtract(this.stepping(),\"m\"))},\"control up\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(1,\"y\")):this.date(b.clone().add(1,\"h\"))}},\"control down\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(1,\"y\")):this.date(b.clone().subtract(1,\"h\"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"d\"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"d\"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"M\"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"M\"))}},enter:function(){this.hide()},escape:function(){this.hide()},\"control space\":function(a){a.find(\".timepicker\").is(\":visible\")&&a.find('.btn[data-action=\"togglePeriod\"]').click()},t:function(){this.date(this.getMoment())},\"delete\":function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1}});", "label": 0, "label_name": "vulnerable"} +{"code": "if(m||p){var O=[],V=null,U=null,Y=null,n=function(ea){W.setAttribute(\"disabled\",\"disabled\");for(var ta=0;taparams['mod'] = expString::escape($this->params['mod']);\n $this->params['src'] = expString::escape($this->params['src']);\n $mod = expModules::getController($this->params['mod'], $this->params['src']);\n if ($mod != null) {\n $mod->delete_instance(); // delete all assoc items\n $db->delete(\n 'sectionref',\n \"source='\" . $this->params['src'] . \"' and module='\" . $this->params['mod'] . \"'\"\n ); // delete recycle bin holder\n flash('notice', gt('Item removed from Recycle Bin'));\n }\n expHistory::back();\n }", "label": 1, "label_name": "safe"} +{"code": " static function getRSSFeed($url, $cache_duration = DAY_TIMESTAMP) {\n global $CFG_GLPI;\n\n $feed = new SimplePie();\n $feed->set_cache_location(GLPI_RSS_DIR);\n $feed->set_cache_duration($cache_duration);\n\n // proxy support\n if (!empty($CFG_GLPI[\"proxy_name\"])) {\n $prx_opt = [];\n $prx_opt[CURLOPT_PROXY] = $CFG_GLPI[\"proxy_name\"];\n $prx_opt[CURLOPT_PROXYPORT] = $CFG_GLPI[\"proxy_port\"];\n if (!empty($CFG_GLPI[\"proxy_user\"])) {\n $prx_opt[CURLOPT_HTTPAUTH] = CURLAUTH_ANYSAFE;\n $prx_opt[CURLOPT_PROXYUSERPWD] = $CFG_GLPI[\"proxy_user\"].\":\".\n Toolbox::sodiumDecrypt($CFG_GLPI[\"proxy_passwd\"]);\n }\n $feed->set_curl_options($prx_opt);\n }\n\n $feed->enable_cache(true);\n $feed->set_feed_url($url);\n $feed->force_feed(true);\n // Initialize the whole SimplePie object. Read the feed, process it, parse it, cache it, and\n // all that other good stuff. The feed's information will not be available to SimplePie before\n // this is called.\n $feed->init();\n\n // We'll make sure that the right content type and character encoding gets set automatically.\n // This function will grab the proper character encoding, as well as set the content type to text/html.\n $feed->handle_content_type();\n if ($feed->error()) {\n return false;\n }\n return $feed;\n }", "label": 1, "label_name": "safe"} +{"code": "static void *command_init(struct pci_dev *dev, int offset)\n{\n\tstruct pci_cmd_info *cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);\n\tint err;\n\n\tif (!cmd)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\terr = pci_read_config_word(dev, PCI_COMMAND, &cmd->val);\n\tif (err) {\n\t\tkfree(cmd);\n\t\treturn ERR_PTR(err);\n\t}\n\n\treturn cmd;\n}", "label": 1, "label_name": "safe"} +{"code": "func TestPermissions(t *testing.T) {\n\tappCtx := Given(t)\n\tprojName := \"argo-project\"\n\tprojActions := projectFixture.\n\t\tGiven(t).\n\t\tName(projName).\n\t\tWhen().\n\t\tCreate()\n\n\tsourceError := fmt.Sprintf(\"application repo %s is not permitted in project 'argo-project'\", RepoURL(RepoURLTypeFile))\n\tdestinationError := fmt.Sprintf(\"application destination {%s %s} is not permitted in project 'argo-project'\", KubernetesInternalAPIServerAddr, DeploymentNamespace())\n\n\tappCtx.\n\t\tPath(\"guestbook-logs\").\n\t\tProject(projName).\n\t\tWhen().\n\t\tIgnoreErrors().\n\t\t// ensure app is not created if project permissions are missing\n\t\tCreateApp().\n\t\tThen().\n\t\tExpect(Error(\"\", sourceError)).\n\t\tExpect(Error(\"\", destinationError)).\n\t\tWhen().\n\t\tDoNotIgnoreErrors().\n\t\t// add missing permissions, create and sync app\n\t\tAnd(func() {\n\t\t\tprojActions.AddDestination(\"*\", \"*\")\n\t\t\tprojActions.AddSource(\"*\")\n\t\t}).\n\t\tCreateApp().\n\t\tSync().\n\t\tThen().\n\t\t// make sure application resource actiions are successful\n\t\tAnd(func(app *Application) {\n\t\t\tassertResourceActions(t, app.Name, true)\n\t\t}).\n\t\tWhen().\n\t\t// remove projet permissions and \"refresh\" app\n\t\tAnd(func() {\n\t\t\tprojActions.UpdateProject(func(proj *AppProject) {\n\t\t\t\tproj.Spec.Destinations = nil\n\t\t\t\tproj.Spec.SourceRepos = nil\n\t\t\t})\n\t\t}).\n\t\tRefresh(RefreshTypeNormal).\n\t\tThen().\n\t\t// ensure app resource tree is empty when source/destination permissions are missing\n\t\tExpect(Condition(ApplicationConditionInvalidSpecError, destinationError)).\n\t\tExpect(Condition(ApplicationConditionInvalidSpecError, sourceError)).\n\t\tAnd(func(app *Application) {\n\t\t\tcloser, cdClient := ArgoCDClientset.NewApplicationClientOrDie()\n\t\t\tdefer io.Close(closer)\n\t\t\ttree, err := cdClient.ResourceTree(context.Background(), &applicationpkg.ResourcesQuery{ApplicationName: &app.Name})\n\t\t\trequire.NoError(t, err)\n\t\t\tassert.Len(t, tree.Nodes, 0)\n\t\t\tassert.Len(t, tree.OrphanedNodes, 0)\n\t\t}).\n\t\tWhen().\n\t\t// add missing permissions but deny management of Deployment kind\n\t\tAnd(func() {\n\t\t\tprojActions.\n\t\t\t\tAddDestination(\"*\", \"*\").\n\t\t\t\tAddSource(\"*\").\n\t\t\t\tUpdateProject(func(proj *AppProject) {\n\t\t\t\t\tproj.Spec.NamespaceResourceBlacklist = []metav1.GroupKind{{Group: \"*\", Kind: \"Deployment\"}}\n\t\t\t\t})\n\t\t}).\n\t\tRefresh(RefreshTypeNormal).\n\t\tThen().\n\t\t// make sure application resource actiions are failing\n\t\tAnd(func(app *Application) {\n\t\t\tassertResourceActions(t, \"test-permissions\", false)\n\t\t})\n}", "label": 1, "label_name": "safe"} +{"code": "error_t httpClientSetMethod(HttpClientContext *context, const char_t *method)\n{\n size_t m;\n size_t n;\n char_t *p;\n\n //Check parameters\n if(context == NULL || method == NULL)\n return ERROR_INVALID_PARAMETER;\n\n //Compute the length of the HTTP method\n n = osStrlen(method);\n\n //Make sure the length of the user name is acceptable\n if(n == 0 || n > HTTP_CLIENT_MAX_METHOD_LEN)\n return ERROR_INVALID_LENGTH;\n\n //Make sure the buffer contains a valid HTTP request\n if(context->bufferLen > HTTP_CLIENT_BUFFER_SIZE)\n return ERROR_INVALID_SYNTAX;\n\n //Properly terminate the string with a NULL character\n context->buffer[context->bufferLen] = '\\0';\n\n //The Request-Line begins with a method token\n p = osStrchr(context->buffer, ' ');\n //Any parsing error?\n if(p == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Compute the length of the current method token\n m = p - context->buffer;\n\n //Make sure the buffer is large enough to hold the new HTTP request method\n if((context->bufferLen + n - m) > HTTP_CLIENT_BUFFER_SIZE)\n return ERROR_BUFFER_OVERFLOW;\n\n //Make room for the new method token\n osMemmove(context->buffer + n, p, context->bufferLen + 1 - m);\n //Copy the new method token\n osStrncpy(context->buffer, method, n);\n\n //Adjust the length of the request header\n context->bufferLen = context->bufferLen + n - m;\n\n //Save HTTP request method\n osStrcpy(context->method, method);\n\n //Successful processing\n return NO_ERROR;\n}", "label": 1, "label_name": "safe"} +{"code": " it 'should have primary network (10.0.2.0)' do\n expect(subject.call(['10.0.2.0'])).to be_truthy\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public static function isExist($user)\n {\n if (isset($_GET['act']) && $_GET['act'] == 'edit') {\n $id = Typo::int($_GET['id']);\n $where = \"AND `id` != '{$id}' \";\n } else {\n $where = '';\n }\n $user = sprintf('%s', Typo::cleanX($user));\n $sql = sprintf(\"SELECT `userid` FROM `user` WHERE `userid` = '%s' %s \", $user, $where);\n $usr = Db::result($sql);\n $n = Db::$num_rows;\n if ($n > 0) {\n return false;\n } else {\n return true;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus ReluPrepare(TfLiteContext* context, TfLiteNode* node) {\n ReluOpData* data = reinterpret_cast(node->user_data);\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output = GetOutput(context, node, 0);\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);\n\n if (input->type == kTfLiteInt8 || input->type == kTfLiteUInt8) {\n double real_multiplier = input->params.scale / output->params.scale;\n QuantizeMultiplier(real_multiplier, &data->output_multiplier,\n &data->output_shift);\n }\n\n return context->ResizeTensor(context, output,\n TfLiteIntArrayCopy(input->dims));\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\twatchFns: function() {\n\t\tvar result = [];\n\t\tvar fns = this.state.inputs;\n\t\tvar self = this;\n\t\tforEach(fns, function(name) {\n\t\t\tresult.push(\"var \" + name + \"=\" + self.generateFunction(name, \"s\"));\n\t\t});\n\t\tif (fns.length) {\n\t\t\tresult.push(\"fn.inputs=[\" + fns.join(\",\") + \"];\");\n\t\t}\n\t\treturn result.join(\"\");\n\t},", "label": 1, "label_name": "safe"} +{"code": "minimumSearchLength:2});$(\".fc_input_fake label\").click(function(){var a=$(this).prop(\"for\");$(\"#\"+a).val(\"\");searchUsers(\"\")});$(\".ajaxForm\").each(function(){dialog_form($(this))});$(\"a.ajaxLink\").click(function(a){a.preventDefault();a=$(this).prop(\"href\");dialog_ajax(\"Saving\",a,getDatesFromQuerystring(document.URL.split(\"?\")[1]))});$(\"#fc_sidebar_footer, #fc_sidebar\").resizable({handles:\"e\",minWidth:100,start:function(b,e){a=parseInt($(window).width(),10)},resize:function(b,e){$(\"#fc_content_container, #fc_content_footer\").css({width:a-\ne.size.width+\"px\"});$(\"#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content\").css({width:e.size.width+\"px\"});$(\"#fc_add_page\").css({left:e.size.width+\"px\"})},stop:function(a,b){$.cookie(\"sidebar\",b.size.width,{path:\"/\"})}});$(\"#fc_add_page_nav\").find(\"a\").click(function(){var a=$(this);a.hasClass(\"fc_active\")||($(\"#fc_add_page\").find(\".fc_active\").removeClass(\"fc_active\"),a.addClass(\"fc_active\"),a=a.attr(\"href\"),$(a).addClass(\"fc_active\"));return!1});$(\"#fc_footer_info\").on(\"click\",", "label": 0, "label_name": "vulnerable"} +{"code": "function reqSubsystem(chan, name, cb) {\n if (chan.outgoing.state !== 'open') {\n cb(new Error('Channel is not open'));\n return;\n }\n\n chan._callbacks.push((had_err) => {\n if (had_err) {\n cb(had_err !== true\n ? had_err\n : new Error(`Unable to start subsystem: ${name}`));\n return;\n }\n chan.subtype = 'subsystem';\n cb(undefined, chan);\n });\n\n chan._client._protocol.subsystem(chan.outgoing.id, name, true);\n}", "label": 1, "label_name": "safe"} +{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"chomp\")).to eq(\"function_chomp\")\n end", "label": 0, "label_name": "vulnerable"} +{"code": " protected function getUserzoneCookie() \n {\n \treturn null;\n }", "label": 1, "label_name": "safe"} +{"code": " $output = $i === false ? '' : substr($output, 0, $i);\n } elseif ($path === '.' || $path === '..') {\n // Step 2.D\n $path = '';\n } else {\n // Step 2.E\n $i = strpos($path, '/', $path[0] === '/');\n if ($i === false) {\n $output .= $path;\n $path = '';\n break;\n }\n $output .= substr($path, 0, $i);\n $path = substr($path, $i);\n }\n }\n\n if ($path !== '') {\n $message = sprintf(\n 'Unable to remove dot segments; hit loop limit %d (left: %s)',\n $j, var_export($path, true)\n );\n trigger_error($message, E_USER_WARNING);\n }\n\n return $output;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void AvahiService::stop()\n{\n if (resolver) {\n resolver->Free();\n resolver->deleteLater();\n disconnect(resolver, SIGNAL(Found(int,int,const QString &,const QString &,const QString &,const QString &, int, const QString &,ushort,const QList&, uint)),\n this, SLOT(resolved(int,int,const QString &,const QString &,const QString &,const QString &, int, const QString &,ushort, const QList&, uint)));\n disconnect(resolver, SIGNAL(Failure(QString)), this, SLOT(error(QString)));\n resolver=0;\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function offset($value)\n {\n $this->offset = max(0, $value);\n\n return $this;\n }", "label": 1, "label_name": "safe"} +{"code": "static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t struct msghdr *msg, size_t size, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name;\n\tsize_t copied;\n\tstruct sk_buff *skb;\n\tint er;\n\n\t/*\n\t * This works for seqpacket too. The receiver has ordered the queue for\n\t * us! We do one quick check first though\n\t */\n\n\tlock_sock(sk);\n\tif (sk->sk_state != TCP_ESTABLISHED) {\n\t\trelease_sock(sk);\n\t\treturn -ENOTCONN;\n\t}\n\n\t/* Now we can treat all alike */\n\tif ((skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &er)) == NULL) {\n\t\trelease_sock(sk);\n\t\treturn er;\n\t}\n\n\tskb_reset_transport_header(skb);\n\tcopied = skb->len;\n\n\tif (copied > size) {\n\t\tcopied = size;\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t}\n\n\ter = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);\n\tif (er < 0) {\n\t\tskb_free_datagram(sk, skb);\n\t\trelease_sock(sk);\n\t\treturn er;\n\t}\n\n\tif (sax != NULL) {\n\t\tmemset(sax, 0, sizeof(sax));\n\t\tsax->sax25_family = AF_NETROM;\n\t\tskb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call,\n\t\t\t AX25_ADDR_LEN);\n\t}\n\n\tmsg->msg_namelen = sizeof(*sax);\n\n\tskb_free_datagram(sk, skb);\n\n\trelease_sock(sk);\n\treturn copied;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " relatedTypeString: this.translateEntityType(this.entityType),\n iconHtml: this.getIconHtml(this.entityType, this.entityId)\n }, Dep.prototype.data.call(this));\n },\n\n init: function () {\n if (this.getUser().isAdmin()) {\n this.isRemovable = true;\n }\n Dep.prototype.init.call(this);\n },\n\n setup: function () {\n var data = this.model.get('data') || {};\n\n this.entityType = this.model.get('relatedType') || data.entityType || null;\n this.entityId = this.model.get('relatedId') || data.entityId || null;\n this.entityName = this.model.get('relatedName') || data.entityName || null;\n\n this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);\n this.messageData['relatedEntity'] = '' + this.entityName +'';\n\n this.createMessage();\n }\n });\n});", "label": 0, "label_name": "vulnerable"} +{"code": " public SAXReader(boolean validating) {\n this.validating = validating;\n }", "label": 1, "label_name": "safe"} +{"code": "\t\thelp = function() {\n\t\t\t// help tab\n\t\t\thtml.push('
    ');\n\t\t\thtml.push('DON\\'T PANIC');\n\t\t\thtml.push('
    ');\n\t\t\t// end help\n\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function upload($_files , $file_key , $uid , $item_id = 0 , $page_id = 0 ){\n\t\t$uploadFile = $_files[$file_key] ;\n\n\t\tif( !$this->isAllowedFilename($_files[$file_key]['name']) ){\n\t\t\treturn false;\n\t\t}\n\n\t\t$oss_open = D(\"Options\")->get(\"oss_open\" ) ;\n\t\tif ($oss_open) {\n\t\t\t\t$url = $this->uploadOss($uploadFile);\n\t\t\t\tif ($url) {\n\t\t\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign)); \n\t\t\t\t\t return $url ;\n\t\t\t\t}\n\t\t}else{\n\t\t\t$upload = new \\Think\\Upload();// \u5b9e\u4f8b\u5316\u4e0a\u4f20\u7c7b\n\t\t\t$upload->maxSize = 1003145728 ;// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5927\u5c0f\n\t\t\t$upload->rootPath = './../Public/Uploads/';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u76ee\u5f55\n\t\t\t$upload->savePath = '';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5b50\u76ee\u5f55\n\t\t\t$info = $upload->uploadOne($uploadFile) ;\n\t\t\tif(!$info) {// \u4e0a\u4f20\u9519\u8bef\u63d0\u793a\u9519\u8bef\u4fe1\u606f\n\t\t\t\tvar_dump($upload->getError());\n\t\t\t\treturn;\n\t\t\t}else{// \u4e0a\u4f20\u6210\u529f \u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u4fe1\u606f\n\t\t\t\t$url = site_url().'/Public/Uploads/'.$info['savepath'].$info['savename'] ;\n\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t$insert = array(\n\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t);\n\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign));\n\t\t\t\treturn $url ;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct($message = null, \\Exception $previous = null, $code = 0)\n {\n parent::__construct(403, $message, $previous, array(), $code);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tprivate static async Task ResponseTransfer(EAccess access, string botNames, string botNameTo, ulong steamID = 0) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNameTo)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNameTo));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponseTransfer(ProxyAccess(bot, access, steamID), botNameTo))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label": 1, "label_name": "safe"} +{"code": "\tprivate static async Task ResponsePointsBalance(EAccess access, string botNames, ulong steamID = 0) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponsePointsBalance(ProxyAccess(bot, access, steamID)))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label": 1, "label_name": "safe"} +{"code": "FstringParser_ConcatFstring(FstringParser *state, const char **str,\n const char *end, int raw, int recurse_lvl,\n struct compiling *c, const node *n)\n{\n FstringParser_check_invariants(state);\n state->fmode = 1;\n\n /* Parse the f-string. */\n while (1) {\n PyObject *literal = NULL;\n expr_ty expression = NULL;\n\n /* If there's a zero length literal in front of the\n expression, literal will be NULL. If we're at the end of\n the f-string, expression will be NULL (unless result == 1,\n see below). */\n int result = fstring_find_literal_and_expr(str, end, raw, recurse_lvl,\n &literal, &expression,\n c, n);\n if (result < 0)\n return -1;\n\n /* Add the literal, if any. */\n if (!literal) {\n /* Do nothing. Just leave last_str alone (and possibly\n NULL). */\n } else if (!state->last_str) {\n /* Note that the literal can be zero length, if the\n input string is \"\\\\\\n\" or \"\\\\\\r\", among others. */\n state->last_str = literal;\n literal = NULL;\n } else {\n /* We have a literal, concatenate it. */\n assert(PyUnicode_GET_LENGTH(literal) != 0);\n if (FstringParser_ConcatAndDel(state, literal) < 0)\n return -1;\n literal = NULL;\n }\n\n /* We've dealt with the literal now. It can't be leaked on further\n errors. */\n assert(literal == NULL);\n\n /* See if we should just loop around to get the next literal\n and expression, while ignoring the expression this\n time. This is used for un-doubling braces, as an\n optimization. */\n if (result == 1)\n continue;\n\n if (!expression)\n /* We're done with this f-string. */\n break;\n\n /* We know we have an expression. Convert any existing string\n to a Str node. */\n if (!state->last_str) {\n /* Do nothing. No previous literal. */\n } else {\n /* Convert the existing last_str literal to a Str node. */\n expr_ty str = make_str_node_and_del(&state->last_str, c, n);\n if (!str || ExprList_Append(&state->expr_list, str) < 0)\n return -1;\n }\n\n if (ExprList_Append(&state->expr_list, expression) < 0)\n return -1;\n }\n\n /* If recurse_lvl is zero, then we must be at the end of the\n string. Otherwise, we must be at a right brace. */\n\n if (recurse_lvl == 0 && *str < end-1) {\n ast_error(c, n, \"f-string: unexpected end of string\");\n return -1;\n }\n if (recurse_lvl != 0 && **str != '}') {\n ast_error(c, n, \"f-string: expecting '}'\");\n return -1;\n }\n\n FstringParser_check_invariants(state);\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": " error: function(xhr, status, error) {\n if ((status == \"timeout\") || ($.trim(error) == \"timeout\")) {\n /*\n We are not interested in timeout because:\n - it can take minutes to stop a node (resources running on it have\n to be stopped/moved and we do not need to wait for that)\n - if pcs is not able to stop a node it returns an (forceable) error\n immediatelly\n */\n return;\n }\n var message = \"Unable to stop node '\" + node + \" \" + ajax_simple_error(\n xhr, status, error\n );\n if (message.indexOf('--force') == -1) {\n alert(message);\n }\n else {\n message = message.replace(', use --force to override', '');\n if (confirm(message + \"\\n\\nDo you want to force the operation?\")) {\n node_stop(node, true);\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "0,0,80,30,\"ellipse\");e(g)}finally{t.getModel().endUpdate()}if(\"horizontalTree\"==l){var k=new mxCompactTreeLayout(t);k.edgeRouting=!1;k.levelDistance=30;D=\"edgeStyle=elbowEdgeStyle;elbow=horizontal;\"}else\"verticalTree\"==l?(k=new mxCompactTreeLayout(t,!1),k.edgeRouting=!1,k.levelDistance=30,D=\"edgeStyle=elbowEdgeStyle;elbow=vertical;\"):\"radialTree\"==l?(k=new mxRadialTreeLayout(t,!1),k.edgeRouting=!1,k.levelDistance=80):\"verticalFlow\"==l?k=new mxHierarchicalLayout(t,mxConstants.DIRECTION_NORTH):\"horizontalFlow\"==\nl?k=new mxHierarchicalLayout(t,mxConstants.DIRECTION_WEST):\"organic\"==l?(k=new mxFastOrganicLayout(t,!1),k.forceConstant=80):\"circle\"==l&&(k=new mxCircleLayout(t));if(null!=k){var m=function(A,z){t.getModel().beginUpdate();try{null!=A&&A(),k.execute(t.getDefaultParent(),g)}catch(L){throw L;}finally{A=new mxMorphing(t),A.addListener(mxEvent.DONE,mxUtils.bind(this,function(){t.getModel().endUpdate();null!=z&&z()})),A.startAnimation()}},q=mxEdgeHandler.prototype.connect;mxEdgeHandler.prototype.connect=\nfunction(A,z,L,M,n){q.apply(this,arguments);m()};t.resizeCell=function(){mxGraph.prototype.resizeCell.apply(this,arguments);m()};t.connectionHandler.addListener(mxEvent.CONNECT,function(){m()})}var v=mxUtils.button(mxResources.get(\"close\"),function(){b.confirm(mxResources.get(\"areYouSure\"),function(){null!=u.parentNode&&(t.destroy(),u.parentNode.removeChild(u));b.hideDialog()})});v.className=\"geBtn\";b.editor.cancelFirst&&d.appendChild(v);var y=mxUtils.button(mxResources.get(\"insert\"),function(A){t.clearCellOverlays();", "label": 1, "label_name": "safe"} +{"code": " public virtual async Task UploadAsync(UploadCommand cmd, CancellationToken cancellationToken = default)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var uploadResp = new UploadResponse();\n var targetPath = cmd.TargetPath;\n var volume = targetPath.Volume;\n var warning = uploadResp.GetWarnings();\n var warningDetails = uploadResp.GetWarningDetails();\n var setNewParents = new HashSet();\n\n foreach (var uploadPath in cmd.UploadPathInfos.Distinct())\n {\n var directory = uploadPath.Directory;\n string lastParentHash = null;\n\n while (!volume.IsRoot(directory))\n {\n var hash = lastParentHash ?? directory.GetHash(volume, pathParser);\n lastParentHash = directory.GetParentHash(volume, pathParser);\n\n if (!await directory.ExistsAsync && setNewParents.Add(directory))\n uploadResp.added.Add(await directory.ToFileInfoAsync(hash, lastParentHash, volume, connector.Options, cancellationToken: cancellationToken));\n\n directory = directory.Parent;\n }\n }\n\n var uploadCount = cmd.Upload.Count();\n for (var idx = 0; idx < uploadCount; idx++)\n {\n var formFile = cmd.Upload.ElementAt(idx);\n IDirectory dest;\n string destHash;\n\n try\n {\n if (cmd.UploadPath.Count > idx)\n {\n dest = cmd.UploadPathInfos.ElementAt(idx).Directory;\n destHash = cmd.UploadPath[idx];\n }\n else\n {\n dest = targetPath.Directory;\n destHash = targetPath.HashedTarget;\n }\n\n if (!dest.CanCreateObject())\n throw new PermissionDeniedException($\"Permission denied: {volume.GetRelativePath(dest)}\");\n\n string uploadFullName = Path.Combine(dest.FullName, Path.GetFileName(formFile.FileName));\n var uploadFileInfo = new FileSystemFile(uploadFullName, volume);\n var isOverwrite = false;\n\n if (await uploadFileInfo.ExistsAsync)\n {\n if (cmd.Renames.Contains(formFile.FileName))\n {\n var fileNameWithoutExt = Path.GetFileNameWithoutExtension(formFile.FileName);\n var ext = Path.GetExtension(formFile.FileName);\n var backupName = $\"{fileNameWithoutExt}{cmd.Suffix}{ext}\";\n var fullBakName = Path.Combine(uploadFileInfo.Parent.FullName, backupName);\n var bakFile = new FileSystemFile(fullBakName, volume);\n\n if (await bakFile.ExistsAsync)\n backupName = await bakFile.GetCopyNameAsync(cmd.Suffix, cancellationToken: cancellationToken);\n\n var prevName = uploadFileInfo.Name;\n OnBeforeRename?.Invoke(this, (uploadFileInfo, backupName));\n await uploadFileInfo.RenameAsync(backupName, cancellationToken: cancellationToken);\n OnAfterRename?.Invoke(this, (uploadFileInfo, prevName));\n\n uploadResp.added.Add(await uploadFileInfo.ToFileInfoAsync(destHash, volume, pathParser, pictureEditor, videoEditor, cancellationToken: cancellationToken));\n uploadFileInfo = new FileSystemFile(uploadFullName, volume);\n }\n else if (cmd.Overwrite == 0 || (cmd.Overwrite == null && !volume.UploadOverwrite))\n {\n string newName = await uploadFileInfo.GetCopyNameAsync(cmd.Suffix, cancellationToken: cancellationToken);\n uploadFullName = Path.Combine(uploadFileInfo.DirectoryName, newName);\n uploadFileInfo = new FileSystemFile(uploadFullName, volume);\n isOverwrite = false;\n }\n else if (!uploadFileInfo.ObjectAttribute.Write)\n throw new PermissionDeniedException();\n else isOverwrite = true;\n }\n\n OnBeforeUpload?.Invoke(this, (uploadFileInfo, formFile, isOverwrite));\n using (var fileStream = await uploadFileInfo.OpenWriteAsync(cancellationToken: cancellationToken))\n {\n await formFile.CopyToAsync(fileStream, cancellationToken: cancellationToken);\n }\n OnAfterUpload?.Invoke(this, (uploadFileInfo, formFile, isOverwrite));\n\n await uploadFileInfo.RefreshAsync(cancellationToken);\n uploadResp.added.Add(await uploadFileInfo.ToFileInfoAsync(destHash, volume, pathParser, pictureEditor, videoEditor, cancellationToken: cancellationToken));\n }\n catch (Exception ex)\n {\n var rootCause = ex.GetRootCause();\n OnUploadError?.Invoke(this, ex);\n\n if (rootCause is PermissionDeniedException pEx)\n {\n warning.Add(string.IsNullOrEmpty(pEx.Message) ? $\"Permission denied: {formFile.FileName}\" : pEx.Message);\n warningDetails.Add(ErrorResponse.Factory.UploadFile(pEx, formFile.FileName));\n }\n else\n {\n warning.Add($\"Failed to upload: {formFile.FileName}\");\n warningDetails.Add(ErrorResponse.Factory.UploadFile(ex, formFile.FileName));\n }\n }\n }\n\n return uploadResp;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function index($id)\n {\n if (!is_numeric($id)) {\n throw new MethodNotAllowedException(__('No template with the provided ID exists, or you are not authorised to see it.'));\n }\n //check permissions\n $template = $this->TemplateElement->Template->checkAuthorisation($id, $this->Auth->user(), false);\n if (!$this->_isSiteAdmin() && !$template) {\n throw new MethodNotAllowedException(__('No template with the provided ID exists, or you are not authorised to see it.'));\n }\n\n $templateElements = $this->TemplateElement->find('all', array(\n 'conditions' => array(\n 'template_id' => $id,\n ),\n 'contain' => array(\n 'TemplateElementAttribute',\n 'TemplateElementText',\n 'TemplateElementFile'\n ),\n 'order' => array('TemplateElement.position ASC')\n ));\n $this->loadModel('Attribute');\n $this->set('validTypeGroups', $this->Attribute->validTypeGroups);\n $this->set('id', $id);\n $this->layout = 'ajaxTemplate';\n $this->set('elements', $templateElements);\n $mayModify = false;\n if ($this->_isSiteAdmin() || $template['Template']['org'] == $this->Auth->user('Organisation')['name']) {\n $mayModify = true;\n }\n $this->set('mayModify', $mayModify);\n $this->render('ajax/ajaxIndex');\n }", "label": 1, "label_name": "safe"} +{"code": " public function initFromGdResource($resource)\n {\n throw new \\Intervention\\Image\\Exception\\NotSupportedException(\n 'Imagick driver is unable to init from GD resource.'\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static VALUE from_document(VALUE klass, VALUE document)\n{\n xmlDocPtr doc;\n xmlRelaxNGParserCtxtPtr ctx;\n xmlRelaxNGPtr schema;\n VALUE errors;\n VALUE rb_schema;\n\n Data_Get_Struct(document, xmlDoc, doc);\n\n /* In case someone passes us a node. ugh. */\n doc = doc->doc;\n\n ctx = xmlRelaxNGNewDocParserCtxt(doc);\n\n errors = rb_ary_new();\n xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);\n\n#ifdef HAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS\n xmlRelaxNGSetParserStructuredErrors(\n ctx,\n Nokogiri_error_array_pusher,\n (void *)errors\n );\n#endif\n\n schema = xmlRelaxNGParse(ctx);\n\n xmlSetStructuredErrorFunc(NULL, NULL);\n xmlRelaxNGFreeParserCtxt(ctx);\n\n if(NULL == schema) {\n xmlErrorPtr error = xmlGetLastError();\n if(error)\n Nokogiri_error_raise(NULL, error);\n else\n rb_raise(rb_eRuntimeError, \"Could not parse document\");\n\n return Qnil;\n }\n\n rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);\n rb_iv_set(rb_schema, \"@errors\", errors);\n\n return rb_schema;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)\n{\n\tint start = 0;\n\tu32 prev_legacy, cur_legacy;\n\tmutex_lock(&kvm->arch.vpit->pit_state.lock);\n\tprev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tcur_legacy = ps->flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tif (!prev_legacy && cur_legacy)\n\t\tstart = 1;\n\tmemcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,\n\t sizeof(kvm->arch.vpit->pit_state.channels));\n\tkvm->arch.vpit->pit_state.flags = ps->flags;\n\tkvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start);\n\tmutex_unlock(&kvm->arch.vpit->pit_state.lock);\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n auto* params =\n reinterpret_cast(node->builtin_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n TF_LITE_ENSURE_EQ(context, NumDimensions(input), 4);\n\n auto data_type = output->type;\n TF_LITE_ENSURE(context,\n data_type == kTfLiteFloat32 || data_type == kTfLiteUInt8 ||\n data_type == kTfLiteInt8 || data_type == kTfLiteInt32 ||\n data_type == kTfLiteInt64);\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);\n\n const int block_size = params->block_size;\n const int input_height = input->dims->data[1];\n const int input_width = input->dims->data[2];\n int output_height = input_height / block_size;\n int output_width = input_width / block_size;\n\n TF_LITE_ENSURE_EQ(context, input_height, output_height * block_size);\n TF_LITE_ENSURE_EQ(context, input_width, output_width * block_size);\n\n TfLiteIntArray* output_size = TfLiteIntArrayCreate(4);\n output_size->data[0] = input->dims->data[0];\n output_size->data[1] = output_height;\n output_size->data[2] = output_width;\n output_size->data[3] = input->dims->data[3] * block_size * block_size;\n\n return context->ResizeTensor(context, output, output_size);\n}", "label": 1, "label_name": "safe"} +{"code": " function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);\n \n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $record = new optiongroup_master($id); \n assign_to_template(array(\n 'record'=>$record\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *MockCoreStrategy) RefreshTokenSignature(arg0 string) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshTokenSignature\", arg0)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} +{"code": "R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaClassesAttribute *icattr;\n\tRBinJavaAttrInfo *attr = NULL;\n\tRBinJavaCPTypeObj *obj;\n\tut32 i = 0;\n\tut64 offset = 0, curpos;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (buf_offset + offset + 8 > sz) {\n\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\treturn NULL;\n\t}\n\tif (attr == NULL) {\n\t\t// TODO eprintf\n\t\treturn attr;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_INNER_CLASSES_ATTR;\n\tattr->info.inner_classes_attr.number_of_classes = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.inner_classes_attr.classes = r_list_newf (r_bin_java_inner_classes_attr_entry_free);\n\tfor (i = 0; i < attr->info.inner_classes_attr.number_of_classes; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\tif (buf_offset + offset + 8 > sz) {\n\t\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ticattr = R_NEW0 (RBinJavaClassesAttribute);\n\t\tif (!icattr) {\n\t\t\tbreak;\n\t\t}\n\t\ticattr->inner_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->outer_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_class_access_flags = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->flags_str = retrieve_class_method_access_string (icattr->inner_class_access_flags);\n\t\ticattr->file_offset = curpos;\n\t\ticattr->size = 8;\n\n\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_name_idx);\n\t\tif (!obj) {\n\t\t\teprintf (\"BINCPLIS IS HULL %d\\n\", icattr->inner_name_idx);\n\t\t}\n\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\tif (!icattr->name) {\n\t\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_class_info_idx);\n\t\t\tif (!obj) {\n\t\t\t\teprintf (\"BINCPLIST IS NULL %d\\n\", icattr->inner_class_info_idx);\n\t\t\t}\n\t\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\t\tif (!icattr->name) {\n\t\t\t\ticattr->name = r_str_dup (NULL, \"NULL\");\n\t\t\t\teprintf (\"r_bin_java_inner_classes_attr: Unable to find the name for %d index.\\n\", icattr->inner_name_idx);\n\t\t\t\tfree (icattr);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tIFDBG eprintf (\"r_bin_java_inner_classes_attr: Inner class name %d is %s.\\n\", icattr->inner_name_idx, icattr->name);\n\t\tr_list_append (attr->info.inner_classes_attr.classes, (void *) icattr);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_inner_classes_attr_summary(attr);\n\treturn attr;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function argument($key)\n {\n return new \\Intervention\\Image\\Commands\\Argument($this, $key);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " void Compute(OpKernelContext *ctx) override {\n // (0) validations\n const Tensor *a_indices, *b_indices, *a_values_t, *b_values_t, *a_shape,\n *b_shape, *thresh_t;\n\n OP_REQUIRES_OK(ctx, ctx->input(\"a_indices\", &a_indices));\n OP_REQUIRES_OK(ctx, ctx->input(\"b_indices\", &b_indices));\n OP_REQUIRES(ctx,\n TensorShapeUtils::IsMatrix(a_indices->shape()) &&\n TensorShapeUtils::IsMatrix(b_indices->shape()),\n errors::InvalidArgument(\n \"Input indices should be matrices but received shapes: \",\n a_indices->shape().DebugString(), \" and \",\n b_indices->shape().DebugString()));\n const int64 a_nnz = a_indices->dim_size(0);\n const int64 b_nnz = b_indices->dim_size(0);\n\n OP_REQUIRES_OK(ctx, ctx->input(\"a_values\", &a_values_t));\n OP_REQUIRES_OK(ctx, ctx->input(\"b_values\", &b_values_t));\n\n OP_REQUIRES(ctx,\n TensorShapeUtils::IsVector(a_values_t->shape()) &&\n TensorShapeUtils::IsVector(b_values_t->shape()),\n errors::InvalidArgument(\n \"Input values should be vectors but received shapes: \",\n a_values_t->shape().DebugString(), \" and \",\n b_values_t->shape().DebugString()));\n auto a_values = ctx->input(1).vec();\n auto b_values = ctx->input(4).vec();\n OP_REQUIRES(\n ctx, a_values.size() == a_nnz && b_values.size() == b_nnz,\n errors::InvalidArgument(\"Expected \", a_nnz, \" and \", b_nnz,\n \" non-empty input values, got \",\n a_values.size(), \" and \", b_values.size()));\n\n OP_REQUIRES_OK(ctx, ctx->input(\"a_shape\", &a_shape));\n OP_REQUIRES_OK(ctx, ctx->input(\"b_shape\", &b_shape));\n OP_REQUIRES(ctx,\n TensorShapeUtils::IsVector(a_shape->shape()) &&\n TensorShapeUtils::IsVector(b_shape->shape()),\n errors::InvalidArgument(\n \"Input shapes should be a vector but received shapes \",\n a_shape->shape().DebugString(), \" and \",\n b_shape->shape().DebugString()));\n OP_REQUIRES(\n ctx, a_shape->IsSameSize(*b_shape),\n errors::InvalidArgument(\n \"Operands do not have the same ranks; got shapes: \",\n a_shape->SummarizeValue(10), \" and \", b_shape->SummarizeValue(10)));\n const auto a_shape_flat = a_shape->flat();\n const auto b_shape_flat = b_shape->flat();\n for (int i = 0; i < a_shape->NumElements(); ++i) {\n OP_REQUIRES(ctx, a_shape_flat(i) == b_shape_flat(i),\n errors::InvalidArgument(\n \"Operands' shapes do not match: got \", a_shape_flat(i),\n \" and \", b_shape_flat(i), \" for dimension \", i));\n }\n\n OP_REQUIRES_OK(ctx, ctx->input(\"thresh\", &thresh_t));\n OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(thresh_t->shape()),\n errors::InvalidArgument(\n \"The magnitude threshold must be a scalar: got shape \",\n thresh_t->shape().DebugString()));\n // std::abs() so that it works for complex{64,128} values as well\n const Treal thresh = thresh_t->scalar()();\n\n // (1) do a pass over inputs, and append values and indices to vectors\n auto a_indices_mat = a_indices->matrix();\n auto b_indices_mat = b_indices->matrix();\n std::vector> entries_to_copy; // from_a?, idx\n entries_to_copy.reserve(a_nnz + b_nnz);\n std::vector out_values;\n const int num_dims = a_shape->dim_size(0);\n\n OP_REQUIRES(ctx, num_dims > 0,\n errors::InvalidArgument(\"Invalid input_a shape. Received: \",\n a_shape->DebugString()));\n\n // The input and output sparse tensors are assumed to be ordered along\n // increasing dimension number.\n int64 i = 0, j = 0;\n T s;\n while (i < a_nnz && j < b_nnz) {\n switch (sparse::DimComparator::cmp(a_indices_mat, b_indices_mat, i, j,\n num_dims)) {\n case -1:\n entries_to_copy.emplace_back(true, i);\n out_values.push_back(a_values(i));\n ++i;\n break;\n case 0:\n s = a_values(i) + b_values(j);\n if (thresh <= std::abs(s)) {\n entries_to_copy.emplace_back(true, i);\n out_values.push_back(s);\n }\n ++i;\n ++j;\n break;\n case 1:\n entries_to_copy.emplace_back(false, j);\n out_values.push_back(b_values(j));\n ++j;\n break;\n }\n }\n\n#define HANDLE_LEFTOVERS(A_OR_B, IDX, IS_A) \\\n while (IDX < A_OR_B##_nnz) { \\\n entries_to_copy.emplace_back(IS_A, IDX); \\\n out_values.push_back(A_OR_B##_values(IDX)); \\\n ++IDX; \\\n }\n\n // at most one of these calls appends new values\n HANDLE_LEFTOVERS(a, i, true);\n HANDLE_LEFTOVERS(b, j, false);\n#undef HANDLE_LEFTOVERS\n\n // (2) allocate and fill output tensors\n const int64 sum_nnz = out_values.size();\n Tensor *out_indices_t, *out_values_t;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(0, TensorShape({sum_nnz, num_dims}),\n &out_indices_t));\n OP_REQUIRES_OK(\n ctx, ctx->allocate_output(1, TensorShape({sum_nnz}), &out_values_t));\n auto out_indices_mat = out_indices_t->matrix();\n auto out_values_flat = out_values_t->vec();\n\n for (i = 0; i < sum_nnz; ++i) {\n const bool from_a = entries_to_copy[i].first;\n const int64 idx = entries_to_copy[i].second;\n out_indices_mat.chip<0>(i) =\n from_a ? a_indices_mat.chip<0>(idx) : b_indices_mat.chip<0>(idx);\n }\n if (sum_nnz > 0) {\n std::copy_n(out_values.begin(), sum_nnz, &out_values_flat(0));\n }\n ctx->set_output(2, *a_shape);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,\n int swap, uint32_t namesz, uint32_t descsz,\n size_t noff, size_t doff, int *flags, size_t size, int clazz)\n{\n#ifdef ELFCORE\n\tint os_style = -1;\n\t/*\n\t * Sigh. The 2.0.36 kernel in Debian 2.1, at\n\t * least, doesn't correctly implement name\n\t * sections, in core dumps, as specified by\n\t * the \"Program Linking\" section of \"UNIX(R) System\n\t * V Release 4 Programmer's Guide: ANSI C and\n\t * Programming Support Tools\", because my copy\n\t * clearly says \"The first 'namesz' bytes in 'name'\n\t * contain a *null-terminated* [emphasis mine]\n\t * character representation of the entry's owner\n\t * or originator\", but the 2.0.36 kernel code\n\t * doesn't include the terminating null in the\n\t * name....\n\t */\n\tif ((namesz == 4 && strncmp((char *)&nbuf[noff], \"CORE\", 4) == 0) ||\n\t (namesz == 5 && strcmp((char *)&nbuf[noff], \"CORE\") == 0)) {\n\t\tos_style = OS_STYLE_SVR4;\n\t}\n\n\tif ((namesz == 8 && strcmp((char *)&nbuf[noff], \"FreeBSD\") == 0)) {\n\t\tos_style = OS_STYLE_FREEBSD;\n\t}\n\n\tif ((namesz >= 11 && strncmp((char *)&nbuf[noff], \"NetBSD-CORE\", 11)\n\t == 0)) {\n\t\tos_style = OS_STYLE_NETBSD;\n\t}\n\n\tif (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {\n\t\tif (file_printf(ms, \", %s-style\", os_style_names[os_style])\n\t\t == -1)\n\t\t\treturn 1;\n\t\t*flags |= FLAGS_DID_CORE_STYLE;\n\t\t*flags |= os_style;\n\t}\n\n\tswitch (os_style) {\n\tcase OS_STYLE_NETBSD:\n\t\tif (type == NT_NETBSD_CORE_PROCINFO) {\n\t\t\tchar sbuf[512];\n\t\t\tstruct NetBSD_elfcore_procinfo pi;\n\t\t\tmemset(&pi, 0, sizeof(pi));\n\t\t\tmemcpy(&pi, nbuf + doff, descsz);\n\n\t\t\tif (file_printf(ms, \", from '%.31s', pid=%u, uid=%u, \"\n\t\t\t \"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)\",\n\t\t\t file_printable(sbuf, sizeof(sbuf),\n\t\t\t RCAST(char *, pi.cpi_name)),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_pid),\n\t\t\t elf_getu32(swap, pi.cpi_euid),\n\t\t\t elf_getu32(swap, pi.cpi_egid),\n\t\t\t elf_getu32(swap, pi.cpi_nlwps),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_siglwp),\n\t\t\t elf_getu32(swap, pi.cpi_signo),\n\t\t\t elf_getu32(swap, pi.cpi_sigcode)) == -1)\n\t\t\t\treturn 1;\n\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\treturn 1;\n\t\t}\n\t\tbreak;\n\n\tcase OS_STYLE_FREEBSD:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t argoff, pidoff;\n\n\t\t\tif (clazz == ELFCLASS32)\n\t\t\t\targoff = 4 + 4 + 17;\n\t\t\telse\n\t\t\t\targoff = 4 + 4 + 8 + 17;\n\t\t\tif (file_printf(ms, \", from '%.80s'\", nbuf + doff +\n\t\t\t argoff) == -1)\n\t\t\t\treturn 1;\n\t\t\tpidoff = argoff + 81 + 2;\n\t\t\tif (doff + pidoff + 4 <= size) {\n\t\t\t\tif (file_printf(ms, \", pid=%u\",\n\t\t\t\t elf_getu32(swap, *RCAST(uint32_t *, (nbuf +\n\t\t\t\t doff + pidoff)))) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t}\t\t\t \n\t\tbreak;\n\n\tdefault:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t i, j;\n\t\t\tunsigned char c;\n\t\t\t/*\n\t\t\t * Extract the program name. We assume\n\t\t\t * it to be 16 characters (that's what it\n\t\t\t * is in SunOS 5.x and Linux).\n\t\t\t *\n\t\t\t * Unfortunately, it's at a different offset\n\t\t\t * in various OSes, so try multiple offsets.\n\t\t\t * If the characters aren't all printable,\n\t\t\t * reject it.\n\t\t\t */\n\t\t\tfor (i = 0; i < NOFFSETS; i++) {\n\t\t\t\tunsigned char *cname, *cp;\n\t\t\t\tsize_t reloffset = prpsoffsets(i);\n\t\t\t\tsize_t noffset = doff + reloffset;\n\t\t\t\tsize_t k;\n\t\t\t\tfor (j = 0; j < 16; j++, noffset++,\n\t\t\t\t reloffset++) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the buffer; if\n\t\t\t\t\t * we are, just give up.\n\t\t\t\t\t */\n\t\t\t\t\tif (noffset >= size)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the contents;\n\t\t\t\t\t * if we are, this obviously\n\t\t\t\t\t * isn't the right offset.\n\t\t\t\t\t */\n\t\t\t\t\tif (reloffset >= descsz)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\tc = nbuf[noffset];\n\t\t\t\t\tif (c == '\\0') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A '\\0' at the\n\t\t\t\t\t\t * beginning is\n\t\t\t\t\t\t * obviously wrong.\n\t\t\t\t\t\t * Any other '\\0'\n\t\t\t\t\t\t * means we're done.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (j == 0)\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A nonprintable\n\t\t\t\t\t\t * character is also\n\t\t\t\t\t\t * wrong.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!isprint(c) || isquote(c))\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Well, that worked.\n\t\t\t\t */\n\n\t\t\t\t/*\n\t\t\t\t * Try next offsets, in case this match is\n\t\t\t\t * in the middle of a string.\n\t\t\t\t */\n\t\t\t\tfor (k = i + 1 ; k < NOFFSETS; k++) {\n\t\t\t\t\tsize_t no;\n\t\t\t\t\tint adjust = 1;\n\t\t\t\t\tif (prpsoffsets(k) >= prpsoffsets(i))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (no = doff + prpsoffsets(k);\n\t\t\t\t\t no < doff + prpsoffsets(i); no++)\n\t\t\t\t\t\tadjust = adjust\n\t\t\t\t\t\t && isprint(nbuf[no]);\n\t\t\t\t\tif (adjust)\n\t\t\t\t\t\ti = k;\n\t\t\t\t}\n\n\t\t\t\tcname = (unsigned char *)\n\t\t\t\t &nbuf[doff + prpsoffsets(i)];\n\t\t\t\tfor (cp = cname; cp < nbuf + size && *cp\n\t\t\t\t && isprint(*cp); cp++)\n\t\t\t\t\tcontinue;\n\t\t\t\t/*\n\t\t\t\t * Linux apparently appends a space at the end\n\t\t\t\t * of the command line: remove it.\n\t\t\t\t */\n\t\t\t\twhile (cp > cname && isspace(cp[-1]))\n\t\t\t\t\tcp--;\n\t\t\t\tif (file_printf(ms, \", from '%.*s'\",\n\t\t\t\t (int)(cp - cname), cname) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\t\treturn 1;\n\n\t\t\ttryanother:\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n#endif\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "template void testFeatTable(const T & table, const char * testName)\n{\n FeatureMap testFeatureMap;\n dummyFace.replace_table(TtfUtil::Tag::Feat, &table, sizeof(T));\n gr_face * face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, 0);\n if (!face) throw std::runtime_error(\"failed to load font\");\n bool readStatus = testFeatureMap.readFeats(*face);\n testAssert(\"readFeats\", readStatus);\n fprintf(stderr, testName, NULL);\n testAssertEqual(\"test num features %hu,%hu\\n\", testFeatureMap.numFeats(), table.m_header.m_numFeat);\n\n for (size_t i = 0; i < sizeof(table.m_defs) / sizeof(FeatDefn); i++)\n {\n const FeatureRef * ref = testFeatureMap.findFeatureRef(table.m_defs[i].m_featId);\n testAssert(\"test feat\\n\", ref);\n testAssertEqual(\"test feat settings %hu %hu\\n\", ref->getNumSettings(), table.m_defs[i].m_numFeatSettings);\n testAssertEqual(\"test feat label %hu %hu\\n\", ref->getNameId(), table.m_defs[i].m_label);\n size_t settingsIndex = (table.m_defs[i].m_settingsOffset - sizeof(FeatHeader)\n - (sizeof(FeatDefn) * table.m_header.m_numFeat)) / sizeof(FeatSetting);\n for (size_t j = 0; j < table.m_defs[i].m_numFeatSettings; j++)\n {\n testAssertEqual(\"setting label %hu %hu\\n\", ref->getSettingName(j),\n table.m_settings[settingsIndex+j].m_label);\n }\n }\n gr_face_destroy(face);\n}", "label": 1, "label_name": "safe"} +{"code": "\tpub fn generate_web_proxy_access_token(&self) -> String {\n\t\tlet token = random_string(16);\n\t\tlet mut tokens = self.web_proxy_tokens.lock();\n\t\ttokens.prune();\n\t\ttokens.insert(token.clone(), ());\n\t\ttoken\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public void testWhitespaceInTransferEncoding02() {\n String requestStr = \"POST / HTTP/1.1\" +\n \"Transfer-Encoding : chunked\\r\\n\" +\n \"Host: target.com\" +\n \"Content-Length: 65\\r\\n\\r\\n\" +\n \"0\\r\\n\\r\\n\" +\n \"GET /maliciousRequest HTTP/1.1\\r\\n\" +\n \"Host: evilServer.com\\r\\n\" +\n \"Foo: x\";\n testInvalidHeaders0(requestStr);\n }", "label": 1, "label_name": "safe"} +{"code": "\tpublic GroupXStream() {\n\t\txstream = XStreamHelper.createXStreamInstance();\n\t\t\n\t\tXStream.setupDefaultSecurity(xstream);\n\t\tClass[] types = new Class[] {\n\t\t\t\tCollabTools.class, Group.class, Area.class, AreaCollection.class, GroupCollection.class,\n\t\t\t\tOLATGroupExport.class, ArrayList.class\n\t\t};\n\t\txstream.addPermission(new ExplicitTypePermission(types));\n\t\t\n\t\txstream.alias(\"OLATGroupExport\", OLATGroupExport.class);\n\t\txstream.alias(\"AreaCollection\", AreaCollection.class);\n\t\txstream.alias(\"GroupCollection\", GroupCollection.class);\n\n\t\txstream.addImplicitCollection(AreaCollection.class, \"groups\", \"Area\", Area.class);\n\t\txstream.addImplicitCollection(GroupCollection.class, \"groups\", \"Group\", Group.class);\n\t\t\n\t\txstream.aliasAttribute(OLATGroupExport.class, \"areas\", \"AreaCollection\");\n\t\txstream.aliasAttribute(OLATGroupExport.class, \"groups\", \"GroupCollection\");\n\n\t\txstream.alias(\"Area\", Area.class);\n\t\txstream.aliasAttribute(Area.class, \"name\", \"name\");\n\t\txstream.aliasAttribute(Area.class, \"key\", \"key\");\n\t\txstream.addImplicitCollection(Area.class, \"description\", \"Description\", String.class);\n\t\txstream.aliasAttribute(Area.class, \"description\", \"description\");\n\n\t\txstream.alias(\"Group\", Group.class);\n\t\txstream.alias(\"CollabTools\", CollabTools.class);\n\t\txstream.addImplicitCollection(Group.class, \"areaRelations\", \"AreaRelation\", String.class);\n\t\txstream.addImplicitCollection(Group.class, \"description\", \"Description\", String.class);\n\t\txstream.aliasAttribute(Group.class, \"key\", \"key\");\n\t\txstream.aliasAttribute(Group.class, \"name\", \"name\");\n\t\txstream.aliasAttribute(Group.class, \"maxParticipants\", \"maxParticipants\");\n\t\txstream.aliasAttribute(Group.class, \"minParticipants\", \"minParticipants\");\n\t\txstream.aliasAttribute(Group.class, \"waitingList\", \"waitingList\");\n\t\txstream.aliasAttribute(Group.class, \"autoCloseRanks\", \"autoCloseRanks\");\n\t\txstream.aliasAttribute(Group.class, \"showOwners\", \"showOwners\");\n\t\txstream.aliasAttribute(Group.class, \"showParticipants\", \"showParticipants\");\n\t\txstream.aliasAttribute(Group.class, \"showWaitingList\", \"showWaitingList\");\n\t\txstream.aliasAttribute(Group.class, \"description\", \"description\");\n\t\txstream.aliasAttribute(Group.class, \"info\", \"info\");\n\t\txstream.aliasAttribute(Group.class, \"folderAccess\", \"folderAccess\");\n\t\t\n\t\t//CollabTools\n\t\txstream.aliasAttribute(Group.class, \"tools\", \"CollabTools\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasNews\", \"hasNews\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasContactForm\", \"hasContactForm\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasCalendar\", \"hasCalendar\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasFolder\", \"hasFolder\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasForum\", \"hasForum\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasChat\", \"hasChat\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasWiki\", \"hasWiki\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasPortfolio\", \"hasPortfolio\");\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testWrongPdoErrMode()\n {\n $pdo = new \\PDO('sqlite::memory:');\n $pdo->setAttribute(\\PDO::ATTR_ERRMODE, \\PDO::ERRMODE_SILENT);\n $pdo->exec('CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)');\n\n $this->setExpectedException('InvalidArgumentException');\n $storage = new LegacyPdoSessionHandler($pdo, array('db_table' => 'sessions'));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\"dblclick\",function(La){n();mxEvent.consume(La)})}else if(!ja&&null!=pa&&0startingChars;\n }", "label": 1, "label_name": "safe"} +{"code": "static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n buffer[MagickPathExtent],\n name[MagickPathExtent];\n\n Image\n *image;\n\n int\n c;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i,\n x;\n\n register Quantum\n *q;\n\n register unsigned char\n *p;\n\n short int\n hex_digits[256];\n\n ssize_t\n y;\n\n unsigned char\n *data;\n\n unsigned int\n bit,\n byte,\n bytes_per_line,\n height,\n length,\n padding,\n version,\n width;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read X bitmap header.\n */\n width=0;\n height=0;\n while (ReadBlobString(image,buffer) != (char *) NULL)\n if (sscanf(buffer,\"#define %32s %u\",name,&width) == 2)\n if ((strlen(name) >= 6) &&\n (LocaleCompare(name+strlen(name)-6,\"_width\") == 0))\n break;\n while (ReadBlobString(image,buffer) != (char *) NULL)\n if (sscanf(buffer,\"#define %32s %u\",name,&height) == 2)\n if ((strlen(name) >= 7) &&\n (LocaleCompare(name+strlen(name)-7,\"_height\") == 0))\n break;\n image->columns=width;\n image->rows=height;\n image->depth=8;\n image->storage_class=PseudoClass;\n image->colors=2;\n /*\n Scan until hex digits.\n */\n version=11;\n while (ReadBlobString(image,buffer) != (char *) NULL)\n {\n if (sscanf(buffer,\"static short %32s = {\",name) == 1)\n version=10;\n else\n if (sscanf(buffer,\"static unsigned char %32s = {\",name) == 1)\n version=11;\n else\n if (sscanf(buffer,\"static char %32s = {\",name) == 1)\n version=11;\n else\n continue;\n p=(unsigned char *) strrchr(name,'_');\n if (p == (unsigned char *) NULL)\n p=(unsigned char *) name;\n else\n p++;\n if (LocaleCompare(\"bits[]\",(char *) p) == 0)\n break;\n }\n if ((image->columns == 0) || (image->rows == 0) ||\n (EOFBlob(image) != MagickFalse))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Initialize image structure.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Initialize colormap.\n */\n image->colormap[0].red=(MagickRealType) QuantumRange;\n image->colormap[0].green=(MagickRealType) QuantumRange;\n image->colormap[0].blue=(MagickRealType) QuantumRange;\n image->colormap[1].red=0.0;\n image->colormap[1].green=0.0;\n image->colormap[1].blue=0.0;\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Initialize hex values.\n */\n hex_digits[(int) '0']=0;\n hex_digits[(int) '1']=1;\n hex_digits[(int) '2']=2;\n hex_digits[(int) '3']=3;\n hex_digits[(int) '4']=4;\n hex_digits[(int) '5']=5;\n hex_digits[(int) '6']=6;\n hex_digits[(int) '7']=7;\n hex_digits[(int) '8']=8;\n hex_digits[(int) '9']=9;\n hex_digits[(int) 'A']=10;\n hex_digits[(int) 'B']=11;\n hex_digits[(int) 'C']=12;\n hex_digits[(int) 'D']=13;\n hex_digits[(int) 'E']=14;\n hex_digits[(int) 'F']=15;\n hex_digits[(int) 'a']=10;\n hex_digits[(int) 'b']=11;\n hex_digits[(int) 'c']=12;\n hex_digits[(int) 'd']=13;\n hex_digits[(int) 'e']=14;\n hex_digits[(int) 'f']=15;\n hex_digits[(int) 'x']=0;\n hex_digits[(int) ' ']=(-1);\n hex_digits[(int) ',']=(-1);\n hex_digits[(int) '}']=(-1);\n hex_digits[(int) '\\n']=(-1);\n hex_digits[(int) '\\t']=(-1);\n /*\n Read hex image data.\n */\n padding=0;\n if (((image->columns % 16) != 0) && ((image->columns % 16) < 9) &&\n (version == 10))\n padding=1;\n bytes_per_line=(unsigned int) (image->columns+7)/8+padding;\n length=(unsigned int) image->rows;\n data=(unsigned char *) AcquireQuantumMemory(length,bytes_per_line*\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n if (version == 10)\n for (i=0; i < (ssize_t) (bytes_per_line*image->rows); (i+=2))\n {\n c=XBMInteger(image,hex_digits);\n if (c < 0)\n break;\n *p++=(unsigned char) c;\n if ((padding == 0) || (((i+2) % bytes_per_line) != 0))\n *p++=(unsigned char) (c >> 8);\n }\n else\n for (i=0; i < (ssize_t) (bytes_per_line*image->rows); i++)\n {\n c=XBMInteger(image,hex_digits);\n if (c < 0)\n break;\n *p++=(unsigned char) c;\n }\n if (EOFBlob(image) != MagickFalse)\n {\n data=(unsigned char *) RelinquishMagickMemory(data);\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n }\n /*\n Convert X bitmap image to pixel packets.\n */\n p=data;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n bit=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (bit == 0)\n byte=(unsigned int) (*p++);\n SetPixelIndex(image,(Quantum) ((byte & 0x01) != 0 ? 0x01 : 0x00),q);\n bit++;\n byte>>=1;\n if (bit == 8)\n bit=0;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n data=(unsigned char *) RelinquishMagickMemory(data);\n (void) SyncImage(image,exception);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}", "label": 1, "label_name": "safe"} +{"code": " _resolvePath(path = '.') {\n const clientPath = (() => {\n path = nodePath.normalize(path);\n if (nodePath.isAbsolute(path)) {\n return nodePath.join(path);\n } else {\n return nodePath.join(this.cwd, path);\n }\n })();\n\n const fsPath = (() => {\n const resolvedPath = nodePath.join(this.root, clientPath);\n return nodePath.resolve(nodePath.normalize(nodePath.join(resolvedPath)));\n })();\n\n return {\n clientPath,\n fsPath\n };\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void jas_matrix_asl(jas_matrix_t *matrix, int n)\n{\n\tjas_matind_t i;\n\tjas_matind_t j;\n\tjas_seqent_t *rowstart;\n\tjas_matind_t rowstep;\n\tjas_seqent_t *data;\n\n\tif (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {\n\t\tassert(matrix->rows_);\n\t\trowstep = jas_matrix_rowstep(matrix);\n\t\tfor (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,\n\t\t rowstart += rowstep) {\n\t\t\tfor (j = matrix->numcols_, data = rowstart; j > 0; --j,\n\t\t\t ++data) {\n\t\t\t\t//*data <<= n;\n\t\t\t\t*data = jas_seqent_asl(*data, n);\n\t\t\t}\n\t\t}\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " it 'should have loopback (lo)' do\n expect(subject.call(['lo'])).to be_truthy\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static int ax25_create(struct net *net, struct socket *sock, int protocol,\n\t\t int kern)\n{\n\tstruct sock *sk;\n\tax25_cb *ax25;\n\n\tif (protocol < 0 || protocol > SK_PROTOCOL_MAX)\n\t\treturn -EINVAL;\n\n\tif (!net_eq(net, &init_net))\n\t\treturn -EAFNOSUPPORT;\n\n\tswitch (sock->type) {\n\tcase SOCK_DGRAM:\n\t\tif (protocol == 0 || protocol == PF_AX25)\n\t\t\tprotocol = AX25_P_TEXT;\n\t\tbreak;\n\n\tcase SOCK_SEQPACKET:\n\t\tswitch (protocol) {\n\t\tcase 0:\n\t\tcase PF_AX25:\t/* For CLX */\n\t\t\tprotocol = AX25_P_TEXT;\n\t\t\tbreak;\n\t\tcase AX25_P_SEGMENT:\n#ifdef CONFIG_INET\n\t\tcase AX25_P_ARP:\n\t\tcase AX25_P_IP:\n#endif\n#ifdef CONFIG_NETROM\n\t\tcase AX25_P_NETROM:\n#endif\n#ifdef CONFIG_ROSE\n\t\tcase AX25_P_ROSE:\n#endif\n\t\t\treturn -ESOCKTNOSUPPORT;\n#ifdef CONFIG_NETROM_MODULE\n\t\tcase AX25_P_NETROM:\n\t\t\tif (ax25_protocol_is_registered(AX25_P_NETROM))\n\t\t\t\treturn -ESOCKTNOSUPPORT;\n\t\t\tbreak;\n#endif\n#ifdef CONFIG_ROSE_MODULE\n\t\tcase AX25_P_ROSE:\n\t\t\tif (ax25_protocol_is_registered(AX25_P_ROSE))\n\t\t\t\treturn -ESOCKTNOSUPPORT;\n#endif\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\n\tcase SOCK_RAW:\n\t\tbreak;\n\tdefault:\n\t\treturn -ESOCKTNOSUPPORT;\n\t}\n\n\tsk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto, kern);\n\tif (sk == NULL)\n\t\treturn -ENOMEM;\n\n\tax25 = ax25_sk(sk)->cb = ax25_create_cb();\n\tif (!ax25) {\n\t\tsk_free(sk);\n\t\treturn -ENOMEM;\n\t}\n\n\tsock_init_data(sock, sk);\n\n\tsk->sk_destruct = ax25_free_sock;\n\tsock->ops = &ax25_proto_ops;\n\tsk->sk_protocol = protocol;\n\n\tax25->sk = sk;\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "void RemoteFsDevice::mount()\n{\n if (details.isLocalFile()) {\n return;\n }\n if (isConnected() || proc) {\n return;\n }\n\n if (messageSent) {\n return;\n }\n if (constSambaAvahiProtocol==details.url.scheme()) {\n Details det=details;\n AvahiService *srv=Avahi::self()->getService(det.serviceName);\n if (!srv || srv->getHost().isEmpty() || 0==srv->getPort()) {\n emit error(tr(\"Failed to resolve connection details for %1\").arg(details.name));\n return;\n }\n if (constPromptPassword==det.url.password()) {\n bool ok=false;\n QString passwd=InputDialog::getPassword(QString(), &ok, QApplication::activeWindow());\n if (!ok) {\n return;\n }\n det.url.setPassword(passwd);\n }\n det.url.setScheme(constSambaProtocol);\n det.url.setHost(srv->getHost());\n det.url.setPort(srv->getPort());\n mounter()->mount(det.url.toString(), mountPoint(details, true), getuid(), getgid(), getpid());\n setStatusMessage(tr(\"Connecting...\"));\n messageSent=true;\n return;\n }\n if (constSambaProtocol==details.url.scheme()) {\n Details det=details;\n if (constPromptPassword==det.url.password()) {\n bool ok=false;\n QString passwd=InputDialog::getPassword(QString(), &ok, QApplication::activeWindow());\n if (!ok) {\n return;\n }\n det.url.setPassword(passwd);\n }\n mounter()->mount(det.url.toString(), mountPoint(details, true), getuid(), getgid(), getpid());\n setStatusMessage(tr(\"Connecting...\"));\n messageSent=true;\n return;\n }\n\n QString cmd;\n QStringList args;\n QString askPass;\n if (!details.isLocalFile() && !details.isEmpty()) {\n // If user has added 'IdentityFile' to extra options, then no password prompting is required...\n bool needAskPass=!details.extraOptions.contains(\"IdentityFile=\");\n\n if (needAskPass) {\n QStringList askPassList;\n if (Utils::KDE==Utils::currentDe()) {\n askPassList << QLatin1String(\"ksshaskpass\") << QLatin1String(\"ssh-askpass\") << QLatin1String(\"ssh-askpass-gnome\");\n } else {\n askPassList << QLatin1String(\"ssh-askpass-gnome\") << QLatin1String(\"ssh-askpass\") << QLatin1String(\"ksshaskpass\");\n }\n\n for (const QString &ap: askPassList) {\n askPass=Utils::findExe(ap);\n if (!askPass.isEmpty()) {\n break;\n }\n }\n\n if (askPass.isEmpty()) {\n emit error(tr(\"No suitable ssh-askpass application installed! This is required for entering passwords.\"));\n return;\n }\n }\n QString sshfs=Utils::findExe(\"sshfs\");\n if (sshfs.isEmpty()) {\n emit error(tr(\"\\\"sshfs\\\" is not installed!\"));\n return;\n }\n cmd=Utils::findExe(\"setsid\");\n if (!cmd.isEmpty()) {\n QString mp=mountPoint(details, true);\n if (mp.isEmpty()) {\n emit error(\"Failed to determine mount point\"); // TODO: 2.4 make translatable. For now, error should never happen!\n }\n if (!QDir(mp).entryList(QDir::NoDot|QDir::NoDotDot|QDir::AllEntries|QDir::Hidden).isEmpty()) {\n emit error(tr(\"Mount point (\\\"%1\\\") is not empty!\").arg(mp));\n return;\n }\n\n args << sshfs << details.url.userName()+QChar('@')+details.url.host()+QChar(':')+details.url.path()<< QLatin1String(\"-p\")\n << QString::number(details.url.port()) << mountPoint(details, true)\n << QLatin1String(\"-o\") << QLatin1String(\"ServerAliveInterval=15\");\n //<< QLatin1String(\"-o\") << QLatin1String(\"Ciphers=arcfour\");\n if (!details.extraOptions.isEmpty()) {\n args << details.extraOptions.split(' ', QString::SkipEmptyParts);\n }\n } else {\n emit error(tr(\"\\\"sshfs\\\" is not installed!\").replace(\"sshfs\", \"setsid\")); // TODO: 2.4 use correct string!\n }\n }\n\n if (!cmd.isEmpty()) {\n setStatusMessage(tr(\"Connecting...\"));\n proc=new QProcess(this);\n proc->setProperty(\"mount\", true);\n\n if (!askPass.isEmpty()) {\n QProcessEnvironment env = QProcessEnvironment::systemEnvironment();\n env.insert(\"SSH_ASKPASS\", askPass);\n proc->setProcessEnvironment(env);\n }\n connect(proc, SIGNAL(finished(int)), SLOT(procFinished(int)));\n proc->start(cmd, args, QIODevice::ReadOnly);\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static inline size_t GetPSDRowSize(Image *image)\n{\n if (image->depth == 1)\n return((image->columns+7)/8);\n else\n return(image->columns*GetPSDPacketSize(image));\n}", "label": 0, "label_name": "vulnerable"} +{"code": "P)this.editPlantUmlData(D,G,P);else if(P=this.graph.getAttributeForCell(D,\"mermaidData\"),null!=P)this.editMermaidData(D,G,P);else{var K=g.getCellStyle(D);\"1\"==mxUtils.getValue(K,\"metaEdit\",\"0\")?d.showDataDialog(D):k.apply(this,arguments)}}catch(F){d.handleError(F)}};g.getLinkTitle=function(D){return d.getLinkTitle(D)};g.customLinkClicked=function(D){var G=!1;try{d.handleCustomLink(D),G=!0}catch(P){d.handleError(P)}return G};var l=g.parseBackgroundImage;g.parseBackgroundImage=function(D){var G=l.apply(this,", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic void testSelectByOperationsNotSpecifiedOrSign() {\n\n\t\tJWKSelector selector = new JWKSelector(new JWKMatcher.Builder().keyOperations(KeyOperation.SIGN, null).build());\n\n\t\tList keyList = new ArrayList<>();\n\t\tkeyList.add(new RSAKey.Builder(new Base64URL(\"n\"), new Base64URL(\"e\")).keyID(\"1\")\n\t\t\t.keyOperations(new HashSet<>(Collections.singletonList(KeyOperation.SIGN))).build());\n\t\tkeyList.add(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID(\"2\").build());\n\t\tkeyList.add(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID(\"3\")\n\t\t\t.keyOperations(new HashSet<>(Collections.singletonList(KeyOperation.ENCRYPT))).build());\n\n\t\tJWKSet jwkSet = new JWKSet(keyList);\n\n\t\tList matches = selector.select(jwkSet);\n\n\t\tRSAKey key1 = (RSAKey)matches.get(0);\n\t\tassertEquals(KeyType.RSA, key1.getKeyType());\n\t\tassertEquals(\"1\", key1.getKeyID());\n\n\t\tECKey key2 = (ECKey)matches.get(1);\n\t\tassertEquals(KeyType.EC, key2.getKeyType());\n\t\tassertEquals(\"2\", key2.getKeyID());\n\n\t\tassertEquals(2, matches.size());\n\t}", "label": 1, "label_name": "safe"} +{"code": "void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new)\n{\n unsigned char *data = NULL;\n int size;\n loff_t offs;\n\n if (new == -1)\n\tnew = FAT_EOF(fs);\n else if ((long)new == -2)\n\tnew = FAT_BAD(fs);\n switch (fs->fat_bits) {\n case 12:\n\tdata = fs->fat + cluster * 3 / 2;\n\toffs = fs->fat_start + cluster * 3 / 2;\n\tif (cluster & 1) {\n\t FAT_ENTRY prevEntry;\n\t get_fat(&prevEntry, fs->fat, cluster - 1, fs);\n\t data[0] = ((new & 0xf) << 4) | (prevEntry.value >> 8);\n\t data[1] = new >> 4;\n\t} else {\n\t FAT_ENTRY subseqEntry;\n\t if (cluster != fs->clusters + 1)\n\t\tget_fat(&subseqEntry, fs->fat, cluster + 1, fs);\n\t else\n\t\tsubseqEntry.value = 0;\n\t data[0] = new & 0xff;\n\t data[1] = (new >> 8) | ((0xff & subseqEntry.value) << 4);\n\t}\n\tsize = 2;\n\tbreak;\n case 16:\n\tdata = fs->fat + cluster * 2;\n\toffs = fs->fat_start + cluster * 2;\n\t*(unsigned short *)data = htole16(new);\n\tsize = 2;\n\tbreak;\n case 32:\n\t{\n\t FAT_ENTRY curEntry;\n\t get_fat(&curEntry, fs->fat, cluster, fs);\n\n\t data = fs->fat + cluster * 4;\n\t offs = fs->fat_start + cluster * 4;\n\t /* According to M$, the high 4 bits of a FAT32 entry are reserved and\n\t * are not part of the cluster number. So we never touch them. */\n\t *(uint32_t *)data = htole32((new & 0xfffffff) |\n\t\t\t\t\t (curEntry.reserved << 28));\n\t size = 4;\n\t}\n\tbreak;\n default:\n\tdie(\"Bad FAT entry size: %d bits.\", fs->fat_bits);\n }\n fs_write(offs, size, data);\n if (fs->nfats > 1) {\n\tfs_write(offs + fs->fat_size, size, data);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "static boolean ReadIPTCProfile(j_decompress_ptr jpeg_info)\n{\n char\n magick[MagickPathExtent];\n\n ErrorManager\n *error_manager;\n\n ExceptionInfo\n *exception;\n\n Image\n *image;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n length;\n\n StringInfo\n *iptc_profile,\n *profile;\n\n /*\n Determine length of binary data stored here.\n */\n length=(size_t) ((size_t) GetCharacter(jpeg_info) << 8);\n length+=(size_t) GetCharacter(jpeg_info);\n length-=2;\n if (length <= 14)\n {\n while (length-- > 0)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n /*\n Validate that this was written as a Photoshop resource format slug.\n */\n for (i=0; i < 10; i++)\n magick[i]=(char) GetCharacter(jpeg_info);\n magick[10]='\\0';\n length-=10;\n if (length <= 10)\n return(TRUE);\n if (LocaleCompare(magick,\"Photoshop \") != 0)\n {\n /*\n Not a IPTC profile, return.\n */\n for (i=0; i < (ssize_t) length; i++)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n /*\n Remove the version number.\n */\n for (i=0; i < 4; i++)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n if (length <= 11)\n return(TRUE);\n length-=4;\n error_manager=(ErrorManager *) jpeg_info->client_data;\n exception=error_manager->exception;\n image=error_manager->image;\n profile=BlobToStringInfo((const void *) NULL,length);\n if (profile == (StringInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n error_manager->profile=profile;\n p=GetStringInfoDatum(profile);\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=GetCharacter(jpeg_info);\n if (c == EOF)\n break;\n *p++=(unsigned char) c;\n }\n error_manager->profile=NULL;\n if (i != (ssize_t) length)\n {\n profile=DestroyStringInfo(profile);\n (void) ThrowMagickException(exception,GetMagickModule(),\n CorruptImageError,\"InsufficientImageDataInFile\",\"`%s'\",\n image->filename);\n return(FALSE);\n }\n /*\n The IPTC profile is actually an 8bim.\n */\n iptc_profile=(StringInfo *) GetImageProfile(image,\"8bim\");\n if (iptc_profile != (StringInfo *) NULL)\n {\n ConcatenateStringInfo(iptc_profile,profile);\n profile=DestroyStringInfo(profile);\n }\n else\n {\n status=SetImageProfile(image,\"8bim\",profile,exception);\n profile=DestroyStringInfo(profile);\n if (status == MagickFalse)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"Profile: iptc, %.20g bytes\",(double) length);\n return(TRUE);\n}", "label": 1, "label_name": "safe"} +{"code": " public function testDefaultLocaleWithoutSession()\n {\n $listener = new LocaleListener($this->requestStack, 'fr');\n $event = $this->getEvent($request = Request::create('/'));\n\n $listener->onKernelRequest($event);\n $this->assertEquals('fr', $request->getLocale());\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function destroy($name) {\n if (!isset($this->_storage[$name])) {\n trigger_error(\"Attempted to destroy non-existent variable $name\",\n E_USER_ERROR);\n return;\n }\n unset($this->_storage[$name]);\n }", "label": 1, "label_name": "safe"} +{"code": " function get_plural_forms() {\n // lets assume message number 0 is header\n // this is true, right?\n $this->load_tables();\n\n // cache header field for plural forms\n if (! is_string($this->pluralheader)) {\n if ($this->enable_cache) {\n $header = $this->cache_translations[\"\"];\n } else {\n $header = $this->get_translation_string(0);\n }\n $expr = $this->extract_plural_forms_header_from_po_header($header);\n $this->pluralheader = $this->sanitize_plural_expression($expr);\n }\n return $this->pluralheader;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function(u,E,J,T){for(var N=0;N htmlentities(self::$search_type),\n 'stext' => htmlentities(self::$search_text),\n 'method' => htmlentities(self::$search_method),\n 'datelimit' => self::$search_date_limit,\n 'fields' => self::$search_fields,\n 'sort' => self::$search_sort,\n 'chars' => htmlentities(self::$search_chars),\n 'order' => self::$search_order,\n 'forum_id' => self::$forum_id,\n 'memory_limit' => self::$memory_limit,\n 'composevars' => self::$composevars,\n 'rowstart' => self::$rowstart,\n 'search_param' => htmlentities(self::$search_param),\n ];\n\n return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL);\n }", "label": 1, "label_name": "safe"} +{"code": "(ma.style.backgroundImage=\"url(\"+ja+\")\",ma.style.backgroundPosition=\"center center\",ma.style.backgroundRepeat=\"no-repeat\",ma.style.backgroundSize=\"24px 24px\",ma.style.width=\"34px\",ma.innerHTML=\"\"):ba||(ma.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\",ma.style.backgroundPosition=\"right 6px center\",ma.style.backgroundRepeat=\"no-repeat\",ma.style.paddingRight=\"22px\");return ma}function F(ca,ba,ja,ia,ma,qa){var oa=document.createElement(\"a\");oa.className=\"1\"==urlParams.sketch?\"geToolbarButton\":\n\"geMenuItem\";oa.style.display=\"inline-block\";oa.style.boxSizing=\"border-box\";oa.style.height=\"30px\";oa.style.padding=\"6px\";oa.style.position=\"relative\";oa.style.verticalAlign=\"top\";oa.style.top=\"0px\";\"1\"==urlParams.sketch&&(oa.style.borderStyle=\"none\",oa.style.boxShadow=\"none\",oa.style.padding=\"6px\",oa.style.margin=\"0px\");null!=E.statusContainer?S.insertBefore(oa,E.statusContainer):S.appendChild(oa);null!=qa?(oa.style.backgroundImage=\"url(\"+qa+\")\",oa.style.backgroundPosition=\"center center\",oa.style.backgroundRepeat=\n\"no-repeat\",oa.style.backgroundSize=\"24px 24px\",oa.style.width=\"34px\"):mxUtils.write(oa,ca);mxEvent.addListener(oa,mxClient.IS_POINTER?\"pointerdown\":\"mousedown\",mxUtils.bind(this,function(na){na.preventDefault()}));mxEvent.addListener(oa,\"click\",function(na){\"disabled\"!=oa.getAttribute(\"disabled\")&&ba(na);mxEvent.consume(na)});null==ja&&(oa.style.marginRight=\"4px\");null!=ia&&oa.setAttribute(\"title\",ia);null!=ma&&(ca=function(){ma.isEnabled()?(oa.removeAttribute(\"disabled\"),oa.style.cursor=\"pointer\"):\n(oa.setAttribute(\"disabled\",\"disabled\"),oa.style.cursor=\"default\")},ma.addListener(\"stateChanged\",ca),H.addListener(\"enabledChanged\",ca),ca());return oa}function G(ca,ba,ja){ja=document.createElement(\"div\");ja.className=\"geMenuItem\";ja.style.display=\"inline-block\";ja.style.verticalAlign=\"top\";ja.style.marginRight=\"6px\";ja.style.padding=\"0 4px 0 4px\";ja.style.height=\"30px\";ja.style.position=\"relative\";ja.style.top=\"0px\";\"1\"==urlParams.sketch&&(ja.style.boxShadow=\"none\");for(var ia=0;ia=k.scrollHeight-k.offsetHeight&&C()},mxEvent.addListener(k,\"scroll\",B))}),y)});t()};GitHubClient.prototype.logout=function(){this.clearPersistentToken();this.setUser(null);b=null}})();TrelloFile=function(b,e,f){DrawioFile.call(this,b,e);this.meta=f;this.saveNeededCounter=0};mxUtils.extend(TrelloFile,DrawioFile);TrelloFile.prototype.getHash=function(){return\"T\"+encodeURIComponent(this.meta.compoundId)};TrelloFile.prototype.getMode=function(){return App.MODE_TRELLO};TrelloFile.prototype.isAutosave=function(){return!0};TrelloFile.prototype.getTitle=function(){return this.meta.name};TrelloFile.prototype.isRenamable=function(){return!1};TrelloFile.prototype.getSize=function(){return this.meta.bytes};", "label": 0, "label_name": "vulnerable"} +{"code": "static int rfcomm_get_dev_list(void __user *arg)\n{\n\tstruct rfcomm_dev *dev;\n\tstruct rfcomm_dev_list_req *dl;\n\tstruct rfcomm_dev_info *di;\n\tint n = 0, size, err;\n\tu16 dev_num;\n\n\tBT_DBG(\"\");\n\n\tif (get_user(dev_num, (u16 __user *) arg))\n\t\treturn -EFAULT;\n\n\tif (!dev_num || dev_num > (PAGE_SIZE * 4) / sizeof(*di))\n\t\treturn -EINVAL;\n\n\tsize = sizeof(*dl) + dev_num * sizeof(*di);\n\n\tdl = kzalloc(size, GFP_KERNEL);\n\tif (!dl)\n\t\treturn -ENOMEM;\n\n\tdi = dl->dev_info;\n\n\tspin_lock(&rfcomm_dev_lock);\n\n\tlist_for_each_entry(dev, &rfcomm_dev_list, list) {\n\t\tif (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))\n\t\t\tcontinue;\n\t\t(di + n)->id = dev->id;\n\t\t(di + n)->flags = dev->flags;\n\t\t(di + n)->state = dev->dlc->state;\n\t\t(di + n)->channel = dev->channel;\n\t\tbacpy(&(di + n)->src, &dev->src);\n\t\tbacpy(&(di + n)->dst, &dev->dst);\n\t\tif (++n >= dev_num)\n\t\t\tbreak;\n\t}\n\n\tspin_unlock(&rfcomm_dev_lock);\n\n\tdl->dev_num = n;\n\tsize = sizeof(*dl) + n * sizeof(*di);\n\n\terr = copy_to_user(arg, dl, size);\n\tkfree(dl);\n\n\treturn err ? -EFAULT : 0;\n}", "label": 1, "label_name": "safe"} +{"code": "(function(){var r=function(c,j){function r(){var a=arguments,b=this.getContentElement(\"advanced\",\"txtdlgGenStyle\");b&&b.commit.apply(b,a);this.foreach(function(b){b.commit&&\"txtdlgGenStyle\"!=b.id&&b.commit.apply(b,a)})}function i(a){if(!s){s=1;var b=this.getDialog(),d=b.imageElement;if(d){this.commit(f,d);for(var a=[].concat(a),e=a.length,c,g=0;g_url/?database=$db\", false, stream_context_create(array('http' => array(\n\t\t\t\t'method' => 'POST',\n\t\t\t\t'content' => $this->isQuerySelectLike($query) ? \"$query FORMAT JSONCompact\" : $query,\n\t\t\t\t'header' => 'Content-type: application/x-www-form-urlencoded',\n\t\t\t\t'ignore_errors' => 1, // available since PHP 5.2.10\n\t\t\t))));\n\n\t\t\tif ($file === false) {\n\t\t\t\t$this->error = $php_errormsg;\n\t\t\t\treturn $file;\n\t\t\t}\n\t\t\tif (!preg_match('~^HTTP/[0-9.]+ 2~i', $http_response_header[0])) {\n\t\t\t\t$this->error = $file;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$return = json_decode($file, true);\n\t\t\tif ($return === null) {\n\t\t\t\tif (!$this->isQuerySelectLike($query) && $file === '') {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t$this->errno = json_last_error();\n\t\t\t\tif (function_exists('json_last_error_msg')) {\n\t\t\t\t\t$this->error = json_last_error_msg();\n\t\t\t\t} else {\n\t\t\t\t\t$constants = get_defined_constants(true);\n\t\t\t\t\tforeach ($constants['json'] as $name => $value) {\n\t\t\t\t\t\tif ($value == $this->errno && preg_match('~^JSON_ERROR_~', $name)) {\n\t\t\t\t\t\t\t$this->error = $name;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new Min_Result($return);\n\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function getIconName($module)\n {\n return static::$iconNames[$module] ?? strtolower(str_replace('_', '-', $module));\n }", "label": 1, "label_name": "safe"} +{"code": " function drawError(ctx,err,x,y,upper,lower,drawUpper,drawLower,radius,offset,minmax){\n\n //shadow offset\n y += offset;\n upper += offset;\n lower += offset;\n\n // error bar - avoid plotting over circles\n if (err.err == 'x'){\n if (upper > x + radius) drawPath(ctx, [[upper,y],[Math.max(x + radius,minmax[0]),y]]);\n else drawUpper = false;\n if (lower < x - radius) drawPath(ctx, [[Math.min(x - radius,minmax[1]),y],[lower,y]] );\n else drawLower = false;\n }\n else {\n if (upper < y - radius) drawPath(ctx, [[x,upper],[x,Math.min(y - radius,minmax[0])]] );\n else drawUpper = false;\n if (lower > y + radius) drawPath(ctx, [[x,Math.max(y + radius,minmax[1])],[x,lower]] );\n else drawLower = false;\n }\n\n //internal radius value in errorbar, allows to plot radius 0 points and still keep proper sized caps\n //this is a way to get errorbars on lines without visible connecting dots\n radius = err.radius != null? err.radius: radius;\n\n // upper cap\n if (drawUpper) {\n if (err.upperCap == '-'){\n if (err.err=='x') drawPath(ctx, [[upper,y - radius],[upper,y + radius]] );\n else drawPath(ctx, [[x - radius,upper],[x + radius,upper]] );\n } else if ($.isFunction(err.upperCap)){\n if (err.err=='x') err.upperCap(ctx, upper, y, radius);\n else err.upperCap(ctx, x, upper, radius);\n }\n }\n // lower cap\n if (drawLower) {\n if (err.lowerCap == '-'){\n if (err.err=='x') drawPath(ctx, [[lower,y - radius],[lower,y + radius]] );\n else drawPath(ctx, [[x - radius,lower],[x + radius,lower]] );\n } else if ($.isFunction(err.lowerCap)){\n if (err.err=='x') err.lowerCap(ctx, lower, y, radius);\n else err.lowerCap(ctx, x, lower, radius);\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "int64_t OpLevelCostEstimator::CalculateTensorSize(\n const OpInfo::TensorProperties& tensor, bool* found_unknown_shapes) {\n int64_t count = CalculateTensorElementCount(tensor, found_unknown_shapes);\n int size = DataTypeSize(BaseType(tensor.dtype()));\n VLOG(2) << \"Count: \" << count << \" DataTypeSize: \" << size;\n int64_t tensor_size = MultiplyWithoutOverflow(count, size);\n if (tensor_size < 0) {\n VLOG(1) << \"Overflow encountered when computing tensor size, multiplying \"\n << count << \" with \" << size;\n return -1;\n }\n return tensor_size;\n}", "label": 1, "label_name": "safe"} +{"code": " it \"removes the stored credentials\" do\n cluster.logout :admin\n cluster.auth.should be_empty\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testHandleWhenAListenerReturnsAResponse()\n {\n $dispatcher = new EventDispatcher();\n $dispatcher->addListener(KernelEvents::REQUEST, function ($event) {\n $event->setResponse(new Response('hello'));\n });\n\n $kernel = new HttpKernel($dispatcher, $this->getResolver());\n\n $this->assertEquals('hello', $kernel->handle(new Request())->getContent());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "return this.collapsed||a.type!=CKEDITOR.NODE_ELEMENT?a:a.getChild(this.endOffset-1)||a},getNextEditableNode:b(),getPreviousEditableNode:b(1),scrollIntoView:function(){var a=new CKEDITOR.dom.element.createFromHtml(\" \",this.document),b,c,d,f=this.clone();f.optimize();if(d=f.startContainer.type==CKEDITOR.NODE_TEXT){c=f.startContainer.getText();b=f.startContainer.split(f.startOffset);a.insertAfter(f.startContainer)}else f.insertNode(a);a.scrollIntoView();if(d){f.startContainer.setText(c);\nb.remove()}a.remove()}}})();CKEDITOR.POSITION_AFTER_START=1;CKEDITOR.POSITION_BEFORE_END=2;CKEDITOR.POSITION_BEFORE_START=3;CKEDITOR.POSITION_AFTER_END=4;CKEDITOR.ENLARGE_ELEMENT=1;CKEDITOR.ENLARGE_BLOCK_CONTENTS=2;CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS=3;CKEDITOR.ENLARGE_INLINE=4;CKEDITOR.START=1;CKEDITOR.END=2;CKEDITOR.SHRINK_ELEMENT=1;CKEDITOR.SHRINK_TEXT=2;\"use strict\";", "label": 1, "label_name": "safe"} +{"code": " protected function getAuthorizationHeaders($token = null)\n {\n return ['Authorization' => 'Bearer ' . $token];\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private static List GetMonitors()\r\n {\r\n List monitors = new List();\r\n\r\n EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,\r\n (IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData) =>\r\n {\r\n MONITORINFOEX monitorInfo = new MONITORINFOEX();\r\n monitorInfo.cbSize = Marshal.SizeOf(typeof(MONITORINFOEX));\r\n\r\n GetMonitorInfo(hMonitor, ref monitorInfo);\r\n\r\n monitors.Add(new Monitor()\r\n {\r\n Primary = (monitorInfo.dwFlags & MONITORINFOF_PRIMARY) != 0,\r\n DeviceName = monitorInfo.szDevice,\r\n Rect = Rectangle.FromLTRB(monitorInfo.rcMonitor.Left,\r\n monitorInfo.rcMonitor.Top,\r\n monitorInfo.rcMonitor.Right,\r\n monitorInfo.rcMonitor.Bottom),\r\n WorkRect = Rectangle.FromLTRB(monitorInfo.rcWork.Left,\r\n monitorInfo.rcWork.Top,\r\n monitorInfo.rcWork.Right,\r\n monitorInfo.rcWork.Bottom)\r\n });\r\n\r\n return true;\r\n },\r\n IntPtr.Zero\r\n );\r\n\r\n return monitors;\r\n }\r", "label": 1, "label_name": "safe"} +{"code": "\"startWidth\",this.defaultArrowWidth)};Ca.prototype.getEndArrowWidth=function(){return this.getEdgeWidth()+mxUtils.getNumber(this.style,\"endWidth\",this.defaultArrowWidth)};Ca.prototype.getEdgeWidth=function(){return mxUtils.getNumber(this.style,\"width\",this.defaultWidth)+Math.max(0,this.strokewidth-1)};mxCellRenderer.registerShape(\"flexArrow\",Ca);mxUtils.extend(Qa,mxActor);Qa.prototype.size=30;Qa.prototype.isRoundable=function(){return!0};Qa.prototype.redrawPath=function(c,l,x,p,v){l=Math.min(v,parseFloat(mxUtils.getValue(this.style,", "label": 1, "label_name": "safe"} +{"code": " def check_owner\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n begin\n owner_id = Workflow.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " this._transport.on(\"chunk\", (messageChunk: Buffer) => {\r\n /**\r\n * notify the observers that ClientSecureChannelLayer has received a message chunk\r\n * @event receive_chunk\r\n * @param message_chunk\r\n */\r\n this.emit(\"receive_chunk\", messageChunk);\r\n this._on_receive_message_chunk(messageChunk);\r\n });\r", "label": 1, "label_name": "safe"} +{"code": " public function theme_switch() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }\n \texpSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);\n\t expSession::set('display_theme',$this->params['theme']);\n\t $sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t if (strtolower($sv)=='default') {\n\t $sv = '';\n\t }\n\t expSettings::change('THEME_STYLE_REAL',$sv);\n\t expSession::set('theme_style',$sv);\n\t expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme\n\n // $message = (MINIFY != 1) ? \"Exponent is now minifying Javascript and CSS\" : \"Exponent is no longer minifying Javascript and CSS\" ;\n // flash('message',$message);\n\t $message = gt(\"You have selected the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t if ($sv != '') {\n\t\t $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');\n\t }\n\t flash('message',$message);\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n// expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n \texpHistory::returnTo('manageable');\n }\t", "label": 0, "label_name": "vulnerable"} +{"code": " public void translate(ServerVehicleMovePacket packet, GeyserSession session) {\n Entity entity = session.getRidingVehicleEntity();\n if (entity == null) return;\n\n entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, true);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\texpand: function( id ) {\n\t\tvar self = this;\n\n\t\t// Set the current theme model\n\t\tthis.model = self.collection.get( id );\n\n\t\t// Trigger a route update for the current model\n\t\tthemes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );\n\n\t\t// Sets this.view to 'detail'\n\t\tthis.setView( 'detail' );\n\t\t$( 'body' ).addClass( 'modal-open' );\n\n\t\t// Set up the theme details view\n\t\tthis.overlay = new themes.view.Details({\n\t\t\tmodel: self.model\n\t\t});\n\n\t\tthis.overlay.render();\n\t\tthis.$overlay.html( this.overlay.el );\n\n\t\t// Bind to theme:next and theme:previous\n\t\t// triggered by the arrow keys\n\t\t//\n\t\t// Keep track of the current model so we\n\t\t// can infer an index position\n\t\tthis.listenTo( this.overlay, 'theme:next', function() {\n\t\t\t// Renders the next theme on the overlay\n\t\t\tself.next( [ self.model.cid ] );\n\n\t\t})\n\t\t.listenTo( this.overlay, 'theme:previous', function() {\n\t\t\t// Renders the previous theme on the overlay\n\t\t\tself.previous( [ self.model.cid ] );\n\t\t});\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": "static s32 gf_avc_read_pps_bs_internal(GF_BitStream *bs, AVCState *avc, u32 nal_hdr)\n{\n\ts32 pps_id;\n\tAVC_PPS *pps;\n\n\tgf_bs_enable_emulation_byte_removal(bs, GF_TRUE);\n\n\tif (!nal_hdr) {\n\t\tgf_bs_read_int_log(bs, 1, \"forbidden_zero_bit\");\n\t\tgf_bs_read_int_log(bs, 2, \"nal_ref_idc\");\n\t\tgf_bs_read_int_log(bs, 5, \"nal_unit_type\");\n\t}\n\tpps_id = gf_bs_read_ue_log(bs, \"pps_id\");\n\tif (pps_id >= 255) {\n\t\treturn -1;\n\t}\n\tpps = &avc->pps[pps_id];\n\tpps->id = pps_id;\n\n\tif (!pps->status) pps->status = 1;\n\tpps->sps_id = gf_bs_read_ue_log(bs, \"sps_id\");\n\tif (pps->sps_id >= 32) {\n\t\tpps->sps_id = 0;\n\t\treturn -1;\n\t}\n\t/*sps_id may be refer to regular SPS or subseq sps, depending on the coded slice referring to the pps*/\n\tif (!avc->sps[pps->sps_id].state && !avc->sps[pps->sps_id + GF_SVC_SSPS_ID_SHIFT].state) {\n\t\treturn -1;\n\t}\n\tavc->pps_active_idx = pps->id; /*set active sps*/\n\tavc->sps_active_idx = pps->sps_id; /*set active sps*/\n\tpps->entropy_coding_mode_flag = gf_bs_read_int_log(bs, 1, \"entropy_coding_mode_flag\");\n\tpps->pic_order_present = gf_bs_read_int_log(bs, 1, \"pic_order_present\");\n\tpps->slice_group_count = gf_bs_read_ue_log(bs, \"slice_group_count_minus1\") + 1;\n\tif (pps->slice_group_count > 1) {\n\t\tu32 iGroup;\n\t\tpps->mb_slice_group_map_type = gf_bs_read_ue_log(bs, \"mb_slice_group_map_type\");\n\t\tif (pps->mb_slice_group_map_type == 0) {\n\t\t\tfor (iGroup = 0; iGroup <= pps->slice_group_count - 1; iGroup++)\n\t\t\t\tgf_bs_read_ue_log_idx(bs, \"run_length_minus1\", iGroup);\n\t\t}\n\t\telse if (pps->mb_slice_group_map_type == 2) {\n\t\t\tfor (iGroup = 0; iGroup < pps->slice_group_count - 1; iGroup++) {\n\t\t\t\tgf_bs_read_ue_log_idx(bs, \"top_left\", iGroup);\n\t\t\t\tgf_bs_read_ue_log_idx(bs, \"bottom_right\", iGroup);\n\t\t\t}\n\t\t}\n\t\telse if (pps->mb_slice_group_map_type == 3 || pps->mb_slice_group_map_type == 4 || pps->mb_slice_group_map_type == 5) {\n\t\t\tgf_bs_read_int_log(bs, 1, \"slice_group_change_direction_flag\");\n\t\t\tgf_bs_read_ue_log(bs, \"slice_group_change_rate_minus1\");\n\t\t}\n\t\telse if (pps->mb_slice_group_map_type == 6) {\n\t\t\tu32 i;\n\t\t\tpps->pic_size_in_map_units_minus1 = gf_bs_read_ue_log(bs, \"pic_size_in_map_units_minus1\");\n\t\t\tfor (i = 0; i <= pps->pic_size_in_map_units_minus1; i++) {\n\t\t\t\tgf_bs_read_int_log_idx(bs, (u32)ceil(log(pps->slice_group_count) / log(2)), \"slice_group_id\", i);\n\t\t\t}\n\t\t}\n\t}\n\tpps->num_ref_idx_l0_default_active_minus1 = gf_bs_read_ue_log(bs, \"num_ref_idx_l0_default_active_minus1\");\n\tpps->num_ref_idx_l1_default_active_minus1 = gf_bs_read_ue_log(bs, \"num_ref_idx_l1_default_active_minus1\");\n\n\t/*\n\tif ((pps->ref_count[0] > 32) || (pps->ref_count[1] > 32)) goto exit;\n\t*/\n\n\tpps->weighted_pred_flag = gf_bs_read_int_log(bs, 1, \"weighted_pred_flag\");\n\tgf_bs_read_int_log(bs, 2, \"weighted_bipred_idc\");\n\tgf_bs_read_se_log(bs, \"init_qp_minus26\");\n\tgf_bs_read_se_log(bs, \"init_qs_minus26\");\n\tgf_bs_read_se_log(bs, \"chroma_qp_index_offset\");\n\tpps->deblocking_filter_control_present_flag = gf_bs_read_int_log(bs, 1, \"deblocking_filter_control_present_flag\");\n\tgf_bs_read_int_log(bs, 1, \"constrained_intra_pred\");\n\tpps->redundant_pic_cnt_present = gf_bs_read_int_log(bs, 1, \"redundant_pic_cnt_present\");\n\n\treturn pps_id;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void dhcpClientParseAck(DhcpClientContext *context,\n const DhcpMessage *message, size_t length)\n{\n uint_t i;\n uint_t j;\n uint_t n;\n DhcpOption *option;\n DhcpOption *serverIdOption;\n NetInterface *interface;\n NetInterface *logicalInterface;\n NetInterface *physicalInterface;\n\n //Point to the underlying network interface\n interface = context->settings.interface;\n //Point to the logical interface\n logicalInterface = nicGetLogicalInterface(interface);\n //Point to the physical interface\n physicalInterface = nicGetPhysicalInterface(interface);\n\n //Index of the IP address in the list of addresses assigned to the interface\n i = context->settings.ipAddrIndex;\n\n //Discard any received packet that does not match the transaction ID\n if(ntohl(message->xid) != context->transactionId)\n return;\n\n //Make sure the IP address assigned to the client is valid\n if(message->yiaddr == IPV4_UNSPECIFIED_ADDR)\n return;\n\n //Check MAC address\n if(!macCompAddr(&message->chaddr, &logicalInterface->macAddr))\n return;\n\n //A DHCP server always returns its own address in the Server Identifier option\n serverIdOption = dhcpGetOption(message, length, DHCP_OPT_SERVER_IDENTIFIER);\n\n //Failed to retrieve the Server Identifier option?\n if(serverIdOption == NULL || serverIdOption->length != 4)\n return;\n\n //Check current state\n if(context->state == DHCP_STATE_SELECTING)\n {\n //A DHCPACK message is not acceptable when rapid commit is disallowed\n if(!context->settings.rapidCommit)\n return;\n\n //Search for the Rapid Commit option\n option = dhcpGetOption(message, length, DHCP_OPT_RAPID_COMMIT);\n\n //A server must include this option in a DHCPACK message sent\n //in a response to a DHCPDISCOVER message when completing the\n //DHCPDISCOVER-DHCPACK message exchange\n if(option == NULL || option->length != 0)\n return;\n }\n else if(context->state == DHCP_STATE_REQUESTING ||\n context->state == DHCP_STATE_RENEWING)\n {\n //Check the server identifier\n if(!ipv4CompAddr(serverIdOption->value, &context->serverIpAddr))\n return;\n }\n else if(context->state == DHCP_STATE_REBOOTING ||\n context->state == DHCP_STATE_REBINDING)\n {\n //Do not check the server identifier\n }\n else\n {\n //Silently discard the DHCPACK message\n return;\n }\n\n //Retrieve IP Address Lease Time option\n option = dhcpGetOption(message, length, DHCP_OPT_IP_ADDRESS_LEASE_TIME);\n\n //Failed to retrieve specified option?\n if(option == NULL || option->length != 4)\n return;\n\n //Record the lease time\n context->leaseTime = LOAD32BE(option->value);\n\n //Retrieve Renewal Time Value option\n option = dhcpGetOption(message, length, DHCP_OPT_RENEWAL_TIME_VALUE);\n\n //Specified option found?\n if(option != NULL && option->length == 4)\n {\n //This option specifies the time interval from address assignment\n //until the client transitions to the RENEWING state\n context->t1 = LOAD32BE(option->value);\n }\n else if(context->leaseTime != DHCP_INFINITE_TIME)\n {\n //By default, T1 is set to 50% of the lease time\n context->t1 = context->leaseTime / 2;\n }\n else\n {\n //Infinite lease\n context->t1 = DHCP_INFINITE_TIME;\n }\n\n //Retrieve Rebinding Time value option\n option = dhcpGetOption(message, length, DHCP_OPT_REBINDING_TIME_VALUE);\n\n //Specified option found?\n if(option != NULL && option->length == 4)\n {\n //This option specifies the time interval from address assignment\n //until the client transitions to the REBINDING state\n context->t2 = LOAD32BE(option->value);\n }\n else if(context->leaseTime != DHCP_INFINITE_TIME)\n {\n //By default, T2 is set to 87.5% of the lease time\n context->t2 = context->leaseTime * 7 / 8;\n }\n else\n {\n //Infinite lease\n context->t2 = DHCP_INFINITE_TIME;\n }\n\n //Retrieve Subnet Mask option\n option = dhcpGetOption(message, length, DHCP_OPT_SUBNET_MASK);\n\n //The specified option has been found?\n if(option != NULL && option->length == sizeof(Ipv4Addr))\n {\n //Save subnet mask\n ipv4CopyAddr(&interface->ipv4Context.addrList[i].subnetMask,\n option->value);\n }\n\n //Retrieve Router option\n option = dhcpGetOption(message, length, DHCP_OPT_ROUTER);\n\n //The specified option has been found?\n if(option != NULL && !(option->length % sizeof(Ipv4Addr)))\n {\n //Save default gateway\n if(option->length >= sizeof(Ipv4Addr))\n {\n ipv4CopyAddr(&interface->ipv4Context.addrList[i].defaultGateway,\n option->value);\n }\n }\n\n //Use the DNS servers provided by the DHCP server?\n if(!context->settings.manualDnsConfig)\n {\n //Retrieve DNS Server option\n option = dhcpGetOption(message, length, DHCP_OPT_DNS_SERVER);\n\n //The specified option has been found?\n if(option != NULL && !(option->length % sizeof(Ipv4Addr)))\n {\n //Get the number of addresses provided in the response\n n = option->length / sizeof(Ipv4Addr);\n\n //Loop through the list of addresses\n for(j = 0; j < n && j < IPV4_DNS_SERVER_LIST_SIZE; j++)\n {\n //Save DNS server address\n ipv4CopyAddr(&interface->ipv4Context.dnsServerList[j],\n option->value + j * sizeof(Ipv4Addr));\n }\n }\n }\n\n //Retrieve MTU option\n option = dhcpGetOption(message, length, DHCP_OPT_INTERFACE_MTU);\n\n //The specified option has been found?\n if(option != NULL && option->length == 2)\n {\n //This option specifies the MTU to use on this interface\n n = LOAD16BE(option->value);\n\n //Make sure that the option's value is acceptable\n if(n >= IPV4_MINIMUM_MTU && n <= physicalInterface->nicDriver->mtu)\n {\n //Set the MTU to be used on the interface\n interface->ipv4Context.linkMtu = n;\n }\n }\n\n //Record the IP address of the DHCP server\n ipv4CopyAddr(&context->serverIpAddr, serverIdOption->value);\n //Record the IP address assigned to the client\n context->requestedIpAddr = message->yiaddr;\n\n //Save the time a which the lease was obtained\n context->leaseStartTime = osGetSystemTime();\n\n //Check current state\n if(context->state == DHCP_STATE_REQUESTING ||\n context->state == DHCP_STATE_REBOOTING)\n {\n //Use the IP address as a tentative address\n interface->ipv4Context.addrList[i].addr = message->yiaddr;\n interface->ipv4Context.addrList[i].state = IPV4_ADDR_STATE_TENTATIVE;\n\n //Clear conflict flag\n interface->ipv4Context.addrList[i].conflict = FALSE;\n\n //The client should probe the newly received address\n dhcpClientChangeState(context, DHCP_STATE_PROBING, 0);\n }\n else\n {\n //Assign the IP address to the client\n interface->ipv4Context.addrList[i].addr = message->yiaddr;\n interface->ipv4Context.addrList[i].state = IPV4_ADDR_STATE_VALID;\n\n#if (MDNS_RESPONDER_SUPPORT == ENABLED)\n //Restart mDNS probing process\n mdnsResponderStartProbing(interface->mdnsResponderContext);\n#endif\n //The client transitions to the BOUND state\n dhcpClientChangeState(context, DHCP_STATE_BOUND, 0);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "\t\tpublic JpaOrder nullsFirst() {\n\t\t\treturn with(NullHandling.NULLS_FIRST);\n\t\t}", "label": 1, "label_name": "safe"} +{"code": " protected function getColumn(array $project)\n {\n $column = $this->columnModel->getById($this->request->getIntegerParam('column_id'));\n\n if (empty($column)) {\n throw new PageNotFoundException();\n }\n\n if ($column['project_id'] != $project['id']) {\n throw new AccessForbiddenException();\n }\n\n return $column;\n }", "label": 1, "label_name": "safe"} +{"code": "\t\tfb.setSize = function (width) {\n\t\t\tif (fbPlayer !== null && !isNaN(width)) {\n\t\t\t\tfbContainer.style.width = width;\n\t\t\t}\n\t\t};", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *U) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: U: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: U: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 2:\n\t\t\tif wireType == 1 {\n\t\t\t\tvar v uint64\n\t\t\t\tif (iNdEx + 8) > l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tv = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))\n\t\t\t\tiNdEx += 8\n\t\t\t\tv2 := float64(math.Float64frombits(v))\n\t\t\t\tm.Field2 = append(m.Field2, v2)\n\t\t\t} else if wireType == 2 {\n\t\t\t\tvar packedLen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tpackedLen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif packedLen < 0 {\n\t\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + packedLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tvar elementCount int\n\t\t\t\telementCount = packedLen / 8\n\t\t\t\tif elementCount != 0 && len(m.Field2) == 0 {\n\t\t\t\t\tm.Field2 = make([]float64, 0, elementCount)\n\t\t\t\t}\n\t\t\t\tfor iNdEx < postIndex {\n\t\t\t\t\tvar v uint64\n\t\t\t\t\tif (iNdEx + 8) > l {\n\t\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tv = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))\n\t\t\t\t\tiNdEx += 8\n\t\t\t\t\tv2 := float64(math.Float64frombits(v))\n\t\t\t\t\tm.Field2 = append(m.Field2, v2)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field2\", wireType)\n\t\t\t}\n\t\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field3\", wireType)\n\t\t\t}\n\t\t\tvar v uint32\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= uint32(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field3 = &v\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipUnrecognized(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": "int64_t OpLevelCostEstimator::CalculateOutputSize(const OpInfo& op_info,\n bool* found_unknown_shapes) {\n int64_t total_output_size = 0;\n // Use float as default for calculations.\n for (const auto& output : op_info.outputs()) {\n DataType dt = output.dtype();\n const auto& original_output_shape = output.shape();\n int64_t output_size = DataTypeSize(BaseType(dt));\n int num_dims = std::max(1, original_output_shape.dim_size());\n auto output_shape = MaybeGetMinimumShape(original_output_shape, num_dims,\n found_unknown_shapes);\n for (const auto& dim : output_shape.dim()) {\n output_size *= dim.size();\n }\n total_output_size += output_size;\n VLOG(1) << \"Output Size: \" << output_size\n << \" Total Output Size:\" << total_output_size;\n }\n return total_output_size;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "check_rpcsec_auth(struct svc_req *rqstp)\n{\n gss_ctx_id_t ctx;\n krb5_context kctx;\n OM_uint32 maj_stat, min_stat;\n gss_name_t name;\n krb5_principal princ;\n int ret, success;\n krb5_data *c1, *c2, *realm;\n gss_buffer_desc gss_str;\n kadm5_server_handle_t handle;\n size_t slen;\n char *sdots;\n\n success = 0;\n handle = (kadm5_server_handle_t)global_server_handle;\n\n if (rqstp->rq_cred.oa_flavor != RPCSEC_GSS)\n\t return 0;\n\n ctx = rqstp->rq_svccred;\n\n maj_stat = gss_inquire_context(&min_stat, ctx, NULL, &name,\n\t\t\t\t NULL, NULL, NULL, NULL, NULL);\n if (maj_stat != GSS_S_COMPLETE) {\n\t krb5_klog_syslog(LOG_ERR, _(\"check_rpcsec_auth: failed \"\n\t\t\t\t \"inquire_context, stat=%u\"), maj_stat);\n\t log_badauth(maj_stat, min_stat, rqstp->rq_xprt, NULL);\n\t goto fail_name;\n }\n\n kctx = handle->context;\n ret = gss_to_krb5_name_1(rqstp, kctx, name, &princ, &gss_str);\n if (ret == 0)\n\t goto fail_name;\n\n slen = gss_str.length;\n trunc_name(&slen, &sdots);\n /*\n * Since we accept with GSS_C_NO_NAME, the client can authenticate\n * against the entire kdb. Therefore, ensure that the service\n * name is something reasonable.\n */\n if (krb5_princ_size(kctx, princ) != 2)\n\t goto fail_princ;\n\n c1 = krb5_princ_component(kctx, princ, 0);\n c2 = krb5_princ_component(kctx, princ, 1);\n realm = krb5_princ_realm(kctx, princ);\n if (strncmp(handle->params.realm, realm->data, realm->length) == 0\n\t && strncmp(\"kadmin\", c1->data, c1->length) == 0) {\n\n\t if (strncmp(\"history\", c2->data, c2->length) == 0)\n\t goto fail_princ;\n\t else\n\t success = 1;\n }\n\nfail_princ:\n if (!success) {\n\t krb5_klog_syslog(LOG_ERR, _(\"bad service principal %.*s%s\"),\n\t\t\t (int) slen, (char *) gss_str.value, sdots);\n }\n gss_release_buffer(&min_stat, &gss_str);\n krb5_free_principal(kctx, princ);\nfail_name:\n gss_release_name(&min_stat, &name);\n return success;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " recurseBuild($myNode, $newLeft, $newRight);\n }\n //eDebug($TheTree,true);\n\n echo \"Done\";\n\n /*function flattenArray(array $array){\n $ret_array = array();\n $counter=0;\n foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key=>$value) {\n if ($key=='id') {\n $counter++;\n }\n $ret_array[$counter][$key] = $value;\n }\n return $ret_array;\n }*/\n\n // takes a flat array with propper parent/child relationships in propper order\n // and adds the lft and rgt extents correctly for a nested set\n\n /*function nestify($categories) {\n // Trees mapped\n $trees = array();\n $trackParents = array();\n $depth=0;\n $counter=1;\n $prevDepth=0;\n\n foreach ($categories as $key=>$val) {\n if ($counter==1) {\n # first in loop. We should only hit this once: first.\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']>$prevDepth) {\n # we have a child of the previous node\n $trackParents[] = $key-1;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']==$prevDepth) {\n # we have a sibling of the previous node\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else {\n # we have moved up in depth, but how far up?\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $l=count($trackParents);\n while($l > 0 && $trackParents[$l - 1]['depth'] >= $val['depth']) {\n $categories[$trackParents[$l - 1]]['rgt'] = $counter;\n array_pop($trackParents);\n $counter++;\n $l--;\n }\n\n $categories[$key]['lft'] = $counter;\n //???$counter++;\n }\n $prevDepth=$val['depth'];\n }\n\n $categories[$key]['rgt'] = $counter;\n return $categories;\n } */\n\n // takes a flat nested set formatted array and creates a multi-dimensional array from it\n\n /*function toHierarchy($collection)\n {\n // Trees mapped\n $trees = array();\n $l = 0;\n\n if (count($collection) > 0) {\n // Node Stack. Used to help building the hierarchy\n $stack = array();\n\n foreach ($collection as $node) {\n $item = $node;\n $item['children'] = array();\n\n // Number of stack items\n $l = count($stack);\n\n // Check if we're dealing with different levels\n while($l > 0 && $stack[$l - 1]['depth'] >= $item['depth']) {\n array_pop($stack);\n $l--;\n }\n\n // Stack is empty (we are inspecting the root)\n if ($l == 0) {\n // Assigning the root node\n $i = count($trees);\n $trees[$i] = $item;\n $stack[] = & $trees[$i];\n } else {\n // Add node to parent\n $i = count($stack[$l - 1]['children']);\n $stack[$l - 1]['children'][$i] = $item;\n $stack[] = & $stack[$l - 1]['children'][$i];\n }\n }\n }\n\n return $trees;\n }*/\n\n // this will test our data manipulation\n // eDebug(toHierarchy(nestify(flattenArray($TheTree))),1);\n\n /*$flat_fixed_cats = nestify(flattenArray($TheTree));\n\n foreach ($flat_fixed_cats as $k=>$v) {\n $cat = new storeCategory($v['id']);\n $cat->lft = $v['lft'];\n $cat->rgt = $v['rgt'];\n $cat->save();\n eDebug($cat);\n }\n */\n //-Show Array Structure--//\n // print_r($TheTree);\n //\n //\n // //--Print the Categories, and send their children to DrawBranch--//\n // //--The code below allows you to keep track of what category you're currently drawing--//\n //\n // printf(\"
      \");\n //\n // foreach($TheTree as $MyNode) {\n // printf(\"
    • {$MyNode['Name']}
    • \");\n // if(is_array($MyNode[\"Children\"]) && !empty($MyNode[\"Children\"])) {\n // DrawBranch($MyNode[\"Children\"]);\n // }\n // }\n // printf(\"
    \");\n // //--Recursive printer, should draw a child, and any of its children--//\n //\n // function DrawBranch($Node){\n // printf(\"
      \");\n //\n // foreach($Node as $Entity) {\n // printf(\"
    • {$Entity['Name']}
    • \");\n //\n // if(is_array($Entity[\"Children\"]) && !empty($Entity[\"Children\"])) {\n // DrawBranch($Entity[\"Children\"]);\n // }\n //\n // printf(\"
    \");\n // }\n // }\n }", "label": 1, "label_name": "safe"} +{"code": "ua=E.actions.get(\"zoomOut\"),Da=E.actions.get(\"resetView\");p=E.actions.get(\"fullscreen\");var Fa=E.actions.get(\"undo\"),Ka=E.actions.get(\"redo\"),Oa=F(\"\",Fa.funct,null,mxResources.get(\"undo\")+\" (\"+Fa.shortcut+\")\",Fa,Editor.undoImage),Ia=F(\"\",Ka.funct,null,mxResources.get(\"redo\")+\" (\"+Ka.shortcut+\")\",Ka,Editor.redoImage),Ea=F(\"\",p.funct,null,mxResources.get(\"fullscreen\"),p,Editor.fullscreenImage);if(null!=T){C=function(){ta.style.display=null!=E.pages&&(\"0\"!=urlParams.pages||1 str:\n \"\"\"\n Adds word boundary characters to the start and end of an\n expression to require that the match occur as a whole word,\n but do so respecting the fact that strings starting or ending\n with non-word characters will change word boundaries.\n \"\"\"\n # we can't use \\b as it chokes on unicode. however \\W seems to be okay\n # as shorthand for [^0-9A-Za-z_].\n return r\"(^|\\W)%s(\\W|$)\" % (r,)", "label": 0, "label_name": "vulnerable"} +{"code": "static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer)\n{\n\tstruct sockaddr_rc *sa = (struct sockaddr_rc *) addr;\n\tstruct sock *sk = sock->sk;\n\n\tBT_DBG(\"sock %p, sk %p\", sock, sk);\n\n\tmemset(sa, 0, sizeof(*sa));\n\tsa->rc_family = AF_BLUETOOTH;\n\tsa->rc_channel = rfcomm_pi(sk)->channel;\n\tif (peer)\n\t\tbacpy(&sa->rc_bdaddr, &bt_sk(sk)->dst);\n\telse\n\t\tbacpy(&sa->rc_bdaddr, &bt_sk(sk)->src);\n\n\t*len = sizeof(struct sockaddr_rc);\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": " it \"should raise a ParseError if argument 1 isn't 'encode' or 'decode'\" do\n expect { scope.function_base64([\"bees\",\"astring\"]) }.to(raise_error(Puppet::ParseError, /first argument must be one of/))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " function update_option_master() {\n global $db;\n\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;\n\n $opt->update($this->params);\n\n // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {\n\n }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);\n\n expHistory::back();\n }", "label": 1, "label_name": "safe"} +{"code": " public function getMessage()\n {\n if (!$this->isSuccessful()) {\n return $this->data['error']['message'];\n }\n\n return;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "mxUtils.getOffset(l.container),U=l.view.translate,X=l.view.scale,u=null!=b.currentPage?b.currentPage.getId():null;c(\"cursor\",{pageId:u,x:Math.round((M.getX()-W.x+l.container.scrollLeft)/X-U.x),y:Math.round((M.getY()-W.y+l.container.scrollTop)/X-U.y)})}}function n(M,W){var U=null!=b.currentPage?b.currentPage.getId():null;if(null!=M&&null!=M.cursor&&null!=M.lastCursor)if(null!=M.lastCursor.hide||!b.isShowRemoteCursors()||null!=M.lastCursor.pageId&&M.lastCursor.pageId!=U)M.cursor.style.display=\"none\";\nelse{U=function(){var N=Math.max(l.container.scrollLeft,Math.min(l.container.scrollLeft+l.container.clientWidth-M.cursor.clientWidth,E)),Q=Math.max(l.container.scrollTop-22,Math.min(l.container.scrollTop+l.container.clientHeight-M.cursor.clientHeight,J));T.style.opacity=N!=E||Q!=J?0:1;M.cursor.style.left=N+\"px\";M.cursor.style.top=Q+\"px\";M.cursor.style.display=\"\"};var X=l.view.translate,u=l.view.scale,E=(X.x+M.lastCursor.x)*u+8,J=(X.y+M.lastCursor.y)*u-12,T=M.cursor.getElementsByTagName(\"img\")[0];\nW?(mxUtils.setPrefixedStyle(M.cursor.style,\"transition\",\"all 600ms ease-out\"),mxUtils.setPrefixedStyle(T.style,\"transition\",\"all 600ms ease-out\"),window.setTimeout(U,0)):(mxUtils.setPrefixedStyle(M.cursor.style,\"transition\",null),mxUtils.setPrefixedStyle(T.style,\"transition\",null),U())}}function v(M,W){function U(){if(null==y[u]){var Y=t[u];null==Y&&(Y=p%x.length,t[u]=Y,p++);var ba=x[Y];Y=11>2;c2=(x&3)<<4|A>>4;c3=(A&15)<<2|z>>6;c4=z&63;r=\"\";r+=q(c1&63);r+=q(c2&63);r+=q(c3&63);return r+=q(c4&63)}function q(x){if(10>x)return String.fromCharCode(48+x);x-=10;if(26>x)return String.fromCharCode(65+x);x-=26;if(26>x)return String.fromCharCode(97+x);x-=26;return 0==x?\"-\":1==x?\"_\":\"?\"}var v=new XMLHttpRequest;v.open(\"GET\",(\"txt\"==e?PLANT_URL+\"/txt/\":\"png\"==e?PLANT_URL+\"/png/\":\nPLANT_URL+\"/svg/\")+function(x){r=\"\";for(i=0;ithis.status)if(\"txt\"==e)g(this.response);else{var A=new FileReader;A.readAsDataURL(this.response);A.onloadend=function(z){var L=new Image;L.onload=\nfunction(){try{var M=L.width,n=L.height;if(0==M&&0==n){var y=A.result,K=y.indexOf(\",\"),B=decodeURIComponent(escape(atob(y.substring(K+1)))),F=mxUtils.parseXml(B).getElementsByTagName(\"svg\");0> 13) + 2) << 1;\n if (frame - frame_start < offset || frame_end - frame < count*2 + width)\n return AVERROR_INVALIDDATA;\n for (i = 0; i < count; i++) {\n frame[0] = frame[1] =\n frame[width] = frame[width + 1] = frame[-offset];\n\n frame += 2;\n }\n } else if (bitbuf & (mask << 1)) {\n v = bytestream2_get_le16(gb)*2;\n if (frame - frame_end < v)\n return AVERROR_INVALIDDATA;\n frame += v;\n } else {\n if (frame_end - frame < width + 4)\n return AVERROR_INVALIDDATA;\n frame[0] = frame[1] =\n frame[width] = frame[width + 1] = bytestream2_get_byte(gb);\n frame += 2;\n frame[0] = frame[1] =\n frame[width] = frame[width + 1] = bytestream2_get_byte(gb);\n frame += 2;\n }\n mask <<= 2;\n }\n\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node, bool is_arg_max) {\n const TfLiteTensor* input = GetInput(context, node, kInputTensor);\n const TfLiteTensor* axis = GetInput(context, node, kAxis);\n TfLiteTensor* output = GetOutput(context, node, kOutputTensor);\n if (IsDynamicTensor(output)) {\n TF_LITE_ENSURE_STATUS(ResizeOutput(context, input, axis, output));\n }\n\n#define TF_LITE_ARG_MIN_MAX(data_type, axis_type, output_type) \\\n optimized_ops::ArgMinMax( \\\n GetTensorShape(input), GetTensorData(input), \\\n GetTensorData(axis), GetTensorShape(output), \\\n GetTensorData(output), \\\n GetComparefunction(is_arg_max))\n if (axis->type == kTfLiteInt32) {\n switch (output->type) {\n case kTfLiteInt32: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int32_t, int32_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int32_t, int32_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int32_t, int32_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int32_t, int32_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n case kTfLiteInt64: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int32_t, int64_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int32_t, int64_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int32_t, int64_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int32_t, int64_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n default:\n context->ReportError(\n context, \"Only int32 and int64 are supported currently, got %s.\",\n TfLiteTypeGetName(output->type));\n return kTfLiteError;\n }\n } else {\n switch (output->type) {\n case kTfLiteInt32: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int64_t, int32_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int64_t, int32_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int64_t, int32_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int64_t, int32_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n case kTfLiteInt64: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int64_t, int64_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int64_t, int64_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int64_t, int64_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int64_t, int64_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n default:\n context->ReportError(\n context, \"Only int32 and int64 are supported currently, got %s.\",\n TfLiteTypeGetName(output->type));\n return kTfLiteError;\n }\n }\n#undef TF_LITE_ARG_MIN_MAX\n\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should work' do\n pp = <<-EOS\n class { 'mysql::server': root_password => 'test' }\n EOS\n\n # Run it twice and test for idempotency\n apply_manifest(pp, :catch_failures => true)\n expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "!0);V.init()}))})})}));d.actions.put(\"liveImage\",new Action(\"Live image...\",function(){var n=d.getCurrentFile();null!=n&&d.spinner.spin(document.body,mxResources.get(\"loading\"))&&d.getPublicUrl(d.getCurrentFile(),function(y){d.spinner.stop();null!=y?(y=new EmbedDialog(d,''),d.showDialog(y.container,450,240,!0,!0),y.init()):d.handleError({message:mxResources.get(\"invalidPublicUrl\")})})}));d.actions.put(\"embedImage\",", "label": 0, "label_name": "vulnerable"} +{"code": " public function downloadCsvAction(Request $request)\n {\n $this->checkPermission('reports');\n if ($exportFile = $request->get('exportFile')) {\n $exportFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . '/' . basename($exportFile);\n $response = new BinaryFileResponse($exportFile);\n $response->headers->set('Content-Type', 'text/csv; charset=UTF-8');\n $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'export.csv');\n $response->deleteFileAfterSend(true);\n\n return $response;\n }\n throw new FileNotFoundException(\"File \\\"$exportFile\\\" not found!\");\n }", "label": 1, "label_name": "safe"} +{"code": " it 'does ticket merge (07.01)' do\n group_no_permission = create(:group)\n ticket1 = create(\n :ticket,\n title: 'ticket merge1',\n group: ticket_group,\n customer_id: customer_user.id,\n )\n ticket2 = create(\n :ticket,\n title: 'ticket merge2',\n group: ticket_group,\n customer_id: customer_user.id,\n )\n ticket3 = create(\n :ticket,\n title: 'ticket merge2',\n group: group_no_permission,\n customer_id: customer_user.id,\n )\n\n authenticated_as(customer_user)\n get \"/api/v1/ticket_merge/#{ticket2.id}/#{ticket1.id}\", params: {}, as: :json\n expect(response).to have_http_status(:unauthorized)\n\n authenticated_as(agent_user)\n get \"/api/v1/ticket_merge/#{ticket2.id}/#{ticket1.id}\", params: {}, as: :json\n expect(response).to have_http_status(:ok)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['result']).to eq('failed')\n expect(json_response['message']).to eq('No such master ticket number!')\n\n get \"/api/v1/ticket_merge/#{ticket3.id}/#{ticket1.number}\", params: {}, as: :json\n expect(response).to have_http_status(:unauthorized)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['error']).to eq('Not authorized')\n expect(json_response['error_human']).to eq('Not authorized')\n\n get \"/api/v1/ticket_merge/#{ticket1.id}/#{ticket3.number}\", params: {}, as: :json\n expect(response).to have_http_status(:unauthorized)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['error']).to eq('Not authorized')\n expect(json_response['error_human']).to eq('Not authorized')\n\n get \"/api/v1/ticket_merge/#{ticket1.id}/#{ticket2.number}\", params: {}, as: :json\n expect(response).to have_http_status(:ok)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['result']).to eq('success')\n expect(json_response['master_ticket']['id']).to eq(ticket2.id)\n end", "label": 1, "label_name": "safe"} +{"code": " def test_received_nonsense_nothing(self):\n data = b\"\\r\\n\\r\\n\"\n result = self.parser.received(data)\n self.assertEqual(result, 4)\n self.assertTrue(self.parser.completed)\n self.assertEqual(self.parser.headers, {})", "label": 1, "label_name": "safe"} +{"code": " private function getDefinitionId($id)\n {\n $seen = array();\n while ($this->container->hasAlias($id)) {\n if (isset($seen[$id])) {\n throw new ServiceCircularReferenceException($id, array_keys($seen));\n }\n $seen[$id] = true;\n $id = (string) $this->container->getAlias($id);\n }\n\n return $id;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public static function add($tags) {\r\n\r\n $tag = explode(\",\", $tags);\r\n foreach ($tag as $t) {\r\n if (self::exist($t)) {\r\n return false;\r\n }else{\r\n $slug = Typo::slugify(Typo::cleanX($t));\r\n $cat = Typo::cleanX($t);\r\n $tag = Db::insert(\r\n sprintf(\"INSERT INTO `cat` VALUES (null, '%s', '%s', '%d', '', 'tag' )\",\r\n $cat, $slug, 0\r\n )\r\n );\r\n return true;\r\n }\r\n }\r\n\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " close: function(event, ui) {\n login_dialog_opened = false;\n location = \"/logout\";\n },", "label": 1, "label_name": "safe"} +{"code": "static int cac_get_serial_nr_from_CUID(sc_card_t* card, sc_serial_number_t* serial)\n{\n\tcac_private_data_t * priv = CAC_DATA(card);\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL);\n if (card->serialnr.len) {\n *serial = card->serialnr;\n SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS);\n }\n\tif (priv->cac_id_len) {\n\t\tserial->len = MIN(priv->cac_id_len, SC_MAX_SERIALNR);\n\t\tmemcpy(serial->value, priv->cac_id, serial->len);\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_FILE_NOT_FOUND);\n}", "label": 1, "label_name": "safe"} +{"code": " ErrorType decrypt(unsigned char* packet,\n uint32_t packet_len,\n unsigned char* length_bytes,\n unsigned char* tag) {\n ErrorType r = kErrNone;\n\n // `packet` layout:\n // \n\n int outlen;\n\n // Increment IV\n unsigned char lastiv[1];\n if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_IV_GEN, 1, lastiv)) {\n r = kErrOpenSSL;\n goto out;\n }\n\n // Set AAD (the packet length)\n if (!EVP_DecryptUpdate(ctx_, nullptr, &outlen, length_bytes, 4)) {\n r = kErrOpenSSL;\n goto out;\n }\n if (outlen != 4) {\n r = kErrAADFailure;\n goto out;\n }\n\n // Decrypt everything but the packet length\n if (EVP_DecryptUpdate(ctx_, packet, &outlen, packet, packet_len) != 1) {\n r = kErrOpenSSL;\n goto out;\n }\n if (static_cast(outlen) != packet_len) {\n r = kErrPartialDecrypt;\n goto out;\n }\n\n // Set authentication tag\n if (EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_SET_TAG, 16, tag) != 1) {\n r = kErrOpenSSL;\n goto out;\n }\n\n // Verify authentication tag\n if (!EVP_DecryptFinal_ex(ctx_, nullptr, &outlen)) {\n r = kErrOpenSSL;\n goto out;\n }\n\nout:\n return r;\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\tselect = function() {\n\t\t\t\t\tvar name = input.val().replace(/\\.((tar\\.(gz|bz|bz2|z|lzo))|cpio\\.gz|ps\\.gz|xcf\\.(gz|bz2)|[a-z0-9]{1,4})$/ig, '');\n\t\t\t\t\tinError = false;\n\t\t\t\t\tif (fm.UA.Mobile) {\n\t\t\t\t\t\toverlay.on('click', cancel)\n\t\t\t\t\t\t\t.removeClass('ui-front').elfinderoverlay('show');\n\t\t\t\t\t}\n\t\t\t\t\tinput.select().focus();\n\t\t\t\t\tinput[0].setSelectionRange && input[0].setSelectionRange(0, name.length);\n\t\t\t\t},", "label": 1, "label_name": "safe"} +{"code": " \"should return zero values\": function(res) {\n assert.equal(res.length, 0);\n },", "label": 0, "label_name": "vulnerable"} +{"code": "juniper_ggsn_print(netdissect_options *ndo,\n const struct pcap_pkthdr *h, register const u_char *p)\n{\n struct juniper_l2info_t l2info;\n struct juniper_ggsn_header {\n uint8_t svc_id;\n uint8_t flags_len;\n uint8_t proto;\n uint8_t flags;\n uint8_t vlan_id[2];\n uint8_t res[2];\n };\n const struct juniper_ggsn_header *gh;\n\n l2info.pictype = DLT_JUNIPER_GGSN;\n if (juniper_parse_header(ndo, p, h, &l2info) == 0)\n return l2info.header_len;\n\n p+=l2info.header_len;\n gh = (struct juniper_ggsn_header *)&l2info.cookie;\n\n ND_TCHECK(*gh);\n if (ndo->ndo_eflag) {\n ND_PRINT((ndo, \"proto %s (%u), vlan %u: \",\n tok2str(juniper_protocol_values,\"Unknown\",gh->proto),\n gh->proto,\n EXTRACT_16BITS(&gh->vlan_id[0])));\n }\n\n switch (gh->proto) {\n case JUNIPER_PROTO_IPV4:\n ip_print(ndo, p, l2info.length);\n break;\n case JUNIPER_PROTO_IPV6:\n ip6_print(ndo, p, l2info.length);\n break;\n default:\n if (!ndo->ndo_eflag)\n ND_PRINT((ndo, \"unknown GGSN proto (%u)\", gh->proto));\n }\n\n return l2info.header_len;\n\ntrunc:\n\tND_PRINT((ndo, \"[|juniper_services]\"));\n\treturn l2info.header_len;\n}", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n auto* params = reinterpret_cast(node->builtin_data);\n OpData* data = reinterpret_cast(node->user_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor1, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor2, &input2));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n TF_LITE_ENSURE_TYPES_EQ(context, input1->type, input2->type);\n output->type = input2->type;\n\n data->requires_broadcast = !HaveSameShapes(input1, input2);\n\n TfLiteIntArray* output_size = nullptr;\n if (data->requires_broadcast) {\n TF_LITE_ENSURE_OK(context, CalculateShapeForBroadcast(\n context, input1, input2, &output_size));\n } else {\n output_size = TfLiteIntArrayCopy(input1->dims);\n }\n\n if (output->type == kTfLiteUInt8) {\n TF_LITE_ENSURE_STATUS(CalculateActivationRangeQuantized(\n context, params->activation, output, &data->output_activation_min,\n &data->output_activation_max));\n const double real_multiplier =\n input1->params.scale / (input2->params.scale * output->params.scale);\n QuantizeMultiplier(real_multiplier, &data->output_multiplier,\n &data->output_shift);\n }\n\n return context->ResizeTensor(context, output, output_size);\n}", "label": 1, "label_name": "safe"} +{"code": " def test_basic_auth_invalid_username(self):\n with self.assertRaises(InvalidStatusCode) as raised:\n self.start_client(user_info=(\"goodbye\", \"iloveyou\"))\n self.assertEqual(raised.exception.status_code, 401)", "label": 1, "label_name": "safe"} +{"code": " private String getPath(String test, int sequence, boolean poison) {\n String path = contextPath + \"/servlet?action=\" + test + \"&sequence=\" + sequence;\n if (poison) {\n path += \"&poison=true\";\n }\n return path;\n }", "label": 1, "label_name": "safe"} +{"code": " } elseif ($trusted || $check_comments) {\n // always cleanup comments\n $trailing_hyphen = false;\n if ($e) {\n // perform check whether or not there's a trailing hyphen\n if (substr($token->data, -1) == '-') {\n $trailing_hyphen = true;\n }\n }\n $token->data = rtrim($token->data, '-');\n $found_double_hyphen = false;\n while (strpos($token->data, '--') !== false) {\n $found_double_hyphen = true;\n $token->data = str_replace('--', '-', $token->data);\n }\n if ($trusted || !empty($comment_lookup[trim($token->data)]) ||\n ($comment_regexp !== null && preg_match($comment_regexp, trim($token->data)))) {\n // OK good\n if ($e) {\n if ($trailing_hyphen) {\n $e->send(\n E_NOTICE,\n 'Strategy_RemoveForeignElements: Trailing hyphen in comment removed'\n );\n }\n if ($found_double_hyphen) {\n $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Hyphens in comment collapsed');\n }\n }\n } else {\n if ($e) {\n $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Comment removed');\n }\n continue;\n }\n } else {", "label": 1, "label_name": "safe"} +{"code": " it 'finds short ipv6' do\n shell(\"mysql -NBe \\\"SHOW GRANTS FOR 'test'@'::1/128'\\\"\") do |r|\n expect(r.stdout).to match(/GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'::1\\/128'/)\n expect(r.stderr).to be_empty\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)\n {\n $this->expressionLanguageProviders[] = $provider;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should exec for CentOS identified from operatingsystem' do\n allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)\n allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS')\n expect(subject).to receive(:execute).with(%w{/sbin/service iptables save})\n subject.persist_iptables(proto)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it param[:title] do\n matches = Array(param[:match])\n\n if matches.all? { |m| m.is_a? Regexp }\n matches.each { |item| should contain_concat__fragment(\"#{title}-header\").with_content(item) }\n else\n lines = subject.resource('concat::fragment', \"#{title}-header\").send(:parameters)[:content].split(\"\\n\")\n (lines & Array(param[:match])).should == Array(param[:match])\n end\n Array(param[:notmatch]).each do |item|\n should contain_concat__fragment(\"#{title}-header\").without_content(item)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* cond_tensor;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputConditionTensor,\n &cond_tensor));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n if (IsDynamicTensor(output)) {\n TF_LITE_ENSURE_OK(context,\n ResizeOutputTensor(context, cond_tensor, output));\n }\n\n TfLiteIntArray* dims = cond_tensor->dims;\n if (dims->size == 0) {\n // Scalar tensors are not supported.\n TF_LITE_KERNEL_LOG(context, \"Where op requires condition w/ rank > 0\");\n return kTfLiteError;\n }\n\n reference_ops::SelectTrueCoords(GetTensorShape(cond_tensor),\n GetTensorData(cond_tensor),\n GetTensorData(output));\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " protected function getDefault($key, $default)\n {\n if ( ! $this->fallback) {\n return $default;\n }\n\n return $this->fallback->get($key, $default);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " $product_status = new product_status($pstat);\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (oi.products_status = '\" . $product_status->title . \"'\";\n } else {\n $sqltmp .= \" OR oi.products_status = '\" . $product_status->title . \"'\";\n }\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n\n if (!empty($p['uidata'])) {\n $sqlwhere .= \" AND oi.user_input_fields != '' AND oi.user_input_fields != 'a:0:{}'\";\n }\n\n $inc = 0;\n $sqltmp = '';\n foreach ($p['discounts'] as $d) {\n if ($d == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (od.discounts_id = \" . $d;\n } else {\n $sqltmp .= \" OR od.discounts_id = \" . $d;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n\n if (!empty($p['blshpname'])) {\n $sqlwhere .= \" AND (b.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $p['blshpname'] . \"%')\";\n }\n\n if (!empty($p['email'])) {\n $sqlwhere .= \" AND (b.email LIKE '%\" . $p['email'] . \"%'\";\n $sqlwhere .= \" OR s.email LIKE '%\" . $p['email'] . \"%')\";\n }\n\n if (!empty($p['zip'])) {\n if ($p['bl-sp-zip'] == 'b') $sqlwhere .= \" AND b.zip LIKE '%\" . $p['zip'] . \"%'\";\n else if ($p['bl-sp-zip'] == 's') $sqlwhere .= \" AND s.zip LIKE '%\" . $p['zip'] . \"%'\";\n }\n\n if (isset($p['state'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['state'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" AND (b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" AND (s.state = \" . $s;\n } else {\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" OR b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" OR s.state = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }\n\n if (isset($p['payment_method'])) {\n $inc = 0;\n $sqltmp = '';\n //get each calculator's id \n\n foreach ($p['payment_method'] as $s) {\n if ($s == -1) continue;\n if ($s == 'VisaCard' || $s == 'AmExCard' || $s == 'MasterCard' || $s == 'DiscoverCard') {\n $paymentQuery = 'b.billing_options LIKE \"%' . $s . '%\"';\n } else {\n $bc = new billingcalculator();\n $calc = $bc->findBy('calculator_name', $s);\n $paymentQuery = 'billingcalculator_id = ' . $calc->id;\n }\n\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND ( \" . $paymentQuery;\n } else {\n $sqltmp .= \" OR \" . $paymentQuery;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }\n\n //echo $sql . $sqlwhere . \"
    \";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products\n [date-startdate] => \n [time-h-startdate] => \n [time-m-startdate] => \n [ampm-startdate] => am\n [date-enddate] => \n [time-h-enddate] => \n [time-m-enddate] => \n [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )\n\n [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )\n\n [order-range-op] => e\n [order-range-num] => \n [order-price-op] => l\n [order-price-num] => \n [pnam] => \n [sku] => \n [discounts] => Array\n (\n [0] => -1\n )\n\n [blshpname] => \n [email] => \n [bl-sp-zip] => s\n [zip] => \n [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )\n\n [status] => Array\n (\n [0] => -1\n )\n\n )\n */\n\n //$sqlwhere .= \" ORDER BY purchased_date DESC\";\n $count_sql .= $sql . $sqlwhere;\n $sql = $start_sql . $sql;\n expSession::set('order_print_query', $sql . $sqlwhere);\n $reportRecords = $db->selectObjectsBySql($sql . $sqlwhere);\n expSession::set('order_export_values', $reportRecords);\n\n //eDebug(expSession::get('order_export_values'));\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();\n //$items = $prod->find('all', 1, 'id DESC',25); \n //$items = $order->find('all', 1, 'id DESC',25); \n //$res = $mod->find('all',$sql,'id',25);\n //eDebug($items);\n //eDebug($sql . $sqlwhere); \n\n $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'count_sql' => $count_sql,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status Changed Date') => 'status_changed_date',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n\n //strftime(\"%a %d-%m-%Y\", get_first_day(3, 1, 2007)); Thursday, 1 April 2010 \n //$d_month_previous = date('n', mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n\n $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV',\n 'export_status_report' => 'Export Order Status Data to CSV',\n 'export_inventory' => 'Export Inventory Data to CSV',\n 'export_user_input_report' => 'Export User Input Data to CSV',\n 'export_order_items' => 'Export Order Items Data to CSV',\n 'show_payment_summary' => 'Show Payment & Tax Summary'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "def test_httpie_sessions_upgrade_all(tmp_path, mock_env, extra_args, extra_variables):\n mock_env._create_temp_config_dir = False\n mock_env.config_dir = tmp_path / \"config\"\n\n session_dir = mock_env.config_dir / SESSIONS_DIR_NAME / DUMMY_HOST\n session_dir.mkdir(parents=True)\n for original_session_file in SESSION_FILES_OLD:\n shutil.copy(original_session_file, session_dir)\n\n result = httpie(\n 'cli', 'sessions', 'upgrade-all', *extra_args, env=mock_env\n )\n assert result.exit_status == ExitStatus.SUCCESS\n\n for refactored_session_file, expected_session_file in zip(\n sorted(session_dir.glob(\"*.json\")),\n SESSION_FILES_NEW\n ):\n assert read_session_file(refactored_session_file) == read_session_file(\n expected_session_file, extra_variables=extra_variables\n )", "label": 1, "label_name": "safe"} +{"code": " it 'should remove Mysql_User[root@::1]' do\n should contain_mysql_user('root@::1').with_ensure('absent')\n end", "label": 0, "label_name": "vulnerable"} +{"code": " private function _pLookAhead()\n {\n if ($this->currentToken instanceof HTMLPurifier_Token_Start) {\n $nesting = 1;\n } else {\n $nesting = 0;\n }\n $ok = false;\n $i = null;\n while ($this->forwardUntilEndToken($i, $current, $nesting)) {\n $result = $this->_checkNeedsP($current);\n if ($result !== null) {\n $ok = $result;\n break;\n }\n }\n return $ok;\n }", "label": 1, "label_name": "safe"} +{"code": " it \"should execute 'git init --bare'\" do\n resource[:ensure] = :bare\n resource.delete(:source)\n expects_chdir\n expects_mkdir\n expects_directory?(false)\n provider.expects(:working_copy_exists?).returns(false)\n provider.expects(:git).with('init', '--bare')\n provider.create\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n{\n _Py_IDENTIFIER(__module__);\n _Py_IDENTIFIER(_ast3);\n PyObject *fnames, *result;\n int i;\n fnames = PyTuple_New(num_fields);\n if (!fnames) return NULL;\n for (i = 0; i < num_fields; i++) {\n PyObject *field = PyUnicode_FromString(fields[i]);\n if (!field) {\n Py_DECREF(fnames);\n return NULL;\n }\n PyTuple_SET_ITEM(fnames, i, field);\n }\n result = PyObject_CallFunction((PyObject*)&PyType_Type, \"s(O){OOOO}\",\n type, base,\n _PyUnicode_FromId(&PyId__fields), fnames,\n _PyUnicode_FromId(&PyId___module__),\n _PyUnicode_FromId(&PyId__ast3));\n Py_DECREF(fnames);\n return (PyTypeObject*)result;\n}", "label": 1, "label_name": "safe"} +{"code": " function startReads() {\n let reads = 0;\n let psrc = 0;\n while (pdst < fsize && reads < concurrency) {\n const chunk =\n (pdst + chunkSize > fsize ? fsize - pdst : chunkSize);\n singleRead(psrc, pdst, chunk);\n psrc += chunk;\n pdst += chunk;\n ++reads;\n }\n }", "label": 1, "label_name": "safe"} +{"code": "jas_image_t *bmp_decode(jas_stream_t *in, char *optstr)\n{\n\tjas_image_t *image;\n\tbmp_hdr_t hdr;\n\tbmp_info_t *info;\n\tuint_fast16_t cmptno;\n\tjas_image_cmptparm_t cmptparms[3];\n\tjas_image_cmptparm_t *cmptparm;\n\tuint_fast16_t numcmpts;\n\tlong n;\n\tbmp_dec_importopts_t opts;\n\tsize_t num_samples;\n\n\timage = 0;\n\tinfo = 0;\n\n\tif (bmp_dec_parseopts(optstr, &opts)) {\n\t\tgoto error;\n\t}\n\n\tjas_eprintf(\n\t \"THE BMP FORMAT IS NOT FULLY SUPPORTED!\\n\"\n\t \"THAT IS, THE JASPER SOFTWARE CANNOT DECODE ALL TYPES OF BMP DATA.\\n\"\n\t \"IF YOU HAVE ANY PROBLEMS, PLEASE TRY CONVERTING YOUR IMAGE DATA\\n\"\n\t \"TO THE PNM FORMAT, AND USING THIS FORMAT INSTEAD.\\n\"\n\t );\n\n\t/* Read the bitmap header. */\n\tif (bmp_gethdr(in, &hdr)) {\n\t\tjas_eprintf(\"cannot get header\\n\");\n\t\tgoto error;\n\t}\n\tJAS_DBGLOG(1, (\n\t \"BMP header: magic 0x%x; siz %d; res1 %d; res2 %d; off %d\\n\",\n\t hdr.magic, hdr.siz, hdr.reserved1, hdr.reserved2, hdr.off\n\t ));\n\n\t/* Read the bitmap information. */\n\tif (!(info = bmp_getinfo(in))) {\n\t\tjas_eprintf(\"cannot get info\\n\");\n\t\tgoto error;\n\t}\n\tJAS_DBGLOG(1,\n\t (\"BMP information: len %ld; width %ld; height %ld; numplanes %d; \"\n\t \"depth %d; enctype %ld; siz %ld; hres %ld; vres %ld; numcolors %ld; \"\n\t \"mincolors %ld\\n\", JAS_CAST(long, info->len),\n\t JAS_CAST(long, info->width), JAS_CAST(long, info->height),\n\t JAS_CAST(long, info->numplanes), JAS_CAST(long, info->depth),\n\t JAS_CAST(long, info->enctype), JAS_CAST(long, info->siz),\n\t JAS_CAST(long, info->hres), JAS_CAST(long, info->vres),\n\t JAS_CAST(long, info->numcolors), JAS_CAST(long, info->mincolors)));\n\n\tif (info->width < 0 || info->height < 0 || info->numplanes < 0 ||\n\t info->depth < 0 || info->siz < 0 || info->hres < 0 || info->vres < 0) {\n\t\tjas_eprintf(\"corrupt bit stream\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!jas_safe_size_mul3(info->width, info->height, info->numplanes,\n\t &num_samples)) {\n\t\tjas_eprintf(\"image size too large\\n\");\n\t\tgoto error;\n\t}\n\n\tif (opts.max_samples > 0 && num_samples > opts.max_samples) {\n\t\tjas_eprintf(\"maximum number of pixels exceeded (%zu)\\n\",\n\t\t opts.max_samples);\n\t\tgoto error;\n\t}\n\n\t/* Ensure that we support this type of BMP file. */\n\tif (!bmp_issupported(&hdr, info)) {\n\t\tjas_eprintf(\"error: unsupported BMP encoding\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Skip over any useless data between the end of the palette\n\t and start of the bitmap data. */\n\tif ((n = hdr.off - (BMP_HDRLEN + BMP_INFOLEN + BMP_PALLEN(info))) < 0) {\n\t\tjas_eprintf(\"error: possibly bad bitmap offset?\\n\");\n\t\tgoto error;\n\t}\n\tif (n > 0) {\n\t\tjas_eprintf(\"skipping unknown data in BMP file\\n\");\n\t\tif (bmp_gobble(in, n)) {\n\t\t\tgoto error;\n\t\t}\n\t}\n\n\t/* Get the number of components. */\n\tnumcmpts = bmp_numcmpts(info);\n\n\tfor (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,\n\t ++cmptparm) {\n\t\tcmptparm->tlx = 0;\n\t\tcmptparm->tly = 0;\n\t\tcmptparm->hstep = 1;\n\t\tcmptparm->vstep = 1;\n\t\tcmptparm->width = info->width;\n\t\tcmptparm->height = info->height;\n\t\tcmptparm->prec = 8;\n\t\tcmptparm->sgnd = false;\n\t}\n\n\t/* Create image object. */\n\tif (!(image = jas_image_create(numcmpts, cmptparms,\n\t JAS_CLRSPC_UNKNOWN))) {\n\t\tgoto error;\n\t}\n\n\tif (numcmpts == 3) {\n\t\tjas_image_setclrspc(image, JAS_CLRSPC_SRGB);\n\t\tjas_image_setcmpttype(image, 0,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R));\n\t\tjas_image_setcmpttype(image, 1,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G));\n\t\tjas_image_setcmpttype(image, 2,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B));\n\t} else {\n\t\tjas_image_setclrspc(image, JAS_CLRSPC_SGRAY);\n\t\tjas_image_setcmpttype(image, 0,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y));\n\t}\n\n\t/* Read the bitmap data. */\n\tif (bmp_getdata(in, info, image)) {\n\t\tgoto error;\n\t}\n\n\tbmp_info_destroy(info);\n\n\treturn image;\n\nerror:\n\tif (info) {\n\t\tbmp_info_destroy(info);\n\t}\n\tif (image) {\n\t\tjas_image_destroy(image);\n\t}\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": " public static function referenceFixtures() {\n return array(\n 'campaign' => array ('Campaign', '.CampaignMailingBehaviorTest'),\n 'lists' => 'X2List',\n 'credentials' => 'Credentials',\n 'users' => 'User',\n 'profile' => array('Profile','.marketing')\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": " return $fa->nameGlyph($icons, 'icon-');\r\n }\r\n } else {\r\n return array();\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " def test_escape_backtick\n assert_equal \"\\\\`\", escape_javascript(\"`\")\n end", "label": 1, "label_name": "safe"} +{"code": " public void testHeaderNameEndsWithControlChar1d() {\n testHeaderNameEndsWithControlChar(0x1d);\n }", "label": 1, "label_name": "safe"} +{"code": "def guest_only(view_func):\n # TODO: test!\n @wraps(view_func)\n def wrapper(request, *args, **kwargs):\n if request.user.is_authenticated:\n return redirect(request.GET.get('next', request.user.st.get_absolute_url()))\n\n return view_func(request, *args, **kwargs)\n\n return wrapper", "label": 0, "label_name": "vulnerable"} +{"code": "_PyObject_ArenaMalloc(void *ctx, size_t size)\n{\n return malloc(size);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\tcustomColsBuild = function() {\n\t\t\t\tvar customCols = '';\n\t\t\t\tvar columns = fm.options.uiOptions.cwd.listView.columns;\n\t\t\t\tfor (var i = 0; i < columns.length; i++) {\n\t\t\t\t\tcustomCols += '{' + columns[i] + '}';\n\t\t\t\t}\n\t\t\t\treturn customCols;\n\t\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": "function enableCurrency(e) {\n var button = $(e.currentTarget);\n var currencyId = parseInt(button.data('id'));\n\n $.post(enableCurrencyUrl, {\n _token: token,\n id: currencyId\n }).done(function (data) {\n // lame but it works\n location.reload();\n }).fail(function () {\n console.error('I failed :(');\n });\n return false;\n}", "label": 1, "label_name": "safe"} +{"code": "get_strings_2_svc(gstrings_arg *arg, struct svc_req *rqstp)\n{\n static gstrings_ret ret;\n char *prime_arg;\n gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER;\n gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_gstrings_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (! cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ) &&\n (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context,\n rqst2name(rqstp),\n ACL_INQUIRE,\n arg->princ,\n NULL))) {\n ret.code = KADM5_AUTH_GET;\n log_unauth(\"kadm5_get_strings\", prime_arg,\n &client_name, &service_name, rqstp);\n } else {\n ret.code = kadm5_get_strings((void *)handle, arg->princ, &ret.strings,\n &ret.count);\n if (ret.code != 0)\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(\"kadm5_get_strings\", prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n free(prime_arg);\nexit_func:\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n free_server_handle(handle);\n return &ret;\n}", "label": 1, "label_name": "safe"} +{"code": "flac_read_loop (SF_PRIVATE *psf, unsigned len)\n{\tFLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;\n\n\tpflac->pos = 0 ;\n\tpflac->len = len ;\n\tpflac->remain = len ;\n\n\t/* First copy data that has already been decoded and buffered. */\n\tif (pflac->frame != NULL && pflac->bufferpos < pflac->frame->header.blocksize)\n\t\tflac_buffer_copy (psf) ;\n\n\t/* Decode some more. */\n\twhile (pflac->pos < pflac->len)\n\t{\tif (FLAC__stream_decoder_process_single (pflac->fsd) == 0)\n\t\t\tbreak ;\n\t\tif (FLAC__stream_decoder_get_state (pflac->fsd) >= FLAC__STREAM_DECODER_END_OF_STREAM)\n\t\t\tbreak ;\n\t\t} ;\n\n\tpflac->ptr = NULL ;\n\n\treturn pflac->pos ;\n} /* flac_read_loop */", "label": 0, "label_name": "vulnerable"} +{"code": "function phorum_htmlpurifier_common()\n{\n require_once(dirname(__FILE__).'/htmlpurifier/HTMLPurifier.auto.php');\n require(dirname(__FILE__).'/init-config.php');\n\n $config = phorum_htmlpurifier_get_config();\n HTMLPurifier::getInstance($config);\n\n // increment revision.txt if you want to invalidate the cache\n $GLOBALS['PHORUM']['mod_htmlpurifier']['body_cache_serial'] = $config->getSerial();\n\n // load migration\n if (file_exists(dirname(__FILE__) . '/migrate.php')) {\n include(dirname(__FILE__) . '/migrate.php');\n } else {\n echo 'Error: No migration path specified for HTML Purifier, please check\n modes/htmlpurifier/migrate.bbcode.php for instructions on\n how to migrate from your previous markup language.';\n exit;\n }\n\n if (!function_exists('phorum_htmlpurifier_migrate')) {\n // Dummy function\n function phorum_htmlpurifier_migrate($data) {return $data;}\n }\n\n}", "label": 1, "label_name": "safe"} +{"code": "def test_get_frontend_context_variables_safe(component):\n # Set component.name to a potential XSS attack\n component.name = ''\n\n class Meta:\n safe = [\n \"name\",\n ]\n\n setattr(component, \"Meta\", Meta())\n\n frontend_context_variables = component.get_frontend_context_variables()\n frontend_context_variables_dict = orjson.loads(frontend_context_variables)\n assert len(frontend_context_variables_dict) == 1\n assert (\n frontend_context_variables_dict.get(\"name\")\n == ''\n )", "label": 0, "label_name": "vulnerable"} +{"code": " def test_quotas_update_as_user(self):\n body = {'quota_class_set': {'instances': 50, 'cores': 50,\n 'ram': 51200, 'volumes': 10,\n 'gigabytes': 1000, 'floating_ips': 10,\n 'metadata_items': 128, 'injected_files': 5,\n 'injected_file_content_bytes': 10240}}\n\n req = fakes.HTTPRequest.blank(\n '/v2/fake4/os-quota-class-sets/test_class')\n self.assertRaises(webob.exc.HTTPForbidden, self.controller.update,\n req, 'test_class', body)", "label": 0, "label_name": "vulnerable"} +{"code": " public void testUri() {\n final HttpHeadersBase headers = newHttp2Headers();\n assertThat(headers.uri()).isEqualTo(URI.create(\"https://netty.io/index.html\"));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *SizeMessage) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: SizeMessage: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: SizeMessage: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Size_\", wireType)\n\t\t\t}\n\t\t\tvar v int64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Size_ = &v\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Equal_\", wireType)\n\t\t\t}\n\t\t\tvar v int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tb := bool(v != 0)\n\t\t\tm.Equal_ = &b\n\t\tcase 3:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field String_\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthSizeunderscore\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthSizeunderscore\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\ts := string(dAtA[iNdEx:postIndex])\n\t\t\tm.String_ = &s\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipSizeunderscore(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthSizeunderscore\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 1, "label_name": "safe"} +{"code": "static inline u32 net_hash_mix(const struct net *net)\n{\n\treturn net->hash_mix;\n}", "label": 1, "label_name": "safe"} +{"code": " def edit_timecard\n Log.add_info(request, params.inspect)\n\n date_s = params[:date]\n\n if date_s.nil? or date_s.empty?\n @date = Date.today\n date_s = @date.strftime(Schedule::SYS_DATE_FORM)\n else\n @date = Date.parse(date_s)\n end\n\n @timecard = Timecard.get_for(@login_user.id, date_s)\n\n render(:partial => 'timecard', :layout => false)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)\n{\n\tconst char *sysinfo_table[] = {\n\t\tutsname()->sysname,\n\t\tutsname()->nodename,\n\t\tutsname()->release,\n\t\tutsname()->version,\n\t\tutsname()->machine,\n\t\t\"alpha\",\t/* instruction set architecture */\n\t\t\"dummy\",\t/* hardware serial number */\n\t\t\"dummy\",\t/* hardware manufacturer */\n\t\t\"dummy\",\t/* secure RPC domain */\n\t};\n\tunsigned long offset;\n\tconst char *res;\n\tlong len, err = -EINVAL;\n\n\toffset = command-1;\n\tif (offset >= ARRAY_SIZE(sysinfo_table)) {\n\t\t/* Digital UNIX has a few unpublished interfaces here */\n\t\tprintk(\"sysinfo(%d)\", command);\n\t\tgoto out;\n\t}\n\n\tdown_read(&uts_sem);\n\tres = sysinfo_table[offset];\n\tlen = strlen(res)+1;\n\tif ((unsigned long)len > (unsigned long)count)\n\t\tlen = count;\n\tif (copy_to_user(buf, res, len))\n\t\terr = -EFAULT;\n\telse\n\t\terr = 0;\n\tup_read(&uts_sem);\n out:\n\treturn err;\n}", "label": 1, "label_name": "safe"} +{"code": " public function getCardReference()\n {\n if (isset($this->data['object']) && 'customer' === $this->data['object']) {\n if (!empty($this->data['default_card'])) {\n return $this->data['default_card'];\n }\n if (!empty($this->data['id'])) {\n return $this->data['id'];\n }\n }\n if (isset($this->data['object']) && 'card' === $this->data['object']) {\n if (!empty($this->data['id'])) {\n return $this->data['id'];\n }\n }\n if (isset($this->data['object']) && 'charge' === $this->data['object']) {\n if (! empty($this->data['source'])) {\n if (! empty($this->data['source']['id'])) {\n return $this->data['source']['id'];\n }\n }\n }\n\n return;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tdm.setSize = function (width, height) {\n\t\t\tif (dmIframe) {\n\t\t\t\tdmIframe.width = width;\n\t\t\t\tdmIframe.height = height;\n\t\t\t}\n\t\t};", "label": 0, "label_name": "vulnerable"} +{"code": "static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb,\n\t\t unsigned int dataoff, unsigned int *timeouts)\n{\n\tstruct net *net = nf_ct_net(ct);\n\tstruct dccp_net *dn;\n\tstruct dccp_hdr _dh, *dh;\n\tconst char *msg;\n\tu_int8_t state;\n\n\tdh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);\n\tBUG_ON(dh == NULL);\n\n\tstate = dccp_state_table[CT_DCCP_ROLE_CLIENT][dh->dccph_type][CT_DCCP_NONE];\n\tswitch (state) {\n\tdefault:\n\t\tdn = dccp_pernet(net);\n\t\tif (dn->dccp_loose == 0) {\n\t\t\tmsg = \"nf_ct_dccp: not picking up existing connection \";\n\t\t\tgoto out_invalid;\n\t\t}\n\tcase CT_DCCP_REQUEST:\n\t\tbreak;\n\tcase CT_DCCP_INVALID:\n\t\tmsg = \"nf_ct_dccp: invalid state transition \";\n\t\tgoto out_invalid;\n\t}\n\n\tct->proto.dccp.role[IP_CT_DIR_ORIGINAL] = CT_DCCP_ROLE_CLIENT;\n\tct->proto.dccp.role[IP_CT_DIR_REPLY] = CT_DCCP_ROLE_SERVER;\n\tct->proto.dccp.state = CT_DCCP_NONE;\n\tct->proto.dccp.last_pkt = DCCP_PKT_REQUEST;\n\tct->proto.dccp.last_dir = IP_CT_DIR_ORIGINAL;\n\tct->proto.dccp.handshake_seq = 0;\n\treturn true;\n\nout_invalid:\n\tif (LOG_INVALID(net, IPPROTO_DCCP))\n\t\tnf_log_packet(net, nf_ct_l3num(ct), 0, skb, NULL, NULL,\n\t\t\t NULL, \"%s\", msg);\n\treturn false;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static void pcrypt_free(struct crypto_instance *inst)\n{\n\tstruct pcrypt_instance_ctx *ctx = crypto_instance_ctx(inst);\n\n\tcrypto_drop_aead(&ctx->spawn);\n\tkfree(inst);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " void getWithDefaultValueWorks() {\n final HttpHeadersBase headers = newEmptyHeaders();\n headers.add(\"name1\", \"value1\");\n\n assertThat(headers.get(\"name1\", \"defaultvalue\")).isEqualTo(\"value1\");\n assertThat(headers.get(\"noname\", \"defaultvalue\")).isEqualTo(\"defaultvalue\");\n }", "label": 1, "label_name": "safe"} +{"code": " it 'installs the right package' do\n pp = <<-EOS\n class { 'ntp':\n package_ensure => present,\n package_name => ['#{packagename}'],\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe package(packagename) do\n it { should be_installed }\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "spell_add_word(\n char_u\t*word,\n int\t\tlen,\n int\t\twhat,\t // SPELL_ADD_ values\n int\t\tidx,\t // \"zG\" and \"zW\": zero, otherwise index in\n\t\t\t // 'spellfile'\n int\t\tundo)\t // TRUE for \"zug\", \"zuG\", \"zuw\" and \"zuW\"\n{\n FILE\t*fd = NULL;\n buf_T\t*buf = NULL;\n int\t\tnew_spf = FALSE;\n char_u\t*fname;\n char_u\t*fnamebuf = NULL;\n char_u\tline[MAXWLEN * 2];\n long\tfpos, fpos_next = 0;\n int\t\ti;\n char_u\t*spf;\n\n if (!valid_spell_word(word))\n {\n\temsg(_(e_illegal_character_in_word));\n\treturn;\n }\n\n if (idx == 0)\t // use internal wordlist\n {\n\tif (int_wordlist == NULL)\n\t{\n\t int_wordlist = vim_tempname('s', FALSE);\n\t if (int_wordlist == NULL)\n\t\treturn;\n\t}\n\tfname = int_wordlist;\n }\n else\n {\n\t// If 'spellfile' isn't set figure out a good default value.\n\tif (*curwin->w_s->b_p_spf == NUL)\n\t{\n\t init_spellfile();\n\t new_spf = TRUE;\n\t}\n\n\tif (*curwin->w_s->b_p_spf == NUL)\n\t{\n\t semsg(_(e_option_str_is_not_set), \"spellfile\");\n\t return;\n\t}\n\tfnamebuf = alloc(MAXPATHL);\n\tif (fnamebuf == NULL)\n\t return;\n\n\tfor (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; ++i)\n\t{\n\t copy_option_part(&spf, fnamebuf, MAXPATHL, \",\");\n\t if (i == idx)\n\t\tbreak;\n\t if (*spf == NUL)\n\t {\n\t\tsemsg(_(e_spellfile_does_not_have_nr_entries), idx);\n\t\tvim_free(fnamebuf);\n\t\treturn;\n\t }\n\t}\n\n\t// Check that the user isn't editing the .add file somewhere.\n\tbuf = buflist_findname_exp(fnamebuf);\n\tif (buf != NULL && buf->b_ml.ml_mfp == NULL)\n\t buf = NULL;\n\tif (buf != NULL && bufIsChanged(buf))\n\t{\n\t emsg(_(e_file_is_loaded_in_another_buffer));\n\t vim_free(fnamebuf);\n\t return;\n\t}\n\n\tfname = fnamebuf;\n }\n\n if (what == SPELL_ADD_BAD || undo)\n {\n\t// When the word appears as good word we need to remove that one,\n\t// since its flags sort before the one with WF_BANNED.\n\tfd = mch_fopen((char *)fname, \"r\");\n\tif (fd != NULL)\n\t{\n\t while (!vim_fgets(line, MAXWLEN * 2, fd))\n\t {\n\t\tfpos = fpos_next;\n\t\tfpos_next = ftell(fd);\n\t\tif (fpos_next < 0)\n\t\t break; // should never happen\n\t\tif (STRNCMP(word, line, len) == 0\n\t\t\t&& (line[len] == '/' || line[len] < ' '))\n\t\t{\n\t\t // Found duplicate word. Remove it by writing a '#' at\n\t\t // the start of the line. Mixing reading and writing\n\t\t // doesn't work for all systems, close the file first.\n\t\t fclose(fd);\n\t\t fd = mch_fopen((char *)fname, \"r+\");\n\t\t if (fd == NULL)\n\t\t\tbreak;\n\t\t if (fseek(fd, fpos, SEEK_SET) == 0)\n\t\t {\n\t\t\tfputc('#', fd);\n\t\t\tif (undo)\n\t\t\t{\n\t\t\t home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);\n\t\t\t smsg(_(\"Word '%.*s' removed from %s\"),\n\t\t\t\t\t\t\t len, word, NameBuff);\n\t\t\t}\n\t\t }\n\t\t if (fseek(fd, fpos_next, SEEK_SET) != 0)\n\t\t {\n\t\t\tPERROR(_(\"Seek error in spellfile\"));\n\t\t\tbreak;\n\t\t }\n\t\t}\n\t }\n\t if (fd != NULL)\n\t\tfclose(fd);\n\t}\n }\n\n if (!undo)\n {\n\tfd = mch_fopen((char *)fname, \"a\");\n\tif (fd == NULL && new_spf)\n\t{\n\t char_u *p;\n\n\t // We just initialized the 'spellfile' option and can't open the\n\t // file. We may need to create the \"spell\" directory first. We\n\t // already checked the runtime directory is writable in\n\t // init_spellfile().\n\t if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname)\n\t {\n\t\tint c = *p;\n\n\t\t// The directory doesn't exist. Try creating it and opening\n\t\t// the file again.\n\t\t*p = NUL;\n\t\tvim_mkdir(fname, 0755);\n\t\t*p = c;\n\t\tfd = mch_fopen((char *)fname, \"a\");\n\t }\n\t}\n\n\tif (fd == NULL)\n\t semsg(_(e_cant_open_file_str), fname);\n\telse\n\t{\n\t if (what == SPELL_ADD_BAD)\n\t\tfprintf(fd, \"%.*s/!\\n\", len, word);\n\t else if (what == SPELL_ADD_RARE)\n\t\tfprintf(fd, \"%.*s/?\\n\", len, word);\n\t else\n\t\tfprintf(fd, \"%.*s\\n\", len, word);\n\t fclose(fd);\n\n\t home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);\n\t smsg(_(\"Word '%.*s' added to %s\"), len, word, NameBuff);\n\t}\n }\n\n if (fd != NULL)\n {\n\t// Update the .add.spl file.\n\tmkspell(1, &fname, FALSE, TRUE, TRUE);\n\n\t// If the .add file is edited somewhere, reload it.\n\tif (buf != NULL)\n\t buf_reload(buf, buf->b_orig_mode, FALSE);\n\n\tredraw_all_later(SOME_VALID);\n }\n vim_free(fnamebuf);\n}", "label": 1, "label_name": "safe"} +{"code": "def create_class_from_xml_string(target_class, xml_string):\n \"\"\"Creates an instance of the target class from a string.\n\n :param target_class: The class which will be instantiated and populated\n with the contents of the XML. This class must have a c_tag and a\n c_namespace class variable.\n :param xml_string: A string which contains valid XML. The root element\n of the XML string should match the tag and namespace of the desired\n class.\n\n :return: An instance of the target class with members assigned according to\n the contents of the XML - or None if the root XML tag and namespace did\n not match those of the target class.\n \"\"\"\n if not isinstance(xml_string, six.binary_type):\n xml_string = xml_string.encode('utf-8')\n tree = ElementTree.fromstring(xml_string)\n return create_class_from_element_tree(target_class, tree)", "label": 0, "label_name": "vulnerable"} +{"code": " public function testWithPortCannotBeZero()\n {\n (new Uri())->withPort(0);\n }", "label": 1, "label_name": "safe"} +{"code": "this.init=function(){function G(H){if(null!=H){var S=H.getAttribute(\"background\");if(null==S||\"\"==S||S==mxConstants.NONE)S=Editor.isDarkMode()?\"transparent\":\"#ffffff\";B.style.backgroundColor=S;(new mxCodec(H.ownerDocument)).decode(H,I.getModel());I.maxFitScale=1;I.fit(8);I.center()}return H}function P(H){null!=H&&(H=G(Editor.parseDiagramNode(H)));return H}mxEvent.addListener(E,\"change\",function(H){z=parseInt(E.value);P(L[z]);mxEvent.consume(H)});if(\"mxfile\"==t.nodeName){var J=t.getElementsByTagName(\"diagram\");", "label": 1, "label_name": "safe"} +{"code": " public function __construct($config) {\n $def = $config->getCSSDefinition();\n $this->info['font-style'] = $def->info['font-style'];\n $this->info['font-variant'] = $def->info['font-variant'];\n $this->info['font-weight'] = $def->info['font-weight'];\n $this->info['font-size'] = $def->info['font-size'];\n $this->info['line-height'] = $def->info['line-height'];\n $this->info['font-family'] = $def->info['font-family'];\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\tupdateFunc = function( i, contexts, values ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tcontexts[ i ] = this;\n\t\t\t\t\tvalues[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n\t\t\t\t\tif ( values === progressValues ) {\n\t\t\t\t\t\tdeferred.notifyWith( contexts, values );\n\t\t\t\t\t} else if ( !( --remaining ) ) {\n\t\t\t\t\t\tdeferred.resolveWith( contexts, values );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},", "label": 1, "label_name": "safe"} +{"code": "exports.watch = function(files, fn){\n var options = { interval: 100 };\n files.forEach(function(file){\n debug('file %s', file);\n fs.watchFile(file, options, function(curr, prev){\n if (prev.mtime < curr.mtime) fn(file);\n });\n });\n};", "label": 0, "label_name": "vulnerable"} +{"code": " def generation_time\n ::Time.at(to_bson.unpack(\"N\")[0]).utc\n end", "label": 1, "label_name": "safe"} +{"code": "static int __init pcd_init(void)\n{\n\tstruct pcd_unit *cd;\n\tint unit;\n\n\tif (disable)\n\t\treturn -EINVAL;\n\n\tpcd_init_units();\n\n\tif (pcd_detect())\n\t\treturn -ENODEV;\n\n\t/* get the atapi capabilities page */\n\tpcd_probe_capabilities();\n\n\tif (register_blkdev(major, name)) {\n\t\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\t\tif (!cd->disk)\n\t\t\t\tcontinue;\n\n\t\t\tblk_cleanup_queue(cd->disk->queue);\n\t\t\tblk_mq_free_tag_set(&cd->tag_set);\n\t\t\tput_disk(cd->disk);\n\t\t}\n\t\treturn -EBUSY;\n\t}\n\n\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\tif (cd->present) {\n\t\t\tregister_cdrom(&cd->info);\n\t\t\tcd->disk->private_data = cd;\n\t\t\tadd_disk(cd->disk);\n\t\t}\n\t}\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "void mlock_vma_page(struct page *page)\n{\n\t/* Serialize with page migration */\n\tBUG_ON(!PageLocked(page));\n\n\tif (!TestSetPageMlocked(page)) {\n\t\tmod_zone_page_state(page_zone(page), NR_MLOCK,\n\t\t\t\t hpage_nr_pages(page));\n\t\tcount_vm_event(UNEVICTABLE_PGMLOCKED);\n\t\tif (!isolate_lru_page(page))\n\t\t\tputback_lru_page(page);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "TEST(BasicInterpreter, AllocateTwice) {\n Interpreter interpreter;\n ASSERT_EQ(interpreter.AddTensors(2), kTfLiteOk);\n ASSERT_EQ(interpreter.SetInputs({0}), kTfLiteOk);\n ASSERT_EQ(interpreter.SetOutputs({1}), kTfLiteOk);\n\n TfLiteQuantizationParams quantized;\n ASSERT_EQ(interpreter.SetTensorParametersReadWrite(0, kTfLiteFloat32, \"\", {3},\n quantized),\n kTfLiteOk);\n ASSERT_EQ(interpreter.SetTensorParametersReadWrite(1, kTfLiteFloat32, \"\", {3},\n quantized),\n kTfLiteOk);\n\n TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr};\n reg.prepare = [](TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* tensor0;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &tensor0));\n TfLiteTensor* tensor1;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &tensor1));\n TfLiteIntArray* newSize = TfLiteIntArrayCopy(tensor0->dims);\n return context->ResizeTensor(context, tensor1, newSize);\n };\n reg.invoke = [](TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* a0;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &a0));\n TfLiteTensor* a1;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &a1));\n int num = a0->dims->data[0];\n for (int i = 0; i < num; i++) {\n a1->data.f[i] = a0->data.f[i];\n }\n return kTfLiteOk;\n };\n ASSERT_EQ(\n interpreter.AddNodeWithParameters({0}, {1}, nullptr, 0, nullptr, ®),\n kTfLiteOk);\n ASSERT_EQ(interpreter.ResizeInputTensor(0, {3}), kTfLiteOk);\n ASSERT_EQ(interpreter.AllocateTensors(), kTfLiteOk);\n ASSERT_EQ(interpreter.Invoke(), kTfLiteOk);\n char* old_tensor0_ptr = interpreter.tensor(0)->data.raw;\n char* old_tensor1_ptr = interpreter.tensor(1)->data.raw;\n\n ASSERT_EQ(interpreter.AllocateTensors(), kTfLiteOk);\n ASSERT_EQ(interpreter.Invoke(), kTfLiteOk);\n ASSERT_EQ(old_tensor0_ptr, interpreter.tensor(0)->data.raw);\n ASSERT_EQ(old_tensor1_ptr, interpreter.tensor(1)->data.raw);\n}", "label": 1, "label_name": "safe"} +{"code": "a._.elementsPath&&(b=a._.elementsPath.filters)&&b.push(function(b){var i=b.getName(),e=k[i]||!1;\"link\"==e&&0===b.getAttribute(\"href\").indexOf(\"mailto:\")?e=\"email\":\"span\"==i?b.getStyle(\"font-size\")?e=\"size\":b.getStyle(\"color\")&&(e=\"color\"):\"img\"==e&&(b=b.data(\"cke-saved-src\")||b.getAttribute(\"src\"))&&0===b.indexOf(a.config.smiley_path)&&(e=\"smiley\");return e})}})})();CKEDITOR.config.plugins='dialogui,dialog,a11yhelp,basicstyles,blockquote,clipboard,panel,floatpanel,menu,contextmenu,resize,button,toolbar,elementspath,enterkey,entities,popup,filebrowser,floatingspace,listblock,richcombo,format,horizontalrule,htmlwriter,wysiwygarea,image,indent,indentlist,fakeobjects,link,list,magicline,maximize,pastetext,pastefromword,removeformat,sourcearea,specialchar,menubutton,scayt,stylescombo,tab,table,tabletools,undo,wsc,bbcode';CKEDITOR.config.skin='moono';(function() {var setIcons = function(icons, strip) {var path = CKEDITOR.getUrl( 'plugins/' + strip );icons = icons.split( ',' );for ( var i = 0; i < icons.length; i++ )CKEDITOR.skin.icons[ icons[ i ] ] = { path: path, offset: -icons[ ++i ], bgsize : icons[ ++i ] };};if (CKEDITOR.env.hidpi) setIcons('bold,0,,italic,24,,strike,48,,subscript,72,,superscript,96,,underline,120,,blockquote,144,,copy-rtl,168,,copy,192,,cut-rtl,216,,cut,240,,paste-rtl,264,,paste,288,,horizontalrule,312,,image,336,,indent-rtl,360,,indent,384,,outdent-rtl,408,,outdent,432,,anchor-rtl,456,,anchor,480,,link,504,,unlink,528,,bulletedlist-rtl,552,,bulletedlist,576,,numberedlist-rtl,600,,numberedlist,624,,maximize,648,,pastetext-rtl,672,,pastetext,696,,pastefromword-rtl,720,,pastefromword,744,,removeformat,768,,source-rtl,792,,source,816,,specialchar,840,,scayt,864,,table,888,,redo-rtl,912,,redo,936,,undo-rtl,960,,undo,984,,spellchecker,1008,','icons_hidpi.png');else setIcons('bold,0,auto,italic,24,auto,strike,48,auto,subscript,72,auto,superscript,96,auto,underline,120,auto,blockquote,144,auto,copy-rtl,168,auto,copy,192,auto,cut-rtl,216,auto,cut,240,auto,paste-rtl,264,auto,paste,288,auto,horizontalrule,312,auto,image,336,auto,indent-rtl,360,auto,indent,384,auto,outdent-rtl,408,auto,outdent,432,auto,anchor-rtl,456,auto,anchor,480,auto,link,504,auto,unlink,528,auto,bulletedlist-rtl,552,auto,bulletedlist,576,auto,numberedlist-rtl,600,auto,numberedlist,624,auto,maximize,648,auto,pastetext-rtl,672,auto,pastetext,696,auto,pastefromword-rtl,720,auto,pastefromword,744,auto,removeformat,768,auto,source-rtl,792,auto,source,816,auto,specialchar,840,auto,scayt,864,auto,table,888,auto,redo-rtl,912,auto,redo,936,auto,undo-rtl,960,auto,undo,984,auto,spellchecker,1008,auto','icons.png');})();CKEDITOR.lang.languages={\"en\":1,\"de\":1};}());", "label": 1, "label_name": "safe"} +{"code": " public function handleEnd(&$token)\n {\n if ($token->markForDeletion) {\n $token = false;\n }\n }", "label": 1, "label_name": "safe"} +{"code": "CKEDITOR.env.version<11?a[g].$.styleSheet.cssText=a[g].$.styleSheet.cssText+f:a[g].$.innerHTML=a[g].$.innerHTML+f}}var g={};CKEDITOR.skin={path:a,loadPart:function(c,d){CKEDITOR.skin.name!=CKEDITOR.skinName.split(\",\")[0]?CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(a()+\"skin.js\"),function(){b(c,d)}):b(c,d)},getPath:function(a){return CKEDITOR.getUrl(e(a))},icons:{},addIcon:function(a,b,c,d){a=a.toLowerCase();this.icons[a]||(this.icons[a]={path:b,offset:c||0,bgsize:d||\"16px\"})},getIconStyle:function(a,", "label": 1, "label_name": "safe"} +{"code": " it 'finds ipv6' do\n shell(\"mysql -NBe \\\"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\\\"\") do |r|\n expect(r.stdout).to match(/GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'/)\n expect(r.stderr).to be_empty\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "!function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u=\"function\"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error(\"Cannot find module '\"+o+\"'\");throw l.code=\"MODULE_NOT_FOUND\",l}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var a=\"function\"==typeof require&&require,o=0;ogetTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_restriction/show', array(\n 'status_list' => array(\n SubtaskModel::STATUS_TODO => t('Todo'),\n SubtaskModel::STATUS_DONE => t('Done'),\n ),\n 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it 'lstrips strings' do\n pp = <<-EOS\n $a = \" blowzy night-frumps vex'd jack q \"\n $o = lstrip($a)\n notice(inline_template('lstrip is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/lstrip is \"blowzy night-frumps vex'd jack q \"/)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def create_q_page\n Log.add_info(request, params.inspect)\n\n return unless request.post?\n\n @tmpl_folder, @tmpl_q_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_RESEARCH)\n\n unless @tmpl_q_folder.nil?\n\n @items = Folder.get_items_admin(@tmpl_q_folder.id, 'xorder ASC')\n\n if !@items.nil? and @items.length >= ResearchesHelper::MAX_PAGES\n flash[:notice] = 'ERROR:' + t('research.max_pages')\n render(:partial => 'ajax_q_page', :layout => false)\n return\n end\n\n item = Item.new_research(@tmpl_q_folder.id)\n item.title = t('research.new_page')\n item.user_id = 0\n item.save!\n\n @items << item\n\n else\n Log.add_error(request, nil, '/'+TemplatesHelper::TMPL_ROOT+'/'+TemplatesHelper::TMPL_RESEARCH+' NOT found!')\n end\n\n render(:partial => 'ajax_q_page', :layout => false)\n end", "label": 1, "label_name": "safe"} +{"code": "function(K){l=K};this.setAutoScroll=function(K){p=K};this.setOpenFill=function(K){q=K};this.setStopClickEnabled=function(K){A=K};this.setSelectInserted=function(K){B=K};this.setSmoothing=function(K){f=K};this.setPerfectFreehandMode=function(K){O=K};this.setBrushSize=function(K){I.size=K};this.getBrushSize=function(){return I.size};var t=function(K){y=K;b.getRubberband().setEnabled(!K);b.graphHandler.setSelectEnabled(!K);b.graphHandler.setMoveEnabled(!K);b.container.style.cursor=K?\"crosshair\":\"\";b.fireEvent(new mxEventObject(\"freehandStateChanged\"))};", "label": 0, "label_name": "vulnerable"} +{"code": "func (svc *Service) ListUsers(ctx context.Context, opt fleet.UserListOptions) ([]*fleet.User, error) {\n\tuser := &fleet.User{}\n\tif opt.TeamID != 0 {\n\t\tuser.Teams = []fleet.UserTeam{{Team: fleet.Team{ID: opt.TeamID}}}\n\t}\n\tif err := svc.authz.Authorize(ctx, user, fleet.ActionRead); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn svc.ds.ListUsers(ctx, opt)\n}", "label": 1, "label_name": "safe"} +{"code": "cssp_read_tsrequest(STREAM token, STREAM pubkey)\n{\n\tSTREAM s;\n\tint length;\n\tint tagval;\n\n\ts = tcp_recv(NULL, 4);\n\n\tif (s == NULL)\n\t\treturn False;\n\n\t// verify ASN.1 header\n\tif (s->p[0] != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t{\n\t\tlogger(Protocol, Error,\n\t\t \"cssp_read_tsrequest(), expected BER_TAG_SEQUENCE|BER_TAG_CONSTRUCTED, got %x\",\n\t\t s->p[0]);\n\t\treturn False;\n\t}\n\n\t// peek at first 4 bytes to get full message length\n\tif (s->p[1] < 0x80)\n\t\tlength = s->p[1] - 2;\n\telse if (s->p[1] == 0x81)\n\t\tlength = s->p[2] - 1;\n\telse if (s->p[1] == 0x82)\n\t\tlength = (s->p[2] << 8) | s->p[3];\n\telse\n\t\treturn False;\n\n\t// receive the remainings of message\n\ts = tcp_recv(s, length);\n\n\t// parse the response and into nego token\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\treturn False;\n\n\t// version [0]\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\treturn False;\n\tin_uint8s(s, length);\n\n\t// negoToken [1]\n\tif (token)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\ttoken->end = token->p = token->data;\n\t\tout_uint8p(token, s->p, length);\n\t\ts_mark_end(token);\n\t}\n\n\t// pubKey [3]\n\tif (pubkey)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\tpubkey->data = pubkey->p = s->p;\n\t\tpubkey->end = pubkey->data + length;\n\t\tpubkey->size = length;\n\t}\n\n\n\treturn True;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,\n\t\t\t char __user *optval, unsigned int optlen)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct l2tp_session *session;\n\tstruct l2tp_tunnel *tunnel;\n\tstruct pppol2tp_session *ps;\n\tint val;\n\tint err;\n\n\tif (level != SOL_PPPOL2TP)\n\t\treturn udp_prot.setsockopt(sk, level, optname, optval, optlen);\n\n\tif (optlen < sizeof(int))\n\t\treturn -EINVAL;\n\n\tif (get_user(val, (int __user *)optval))\n\t\treturn -EFAULT;\n\n\terr = -ENOTCONN;\n\tif (sk->sk_user_data == NULL)\n\t\tgoto end;\n\n\t/* Get session context from the socket */\n\terr = -EBADF;\n\tsession = pppol2tp_sock_to_session(sk);\n\tif (session == NULL)\n\t\tgoto end;\n\n\t/* Special case: if session_id == 0x0000, treat as operation on tunnel\n\t */\n\tps = l2tp_session_priv(session);\n\tif ((session->session_id == 0) &&\n\t (session->peer_session_id == 0)) {\n\t\terr = -EBADF;\n\t\ttunnel = l2tp_sock_to_tunnel(ps->tunnel_sock);\n\t\tif (tunnel == NULL)\n\t\t\tgoto end_put_sess;\n\n\t\terr = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val);\n\t\tsock_put(ps->tunnel_sock);\n\t} else\n\t\terr = pppol2tp_session_setsockopt(sk, session, optname, val);\n\n\terr = 0;\n\nend_put_sess:\n\tsock_put(sk);\nend:\n\treturn err;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def warnDevDieIf(test: => Bo, errorCode: St, details: St = \"\"): U =\n warnDbgDieIf(test, errorCode, details)", "label": 1, "label_name": "safe"} +{"code": "MONGO_EXPORT bson_bool_t mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const char *pass ) {\n bson from_db;\n bson cmd;\n const char *nonce;\n int result;\n\n mongo_md5_state_t st;\n mongo_md5_byte_t digest[16];\n char hex_digest[33];\n\n if( mongo_simple_int_command( conn, db, \"getnonce\", 1, &from_db ) == MONGO_OK ) {\n bson_iterator it;\n bson_find( &it, &from_db, \"nonce\" );\n nonce = bson_iterator_string( &it );\n }\n else {\n return MONGO_ERROR;\n }\n\n mongo_pass_digest( user, pass, hex_digest );\n\n mongo_md5_init( &st );\n mongo_md5_append( &st, ( const mongo_md5_byte_t * )nonce, strlen( nonce ) );\n mongo_md5_append( &st, ( const mongo_md5_byte_t * )user, strlen( user ) );\n mongo_md5_append( &st, ( const mongo_md5_byte_t * )hex_digest, 32 );\n mongo_md5_finish( &st, digest );\n digest2hex( digest, hex_digest );\n\n bson_init( &cmd );\n bson_append_int( &cmd, \"authenticate\", 1 );\n bson_append_string( &cmd, \"user\", user );\n bson_append_string( &cmd, \"nonce\", nonce );\n bson_append_string( &cmd, \"key\", hex_digest );\n bson_finish( &cmd );\n\n bson_destroy( &from_db );\n\n result = mongo_run_command( conn, db, &cmd, NULL );\n\n bson_destroy( &cmd );\n\n return result;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " setter: function(path) {\n return (\n setCache.get(path) ||\n setCache.set(\n path,\n new Function('data, value', expr(path, 'data') + ' = value')\n )\n )\n },", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function updateTab($id, $array)\n\t{\n\t\tif (!$id || $id == '') {\n\t\t\t$this->setAPIResponse('error', 'id was not set', 422);\n\t\t\treturn null;\n\t\t}\n\t\tif (!$array) {\n\t\t\t$this->setAPIResponse('error', 'no data was sent', 422);\n\t\t\treturn null;\n\t\t}\n\t\t$tabInfo = $this->getTabById($id);\n\t\tif ($tabInfo) {\n\t\t\t$array = $this->checkKeys($tabInfo, $array);\n\t\t} else {\n\t\t\t$this->setAPIResponse('error', 'No tab info found', 404);\n\t\t\treturn false;\n\t\t}\n\t\tif (array_key_exists('name', $array)) {\n\t\t\t$array['name'] = $this->sanitizeUserString($array['name']);\n\t\t\tif ($this->isTabNameTaken($array['name'], $id)) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!$this->qualifyLength($array['name'], 50, true)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('default', $array)) {\n\t\t\tif ($array['default']) {\n\t\t\t\t$this->clearTabDefault();\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id_min', $array)) ? $array['group_id_min'] : $tabInfo['group_id_min'];\n\t\t\tif ($array['group_id'] < $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a lower Group Id Max than Group Id Min', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id_min', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id', $array)) ? $array['group_id'] : $tabInfo['group_id'];\n\t\t\tif ($array['group_id_min'] > $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a higher Group Id Min than Group Id Max', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t$response = [\n\t\t\tarray(\n\t\t\t\t'function' => 'query',\n\t\t\t\t'query' => array(\n\t\t\t\t\t'UPDATE tabs SET',\n\t\t\t\t\t$array,\n\t\t\t\t\t'WHERE id = ?',\n\t\t\t\t\t$id\n\t\t\t\t)\n\t\t\t),\n\t\t];\n\t\t$this->setAPIResponse(null, 'Tab info updated');\n\t\t$this->setLoggerChannel('Tab Management');\n\t\t$this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']');\n\t\treturn $this->processQueries($response);\n\t}", "label": 1, "label_name": "safe"} +{"code": " public function activate_address()\n {\n global $db, $user;\n\n $object = new stdClass();\n $object->id = $this->params['id'];\n $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], \"user_id=\" . $user->id);\n flash(\"message\", gt(\"Successfully updated address.\"));\n expHistory::back(); \n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tpublic function build() {\n\t\t\t$this->buildIncludes();\n\t\t\t$this->_view = General::sanitize($this->_view);\n\n\t\t\t$header = new XMLElement('div');\n\t\t\t$header->setAttribute('id', 'header');\n\t\t\t$jump = new XMLElement('div');\n\t\t\t$jump->setAttribute('id', 'jump');\n\t\t\t$content = new XMLElement('div');\n\t\t\t$content->setAttribute('id', 'content');\n\n\t\t\t$this->buildHeader($header);\n\t\t\t$this->buildNavigation($header);\n\n\t\t\t$this->buildJump($jump);\n\t\t\t$header->appendChild($jump);\n\n\t\t\t$this->Body->appendChild($header);\n\n\t\t\t$this->buildContent($content);\n\t\t\t$this->Body->appendChild($content);\n\n\t\t\treturn parent::generate();\n\t\t}", "label": 1, "label_name": "safe"} +{"code": "b.select()}else if(w(a)){b.moveToElementEditStart(a);b.select()}else{b=b.clone();b.moveToElementEditStart(a);y(c,e,b)}k.cancel()}}setTimeout(function(){c.selectionChange(1)})}}}))}})})();(function(){function Q(a,c,d){return m(c)&&m(d)&&d.equals(c.getNext(function(a){return!(z(a)||A(a)||p(a))}))}function u(a){this.upper=a[0];this.lower=a[1];this.set.apply(this,a.slice(2))}function J(a){var c=a.element;if(c&&m(c)&&(c=c.getAscendant(a.triggers,!0))&&a.editable.contains(c)){var d=K(c,!0);if(\"true\"==d.getAttribute(\"contenteditable\"))return c;if(d.is(a.triggers))return d}return null}function ga(a,c,d){o(a,c);o(a,d);a=c.size.bottom;d=d.size.top;return a&&d?0|(a+d)/2:a||d}function r(a,c,\nd){return c=c[d?\"getPrevious\":\"getNext\"](function(b){return b&&b.type==CKEDITOR.NODE_TEXT&&!z(b)||m(b)&&!p(b)&&!v(a,b)})}function K(a,c){if(a.data(\"cke-editable\"))return null;for(c||(a=a.getParent());a&&!a.data(\"cke-editable\");){if(a.hasAttribute(\"contenteditable\"))return a;a=a.getParent()}return null}function ha(a){var c=a.doc,d=B('',c),b=this.path+\"images/\"+(n.hidpi?\"hidpi/\":\"\")+\"icon.png\";q(d,", "label": 1, "label_name": "safe"} +{"code": " it 'understands offsets for adding rules to the middle' do\n resource = Puppet::Type.type(:firewall).new({ :name => '101 test', })\n allow(resource.provider.class).to receive(:instances).and_return(providers)\n expect(resource.provider.insert_order).to eq(2)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function applyToImage(Image $image, $x = 0, $y = 0)\n {\n $rectangle = new \\ImagickDraw;\n\n // set background\n $bgcolor = new Color($this->background);\n $rectangle->setFillColor($bgcolor->getPixel());\n\n // set border\n if ($this->hasBorder()) {\n $border_color = new Color($this->border_color);\n $rectangle->setStrokeWidth($this->border_width);\n $rectangle->setStrokeColor($border_color->getPixel());\n }\n\n $rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2);\n\n $image->getCore()->drawImage($rectangle);\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " $removed[] = $fi->getFilename();\n }\n if ($removed = implode(', ', $removed)) {\n $result .= $removed . ' ' . dgettext('tuleap-tracker', 'removed');\n }\n\n $added = $this->fetchAddedFiles(array_diff($this->files, $changeset_value->getFiles()), $format, $is_for_mail);\n if ($added && $result) {\n $result .= $format === 'html' ? '; ' : PHP_EOL;\n }\n $result .= $added;\n\n return $result;\n }\n return false;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct($inline, $block) {\n $this->inline = new HTMLPurifier_ChildDef_Optional($inline);\n $this->block = new HTMLPurifier_ChildDef_Optional($block);\n $this->elements = $this->block->elements;\n }", "label": 1, "label_name": "safe"} +{"code": " public function testFilterRelativePathBase()\n {\n $this->setBase('foo/baz.html');\n $this->assertFiltering('foo.php', 'foo/foo.php');\n }", "label": 1, "label_name": "safe"} +{"code": " failureRedirect: '/login/index.html' + origin + (origin ? '&error' : '?error'),\r\n failureFlash: 'Invalid username or password.'\r\n })(req, res, next);\r\n });\r", "label": 1, "label_name": "safe"} +{"code": "le64addr_string(netdissect_options *ndo, const u_char *ep)\n{\n\tconst unsigned int len = 8;\n\tregister u_int i;\n\tregister char *cp;\n\tregister struct bsnamemem *tp;\n\tchar buf[BUFSIZE];\n\n\ttp = lookup_bytestring(ndo, ep, len);\n\tif (tp->bs_name)\n\t\treturn (tp->bs_name);\n\n\tcp = buf;\n\tfor (i = len; i > 0 ; --i) {\n\t\t*cp++ = hex[*(ep + i - 1) >> 4];\n\t\t*cp++ = hex[*(ep + i - 1) & 0xf];\n\t\t*cp++ = ':';\n\t}\n\tcp --;\n\n\t*cp = '\\0';\n\n\ttp->bs_name = strdup(buf);\n\tif (tp->bs_name == NULL)\n\t\t(*ndo->ndo_error)(ndo, \"le64addr_string: strdup(buf)\");\n\n\treturn (tp->bs_name);\n}", "label": 1, "label_name": "safe"} +{"code": "error_t ftpClientParseDirEntry(char_t *line, FtpDirEntry *dirEntry)\n{\n uint_t i;\n size_t n;\n char_t *p;\n char_t *token;\n\n //Abbreviated months\n static const char_t months[13][4] =\n {\n \" \",\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n };\n\n //Read first field\n token = osStrtok_r(line, \" \\t\", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //MS-DOS listing format?\n if(osIsdigit(token[0]))\n {\n //Check modification date format\n if(osStrlen(token) == 8 && token[2] == '-' && token[5] == '-')\n {\n //The format of the date is mm-dd-yy\n dirEntry->modified.month = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.day = (uint8_t) osStrtoul(token + 3, NULL, 10);\n dirEntry->modified.year = (uint16_t) osStrtoul(token + 6, NULL, 10) + 2000;\n }\n else if(osStrlen(token) == 10 && token[2] == '/' && token[5] == '/')\n {\n //The format of the date is mm/dd/yyyy\n dirEntry->modified.month = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.day = (uint8_t) osStrtoul(token + 3, NULL, 10);\n dirEntry->modified.year = (uint16_t) osStrtoul(token + 6, NULL, 10);\n }\n else\n {\n //Invalid time format\n return ERROR_INVALID_SYNTAX;\n }\n\n //Read modification time\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Check modification time format\n if(osStrlen(token) >= 5 && token[2] == ':')\n {\n //The format of the time hh:mm\n dirEntry->modified.hours = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.minutes = (uint8_t) osStrtoul(token + 3, NULL, 10);\n\n //The PM period covers the 12 hours from noon to midnight\n if(strstr(token, \"PM\") != NULL)\n dirEntry->modified.hours += 12;\n }\n else\n {\n //Invalid time format\n return ERROR_INVALID_SYNTAX;\n }\n\n //Read next field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Check whether the current entry is a directory\n if(!osStrcmp(token, \"\"))\n {\n //Update attributes\n dirEntry->attributes |= FTP_FILE_ATTR_DIRECTORY;\n }\n else\n {\n //Save the size of the file\n dirEntry->size = osStrtoul(token, NULL, 10);\n }\n\n //Read filename field\n token = osStrtok_r(NULL, \" \\r\\n\", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Retrieve the length of the filename\n n = osStrlen(token);\n //Limit the number of characters to copy\n n = MIN(n, FTP_CLIENT_MAX_FILENAME_LEN);\n\n //Copy the filename\n osStrncpy(dirEntry->name, token, n);\n //Properly terminate the string with a NULL character\n dirEntry->name[n] = '\\0';\n }\n //Unix listing format?\n else\n {\n //Check file permissions\n if(strchr(token, 'd') != NULL)\n dirEntry->attributes |= FTP_FILE_ATTR_DIRECTORY;\n if(strchr(token, 'w') == NULL)\n dirEntry->attributes |= FTP_FILE_ATTR_READ_ONLY;\n\n //Read next field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Discard owner field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Discard group field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Read size field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Save the size of the file\n dirEntry->size = osStrtoul(token, NULL, 10);\n\n //Read modification time (month)\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Decode the 3-letter month name\n for(i = 1; i <= 12; i++)\n {\n //Compare month name\n if(!osStrcmp(token, months[i]))\n {\n //Save month number\n dirEntry->modified.month = i;\n break;\n }\n }\n\n //Read modification time (day)\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Save day number\n dirEntry->modified.day = (uint8_t) osStrtoul(token, NULL, 10);\n\n //Read next field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Check modification time format\n if(osStrlen(token) == 4)\n {\n //The format of the year is yyyy\n dirEntry->modified.year = (uint16_t) osStrtoul(token, NULL, 10);\n\n }\n else if(osStrlen(token) == 5)\n {\n //The format of the time hh:mm\n token[2] = '\\0';\n dirEntry->modified.hours = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.minutes = (uint8_t) osStrtoul(token + 3, NULL, 10);\n }\n else\n {\n //Invalid time format\n return ERROR_INVALID_SYNTAX;\n }\n\n //Read filename field\n token = osStrtok_r(NULL, \" \\r\\n\", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Retrieve the length of the filename\n n = osStrlen(token);\n //Limit the number of characters to copy\n n = MIN(n, FTP_CLIENT_MAX_FILENAME_LEN);\n\n //Copy the filename\n osStrncpy(dirEntry->name, token, n);\n //Properly terminate the string with a NULL character\n dirEntry->name[n] = '\\0';\n }\n\n //The directory entry is valid\n return NO_ERROR;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "func (x *UpdateAccountRequest) ProtoReflect() protoreflect.Message {\n\tmi := &file_console_proto_msgTypes[36]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function resolve(UriInterface $base, $rel)\n {\n if ($rel === null || $rel === '') {\n return $base;\n }\n\n if (!($rel instanceof UriInterface)) {\n $rel = new self($rel);\n }\n\n // Return the relative uri as-is if it has a scheme.\n if ($rel->getScheme()) {\n return $rel->withPath(static::removeDotSegments($rel->getPath()));\n }\n\n $relParts = [\n 'scheme' => $rel->getScheme(),\n 'authority' => $rel->getAuthority(),\n 'path' => $rel->getPath(),\n 'query' => $rel->getQuery(),\n 'fragment' => $rel->getFragment()\n ];\n\n $parts = [\n 'scheme' => $base->getScheme(),\n 'authority' => $base->getAuthority(),\n 'path' => $base->getPath(),\n 'query' => $base->getQuery(),\n 'fragment' => $base->getFragment()\n ];\n\n if (!empty($relParts['authority'])) {\n $parts['authority'] = $relParts['authority'];\n $parts['path'] = self::removeDotSegments($relParts['path']);\n $parts['query'] = $relParts['query'];\n $parts['fragment'] = $relParts['fragment'];\n } elseif (!empty($relParts['path'])) {\n if (substr($relParts['path'], 0, 1) == '/') {\n $parts['path'] = self::removeDotSegments($relParts['path']);\n $parts['query'] = $relParts['query'];\n $parts['fragment'] = $relParts['fragment'];\n } else {\n if (!empty($parts['authority']) && empty($parts['path'])) {\n $mergedPath = '/';\n } else {\n $mergedPath = substr($parts['path'], 0, strrpos($parts['path'], '/') + 1);\n }\n $parts['path'] = self::removeDotSegments($mergedPath . $relParts['path']);\n $parts['query'] = $relParts['query'];\n $parts['fragment'] = $relParts['fragment'];\n }\n } elseif (!empty($relParts['query'])) {\n $parts['query'] = $relParts['query'];\n } elseif ($relParts['fragment'] != null) {\n $parts['fragment'] = $relParts['fragment'];\n }\n\n return new self(static::createUriString(\n $parts['scheme'],\n $parts['authority'],\n $parts['path'],\n $parts['query'],\n $parts['fragment']\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function initializeSut() {\n sut = proxyquire(sourcePath + 'vcs/git', {\n \"child_process\": {\n exec: exec\n },\n \"path\": {\n dirname: dirname,\n basename: basename\n }\n });\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function prepare($config)\n {\n $this->target = $config->get('URI.' . $this->name);\n $this->parser = new HTMLPurifier_URIParser();\n $this->doEmbed = $config->get('URI.MungeResources');\n $this->secretKey = $config->get('URI.MungeSecretKey');\n if ($this->secretKey && !function_exists('hash_hmac')) {\n throw new Exception(\"Cannot use %URI.MungeSecretKey without hash_hmac support.\");\n }\n return true;\n }", "label": 1, "label_name": "safe"} +{"code": " reply: () => Promise.resolve()\n };\n const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);\n\n beforeEach(() => {\n sandbox = sinon.sandbox.create().usingPromise(Promise);\n\n sandbox.spy(mockClient, 'reply');\n });\n afterEach(() => {\n sandbox.restore();\n });\n\n it('// unsuccessful', () => {\n return cmdFn()\n .then(() => {\n expect(mockClient.reply.args[0][0]).to.equal(501);\n });\n });\n\n it('BAD // unsuccessful', () => {\n return cmdFn({command: {arg: 'BAD', directive: CMD}})\n .then(() => {\n expect(mockClient.reply.args[0][0]).to.equal(500);\n });\n });\n\n it('UTF8 BAD // unsuccessful', () => {\n return cmdFn({command: {arg: 'UTF8 BAD', directive: CMD}})\n .then(() => {\n expect(mockClient.reply.args[0][0]).to.equal(501);\n });\n });\n\n it('UTF8 OFF // successful', () => {\n return cmdFn({command: {arg: 'UTF8 OFF', directive: CMD}})\n .then(() => {\n expect(mockClient.encoding).to.equal('ascii');\n expect(mockClient.reply.args[0][0]).to.equal(200);\n });\n });\n\n it('UTF8 ON // successful', () => {\n return cmdFn({command: {arg: 'UTF8 ON', directive: CMD}})\n .then(() => {\n expect(mockClient.encoding).to.equal('utf8');\n expect(mockClient.reply.args[0][0]).to.equal(200);\n });\n });\n});", "label": 0, "label_name": "vulnerable"} +{"code": "ticketsController.uploadImageMDE = function (req, res) {\n var Chance = require('chance')\n var chance = new Chance()\n var fs = require('fs-extra')\n var Busboy = require('busboy')\n var busboy = new Busboy({\n headers: req.headers,\n limits: {\n files: 1,\n fileSize: 5 * 1024 * 1024 // 5mb limit\n }\n })\n\n var object = {}\n var error\n\n object.ticketId = req.headers.ticketid\n if (!object.ticketId) return res.status(400).json({ success: false })\n\n busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {\n if (mimetype.indexOf('image/') === -1) {\n error = {\n status: 500,\n message: 'Invalid File Type'\n }\n\n return file.resume()\n }\n\n var ext = path.extname(filename)\n var allowedExtensions = [\n '.jpg',\n '.jpeg',\n '.jpe',\n '.jif',\n '.jfif',\n '.jfi',\n '.png',\n '.gif',\n '.webp',\n '.tiff',\n '.tif',\n '.bmp',\n '.dib',\n '.heif',\n '.heic'\n ]\n\n if (!allowedExtensions.includes(ext.toLocaleLowerCase())) {\n error = {\n status: 400,\n message: 'Invalid File Type'\n }\n\n return file.resume()\n }\n\n var savePath = path.join(__dirname, '../../public/uploads/tickets', object.ticketId)\n // var sanitizedFilename = filename.replace(/[^a-z0-9.]/gi, '_').toLowerCase();\n var sanitizedFilename = chance.hash({ length: 20 }) + ext\n if (!fs.existsSync(savePath)) fs.ensureDirSync(savePath)\n\n object.filePath = path.join(savePath, 'inline_' + sanitizedFilename)\n object.filename = sanitizedFilename\n object.mimetype = mimetype\n\n if (fs.existsSync(object.filePath)) {\n error = {\n status: 500,\n message: 'File already exists'\n }\n\n return file.resume()\n }\n\n file.on('limit', function () {\n error = {\n status: 500,\n message: 'File too large'\n }\n\n // Delete the temp file\n if (fs.existsSync(object.filePath)) fs.unlinkSync(object.filePath)\n\n return file.resume()\n })\n\n file.pipe(fs.createWriteStream(object.filePath))\n })\n\n busboy.on('finish', function () {\n if (error) return res.status(error.status).send(error.message)\n\n if (_.isUndefined(object.ticketId) || _.isUndefined(object.filename) || _.isUndefined(object.filePath)) {\n return res.status(400).send('Invalid Form Data')\n }\n\n // Everything Checks out lets make sure the file exists and then add it to the attachments array\n if (!fs.existsSync(object.filePath)) return res.status(500).send('File Failed to Save to Disk')\n\n var fileUrl = '/uploads/tickets/' + object.ticketId + '/inline_' + object.filename\n\n return res.json({ filename: fileUrl, ticketId: object.ticketId })\n })\n\n req.pipe(busboy)\n}", "label": 1, "label_name": "safe"} +{"code": "parseUserInfo(DUL_USERINFO * userInfo,\n unsigned char *buf,\n unsigned long *itemLength,\n unsigned char typeRQorAC,\n unsigned long availData /* bytes left for in this PDU */)\n{\n unsigned short userLength;\n unsigned long length;\n OFCondition cond = EC_Normal;\n PRV_SCUSCPROLE *role;\n SOPClassExtendedNegotiationSubItem *extNeg = NULL;\n UserIdentityNegotiationSubItem *usrIdent = NULL;\n\n // minimum allowed size is 4 byte (case where the length of the user data is 0),\n // else we read past the buffer end\n if (availData < 4)\n return makeLengthError(\"user info\", availData, 4);\n\n // skip item type (50H) field\n userInfo->type = *buf++;\n // skip unused (\"reserved\") field\n userInfo->rsv1 = *buf++;\n // get and remember announced length of user data\n EXTRACT_SHORT_BIG(buf, userInfo->length);\n // .. and skip over the two length field bytes\n buf += 2;\n\n // userLength contains announced length of full user item structure,\n // will be used here to count down the available data later\n userLength = userInfo->length;\n // itemLength contains full length of the user item including the 4 bytes extra header (type, reserved + 2 for length)\n *itemLength = userLength + 4;\n\n // does this item claim to be larger than the available data?\n if (availData < *itemLength)\n return makeLengthError(\"user info\", availData, 0, userLength);\n\n DCMNET_TRACE(\"Parsing user info field (\"\n << STD_NAMESPACE hex << STD_NAMESPACE setfill('0') << STD_NAMESPACE setw(2) << (unsigned int)userInfo->type\n << STD_NAMESPACE dec << \"), Length: \" << (unsigned long)userInfo->length);\n // parse through different types of user items as long as we have data\n while (userLength > 0) {\n DCMNET_TRACE(\"Parsing remaining \" << (long)userLength << \" bytes of User Information\" << OFendl\n << \"Next item type: \"\n << STD_NAMESPACE hex << STD_NAMESPACE setfill('0') << STD_NAMESPACE setw(2) << (unsigned int)*buf);\n switch (*buf) {\n case DUL_TYPEMAXLENGTH:\n cond = parseMaxPDU(&userInfo->maxLength, buf, &length, userLength);\n if (cond.bad())\n return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"maximum length sub-item\", userLength, length);\n DCMNET_TRACE(\"Successfully parsed Maximum PDU Length\");\n break;\n case DUL_TYPEIMPLEMENTATIONCLASSUID:\n cond = parseSubItem(&userInfo->implementationClassUID,\n buf, &length, userLength);\n if (cond.bad())\n return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"Implementation Class UID sub-item\", userLength, length);\n break;\n\n case DUL_TYPEASYNCOPERATIONS:\n cond = parseDummy(buf, &length, userLength);\n if (cond.bad())\n return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"asynchronous operation user item type\", userLength, length);\n break;\n case DUL_TYPESCUSCPROLE:\n role = (PRV_SCUSCPROLE*)malloc(sizeof(PRV_SCUSCPROLE));\n if (role == NULL) return EC_MemoryExhausted;\n cond = parseSCUSCPRole(role, buf, &length, userLength);\n if (cond.bad()) return cond;\n LST_Enqueue(&userInfo->SCUSCPRoleList, (LST_NODE*)role);\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"SCP/SCU Role Selection sub-item\", userLength, length);\n break;\n case DUL_TYPEIMPLEMENTATIONVERSIONNAME:\n cond = parseSubItem(&userInfo->implementationVersionName,\n buf, &length, userLength);\n if (cond.bad()) return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"Implementation Version Name structure\", userLength, length);\n break;\n\n case DUL_TYPESOPCLASSEXTENDEDNEGOTIATION:\n /* parse an extended negotiation sub-item */\n extNeg = new SOPClassExtendedNegotiationSubItem;\n if (extNeg == NULL) return EC_MemoryExhausted;\n cond = parseExtNeg(extNeg, buf, &length, userLength);\n if (cond.bad()) return cond;\n if (userInfo->extNegList == NULL)\n {\n userInfo->extNegList = new SOPClassExtendedNegotiationSubItemList;\n if (userInfo->extNegList == NULL) return EC_MemoryExhausted;\n }\n userInfo->extNegList->push_back(extNeg);\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"SOP Class Extended Negotiation sub-item\", userLength, length);\n break;\n\n case DUL_TYPENEGOTIATIONOFUSERIDENTITY_REQ:\n case DUL_TYPENEGOTIATIONOFUSERIDENTITY_ACK:\n if (typeRQorAC == DUL_TYPEASSOCIATERQ)\n usrIdent = new UserIdentityNegotiationSubItemRQ();\n else // assume DUL_TYPEASSOCIATEAC\n usrIdent = new UserIdentityNegotiationSubItemAC();\n if (usrIdent == NULL) return EC_MemoryExhausted;\n cond = usrIdent->parseFromBuffer(buf, length /*return value*/, userLength);\n if (cond.bad())\n {\n delete usrIdent;\n return cond;\n }\n userInfo->usrIdent = usrIdent;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"User Identity sub-item\", userLength, length);\n break;\n default:\n // we hit an unknown user item that is not defined in the standard\n // or still unknown to DCMTK\n cond = parseDummy(buf, &length /* returns bytes \"handled\" by parseDummy */, userLength /* data available in bytes for user item */);\n if (cond.bad())\n return cond;\n // skip the bytes read\n buf += length;\n // subtract bytes of parsed data from available data bytes\n if (OFstatic_cast(unsigned short, length) != length\n || !OFStandard::safeSubtract(userLength, OFstatic_cast(unsigned short, length), userLength))\n return makeUnderflowError(\"unknown user item\", userLength, length);\n break;\n }\n }\n\n return EC_Normal;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function setUp()\n {\n parent::setup();\n $this->factory = new HTMLPurifier_DefinitionCacheFactory();\n $this->oldFactory = HTMLPurifier_DefinitionCacheFactory::instance();\n HTMLPurifier_DefinitionCacheFactory::instance($this->factory);\n }", "label": 1, "label_name": "safe"} +{"code": " public function test_getSchemaObj_invalidDefaultScheme()\n {\n $this->setUpNoValidSchemes();\n $this->config->set('URI.DefaultScheme', 'foobar');\n\n $uri = $this->createURI('hmm');\n\n $this->expectError('Default scheme object \"foobar\" was not readable');\n $result = $uri->getSchemeObj($this->config, $this->context);\n $this->assertIdentical($result, false);\n\n $this->tearDownSchemeRegistryMock();\n }", "label": 1, "label_name": "safe"} +{"code": "process_options(argc, argv)\nint argc;\nchar *argv[];\n{\n int i, l;\n\n /*\n * Process options.\n */\n while (argc > 1 && argv[1][0] == '-') {\n argv++;\n argc--;\n l = (int) strlen(*argv);\n /* must supply at least 4 chars to match \"-XXXgraphics\" */\n if (l < 4)\n l = 4;\n\n switch (argv[0][1]) {\n case 'D':\n case 'd':\n if ((argv[0][1] == 'D' && !argv[0][2])\n || !strcmpi(*argv, \"-debug\")) {\n wizard = TRUE, discover = FALSE;\n } else if (!strncmpi(*argv, \"-DECgraphics\", l)) {\n load_symset(\"DECGraphics\", PRIMARY);\n switch_symbols(TRUE);\n } else {\n raw_printf(\"Unknown option: %s\", *argv);\n }\n break;\n case 'X':\n\n discover = TRUE, wizard = FALSE;\n break;\n#ifdef NEWS\n case 'n':\n iflags.news = FALSE;\n break;\n#endif\n case 'u':\n if (argv[0][2]) {\n (void) strncpy(plname, argv[0] + 2, sizeof plname - 1);\n } else if (argc > 1) {\n argc--;\n argv++;\n (void) strncpy(plname, argv[0], sizeof plname - 1);\n } else {\n raw_print(\"Player name expected after -u\");\n }\n break;\n case 'I':\n case 'i':\n if (!strncmpi(*argv, \"-IBMgraphics\", l)) {\n load_symset(\"IBMGraphics\", PRIMARY);\n load_symset(\"RogueIBM\", ROGUESET);\n switch_symbols(TRUE);\n } else {\n raw_printf(\"Unknown option: %s\", *argv);\n }\n break;\n case 'p': /* profession (role) */\n if (argv[0][2]) {\n if ((i = str2role(&argv[0][2])) >= 0)\n flags.initrole = i;\n } else if (argc > 1) {\n argc--;\n argv++;\n if ((i = str2role(argv[0])) >= 0)\n flags.initrole = i;\n }\n break;\n case 'r': /* race */\n if (argv[0][2]) {\n if ((i = str2race(&argv[0][2])) >= 0)\n flags.initrace = i;\n } else if (argc > 1) {\n argc--;\n argv++;\n if ((i = str2race(argv[0])) >= 0)\n flags.initrace = i;\n }\n break;\n case 'w': /* windowtype */\n config_error_init(FALSE, \"command line\", FALSE);\n choose_windows(&argv[0][2]);\n config_error_done();\n break;\n case '@':\n flags.randomall = 1;\n break;\n default:\n if ((i = str2role(&argv[0][1])) >= 0) {\n flags.initrole = i;\n break;\n }\n /* else raw_printf(\"Unknown option: %s\", *argv); */\n }\n }\n\n#ifdef SYSCF\n if (argc > 1)\n raw_printf(\"MAXPLAYERS are set in sysconf file.\\n\");\n#else\n /* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */\n if (argc > 1)\n locknum = atoi(argv[1]);\n#endif\n#ifdef MAX_NR_OF_PLAYERS\n /* limit to compile-time limit */\n if (!locknum || locknum > MAX_NR_OF_PLAYERS)\n locknum = MAX_NR_OF_PLAYERS;\n#endif\n#ifdef SYSCF\n /* let syscf override compile-time limit */\n if (!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))\n locknum = sysopt.maxplayers;\n#endif\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function addDiscountToCart() {\n// global $user, $order;\n global $order;\n //lookup discount to see if it's real and valid, and not already in our cart\n //this will change once we allow more than one coupon code\n\n $discount = new discounts();\n $discount = $discount->getCouponByName(expString::escape($this->params['coupon_code']));\n\n if (empty($discount)) {\n flash('error', gt(\"This discount code you entered does not exist.\"));\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }\n\n //check to see if it's in our cart already\n if ($this->isDiscountInCart($discount->id)) {\n flash('error', gt(\"This discount code is already in your cart.\"));\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }\n\n //this should really be reworked, as it shoudn't redirect directly and not return\n $validateDiscountMessage = $discount->validateDiscount();\n if ($validateDiscountMessage == \"\") {\n //if all good, add to cart, otherwise it will have redirected\n $od = new order_discounts();\n $od->orders_id = $order->id;\n $od->discounts_id = $discount->id;\n $od->coupon_code = $discount->coupon_code;\n $od->title = $discount->title;\n $od->body = $discount->body;\n $od->save();\n // set this to just the discount applied via this coupon?? if so, when though? $od->discount_total = ??;\n flash('message', gt(\"The discount code has been applied to your cart.\"));\n } else {\n flash('error', $validateDiscountMessage);\n }\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }", "label": 1, "label_name": "safe"} +{"code": " public function __construct()\n {\n $this->pngBase64 =\n 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP'.\n 'C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA'.\n 'AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J'.\n 'REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq'.\n 'ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0'.\n 'vr4MkhoXe0rZigAAAABJRU5ErkJggg==';\n }", "label": 1, "label_name": "safe"} +{"code": "static size_t _php_mb_regex_get_option_string(char *str, size_t len, OnigOptionType option, OnigSyntaxType *syntax)\n{\n\tsize_t len_left = len;\n\tsize_t len_req = 0;\n\tchar *p = str;\n\tchar c;\n\n\tif ((option & ONIG_OPTION_IGNORECASE) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'i';\n\t\t}\n\t\t++len_req;\t\n\t}\n\n\tif ((option & ONIG_OPTION_EXTEND) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'x';\n\t\t}\n\t\t++len_req;\t\n\t}\n\n\tif ((option & (ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) ==\n\t\t\t(ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'p';\n\t\t}\n\t\t++len_req;\t\n\t} else {\n\t\tif ((option & ONIG_OPTION_MULTILINE) != 0) {\n\t\t\tif (len_left > 0) {\n\t\t\t\t--len_left;\n\t\t\t\t*(p++) = 'm';\n\t\t\t}\n\t\t\t++len_req;\t\n\t\t}\n\n\t\tif ((option & ONIG_OPTION_SINGLELINE) != 0) {\n\t\t\tif (len_left > 0) {\n\t\t\t\t--len_left;\n\t\t\t\t*(p++) = 's';\n\t\t\t}\n\t\t\t++len_req;\t\n\t\t}\n\t}\t\n\tif ((option & ONIG_OPTION_FIND_LONGEST) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'l';\n\t\t}\n\t\t++len_req;\t\n\t}\n\tif ((option & ONIG_OPTION_FIND_NOT_EMPTY) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'n';\n\t\t}\n\t\t++len_req;\t\n\t}\n\n\tc = 0;\n\n\tif (syntax == ONIG_SYNTAX_JAVA) {\n\t\tc = 'j';\n\t} else if (syntax == ONIG_SYNTAX_GNU_REGEX) {\n\t\tc = 'u';\n\t} else if (syntax == ONIG_SYNTAX_GREP) {\n\t\tc = 'g';\n\t} else if (syntax == ONIG_SYNTAX_EMACS) {\n\t\tc = 'c';\n\t} else if (syntax == ONIG_SYNTAX_RUBY) {\n\t\tc = 'r';\n\t} else if (syntax == ONIG_SYNTAX_PERL) {\n\t\tc = 'z';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_BASIC) {\n\t\tc = 'b';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_EXTENDED) {\n\t\tc = 'd';\n\t}\n\n\tif (c != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = c;\n\t\t}\n\t\t++len_req;\n\t}\n\n\n\tif (len_left > 0) {\n\t\t--len_left;\n\t\t*(p++) = '\\0';\n\t}\n\t++len_req;\t\n\tif (len < len_req) {\n\t\treturn len_req;\n\t}\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "B)):N.isSelectionEmpty()&&N.isEnabled()?(B.addSeparator(),this.addMenuItems(B,[\"editData\"],null,G),B.addSeparator(),this.addSubmenu(\"layout\",B),this.addSubmenu(\"insert\",B),this.addMenuItems(B,[\"-\",\"exitGroup\"],null,G)):N.isEnabled()&&this.addMenuItems(B,[\"-\",\"lockUnlock\"],null,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(B,F,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(B,[\"copyAsImage\"],null,G)};EditorUi.prototype.toggleFormatPanel=", "label": 0, "label_name": "vulnerable"} +{"code": " public static String getAttachedFilePath(String inputStudyOid) {\n \t// Using a standard library to validate/Sanitize user inputs which will be used in path expression to prevent from path traversal\n \tString studyOid = FilenameUtils.getName(inputStudyOid);\n String attachedFilePath = CoreResources.getField(\"attached_file_location\");\n if (attachedFilePath == null || attachedFilePath.length() <= 0) {\n attachedFilePath = CoreResources.getField(\"filePath\") + \"attached_files\" + File.separator + studyOid + File.separator;\n } else {\n attachedFilePath += studyOid + File.separator;\n }\n return attachedFilePath;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)\n{\n\tgfn_t gfn, end_gfn;\n\tpfn_t pfn;\n\tint r = 0;\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tint flags;\n\n\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;\n\n\tgfn = slot->base_gfn;\n\tend_gfn = gfn + slot->npages;\n\n\tflags = IOMMU_READ;\n\tif (!(slot->flags & KVM_MEM_READONLY))\n\t\tflags |= IOMMU_WRITE;\n\tif (!kvm->arch.iommu_noncoherent)\n\t\tflags |= IOMMU_CACHE;\n\n\n\twhile (gfn < end_gfn) {\n\t\tunsigned long page_size;\n\n\t\t/* Check if already mapped */\n\t\tif (iommu_iova_to_phys(domain, gfn_to_gpa(gfn))) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Get the page size we could use to map */\n\t\tpage_size = kvm_host_page_size(kvm, gfn);\n\n\t\t/* Make sure the page_size does not exceed the memslot */\n\t\twhile ((gfn + (page_size >> PAGE_SHIFT)) > end_gfn)\n\t\t\tpage_size >>= 1;\n\n\t\t/* Make sure gfn is aligned to the page size we want to map */\n\t\twhile ((gfn << PAGE_SHIFT) & (page_size - 1))\n\t\t\tpage_size >>= 1;\n\n\t\t/* Make sure hva is aligned to the page size we want to map */\n\t\twhile (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))\n\t\t\tpage_size >>= 1;\n\n\t\t/*\n\t\t * Pin all pages we are about to map in memory. This is\n\t\t * important because we unmap and unpin in 4kb steps later.\n\t\t */\n\t\tpfn = kvm_pin_pages(slot, gfn, page_size);\n\t\tif (is_error_noslot_pfn(pfn)) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Map into IO address space */\n\t\tr = iommu_map(domain, gfn_to_gpa(gfn), pfn_to_hpa(pfn),\n\t\t\t page_size, flags);\n\t\tif (r) {\n\t\t\tprintk(KERN_ERR \"kvm_iommu_map_address:\"\n\t\t\t \"iommu failed to map pfn=%llx\\n\", pfn);\n\t\t\tgoto unmap_pages;\n\t\t}\n\n\t\tgfn += page_size >> PAGE_SHIFT;\n\n\n\t}\n\n\treturn 0;\n\nunmap_pages:\n\tkvm_iommu_put_pages(kvm, slot->base_gfn, gfn);\n\treturn r;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " protected function prepareConfig(array $config)\n {\n $config = new Config($config);\n $config->setFallback($this->getConfig());\n\n return $config;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public static function remove($token){\n $json = Options::get('tokens');\n $tokens = json_decode($json, true);\n unset($tokens[$token]);\n $tokens = json_encode($tokens);\n if(Options::update('tokens',$tokens)){\n return true;\n }else{\n return false;\n }\n }", "label": 1, "label_name": "safe"} +{"code": " void existingDocumentTerminalFromUI() throws Exception\n {\n // current document = xwiki:Main.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"Main\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(false);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Submit from the UI spaceReference=X&name=Y&tocreate=terminal\n when(mockRequest.getParameter(\"spaceReference\")).thenReturn(\"X\");\n when(mockRequest.getParameter(\"name\")).thenReturn(\"Y\");\n when(mockRequest.getParameter(\"tocreate\")).thenReturn(\"terminal\");\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: We are creating X.Y instead of X.Y.WebHome because the tocreate parameter says \"terminal\".\n verify(mockURLFactory).createURL(\"X\", \"Y\", \"edit\", \"template=&parent=Main.WebHome&title=Y\", null, \"xwiki\",\n context);\n }", "label": 1, "label_name": "safe"} +{"code": "def _get_default_quotas():\n defaults = {\n 'instances': FLAGS.quota_instances,\n 'cores': FLAGS.quota_cores,\n 'ram': FLAGS.quota_ram,\n 'volumes': FLAGS.quota_volumes,\n 'gigabytes': FLAGS.quota_gigabytes,\n 'floating_ips': FLAGS.quota_floating_ips,\n 'metadata_items': FLAGS.quota_metadata_items,\n 'injected_files': FLAGS.quota_injected_files,\n 'injected_file_content_bytes':\n FLAGS.quota_injected_file_content_bytes,\n 'security_groups': FLAGS.quota_security_groups,\n 'security_group_rules': FLAGS.quota_security_group_rules,\n }\n # -1 in the quota flags means unlimited\n return defaults", "label": 1, "label_name": "safe"} +{"code": "ba.src=\"/images/icon-search.svg\"};b.sidebar.hideTooltip();b.sidebar.currentElt=ca;Ca=!0;ba.src=\"/images/aui-wait.gif\";fa.isExt?e(fa,oa,function(){A(mxResources.get(\"cantLoadPrev\"));Ca=!1;ba.src=\"/images/icon-search.svg\"}):ia(fa.url,oa)}}function n(fa,ca,ba){if(null!=C){for(var ja=C.className.split(\" \"),ia=0;ia=na.getStatus()?ja(na.getText(),oa):ia()})):ja(b.emptyDiagramXml,oa)},ja=function(oa,na){x||b.hideDialog(!0);f(oa,na,qa,ca)},ia=function(){A(mxResources.get(\"cannotLoad\"));ma()},ma=function(){I=qa;Ba.className=\"geTempDlgCreateBtn\";ca&&(Ka.className=\"geTempDlgOpenBtn\")},", "label": 0, "label_name": "vulnerable"} +{"code": " public function updateMemoryUsage()\n {\n $this->data['memory'] = memory_get_peak_usage(true);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "def test_datetime_parsing(value, result):\n if type(result) == type and issubclass(result, Exception):\n with pytest.raises(result):\n parse_datetime(value)\n else:\n assert parse_datetime(value) == result", "label": 1, "label_name": "safe"} +{"code": " public function save_change_password() {\n global $user;\n\n $isuser = ($this->params['uid'] == $user->id) ? 1 : 0;\n\n if (!$user->isAdmin() && !$isuser) {\n flash('error', gt('You do not have permissions to change this users password.'));\n expHistory::back();\n }\n\n if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {\n flash('error', gt('The current password you entered is not correct.'));\n expHistory::returnTo('editable');\n }\n //eDebug($user);\n $u = new user($this->params['uid']);\n\n $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);\n //eDebug($u, true);\n if (is_string($ret)) {\n flash('error', $ret);\n expHistory::returnTo('editable');\n } else {\n $params = array();\n $params['is_admin'] = !empty($u->is_admin);\n $params['is_acting_admin'] = !empty($u->is_acting_admin);\n $u->update($params);\n }\n\n if (!$isuser) {\n flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));\n } else {\n $user->password = $u->password;\n flash('message', gt('Your password has been changed.'));\n }\n expHistory::back();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "int main(int argc, char *argv[])\n{\n libettercap_init();\n ef_globals_alloc();\n select_text_interface();\n libettercap_ui_init();\n /* etterfilter copyright */\n fprintf(stdout, \"\\n\" EC_COLOR_BOLD \"%s %s\" EC_COLOR_END \" copyright %s %s\\n\\n\", \n PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS);\n \n /* initialize the line number */\n EF_GBL->lineno = 1;\n \n /* getopt related parsing... */\n parse_options(argc, argv);\n\n /* set the input for source file */\n if (EF_GBL_OPTIONS->source_file) {\n yyin = fopen(EF_GBL_OPTIONS->source_file, \"r\");\n if (yyin == NULL)\n FATAL_ERROR(\"Input file not found !\");\n } else {\n FATAL_ERROR(\"No source file.\");\n }\n\n /* no buffering */\n setbuf(yyin, NULL);\n setbuf(stdout, NULL);\n setbuf(stderr, NULL);\n\n \n /* load the tables in etterfilter.tbl */\n load_tables();\n /* load the constants in etterfilter.cnt */\n load_constants();\n\n /* print the message */\n fprintf(stdout, \"\\n Parsing source file \\'%s\\' \", EF_GBL_OPTIONS->source_file);\n fflush(stdout);\n\n ef_debug(1, \"\\n\");\n\n /* begin the parsing */\n if (yyparse() == 0)\n fprintf(stdout, \" done.\\n\\n\");\n else\n fprintf(stdout, \"\\n\\nThe script contains errors...\\n\\n\");\n \n /* write to file */\n if (write_output() != E_SUCCESS)\n FATAL_ERROR(\"Cannot write output file (%s)\", EF_GBL_OPTIONS->output_file);\n ef_globals_free();\n return 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "func (cn *clusterNode) resurrect() {\n\tgRPCServer, err := comm_utils.NewGRPCServer(cn.bindAddress, cn.serverConfig)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed starting gRPC server: %v\", err))\n\t}\n\tcn.srv = gRPCServer\n\torderer.RegisterClusterServer(gRPCServer.Server(), cn)\n\tgo cn.srv.Start()\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testIgnoreInvalidData()\n {\n $this->assertResult(\n '',\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": "archive_write_disk_set_acls(struct archive *a, int fd, const char *name,\n struct archive_acl *abstract_acl, __LA_MODE_T mode)\n{\n\tint\t\tret = ARCHIVE_OK;\n\n\t(void)mode;\t/* UNUSED */\n\n\tif ((archive_acl_types(abstract_acl)\n\t & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {\n\t\t/* Solaris writes POSIX.1e access and default ACLs together */\n\t\tret = set_acl(a, fd, name, abstract_acl,\n\t\t ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, \"posix1e\");\n\n\t\t/* Simultaneous POSIX.1e and NFSv4 is not supported */\n\t\treturn (ret);\n\t}\n#if ARCHIVE_ACL_SUNOS_NFS4\n\telse if ((archive_acl_types(abstract_acl) &\n\t ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {\n\t\tret = set_acl(a, fd, name, abstract_acl,\n\t\t ARCHIVE_ENTRY_ACL_TYPE_NFS4, \"nfs4\");\n\t}\n#endif\n\treturn (ret);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tcancel: function() {\n\n\t\tif (this.dragging) {\n\n\t\t\tthis._mouseUp({ target: null });\n\n\t\t\tif (this.options.helper === \"original\") {\n\t\t\t\tthis.currentItem.css(this._storedCSS).removeClass(\"ui-sortable-helper\");\n\t\t\t} else {\n\t\t\t\tthis.currentItem.show();\n\t\t\t}\n\n\t\t\t//Post deactivating events to containers\n\t\t\tfor (var i = this.containers.length - 1; i >= 0; i--) {\n\t\t\t\tthis.containers[i]._trigger(\"deactivate\", null, this._uiHash(this));\n\t\t\t\tif (this.containers[i].containerCache.over) {\n\t\t\t\t\tthis.containers[i]._trigger(\"out\", null, this._uiHash(this));\n\t\t\t\t\tthis.containers[i].containerCache.over = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (this.placeholder) {\n\t\t\t//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!\n\t\t\tif (this.placeholder[0].parentNode) {\n\t\t\t\tthis.placeholder[0].parentNode.removeChild(this.placeholder[0]);\n\t\t\t}\n\t\t\tif (this.options.helper !== \"original\" && this.helper && this.helper[0].parentNode) {\n\t\t\t\tthis.helper.remove();\n\t\t\t}\n\n\t\t\t$.extend(this, {\n\t\t\t\thelper: null,\n\t\t\t\tdragging: false,\n\t\t\t\treverting: false,\n\t\t\t\t_noFinalSort: null\n\t\t\t});\n\n\t\t\tif (this.domPosition.prev) {\n\t\t\t\t$(this.domPosition.prev).after(this.currentItem);\n\t\t\t} else {\n\t\t\t\t$(this.domPosition.parent).prepend(this.currentItem);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\n\t},", "label": 1, "label_name": "safe"} +{"code": " public function confirm()\n {\n $project = $this->getProject();\n $action = $this->getAction($project);\n\n $this->response->html($this->helper->layout->project('action/remove', array(\n 'action' => $action,\n 'available_events' => $this->eventManager->getAll(),\n 'available_actions' => $this->actionManager->getAvailableActions(),\n 'project' => $project,\n 'title' => t('Remove an action')\n )));\n }", "label": 1, "label_name": "safe"} +{"code": "void lpc546xxEthDisableIrq(NetInterface *interface)\n{\n //Disable Ethernet MAC interrupts\n NVIC_DisableIRQ(ETHERNET_IRQn);\n\n //Valid Ethernet PHY or switch driver?\n if(interface->phyDriver != NULL)\n {\n //Disable Ethernet PHY interrupts\n interface->phyDriver->disableIrq(interface);\n }\n else if(interface->switchDriver != NULL)\n {\n //Disable Ethernet switch interrupts\n interface->switchDriver->disableIrq(interface);\n }\n else\n {\n //Just for sanity\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void test_rename(const char *path)\n{\n\tchar *d = strdupa(path), *tmpname;\n\td = dirname(d);\n\tsize_t len = strlen(path) + 30;\n\n\ttmpname = alloca(len);\n\tsnprintf(tmpname, len, \"%s/%d\", d, (int)getpid());\n\tif (rename(path, tmpname) == 0 || errno != ENOENT) {\n\t\tfprintf(stderr, \"leak at rename of %s\\n\", path);\n\t\texit(1);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "int IniSection::setSectionProp (const YCPPath&p,const YCPValue&in, int what, int depth)\n{\n string k = ip->changeCase (p->component_str (depth));\n // Find the matching sections.\n // If we need to recurse, choose one, creating if necessary\n // Otherwise set properties of all of the leaf sections,\n // creating and deleting if the number of them does not match\n\n pair r =\n\tisections.equal_range (k);\n IniSectionIdxIterator xi = r.first, xe = r.second;\n\n if (depth + 1 < p->length())\n {\n\t// recurse\n\tIniIterator si;\n\tif (xi == xe)\n\t{\n\t // not found, need to add it;\n\t y2debug (\"Write: adding recursively %s to %s\", k.c_str (), p->toString().c_str());\n\n\t IniSection s (ip, k);\n\t container.push_back (IniContainerElement (s));\n\t isections.insert (IniSectionIndex::value_type (k, --container.end ()));\n\n\t si = --container.end ();\n\t}\n\telse\n\t{\n\t // there's something, choose last\n\t si = (--xe)->second;\n\t}\n\treturn si->s ().setSectionProp (p, in, what, depth+1);\n }\n else\n {\n\t// bottom level\n\n\t// make sure we have a list of values\n\tYCPList props;\n\tif (ip->repeatNames ())\n\t{\n\t props = as_list (in, \"property of section with repeat_names\");\n\t if (props.isNull())\n\t\treturn -1;\n\t}\n\telse\n\t{\n\t props->add (in);\n\t}\n\tint pi = 0, pe = props->size ();\n\n\t// Go simultaneously through the found sections\n\t// and the list of parameters, while _either_ lasts\n\t// Fewer sections-> add them, more sections-> delete them\n\n\twhile (pi != pe || xi != xe)\n\t{\n\t // watch out for validity of iterators!\n\n\t if (pi == pe)\n\t {\n\t\t// deleting a section\n\t\tdelSection1 (xi++);\n\t\t// no ++pi\n\t }\n\t else\n\t {\n\t\tYCPValue prop = props->value (pi);\n\t\tIniIterator si;\n\t\tif (xi == xe)\n\t\t{\n\t\t ///need to add a section ...\n\t\t y2debug (\"Adding section %s\", p->toString().c_str());\n\t\t // prepare it to have its property set\n\t\t // create it\n\t\t IniSection s (ip, k);\n\t\t s.dirty = true;\n\t\t // insert and index\n\t\t container.push_back (IniContainerElement (s));\n\t\t isections.insert (IniSectionIndex::value_type (k, --container.end ()));\n\t\t si = --container.end ();\n\t\t}\n\t\telse\n\t\t{\n\t\t si = xi->second;\n\t\t}\n\n\t\t// set a section's property\n\t\tIniSection & s = si->s ();\n\t\tif (what == 0) {\n\t\t YCPString str = as_string (prop, \"section_comment\");\n\t\t if (str.isNull())\n\t\t\treturn -1;\n\t\t s.setComment (str->value_cstr());\n\t\t}\n\t\telse if (what == 1) {\n\t\t YCPInteger i = as_integer (prop, \"section_rewrite\");\n\t\t if (i.isNull())\n\t\t\treturn -1;\n\t\t s.setRewriteBy (i->value());\n\t\t}\n\t\telse if (what == 2) {\n\t\t YCPInteger i = as_integer (prop, \"section_type\");\n\t\t if (i.isNull())\n\t\t\treturn -1;\n\t\t s.setReadBy (i->value());\n\t\t}\n\t\telse if (what == 3) {\n\t\t YCPBoolean b = as_boolean (prop, \"section_private\");\n\t\t if (b.isNull())\n\t\t\treturn -1;\n\t\t s.setPrivate (b->value());\n\t\t}\n\n\t\tif (xi != xe)\n\t\t{\n\t\t ++xi;\n\t\t}\n\t\t++pi;\n\t }\n\t // iterators have been advanced already\n\t}\n\treturn 0;\n }\n}", "label": 1, "label_name": "safe"} +{"code": " provisionCallback: (user, renew, cb) => {\n cb(null, 'zzz');\n }\n });\n\n xoauth2.getToken(false, function(err, accessToken) {\n expect(err).to.not.exist;\n expect(accessToken).to.equal('zzz');\n done();\n });\n });", "label": 0, "label_name": "vulnerable"} +{"code": "int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)\n{\n\tint ret;\n\tint size;\n\n\tif (ud->side == USBIP_STUB) {\n\t\t/* the direction of urb must be OUT. */\n\t\tif (usb_pipein(urb->pipe))\n\t\t\treturn 0;\n\n\t\tsize = urb->transfer_buffer_length;\n\t} else {\n\t\t/* the direction of urb must be IN. */\n\t\tif (usb_pipeout(urb->pipe))\n\t\t\treturn 0;\n\n\t\tsize = urb->actual_length;\n\t}\n\n\t/* no need to recv xbuff */\n\tif (!(size > 0))\n\t\treturn 0;\n\n\tif (size > urb->transfer_buffer_length) {\n\t\t/* should not happen, probably malicious packet */\n\t\tif (ud->side == USBIP_STUB) {\n\t\t\tusbip_event_add(ud, SDEV_EVENT_ERROR_TCP);\n\t\t\treturn 0;\n\t\t} else {\n\t\t\tusbip_event_add(ud, VDEV_EVENT_ERROR_TCP);\n\t\t\treturn -EPIPE;\n\t\t}\n\t}\n\n\tret = usbip_recv(ud->tcp_socket, urb->transfer_buffer, size);\n\tif (ret != size) {\n\t\tdev_err(&urb->dev->dev, \"recv xbuf, %d\\n\", ret);\n\t\tif (ud->side == USBIP_STUB) {\n\t\t\tusbip_event_add(ud, SDEV_EVENT_ERROR_TCP);\n\t\t} else {\n\t\t\tusbip_event_add(ud, VDEV_EVENT_ERROR_TCP);\n\t\t\treturn -EPIPE;\n\t\t}\n\t}\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": " $this->validateDirective($directive);\n }\n return true;\n }", "label": 1, "label_name": "safe"} +{"code": "RestAuthHandler::RestAuthHandler(application_features::ApplicationServer& server,\n GeneralRequest* request, GeneralResponse* response)\n : RestVocbaseBaseHandler(server, request, response),\n _validFor(60 * 60 * 24 * 30) {}", "label": 0, "label_name": "vulnerable"} +{"code": "function(){g.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);mxSettings.save()}}window.EditDataDialog&&(EditDataDialog.getDisplayIdForCell=function(u,E){var J=null;null!=u.editor.graph.getModel().getParent(E)?J=E.getId():null!=u.currentPage&&(J=u.currentPage.getId());return J});if(null!=window.StyleFormatPanel){var k=Format.prototype.init;Format.prototype.init=function(){k.apply(this,arguments);this.editorUi.editor.addListener(\"fileLoaded\",this.update)};var l=Format.prototype.refresh;", "label": 0, "label_name": "vulnerable"} +{"code": "PUBLIC cchar *httpGetParam(HttpConn *conn, cchar *var, cchar *defaultValue)\n{\n cchar *value;\n\n value = mprLookupJson(httpGetParams(conn), var);\n return (value) ? value : defaultValue;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static CPINLINE zend_class_entry* swoole_try_get_ce(zend_string *class_name)\n{\n //user class , do not support incomplete class now\n zend_class_entry *ce = zend_lookup_class(class_name);\n if (ce)\n {\n return ce;\n }\n // try call unserialize callback and retry lookup\n zval user_func, args[1], retval;\n\n /* Check for unserialize callback */\n if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\\0'))\n {\n zend_throw_exception_ex(NULL, 0, \"can not find class %s\", class_name->val TSRMLS_CC);\n return NULL;\n }\n \n zend_string *fname = swoole_string_init(ZEND_STRL(PG(unserialize_callback_func)));\n Z_STR(user_func) = fname;\n Z_TYPE_INFO(user_func) = IS_STRING_EX;\n ZVAL_STR(&args[0], class_name);\n\n call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL);\n\n swoole_string_release(fname);\n\n //user class , do not support incomplete class now\n ce = zend_lookup_class(class_name);\n if (!ce)\n {\n zend_throw_exception_ex(NULL, 0, \"can not find class %s\", class_name->val TSRMLS_CC);\n return NULL;\n }\n else\n {\n return ce;\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)\n{\n VirtQueueElement elem;\n VirtQueue *vq;\n\n vq = vser->c_ivq;\n if (!virtio_queue_ready(vq)) {\n return 0;\n }\n if (!virtqueue_pop(vq, &elem)) {\n return 0;\n }\n\n /* TODO: detect a buffer that's too short, set NEEDS_RESET */\n iov_from_buf(elem.in_sg, elem.in_num, 0, buf, len);\n\n virtqueue_push(vq, &elem, len);\n virtio_notify(VIRTIO_DEVICE(vser), vq);\n return len;\n}", "label": 1, "label_name": "safe"} +{"code": "function(b,c){b=typeof c;\"function\"==b?c=mxStyleRegistry.getName(c):\"object\"==b&&(c=null);return c};a.decode=function(b,c,d){d=d||new this.template.constructor;var e=c.getAttribute(\"id\");null!=e&&(b.objects[e]=d);for(c=c.firstChild;null!=c;){if(!this.processInclude(b,c,d)&&\"add\"==c.nodeName&&(e=c.getAttribute(\"as\"),null!=e)){var f=c.getAttribute(\"extend\"),g=null!=f?mxUtils.clone(d.styles[f]):null;null==g&&(null!=f&&mxLog.warn(\"mxStylesheetCodec.decode: stylesheet \"+f+\" not found to extend\"),g={});\nfor(f=c.firstChild;null!=f;){if(f.nodeType==mxConstants.NODETYPE_ELEMENT){var k=f.getAttribute(\"as\");if(\"add\"==f.nodeName){var l=mxUtils.getTextContent(f);null!=l&&0mnt->mnt_sb;\n\tstruct mount *mnt = real_mount(path->mnt);\n\n\tif (!check_mnt(mnt))\n\t\treturn -EINVAL;\n\n\tif (path->dentry != path->mnt->mnt_root)\n\t\treturn -EINVAL;\n\n\t/* Don't allow changing of locked mnt flags.\n\t *\n\t * No locks need to be held here while testing the various\n\t * MNT_LOCK flags because those flags can never be cleared\n\t * once they are set.\n\t */\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_READONLY) &&\n\t !(mnt_flags & MNT_READONLY)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&\n\t !(mnt_flags & MNT_NODEV)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&\n\t !(mnt_flags & MNT_NOSUID)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_NOEXEC) &&\n\t !(mnt_flags & MNT_NOEXEC)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_ATIME) &&\n\t ((mnt->mnt.mnt_flags & MNT_ATIME_MASK) != (mnt_flags & MNT_ATIME_MASK))) {\n\t\treturn -EPERM;\n\t}\n\n\terr = security_sb_remount(sb, data);\n\tif (err)\n\t\treturn err;\n\n\tdown_write(&sb->s_umount);\n\tif (flags & MS_BIND)\n\t\terr = change_mount_flags(path->mnt, flags);\n\telse if (!capable(CAP_SYS_ADMIN))\n\t\terr = -EPERM;\n\telse\n\t\terr = do_remount_sb(sb, flags, data, 0);\n\tif (!err) {\n\t\tlock_mount_hash();\n\t\tmnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK;\n\t\tmnt->mnt.mnt_flags = mnt_flags;\n\t\ttouch_mnt_namespace(mnt->mnt_ns);\n\t\tunlock_mount_hash();\n\t}\n\tup_write(&sb->s_umount);\n\treturn err;\n}", "label": 1, "label_name": "safe"} +{"code": "def test_adjust_timeout():\n mw = _get_mw()\n req1 = scrapy.Request(\"http://example.com\", meta={\n 'splash': {'args': {'timeout': 60, 'html': 1}},\n\n # download_timeout is always present,\n # it is set by DownloadTimeoutMiddleware\n 'download_timeout': 30,\n })\n req1 = mw.process_request(req1, None)\n assert req1.meta['download_timeout'] > 60\n\n req2 = scrapy.Request(\"http://example.com\", meta={\n 'splash': {'args': {'html': 1}},\n 'download_timeout': 30,\n })\n req2 = mw.process_request(req2, None)\n assert req2.meta['download_timeout'] == 30", "label": 1, "label_name": "safe"} +{"code": "func (m *Unrecognized) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: Unrecognized: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: Unrecognized: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field1\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\ts := string(dAtA[iNdEx:postIndex])\n\t\t\tm.Field1 = &s\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public void complexExample() throws Exception {\n assertThat(ConstraintViolations.format(validator.validate(new ComplexExample())))\n .containsExactlyInAnyOrder(\n FAILED_RESULT + \"1\",\n FAILED_RESULT + \"2\",\n FAILED_RESULT + \"3\"\n );\n assertThat(TestLoggerFactory.getAllLoggingEvents())\n .isEmpty();\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public static string ConstructValidateUrl(string serviceTicket, bool gateway, bool renew, NameValueCollection customParameters)\n {\n if (gateway && renew)\n {\n throw new ArgumentException(\"Gateway and Renew parameters are mutually exclusive and cannot both be True\");\n }\n\n CasAuthentication.Initialize();\n\n EnhancedUriBuilder ub = new EnhancedUriBuilder(EnhancedUriBuilder.Combine(CasAuthentication.CasServerUrlPrefix, CasAuthentication.TicketValidator.UrlSuffix));\n ub.QueryItems.Add(CasAuthentication.TicketValidator.ServiceParameterName, HttpUtility.UrlEncode(ConstructServiceUrl(gateway)));\n ub.QueryItems.Add(CasAuthentication.TicketValidator.ArtifactParameterName, serviceTicket);\n\n if (renew)\n {\n ub.QueryItems.Set(\"renew\", \"true\");\n }\n\n if (customParameters != null)\n {\n for (int i = 0; i < customParameters.Count; i++)\n {\n string key = customParameters.AllKeys[i];\n string value = customParameters[i];\n\n ub.QueryItems.Add(key, value);\n }\n }\n return ub.Uri.AbsoluteUri;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t$text = preg_replace( $skipPat, '', $text );\n\t\t}\n\n\t\tif ( self::open( $parser, $part1 ) ) {\n\n\t\t\t// Handle recursion here, so we can break cycles.\n\t\t\tif ( $recursionCheck == false ) {\n\t\t\t\t$text = $parser->preprocess( $text, $parser->getTitle(), $parser->getOptions() );\n\t\t\t\tself::close( $parser, $part1 );\n\t\t\t}\n\n\t\t\tif ( $maxLength > 0 ) {\n\t\t\t\t$text = self::limitTranscludedText( $text, $maxLength, $link );\n\t\t\t}\n\t\t\tif ( $trim ) {\n\t\t\t\treturn trim( $text );\n\t\t\t} else {\n\t\t\t\treturn $text;\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"[[\" . $parser->getTitle()->getPrefixedText() . \"]]\" . \"\";\n\t\t}\n\t}", "label": 1, "label_name": "safe"} +{"code": "\tprotected function getRootStatExtra() {\n\t\t$stat = array();\n\t\tif ($this->rootName) {\n\t\t\t$stat['name'] = $this->rootName;\n\t\t}\n\t\tif (! empty($this->options['icon'])) {\n\t\t\t$stat['icon'] = $this->options['icon'];\n\t\t}\n\t\tif (! empty($this->options['rootCssClass'])) {\n\t\t\t$stat['csscls'] = $this->options['rootCssClass'];\n\t\t}\n\t\tif (! empty($this->tmbURL)) {\n\t\t\t$stat['tmbUrl'] = $this->tmbURL;\n\t\t}\n\t\t$stat['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array();\n\t\t$stat['disabled'] = $this->disabled;\n\t\tif (isset($this->options['netkey'])) {\n\t\t\t$stat['netkey'] = $this->options['netkey'];\n\t\t}\n\t\treturn $stat;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testSendError()\n {\n $this->setMockHttpResponse('FetchTransactionFailure.txt');\n $response = $this->request->send();\n\n $this->assertFalse($response->isSuccessful());\n $this->assertFalse($response->isRedirect());\n $this->assertNull($response->getTransactionReference());\n $this->assertNull($response->getCardReference());\n $this->assertSame('No such charge: ch_29yrvk84GVDsq9fake', $response->getMessage());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *MockCoreStrategy) GenerateAuthorizeCode(arg0 context.Context, arg1 fosite.Requester) (string, string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenerateAuthorizeCode\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "label": 1, "label_name": "safe"} +{"code": "int get_rock_ridge_filename(struct iso_directory_record *de,\n\t\t\t char *retname, struct inode *inode)\n{\n\tstruct rock_state rs;\n\tstruct rock_ridge *rr;\n\tint sig;\n\tint retnamlen = 0;\n\tint truncate = 0;\n\tint ret = 0;\n\n\tif (!ISOFS_SB(inode->i_sb)->s_rock)\n\t\treturn 0;\n\t*retname = 0;\n\n\tinit_rock_state(&rs, inode);\n\tsetup_rock_ridge(de, inode, &rs);\nrepeat:\n\n\twhile (rs.len > 2) { /* There may be one byte for padding somewhere */\n\t\trr = (struct rock_ridge *)rs.chr;\n\t\t/*\n\t\t * Ignore rock ridge info if rr->len is out of range, but\n\t\t * don't return -EIO because that would make the file\n\t\t * invisible.\n\t\t */\n\t\tif (rr->len < 3)\n\t\t\tgoto out;\t/* Something got screwed up here */\n\t\tsig = isonum_721(rs.chr);\n\t\tif (rock_check_overflow(&rs, sig))\n\t\t\tgoto eio;\n\t\trs.chr += rr->len;\n\t\trs.len -= rr->len;\n\t\t/*\n\t\t * As above, just ignore the rock ridge info if rr->len\n\t\t * is bogus.\n\t\t */\n\t\tif (rs.len < 0)\n\t\t\tgoto out;\t/* Something got screwed up here */\n\n\t\tswitch (sig) {\n\t\tcase SIG('R', 'R'):\n\t\t\tif ((rr->u.RR.flags[0] & RR_NM) == 0)\n\t\t\t\tgoto out;\n\t\t\tbreak;\n\t\tcase SIG('S', 'P'):\n\t\t\tif (check_sp(rr, inode))\n\t\t\t\tgoto out;\n\t\t\tbreak;\n\t\tcase SIG('C', 'E'):\n\t\t\trs.cont_extent = isonum_733(rr->u.CE.extent);\n\t\t\trs.cont_offset = isonum_733(rr->u.CE.offset);\n\t\t\trs.cont_size = isonum_733(rr->u.CE.size);\n\t\t\tbreak;\n\t\tcase SIG('N', 'M'):\n\t\t\tif (truncate)\n\t\t\t\tbreak;\n\t\t\tif (rr->len < 5)\n\t\t\t\tbreak;\n\t\t\t/*\n\t\t\t * If the flags are 2 or 4, this indicates '.' or '..'.\n\t\t\t * We don't want to do anything with this, because it\n\t\t\t * screws up the code that calls us. We don't really\n\t\t\t * care anyways, since we can just use the non-RR\n\t\t\t * name.\n\t\t\t */\n\t\t\tif (rr->u.NM.flags & 6)\n\t\t\t\tbreak;\n\n\t\t\tif (rr->u.NM.flags & ~1) {\n\t\t\t\tprintk(\"Unsupported NM flag settings (%d)\\n\",\n\t\t\t\t\trr->u.NM.flags);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ((strlen(retname) + rr->len - 5) >= 254) {\n\t\t\t\ttruncate = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstrncat(retname, rr->u.NM.name, rr->len - 5);\n\t\t\tretnamlen += rr->len - 5;\n\t\t\tbreak;\n\t\tcase SIG('R', 'E'):\n\t\t\tkfree(rs.buffer);\n\t\t\treturn -1;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\tret = rock_continue(&rs);\n\tif (ret == 0)\n\t\tgoto repeat;\n\tif (ret == 1)\n\t\treturn retnamlen; /* If 0, this file did not have a NM field */\nout:\n\tkfree(rs.buffer);\n\treturn ret;\neio:\n\tret = -EIO;\n\tgoto out;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " protected function getDefaultParameters()\n {\n return array(\n 'foo' => '%baz%',\n 'baz' => 'bar',\n 'bar' => 'foo is %%foo bar',\n 'escape' => '@escapeme',\n 'values' => array(\n 0 => true,\n 1 => false,\n 2 => NULL,\n 3 => 0,\n 4 => 1000.3,\n 5 => 'true',\n 6 => 'false',\n 7 => 'null',\n ),\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": "rdpdr_process(STREAM s)\n{\n\tuint32 handle;\n\tuint16 vmin;\n\tuint16 component;\n\tuint16 pakid;\n\tstruct stream packet = *s;\n\n\tlogger(Protocol, Debug, \"rdpdr_process()\");\n\t/* hexdump(s->p, s->end - s->p); */\n\n\tin_uint16(s, component);\n\tin_uint16(s, pakid);\n\n\tif (component == RDPDR_CTYP_CORE)\n\t{\n\t\tswitch (pakid)\n\t\t{\n\t\t\tcase PAKID_CORE_DEVICE_IOREQUEST:\n\t\t\t\trdpdr_process_irp(s);\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_SERVER_ANNOUNCE:\n\t\t\t\t/* DR_CORE_SERVER_ANNOUNCE_REQ */\n\t\t\t\tin_uint8s(s, 2);\t/* skip versionMajor */\n\t\t\t\tin_uint16_le(s, vmin);\t/* VersionMinor */\n\n\t\t\t\tin_uint32_le(s, g_client_id);\t/* ClientID */\n\n\t\t\t\t/* g_client_id is sent back to server,\n\t\t\t\t so lets check that we actually got\n\t\t\t\t valid data from stream to prevent\n\t\t\t\t that we leak back data to server */\n\t\t\t\tif (!s_check(s))\n\t\t\t\t{\n\t\t\t\t\trdp_protocol_error(\"rdpdr_process(), consume of g_client_id from stream did overrun\", &packet);\n\t\t\t\t}\n\n\t\t\t\t/* The RDP client is responsibility to provide a random client id\n\t\t\t\t if server version is < 12 */\n\t\t\t\tif (vmin < 0x000c)\n\t\t\t\t\tg_client_id = 0x815ed39d;\t/* IP address (use 127.0.0.1) 0x815ed39d */\n\t\t\t\tg_epoch++;\n\n#if WITH_SCARD\n\t\t\t\t/*\n\t\t\t\t * We need to release all SCARD contexts to end all\n\t\t\t\t * current transactions and pending calls\n\t\t\t\t */\n\t\t\t\tscard_release_all_contexts();\n\n\t\t\t\t/*\n\t\t\t\t * According to [MS-RDPEFS] 3.2.5.1.2:\n\t\t\t\t *\n\t\t\t\t * If this packet appears after a sequence of other packets,\n\t\t\t\t * it is a signal that the server has reconnected to a new session\n\t\t\t\t * and the whole sequence has been reset. The client MUST treat\n\t\t\t\t * this packet as the beginning of a new sequence.\n\t\t\t\t * The client MUST also cancel all outstanding requests and release\n\t\t\t\t * previous references to all devices.\n\t\t\t\t *\n\t\t\t\t * If any problem arises in the future, please, pay attention to the\n\t\t\t\t * \"If this packet appears after a sequence of other packets\" part\n\t\t\t\t *\n\t\t\t\t */\n\n#endif\n\n\t\t\t\trdpdr_send_client_announce_reply();\n\t\t\t\trdpdr_send_client_name_request();\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_CLIENTID_CONFIRM:\n\t\t\t\trdpdr_send_client_device_list_announce();\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_DEVICE_REPLY:\n\t\t\t\tin_uint32(s, handle);\n\t\t\t\tlogger(Protocol, Debug,\n\t\t\t\t \"rdpdr_process(), server connected to resource %d\", handle);\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_SERVER_CAPABILITY:\n\t\t\t\trdpdr_send_client_capability_response();\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tlogger(Protocol, Debug,\n\t\t\t\t \"rdpdr_process(), pakid 0x%x of component 0x%x\", pakid,\n\t\t\t\t component);\n\t\t\t\tbreak;\n\n\t\t}\n\t}\n\telse if (component == RDPDR_CTYP_PRN)\n\t{\n\t\tif (pakid == PAKID_PRN_CACHE_DATA)\n\t\t\tprintercache_process(s);\n\t}\n\telse\n\t\tlogger(Protocol, Warning, \"rdpdr_process(), unhandled component 0x%x\", component);\n}", "label": 1, "label_name": "safe"} +{"code": "this.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerHTML=\"\")};", "label": 0, "label_name": "vulnerable"} +{"code": " it \"stores the session\" do\n cursor.session.should eq session\n end", "label": 0, "label_name": "vulnerable"} +{"code": " private def checkSillySessionId(site: SiteBrief, anyOldSid: Opt[St],\n dao: SessionSiteDaoMixin, now: When,\n expireIdleAfterMillis: i64): CheckSidResult = {\n\n val value = anyOldSid getOrElse {\n return CheckSidResult.noSession(SidAbsent)\n }\n\n // Example value: 88-F7sAzB0yaaX.1312629782081.1c3n0fgykm - no, obsolete\n if (value.length <= HashLength)\n return CheckSidResult.noSession(SidBadFormat)\n\n val (hash, dotUseridDateRandom) = value splitAt HashLength\n val realHash = hashSha1Base64UrlSafe(\n s\"$secretSalt.${site.id}$dotUseridDateRandom\") take HashLength\n\n if (hash != realHash)\n return CheckSidResult.noSession(SidBadHash)\n\n val oldOkSid = dotUseridDateRandom.drop(1).split('.') match {\n case Array(userIdString, dateStr, randVal) =>\n val userId: Option[UserId] =\n if (userIdString.isEmpty) None\n else Try(userIdString.toInt).toOption orElse {\n return CheckSidResult.noSession(SidBadFormat)\n }\n val ageMillis = now.millis - dateStr.toLong\n UX; BUG; COULD; // [EXPIREIDLE] this also expires *active* sessions. Instead,\n // lookup the user, and consider only time elapsed, since hens last visit.\n // ... Need to have a SiteDao here then. And pass the Participant back to the\n // caller, so it won't have to look it up again.\n // Not urgent though \u2014 no one will notice: by default, one stays logged in 1 year [7AKR04].\n if (ageMillis > expireIdleAfterMillis) {\n val expiredSid = SidExpired(\n minutesOld = ageMillis / MillisPerMinute,\n maxAgeMins = expireIdleAfterMillis / MillisPerMinute,\n wasForPatId = userId)\n return CheckSidResult.noSession(expiredSid)\n }\n SidOk(\n value = value,\n ageInMillis = ageMillis,\n userId = userId)\n case _ => SidBadFormat\n }\n\n var newSidCookies: List[Cookie] = Nil\n\n // Upgrade old sid to new style sid: [btr_sid]\n // ----------------------------------------\n\n /* Maybe skip this. Hard to test?\n if ((tryFancySid || useFancySid) && oldOkSid.userId.isDefined) {\n val dao = anyDao getOrDie \"TyE50FREN68\"\n val patId = oldOkSid.userId getOrDie \"TyE602MTEGPH\"\n val settings = dao.getWholeSiteSettings()\n val expireIdleAfterSecs = settings.expireIdleAfterMins * 60\n val (newCookies, sidPart1, sidPart2) =\n genAndSaveFancySid(patId = patId, expireIdleAfterSecs, dao.redisCache,\n isOldUpgraded = true)\n // cookies = newSidPart1Cookie::newSidPart2Cookie::cookies\n result = SidOk(sidPart1,\n expireIdleAfterSecs * 1000, Some(patId))\n newSidCookies = newCookies\n }\n */\n\n CheckSidResult(anyTySession = None, oldOkSid, createCookies = newSidCookies)\n }\n\n\n @deprecated(\"Now\", \"Use the fancy session id instead.\")", "label": 1, "label_name": "safe"} +{"code": "Runner.prototype.uncaught = function(err){\n debug('uncaught exception %s', err.message);\n var runnable = this.currentRunnable;\n if (!runnable || 'failed' == runnable.state) return;\n runnable.clearTimeout();\n err.uncaught = true;\n this.fail(runnable, err);\n\n // recover from test\n if ('test' == runnable.type) {\n this.emit('test end', runnable);\n this.hookUp('afterEach', this.next);\n return;\n }\n\n // bail on hooks\n this.emit('end');\n};", "label": 0, "label_name": "vulnerable"} +{"code": "void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encryptedPrivateKey,\n uint64_t enc_len, char *_hashX,\n char *_hashY, char *signature) {\n LOG_DEBUG(__FUNCTION__);\n INIT_ERROR_STATE\n\n CHECK_STATE(encryptedPrivateKey);\n CHECK_STATE(_hashX);\n CHECK_STATE(_hashY);\n CHECK_STATE(signature);\n\n SAFE_CHAR_BUF(key, BUF_LEN);SAFE_CHAR_BUF(sig, BUF_LEN);\n\n int status = AES_decrypt(encryptedPrivateKey, enc_len, key, BUF_LEN);\n\n CHECK_STATUS(\"AES decrypt failed\")\n\n if (!enclave_sign(key, _hashX, _hashY, sig)) {\n strncpy(errString, \"Enclave failed to create bls signature\", BUF_LEN);\n LOG_ERROR(errString);\n *errStatus = -1;\n goto clean;\n }\n\n strncpy(signature, sig, BUF_LEN);\n\n if (strnlen(signature, BUF_LEN) < 10) {\n strncpy(errString, \"Signature too short\", BUF_LEN);\n LOG_ERROR(errString);\n *errStatus = -1;\n goto clean;\n }\n\n SET_SUCCESS\n\n LOG_DEBUG(\"SGX call completed\");\n\n clean:\n ;\n LOG_DEBUG(\"SGX call completed\");\n}", "label": 1, "label_name": "safe"} +{"code": "process_secondary_order(STREAM s)\n{\n\t/* The length isn't calculated correctly by the server.\n\t * For very compact orders the length becomes negative\n\t * so a signed integer must be used. */\n\tuint16 length;\n\tuint16 flags;\n\tuint8 type;\n\tuint8 *next_order;\n\tstruct stream packet = *s;\n\n\tin_uint16_le(s, length);\n\tin_uint16_le(s, flags);\t/* used by bmpcache2 */\n\tin_uint8(s, type);\n\n\tif (!s_check_rem(s, length + 7))\n\t{\n\t\trdp_protocol_error(\"process_secondary_order(), next order pointer would overrun stream\", &packet);\n\t}\n\n\tnext_order = s->p + (sint16) length + 7;\n\n\tswitch (type)\n\t{\n\t\tcase RDP_ORDER_RAW_BMPCACHE:\n\t\t\tprocess_raw_bmpcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_COLCACHE:\n\t\t\tprocess_colcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BMPCACHE:\n\t\t\tprocess_bmpcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_FONTCACHE:\n\t\t\tprocess_fontcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_RAW_BMPCACHE2:\n\t\t\tprocess_bmpcache2(s, flags, False);\t/* uncompressed */\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BMPCACHE2:\n\t\t\tprocess_bmpcache2(s, flags, True);\t/* compressed */\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BRUSHCACHE:\n\t\t\tprocess_brushcache(s, flags);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tlogger(Graphics, Warning,\n\t\t\t \"process_secondary_order(), unhandled secondary order %d\", type);\n\t}\n\n\ts->p = next_order;\n}", "label": 1, "label_name": "safe"} +{"code": "\tthis.getstate = function() {\n\t\treturn 0;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "L&&P.replAllPos>=z)break;C[I.id]={replAllMrk:L,replAllPos:z};k.isCellEditable(I)&&(k.model.setValue(I,H(T,A,K.value,z-A.length,k.getCurrentCellStyle(I))),p++)}V!=b.currentPage&&b.editor.graph.model.execute(new SelectPage(b,V));mxUtils.write(E,mxResources.get(\"matchesRepl\",[p]))}catch(O){b.handleError(O)}finally{k.getModel().endUpdate(),b.editor.graph.setSelectionCells(X),b.editor.graph.rendering=!0}L++}});Q.setAttribute(\"title\",mxResources.get(\"replaceAll\"));Q.style.float=\"none\";Q.style.width=\"120px\";\nQ.style.marginTop=\"6px\";Q.style.marginLeft=\"8px\";Q.style.overflow=\"hidden\";Q.style.textOverflow=\"ellipsis\";Q.className=\"geBtn gePrimaryBtn\";Q.setAttribute(\"disabled\",\"disabled\");n.appendChild(Q);mxUtils.br(n);n.appendChild(N);N=mxUtils.button(mxResources.get(\"close\"),mxUtils.bind(this,function(){this.window.setVisible(!1)}));N.setAttribute(\"title\",mxResources.get(\"close\"));N.style.float=\"none\";N.style.width=\"120px\";N.style.marginTop=\"6px\";N.style.marginLeft=\"8px\";N.style.overflow=\"hidden\";N.style.textOverflow=\n\"ellipsis\";N.className=\"geBtn\";n.appendChild(N);mxUtils.br(n);n.appendChild(E)}else N.style.width=\"90px\",J.style.width=\"90px\";mxEvent.addListener(y,\"keyup\",function(V){if(91==V.keyCode||93==V.keyCode||17==V.keyCode)mxEvent.consume(V);else if(27==V.keyCode)g.funct();else if(m!=y.value.toLowerCase()||13==V.keyCode)try{y.style.backgroundColor=e()?\"\":Editor.isDarkMode()?\"#ff0000\":\"#ffcfcf\"}catch(X){y.style.backgroundColor=Editor.isDarkMode()?\"#ff0000\":\"#ffcfcf\"}});mxEvent.addListener(M,\"keydown\",function(V){70==\nV.keyCode&&b.keyHandler.isControlDown(V)&&!mxEvent.isShiftDown(V)&&(g.funct(),mxEvent.consume(V))});this.window=new mxWindow(mxResources.get(\"find\")+(t?\"/\"+mxResources.get(\"replace\"):\"\"),M,f,l,d,u,!0,!0);this.window.destroyOnClose=!1;this.window.setMaximizable(!1);this.window.setResizable(!1);this.window.setClosable(!0);this.window.addListener(\"show\",mxUtils.bind(this,function(){this.window.fit();this.window.isVisible()?(y.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode?y.select():\ndocument.execCommand(\"selectAll\",!1,null),null!=b.pages&&1 true\n }\n\n csv = file.read\n begin\n csv.encode!(Encoding::UTF_8, enc, {:invalid => :replace, :undef => :replace, :replace => ' '})\n rescue => evar\n Log.add_error(request, evar)\n end\n\n found_update = false\n err_col_names = nil\n col_idxs = []\n\n CSV.parse(csv, opt) do |row|\n unless row.first.nil?\n next if row.first.lstrip.index('#') == 0\n end\n next if row.compact.empty?\n\n count += 1\n if count == 0 # for Header Line\n err_col_names = Address.check_csv_header(row, book)\n if err_col_names.nil? or err_col_names.empty?\n header_cols = Address.csv_header_cols(book)\n col_idxs = header_cols.collect{|col_name| row.index(col_name)}\n next\n else\n logger.fatal('@@@ ' + err_col_names.inspect)\n @imp_errs[0] = []\n err_col_names.each do |err_col_name|\n @imp_errs[0] << t('address.invalid_column_names') + err_col_name\n end\n break\n end\n end\n\n address = Address.parse_csv_row(row, book, col_idxs, @login_user)\n\n check = address.check_import(mode, address_names)\n\n @imp_errs[count] = check unless check.empty?\n\n addresses << address\n\n if (mode == 'update')\n update_address = all_addresses.find do |rec|\n rec.id == address.id\n end\n unless update_address.nil?\n all_addresses.delete(update_address)\n found_update = true\n end\n end\n end\n\n if err_col_names.nil? or err_col_names.empty?\n if addresses.empty?\n @imp_errs[0] = [t('address.nothing_to_import')]\n else\n if (mode == 'update') and !found_update\n @imp_errs[0] = [t('address.nothing_to_update')]\n end\n end\n end\n\n # Create or Update\n count = 0\n @imp_cnt = 0\n if @imp_errs.empty?\n addresses.each do |address|\n count += 1\n begin\n address_id = address.id\n\n address.save!\n\n @imp_cnt += 1\n\n rescue => evar\n @imp_errs[count] = [t('address.save_failed') + evar.to_s]\n end\n end\n end\n\n # Delete\n # Actually, the correct order of the process is Delete -> Create,\n # not to duplicate a Address Name.\n # 3: morita <- Delete\n # : morita <- Create\n # But such a case is most likely to be considered as a \n # user's miss-operation. We can avoid this case with\n # 'opposite' process.\n del_cnt = 0\n if (@imp_errs.empty? and mode == 'update')\n all_addresses.each do |address|\n address.destroy\n del_cnt += 1\n end\n end\n\n if @imp_errs.empty?\n flash[:notice] = t('address.imported', :count => addresses.length)\n if (del_cnt > 0)\n flash[:notice] << '
    ' + t('address.deleted', :count => del_cnt)\n end\n end\n\n list\n render(:action => 'list')\n end", "label": 1, "label_name": "safe"} +{"code": " public static function flag($vars)\n {\n switch (SMART_URL) {\n case true:\n $lang = '?lang='.$vars;\n if (isset($_GET['lang'])) {\n $uri = explode('?', $_SERVER['REQUEST_URI']);\n $uri = $uri[0];\n } else {\n $uri = $_SERVER['REQUEST_URI'];\n }\n $url = $uri.$lang;\n\n break;\n\n default:\n // print_r($_GET);\n if (!empty($_GET)) {\n $val = '';\n foreach ($_GET as $key => $value) {\n if ($key == 'lang') {\n $val .= '&lang='.$vars;\n } else {\n $val .= $key.'='.$value;\n }\n }\n } else {\n $val = 'lang='.$vars;\n }\n $lang = !isset($_GET['lang']) ? '&lang='.$vars : $val;\n $url = Site::$url.'/?'.$lang;\n break;\n }\n\n return $url;\n }", "label": 1, "label_name": "safe"} +{"code": "if(\"function\"!=typeof a)throw new TypeError(\"parseInputDate() sholud be as function\");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledTimeIntervals() expects an array parameter\");return d.disabledTimeIntervals=b,$(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledHours() expects an array parameter\");if(d.disabledHours=na(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"enabledHours() expects an array parameter\");if(d.enabledHours=na(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!(\"string\"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError(\"viewDate() parameter must be one of [string, moment or Date]\");return f=ga(a),J(),l},c.is(\"input\"))g=c;else if(g=c.find(d.datepickerInput),0===g.size())g=c.find(\"input\");else if(!g.is(\"input\"))throw new Error('CSS class \"'+d.datepickerInput+'\" cannot be applied to non input element');if(c.hasClass(\"input-group\")&&(n=0===c.find(\".datepickerbutton\").size()?c.find(\".input-group-addon\"):c.find(\".datepickerbutton\")),!d.inline&&!g.is(\"input\"))throw new Error(\"Could not initialize DateTimePicker without an input element\");return e=x(),f=e.clone(),a.extend(!0,d,G()),l.options(d),oa(),ka(),g.prop(\"disabled\")&&l.disable(),g.is(\"input\")&&0!==g.val().trim().length?_(ga(g.val().trim())):d.defaultDate&&void 0===g.attr(\"placeholder\")&&_(d.defaultDate),d.inline&&ea(),l};a.fn.datetimepicker=function(b){return this.each(function(){var d=a(this);d.data(\"DateTimePicker\")||(b=a.extend(!0,{},a.fn.datetimepicker.defaults,b),d.data(\"DateTimePicker\",c(d,b)))})},a.fn.datetimepicker.defaults={timeZone:\"Etc/UTC\",format:!1,dayViewHeaderFormat:\"MMMM YYYY\",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:\"glyphicon glyphicon-time\",date:\"glyphicon glyphicon-calendar\",up:\"glyphicon glyphicon-chevron-up\",down:\"glyphicon glyphicon-chevron-down\",previous:\"glyphicon glyphicon-chevron-left\",next:\"glyphicon glyphicon-chevron-right\",today:\"glyphicon glyphicon-screenshot\",clear:\"glyphicon glyphicon-trash\",close:\"glyphicon glyphicon-remove\"},tooltips:{today:\"Go to today\",clear:\"Clear selection\",close:\"Close the picker\",selectMonth:\"Select Month\",prevMonth:\"Previous Month\",nextMonth:\"Next Month\",selectYear:\"Select Year\",prevYear:\"Previous Year\",nextYear:\"Next Year\",selectDecade:\"Select Decade\",prevDecade:\"Previous Decade\",nextDecade:\"Next Decade\",prevCentury:\"Previous Century\",nextCentury:\"Next Century\",pickHour:\"Pick Hour\",incrementHour:\"Increment Hour\",decrementHour:\"Decrement Hour\",pickMinute:\"Pick Minute\",incrementMinute:\"Increment Minute\",decrementMinute:\"Decrement Minute\",pickSecond:\"Pick Second\",incrementSecond:\"Increment Second\",decrementSecond:\"Decrement Second\",togglePeriod:\"Toggle Period\",selectTime:\"Select Time\"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:\"days\",toolbarPlacement:\"default\",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:\"auto\",vertical:\"auto\"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:\".datepickerinput\",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(7,\"d\")):this.date(b.clone().add(this.stepping(),\"m\"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(7,\"d\")):this.date(b.clone().subtract(this.stepping(),\"m\"))},\"control up\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(1,\"y\")):this.date(b.clone().add(1,\"h\"))}},\"control down\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(1,\"y\")):this.date(b.clone().subtract(1,\"h\"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"d\"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"d\"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"M\"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"M\"))}},enter:function(){this.hide()},escape:function(){this.hide()},\"control space\":function(a){a.find(\".timepicker\").is(\":visible\")&&a.find('.btn[data-action=\"togglePeriod\"]').click()},t:function(){this.date(this.getMoment())},\"delete\":function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1}});", "label": 0, "label_name": "vulnerable"} +{"code": " def begin(name)\n stack(name).push true\n end", "label": 1, "label_name": "safe"} +{"code": "COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask,\n\t\t compat_ulong_t, maxnode)\n{\n\tlong err = 0;\n\tunsigned long __user *nm = NULL;\n\tunsigned long nr_bits, alloc_size;\n\tDECLARE_BITMAP(bm, MAX_NUMNODES);\n\n\tnr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES);\n\talloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;\n\n\tif (nmask) {\n\t\terr = compat_get_bitmap(bm, nmask, nr_bits);\n\t\tnm = compat_alloc_user_space(alloc_size);\n\t\terr |= copy_to_user(nm, bm, alloc_size);\n\t}\n\n\tif (err)\n\t\treturn -EFAULT;\n\n\treturn sys_set_mempolicy(mode, nm, nr_bits+1);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t protected function curl_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ){\n\t\t$ch = curl_init();\n\t\tcurl_setopt( $ch, CURLOPT_URL, $url );\n\t\tcurl_setopt( $ch, CURLOPT_HEADER, false );\n\t\tif ($outfp) {\n\t\t\tcurl_setopt( $ch, CURLOPT_FILE, $outfp );\n\t\t} else {\n\t\t\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );\n\t\t\tcurl_setopt( $ch, CURLOPT_BINARYTRANSFER, true );\n\t\t}\n\t\tcurl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 1 );\n\t\tcurl_setopt( $ch, CURLOPT_LOW_SPEED_TIME, $timeout );\n\t\tcurl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );\n\t\tcurl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);\n\t\tcurl_setopt( $ch, CURLOPT_MAXREDIRS, $redirect_max);\n\t\tcurl_setopt( $ch, CURLOPT_USERAGENT, $ua);\n\t\t$result = curl_exec( $ch );\n\t\t$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);\n\t\tcurl_close( $ch );\n\t\treturn $outfp? $outfp : $result;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " void resize (std::size_t new_size_) { _buf_size = new_size_; }", "label": 0, "label_name": "vulnerable"} +{"code": " public static function getCSS()\n {\n return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');\n }", "label": 1, "label_name": "safe"} +{"code": " public function test_filter()\n {\n $def = new HTMLPurifier_URIDefinition();\n $def->addFilter($this->createFilterMock(), $this->config);\n $def->addFilter($this->createFilterMock(), $this->config);\n $uri = $this->createURI('test');\n $this->assertTrue($def->filter($uri, $this->config, $this->context));\n }", "label": 1, "label_name": "safe"} +{"code": "GraphViewer.processElements=function(b){mxUtils.forEach(GraphViewer.getElementsByClassName(b||\"mxgraph\"),function(e){try{e.innerHTML=\"\",GraphViewer.createViewerForElement(e)}catch(k){e.innerHTML=k.message,null!=window.console&&console.error(k)}})};", "label": 0, "label_name": "vulnerable"} +{"code": " public function execute($image)\n {\n $size = $this->argument(0)->type('digit')->value(10);\n\n $width = $image->getWidth();\n $height = $image->getHeight();\n\n $image->getCore()->scaleImage(max(1, ($width / $size)), max(1, ($height / $size)));\n $image->getCore()->scaleImage($width, $height);\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t} elseif (isset($graph['data_query_name'])) {\n\t\t\t\tif (isset($prev_data_query_name)) {\n\t\t\t\t\tif ($prev_data_query_name != $graph['data_query_name']) {\n\t\t\t\t\t\t$print = true;\n\t\t\t\t\t\t$prev_data_query_name = $graph['data_query_name'];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$print = false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$print = true;\n\t\t\t\t\t$prev_data_query_name = $graph['data_query_name'];\n\t\t\t\t}\n\n\t\t\t\tif ($print) {\n\t\t\t\t\tif (!$start) {\n\t\t\t\t\t\twhile(($i % $columns) != 0) {\n\t\t\t\t\t\t\tprint \"\";\n\t\t\t\t\t\t\t$i++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprint \"\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\tprint \"\n\t\t\t\t\t\t\t\" . __('Data Query:') . ' ' . $graph['data_query_name'] . \"\n\t\t\t\t\t\t\\n\";\n\t\t\t\t\t$i = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($i == 0) {\n\t\t\t\tprint \"\\n\";\n\t\t\t\t$start = false;\n\t\t\t}\n\n\t\t\t?>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t\t\t\t
    ' graph_width='' graph_height=''>
    \n\t\t\t\t\t\t\t\" . html_escape($graph['title_cache']) . '' : '');?>\n\t\t\t\t\t\t
    ' class='noprint graphDrillDown'>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
    \n\t\t\t\n\t\t\t\\n\";\n\t\t\t\t$start = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!$start) {\n\t\t\twhile(($i % $columns) != 0) {\n\t\t\t\tprint \"\";\n\t\t\t\t$i++;\n\t\t\t}\n\n\t\t\tprint \"\\n\";\n\t\t}\n\t} else {", "label": 1, "label_name": "safe"} +{"code": "\t\t\tadd = function(files) {\n\t\t\t\tvar place = list ? cwd.find('tbody') : cwd,\n\t\t\t\t\tl = files.length, \n\t\t\t\t\tltmb = [],\n\t\t\t\t\tatmb = {},\n\t\t\t\t\tdirs = false,\n\t\t\t\t\tfindNode = function(file) {\n\t\t\t\t\t\tvar pointer = cwd.find('[id]:first'), file2;\n\n\t\t\t\t\t\twhile (pointer.length) {\n\t\t\t\t\t\t\tfile2 = fm.file(pointer.attr('id'));\n\t\t\t\t\t\t\tif (!pointer.is('.elfinder-cwd-parent') && file2 && fm.compare(file, file2) < 0) {\n\t\t\t\t\t\t\t\treturn pointer;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpointer = pointer.next('[id]');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tfindIndex = function(file) {\n\t\t\t\t\t\tvar l = buffer.length, i;\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (i =0; i < l; i++) {\n\t\t\t\t\t\t\tif (fm.compare(file, buffer[i]) < 0) {\n\t\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn l || -1;\n\t\t\t\t\t},\n\t\t\t\t\tfile, hash, node, ndx;\n\n\t\t\t\t\n\t\t\t\twhile (l--) {\n\t\t\t\t\tfile = files[l];\n\t\t\t\t\thash = file.hash;\n\t\t\t\t\t\n\t\t\t\t\tif (cwd.find('#'+hash).length) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((node = findNode(file)) && node.length) {\n\t\t\t\t\t\tnode.before(itemhtml(file)); \n\t\t\t\t\t} else if ((ndx = findIndex(file)) >= 0) {\n\t\t\t\t\t\tbuffer.splice(ndx, 0, file);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tplace.append(itemhtml(file));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (cwd.find('#'+hash).length) {\n\t\t\t\t\t\tif (file.mime == 'directory') {\n\t\t\t\t\t\t\tdirs = true;\n\t\t\t\t\t\t} else if (file.tmb) {\n\t\t\t\t\t\t\tfile.tmb === 1 ? ltmb.push(hash) : (atmb[hash] = file.tmb);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tattachThumbnails(atmb);\n\t\t\t\tltmb.length && loadThumbnails(ltmb);\n\t\t\t\tdirs && makeDroppable();\n\t\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": " $h1 = floor($dec % 16);\n $c = $escape . $hex[\"$h2\"] . $hex[\"$h1\"];\n $length += 2;\n $addtl_chars += 2;\n }\n\n // length for wordwrap exceeded, get a newline into the text\n if ($length >= $line_max) {\n $cur_conv_line .= $c;\n\n // read only up to the whitespace for the current line\n $whitesp_diff = $i - $whitespace_pos + $addtl_chars;\n\n /* the text after the whitespace will have to be read\n * again ( + any additional characters that came into\n * existence as a result of the encoding process after the whitespace)\n *\n * Also, do not start at 0, if there was *no* whitespace in\n * the whole line */\n if (($i + $addtl_chars) > $whitesp_diff) {\n $output .= substr($cur_conv_line, 0, (strlen($cur_conv_line) -\n $whitesp_diff)) . $linebreak;\n $i = $i - $whitesp_diff + $addtl_chars;\n } else {\n $output .= $cur_conv_line . $linebreak;\n }\n\n $cur_conv_line = \"\";\n $length = 0;\n $whitespace_pos = 0;\n } else {\n // length for wordwrap not reached, continue reading\n $cur_conv_line .= $c;\n }\n } // end of for\n\n $length = 0;\n $whitespace_pos = 0;\n $output .= $cur_conv_line;\n $cur_conv_line = \"\";\n\n if ($j <= count($lines) - 1) {\n $output .= $linebreak;\n }\n } // end for\n\n return trim($output);\n } // end quoted_printable_encode", "label": 1, "label_name": "safe"} +{"code": "func (m *MockAuthorizeRequester) GetClient() fosite.Client {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetClient\")\n\tret0, _ := ret[0].(fosite.Client)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} +{"code": " def AsyncGetActionAllowAnyone(f: GetRequest => Future[Result]): mvc.Action[Unit] =\n PlainApiAction(cc.parsers.empty, NoRateLimits, allowAnyone = true).async(f)", "label": 0, "label_name": "vulnerable"} +{"code": "int CLua::loadfile(lua_State *ls, const char *filename, bool trusted,\n bool die_on_fail)\n{\n if (!ls)\n return -1;\n\n if (!is_path_safe(filename, trusted))\n {\n lua_pushstring(\n ls,\n make_stringf(\"invalid filename: %s\", filename).c_str());\n return -1;\n }\n\n string file = datafile_path(filename, die_on_fail);\n if (file.empty())\n {\n lua_pushstring(ls,\n make_stringf(\"Can't find \\\"%s\\\"\", filename).c_str());\n return -1;\n }\n\n FileLineInput f(file.c_str());\n string script;\n while (!f.eof())\n script += f.get_line() + \"\\n\";\n\n if (script[0] == 0x1b)\n abort();\n\n // prefixing with @ stops lua from adding [string \"%s\"]\n return luaL_loadbuffer(ls, &script[0], script.length(),\n (\"@\" + file).c_str());\n}", "label": 1, "label_name": "safe"} +{"code": " text: this.text.slice(start, this.index),\n identifier: true\n });\n },", "label": 0, "label_name": "vulnerable"} +{"code": " public function getFallbackFor($code) {\n $this->loadLanguage($code);\n return $this->cache[$code]['fallback'];\n }", "label": 1, "label_name": "safe"} +{"code": "this.buttonContainer.style.top=\"6px\";this.editor.fireEvent(new mxEventObject(\"statusChanged\"))}};var E=Sidebar.prototype.getTooltipOffset;Sidebar.prototype.getTooltipOffset=function(O,X){if(null==this.editorUi.sidebarWindow||mxUtils.isAncestorNode(this.editorUi.picker,O)){var ea=mxUtils.getOffset(this.editorUi.picker);ea.x+=this.editorUi.picker.offsetWidth+4;ea.y+=O.offsetTop-X.height/2+16;return ea}var ka=E.apply(this,arguments);ea=mxUtils.getOffset(this.editorUi.sidebarWindow.window.div);ka.x+=\nea.x-16;ka.y+=ea.y;return ka};var C=Menus.prototype.createPopupMenu;Menus.prototype.createPopupMenu=function(O,X,ea){var ka=this.editorUi.editor.graph;O.smartSeparators=!0;C.apply(this,arguments);\"1\"==urlParams.sketch?ka.isEnabled()&&(O.addSeparator(),1==ka.getSelectionCount()&&this.addMenuItems(O,[\"-\",\"lockUnlock\"],null,ea)):1==ka.getSelectionCount()?(ka.isCellFoldable(ka.getSelectionCell())&&this.addMenuItems(O,ka.isCellCollapsed(X)?[\"expand\"]:[\"collapse\"],null,ea),this.addMenuItems(O,[\"collapsible\",", "label": 0, "label_name": "vulnerable"} +{"code": " public function getVisibility($path)\n {\n return false;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "mrb_proc_init_copy(mrb_state *mrb, mrb_value self)\n{\n mrb_value proc = mrb_get_arg1(mrb);\n\n if (!mrb_proc_p(proc)) {\n mrb_raise(mrb, E_ARGUMENT_ERROR, \"not a proc\");\n }\n mrb_proc_copy(mrb, mrb_proc_ptr(self), mrb_proc_ptr(proc));\n return self;\n}", "label": 1, "label_name": "safe"} +{"code": " header($name.': '.$value, false);\n }\n header('Content-Type: text/html; charset='.$this->charset);\n }\n\n echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private function add($s1, $s2, $scale) {\n if ($this->bcmath) return bcadd($s1, $s2, $scale);\n else return $this->scale($s1 + $s2, $scale);\n }", "label": 1, "label_name": "safe"} +{"code": " def _parse(self, err):\n\n all_hosts = {}\n self.raw = utils.parse_json(self.data)\n all = Group('all')\n groups = dict(all=all)\n group = None\n\n\n if 'failed' in self.raw:\n sys.stderr.write(err + \"\\n\")\n raise errors.AnsibleError(\"failed to parse executable inventory script results: %s\" % self.raw)\n\n for (group_name, data) in self.raw.items():\n \n # in Ansible 1.3 and later, a \"_meta\" subelement may contain\n # a variable \"hostvars\" which contains a hash for each host\n # if this \"hostvars\" exists at all then do not call --host for each\n # host. This is for efficiency and scripts should still return data\n # if called with --host for backwards compat with 1.2 and earlier.\n\n if group_name == '_meta':\n if 'hostvars' in data:\n self.host_vars_from_top = data['hostvars']\n continue\n\n if group_name != all.name:\n group = groups[group_name] = Group(group_name)\n else:\n group = all\n host = None\n\n if not isinstance(data, dict):\n data = {'hosts': data}\n elif not any(k in data for k in ('hosts','vars')):\n data = {'hosts': [group_name], 'vars': data}\n\n if 'hosts' in data:\n\n for hostname in data['hosts']:\n if not hostname in all_hosts:\n all_hosts[hostname] = Host(hostname)\n host = all_hosts[hostname]\n group.add_host(host)\n\n if 'vars' in data:\n for k, v in data['vars'].iteritems():\n if group.name == all.name:\n all.set_variable(k, v)\n else:\n group.set_variable(k, v)\n if group.name != all.name:\n all.add_child_group(group)\n\n # Separate loop to ensure all groups are defined\n for (group_name, data) in self.raw.items():\n if group_name == '_meta':\n continue\n if isinstance(data, dict) and 'children' in data:\n for child_name in data['children']:\n if child_name in groups:\n groups[group_name].add_child_group(groups[child_name])\n return groups", "label": 0, "label_name": "vulnerable"} +{"code": " public function update()\n {\n $project = $this->getProject();\n\n $values = $this->request->getValues();\n list($valid, $errors) = $this->swimlaneValidator->validateModification($values);\n\n if ($valid) {\n if ($this->swimlaneModel->update($values['id'], $values)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n } else {\n $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));\n }\n }\n\n return $this->edit($values, $errors);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " id: f.id === false ? false : (f.id || true),\n classes: w.classes\n };\n if (isMultiple) {\n attrs.multiple = true;\n }\n return tag('select', [attrs, userAttrs, w.attrs || {}], optionsHTML);\n };", "label": 0, "label_name": "vulnerable"} +{"code": "function item_edit() {\n\tglobal $cdef_item_types, $cdef_functions, $cdef_operators, $custom_data_source_types;\n\n\t/* ================= input validation ================= */\n\tget_filter_request_var('id');\n\tget_filter_request_var('cdef_id');\n\t/* ==================================================== */\n\n\tif (!isempty_request_var('id')) {\n\t\t$cdef = db_fetch_row_prepared('SELECT *\n\t\t\tFROM cdef_items\n\t\t\tWHERE id = ?',\n\t\t\tarray(get_request_var('id')));\n\n\t\tif (cacti_sizeof($cdef)) {\n\t\t\t$current_type = $cdef['type'];\n\t\t\t$values[$current_type] = $cdef['value'];\n\t\t}\n\t} else {\n\t\t$cdef = array();\n\t}\n\n\thtml_start_box(__('CDEF Preview'), '100%', '', '3', 'center', '');\n\tdraw_cdef_preview(get_request_var('cdef_id'));\n\thtml_end_box();\n\n\tform_start('cdef.php', 'form_cdef');\n\n\t$cdef_name = db_fetch_cell_prepared('SELECT name\n\t\tFROM cdef\n\t\tWHERE id = ?',\n\t\tarray(get_request_var('cdef_id')));\n\n\thtml_start_box(__('CDEF Items [edit: %s]', html_escape($cdef_name)), '100%', '', '3', 'center', '');\n\n\tif (isset_request_var('type_select')) {\n\t\t$current_type = get_request_var('type_select');\n\t} elseif (isset($cdef['type'])) {\n\t\t$current_type = $cdef['type'];\n\t} else {\n\t\t$current_type = '1';\n\t}\n\n\t$form_cdef = array(\n\t\t'type_select' => array(\n\t\t\t'method' => 'drop_array',\n\t\t\t'friendly_name' => __('CDEF Item Type'),\n\t\t\t'description' => __('Choose what type of CDEF item this is.'),\n\t\t\t'value' => $current_type,\n\t\t\t'array' => $cdef_item_types\n\t\t),\n\t\t'value' => array(\n\t\t\t'method' => 'drop_array',\n\t\t\t'friendly_name' => __('CDEF Item Value'),\n\t\t\t'description' => __('Enter a value for this CDEF item.'),\n\t\t\t'value' => (isset($cdef['value']) ? $cdef['value']:'')\n\t\t),\n\t\t'id' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => isset_request_var('id') ? get_request_var('id') : '0',\n\t\t),\n\t\t'type' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => $current_type\n\t\t),\n\t\t'cdef_id' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => get_request_var('cdef_id')\n\t\t),\n\t\t'save_component_item' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => '1'\n\t\t)\n\t);\n\n\tswitch ($current_type) {\n\tcase '1':\n\t\t$form_cdef['value']['array'] = $cdef_functions;\n\n\t\tbreak;\n\tcase '2':\n\t\t$form_cdef['value']['array'] = $cdef_operators;\n\n\t\tbreak;\n\tcase '4':\n\t\t$form_cdef['value']['array'] = $custom_data_source_types;\n\n\t\tbreak;\n\tcase '5':\n\t\t$form_cdef['value']['method'] = 'drop_sql';\n\t\t$form_cdef['value']['sql'] = 'SELECT name, id FROM cdef WHERE `system`=0 ORDER BY name';\n\n\t\tbreak;\n\tcase '6':\n\t\t$form_cdef['value']['method'] = 'textbox';\n\t\t$form_cdef['value']['max_length'] = '255';\n\t\t$form_cdef['value']['size'] = '30';\n\n\t\tbreak;\n\t}\n\n\tdraw_edit_form(\n\t\tarray(\n\t\t\t'config' => array('no_form_tag' => true),\n\t\t\t'fields' => inject_form_variables($form_cdef, $cdef)\n\t\t)\n\t);\n\n\t?>\n\t\n\t 32)\n\t\tlen = 32;\n\n\tdown_read(&uts_sem);\n\tfor (i = 0; i < len; ++i) {\n\t\t__put_user(utsname()->domainname[i], name + i);\n\t\tif (utsname()->domainname[i] == '\\0')\n\t\t\tbreak;\n\t}\n\tup_read(&uts_sem);\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "options_dic_send:function(){var b={osp:e.cookie.get(\"osp\"),udn:e.cookie.get(\"udn\"),cust_dic_ids:a.cust_dic_ids,id:\"options_dic_send\",udnCmd:e.cookie.get(\"udnCmd\")};e.postMessage.send({message:b,target:a.targetFromFrame[a.iframeNumber+\"_\"+a.dialog._.currentTabId]})},data:function(a){delete a.id},giveOptions:function(){},setOptionsConfirmF:function(){},setOptionsConfirmT:function(){j.setValue(\"\")},clickBusy:function(){a.div_overlay.setEnable()},suggestAllCame:function(){a.div_overlay.setDisable();a.div_overlay_no_check.setDisable()},", "label": 1, "label_name": "safe"} +{"code": "export function setValueAtPath(\n target: unknown,\n val: unknown,\n path: PathSegments,\n force = false,\n): unknown {\n if (path.length === 0) {\n throw new Error('Cannot set the root object; assign it directly.');\n }\n if (typeof target === 'undefined') {\n throw new TypeError('Cannot set values on undefined');\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let it: any = target;\n const len = path.length;\n const end = path.length - 1;\n let step: PathSegment;\n let cursor = -1;\n let rem: unknown;\n let p: number;\n while (++cursor < len) {\n step = path[cursor];\n if (typeof step !== 'string' && typeof step !== 'number') {\n throw new TypeError('PathSegments must be a string or a number.');\n }\n if (\n step === '__proto__' ||\n step === 'constructor' ||\n step === 'prototype'\n ) {\n throw new Error('Attempted prototype pollution disallowed.');\n }\n if (Array.isArray(it)) {\n if (step === '-' && cursor === end) {\n it.push(val);\n return undefined;\n }\n p = toArrayIndexReference(it, step);\n if (it.length > p) {\n if (cursor === end) {\n rem = it[p];\n it[p] = val;\n break;\n }\n it = it[p];\n } else if (cursor === end && p === it.length) {\n if (force) {\n it.push(val);\n return undefined;\n }\n } else if (force) {\n it = it[p] = cursor === end ? val : {};\n }\n } else {\n if (typeof it[step] === 'undefined') {\n if (force) {\n if (cursor === end) {\n it[step] = val;\n return undefined;\n }\n // if the next step is an array index, this step should be an array.\n if (toArrayIndexReference(it[step], path[cursor + 1]) !== -1) {\n it = it[step] = [];\n continue;\n }\n it = it[step] = {};\n continue;\n }\n return undefined;\n }\n if (cursor === end) {\n rem = it[step];\n it[step] = val;\n break;\n }\n it = it[step];\n }\n }\n return rem;\n}", "label": 1, "label_name": "safe"} +{"code": " $contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('orders_status.php', 'page=' . (int)$_GET['page']), null, null, 'btn-light')];", "label": 1, "label_name": "safe"} +{"code": " public function setupMockForFailure($op)\n {\n $this->mock->expectOnce($op, array($this->def, $this->config));\n $this->mock->returns($op, false, array($this->def, $this->config));\n $this->mock->expectOnce('get', array($this->config));\n }", "label": 1, "label_name": "safe"} +{"code": " protected function parseUrl($url)\n {\n // The regular expression is copied verbatim from RFC 3986, appendix B.\n // The expression does not validate the URL but matches any string.\n preg_match(\n '(^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?)',\n $url, $matches\n );\n\n // \"path\" is always present (possibly as an empty string); the rest\n // are optional.\n $this->_scheme = !empty($matches[1]) ? $matches[2] : false;\n $this->setAuthority(!empty($matches[3]) ? $matches[4] : false);\n $this->_path = $this->_encodeData($matches[5]);\n $this->_query = !empty($matches[6])\n ? $this->_encodeData($matches[7])\n : false\n ;\n $this->_fragment = !empty($matches[8]) ? $matches[9] : false;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t_mouseDrag: function(event) {\n\t\tvar i, item, itemElement, intersection,\n\t\t\to = this.options,\n\t\t\tscrolled = false;\n\n\t\t//Compute the helpers position\n\t\tthis.position = this._generatePosition(event);\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\tif (!this.lastPositionAbs) {\n\t\t\tthis.lastPositionAbs = this.positionAbs;\n\t\t}\n\n\t\t//Do scrolling\n\t\tif(this.options.scroll) {\n\t\t\tif(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== \"HTML\") {\n\n\t\t\t\tif((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;\n\t\t\t\t} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;\n\t\t\t\t}\n\n\t\t\t\tif((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;\n\t\t\t\t} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);\n\t\t\t\t} else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);\n\t\t\t\t}\n\n\t\t\t\tif(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);\n\t\t\t\t} else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {\n\t\t\t\t$.ui.ddmanager.prepareOffsets(this, event);\n\t\t\t}\n\t\t}\n\n\t\t//Regenerate the absolute position used for position checks\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\t//Set the helper position\n\t\tif(!this.options.axis || this.options.axis !== \"y\") {\n\t\t\tthis.helper[0].style.left = this.position.left+\"px\";\n\t\t}\n\t\tif(!this.options.axis || this.options.axis !== \"x\") {\n\t\t\tthis.helper[0].style.top = this.position.top+\"px\";\n\t\t}\n\n\t\t//Rearrange\n\t\tfor (i = this.items.length - 1; i >= 0; i--) {\n\n\t\t\t//Cache variables and intersection, continue if no intersection\n\t\t\titem = this.items[i];\n\t\t\titemElement = item.item[0];\n\t\t\tintersection = this._intersectsWithPointer(item);\n\t\t\tif (!intersection) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Only put the placeholder inside the current Container, skip all\n\t\t\t// items from other containers. This works because when moving\n\t\t\t// an item from one container to another the\n\t\t\t// currentContainer is switched before the placeholder is moved.\n\t\t\t//\n\t\t\t// Without this, moving items in \"sub-sortables\" can cause\n\t\t\t// the placeholder to jitter between the outer and inner container.\n\t\t\tif (item.instance !== this.currentContainer) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// cannot intersect with itself\n\t\t\t// no useless actions that have been done before\n\t\t\t// no action if the item moved is the parent of the item checked\n\t\t\tif (itemElement !== this.currentItem[0] &&\n\t\t\t\tthis.placeholder[intersection === 1 ? \"next\" : \"prev\"]()[0] !== itemElement &&\n\t\t\t\t!$.contains(this.placeholder[0], itemElement) &&\n\t\t\t\t(this.options.type === \"semi-dynamic\" ? !$.contains(this.element[0], itemElement) : true)\n\t\t\t) {\n\n\t\t\t\tthis.direction = intersection === 1 ? \"down\" : \"up\";\n\n\t\t\t\tif (this.options.tolerance === \"pointer\" || this._intersectsWithSides(item)) {\n\t\t\t\t\tthis._rearrange(event, item);\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._trigger(\"change\", event, this._uiHash());\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t//Post events to containers\n\t\tthis._contactContainers(event);\n\n\t\t//Interconnect with droppables\n\t\tif($.ui.ddmanager) {\n\t\t\t$.ui.ddmanager.drag(this, event);\n\t\t}\n\n\t\t//Call callbacks\n\t\tthis._trigger(\"sort\", event, this._uiHash());\n\n\t\tthis.lastPositionAbs = this.positionAbs;\n\t\treturn false;\n\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": "function twig_array_filter(Environment $env, $array, $arrow)\n{\n if (!twig_test_iterable($array)) {\n throw new RuntimeError(sprintf('The \"filter\" filter expects an array or \"Traversable\", got \"%s\".', \\is_object($array) ? \\get_class($array) : \\gettype($array)));\n }\n\n if (!$arrow instanceof Closure && $env->hasExtension('\\Twig\\Extension\\SandboxExtension') && $env->getExtension('\\Twig\\Extension\\SandboxExtension')->isSandboxed()) {\n throw new RuntimeError('The callable passed to \"filter\" filter must be a Closure in sandbox mode.');\n }\n\n if (\\is_array($array)) {\n return array_filter($array, $arrow, \\ARRAY_FILTER_USE_BOTH);\n }\n\n // the IteratorIterator wrapping is needed as some internal PHP classes are \\Traversable but do not implement \\Iterator\n return new \\CallbackFilterIterator(new \\IteratorIterator($array), $arrow);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int MqttClient_WaitType(MqttClient *client, void *packet_obj,\n byte wait_type, word16 wait_packet_id, int timeout_ms)\n{\n int rc;\n word16 packet_id;\n MqttPacketType packet_type;\n#ifdef WOLFMQTT_MULTITHREAD\n MqttPendResp *pendResp;\n int readLocked;\n#endif\n MqttMsgStat* mms_stat;\n int waitMatchFound;\n\n if (client == NULL || packet_obj == NULL) {\n return MQTT_CODE_ERROR_BAD_ARG;\n }\n\n /* all packet type structures must have MqttMsgStat at top */\n mms_stat = (MqttMsgStat*)packet_obj;\n\nwait_again:\n\n /* initialize variables */\n packet_id = 0;\n packet_type = MQTT_PACKET_TYPE_RESERVED;\n#ifdef WOLFMQTT_MULTITHREAD\n pendResp = NULL;\n readLocked = 0;\n#endif\n waitMatchFound = 0;\n\n#ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"MqttClient_WaitType: Type %s (%d), ID %d\",\n MqttPacket_TypeDesc((MqttPacketType)wait_type),\n wait_type, wait_packet_id);\n#endif\n\n switch ((int)*mms_stat)\n {\n case MQTT_MSG_BEGIN:\n {\n #ifdef WOLFMQTT_MULTITHREAD\n /* Lock recv socket mutex */\n rc = wm_SemLock(&client->lockRecv);\n if (rc != 0) {\n PRINTF(\"MqttClient_WaitType: recv lock error!\");\n return rc;\n }\n readLocked = 1;\n #endif\n\n /* reset the packet state */\n client->packet.stat = MQTT_PK_BEGIN;\n }\n FALL_THROUGH;\n\n #ifdef WOLFMQTT_V5\n case MQTT_MSG_AUTH:\n #endif\n case MQTT_MSG_WAIT:\n {\n #ifdef WOLFMQTT_MULTITHREAD\n /* Check to see if packet type and id have already completed */\n pendResp = NULL;\n rc = wm_SemLock(&client->lockClient);\n if (rc == 0) {\n if (MqttClient_RespList_Find(client, (MqttPacketType)wait_type, \n wait_packet_id, &pendResp)) {\n if (pendResp->packetDone) {\n /* pending response is already done, so return */\n rc = pendResp->packet_ret;\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"PendResp already Done %p: Rc %d\", pendResp, rc);\n #endif\n MqttClient_RespList_Remove(client, pendResp);\n wm_SemUnlock(&client->lockClient);\n wm_SemUnlock(&client->lockRecv);\n return rc;\n }\n }\n wm_SemUnlock(&client->lockClient);\n }\n else {\n break; /* error */\n }\n #endif /* WOLFMQTT_MULTITHREAD */\n\n *mms_stat = MQTT_MSG_WAIT;\n\n /* Wait for packet */\n rc = MqttPacket_Read(client, client->rx_buf, client->rx_buf_len,\n timeout_ms);\n /* handle failure */\n if (rc <= 0) {\n break;\n }\n\n /* capture length read */\n client->packet.buf_len = rc;\n\n /* Decode Packet - get type and id */\n rc = MqttClient_DecodePacket(client, client->rx_buf,\n client->packet.buf_len, NULL, &packet_type, NULL, &packet_id);\n if (rc < 0) {\n break;\n }\n\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"Read Packet: Len %d, Type %d, ID %d\",\n client->packet.buf_len, packet_type, packet_id);\n #endif\n\n *mms_stat = MQTT_MSG_READ;\n }\n FALL_THROUGH;\n\n case MQTT_MSG_READ:\n case MQTT_MSG_READ_PAYLOAD:\n {\n MqttPacketType use_packet_type;\n void* use_packet_obj;\n\n #ifdef WOLFMQTT_MULTITHREAD\n readLocked = 1; /* if in this state read is locked */\n #endif\n\n /* read payload state only happens for publish messages */\n if (*mms_stat == MQTT_MSG_READ_PAYLOAD) {\n packet_type = MQTT_PACKET_TYPE_PUBLISH;\n }\n\n /* Determine if we received data for this request */\n if ((wait_type == MQTT_PACKET_TYPE_ANY ||\n wait_type == packet_type ||\n (MqttIsPubRespPacket(packet_type) &&\n MqttIsPubRespPacket(wait_type))) &&\n (wait_packet_id == 0 || wait_packet_id == packet_id))\n {\n use_packet_obj = packet_obj;\n waitMatchFound = 1;\n }\n else {\n /* use generic packet object */\n use_packet_obj = &client->msg;\n }\n use_packet_type = packet_type;\n\n #ifdef WOLFMQTT_MULTITHREAD\n /* Check to see if we have a pending response for this packet */\n pendResp = NULL;\n rc = wm_SemLock(&client->lockClient);\n if (rc == 0) {\n if (MqttClient_RespList_Find(client, packet_type, packet_id,\n &pendResp)) {\n /* we found packet match this incoming read packet */\n pendResp->packetProcessing = 1;\n use_packet_obj = pendResp->packet_obj;\n use_packet_type = pendResp->packet_type;\n /* req from another thread... not a match */\n waitMatchFound = 0;\n }\n wm_SemUnlock(&client->lockClient);\n }\n else {\n break; /* error */\n }\n #endif /* WOLFMQTT_MULTITHREAD */\n\n /* Perform packet handling for publish callback and QoS */\n rc = MqttClient_HandlePacket(client, use_packet_type,\n use_packet_obj, timeout_ms);\n\n #ifdef WOLFMQTT_NONBLOCK\n if (rc == MQTT_CODE_CONTINUE) {\n /* we have received some data, so keep the recv\n mutex lock active and return */\n return rc;\n }\n #endif\n\n /* handle success case */\n if (rc >= 0) {\n rc = MQTT_CODE_SUCCESS;\n }\n\n #ifdef WOLFMQTT_MULTITHREAD\n if (pendResp) {\n /* Mark pending response entry done */\n if (wm_SemLock(&client->lockClient) == 0) {\n pendResp->packetDone = 1;\n pendResp->packet_ret = rc;\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"PendResp Done %p\", pendResp);\n #endif\n pendResp = NULL;\n wm_SemUnlock(&client->lockClient);\n }\n }\n #endif /* WOLFMQTT_MULTITHREAD */\n break;\n }\n\n case MQTT_MSG_WRITE:\n case MQTT_MSG_WRITE_PAYLOAD:\n default:\n {\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"MqttClient_WaitType: Invalid state %d!\", *mms_stat);\n #endif\n rc = MQTT_CODE_ERROR_STAT;\n break;\n }\n } /* switch (*mms_stat) */\n\n#ifdef WOLFMQTT_NONBLOCK\n if (rc != MQTT_CODE_CONTINUE)\n#endif\n {\n /* reset state */\n *mms_stat = MQTT_MSG_BEGIN;\n }\n\n#ifdef WOLFMQTT_MULTITHREAD\n if (readLocked) {\n wm_SemUnlock(&client->lockRecv);\n }\n#endif\n if (rc < 0) {\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"MqttClient_WaitType: Failure: %s (%d)\",\n MqttClient_ReturnCodeToString(rc), rc);\n #endif\n return rc;\n }\n\n if (!waitMatchFound) {\n /* if we get here, then the we are still waiting for a packet */\n goto wait_again;\n }\n\n return rc;\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic function testPages () {\n $this->visitPages ( $this->allPages );\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should require a name' do\n expect {\n Puppet::Type.type(:rabbitmq_user).new({})\n }.to raise_error(Puppet::Error, 'Title or name must be provided')\n end", "label": 0, "label_name": "vulnerable"} +{"code": "void CoreUserInputHandler::handleMsg(const BufferInfo &bufferInfo, const QString &msg)\n{\n Q_UNUSED(bufferInfo);\n if (!msg.contains(' '))\n return;\n\n QString target = msg.section(' ', 0, 0);\n QByteArray encMsg = userEncode(target, msg.section(' ', 1));\n\n#ifdef HAVE_QCA2\n putPrivmsg(serverEncode(target), encMsg, network()->cipher(target));\n#else\n putPrivmsg(serverEncode(target), encMsg);\n#endif\n}", "label": 0, "label_name": "vulnerable"} +{"code": "nautilus_file_mark_desktop_file_executable (GFile *file,\n GtkWindow *parent_window,\n gboolean interactive,\n NautilusOpCallback done_callback,\n gpointer done_callback_data)\n{\n GTask *task;\n MarkTrustedJob *job;\n\n job = op_job_new (MarkTrustedJob, parent_window);\n job->file = g_object_ref (file);\n job->interactive = interactive;\n job->done_callback = done_callback;\n job->done_callback_data = done_callback_data;\n\n task = g_task_new (NULL, NULL, mark_desktop_file_executable_task_done, job);\n g_task_set_task_data (task, job, NULL);\n g_task_run_in_thread (task, mark_desktop_file_executable_task_thread_func);\n g_object_unref (task);\n}", "label": 1, "label_name": "safe"} +{"code": " public function display_sdm_stats_meta_box($post) { //Stats metabox\n\t$old_count = get_post_meta($post->ID, 'sdm_count_offset', true);\n\t$value = isset($old_count) && $old_count != '' ? $old_count : '0';\n\n\t// Get checkbox for \"disable download logging\"\n\t$no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true);\n\t$checked = isset($no_logs) && $no_logs === 'on' ? 'checked=\"checked\"' : '';\n\n\t_e('These are the statistics for this download item.', 'simple-download-monitor');\n\techo '

    ';\n\n\tglobal $wpdb;\n\t$wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'sdm_downloads WHERE post_id=%s', $post->ID));\n\n\techo '
    ';\n\t_e('Number of Downloads:', 'simple-download-monitor');\n\techo ' ' . $wpdb->num_rows . '';\n\techo '
    ';\n\n\techo '
    ';\n\t_e('Offset Count: ', 'simple-download-monitor');\n\techo '
    ';\n\techo ' ';\n\techo '

    ' . __('Enter any positive or negative numerical value; to offset the download count shown to the visitors (when using the download counter shortcode).', 'simple-download-monitor') . '

    ';\n\techo '
    ';\n\n\techo '
    ';\n\techo '
    ';\n\techo '';\n\techo '';\n\t_e('Disable download logging for this item.', 'simple-download-monitor');\n\techo '
    ';\n\n\twp_nonce_field('sdm_count_offset_nonce', 'sdm_count_offset_nonce_check');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void jas_matrix_asr(jas_matrix_t *matrix, int n)\n{\n\tjas_matind_t i;\n\tjas_matind_t j;\n\tjas_seqent_t *rowstart;\n\tjas_matind_t rowstep;\n\tjas_seqent_t *data;\n\n\tassert(n >= 0);\n\tif (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {\n\t\tassert(matrix->rows_);\n\t\trowstep = jas_matrix_rowstep(matrix);\n\t\tfor (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,\n\t\t rowstart += rowstep) {\n\t\t\tfor (j = matrix->numcols_, data = rowstart; j > 0; --j,\n\t\t\t ++data) {\n\t\t\t\t//*data >>= n;\n\t\t\t\t*data = jas_seqent_asr(*data, n);\n\t\t\t}\n\t\t}\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " public function AddCC($address, $name = '') {\n return $this->AddAnAddress('cc', $address, $name);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int asn1_decode_entry(sc_context_t *ctx,struct sc_asn1_entry *entry,\n\t\t\t const u8 *obj, size_t objlen, int depth)\n{\n\tvoid *parm = entry->parm;\n\tint (*callback_func)(sc_context_t *nctx, void *arg, const u8 *nobj,\n\t\t\t size_t nobjlen, int ndepth);\n\tsize_t *len = (size_t *) entry->arg;\n\tint r = 0;\n\n\tcallback_func = parm;\n\n\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"%*.*sdecoding '%s', raw data:%s%s\\n\",\n\t\tdepth, depth, \"\", entry->name,\n\t\tsc_dump_hex(obj, objlen > 16 ? 16 : objlen),\n\t\tobjlen > 16 ? \"...\" : \"\");\n\n\tswitch (entry->type) {\n\tcase SC_ASN1_STRUCT:\n\t\tif (parm != NULL)\n\t\t\tr = asn1_decode(ctx, (struct sc_asn1_entry *) parm, obj,\n\t\t\t\t objlen, NULL, NULL, 0, depth + 1);\n\t\tbreak;\n\tcase SC_ASN1_NULL:\n\t\tbreak;\n\tcase SC_ASN1_BOOLEAN:\n\t\tif (parm != NULL) {\n\t\t\tif (objlen != 1) {\n\t\t\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1,\n\t\t\t\t\t \"invalid ASN.1 object length: %\"SC_FORMAT_LEN_SIZE_T\"u\\n\",\n\t\t\t\t\t objlen);\n\t\t\t\tr = SC_ERROR_INVALID_ASN1_OBJECT;\n\t\t\t} else\n\t\t\t\t*((int *) parm) = obj[0] ? 1 : 0;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_INTEGER:\n\tcase SC_ASN1_ENUMERATED:\n\t\tif (parm != NULL) {\n\t\t\tr = sc_asn1_decode_integer(obj, objlen, (int *) entry->parm);\n\t\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"%*.*sdecoding '%s' returned %d\\n\", depth, depth, \"\",\n\t\t\t\t\tentry->name, *((int *) entry->parm));\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_BIT_STRING_NI:\n\tcase SC_ASN1_BIT_STRING:\n\t\tif (parm != NULL) {\n\t\t\tint invert = entry->type == SC_ASN1_BIT_STRING ? 1 : 0;\n\t\t\tassert(len != NULL);\n\t\t\tif (objlen < 1) {\n\t\t\t\tr = SC_ERROR_INVALID_ASN1_OBJECT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen-1);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t*len = objlen-1;\n\t\t\t\tparm = *buf;\n\t\t\t}\n\t\t\tr = decode_bit_string(obj, objlen, (u8 *) parm, *len, invert);\n\t\t\tif (r >= 0) {\n\t\t\t\t*len = r;\n\t\t\t\tr = 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_BIT_FIELD:\n\t\tif (parm != NULL)\n\t\t\tr = decode_bit_field(obj, objlen, (u8 *) parm, *len);\n\t\tbreak;\n\tcase SC_ASN1_OCTET_STRING:\n\t\tif (parm != NULL) {\n\t\t\tsize_t c;\n\t\t\tassert(len != NULL);\n\n\t\t\t/* Strip off padding zero */\n\t\t\tif ((entry->flags & SC_ASN1_UNSIGNED)\n\t\t\t\t\t&& objlen > 1 && obj[0] == 0x00) {\n\t\t\t\tobjlen--;\n\t\t\t\tobj++;\n\t\t\t}\n\n\t\t\t/* Allocate buffer if needed */\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tc = *len = objlen;\n\t\t\t\tparm = *buf;\n\t\t\t} else\n\t\t\t\tc = objlen > *len ? *len : objlen;\n\n\t\t\tmemcpy(parm, obj, c);\n\t\t\t*len = c;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_GENERALIZEDTIME:\n\t\tif (parm != NULL) {\n\t\t\tsize_t c;\n\t\t\tassert(len != NULL);\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tc = *len = objlen;\n\t\t\t\tparm = *buf;\n\t\t\t} else\n\t\t\t\tc = objlen > *len ? *len : objlen;\n\n\t\t\tmemcpy(parm, obj, c);\n\t\t\t*len = c;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_OBJECT:\n\t\tif (parm != NULL)\n\t\t\tr = sc_asn1_decode_object_id(obj, objlen, (struct sc_object_id *) parm);\n\t\tbreak;\n\tcase SC_ASN1_PRINTABLESTRING:\n\tcase SC_ASN1_UTF8STRING:\n\t\tif (parm != NULL) {\n\t\t\tassert(len != NULL);\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen+1);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t*len = objlen+1;\n\t\t\t\tparm = *buf;\n\t\t\t}\n\t\t\tr = sc_asn1_decode_utf8string(obj, objlen, (u8 *) parm, len);\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\t*len -= 1;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_PATH:\n\t\tif (entry->parm != NULL)\n\t\t\tr = asn1_decode_path(ctx, obj, objlen, (sc_path_t *) parm, depth);\n\t\tbreak;\n\tcase SC_ASN1_PKCS15_ID:\n\t\tif (entry->parm != NULL) {\n\t\t\tstruct sc_pkcs15_id *id = (struct sc_pkcs15_id *) parm;\n\t\t\tsize_t c = objlen > sizeof(id->value) ? sizeof(id->value) : objlen;\n\n\t\t\tmemcpy(id->value, obj, c);\n\t\t\tid->len = c;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_PKCS15_OBJECT:\n\t\tif (entry->parm != NULL)\n\t\t\tr = asn1_decode_p15_object(ctx, obj, objlen, (struct sc_asn1_pkcs15_object *) parm, depth);\n\t\tbreak;\n\tcase SC_ASN1_ALGORITHM_ID:\n\t\tif (entry->parm != NULL)\n\t\t\tr = sc_asn1_decode_algorithm_id(ctx, obj, objlen, (struct sc_algorithm_id *) parm, depth);\n\t\tbreak;\n\tcase SC_ASN1_SE_INFO:\n\t\tif (entry->parm != NULL)\n\t\t\tr = asn1_decode_se_info(ctx, obj, objlen, (sc_pkcs15_sec_env_info_t ***)entry->parm, len, depth);\n\t\tbreak;\n\tcase SC_ASN1_CALLBACK:\n\t\tif (entry->parm != NULL)\n\t\t\tr = callback_func(ctx, entry->arg, obj, objlen, depth);\n\t\tbreak;\n\tdefault:\n\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"invalid ASN.1 type: %d\\n\", entry->type);\n\t\treturn SC_ERROR_INVALID_ASN1_OBJECT;\n\t}\n\tif (r) {\n\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"decoding of ASN.1 object '%s' failed: %s\\n\", entry->name,\n\t\t sc_strerror(r));\n\t\treturn r;\n\t}\n\tentry->flags |= SC_ASN1_PRESENT;\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "void *hashtable_get(hashtable_t *hashtable, const char *key)\n{\n pair_t *pair;\n size_t hash;\n bucket_t *bucket;\n\n hash = hash_str(key);\n bucket = &hashtable->buckets[hash & hashmask(hashtable->order)];\n\n pair = hashtable_find_pair(hashtable, bucket, key, hash);\n if(!pair)\n return NULL;\n\n return pair->value;\n}", "label": 1, "label_name": "safe"} +{"code": "void CtcpParser::query(CoreNetwork *net, const QString &bufname, const QString &ctcpTag, const QString &message)\n{\n QList params;\n params << net->serverEncode(bufname) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message)));\n\n static const char *splitter = \" .,-!?\";\n int maxSplitPos = message.count();\n int splitPos = maxSplitPos;\n\n int overrun = net->userInputHandler()->lastParamOverrun(\"PRIVMSG\", params);\n if (overrun) {\n maxSplitPos = message.count() - overrun -2;\n splitPos = -1;\n for (const char *splitChar = splitter; *splitChar != 0; splitChar++) {\n splitPos = qMax(splitPos, message.lastIndexOf(*splitChar, maxSplitPos) + 1); // keep split char on old line\n }\n if (splitPos <= 0 || splitPos > maxSplitPos)\n splitPos = maxSplitPos;\n\n params = params.mid(0, 1) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message.left(splitPos))));\n }\n net->putCmd(\"PRIVMSG\", params);\n\n if (splitPos < message.count())\n query(net, bufname, ctcpTag, message.mid(splitPos));\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testConstruct()\n {\n $handler = new NativeSessionHandler();\n\n // note for PHPUnit optimisers - the use of assertTrue/False\n // here is deliberate since the tests do not require the classes to exist - drak\n if (PHP_VERSION_ID < 50400) {\n $this->assertFalse($handler instanceof \\SessionHandler);\n $this->assertTrue($handler instanceof NativeSessionHandler);\n } else {\n $this->assertTrue($handler instanceof \\SessionHandler);\n $this->assertTrue($handler instanceof NativeSessionHandler);\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testCamelize($id, $expected)\n {\n $this->assertEquals($expected, Container::camelize($id), sprintf('Container::camelize(\"%s\")', $id));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " static function author() {\n return \"Dave Leffler\";\n }", "label": 1, "label_name": "safe"} +{"code": "(window.webpackJsonpLHCReactAPP=window.webpackJsonpLHCReactAPP||[]).push([[2],{513:function(e,t,a){\"use strict\";a.r(t);var n=a(6),l=a.n(n),c=a(7),o=a.n(c),s=a(9),i=a.n(s),r=a(10),m=a.n(r),d=a(3),u=a.n(d),p=a(11),h=a.n(p),b=a(12),f=a.n(b),g=a(0),E=a.n(g),v=(a(20),a(25)),N=function(e){function t(e){var a;return l()(this,t),a=i()(this,m()(t).call(this,e)),f()(u()(a),\"state\",{mail:null,success:\"\",errors:null,sending:!1}),f()(u()(a),\"dismissModal\",(function(){a.props.toggle()})),a.changeFont=a.changeFont.bind(u()(a)),a.emailRef=E.a.createRef(),a}return h()(t,e),o()(t,[{key:\"changeFont\",value:function(e){this.props.changeFont(e)}},{key:\"componentDidMount\",value:function(){}},{key:\"render\",value:function(){var e=this;this.props.t;return E.a.createElement(E.a.Fragment,null,E.a.createElement(\"div\",{role:\"dialog\",id:\"dialog-content\",\"aria-modal\":\"true\",className:\"fade modal show d-block p-1 pt-0 pb-0\",tabIndex:\"-1\",style:{top:\"auto\",bottom:\"0\",height:\"auto\"}},E.a.createElement(\"div\",{className:\"modal-content radius-0 border-0\"},E.a.createElement(\"div\",{className:\"modal-body pl-2 pr-2 pt-0 pb-0\"},E.a.createElement(\"div\",{className:\"mb-0\"},E.a.createElement(\"div\",{className:\"row\"},E.a.createElement(\"div\",{className:\"col-5 mr-0 pr-1 text-center\"},E.a.createElement(\"a\",{href:\"#\",onClick:function(){return e.changeFont(!1)},className:\"d-block font-weight-bold font-button\"},\"-\",E.a.createElement(\"i\",{className:\"material-icons chat-setting-item\"},\"\uf11d\"))),E.a.createElement(\"div\",{className:\"col-5 ml-0 pl-1 pr-1 text-center\"},E.a.createElement(\"a\",{href:\"#\",onClick:function(){return e.changeFont(!0)},className:\"d-block font-weight-bold font-button\"},\"+\",E.a.createElement(\"i\",{className:\"material-icons chat-setting-item\"},\"\uf11d\"))),E.a.createElement(\"div\",{className:\"col-2 pl-1\"},E.a.createElement(\"button\",{type:\"button\",className:\"close w-100 text-success\",\"data-dismiss\":\"modal\",onClick:this.dismissModal,\"aria-label\":\"Close\"},E.a.createElement(\"span\",{\"aria-hidden\":\"true\"},\"\u2713\")))))))))}}]),t}(g.PureComponent);t.default=Object(v.b)()(N)}}]);", "label": 0, "label_name": "vulnerable"} +{"code": "\tfunction setParameter($a_name, $a_value)\n\t{\n\t\tif ($this->checkParameter($a_name, $a_value))\n\t\t{\n\t\t\t$this->parameters[$a_name] = $a_value;\n\t\t}\n\t}", "label": 1, "label_name": "safe"} +{"code": " public function setUp()\n {\n $this->request = new CaptureRequest($this->getHttpClient(), $this->getHttpRequest());\n $this->request->setTransactionReference('foo');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\"geTempDlgCreateBtn geTempDlgBtnDisabled\")}function y(fa,ca){if(null!=I){var ba=function(oa){qa.isExternal?e(qa,function(na){ja(na,oa)},ia):qa.url?mxUtils.get(TEMPLATE_PATH+\"/\"+qa.url,mxUtils.bind(this,function(na){200<=na.getStatus()&&299>=na.getStatus()?ja(na.getText(),oa):ia()})):ja(b.emptyDiagramXml,oa)},ja=function(oa,na){x||b.hideDialog(!0);f(oa,na,qa,ca)},ia=function(){A(mxResources.get(\"cannotLoad\"));ma()},ma=function(){I=qa;Ba.className=\"geTempDlgCreateBtn\";ca&&(Ka.className=\"geTempDlgOpenBtn\")},", "label": 0, "label_name": "vulnerable"} +{"code": "{type:\"vbox\",padding:0,children:[{type:\"hbox\",widths:[\"5em\"],children:[{type:\"text\",id:\"txtWidth\",requiredContent:\"table{width}\",controlStyle:\"width:5em\",label:a.lang.common.width,title:a.lang.common.cssLengthTooltip,\"default\":a.filter.check(\"table{width}\")?500>n.getSize(\"width\")?\"100%\":500:0,getValue:q,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace(\"%1\",a.lang.common.width)),onChange:function(){var a=this.getDialog().getContentElement(\"advanced\",\"advStyles\");a&&\na.updateStyle(\"width\",this.getValue())},setup:function(a){this.setValue(a.getStyle(\"width\"))},commit:k}]},{type:\"hbox\",widths:[\"5em\"],children:[{type:\"text\",id:\"txtHeight\",requiredContent:\"table{height}\",controlStyle:\"width:5em\",label:a.lang.common.height,title:a.lang.common.cssLengthTooltip,\"default\":\"\",getValue:q,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace(\"%1\",a.lang.common.height)),onChange:function(){var a=this.getDialog().getContentElement(\"advanced\",\"advStyles\");", "label": 1, "label_name": "safe"} +{"code": " public function testFilterDoesNothingForSubRequests()\n {\n $dispatcher = new EventDispatcher();\n $kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');\n $response = new Response('foo ');\n $listener = new SurrogateListener(new Esi());\n\n $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'));\n $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::SUB_REQUEST, $response);\n $dispatcher->dispatch(KernelEvents::RESPONSE, $event);\n\n $this->assertEquals('', $event->getResponse()->headers->get('Surrogate-Control'));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (voteSet *VoteSet) MakeCommit() *Commit {\n\tif voteSet.signedMsgType != tmproto.PrecommitType {\n\t\tpanic(\"Cannot MakeCommit() unless VoteSet.Type is PrecommitType\")\n\t}\n\tvoteSet.mtx.Lock()\n\tdefer voteSet.mtx.Unlock()\n\n\t// Make sure we have a 2/3 majority\n\tif voteSet.maj23 == nil {\n\t\tpanic(\"Cannot MakeCommit() unless a blockhash has +2/3\")\n\t}\n\n\t// For every validator, get the precommit\n\tcommitSigs := make([]CommitSig, len(voteSet.votes))\n\tfor i, v := range voteSet.votes {\n\t\tcommitSigs[i] = v.CommitSig()\n\t}\n\n\treturn NewCommit(voteSet.GetHeight(), voteSet.GetRound(), *voteSet.maj23, commitSigs)\n}", "label": 0, "label_name": "vulnerable"} +{"code": "Ka(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;cignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) {\n ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress);\n }\n\n if ( ! ftp_pasv($this->connection, $this->passive)) {\n throw new RuntimeException(\n 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort()\n );\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\"\"),mxUtils.bind(this,function(y){window.clearTimeout(v);q&&(200<=y.getStatus()&&299>=y.getStatus()?null!=l&&l():d({code:y.getStatus(),message:y.getStatus()}))}));EditorUi.debug(\"DrawioFileSync.fileSaved\",[this],\"diff\",g,m.length,\"bytes\",\"from\",c,\"to\",e,\"etag\",this.file.getCurrentEtag(),\"checksum\",k)}}this.file.setShadowPages(b);this.scheduleCleanup()};", "label": 1, "label_name": "safe"} +{"code": " public function toString()\n {\n // reconstruct authority\n $authority = null;\n // there is a rendering difference between a null authority\n // (http:foo-bar) and an empty string authority\n // (http:///foo-bar).\n if (!is_null($this->host)) {\n $authority = '';\n if (!is_null($this->userinfo)) {\n $authority .= $this->userinfo . '@';\n }\n $authority .= $this->host;\n if (!is_null($this->port)) {\n $authority .= ':' . $this->port;\n }\n }\n\n // Reconstruct the result\n // One might wonder about parsing quirks from browsers after\n // this reconstruction. Unfortunately, parsing behavior depends\n // on what *scheme* was employed (file:///foo is handled *very*\n // differently than http:///foo), so unfortunately we have to\n // defer to the schemes to do the right thing.\n $result = '';\n if (!is_null($this->scheme)) {\n $result .= $this->scheme . ':';\n }\n if (!is_null($authority)) {\n $result .= '//' . $authority;\n }\n $result .= $this->path;\n if (!is_null($this->query)) {\n $result .= '?' . $this->query;\n }\n if (!is_null($this->fragment)) {\n $result .= '#' . $this->fragment;\n }\n\n return $result;\n }", "label": 1, "label_name": "safe"} +{"code": " def __eq__(self, other):\n return (argparse.Namespace.__eq__(self, other) and\n self.uname == other.uname and self.lang_code == other.lang_code and\n self.timestamp == other.timestamp and self.font_config_cache == other.font_config_cache and\n self.fonts_dir == other.fonts_dir and self.max_pages == other.max_pages and\n self.save_box_tiff == other.save_box_tiff and self.overwrite == other.overwrite and\n self.linedata == other.linedata and self.run_shape_clustering == other.run_shape_clustering and\n self.extract_font_properties == other.extract_font_properties and\n self.distort_image == other.distort_image)", "label": 0, "label_name": "vulnerable"} +{"code": " public static function delete($id){\r\n $vars = array(\r\n 'table' => 'user',\r\n 'where' => array(\r\n 'id' => $id\r\n )\r\n );\r\n Db::delete($vars);\r\n\r\n $vars = array(\r\n 'table' => 'user_detail',\r\n 'where' => array(\r\n 'id' => $id\r\n )\r\n );\r\n Db::delete($vars);\r\n Hooks::run('user_sqldel_action', $vars);\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " public static function getHelpVersion($version_id) {\n global $db;\n\n return $db->selectValue('help_version', 'version', 'id=\"'.$version_id.'\"');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function(){return this.graph.connectionHandler.isEnabled()})};var ab=mxVertexHandler.prototype.redrawHandles;mxVertexHandler.prototype.redrawHandles=function(){if(null!=this.moveHandles)for(var z=0;z 0 ) {\n\t\t\t\t\t\t$template1 = preg_replace( '/\\|.*/', '', $template1 );\n\t\t\t\t\t\t$template2 = preg_replace( '/^.+\\|/', '', $template2 );\n\t\t\t\t\t}\n\t\t\t\t\t//Why the hell was defaultTemplateSuffix be passed all over the place for just fucking here? --Alexia\n\t\t\t\t\t$secPieces = LST::includeTemplate( $this->parser, $this, $s, $article, $template1, $template2, $template2 . $this->getTemplateSuffix(), $mustMatch, $mustNotMatch, $this->includePageParsed, implode( ', ', $article->mCategoryLinks ) );\n\t\t\t\t\t$secPiece[$s] = implode( isset( $this->multiSectionSeparators[$s] ) ? $this->replaceTagCount( $this->multiSectionSeparators[$s], $filteredCount ) : '', $secPieces );\n\t\t\t\t\tif ( $this->getDominantSectionCount() >= 0 && $s == $this->getDominantSectionCount() && count( $secPieces ) > 1 ) {\n\t\t\t\t\t\t$dominantPieces = $secPieces;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ( $mustMatch != '' || $mustNotMatch != '' ) && count( $secPieces ) <= 1 && $secPieces[0] == '' ) {\n\t\t\t\t\t\t$matchFailed = true; // NOTHING MATCHED\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct()\n {\n $this->options['alias'] = ''; // alias to replace root dir name\n $this->options['dirMode'] = 0755; // new dirs mode\n $this->options['fileMode'] = 0644; // new files mode\n $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)\n $this->options['rootCssClass'] = 'elfinder-navbar-root-local';\n $this->options['followSymLinks'] = true;\n $this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png'\n $this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload'\n $this->options['substituteImg'] = true; // support substitute image with dim command\n $this->options['statCorrector'] = null; // callable to correct stat data `function(&$stat, $path, $statOwner, $volumeDriveInstance){}`\n }", "label": 0, "label_name": "vulnerable"} +{"code": "ta.style.width=\"40px\";ta.style.height=\"12px\";ta.style.marginBottom=\"-2px\";ta.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\";ta.style.backgroundPosition=\"top center\";ta.style.backgroundRepeat=\"no-repeat\";ta.setAttribute(\"title\",\"Minimize\");var Na=!1,Ca=mxUtils.bind(this,function(){S.innerHTML=\"\";if(!Na){var za=function(Da,La,Ya){Da=X(\"\",Da.funct,null,La,Da,Ya);Da.style.width=\"40px\";Da.style.opacity=\"0.7\";return wa(Da,null,\"pointer\")},wa=function(Da,La,Ya){null!=La&&Da.setAttribute(\"title\",\nLa);Da.style.cursor=null!=Ya?Ya:\"default\";Da.style.margin=\"2px 0px\";S.appendChild(Da);mxUtils.br(S);return Da};wa(U.sidebar.createVertexTemplate(\"text;strokeColor=none;fillColor=none;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;\",60,30,\"Text\",mxResources.get(\"text\"),!0,!1,null,!0,!0),mxResources.get(\"text\")+\" (\"+Editor.ctrlKey+\"+Shift+X)\");wa(U.sidebar.createVertexTemplate(\"shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;fontColor=#000000;darkOpacity=0.05;fillColor=#FFF9B2;strokeColor=none;fillStyle=solid;direction=west;gradientDirection=north;gradientColor=#FFF2A1;shadow=1;size=20;pointerEvents=1;\",", "label": 0, "label_name": "vulnerable"} +{"code": "\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();\n\t\t\n\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "parseAssociate(unsigned char *buf, unsigned long pduLength,\n PRV_ASSOCIATEPDU * assoc)\n{\n OFCondition cond = EC_Normal;\n unsigned char\n type;\n unsigned long\n itemLength;\n PRV_PRESENTATIONCONTEXTITEM\n * context;\n\n (void) memset(assoc, 0, sizeof(*assoc));\n if ((assoc->presentationContextList = LST_Create()) == NULL) return EC_MemoryExhausted;\n if ((assoc->userInfo.SCUSCPRoleList = LST_Create()) == NULL) return EC_MemoryExhausted;\n\n // Check if the PDU actually is long enough for the fields we read\n if (pduLength < 2 + 2 + 16 + 16 + 32)\n return makeLengthError(\"associate PDU\", pduLength, 2 + 2 + 16 + 16 + 32);\n\n assoc->type = *buf++;\n assoc->rsv1 = *buf++;\n EXTRACT_LONG_BIG(buf, assoc->length);\n buf += 4;\n\n EXTRACT_SHORT_BIG(buf, assoc->protocol);\n buf += 2;\n pduLength -= 2;\n if ((assoc->protocol & DUL_PROTOCOL) == 0)\n {\n char buffer[256];\n sprintf(buffer, \"DUL Unsupported peer protocol %04x; expected %04x in %s\", assoc->protocol, DUL_PROTOCOL, \"parseAssociate\");\n return makeDcmnetCondition(DULC_UNSUPPORTEDPEERPROTOCOL, OF_error, buffer);\n }\n assoc->rsv2[0] = *buf++;\n pduLength--;\n assoc->rsv2[1] = *buf++;\n pduLength--;\n (void) strncpy(assoc->calledAPTitle, (char *) buf, 16);\n assoc->calledAPTitle[16] = '\\0';\n trim_trailing_spaces(assoc->calledAPTitle);\n\n buf += 16;\n pduLength -= 16;\n (void) strncpy(assoc->callingAPTitle, (char *) buf, 16);\n assoc->callingAPTitle[16] = '\\0';\n trim_trailing_spaces(assoc->callingAPTitle);\n buf += 16;\n pduLength -= 16;\n (void) memcpy(assoc->rsv3, buf, 32);\n buf += 32;\n pduLength -= 32;\n\n if (DCM_dcmnetLogger.isEnabledFor(OFLogger::DEBUG_LOG_LEVEL)) {\n const char *s;\n DCMNET_DEBUG(\"Parsing an A-ASSOCIATE PDU\");\n if (assoc->type == DUL_TYPEASSOCIATERQ)\n s = \"A-ASSOCIATE RQ\";\n else if (assoc->type == DUL_TYPEASSOCIATEAC)\n s = \"A-ASSOCIATE AC\";\n else\n s = \"Unknown: Programming bug in parseAssociate\";\n\n/* If we hit the \"Unknown type\", there is a programming bug somewhere.\n** This function is only supposed to parse A-ASSOCIATE PDUs and\n** expects its input to have been properly screened.\n*/\n DCMNET_TRACE(\"PDU type: \"\n << STD_NAMESPACE hex << ((unsigned int)assoc->type)\n << STD_NAMESPACE dec << \" (\" << s << \"), PDU Length: \" << assoc->length << OFendl\n << \"DICOM Protocol: \"\n << STD_NAMESPACE hex << assoc->protocol\n << STD_NAMESPACE dec << OFendl\n << \"Called AP Title: \" << assoc->calledAPTitle << OFendl\n << \"Calling AP Title: \" << assoc->callingAPTitle);\n }\n while ((cond.good()) && (pduLength > 0))\n {\n type = *buf;\n DCMNET_TRACE(\"Parsing remaining \" << pduLength << \" bytes of A-ASSOCIATE PDU\" << OFendl\n << \"Next item type: \"\n << STD_NAMESPACE hex << STD_NAMESPACE setfill('0') << STD_NAMESPACE setw(2) << ((unsigned int)type));\n switch (type) {\n case DUL_TYPEAPPLICATIONCONTEXT:\n cond = parseSubItem(&assoc->applicationContext,\n buf, &itemLength, pduLength);\n if (cond.good())\n {\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"Application Context item\", pduLength, itemLength);\n DCMNET_TRACE(\"Successfully parsed Application Context\");\n }\n break;\n case DUL_TYPEPRESENTATIONCONTEXTRQ:\n case DUL_TYPEPRESENTATIONCONTEXTAC:\n context = (PRV_PRESENTATIONCONTEXTITEM*)malloc(sizeof(PRV_PRESENTATIONCONTEXTITEM));\n if (context == NULL) return EC_MemoryExhausted;\n (void) memset(context, 0, sizeof(*context));\n cond = parsePresentationContext(type, context, buf, &itemLength, pduLength);\n if (cond.bad()) return cond;\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"Presentation Context item\", pduLength, itemLength);\n LST_Enqueue(&assoc->presentationContextList, (LST_NODE*)context);\n DCMNET_TRACE(\"Successfully parsed Presentation Context\");\n break;\n case DUL_TYPEUSERINFO:\n // parse user info, which can contain several sub-items like User\n // Identity Negotiation or SOP Class Extended Negotiation\n cond = parseUserInfo(&assoc->userInfo, buf, &itemLength, assoc->type, pduLength);\n if (cond.bad())\n return cond;\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"User Information item\", pduLength, itemLength);\n DCMNET_TRACE(\"Successfully parsed User Information\");\n break;\n default:\n cond = parseDummy(buf, &itemLength, pduLength);\n if (cond.bad())\n return cond;\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"unknown item type\", pduLength, itemLength);\n break;\n }\n }\n return cond;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " static function displayname() {\n return gt(\"e-Commerce Category Manager\");\n }", "label": 1, "label_name": "safe"} +{"code": " public function misc_tab( $post ) {\n\n $upgrade_link = Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link( 'http://enviragallery.com/docs/creating-first-envira-gallery/', 'adminpagemisc', 'readthedocumentation' );\n\n ?>\n
    \n

    \n \n \n \n
    \n \n \" class=\"envira-doc\" target=\"_blank\">\n \n \n or\n \n \n \n
    \n

    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n
    \n \n \n get_config( 'title', $this->get_config_default( 'title' ) ); ?>\" />\n

    \n
    \n \n \n get_config( 'slug', $this->get_config_default( 'slug' ) ); ?>\" />\n

    Unique internal gallery slug for identification and advanced gallery queries.', 'envira-gallery-lite' ); ?>

    \n
    \n \n \n \n

    \n
    \n \n \n get_config( 'rtl', $this->get_config_default( 'rtl' ) ); ?>\" get_config( 'rtl', $this->get_config_default( 'rtl' ) ), 1 ); ?> />\n \n
    \n
    \n display_inline_notice(\n 'envira_gallery_images_tab',\n __( 'Want to take your galleries further?', 'envira-gallery-lite' ),\n __( '

    By upgrading to Envira Gallery Pro, you can get access to numerous other features, including:

    \n

    Bonus: Envira Lite users get a discount code for 20% off regular price.

    ', 'envira-gallery-lite' ),\n 'warning',\n __( 'Click here to Upgrade', 'envira-gallery-lite' ),\n Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link( false, 'adminpagemisc', 'clickheretoupgradebutton' ),\n false\n );\n\n\n\n }", "label": 0, "label_name": "vulnerable"} +{"code": "null!=this.linkHint&&(this.linkHint.style.visibility=\"\")};var Za=mxEdgeHandler.prototype.destroy;mxEdgeHandler.prototype.destroy=function(){Za.apply(this,arguments);null!=this.linkHint&&(this.linkHint.parentNode.removeChild(this.linkHint),this.linkHint=null);null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getSelectionModel().removeListener(this.changeHandler),this.changeHandler=null)}}();(function(){function b(c,l,x){mxShape.call(this);this.line=c;this.stroke=l;this.strokewidth=null!=x?x:1;this.updateBoundsFromLine()}function e(){mxSwimlane.call(this)}function k(){mxSwimlane.call(this)}function n(){mxCylinder.call(this)}function D(){mxCylinder.call(this)}function t(){mxActor.call(this)}function F(){mxCylinder.call(this)}function d(){mxCylinder.call(this)}function f(){mxCylinder.call(this)}function g(){mxCylinder.call(this)}function m(){mxShape.call(this)}function q(){mxShape.call(this)}", "label": 0, "label_name": "vulnerable"} +{"code": "this.spacing=0}function Ca(){mxArrowConnector.call(this);this.spacing=0}function Qa(){mxActor.call(this)}function Ta(){mxRectangleShape.call(this)}function Ka(){mxActor.call(this)}function bb(){mxActor.call(this)}function Ua(){mxActor.call(this)}function $a(){mxActor.call(this)}function z(){mxActor.call(this)}function L(){mxActor.call(this)}function M(){mxActor.call(this)}function T(){mxActor.call(this)}function ca(){mxActor.call(this)}function ia(){mxActor.call(this)}function ma(){mxEllipse.call(this)}", "label": 1, "label_name": "safe"} +{"code": "def get_cc_columns(filter_config_custom_read=False):\n tmpcc = calibre_db.session.query(db.Custom_Columns)\\\n .filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n cc = []\n r = None\n if config.config_columns_to_ignore:\n r = re.compile(config.config_columns_to_ignore)\n\n for col in tmpcc:\n if filter_config_custom_read and config.config_read_column and config.config_read_column == col.id:\n continue\n if r and r.match(col.name):\n continue\n cc.append(col)\n\n return cc", "label": 0, "label_name": "vulnerable"} +{"code": "parsegid(const char *s, gid_t *gid)\n{\n\tstruct group *gr;\n\tconst char *errstr;\n\n\tif ((gr = getgrnam(s)) != NULL) {\n\t\t*gid = gr->gr_gid;\n\t\treturn 0;\n\t}\n\t#if !defined(__linux__) && !defined(__NetBSD__)\n\t*gid = strtonum(s, 0, GID_MAX, &errstr);\n\t#else\n\tsscanf(s, \"%d\", gid);\n\t#endif\n\tif (errstr)\n\t\treturn -1;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int whereIndexExprTransColumn(Walker *p, Expr *pExpr){\n if( pExpr->op==TK_COLUMN ){\n IdxExprTrans *pX = p->u.pIdxTrans;\n if( pExpr->iTable==pX->iTabCur && pExpr->iColumn==pX->iTabCol ){\n assert( pExpr->y.pTab!=0 );\n pExpr->affExpr = sqlite3TableColumnAffinity(pExpr->y.pTab,pExpr->iColumn);\n pExpr->iTable = pX->iIdxCur;\n pExpr->iColumn = pX->iIdxCol;\n pExpr->y.pTab = 0;\n }\n }\n return WRC_Continue;\n}", "label": 1, "label_name": "safe"} +{"code": "function display_error_block() {\n if (!empty($_SESSION['error_msg'])) {\n echo '\n
    \n \n
    \n

    '. htmlentities($_SESSION['error_msg']) .'

    \n
    \n
    '.\"\\n\";\n unset($_SESSION['error_msg']);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "func (f *Fosite) WriteRevocationResponse(rw http.ResponseWriter, err error) {\n\trw.Header().Set(\"Cache-Control\", \"no-store\")\n\trw.Header().Set(\"Pragma\", \"no-cache\")\n\n\tif err == nil {\n\t\trw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\n\tif errors.Is(err, ErrInvalidRequest) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\n\t\tjs, err := json.Marshal(ErrInvalidRequest)\n\t\tif err != nil {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"error\": \"%s\"}`, err.Error()), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(ErrInvalidRequest.Code)\n\t\t_, _ = rw.Write(js)\n\t} else if errors.Is(err, ErrInvalidClient) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\n\t\tjs, err := json.Marshal(ErrInvalidClient)\n\t\tif err != nil {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"error\": \"%s\"}`, err.Error()), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(ErrInvalidClient.Code)\n\t\t_, _ = rw.Write(js)\n\t} else {\n\t\t// 200 OK\n\t\trw.WriteHeader(http.StatusOK)\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "\t\t\t$rest = $count - ( floor( $nsize ) * floor( $iGroup ) );\n\n\t\t\tif ( $rest > 0 ) {\n\t\t\t\t$nsize += 1;\n\t\t\t}\n\n\t\t\t$output .= \"{|\" . $rowColFormat . \"\\n|\\n\";\n\n\t\t\tfor ( $g = 0; $g < $iGroup; $g++ ) {\n\t\t\t\t$output .= $lister->formatList( $articles, $nstart, (int)$nsize );\n\n\t\t\t\tif ( $columns != 1 ) {\n\t\t\t\t\t$output .= \"\\n|valign=top|\\n\";\n\t\t\t\t} else {\n\t\t\t\t\t$output .= \"\\n|-\\n|\\n\";\n\t\t\t\t}\n\n\t\t\t\t$nstart += $nsize;\n\n\t\t\t\tif ( $nstart + $nsize > $count ) {\n\t\t\t\t\t$nsize = $count - $nstart;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$output .= \"\\n|}\\n\";\n\t\t} elseif ( $rowSize > 0 ) {", "label": 1, "label_name": "safe"} +{"code": " def ajax_delete_mails\n Log.add_info(request, params.inspect)\n\n folder_id = params[:id]\n mail_account_id = params[:mail_account_id]\n\n unless params[:check_mail].blank?\n mail_folder = MailFolder.find(folder_id)\n trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRASH)\n\n count = 0\n params[:check_mail].each do |email_id, value|\n next if value != '1'\n\n email = Email.find_by_id(email_id)\n next if email.nil? or (email.user_id != @login_user.id)\n\n if trash_folder.nil? \\\n or folder_id == trash_folder.id.to_s \\\n or mail_folder.get_parents(false).include?(trash_folder.id.to_s)\n email.destroy\n flash[:notice] ||= t('msg.delete_success')\n else\n begin\n email.update_attribute(:mail_folder_id, trash_folder.id)\n flash[:notice] ||= t('msg.moved_to_trash')\n rescue => evar\n Log.add_error(request, evar)\n email.destroy\n flash[:notice] ||= t('msg.delete_success')\n end\n end\n\n count += 1\n end\n end\n\n get_mails\n end", "label": 0, "label_name": "vulnerable"} +{"code": " $contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', null, 'primary', null, 'btn-danger xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('reviews.php', 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id), null, null, 'btn-light')];", "label": 0, "label_name": "vulnerable"} +{"code": " public function disable()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $swimlane_id = $this->request->getIntegerParam('swimlane_id');\n\n if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n } else {\n $this->flash->failure(t('Unable to update this swimlane.'));\n }\n\n $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "Ka(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if (j)if (d!==k)g(j[d],d);else{c=0;for(f=j.length;ctop_frame;\n frame->retval = retval;\n\n if (njs_function_object_type(vm, frame->function)\n == NJS_OBJ_TYPE_ASYNC_FUNCTION)\n {\n return njs_async_function_frame_invoke(vm, retval);\n }\n\n if (frame->native) {\n return njs_function_native_call(vm);\n\n } else {\n return njs_function_lambda_call(vm, NULL, NULL);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "size_t FdInStream::readWithTimeoutOrCallback(void* buf, size_t len, bool wait)\n{\n struct timeval before, after;\n if (timing)\n gettimeofday(&before, 0);\n\n int n;\n while (true) {\n do {\n fd_set fds;\n struct timeval tv;\n struct timeval* tvp = &tv;\n\n if (!wait) {\n tv.tv_sec = tv.tv_usec = 0;\n } else if (timeoutms != -1) {\n tv.tv_sec = timeoutms / 1000;\n tv.tv_usec = (timeoutms % 1000) * 1000;\n } else {\n tvp = 0;\n }\n\n FD_ZERO(&fds);\n FD_SET(fd, &fds);\n n = select(fd+1, &fds, 0, 0, tvp);\n } while (n < 0 && errno == EINTR);\n\n if (n > 0) break;\n if (n < 0) throw SystemException(\"select\",errno);\n if (!wait) return 0;\n if (!blockCallback) throw TimedOut();\n\n blockCallback->blockCallback();\n }\n\n do {\n n = ::recv(fd, (char*)buf, len, 0);\n } while (n < 0 && errno == EINTR);\n\n if (n < 0) throw SystemException(\"read\",errno);\n if (n == 0) throw EndOfStream();\n\n if (timing) {\n gettimeofday(&after, 0);\n int newTimeWaited = ((after.tv_sec - before.tv_sec) * 10000 +\n (after.tv_usec - before.tv_usec) / 100);\n int newKbits = n * 8 / 1000;\n\n // limit rate to between 10kbit/s and 40Mbit/s\n\n if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000;\n if (newTimeWaited < newKbits/4) newTimeWaited = newKbits/4;\n\n timeWaitedIn100us += newTimeWaited;\n timedKbits += newKbits;\n }\n\n return n;\n}", "label": 1, "label_name": "safe"} +{"code": "\"keydown\",mxUtils.bind(this,function(N){mxEvent.isConsumed(N)||((mxEvent.isControlDown(N)||mxClient.IS_MAC&&mxEvent.isMetaDown(N))&&13==N.keyCode?(I.click(),mxEvent.consume(N)):27==N.keyCode&&(u.click(),mxEvent.consume(N)))}));I.focus();I.className=\"geCommentEditBtn gePrimaryBtn\";ta.appendChild(I);U.insertBefore(ta,R);ia.style.display=\"none\";R.style.display=\"none\";la.focus()}function f(ja,U){U.innerHTML=\"\";ja=new Date(ja.modifiedDate);var J=b.timeSince(ja);null==J&&(J=mxResources.get(\"lessThanAMinute\"));\nmxUtils.write(U,mxResources.get(\"timeAgo\",[J],\"{1} ago\"));U.setAttribute(\"title\",ja.toLocaleDateString()+\" \"+ja.toLocaleTimeString())}function g(ja){var U=document.createElement(\"img\");U.className=\"geCommentBusyImg\";U.src=IMAGE_PATH+\"/spin.gif\";ja.appendChild(U);ja.busyImg=U}function m(ja){ja.style.border=\"1px solid red\";ja.removeChild(ja.busyImg)}function q(ja){ja.style.border=\"\";ja.removeChild(ja.busyImg)}function y(ja,U,J,V,P){function R(T,Q,Z){var na=document.createElement(\"li\");na.className=", "label": 0, "label_name": "vulnerable"} +{"code": "break}x.push(f+=1)}return x},d.prototype.setData=function(a){var b;return this.data=a,this.values=function(){var a,c,d,e;for(d=this.data,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(parseFloat(b.value));return e}.call(this),this.redraw()},d.prototype.click=function(a){return this.fire(\"click\",a,this.data[a])},d.prototype.select=function(a){var b,c,d,e,f,g;for(g=this.segments,e=0,f=g.length;f>e;e++)c=g[e],c.deselect();return d=this.segments[a],d.select(),b=this.data[a],this.setLabels(b.label,this.options.formatter(b.value,b))},d.prototype.setLabels=function(a,b){var c,d,e,f,g,h,i,j;return c=2*(Math.min(this.el.width()/2,this.el.height()/2)-10)/3,f=1.8*c,e=c/2,d=c/3,this.text1.attr({text:a,transform:\"\"}),g=this.text1.getBBox(),h=Math.min(f/g.width,e/g.height),this.text1.attr({transform:\"S\"+h+\",\"+h+\",\"+(g.x+g.width/2)+\",\"+(g.y+g.height)}),this.text2.attr({text:b,transform:\"\"}),i=this.text2.getBBox(),j=Math.min(f/i.width,d/i.height),this.text2.attr({transform:\"S\"+j+\",\"+j+\",\"+(i.x+i.width/2)+\",\"+i.y})},d.prototype.drawEmptyDonutLabel=function(a,b,c,d,e){var f;return f=this.raphael.text(a,b,\"\").attr(\"font-size\",d).attr(\"fill\",c),null!=e&&f.attr(\"font-weight\",e),f},d.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},d}(b.EventEmitter),b.DonutSegment=function(a){function b(a,b,c,d,e,g,h,i,j,k){this.cx=a,this.cy=b,this.inner=c,this.outer=d,this.color=h,this.backgroundColor=i,this.index=j,this.raphael=k,this.deselect=f(this.deselect,this),this.select=f(this.select,this),this.sin_p0=Math.sin(e),this.cos_p0=Math.cos(e),this.sin_p1=Math.sin(g),this.cos_p1=Math.cos(g),this.is_long=g-e>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(b,a),b.prototype.calcArcPoints=function(a){return[this.cx+a*this.sin_p0,this.cy+a*this.cos_p0,this.cx+a*this.sin_p1,this.cy+a*this.cos_p1]},b.prototype.calcSegment=function(a,b){var c,d,e,f,g,h,i,j,k,l;return k=this.calcArcPoints(a),c=k[0],e=k[1],d=k[2],f=k[3],l=this.calcArcPoints(b),g=l[0],i=l[1],h=l[2],j=l[3],\"M\"+c+\",\"+e+(\"A\"+a+\",\"+a+\",0,\"+this.is_long+\",0,\"+d+\",\"+f)+(\"L\"+h+\",\"+j)+(\"A\"+b+\",\"+b+\",0,\"+this.is_long+\",1,\"+g+\",\"+i)+\"Z\"},b.prototype.calcArc=function(a){var b,c,d,e,f;return f=this.calcArcPoints(a),b=f[0],d=f[1],c=f[2],e=f[3],\"M\"+b+\",\"+d+(\"A\"+a+\",\"+a+\",0,\"+this.is_long+\",0,\"+c+\",\"+e)},b.prototype.render=function(){var a=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return a.fire(\"hover\",a.index)},function(){return a.fire(\"click\",a.index)})},b.prototype.drawDonutArc=function(a,b){return this.raphael.path(a).attr({stroke:b,\"stroke-width\":2,opacity:0})},b.prototype.drawDonutSegment=function(a,b,c,d,e){return this.raphael.path(a).attr({fill:b,stroke:c,\"stroke-width\":3}).hover(d).click(e)},b.prototype.select=function(){return this.selected?void 0:(this.seg.animate({path:this.selectedPath},150,\"<>\"),this.arc.animate({opacity:1},150,\"<>\"),this.selected=!0)},b.prototype.deselect=function(){return this.selected?(this.seg.animate({path:this.path},150,\"<>\"),this.arc.animate({opacity:0},150,\"<>\"),this.selected=!1):void 0},b}(b.EventEmitter)}).call(this);", "label": 0, "label_name": "vulnerable"} +{"code": "\tvirtual size_t\tRead(void *buffer, size_t size, size_t count, void* limit_start = NULL, void* limit_end = NULL)\r\n\t{\r\n\t\tif (!m_fp) return 0;\r\n\t\tclamp_buffer(buffer, size, limit_start, limit_end);\r\n\t\treturn fread(buffer, size, count, m_fp);\r\n\t}\r", "label": 1, "label_name": "safe"} +{"code": "bool SSecurityTLS::processMsg(SConnection *sc)\n{\n rdr::InStream* is = sc->getInStream();\n rdr::OutStream* os = sc->getOutStream();\n\n vlog.debug(\"Process security message (session %p)\", session);\n\n if (!session) {\n initGlobal();\n\n if (gnutls_init(&session, GNUTLS_SERVER) != GNUTLS_E_SUCCESS)\n throw AuthFailureException(\"gnutls_init failed\");\n\n if (gnutls_set_default_priority(session) != GNUTLS_E_SUCCESS)\n throw AuthFailureException(\"gnutls_set_default_priority failed\");\n\n try {\n setParams(session);\n }\n catch(...) {\n os->writeU8(0);\n throw;\n }\n\n os->writeU8(1);\n os->flush();\n }\n\n rdr::TLSInStream *tlsis = new rdr::TLSInStream(is, session);\n rdr::TLSOutStream *tlsos = new rdr::TLSOutStream(os, session);\n\n int err;\n err = gnutls_handshake(session);\n if (err != GNUTLS_E_SUCCESS) {\n delete tlsis;\n delete tlsos;\n\n if (!gnutls_error_is_fatal(err)) {\n vlog.debug(\"Deferring completion of TLS handshake: %s\", gnutls_strerror(err));\n return false;\n }\n vlog.error(\"TLS Handshake failed: %s\", gnutls_strerror (err));\n shutdown();\n throw AuthFailureException(\"TLS Handshake failed\");\n }\n\n vlog.debug(\"Handshake completed\");\n\n sc->setStreams(fis = tlsis, fos = tlsos);\n\n return true;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " authHandler = function authHandler(authsLeft, partial, cb) {\n if (authPos === authsAllowed.length)\n return false;\n return authsAllowed[authPos++];\n };", "label": 0, "label_name": "vulnerable"} +{"code": "static void process_tree(struct rev_info *revs,\n\t\t\t struct tree *tree,\n\t\t\t show_object_fn show,\n\t\t\t struct strbuf *base,\n\t\t\t const char *name,\n\t\t\t void *cb_data)\n{\n\tstruct object *obj = &tree->object;\n\tstruct tree_desc desc;\n\tstruct name_entry entry;\n\tenum interesting match = revs->diffopt.pathspec.nr == 0 ?\n\t\tall_entries_interesting: entry_not_interesting;\n\tint baselen = base->len;\n\n\tif (!revs->tree_objects)\n\t\treturn;\n\tif (!obj)\n\t\tdie(\"bad tree object\");\n\tif (obj->flags & (UNINTERESTING | SEEN))\n\t\treturn;\n\tif (parse_tree_gently(tree, revs->ignore_missing_links) < 0) {\n\t\tif (revs->ignore_missing_links)\n\t\t\treturn;\n\t\tdie(\"bad tree object %s\", oid_to_hex(&obj->oid));\n\t}\n\n\tobj->flags |= SEEN;\n\tshow(obj, base, name, cb_data);\n\n\tstrbuf_addstr(base, name);\n\tif (base->len)\n\t\tstrbuf_addch(base, '/');\n\n\tinit_tree_desc(&desc, tree->buffer, tree->size);\n\n\twhile (tree_entry(&desc, &entry)) {\n\t\tif (match != all_entries_interesting) {\n\t\t\tmatch = tree_entry_interesting(&entry, base, 0,\n\t\t\t\t\t\t &revs->diffopt.pathspec);\n\t\t\tif (match == all_entries_not_interesting)\n\t\t\t\tbreak;\n\t\t\tif (match == entry_not_interesting)\n\t\t\t\tcontinue;\n\t\t}\n\n\t\tif (S_ISDIR(entry.mode))\n\t\t\tprocess_tree(revs,\n\t\t\t\t lookup_tree(entry.sha1),\n\t\t\t\t show, base, entry.path,\n\t\t\t\t cb_data);\n\t\telse if (S_ISGITLINK(entry.mode))\n\t\t\tprocess_gitlink(revs, entry.sha1,\n\t\t\t\t\tshow, base, entry.path,\n\t\t\t\t\tcb_data);\n\t\telse\n\t\t\tprocess_blob(revs,\n\t\t\t\t lookup_blob(entry.sha1),\n\t\t\t\t show, base, entry.path,\n\t\t\t\t cb_data);\n\t}\n\tstrbuf_setlen(base, baselen);\n\tfree_tree_buffer(tree);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " replaceInValue: function (value, context) {\n return interpreter.replace(value, context, parseContext);\n },", "label": 1, "label_name": "safe"} +{"code": "int key_update(key_ref_t key_ref, const void *payload, size_t plen)\n{\n\tstruct key_preparsed_payload prep;\n\tstruct key *key = key_ref_to_ptr(key_ref);\n\tint ret;\n\n\tkey_check(key);\n\n\t/* the key must be writable */\n\tret = key_permission(key_ref, KEY_NEED_WRITE);\n\tif (ret < 0)\n\t\treturn ret;\n\n\t/* attempt to update it if supported */\n\tif (!key->type->update)\n\t\treturn -EOPNOTSUPP;\n\n\tmemset(&prep, 0, sizeof(prep));\n\tprep.data = payload;\n\tprep.datalen = plen;\n\tprep.quotalen = key->type->def_datalen;\n\tprep.expiry = TIME_T_MAX;\n\tif (key->type->preparse) {\n\t\tret = key->type->preparse(&prep);\n\t\tif (ret < 0)\n\t\t\tgoto error;\n\t}\n\n\tdown_write(&key->sem);\n\n\tret = key->type->update(key, &prep);\n\tif (ret == 0)\n\t\t/* Updating a negative key positively instantiates it */\n\t\tmark_key_instantiated(key, 0);\n\n\tup_write(&key->sem);\n\nerror:\n\tif (key->type->preparse)\n\t\tkey->type->free_preparse(&prep);\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "def list_books():\n off = int(request.args.get(\"offset\") or 0)\n limit = int(request.args.get(\"limit\") or config.config_books_per_page)\n search = request.args.get(\"search\")\n sort_param = request.args.get(\"sort\", \"id\")\n order = request.args.get(\"order\", \"\").lower()\n state = None\n join = tuple()\n\n if sort_param == \"state\":\n state = json.loads(request.args.get(\"state\", \"[]\"))\n elif sort_param == \"tags\":\n order = [db.Tags.name.asc()] if order == \"asc\" else [db.Tags.name.desc()]\n join = db.books_tags_link, db.Books.id == db.books_tags_link.c.book, db.Tags\n elif sort_param == \"series\":\n order = [db.Series.name.asc()] if order == \"asc\" else [db.Series.name.desc()]\n join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series\n elif sort_param == \"publishers\":\n order = [db.Publishers.name.asc()] if order == \"asc\" else [db.Publishers.name.desc()]\n join = db.books_publishers_link, db.Books.id == db.books_publishers_link.c.book, db.Publishers\n elif sort_param == \"authors\":\n order = [db.Authors.name.asc(), db.Series.name, db.Books.series_index] if order == \"asc\" \\\n else [db.Authors.name.desc(), db.Series.name.desc(), db.Books.series_index.desc()]\n join = db.books_authors_link, db.Books.id == db.books_authors_link.c.book, db.Authors, \\\n db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series\n elif sort_param == \"languages\":\n order = [db.Languages.lang_code.asc()] if order == \"asc\" else [db.Languages.lang_code.desc()]\n join = db.books_languages_link, db.Books.id == db.books_languages_link.c.book, db.Languages\n elif order and sort_param in [\"sort\", \"title\", \"authors_sort\", \"series_index\"]:\n order = [text(sort_param + \" \" + order)]\n elif not state:\n order = [db.Books.timestamp.desc()]\n\n total_count = filtered_count = calibre_db.session.query(db.Books).filter(calibre_db.common_filters(allow_show_archived=True)).count()\n if state is not None:\n if search:\n books = calibre_db.search_query(search, config.config_read_column).all()\n filtered_count = len(books)\n else:\n if not config.config_read_column:\n books = (calibre_db.session.query(db.Books, ub.ReadBook.read_status, ub.ArchivedBook.is_archived)\n .select_from(db.Books)\n .outerjoin(ub.ReadBook,\n and_(ub.ReadBook.user_id == int(current_user.id),\n ub.ReadBook.book_id == db.Books.id)))\n else:\n read_column = \"\"\n try:\n read_column = db.cc_classes[config.config_read_column]\n books = (calibre_db.session.query(db.Books, read_column.value, ub.ArchivedBook.is_archived)\n .select_from(db.Books)\n .outerjoin(read_column, read_column.book == db.Books.id))\n except (KeyError, AttributeError):\n log.error(\"Custom Column No.%d is not existing in calibre database\", read_column)\n # Skip linking read column and return None instead of read status\n books = calibre_db.session.query(db.Books, None, ub.ArchivedBook.is_archived)\n books = (books.outerjoin(ub.ArchivedBook, and_(db.Books.id == ub.ArchivedBook.book_id,\n int(current_user.id) == ub.ArchivedBook.user_id))\n .filter(calibre_db.common_filters(allow_show_archived=True)).all())\n entries = calibre_db.get_checkbox_sorted(books, state, off, limit, order, True)\n elif search:\n entries, filtered_count, __ = calibre_db.get_search_results(search,\n off,\n [order,''],\n limit,\n True,\n config.config_read_column,\n *join)\n else:\n entries, __, __ = calibre_db.fill_indexpage_with_archived_books((int(off) / (int(limit)) + 1),\n db.Books,\n limit,\n True,\n order,\n True,\n True,\n config.config_read_column,\n *join)\n\n result = list()\n for entry in entries:\n val = entry[0]\n val.read_status = entry[1] == ub.ReadBook.STATUS_FINISHED\n val.is_archived = entry[2] is True\n for index in range(0, len(val.languages)):\n val.languages[index].language_name = isoLanguages.get_language_name(get_locale(), val.languages[\n index].lang_code)\n result.append(val)\n\n table_entries = {'totalNotFiltered': total_count, 'total': filtered_count, \"rows\": result}\n js_list = json.dumps(table_entries, cls=db.AlchemyEncoder)\n\n response = make_response(js_list)\n response.headers[\"Content-Type\"] = \"application/json; charset=utf-8\"\n return response", "label": 0, "label_name": "vulnerable"} +{"code": "\"25px\";btn.className=\"geColorBtn\";return btn}function Y(za,ta,ka,pa,sa,ya,va){if(0(TokLinuxAfFamily(af));\n input.PushByReference(Extent{reinterpret_cast(src), src_size});\n input.Push(size);\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetNtopHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2);\n\n auto result = output.next();\n int klinux_errno = output.next();\n if (result.empty()) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return nullptr;\n }\n\n memcpy(\n dst, result.data(),\n std::min({static_cast(size), static_cast(result.size()),\n static_cast(INET6_ADDRSTRLEN)}));\n return dst;\n}", "label": 1, "label_name": "safe"} +{"code": " $this->emitToken(array(\n 'type' => self::CHARACTR,\n 'data' => 'char--;\n $this->state = 'data';\n\n } else {\n /* Parse error. Switch to the bogus comment state. */\n $this->state = 'bogusComment';\n }\n }", "label": 1, "label_name": "safe"} +{"code": "\tpublic function load_template()\r\n\t{\r\n\t\tglobal $DB;\r\n\t\tglobal $website;\r\n\t\t\r\n\t\t$template = new template();\t\r\n\t\t\r\n\t\tif(\t$this->association == 'free' ||\r\n\t\t\t($this->association == 'category' && $this->embedding == '0'))\r\n\t\t{\r\n\t\t\t$template->load($this->template);\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$category_template = $DB->query_single(\r\n 'template',\r\n 'nv_structure',\r\n ' id = '.intval($this->category).' AND website = '.intval($website->id)\r\n );\r\n\t\t\t$template->load($category_template);\r\n\t\t}\r\n\t\t\r\n\t\treturn $template;\r\n\t}\r", "label": 1, "label_name": "safe"} +{"code": " $obj = new $modelname(intval($id));\n $obj->rank = $rank;\n $obj->save(false, true);\n $rank++;\n }", "label": 1, "label_name": "safe"} +{"code": "int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t struct msghdr *msg, size_t len,\n\t\t int noblock, int flags, int *addr_len)\n{\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct inet_sock *inet = inet_sk(sk);\n\tstruct sk_buff *skb;\n\tunsigned int ulen, copied;\n\tint peeked, off = 0;\n\tint err;\n\tint is_udplite = IS_UDPLITE(sk);\n\tint is_udp4;\n\tbool slow;\n\n\tif (flags & MSG_ERRQUEUE)\n\t\treturn ipv6_recv_error(sk, msg, len);\n\n\tif (np->rxpmtu && np->rxopt.bits.rxpmtu)\n\t\treturn ipv6_recv_rxpmtu(sk, msg, len);\n\ntry_again:\n\tskb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0),\n\t\t\t\t &peeked, &off, &err);\n\tif (!skb)\n\t\tgoto out;\n\n\tulen = skb->len - sizeof(struct udphdr);\n\tcopied = len;\n\tif (copied > ulen)\n\t\tcopied = ulen;\n\telse if (copied < ulen)\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\n\tis_udp4 = (skb->protocol == htons(ETH_P_IP));\n\n\t/*\n\t * If checksum is needed at all, try to do it while copying the\n\t * data. If the data is truncated, or if we only want a partial\n\t * coverage checksum (UDP-Lite), do it before the copy.\n\t */\n\n\tif (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {\n\t\tif (udp_lib_checksum_complete(skb))\n\t\t\tgoto csum_copy_err;\n\t}\n\n\tif (skb_csum_unnecessary(skb))\n\t\terr = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),\n\t\t\t\t\t msg->msg_iov, copied);\n\telse {\n\t\terr = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);\n\t\tif (err == -EINVAL)\n\t\t\tgoto csum_copy_err;\n\t}\n\tif (unlikely(err)) {\n\t\ttrace_kfree_skb(skb, udpv6_recvmsg);\n\t\tif (!peeked) {\n\t\t\tatomic_inc(&sk->sk_drops);\n\t\t\tif (is_udp4)\n\t\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t\telse\n\t\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t}\n\t\tgoto out_free;\n\t}\n\tif (!peeked) {\n\t\tif (is_udp4)\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t\telse\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t}\n\n\tsock_recv_ts_and_drops(msg, sk, skb);\n\n\t/* Copy the address. */\n\tif (msg->msg_name) {\n\t\tstruct sockaddr_in6 *sin6;\n\n\t\tsin6 = (struct sockaddr_in6 *) msg->msg_name;\n\t\tsin6->sin6_family = AF_INET6;\n\t\tsin6->sin6_port = udp_hdr(skb)->source;\n\t\tsin6->sin6_flowinfo = 0;\n\n\t\tif (is_udp4) {\n\t\t\tipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,\n\t\t\t\t\t &sin6->sin6_addr);\n\t\t\tsin6->sin6_scope_id = 0;\n\t\t} else {\n\t\t\tsin6->sin6_addr = ipv6_hdr(skb)->saddr;\n\t\t\tsin6->sin6_scope_id =\n\t\t\t\tipv6_iface_scope_id(&sin6->sin6_addr,\n\t\t\t\t\t\t IP6CB(skb)->iif);\n\t\t}\n\t\t*addr_len = sizeof(*sin6);\n\t}\n\tif (is_udp4) {\n\t\tif (inet->cmsg_flags)\n\t\t\tip_cmsg_recv(msg, skb);\n\t} else {\n\t\tif (np->rxopt.all)\n\t\t\tip6_datagram_recv_ctl(sk, msg, skb);\n\t}\n\n\terr = copied;\n\tif (flags & MSG_TRUNC)\n\t\terr = ulen;\n\nout_free:\n\tskb_free_datagram_locked(sk, skb);\nout:\n\treturn err;\n\ncsum_copy_err:\n\tslow = lock_sock_fast(sk);\n\tif (!skb_kill_datagram(sk, skb, flags)) {\n\t\tif (is_udp4) {\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t} else {\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t}\n\t}\n\tunlock_sock_fast(sk, slow);\n\n\tif (noblock)\n\t\treturn -EAGAIN;\n\n\t/* starting over for a new packet */\n\tmsg->msg_flags &= ~MSG_TRUNC;\n\tgoto try_again;\n}", "label": 1, "label_name": "safe"} +{"code": "1)},setStartBefore:function(a){this.setStart(a.getParent(),a.getIndex())},setEndAfter:function(a){this.setEnd(a.getParent(),a.getIndex()+1)},setEndBefore:function(a){this.setEnd(a.getParent(),a.getIndex())},setStartAt:function(a,b){switch(b){case CKEDITOR.POSITION_AFTER_START:this.setStart(a,0);break;case CKEDITOR.POSITION_BEFORE_END:a.type==CKEDITOR.NODE_TEXT?this.setStart(a,a.getLength()):this.setStart(a,a.getChildCount());break;case CKEDITOR.POSITION_BEFORE_START:this.setStartBefore(a);break;case CKEDITOR.POSITION_AFTER_END:this.setStartAfter(a)}c(this)},", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus LogicalImpl(TfLiteContext* context, TfLiteNode* node,\n bool (*func)(bool, bool)) {\n OpData* data = reinterpret_cast(node->user_data);\n\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor1, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor2, &input2));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n if (data->requires_broadcast) {\n reference_ops::BroadcastBinaryFunction4DSlow(\n GetTensorShape(input1), GetTensorData(input1),\n GetTensorShape(input2), GetTensorData(input2),\n GetTensorShape(output), GetTensorData(output), func);\n } else {\n reference_ops::BinaryFunction(\n GetTensorShape(input1), GetTensorData(input1),\n GetTensorShape(input2), GetTensorData(input2),\n GetTensorShape(output), GetTensorData(output), func);\n }\n\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " it \"prints the failure message on error\" do\n expect {\n subject.call ['', '/bin/false', 'failure message!']\n }.to raise_error Puppet::ParseError, /failure message!/\n end", "label": 0, "label_name": "vulnerable"} +{"code": " private static void validateName(String name) {\n if (!RE_NAME.matcher(name).matches()) {\n throw new IllegalArgumentException(String.format(\"Illegal character in name: '%s'.\", name));\n }\n }", "label": 1, "label_name": "safe"} +{"code": " def read(t: CompoundNBT): Unit\n def write(t: CompoundNBT): Unit\n def handleConfigPacket(m: MsgOutputCfgPayload): Unit\n}\n\nclass OutputConfigInvalid extends OutputConfig {\n override val id: String = \"invalid\"\n def read(t: CompoundNBT): Unit = {}", "label": 0, "label_name": "vulnerable"} +{"code": " public function setup($config)\n {\n $bdo = $this->addElement(\n 'bdo',\n 'Inline',\n 'Inline',\n array('Core', 'Lang'),\n array(\n 'dir' => 'Enum#ltr,rtl', // required\n // The Abstract Module specification has the attribute\n // inclusions wrong for bdo: bdo allows Lang\n )\n );\n $bdo->attr_transform_post[] = new HTMLPurifier_AttrTransform_BdoDir();\n\n $this->attr_collections['I18N']['dir'] = 'Enum#ltr,rtl';\n }", "label": 1, "label_name": "safe"} +{"code": "\tprivate void doRequest(String method, HttpServletRequest request,\n\t\t\tHttpServletResponse response) throws ServletException, IOException\n\t{\n\t\ttry\n\t\t{\n\t\t\tint serviceId = 0;\n\t\t\tString proxyPath = \"\";\n\t\t\tString queryString = \"\";\n\t\t\t\n\t\t\ttry \n\t\t\t{\n\t\t\t\tif (request.getQueryString() != null)\n\t\t\t\t{\n\t\t\t\t\tqueryString = \"?\" + request.getQueryString(); \t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (request.getPathInfo() != null) // /{serviceId}/*\n\t\t\t\t{\n\t\t\t\t\tString[] pathParts = request.getPathInfo().split(\"/\");\n\t\n\t\t\t\t\tif (pathParts.length > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tserviceId = Integer.parseInt(pathParts[1]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (pathParts.length > 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tproxyPath = String.join(\"/\", Arrays.copyOfRange(pathParts, 2, pathParts.length));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (serviceId < 0 || serviceId > supportedServices.length)\n\t\t\t\t\t{\n\t\t\t\t\t\tserviceId = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (Exception e) \n\t\t\t{\n\t\t\t\t// Ignore and use 0\n\t\t\t\tserviceId = 0;\n\t\t\t}\n\t\t\t\n\t\t\tString exportUrl = System.getenv(supportedServices[serviceId]);\n\t\t\t\n\t\t\tif (exportUrl == null || exportUrl.isEmpty())\n\t\t\t{\n\t\t\t\tthrow new Exception(supportedServices[serviceId] + \" not set\");\n\t\t\t}\n\t\t\t\n\t\t\tURL url = new URL(exportUrl + proxyPath + queryString);\n\t\t\tHttpURLConnection con = (HttpURLConnection) url.openConnection();\n\t\t\t\n\t\t\tcon.setRequestMethod(method);\n\t\t\t\n\t\t\t//Copy request headers to export server\n\t\t\tEnumeration headerNames = request.getHeaderNames();\n\t\t\t \n\t while (headerNames.hasMoreElements()) \n\t {\n\t String headerName = headerNames.nextElement();\n\t Enumeration headers = request.getHeaders(headerName);\n\t \n\t while (headers.hasMoreElements()) \n\t {\n\t String headerValue = headers.nextElement();\n\t con.addRequestProperty(headerName, headerValue);\n\t }\n\t }\n\t \n\t if (\"POST\".equals(method))\n\t {\n\t\t\t\t// Send post request\n\t\t\t\tcon.setDoOutput(true);\n\t\t\t\t\n\t\t\t\tOutputStream params = con.getOutputStream();\n\t\t\t\tUtils.copy(request.getInputStream(), params);\n\t\t\t\tparams.flush();\n\t\t\t\tparams.close();\n\t }\n\t \n\t int responseCode = con.getResponseCode();\n\t\t\t//Copy response code\n\t\t\tresponse.setStatus(responseCode);\n\t\t\t\n\t\t\t//Copy response headers\n\t\t\tMap> map = con.getHeaderFields();\n\t\t\t\n\t\t\tfor (Map.Entry> entry : map.entrySet()) \n\t\t\t{\n\t\t\t\tString key = entry.getKey();\n\t\t\t\t\n\t\t\t\tif (key != null)\n\t\t\t\t{\n\t\t\t\t\tfor (String val : entry.getValue())\n\t\t\t\t\t{\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tresponse.addHeader(entry.getKey(), val);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//Copy response\n\t\t\tOutputStream out = response.getOutputStream();\n\t\t\t\n\t\t\t//Error\n\t\t\tif (responseCode >= 400)\n\t\t\t{\n\t\t\t\tUtils.copy(con.getErrorStream(), out);\n\t\t\t}\n\t\t\telse //Success\n\t\t\t{\n\t\t\t\tUtils.copy(con.getInputStream(), out);\n\t\t\t}\n\t\t\t\n\t\t\tout.flush();\n\t\t\tout.close();\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tresponse.setStatus(\n\t\t\t\t\tHttpServletResponse.SC_INTERNAL_SERVER_ERROR);\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " foreach ($d->aliases as $alias) {\n $schema->addAlias(\n $alias->key,\n $d->id->key\n );\n }", "label": 1, "label_name": "safe"} +{"code": " private void testBSI()\n throws Exception\n {\n KeyPairGenerator kpGen = KeyPairGenerator.getInstance(\"ECDSA\", \"BC\");\n\n kpGen.initialize(new ECGenParameterSpec(TeleTrusTObjectIdentifiers.brainpoolP512r1.getId()));\n\n KeyPair kp = kpGen.generateKeyPair();\n\n byte[] data = \"Hello World!!!\".getBytes();\n String[] cvcAlgs = { \"SHA1WITHCVC-ECDSA\", \"SHA224WITHCVC-ECDSA\",\n \"SHA256WITHCVC-ECDSA\", \"SHA384WITHCVC-ECDSA\",\n \"SHA512WITHCVC-ECDSA\" };\n String[] cvcOids = { EACObjectIdentifiers.id_TA_ECDSA_SHA_1.getId(), EACObjectIdentifiers.id_TA_ECDSA_SHA_224.getId(),\n EACObjectIdentifiers.id_TA_ECDSA_SHA_256.getId(), EACObjectIdentifiers.id_TA_ECDSA_SHA_384.getId(),\n EACObjectIdentifiers.id_TA_ECDSA_SHA_512.getId() };\n\n testBsiAlgorithms(kp, data, cvcAlgs, cvcOids);\n\n String[] plainAlgs = { \"SHA1WITHPLAIN-ECDSA\", \"SHA224WITHPLAIN-ECDSA\",\n \"SHA256WITHPLAIN-ECDSA\", \"SHA384WITHPLAIN-ECDSA\",\n \"SHA512WITHPLAIN-ECDSA\", \"RIPEMD160WITHPLAIN-ECDSA\" };\n String[] plainOids = { BSIObjectIdentifiers.ecdsa_plain_SHA1.getId(), BSIObjectIdentifiers.ecdsa_plain_SHA224.getId(),\n BSIObjectIdentifiers.ecdsa_plain_SHA256.getId(), BSIObjectIdentifiers.ecdsa_plain_SHA384.getId(),\n BSIObjectIdentifiers.ecdsa_plain_SHA512.getId(), BSIObjectIdentifiers.ecdsa_plain_RIPEMD160.getId() };\n\n testBsiAlgorithms(kp, data, plainAlgs, plainOids);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "G.x+=this.editorUi.picker.offsetWidth+4;G.y+=C.offsetTop-E.height/2+16;return G}var P=x.apply(this,arguments);G=mxUtils.getOffset(this.editorUi.sidebarWindow.window.div);P.x+=G.x-16;P.y+=G.y;return P};var y=Menus.prototype.createPopupMenu;Menus.prototype.createPopupMenu=function(C,E,G){var P=this.editorUi.editor.graph;C.smartSeparators=!0;y.apply(this,arguments);\"1\"==urlParams.sketch?P.isEnabled()&&(C.addSeparator(),1==P.getSelectionCount()&&this.addMenuItems(C,[\"-\",\"lockUnlock\"],null,G)):1==P.getSelectionCount()?\n(P.isCellFoldable(P.getSelectionCell())&&this.addMenuItems(C,P.isCellCollapsed(E)?[\"expand\"]:[\"collapse\"],null,G),this.addMenuItems(C,[\"collapsible\",\"-\",\"lockUnlock\",\"enterGroup\"],null,G),C.addSeparator(),this.addSubmenu(\"layout\",C)):P.isSelectionEmpty()&&P.isEnabled()?(C.addSeparator(),this.addMenuItems(C,[\"editData\"],null,G),C.addSeparator(),this.addSubmenu(\"layout\",C),this.addSubmenu(\"insert\",C),this.addMenuItems(C,[\"-\",\"exitGroup\"],null,G)):P.isEnabled()&&this.addMenuItems(C,[\"-\",\"lockUnlock\"],\nnull,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(C,E,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(C,[\"copyAsImage\"],null,G)};EditorUi.prototype.toggleFormatPanel=function(C){null!=this.formatWindow?this.formatWindow.window.setVisible(null!=C?C:!this.formatWindow.window.isVisible()):b(this)};DiagramFormatPanel.prototype.isMathOptionVisible=function(){return!0};var B=EditorUi.prototype.destroy;EditorUi.prototype.destroy=", "label": 1, "label_name": "safe"} +{"code": "INTERNAL void vterm_screen_free(VTermScreen *screen)\n{\n vterm_allocator_free(screen->vt, screen->buffers[0]);\n if(screen->buffers[1])\n vterm_allocator_free(screen->vt, screen->buffers[1]);\n\n vterm_allocator_free(screen->vt, screen->sb_buffer);\n\n vterm_allocator_free(screen->vt, screen);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def test_filelike_http11(self):\n to_send = \"GET /filelike HTTP/1.1\\r\\n\\r\\n\"\n to_send = tobytes(to_send)\n\n self.connect()\n\n for t in range(0, 2):\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n self.assertline(line, \"200\", \"OK\", \"HTTP/1.1\")\n cl = int(headers[\"content-length\"])\n self.assertEqual(cl, len(response_body))\n ct = headers[\"content-type\"]\n self.assertEqual(ct, \"image/jpeg\")\n self.assertTrue(b\"\\377\\330\\377\" in response_body)", "label": 1, "label_name": "safe"} +{"code": "static ssize_t _epoll_writev(\n oe_fd_t* desc,\n const struct oe_iovec* iov,\n int iovcnt)\n{\n ssize_t ret = -1;\n epoll_t* file = _cast_epoll(desc);\n void* buf = NULL;\n size_t buf_size = 0;\n\n if (!file || (iovcnt && !iov) || iovcnt < 0 || iovcnt > OE_IOV_MAX)\n OE_RAISE_ERRNO(OE_EINVAL);\n\n /* Flatten the IO vector into contiguous heap memory. */\n if (oe_iov_pack(iov, iovcnt, &buf, &buf_size) != 0)\n OE_RAISE_ERRNO(OE_ENOMEM);\n\n /* Call the host. */\n if (oe_syscall_writev_ocall(&ret, file->host_fd, buf, iovcnt, buf_size) !=\n OE_OK)\n {\n OE_RAISE_ERRNO(OE_EINVAL);\n }\n\ndone:\n\n if (buf)\n oe_free(buf);\n\n return ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function test_generateFromToken_backtickDisabled()\n {\n $this->config->set('Output.FixInnerHTML', false);\n $this->assertGenerateFromToken(\n new HTMLPurifier_Token_Start('img', array('alt' => '`')),\n '\"`\"'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_values([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testMinimal()\n {\n $this->assertResult(\n '',\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t\tout : function(e, ui) {\n\t\t\t\t\t\tvar helper = ui.helper;\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\thelper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus').data('dropover', Math.max(helper.data('dropover') - 1, 0));\n\t\t\t\t\t\t$(this).removeData('dropover')\n\t\t\t\t\t\t .removeClass(dropover);\n\t\t\t\t\t\tfm.trigger('unlockfiles', {files : helper.data('files'), helper: helper});\n\t\t\t\t\t},\n\t\t\t\t\tdrop : function(e, ui) {\n\t\t\t\t\t\tvar helper = ui.helper,\n\t\t\t\t\t\t\tresolve = true;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$.each(helper.data('files'), function(i, hash) {\n\t\t\t\t\t\t\tvar dir = fm.file(hash);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (dir && dir.mime == 'directory' && !dirs[dir.hash]) {\n\t\t\t\t\t\t\t\tadd(dir);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresolve = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsave();\n\t\t\t\t\t\tresolve && helper.hide();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t// for touch device\n\t\t\t\t.on('touchstart', '.'+navdir+':not(.'+clroot+')', function(e) {\n\t\t\t\t\tvar hash = $(this).attr('id').substr(6),\n\t\t\t\t\tp = $(this)\n\t\t\t\t\t.addClass(hover)\n\t\t\t\t\t.data('longtap', null)\n\t\t\t\t\t.data('tmlongtap', setTimeout(function(){\n\t\t\t\t\t\t// long tap\n\t\t\t\t\t\tp.data('longtap', true);\n\t\t\t\t\t\tfm.trigger('contextmenu', {\n\t\t\t\t\t\t\traw : [{\n\t\t\t\t\t\t\t\tlabel : fm.i18n('rmFromPlaces'),\n\t\t\t\t\t\t\t\ticon : 'rm',\n\t\t\t\t\t\t\t\tcallback : function() { remove(hash); save(); }\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t\t'x' : e.originalEvent.touches[0].pageX,\n\t\t\t\t\t\t\t'y' : e.originalEvent.touches[0].pageY\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 500));\n\t\t\t\t})\n\t\t\t\t.on('touchmove touchend', '.'+navdir+':not(.'+clroot+')', function(e) {\n\t\t\t\t\tclearTimeout($(this).data('tmlongtap'));\n\t\t\t\t\tif (e.type == 'touchmove') {\n\t\t\t\t\t\t$(this).removeClass(hover);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t// \"on regist\" for command exec\n\t\t$(this).on('regist', function(e, files){\n\t\t\tvar added = false;\n\t\t\t$.each(files, function(i, dir) {\n\t\t\t\tif (dir && dir.mime == 'directory' && !dirs[dir.hash]) {\n\t\t\t\t\tif (add(dir)) {\n\t\t\t\t\t\tadded = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadded && save();\n\t\t});\n\t\n\n\t\t// on fm load - show places and load files from backend\n\t\tfm.one('load', function() {\n\t\t\tvar dat, hashes;\n\t\t\t\n\t\t\tif (fm.oldAPI) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tplaces.show().parent().show();\n\n\t\t\tdirs = {};\n\t\t\tdat = $.map((fm.storage(key) || '').split(','), function(hash) { return hash || null;});\n\t\t\t$.each(dat, function(i, d) {\n\t\t\t\tvar dir = d.split('#')\n\t\t\t\tdirs[dir[0]] = dir[1]? dir[1] : dir[0];\n\t\t\t});\n\t\t\t// allow modify `dirs`\n\t\t\t/**\n\t\t\t * example for preset places\n\t\t\t * \n\t\t\t * elfinderInstance.bind('placesload', function(e, fm) {\n\t\t\t * \t//if (fm.storage(e.data.storageKey) === null) { // for first time only\n\t\t\t * \tif (!fm.storage(e.data.storageKey)) { // for empty places\n\t\t\t * \t\te.data.dirs[targetHash] = fallbackName; // preset folder\n\t\t\t * \t}\n\t\t\t * }\n\t\t\t **/\n\t\t\tfm.trigger('placesload', {dirs: dirs, storageKey: key}, true);\n\t\t\t\n\t\t\thashes = Object.keys(dirs);\n\t\t\tif (hashes.length) {\n\t\t\t\troot.prepend(spinner);\n\t\t\t\t\n\t\t\t\tfm.request({\n\t\t\t\t\tdata : {cmd : 'info', targets : hashes},\n\t\t\t\t\tpreventDefault : true\n\t\t\t\t})\n\t\t\t\t.done(function(data) {\n\t\t\t\t\tvar exists = {};\n\t\t\t\t\t$.each(data.files, function(i, f) {\n\t\t\t\t\t\tvar hash = f.hash;\n\t\t\t\t\t\texists[hash] = f;\n\t\t\t\t\t});\n\t\t\t\t\t$.each(dirs, function(h, f) {\n\t\t\t\t\t\tadd(exists[h] || { hash: h, name: f, mime: 'directory', notfound: true });\n\t\t\t\t\t});\n\t\t\t\t\tif (fm.storage('placesState') > 0) {\n\t\t\t\t\t\troot.click();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.always(function() {\n\t\t\t\t\tspinner.remove();\n\t\t\t\t})\n\t\t\t}\n\t\t\t\n\n\t\t\tfm.change(function(e) {\n\t\t\t\tvar changed = false;\n\t\t\t\t$.each(e.data.changed, function(i, file) {\n\t\t\t\t\tif (dirs[file.hash]) {\n\t\t\t\t\t\tif (file.mime !== 'directory') {\n\t\t\t\t\t\t\tif (remove(file.hash)) {\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (update(file)) {\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tchanged && save();\n\t\t\t})\n\t\t\t.bind('rename', function(e) {\n\t\t\t\tvar changed = false;\n\t\t\t\tif (e.data.removed) {\n\t\t\t\t\t$.each(e.data.removed, function(i, hash) {\n\t\t\t\t\t\tif (e.data.added[i]) {\n\t\t\t\t\t\t\tif (update(e.data.added[i], hash)) {\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tchanged && save();\n\t\t\t})\n\t\t\t.bind('rm paste', function(e) {\n\t\t\t\tvar names = [],\n\t\t\t\t\tchanged = false;\n\t\t\t\tif (e.data.removed) {\n\t\t\t\t\t$.each(e.data.removed, function(i, hash) {\n\t\t\t\t\t\tvar name = remove(hash);\n\t\t\t\t\t\tname && names.push(name);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (names.length) {\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t\tif (e.data.added && names.length) {\n\t\t\t\t\t$.each(e.data.added, function(i, file) {\n\t\t\t\t\t\tif ($.inArray(file.name, names) !== 1) {\n\t\t\t\t\t\t\tfile.mime == 'directory' && add(file);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tchanged && save();\n\t\t\t})\n\t\t\t.bind('sync', function() {\n\t\t\t\tvar hashes = Object.keys(dirs);\n\t\t\t\tif (hashes.length) {\n\t\t\t\t\troot.prepend(spinner);\n\n\t\t\t\t\tfm.request({\n\t\t\t\t\t\tdata : {cmd : 'info', targets : hashes},\n\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t})\n\t\t\t\t\t.done(function(data) {\n\t\t\t\t\t\tvar exists = {},\n\t\t\t\t\t\t\tupdated = false,\n\t\t\t\t\t\t\tcwd = fm.cwd().hash;\n\t\t\t\t\t\t$.each(data.files || [], function(i, file) {\n\t\t\t\t\t\t\tvar hash = file.hash;\n\t\t\t\t\t\t\texists[hash] = file;\n\t\t\t\t\t\t\tif (!fm.files().hasOwnProperty(file.hash)) {\n\t\t\t\t\t\t\t\t// update cache\n\t\t\t\t\t\t\t\tfm.trigger('tree', {tree: [file]});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t$.each(dirs, function(h, f) {\n\t\t\t\t\t\t\tif (!f.notfound != !!exists[h]) {\n\t\t\t\t\t\t\t\tif (f.phash === cwd || (exists[h] && exists[h].mime !== 'directory')) {\n\t\t\t\t\t\t\t\t\tif (remove(h)) {\n\t\t\t\t\t\t\t\t\t\tupdated = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (update(exists[h] || { hash: h, name: f.name, mime: 'directory', notfound: true })) {\n\t\t\t\t\t\t\t\t\t\tupdated = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (exists[h] && exists[h].phash != cwd) {\n\t\t\t\t\t\t\t\t// update permission of except cwd\n\t\t\t\t\t\t\t\tupdate(exists[h]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdated && save();\n\t\t\t\t\t})\n\t\t\t\t\t.always(function() {\n\t\t\t\t\t\tspinner.remove();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t\n\t\t})\n\t\t\n\t});\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def create\n if !@resource.value(:source)\n create_repository(@resource.value(:path))\n else\n checkout_repository\n end\n update_owner\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it \"removes all matching documents\" do\n session.should_receive(:with, :consistency => :strong).\n and_yield(session)\n\n session.should_receive(:execute).with do |delete|\n delete.flags.should eq []\n delete.selector.should eq query.operation.selector\n end\n\n query.remove_all\n end", "label": 0, "label_name": "vulnerable"} +{"code": "function(l){this.actions.get(\"shapes\").funct();mxEvent.consume(l)}));d.appendChild(g);return d};EditorUi.prototype.handleError=function(d,g,k,l,p,q,x){var y=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},z=null!=d&&null!=d.error?d.error:d;if(null!=d&&(\"1\"==urlParams.test||null!=d.stack)&&null!=d.message)try{x?null!=window.console&&console.error(\"EditorUi.handleError:\",d):EditorUi.logError(\"Caught: \"+(\"\"==d.message&&null!=d.name)?d.name:d.message,d.filename,d.lineNumber,\nd.columnNumber,d,\"INFO\")}catch(u){}if(null!=z||null!=g){x=mxUtils.htmlEntities(mxResources.get(\"unknownError\"));var A=mxResources.get(\"ok\"),L=null;g=null!=g?g:mxResources.get(\"error\");if(null!=z){null!=z.retry&&(A=mxResources.get(\"cancel\"),L=function(){y();z.retry()});if(404==z.code||404==z.status||403==z.code){x=403==z.code?null!=z.message?mxUtils.htmlEntities(z.message):mxUtils.htmlEntities(mxResources.get(\"accessDenied\")):null!=p?p:mxUtils.htmlEntities(mxResources.get(\"fileNotFoundOrDenied\")+(null!=\nthis.drive&&null!=this.drive.user?\" (\"+this.drive.user.displayName+\", \"+this.drive.user.email+\")\":\"\"));var O=null!=p?null:null!=q?q:window.location.hash;if(null!=O&&(\"#G\"==O.substring(0,2)||\"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D\"==O.substring(0,45))&&(null!=d&&null!=d.error&&(null!=d.error.errors&&0\");I.setAttribute(\"disabled\",\"disabled\");G.appendChild(I)}I=document.createElement(\"option\");mxUtils.write(I,mxResources.get(\"addAccount\"));I.value=D.length;G.appendChild(I)}var D=this.drive.getUsersList(),B=document.createElement(\"div\"),C=document.createElement(\"span\");C.style.marginTop=\"6px\";mxUtils.write(C,mxResources.get(\"changeUser\")+\": \");B.appendChild(C);var G=document.createElement(\"select\");G.style.width=\"200px\";u();mxEvent.addListener(G,\"change\",mxUtils.bind(this,\nfunction(){var N=G.value,I=D.length!=N;I&&this.drive.setUser(D[N]);this.drive.authorize(I,mxUtils.bind(this,function(){I||(D=this.drive.getUsersList(),u())}),mxUtils.bind(this,function(F){this.handleError(F)}),!0)}));B.appendChild(G);B=new CustomDialog(this,B,mxUtils.bind(this,function(){this.loadFile(window.location.hash.substr(1),!0)}));this.showDialog(B.container,300,100,!0,!0)}),mxResources.get(\"cancel\"),mxUtils.bind(this,function(){this.hideDialog();null!=k&&k()}),480,150);return}}null!=z.message?\nx=\"\"==z.message&&null!=z.name?mxUtils.htmlEntities(z.name):mxUtils.htmlEntities(z.message):null!=z.response&&null!=z.response.error?x=mxUtils.htmlEntities(z.response.error):\"undefined\"!==typeof window.App&&(z.code==App.ERROR_TIMEOUT?x=mxUtils.htmlEntities(mxResources.get(\"timeout\")):z.code==App.ERROR_BUSY?x=mxUtils.htmlEntities(mxResources.get(\"busy\")):\"string\"===typeof z&&0warmUp(dirname(self::$cacheFile));\n\n $this->assertFileExists(self::$cacheFile);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "jpeg_error_handler(j_common_ptr p)\t// Common JPEG data\n{\n hd_jpeg_err_t\t*jerr = (hd_jpeg_err_t *)p->err;\n\t\t\t\t\t// JPEG error handler\n\n\n // Save the error message in the string buffer...\n (jerr->jerr.format_message)(p, jerr->message);\n\n // Return to the point we called setjmp()...\n longjmp(jerr->retbuf, 1);\n}", "label": 1, "label_name": "safe"} +{"code": " private SingleButtonPanel addNewAjaxActionButton(final AjaxCallback ajaxCallback, final String label, final String... classnames)\n {\n final AjaxButton button = new AjaxButton(\"button\", form) {\n private static final long serialVersionUID = -5306532706450731336L;\n\n @Override\n protected void onSubmit(final AjaxRequestTarget target, final Form< ? > form)\n {\n csrfTokenHandler.onSubmit();\n ajaxCallback.callback(target);\n }\n\n @Override\n protected void onError(final AjaxRequestTarget target, final Form< ? > form)\n {\n if (ajaxCallback instanceof AjaxFormSubmitCallback) {\n ((AjaxFormSubmitCallback) ajaxCallback).onError(target, form);\n }\n }\n };\n final SingleButtonPanel buttonPanel = new SingleButtonPanel(this.actionButtons.newChildId(), button, label, classnames);\n buttonPanel.add(button);\n return buttonPanel;\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t\tparser.validateLink = function(url) {\n\t\t\t\t\t\tvar BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file', 'data' ];\n\t\t\t\t\t\tvar str = url.trim().toLowerCase();\n\n\t\t\t\t\t\tif (str.indexOf(':') >= 0 && BAD_PROTOCOLS.indexOf(str.split(':')[0]) >= 0) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}", "label": 1, "label_name": "safe"} +{"code": " it \"using %s should be higher then when I wrote this test\" do\n result = scope.function_strftime([\"%s\"])\n expect(result.to_i).to(be > 1311953157)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)\n{\n\tstruct page *pages[NFS4ACL_MAXPAGES] = {NULL, };\n\tstruct nfs_getaclargs args = {\n\t\t.fh = NFS_FH(inode),\n\t\t.acl_pages = pages,\n\t\t.acl_len = buflen,\n\t};\n\tstruct nfs_getaclres res = {\n\t\t.acl_len = buflen,\n\t};\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL],\n\t\t.rpc_argp = &args,\n\t\t.rpc_resp = &res,\n\t};\n\tunsigned int npages = DIV_ROUND_UP(buflen, PAGE_SIZE);\n\tint ret = -ENOMEM, i;\n\n\t/* As long as we're doing a round trip to the server anyway,\n\t * let's be prepared for a page of acl data. */\n\tif (npages == 0)\n\t\tnpages = 1;\n\tif (npages > ARRAY_SIZE(pages))\n\t\treturn -ERANGE;\n\n\tfor (i = 0; i < npages; i++) {\n\t\tpages[i] = alloc_page(GFP_KERNEL);\n\t\tif (!pages[i])\n\t\t\tgoto out_free;\n\t}\n\n\t/* for decoding across pages */\n\tres.acl_scratch = alloc_page(GFP_KERNEL);\n\tif (!res.acl_scratch)\n\t\tgoto out_free;\n\n\targs.acl_len = npages * PAGE_SIZE;\n\targs.acl_pgbase = 0;\n\n\tdprintk(\"%s buf %p buflen %zu npages %d args.acl_len %zu\\n\",\n\t\t__func__, buf, buflen, npages, args.acl_len);\n\tret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),\n\t\t\t &msg, &args.seq_args, &res.seq_res, 0);\n\tif (ret)\n\t\tgoto out_free;\n\n\t/* Handle the case where the passed-in buffer is too short */\n\tif (res.acl_flags & NFS4_ACL_TRUNC) {\n\t\t/* Did the user only issue a request for the acl length? */\n\t\tif (buf == NULL)\n\t\t\tgoto out_ok;\n\t\tret = -ERANGE;\n\t\tgoto out_free;\n\t}\n\tnfs4_write_cached_acl(inode, pages, res.acl_data_offset, res.acl_len);\n\tif (buf)\n\t\t_copy_from_pages(buf, pages, res.acl_data_offset, res.acl_len);\nout_ok:\n\tret = res.acl_len;\nout_free:\n\tfor (i = 0; i < npages; i++)\n\t\tif (pages[i])\n\t\t\t__free_page(pages[i]);\n\tif (res.acl_scratch)\n\t\t__free_page(res.acl_scratch);\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "EditorUi.prototype.updateTabContainer=function(){null!=this.tabContainer&&(this.tabContainer.style.right=\"70px\",this.diagramContainer.style.bottom=\"1\"==urlParams.sketch?\"0px\":this.tabContainerHeight+\"px\");f.apply(this,arguments)};var g=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){g.apply(this,arguments);this.menus.get(\"save\").setEnabled(null!=this.getCurrentFile()||\"1\"==urlParams.embed)};var m=Menus.prototype.addShortcut;Menus.prototype.addShortcut=function(O,\nX){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute(\"title\",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText=\"position:relative;margin-right:4px;cursor:pointer;display:\"+O.style.display;O.className=\"geToolbarButton\";O.innerHTML=\"\";O.style.backgroundImage=\"url(\"+Editor.userImage+\")\";O.style.backgroundPosition=\"center center\";", "label": 0, "label_name": "vulnerable"} +{"code": "static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n)\n{\n int dy = y1 - y0;\n int adx = x1 - x0;\n int ady = abs(dy);\n int base;\n int x=x0,y=y0;\n int err = 0;\n int sy;\n\n#ifdef STB_VORBIS_DIVIDE_TABLE\n if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) {\n if (dy < 0) {\n base = -integer_divide_table[ady][adx];\n sy = base-1;\n } else {\n base = integer_divide_table[ady][adx];\n sy = base+1;\n }\n } else {\n base = dy / adx;\n if (dy < 0)\n sy = base - 1;\n else\n sy = base+1;\n }\n#else\n base = dy / adx;\n if (dy < 0)\n sy = base - 1;\n else\n sy = base+1;\n#endif\n ady -= abs(base) * adx;\n if (x1 > n) x1 = n;\n if (x < x1) {\n LINE_OP(output[x], inverse_db_table[y&255]);\n for (++x; x < x1; ++x) {\n err += ady;\n if (err >= adx) {\n err -= adx;\n y += sy;\n } else\n y += base;\n LINE_OP(output[x], inverse_db_table[y&255]);\n }\n }\n}", "label": 1, "label_name": "safe"} +{"code": " public static ExportFile DownloadExportFile(DateTime date, string fileName)\n {\n var exportFile = new ExportFile();\n var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,\n string.Format(ExportFile.FileUrlPrefix, date.ToString(\"yyyy-MM-dd\"), Uri.EscapeUriString(fileName)),\n exportFile.ReadXml);\n\n return statusCode != HttpStatusCode.NotFound ? exportFile : null;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "window.addEventListener(\"message\",v)}})));c(q);q.onversionchange=function(){q.close()}});k.onerror=e;k.onblocked=function(){}}catch(m){null!=e&&e(m)}else null!=e&&e()}else c(this.database)};EditorUi.prototype.setDatabaseItem=function(c,e,g,k,m){this.openDatabase(mxUtils.bind(this,function(q){try{m=m||\"objects\";Array.isArray(m)||(m=[m],c=[c],e=[e]);var v=q.transaction(m,\"readwrite\");v.oncomplete=g;v.onerror=k;for(q=0;q md5(mt_rand()),\n 'tmp_name' => md5(mt_rand()),\n 'type' => 'image/jpeg',\n 'size' => mt_rand(1000, 10000),\n 'error' => '0',\n ];\n }", "label": 0, "label_name": "vulnerable"} +{"code": "ber_parse_header(STREAM s, int tagval, int *length)\n{\n\tint tag, len;\n\n\tif (tagval > 0xff)\n\t{\n\t\tin_uint16_be(s, tag);\n\t}\n\telse\n\t{\n\t\tin_uint8(s, tag);\n\t}\n\n\tif (tag != tagval)\n\t{\n\t\tlogger(Core, Error, \"ber_parse_header(), expected tag %d, got %d\", tagval, tag);\n\t\treturn False;\n\t}\n\n\tin_uint8(s, len);\n\n\tif (len & 0x80)\n\t{\n\t\tlen &= ~0x80;\n\t\t*length = 0;\n\t\twhile (len--)\n\t\t\tnext_be(s, *length);\n\t}\n\telse\n\t\t*length = len;\n\n\treturn s_check(s);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testPreserveNamespace()\n {\n $this->assertResult('%Core namespace (not recognized)');\n }", "label": 1, "label_name": "safe"} +{"code": "init_remote_listener(int port, gboolean encrypted)\n{\n int rc;\n int *ssock = NULL;\n struct sockaddr_in saddr;\n int optval;\n static struct mainloop_fd_callbacks remote_listen_fd_callbacks = \n {\n .dispatch = cib_remote_listen,\n .destroy = remote_connection_destroy,\n };\n\n if (port <= 0) {\n /* dont start it */\n return 0;\n }\n\n if (encrypted) {\n#ifndef HAVE_GNUTLS_GNUTLS_H\n crm_warn(\"TLS support is not available\");\n return 0;\n#else\n crm_notice(\"Starting a tls listener on port %d.\", port);\n gnutls_global_init();\n /* gnutls_global_set_log_level (10); */\n gnutls_global_set_log_function(debug_log);\n gnutls_dh_params_init(&dh_params);\n gnutls_dh_params_generate2(dh_params, DH_BITS);\n gnutls_anon_allocate_server_credentials(&anon_cred_s);\n gnutls_anon_set_server_dh_params(anon_cred_s, dh_params);\n#endif\n } else {\n crm_warn(\"Starting a plain_text listener on port %d.\", port);\n }\n#ifndef HAVE_PAM\n crm_warn(\"PAM is _not_ enabled!\");\n#endif\n\n /* create server socket */\n ssock = malloc(sizeof(int));\n *ssock = socket(AF_INET, SOCK_STREAM, 0);\n if (*ssock == -1) {\n crm_perror(LOG_ERR, \"Can not create server socket.\" ERROR_SUFFIX);\n free(ssock);\n return -1;\n }\n\n /* reuse address */\n optval = 1;\n rc = setsockopt(*ssock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));\n if(rc < 0) {\n crm_perror(LOG_INFO, \"Couldn't allow the reuse of local addresses by our remote listener\");\n }\n\n /* bind server socket */\n memset(&saddr, '\\0', sizeof(saddr));\n saddr.sin_family = AF_INET;\n saddr.sin_addr.s_addr = INADDR_ANY;\n saddr.sin_port = htons(port);\n if (bind(*ssock, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) {\n crm_perror(LOG_ERR, \"Can not bind server socket.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -2;\n }\n if (listen(*ssock, 10) == -1) {\n crm_perror(LOG_ERR, \"Can not start listen.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -3;\n }\n\n mainloop_add_fd(\"cib-remote\", G_PRIORITY_DEFAULT, *ssock, ssock, &remote_listen_fd_callbacks);\n\n return *ssock;\n}", "label": 1, "label_name": "safe"} +{"code": "int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)\n{\n\tstruct snd_ctl_elem_id id;\n\tunsigned int idx;\n\tunsigned int count;\n\tint err = -EINVAL;\n\n\tif (! kcontrol)\n\t\treturn err;\n\tif (snd_BUG_ON(!card || !kcontrol->info))\n\t\tgoto error;\n\tid = kcontrol->id;\n\tif (id.index > UINT_MAX - kcontrol->count)\n\t\tgoto error;\n\n\tdown_write(&card->controls_rwsem);\n\tif (snd_ctl_find_id(card, &id)) {\n\t\tup_write(&card->controls_rwsem);\n\t\tdev_err(card->dev, \"control %i:%i:%i:%s:%i is already present\\n\",\n\t\t\t\t\tid.iface,\n\t\t\t\t\tid.device,\n\t\t\t\t\tid.subdevice,\n\t\t\t\t\tid.name,\n\t\t\t\t\tid.index);\n\t\terr = -EBUSY;\n\t\tgoto error;\n\t}\n\tif (snd_ctl_find_hole(card, kcontrol->count) < 0) {\n\t\tup_write(&card->controls_rwsem);\n\t\terr = -ENOMEM;\n\t\tgoto error;\n\t}\n\tlist_add_tail(&kcontrol->list, &card->controls);\n\tcard->controls_count += kcontrol->count;\n\tkcontrol->id.numid = card->last_numid + 1;\n\tcard->last_numid += kcontrol->count;\n\tcount = kcontrol->count;\n\tup_write(&card->controls_rwsem);\n\tfor (idx = 0; idx < count; idx++, id.index++, id.numid++)\n\t\tsnd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);\n\treturn 0;\n\n error:\n\tsnd_ctl_free_one(kcontrol);\n\treturn err;\n}", "label": 1, "label_name": "safe"} +{"code": "t1mac_output_ascii(char *s, int len)\n{\n if (blocktyp == POST_BINARY) {\n output_current_post();\n blocktyp = POST_ASCII;\n }\n /* Mac line endings */\n if (len > 0 && s[len-1] == '\\n')\n s[len-1] = '\\r';\n t1mac_output_data((byte *)s, len);\n if (strncmp(s, \"/FontName\", 9) == 0) {\n for (s += 9; isspace((unsigned char) *s); s++)\n /* skip */;\n if (*s == '/') {\n const char *t = ++s;\n while (*t && !isspace((unsigned char) *t)) t++;\n free(font_name);\n font_name = (char *)malloc(t - s + 1);\n memcpy(font_name, s, t - s);\n font_name[t - s] = 0;\n }\n }\n}", "label": 1, "label_name": "safe"} +{"code": "function(){b.spinner.stop();if(null==b.linkPicker){var n=b.drive.createLinkPicker();b.linkPicker=n.setCallback(function(x){LinkDialog.filePicked(x)}).build()}b.linkPicker.setVisible(!0)}))});\"undefined\"!=typeof Dropbox&&\"undefined\"!=typeof Dropbox.choose&&c(IMAGE_PATH+\"/dropbox-logo.svg\",mxResources.get(\"dropbox\"),function(){Dropbox.choose({linkType:\"direct\",cancel:function(){},success:function(n){k.value=n[0].link;k.focus()}})});null!=b.oneDrive&&c(IMAGE_PATH+\"/onedrive-logo.svg\",mxResources.get(\"oneDrive\"),", "label": 1, "label_name": "safe"} +{"code": " void Compute(OpKernelContext* ctx) override {\n const Tensor& gradient = ctx->input(0);\n const Tensor& input = ctx->input(1);\n Tensor* input_backprop = nullptr;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(0, input.shape(), &input_backprop));\n\n OP_REQUIRES(\n ctx, input.IsSameSize(gradient),\n errors::InvalidArgument(\"gradient and input must be the same size\"));\n const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);\n const Tensor& input_min_tensor = ctx->input(2);\n OP_REQUIRES(ctx,\n input_min_tensor.dims() == 0 || input_min_tensor.dims() == 1,\n errors::InvalidArgument(\n \"Input min tensor must have dimension 1. Recieved \",\n input_min_tensor.dims(), \".\"));\n const Tensor& input_max_tensor = ctx->input(3);\n OP_REQUIRES(ctx,\n input_max_tensor.dims() == 0 || input_max_tensor.dims() == 1,\n errors::InvalidArgument(\n \"Input max tensor must have dimension 1. Recieved \",\n input_max_tensor.dims(), \".\"));\n if (axis_ != -1) {\n OP_REQUIRES(\n ctx, input_min_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\"min has incorrect size, expected \", depth,\n \" was \", input_min_tensor.dim_size(0)));\n OP_REQUIRES(\n ctx, input_max_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\"max has incorrect size, expected \", depth,\n \" was \", input_max_tensor.dim_size(0)));\n }\n\n TensorShape min_max_shape(input_min_tensor.shape());\n Tensor* input_min_backprop;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(1, min_max_shape, &input_min_backprop));\n\n Tensor* input_max_backprop;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(2, min_max_shape, &input_max_backprop));\n\n if (axis_ == -1) {\n functor::QuantizeAndDequantizeOneScaleGradientFunctor f;\n f(ctx->eigen_device(), gradient.template flat(),\n input.template flat(), input_min_tensor.scalar(),\n input_max_tensor.scalar(), input_backprop->template flat(),\n input_min_backprop->template scalar(),\n input_max_backprop->template scalar());\n } else {\n functor::QuantizeAndDequantizePerChannelGradientFunctor f;\n f(ctx->eigen_device(),\n gradient.template flat_inner_outer_dims(axis_ - 1),\n input.template flat_inner_outer_dims(axis_ - 1),\n &input_min_tensor, &input_max_tensor,\n input_backprop->template flat_inner_outer_dims(axis_ - 1),\n input_min_backprop->template flat(),\n input_max_backprop->template flat());\n }\n }", "label": 1, "label_name": "safe"} +{"code": "def yet_another_upload_file(request):\n path = tempfile.mkdtemp()\n file_name = os.path.join(path, \"yet_another_%s.txt\" % request.node.name)\n with open(file_name, \"w\") as f:\n f.write(request.node.name)\n return file_name", "label": 0, "label_name": "vulnerable"} +{"code": " def test_size_is_not_scalar(self): # b/206619828\n with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError),\n \"Shape must be rank 0 but is rank 1\"):\n self.evaluate(\n gen_math_ops.dense_bincount(\n input=[0], size=[1, 1], weights=[3], binary_output=False))", "label": 1, "label_name": "safe"} +{"code": "func (*UserList) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{40}\n}", "label": 1, "label_name": "safe"} +{"code": "static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *sg_table,\n\t\t\t\t u32 total_sg_needed, unsigned char init_payload)\n{\n\tu32 i = 0, j, page_offset = 0, sg_per_table;\n\tu32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE /\n\t\t\t\tsizeof(struct scatterlist));\n\tstruct page *pg;\n\tstruct scatterlist *sg;\n\tunsigned char *p;\n\n\twhile (total_sg_needed) {\n\t\tsg_per_table = (total_sg_needed > max_sg_per_table) ?\n\t\t\tmax_sg_per_table : total_sg_needed;\n\n\t\tsg = kzalloc(sg_per_table * sizeof(struct scatterlist),\n\t\t\t\tGFP_KERNEL);\n\t\tif (!sg) {\n\t\t\tpr_err(\"Unable to allocate scatterlist array\"\n\t\t\t\t\" for struct rd_dev\\n\");\n\t\t\treturn -ENOMEM;\n\t\t}\n\n\t\tsg_init_table(sg, sg_per_table);\n\n\t\tsg_table[i].sg_table = sg;\n\t\tsg_table[i].rd_sg_count = sg_per_table;\n\t\tsg_table[i].page_start_offset = page_offset;\n\t\tsg_table[i++].page_end_offset = (page_offset + sg_per_table)\n\t\t\t\t\t\t- 1;\n\n\t\tfor (j = 0; j < sg_per_table; j++) {\n\t\t\tpg = alloc_pages(GFP_KERNEL, 0);\n\t\t\tif (!pg) {\n\t\t\t\tpr_err(\"Unable to allocate scatterlist\"\n\t\t\t\t\t\" pages for struct rd_dev_sg_table\\n\");\n\t\t\t\treturn -ENOMEM;\n\t\t\t}\n\t\t\tsg_assign_page(&sg[j], pg);\n\t\t\tsg[j].length = PAGE_SIZE;\n\n\t\t\tp = kmap(pg);\n\t\t\tmemset(p, init_payload, PAGE_SIZE);\n\t\t\tkunmap(pg);\n\t\t}\n\n\t\tpage_offset += sg_per_table;\n\t\ttotal_sg_needed -= sg_per_table;\n\t}\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": " private X509TrustManager createTrustManager() {\n X509TrustManager trustManager = new X509TrustManager() {\n\n /**\n * {@InheritDoc}\n *\n * @see javax.net.ssl.X509TrustManager#checkClientTrusted(java.security.cert.X509Certificate[], java.lang.String)\n */\n public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {\n logger.trace(\"Skipping trust check on client certificate {}\", string);\n }\n\n /**\n * {@InheritDoc}\n *\n * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String)\n */\n public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {\n logger.trace(\"Skipping trust check on server certificate {}\", string);\n }\n\n /**\n * {@InheritDoc}\n *\n * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()\n */\n public X509Certificate[] getAcceptedIssuers() {\n logger.trace(\"Returning empty list of accepted issuers\");\n return null;\n }\n\n };\n\n return trustManager;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count,\n const size_t quantum)\n{\n MemoryInfo\n *memory_info;\n\n size_t\n length;\n\n length=count*quantum;\n if ((count == 0) || (quantum != (length/count)))\n {\n errno=ENOMEM;\n return((MemoryInfo *) NULL);\n }\n memory_info=(MemoryInfo *) MagickAssumeAligned(AcquireAlignedMemory(1,\n sizeof(*memory_info)));\n if (memory_info == (MemoryInfo *) NULL)\n ThrowFatalException(ResourceLimitFatalError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(memory_info,0,sizeof(*memory_info));\n memory_info->length=length;\n memory_info->signature=MagickSignature;\n if (AcquireMagickResource(MemoryResource,length) != MagickFalse)\n {\n memory_info->blob=AcquireAlignedMemory(1,length);\n if (memory_info->blob != NULL)\n memory_info->type=AlignedVirtualMemory;\n else\n RelinquishMagickResource(MemoryResource,length);\n }\n if ((memory_info->blob == NULL) &&\n (AcquireMagickResource(MapResource,length) != MagickFalse))\n {\n /*\n Heap memory failed, try anonymous memory mapping.\n */\n memory_info->blob=MapBlob(-1,IOMode,0,length);\n if (memory_info->blob != NULL)\n memory_info->type=MapVirtualMemory;\n else\n RelinquishMagickResource(MapResource,length);\n }\n if (memory_info->blob == NULL)\n {\n int\n file;\n\n /*\n Anonymous memory mapping failed, try file-backed memory mapping.\n */\n file=AcquireUniqueFileResource(memory_info->filename);\n if (file != -1)\n {\n if ((lseek(file,length-1,SEEK_SET) >= 0) && (write(file,\"\",1) == 1))\n {\n memory_info->blob=MapBlob(file,IOMode,0,length);\n if (memory_info->blob != NULL)\n {\n memory_info->type=MapVirtualMemory;\n (void) AcquireMagickResource(MapResource,length);\n }\n }\n (void) close(file);\n }\n }\n if (memory_info->blob == NULL)\n {\n memory_info->blob=AcquireMagickMemory(length);\n if (memory_info->blob != NULL)\n memory_info->type=UnalignedVirtualMemory;\n }\n if (memory_info->blob == NULL)\n memory_info=RelinquishVirtualMemory(memory_info);\n return(memory_info);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "spnego_gss_import_sec_context(\n\tOM_uint32\t\t*minor_status,\n\tconst gss_buffer_t\tinterprocess_token,\n\tgss_ctx_id_t\t\t*context_handle)\n{\n\t/*\n\t * Until we implement partial context exports, there are no SPNEGO\n\t * exported context tokens, only tokens for underlying mechs. So just\n\t * return an error for now.\n\t */\n\treturn GSS_S_UNAVAILABLE;\n}", "label": 1, "label_name": "safe"} +{"code": " def self.destroy_by_user(user_id, add_con=nil)\n\n SqlHelper.validate_token([user_id])\n\n con = \"user_id=#{user_id}\"\n con << \" and (#{add_con})\" unless add_con.nil? or add_con.empty?\n emails = Email.where(con).to_a\n\n emails.each do |email|\n email.destroy\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function getName()\n {\n return 'ajax';\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function formatItem( Article $article, $pageText = null ) {\n\t\t$item = '';\n\n\t\tif ( $pageText !== null ) {\n\t\t\t//Include parsed/processed wiki markup content after each item before the closing tag.\n\t\t\t$item .= $pageText;\n\t\t}\n\n\t\t$item = $this->getItemStart() . $item . $this->getItemEnd();\n\n\t\t$item = $this->replaceTagParameters( $item, $article );\n\n\t\treturn $item;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "def test_get_delete_dataobj(test_app, client: FlaskClient, note_fixture):\n response = client.get(\"/dataobj/delete/1\")\n assert response.status_code == 302", "label": 0, "label_name": "vulnerable"} +{"code": "Ga),!0,null,!0);var Ha=document.createElement(\"div\");Ha.className=\"geTempDlgDialogMask\";Q.appendChild(Ha);var Na=b.sidebar.hideTooltip;b.sidebar.hideTooltip=function(){Ha&&(Q.removeChild(Ha),Ha=null,Na.apply(this,arguments),b.sidebar.hideTooltip=Na)};mxEvent.addListener(Ha,\"click\",function(){b.sidebar.hideTooltip()})}}var qa=null;if(Ca||b.sidebar.currentElt==ca)b.sidebar.hideTooltip();else{var oa=function(na){Ca&&b.sidebar.currentElt==ca&&ma(na,mxEvent.getClientX(ja),mxEvent.getClientY(ja));Ca=!1;", "label": 0, "label_name": "vulnerable"} +{"code": " private def impersonateImpl(anyUserId: Opt[PatId], viewAsOnly: Bo,\n request: DebikiRequest[_]): p_Result = {\n\n // To view as another user, the session id should be amended so it includes info like:\n // \"We originally logged in as Nnn and now we're viewing as Nnn2.\" And pages should be shown\n // only if _both_ Nnn and Nnn2 may view them. \u2014 Not yet implemented, only view-as-stranger\n // supported right now.\n dieIf(anyUserId.isDefined && viewAsOnly, \"EdE6WKT0S\")\n\n val sidAndXsrfCookies = anyUserId.toList flatMap { userId =>\n createSessionIdAndXsrfToken(request.siteId, userId)._3\n }\n\n val logoutCookie =\n if (anyUserId.isEmpty) Seq(DiscardingSessionCookie)\n else Nil\n\n val impCookie = makeImpersonationCookie(request.siteId, viewAsOnly, request.theUserId)\n val newCookies = impCookie :: sidAndXsrfCookies\n\n request.dao.pubSub.unsubscribeUser(request.siteId, request.theRequester)\n\n // But don't subscribe to events for the user we'll be viewing the site as. Real\n // time events isn't the purpose of view-site-as. The client should resubscribe\n // the requester to hens *own* notfs, once done impersonating, though.\n\n Ok.withCookies(newCookies: _*).discardingCookies(logoutCookie: _*)\n }\n\n\n private def makeImpersonationCookie(siteId: SiteId, viewAsGroupOnly: Boolean,", "label": 0, "label_name": "vulnerable"} +{"code": " def add(self, image_id, image_file, image_size, connection=None):\n location = self.create_location(image_id)\n if not connection:\n connection = self.get_connection(location)\n\n self._create_container_if_missing(location.container, connection)\n\n LOG.debug(_(\"Adding image object '%(obj_name)s' \"\n \"to Swift\") % dict(obj_name=location.obj))\n try:\n if image_size > 0 and image_size < self.large_object_size:\n # Image size is known, and is less than large_object_size.\n # Send to Swift with regular PUT.\n obj_etag = connection.put_object(location.container,\n location.obj, image_file,\n content_length=image_size)\n else:\n # Write the image into Swift in chunks.\n chunk_id = 1\n if image_size > 0:\n total_chunks = str(int(\n math.ceil(float(image_size) /\n float(self.large_object_chunk_size))))\n else:\n # image_size == 0 is when we don't know the size\n # of the image. This can occur with older clients\n # that don't inspect the payload size.\n LOG.debug(_(\"Cannot determine image size. Adding as a \"\n \"segmented object to Swift.\"))\n total_chunks = '?'\n\n checksum = hashlib.md5()\n combined_chunks_size = 0\n while True:\n chunk_size = self.large_object_chunk_size\n if image_size == 0:\n content_length = None\n else:\n left = image_size - combined_chunks_size\n if left == 0:\n break\n if chunk_size > left:\n chunk_size = left\n content_length = chunk_size\n\n chunk_name = \"%s-%05d\" % (location.obj, chunk_id)\n reader = ChunkReader(image_file, checksum, chunk_size)\n chunk_etag = connection.put_object(\n location.container, chunk_name, reader,\n content_length=content_length)\n bytes_read = reader.bytes_read\n msg = _(\"Wrote chunk %(chunk_name)s (%(chunk_id)d/\"\n \"%(total_chunks)s) of length %(bytes_read)d \"\n \"to Swift returning MD5 of content: \"\n \"%(chunk_etag)s\")\n LOG.debug(msg % locals())\n\n if bytes_read == 0:\n # Delete the last chunk, because it's of zero size.\n # This will happen if size == 0.\n LOG.debug(_(\"Deleting final zero-length chunk\"))\n connection.delete_object(location.container,\n chunk_name)\n break\n\n chunk_id += 1\n combined_chunks_size += bytes_read\n\n # In the case we have been given an unknown image size,\n # set the size to the total size of the combined chunks.\n if image_size == 0:\n image_size = combined_chunks_size\n\n # Now we write the object manifest and return the\n # manifest's etag...\n manifest = \"%s/%s\" % (location.container, location.obj)\n headers = {'ETag': hashlib.md5(\"\").hexdigest(),\n 'X-Object-Manifest': manifest}\n\n # The ETag returned for the manifest is actually the\n # MD5 hash of the concatenated checksums of the strings\n # of each chunk...so we ignore this result in favour of\n # the MD5 of the entire image file contents, so that\n # users can verify the image file contents accordingly\n connection.put_object(location.container, location.obj,\n None, headers=headers)\n obj_etag = checksum.hexdigest()\n\n # NOTE: We return the user and key here! Have to because\n # location is used by the API server to return the actual\n # image data. We *really* should consider NOT returning\n # the location attribute from GET /images/ and\n # GET /images/details\n\n return (location.get_uri(), image_size, obj_etag)\n except swiftclient.ClientException, e:\n if e.http_status == httplib.CONFLICT:\n raise exception.Duplicate(_(\"Swift already has an image at \"\n \"this location\"))\n msg = (_(\"Failed to add object to Swift.\\n\"\n \"Got error from Swift: %(e)s\") % locals())\n LOG.error(msg)\n raise glance.store.BackendException(msg)", "label": 1, "label_name": "safe"} +{"code": "Mocha.prototype.growl = function() {\n this.options.growl = true;\n return this;\n};", "label": 1, "label_name": "safe"} +{"code": "},!1)):s.prependTo(i).after('
    '+c.i18n(\"or\")+\"
    \")[0],c.dialog(i,{title:this.title+(u?\" - \"+c.escape(c.file(u[0]).name):\"\"),modal:!0,resizable:!1,destroyOnClose:!0}),m))}},elFinder.prototype.commands.view=function(){this.value=this.fm.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:\"viewbutton\"},this.getstate=function(){return 0},this.exec=function(){var e=this.fm.storage(\"view\",\"list\"==this.value?\"icons\":\"list\");this.fm.viewchange(),this.update(void 0,e)}}}(jQuery);", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus ResizeOutputTensor(TfLiteContext* context,\n const TfLiteTensor* data,\n const TfLiteTensor* segment_ids,\n TfLiteTensor* output) {\n // Segment ids should be of same cardinality as first input dimension and they\n // should be increasing by at most 1, from 0 (e.g., [0, 0, 1, 2, 3] is valid)\n const int segment_id_size = segment_ids->dims->data[0];\n TF_LITE_ENSURE_EQ(context, segment_id_size, data->dims->data[0]);\n int previous_segment_id = -1;\n for (int i = 0; i < segment_id_size; i++) {\n const int current_segment_id = GetTensorData(segment_ids)[i];\n if (i == 0) {\n TF_LITE_ENSURE_EQ(context, current_segment_id, 0);\n } else {\n int delta = current_segment_id - previous_segment_id;\n TF_LITE_ENSURE(context, delta == 0 || delta == 1);\n }\n previous_segment_id = current_segment_id;\n }\n\n const int max_index = previous_segment_id;\n\n const int data_rank = NumDimensions(data);\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(data));\n output_shape->data[0] = max_index + 1;\n for (int i = 1; i < data_rank; ++i) {\n output_shape->data[i] = data->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}", "label": 1, "label_name": "safe"} +{"code": "static int muscle_list_files(sc_card_t *card, u8 *buf, size_t bufLen)\n{\n\tmuscle_private_t* priv = MUSCLE_DATA(card);\n\tmscfs_t *fs = priv->fs;\n\tint x;\n\tint count = 0;\n\n\tmscfs_check_cache(priv->fs);\n\n\tfor(x = 0; x < fs->cache.size; x++) {\n\t\tu8* oid= fs->cache.array[x].objectId.id;\n\t\tsc_debug(card->ctx, SC_LOG_DEBUG_NORMAL,\n\t\t\t\"FILE: %02X%02X%02X%02X\\n\",\n\t\t\toid[0],oid[1],oid[2],oid[3]);\n\t\tif(0 == memcmp(fs->currentPath, oid, 2)) {\n\t\t\tbuf[0] = oid[2];\n\t\t\tbuf[1] = oid[3];\n\t\t\tif(buf[0] == 0x00 && buf[1] == 0x00) continue; /* No directories/null names outside of root */\n\t\t\tbuf += 2;\n\t\t\tcount+=2;\n\t\t}\n\t}\n\treturn count;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t struct msghdr *msg, size_t len,\n\t\t int noblock, int flags, int *addr_len)\n{\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct inet_sock *inet = inet_sk(sk);\n\tstruct sk_buff *skb;\n\tunsigned int ulen, copied;\n\tint peeked, off = 0;\n\tint err;\n\tint is_udplite = IS_UDPLITE(sk);\n\tint is_udp4;\n\tbool slow;\n\n\tif (addr_len)\n\t\t*addr_len = sizeof(struct sockaddr_in6);\n\n\tif (flags & MSG_ERRQUEUE)\n\t\treturn ipv6_recv_error(sk, msg, len);\n\n\tif (np->rxpmtu && np->rxopt.bits.rxpmtu)\n\t\treturn ipv6_recv_rxpmtu(sk, msg, len);\n\ntry_again:\n\tskb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0),\n\t\t\t\t &peeked, &off, &err);\n\tif (!skb)\n\t\tgoto out;\n\n\tulen = skb->len - sizeof(struct udphdr);\n\tcopied = len;\n\tif (copied > ulen)\n\t\tcopied = ulen;\n\telse if (copied < ulen)\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\n\tis_udp4 = (skb->protocol == htons(ETH_P_IP));\n\n\t/*\n\t * If checksum is needed at all, try to do it while copying the\n\t * data. If the data is truncated, or if we only want a partial\n\t * coverage checksum (UDP-Lite), do it before the copy.\n\t */\n\n\tif (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {\n\t\tif (udp_lib_checksum_complete(skb))\n\t\t\tgoto csum_copy_err;\n\t}\n\n\tif (skb_csum_unnecessary(skb))\n\t\terr = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),\n\t\t\t\t\t msg->msg_iov, copied);\n\telse {\n\t\terr = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);\n\t\tif (err == -EINVAL)\n\t\t\tgoto csum_copy_err;\n\t}\n\tif (unlikely(err)) {\n\t\ttrace_kfree_skb(skb, udpv6_recvmsg);\n\t\tif (!peeked) {\n\t\t\tatomic_inc(&sk->sk_drops);\n\t\t\tif (is_udp4)\n\t\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t\telse\n\t\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t}\n\t\tgoto out_free;\n\t}\n\tif (!peeked) {\n\t\tif (is_udp4)\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t\telse\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t}\n\n\tsock_recv_ts_and_drops(msg, sk, skb);\n\n\t/* Copy the address. */\n\tif (msg->msg_name) {\n\t\tstruct sockaddr_in6 *sin6;\n\n\t\tsin6 = (struct sockaddr_in6 *) msg->msg_name;\n\t\tsin6->sin6_family = AF_INET6;\n\t\tsin6->sin6_port = udp_hdr(skb)->source;\n\t\tsin6->sin6_flowinfo = 0;\n\n\t\tif (is_udp4) {\n\t\t\tipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,\n\t\t\t\t\t &sin6->sin6_addr);\n\t\t\tsin6->sin6_scope_id = 0;\n\t\t} else {\n\t\t\tsin6->sin6_addr = ipv6_hdr(skb)->saddr;\n\t\t\tsin6->sin6_scope_id =\n\t\t\t\tipv6_iface_scope_id(&sin6->sin6_addr,\n\t\t\t\t\t\t IP6CB(skb)->iif);\n\t\t}\n\n\t}\n\tif (is_udp4) {\n\t\tif (inet->cmsg_flags)\n\t\t\tip_cmsg_recv(msg, skb);\n\t} else {\n\t\tif (np->rxopt.all)\n\t\t\tip6_datagram_recv_ctl(sk, msg, skb);\n\t}\n\n\terr = copied;\n\tif (flags & MSG_TRUNC)\n\t\terr = ulen;\n\nout_free:\n\tskb_free_datagram_locked(sk, skb);\nout:\n\treturn err;\n\ncsum_copy_err:\n\tslow = lock_sock_fast(sk);\n\tif (!skb_kill_datagram(sk, skb, flags)) {\n\t\tif (is_udp4) {\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t} else {\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t}\n\t}\n\tunlock_sock_fast(sk, slow);\n\n\tif (noblock)\n\t\treturn -EAGAIN;\n\n\t/* starting over for a new packet */\n\tmsg->msg_flags &= ~MSG_TRUNC;\n\tgoto try_again;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "[];for(G=0;GarchiveSize += filesize($p);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {", "label": 0, "label_name": "vulnerable"} +{"code": " constructor(client, info, localChan) {\n super();\n\n this.type = 'session';\n this.subtype = undefined;\n this._ending = false;\n this._channel = undefined;\n this._chanInfo = {\n type: 'session',\n incoming: {\n id: localChan,\n window: MAX_WINDOW,\n packetSize: PACKET_SIZE,\n state: 'open'\n },\n outgoing: {\n id: info.sender,\n window: info.window,\n packetSize: info.packetSize,\n state: 'open'\n }\n };\n }", "label": 1, "label_name": "safe"} +{"code": "int main() {\n int selftest;\n\n MSPACK_SYS_SELFTEST(selftest);\n TEST(selftest == MSPACK_ERR_OK);\n\n kwajd_open_test_01();\n\n printf(\"ALL %d TESTS PASSED.\\n\", test_count);\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": "int ZlibInStream::overrun(int itemSize, int nItems, bool wait)\n{\n if (itemSize > bufSize)\n throw Exception(\"ZlibInStream overrun: max itemSize exceeded\");\n if (!underlying)\n throw Exception(\"ZlibInStream overrun: no underlying stream\");\n\n if (end - ptr != 0)\n memmove(start, ptr, end - ptr);\n\n offset += ptr - start;\n end -= ptr - start;\n ptr = start;\n\n while (end - ptr < itemSize) {\n if (!decompress(wait))\n return 0;\n }\n\n if (itemSize * nItems > end - ptr)\n nItems = (end - ptr) / itemSize;\n\n return nItems;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public void translate(ServerDifficultyPacket packet, GeyserSession session) {\n SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket();\n setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal());\n session.sendUpstreamPacket(setDifficultyPacket);\n\n session.getWorldCache().setDifficulty(packet.getDifficulty());\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def test___post_init__(self):\n from openapi_python_client.parser.properties import StringProperty\n\n sp = StringProperty(name=\"test\", required=True, default=\"A Default Value\",)\n\n assert sp.default == '\"A Default Value\"'", "label": 0, "label_name": "vulnerable"} +{"code": "function test($serialized) {\n $ret = null;\n var_dump(\n fb_unserialize(\n $serialized,\n inout $ret,\n FB_SERIALIZE_HACK_ARRAYS\n )\n );\n var_dump($ret);\n}", "label": 1, "label_name": "safe"} +{"code": "fn main() -> std::io::Result<()> {\n env::set_var(\"RUST_LOG\", \"swhks=trace\");\n env_logger::init();\n\n let pid_file_path = String::from(\"/tmp/swhks.pid\");\n let sock_file_path = String::from(\"/tmp/swhkd.sock\");\n\n if Path::new(&pid_file_path).exists() {\n log::trace!(\"Reading {} file and checking for running instances.\", pid_file_path);\n let swhkd_pid = match fs::read_to_string(&pid_file_path) {\n Ok(swhkd_pid) => swhkd_pid,\n Err(e) => {\n log::error!(\"Unable to read {} to check all running instances\", e);\n exit(1);\n }\n };\n log::debug!(\"Previous PID: {}\", swhkd_pid);\n\n let mut sys = System::new_all();\n sys.refresh_all();\n for (pid, process) in sys.processes() {\n if pid.to_string() == swhkd_pid && process.exe() == env::current_exe().unwrap() {\n log::error!(\"Server is already running!\");\n exit(1);\n }\n }\n }\n\n if Path::new(&sock_file_path).exists() {\n log::trace!(\"Sockfile exists, attempting to remove it.\");\n match fs::remove_file(&sock_file_path) {\n Ok(_) => {\n log::debug!(\"Removed old socket file\");\n }\n Err(e) => {\n log::error!(\"Error removing the socket file!: {}\", e);\n log::error!(\"You can manually remove the socket file: {}\", sock_file_path);\n exit(1);\n }\n };\n }\n\n match fs::write(&pid_file_path, id().to_string()) {\n Ok(_) => {}\n Err(e) => {\n log::error!(\"Unable to write to {}: {}\", pid_file_path, e);\n exit(1);\n }\n }\n\n let listener = UnixListener::bind(sock_file_path)?;\n loop {\n match listener.accept() {\n Ok((mut socket, address)) => {\n let mut response = String::new();\n socket.read_to_string(&mut response)?;\n run_system_command(&response);\n log::debug!(\"Socket: {:?} Address: {:?} Response: {}\", socket, address, response);\n }\n Err(e) => log::error!(\"accept function failed: {:?}\", e),\n }\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "document.createElement(\"link\");N.setAttribute(\"rel\",\"preload\");N.setAttribute(\"href\",T);N.setAttribute(\"as\",\"font\");N.setAttribute(\"crossorigin\",\"\");E.parentNode.insertBefore(N,E)}}}};Editor.trimCssUrl=function(u){return u.replace(RegExp(\"^[\\\\s\\\"']+\",\"g\"),\"\").replace(RegExp(\"[\\\\s\\\"']+$\",\"g\"),\"\")};Editor.GOOGLE_FONTS=\"https://fonts.googleapis.com/css?family=\";Editor.GUID_ALPHABET=\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_\";Editor.GUID_LENGTH=20;Editor.guid=function(u){u=null!=", "label": 0, "label_name": "vulnerable"} +{"code": " $arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : '') . ' --', 'ext' => 'rar');", "label": 1, "label_name": "safe"} +{"code": "\tpublic function execute()\n\t{\n\t\t// if not in debug-mode we should include the minified versions\n\t\tif(!SPOON_DEBUG && SpoonFile::exists(BACKEND_CORE_PATH . '/js/minified.js'))\n\t\t{\n\t\t\t// include the minified JS-file\n\t\t\t$this->header->addJS('minified.js', 'core', false);\n\t\t}\n\n\t\t// in debug-mode or minified files don't exist\n\t\telse\n\t\t{\n\t\t\t// add jquery, we will need this in every action, so add it globally\n\t\t\t$this->header->addJS('jquery/jquery.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.ui.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.ui.dialog.patch.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.tools.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.backend.js', 'core');\n\t\t}\n\n\t\t// add items that always need to be loaded\n\t\t$this->header->addJS('utils.js', 'core', true);\n\t\t$this->header->addJS('backend.js', 'core', true);\n\n\t\t// add module js\n\t\tif(SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getModule() . '.js'))\n\t\t{\n\t\t\t$this->header->addJS($this->getModule() . '.js', null, true);\n\t\t}\n\n\t\t// add action js\n\t\tif(SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getAction() . '.js'))\n\t\t{\n\t\t\t$this->header->addJS($this->getAction() . '.js', null, true);\n\t\t}\n\n\t\t// if not in debug-mode we should include the minified version\n\t\tif(!SPOON_DEBUG && SpoonFile::exists(BACKEND_CORE_PATH . '/layout/css/minified.css'))\n\t\t{\n\t\t\t$this->header->addCSS('minified.css', 'core');\n\t\t}\n\n\t\t// debug-mode or minified file does not exist\n\t\telse\n\t\t{\n\t\t\t$this->header->addCSS('reset.css', 'core');\n\t\t\t$this->header->addCSS('jquery_ui/fork/jquery_ui.css', 'core');\n\t\t\t$this->header->addCSS('debug.css', 'core');\n\t\t\t$this->header->addCSS('screen.css', 'core');\n\t\t}\n\n\t\t// add module specific css\n\t\tif(SpoonFile::exists(BACKEND_MODULE_PATH . '/layout/css/' . $this->getModule() . '.css'))\n\t\t{\n\t\t\t$this->header->addCSS($this->getModule() . '.css', null);\n\t\t}\n\n\t\t// store var so we don't have to call this function twice\n\t\t$var = $this->getParameter('var', 'array');\n\n\t\t// is there a report to show?\n\t\tif($this->getParameter('report') !== null)\n\t\t{\n\t\t\t// show the report\n\t\t\t$this->tpl->assign('report', true);\n\n\t\t\t// camelcase the string\n\t\t\t$messageName = SpoonFilter::toCamelCase(SpoonFilter::stripHTML($this->getParameter('report')), '-');\n\n\t\t\t// if we have data to use it will be passed as the var parameter\n\t\t\tif(!empty($var)) $this->tpl->assign('reportMessage', vsprintf(BL::msg($messageName), $var));\n\t\t\telse $this->tpl->assign('reportMessage', BL::msg($messageName));\n\n\t\t\t// highlight an element with the given id if needed\n\t\t\tif($this->getParameter('highlight')) $this->tpl->assign('highlight', SpoonFilter::stripHTML($this->getParameter('highlight')));\n\t\t}\n\n\t\t// is there an error to show?\n\t\tif($this->getParameter('error') !== null)\n\t\t{\n\t\t\t// camelcase the string\n\t\t\t$errorName = SpoonFilter::toCamelCase(SpoonFilter::stripHTML($this->getParameter('error')), '-');\n\n\t\t\t// if we have data to use it will be passed as the var parameter\n\t\t\tif(!empty($var)) $this->tpl->assign('errorMessage', vsprintf(BL::err($errorName), $var));\n\t\t\telse $this->tpl->assign('errorMessage', BL::err($errorName));\n\t\t}\n\t}", "label": 1, "label_name": "safe"} +{"code": " public function tearDown()\n {\n foreach ($this->cleanup as $file) {\n if (is_scalar($file) && file_exists($file)) {\n unlink($file);\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": " public Optional convert(Object object, Class targetType, ConversionContext context) {\n CorsOriginConfiguration configuration = new CorsOriginConfiguration();\n if (object instanceof Map) {\n Map mapConfig = (Map) object;\n ConvertibleValues convertibleValues = new ConvertibleValuesMap<>(mapConfig);\n\n convertibleValues\n .get(ALLOWED_ORIGINS, ConversionContext.LIST_OF_STRING)\n .ifPresent(configuration::setAllowedOrigins);\n\n convertibleValues\n .get(ALLOWED_METHODS, CONVERSION_CONTEXT_LIST_OF_HTTP_METHOD)\n .ifPresent(configuration::setAllowedMethods);\n\n convertibleValues\n .get(ALLOWED_HEADERS, ConversionContext.LIST_OF_STRING)\n .ifPresent(configuration::setAllowedHeaders);\n\n convertibleValues\n .get(EXPOSED_HEADERS, ConversionContext.LIST_OF_STRING)\n .ifPresent(configuration::setExposedHeaders);\n\n convertibleValues\n .get(ALLOW_CREDENTIALS, ConversionContext.BOOLEAN)\n .ifPresent(configuration::setAllowCredentials);\n\n convertibleValues\n .get(MAX_AGE, ConversionContext.LONG)\n .ifPresent(configuration::setMaxAge);\n }\n return Optional.of(configuration);\n }", "label": 1, "label_name": "safe"} +{"code": "[H];!u(H)&&!d(H)||D(H)||x.traverse(H,!0,function(U,Q){var W=null!=Q&&x.isTreeEdge(Q);W&&0>mxUtils.indexOf(S,Q)&&S.push(Q);(null==Q||W)&&0>mxUtils.indexOf(S,U)&&S.push(U);return null==Q||W});return S};var G=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){G.apply(this,arguments);(u(this.state.cell)||d(this.state.cell))&&!D(this.state.cell)&&0this.state.width?10:0)+2+\"px\",this.moveHandle.style.top=this.state.y+this.state.height+(40>this.state.height?10:0)+2+\"px\")};var J=mxVertexHandler.prototype.setHandlesVisible;mxVertexHandler.prototype.setHandlesVisible=function(H){J.apply(this,", "label": 0, "label_name": "vulnerable"} +{"code": "b,e){b=this.jobs[b];b.state=a.activeFilter.checkFeature(this)?b.refresh.call(this,a,e):i;return b.state},getContext:function(a){return a.contains(this.context)}}})();(function(){function s(e){function g(b){for(var f=d.startContainer,a=d.endContainer;f&&!f.getParent().equals(b);)f=f.getParent();for(;a&&!a.getParent().equals(b);)a=a.getParent();if(!f||!a)return!1;for(var h=f,f=[],c=!1;!c;)h.equals(a)&&(c=!0),f.push(h),h=h.getNext();if(1>f.length)return!1;h=b.getParents(!0);for(a=0;a :absent}\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus PrepareHashtableSize(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input_resource_id_tensor =\n GetInput(context, node, kInputResourceIdTensor);\n TF_LITE_ENSURE_EQ(context, input_resource_id_tensor->type, kTfLiteInt32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_resource_id_tensor), 1);\n TF_LITE_ENSURE_EQ(context, SizeOfDimension(input_resource_id_tensor, 0), 1);\n\n TfLiteTensor* output_tensor = GetOutput(context, node, kOutputTensor);\n TF_LITE_ENSURE(context, output_tensor != nullptr);\n TF_LITE_ENSURE_EQ(context, output_tensor->type, kTfLiteInt64);\n TfLiteIntArray* outputSize = TfLiteIntArrayCreate(1);\n outputSize->data[0] = 1;\n return context->ResizeTensor(context, output_tensor, outputSize);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "def cluster_status_remote(params, request, session)\n if not allowed_for_local_cluster(session, Permissions::READ)\n return 403, 'Permission denied'\n end\n\n cluster_name = $cluster_name\n # If node is not in a cluster, return empty data\n if not cluster_name or cluster_name.empty?\n overview = {\n :cluster_name => nil,\n :error_list => [],\n :warning_list => [],\n :quorate => nil,\n :status => 'unknown',\n :node_list => [],\n :resource_list => [],\n }\n return JSON.generate(overview)\n end\n\n cluster_nodes = get_nodes().flatten\n status = cluster_status_from_nodes(session, cluster_nodes, cluster_name)\n unless status\n return 403, 'Permission denied'\n end\n return JSON.generate(status)\nend", "label": 0, "label_name": "vulnerable"} +{"code": " var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n var attr = void 0;\n var value = void 0;\n var lcName = void 0;\n var idAttr = void 0;\n var l = void 0;\n /* Execute a hook if present */\n _executeHook('beforeSanitizeAttributes', currentNode, null);\n\n var attributes = currentNode.attributes;\n\n /* Check if we have attributes; if not we might have a text node */\n\n if (!attributes) {\n return;\n }\n\n var hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR\n };\n l = attributes.length;\n\n /* Go backwards over all attributes; safely remove bad ones */\n while (l--) {\n attr = attributes[l];\n var _attr = attr,\n name = _attr.name,\n namespaceURI = _attr.namespaceURI;\n\n value = attr.value.trim();\n lcName = name.toLowerCase();\n\n /* Execute a hook if present */\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n value = hookEvent.attrValue;\n\n /* Remove attribute */\n // Safari (iOS + Mac), last tested v8.0.5, crashes if you try to\n // remove a \"name\" attribute from an tag that has an \"id\"\n // attribute at the time.\n if (lcName === 'name' && currentNode.nodeName === 'IMG' && attributes.id) {\n idAttr = attributes.id;\n attributes = apply(arraySlice, attributes, []);\n _removeAttribute('id', currentNode);\n _removeAttribute(name, currentNode);\n if (attributes.indexOf(idAttr) > l) {\n currentNode.setAttribute('id', idAttr.value);\n }\n } else if (\n // This works around a bug in Safari, where input[type=file]\n // cannot be dynamically set after type has been removed\n currentNode.nodeName === 'INPUT' && lcName === 'type' && value === 'file' && hookEvent.keepAttr && (ALLOWED_ATTR[lcName] || !FORBID_ATTR[lcName])) {\n continue;\n } else {\n // This avoids a crash in Safari v9.0 with double-ids.\n // The trick is to first set the id to be empty and then to\n // remove the attribute\n if (name === 'id') {\n currentNode.setAttribute(name, '');\n }\n\n _removeAttribute(name, currentNode);\n }\n\n /* Did the hooks approve of the attribute? */\n if (!hookEvent.keepAttr) {\n continue;\n }\n\n /* Take care of an mXSS pattern using namespace switches */\n if (/<\\/(style|textarea)/.test(value)) {\n _removeAttribute(name, currentNode);\n }\n\n /* Sanitize attribute content to be template-safe */\n if (SAFE_FOR_TEMPLATES) {\n value = value.replace(MUSTACHE_EXPR$$1, ' ');\n value = value.replace(ERB_EXPR$$1, ' ');\n }\n\n /* Is `value` valid for this attribute? */\n var lcTag = currentNode.nodeName.toLowerCase();\n if (!_isValidAttribute(lcTag, lcName, value)) {\n continue;\n }\n\n /* Handle invalid data-* attribute set by try-catching it */\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n\n DOMPurify.removed.pop();\n } catch (error) {}\n }\n\n /* Execute a hook if present */\n _executeHook('afterSanitizeAttributes', currentNode, null);\n };", "label": 1, "label_name": "safe"} +{"code": " public function test_generateFromTokens_XHTMLoff()\n {\n $this->config->set('HTML.XHTML', false);\n\n // omit trailing slash\n $this->assertGeneration(\n array( new HTMLPurifier_Token_Empty('br') ),\n '
    '\n );\n\n // there should be a test for attribute minimization, but it is\n // impossible for something like that to happen due to our current\n // definitions! fix it later\n\n // namespaced attributes must be dropped\n $this->assertGeneration(\n array( new HTMLPurifier_Token_Start('p', array('xml:lang'=>'fr')) ),\n '

    '\n );\n\n }", "label": 1, "label_name": "safe"} +{"code": " function selectArraysBySql($sql) { \n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "jQuery.fn.extend({\n\tbind: function( type, data, fn ) {\n\t\treturn type == \"unload\" ? this.one(type, data, fn) : this.each(function(){\n\t\t\tjQuery.event.add( this, type, fn || data, fn && data );\n\t\t});\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " public function testYouTube()\n {\n $this->assertResult(\n '',\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": " public static void AddPortalAlias(PortalAliasInfo portal)\n {\n DatabaseHelper.ExecuteStoredProcedure(\"AddPortalAlias\",\n portal.PortalID,\n portal.HTTPAlias,\n portal.CultureCode,\n portal.Skin,\n portal.BrowserType,\n portal.IsPrimary,\n -1);\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus GetOutputSafe(const TfLiteContext* context, const TfLiteNode* node,\n int index, TfLiteTensor** tensor) {\n int tensor_index;\n TF_LITE_ENSURE_OK(\n context, ValidateTensorIndexingSafe(context, index, node->outputs->size,\n node->outputs->data, &tensor_index));\n *tensor = GetTensorAtIndex(context, tensor_index);\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {\n if (empty($endtimestamp)) {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($timestamp) . \")\";\n } else {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($endtimestamp) . \")\";\n }\n if ($multiday)\n $date_sql .= \" OR (\" . expDateTime::startOfDayTimestamp($timestamp) . \" BETWEEN \".$field.\" AND dateFinished)\";\n $date_sql .= \")\";\n return $date_sql;\n }", "label": 1, "label_name": "safe"} +{"code": "void Context::onLog() {\n if (wasm_->onLog_) {\n wasm_->onLog_(this, id_);\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tstatic public function deleteCategory($_id = 0)\n\t{\n\t\tif ($_id != 0) {\n\t\t\t\n\t\t\t$result_stmt = Database::prepare(\"\n\t\t\t\tSELECT COUNT(`id`) as `numtickets` FROM `\" . TABLE_PANEL_TICKETS . \"`\n\t\t\t\tWHERE `category` = :cat\");\n\t\t\t$result = Database::pexecute_first($result_stmt, array(\n\t\t\t\t'cat' => $_id\n\t\t\t));\n\t\t\t\n\t\t\tif ($result['numtickets'] == \"0\") {\n\t\t\t\t$del_stmt = Database::prepare(\"\n\t\t\t\t\tDELETE FROM `\" . TABLE_PANEL_TICKET_CATS . \"` WHERE `id` = :id\");\n\t\t\t\tDatabase::pexecute($del_stmt, array(\n\t\t\t\t\t'id' => $_id\n\t\t\t\t));\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "label": 1, "label_name": "safe"} +{"code": "Q=function(R,fa,la,ra){R.addItem(la,null,mxUtils.bind(this,function(){var u=new CreateGraphDialog(O,la,ra);O.showDialog(u.container,620,420,!0,!1);u.init()}),fa)};this.put(\"insertLayout\",new Menu(mxUtils.bind(this,function(R,fa){for(var la=0;la 0:\n if c.datatype == 'bool' or c.datatype == 'integer' or c.datatype == 'float':\n del_cc = getattr(book, cc_string)[0]\n getattr(book, cc_string).remove(del_cc)\n log.debug('remove ' + str(c.id))\n calibre_db.session.delete(del_cc)\n calibre_db.session.commit()\n elif c.datatype == 'rating':\n del_cc = getattr(book, cc_string)[0]\n getattr(book, cc_string).remove(del_cc)\n if len(del_cc.books) == 0:\n log.debug('remove ' + str(c.id))\n calibre_db.session.delete(del_cc)\n calibre_db.session.commit()\n else:\n del_cc = getattr(book, cc_string)[0]\n getattr(book, cc_string).remove(del_cc)\n log.debug('remove ' + str(c.id))\n calibre_db.session.delete(del_cc)\n calibre_db.session.commit()\n else:\n modify_database_object([u''], getattr(book, cc_string), db.cc_classes[c.id],\n calibre_db.session, 'custom')\n calibre_db.session.query(db.Books).filter(db.Books.id == book_id).delete()", "label": 1, "label_name": "safe"} +{"code": " function reparent_standalone() {\r\n $standalone = $this->section->find($this->params['page']);\r\n if ($standalone) {\r\n $standalone->parent = $this->params['parent'];\r\n $standalone->update();\r\n expSession::clearAllUsersSessionCache('navigation');\r\n expHistory::back();\r\n } else {\r\n notfoundController::handle_not_found();\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " foreach($image->expTag as $tag) {\n if (isset($used_tags[$tag->id])) {\n $used_tags[$tag->id]->count++;\n } else {\n $exptag = new expTag($tag->id);\n $used_tags[$tag->id] = $exptag;\n $used_tags[$tag->id]->count = 1;\n }\n\n }", "label": 1, "label_name": "safe"} +{"code": " public function testFilterAbsolutePathBaseDirectory()\n {\n $this->setBase('/foo/');\n $this->assertFiltering('test.php', '/foo/test.php');\n }", "label": 1, "label_name": "safe"} +{"code": " public async Task UpdatePassword(ResetPasswordDto resetPasswordDto)\n {\n _logger.LogInformation(\"{UserName} is changing {ResetUser}'s password\", User.GetUsername(), resetPasswordDto.UserName);\n var user = await _userManager.Users.SingleAsync(x => x.UserName == resetPasswordDto.UserName);\n\n if (resetPasswordDto.UserName != User.GetUsername() && !(User.IsInRole(PolicyConstants.AdminRole) || User.IsInRole(PolicyConstants.ChangePasswordRole)))\n return Unauthorized(\"You are not permitted to this operation.\");\n\n var errors = await _accountService.ChangeUserPassword(user, resetPasswordDto.Password);\n if (errors.Any())\n {\n return BadRequest(errors);\n }\n\n _logger.LogInformation(\"{User}'s Password has been reset\", resetPasswordDto.UserName);\n return Ok();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "char *path_name(struct strbuf *path, const char *name)\n{\n\tstruct strbuf ret = STRBUF_INIT;\n\tif (path)\n\t\tstrbuf_addbuf(&ret, path);\n\tstrbuf_addstr(&ret, name);\n\treturn strbuf_detach(&ret, NULL);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getCause()\n {\n return $this->cause;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tprivate static IRegex getRegexConcat() {\n\t\treturn RegexConcat.build(CommandBinary.class.getName(), RegexLeaf.start(), //\n\t\t\t\tnew RegexOptional( //\n\t\t\t\t\t\tnew RegexConcat( //\n\t\t\t\t\t\t\t\tnew RegexLeaf(\"COMPACT\", \"(compact)\"), //\n\t\t\t\t\t\t\t\tRegexLeaf.spaceOneOrMore())), //\n\t\t\t\tnew RegexLeaf(\"binary\"), //\n\t\t\t\tRegexLeaf.spaceOneOrMore(), //\n\t\t\t\tnew RegexLeaf(\"FULL\", \"[%g]([^%g]+)[%g]\"), //\n\t\t\t\tRegexLeaf.spaceOneOrMore(), //\n\t\t\t\tnew RegexLeaf(\"as\"), //\n\t\t\t\tRegexLeaf.spaceOneOrMore(), //\n\t\t\t\tnew RegexLeaf(\"CODE\", \"([%pLN_.@]+)\"), RegexLeaf.end());\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " labels: templateInstance.topTasks.get().map((task) => task._id),\n datasets: [{\n values: templateInstance.topTasks.get().map((task) => task.count),\n }],\n },\n tooltipOptions: {\n },\n })\n }\n })\n })\n }", "label": 0, "label_name": "vulnerable"} +{"code": "std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\");\n\n string path = _path;\n if (SystemUtilities::isDirectory(path)) {\n path += \"/\" + getFilename();\n\n // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\n string b = SystemUtilities::getCanonicalPath(path);\n if (!String::startsWith(b, a))\n THROW(\"Tar path points outside of the extraction directory: \" << path);\n }\n\n LOG_DEBUG(5, \"Extracting: \" << path);\n\n switch (getType()) {\n case NORMAL_FILE: case CONTIGUOUS_FILE:\n return extract(*SystemUtilities::oopen(path));\n case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n default: THROW(\"Unsupported tar file type \" << getType());\n }\n\n return getFilename();\n}", "label": 1, "label_name": "safe"} +{"code": "\t function update_upcharge() {\n $this->loc->src = \"@globalstoresettings\";\n $config = new expConfig($this->loc);\n\t\t$this->config = $config->config;\n\n\t\t//This will make sure that only the country or region that given a rate value will be saved in the db\n\t\t$upcharge = array();\n\t\tforeach($this->params['upcharge'] as $key => $item) {\n\t\t\tif(!empty($item)) {\n\t\t\t\t$upcharge[$key] = $item;\n\t\t\t}\n\t\t}\n\t\t$this->config['upcharge'] = $upcharge;\n\n $config->update(array('config'=>$this->config));\n flash('message', gt('Configuration updated'));\n expHistory::back();\n }", "label": 1, "label_name": "safe"} +{"code": "\"24px 24px\",oa.style.width=\"34px\",oa.innerText=\"\"):ca||(oa.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\",oa.style.backgroundPosition=\"right 6px center\",oa.style.backgroundRepeat=\"no-repeat\",oa.style.paddingRight=\"22px\");return oa}function B(aa,ca,na,la,oa,ra){var ia=document.createElement(\"a\");ia.className=\"1\"==urlParams.sketch?\"geToolbarButton\":\"geMenuItem\";ia.style.display=\"inline-block\";ia.style.boxSizing=\"border-box\";ia.style.height=\"30px\";ia.style.padding=\"6px\";ia.style.position=\n\"relative\";ia.style.verticalAlign=\"top\";ia.style.top=\"0px\";\"1\"==urlParams.sketch&&(ia.style.borderStyle=\"none\",ia.style.boxShadow=\"none\",ia.style.padding=\"6px\",ia.style.margin=\"0px\");null!=F.statusContainer?R.insertBefore(ia,F.statusContainer):R.appendChild(ia);null!=ra?(ia.style.backgroundImage=\"url(\"+ra+\")\",ia.style.backgroundPosition=\"center center\",ia.style.backgroundRepeat=\"no-repeat\",ia.style.backgroundSize=\"24px 24px\",ia.style.width=\"34px\"):mxUtils.write(ia,aa);mxEvent.addListener(ia,mxClient.IS_POINTER?\n\"pointerdown\":\"mousedown\",mxUtils.bind(this,function(Da){Da.preventDefault()}));mxEvent.addListener(ia,\"click\",function(Da){\"disabled\"!=ia.getAttribute(\"disabled\")&&ca(Da);mxEvent.consume(Da)});null==na&&(ia.style.marginRight=\"4px\");null!=la&&ia.setAttribute(\"title\",la);null!=oa&&(aa=function(){oa.isEnabled()?(ia.removeAttribute(\"disabled\"),ia.style.cursor=\"pointer\"):(ia.setAttribute(\"disabled\",\"disabled\"),ia.style.cursor=\"default\")},oa.addListener(\"stateChanged\",aa),J.addListener(\"enabledChanged\",\naa),aa());return ia}function G(aa,ca,na){na=document.createElement(\"div\");na.className=\"geMenuItem\";na.style.display=\"inline-block\";na.style.verticalAlign=\"top\";na.style.marginRight=\"6px\";na.style.padding=\"0 4px 0 4px\";na.style.height=\"30px\";na.style.position=\"relative\";na.style.top=\"0px\";\"1\"==urlParams.sketch&&(na.style.boxShadow=\"none\");for(var la=0;lasetFoo($this->get('baz'));\n\n $this->services['configured_service'] = $instance = new \\stdClass();\n\n $a->configureStdClass($instance);\n\n return $instance;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int b_unpack (lua_State *L) {\n Header h;\n const char *fmt = luaL_checkstring(L, 1);\n size_t ld;\n const char *data = luaL_checklstring(L, 2, &ld);\n size_t pos = luaL_optinteger(L, 3, 1) - 1;\n defaultoptions(&h);\n lua_settop(L, 2);\n while (*fmt) {\n int opt = *fmt++;\n size_t size = optsize(L, opt, &fmt);\n pos += gettoalign(pos, &h, opt, size);\n luaL_argcheck(L, pos+size <= ld, 2, \"data string too short\");\n luaL_checkstack(L, 1, \"too many results\");\n switch (opt) {\n case 'b': case 'B': case 'h': case 'H':\n case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */\n int issigned = islower(opt);\n lua_Number res = getinteger(data+pos, h.endian, issigned, size);\n lua_pushnumber(L, res);\n break;\n }\n case 'x': {\n break;\n }\n case 'f': {\n float f;\n memcpy(&f, data+pos, size);\n correctbytes((char *)&f, sizeof(f), h.endian);\n lua_pushnumber(L, f);\n break;\n }\n case 'd': {\n double d;\n memcpy(&d, data+pos, size);\n correctbytes((char *)&d, sizeof(d), h.endian);\n lua_pushnumber(L, d);\n break;\n }\n case 'c': {\n if (size == 0) {\n if (!lua_isnumber(L, -1))\n luaL_error(L, \"format `c0' needs a previous size\");\n size = lua_tonumber(L, -1);\n lua_pop(L, 1);\n luaL_argcheck(L, pos+size <= ld, 2, \"data string too short\");\n }\n lua_pushlstring(L, data+pos, size);\n break;\n }\n case 's': {\n const char *e = (const char *)memchr(data+pos, '\\0', ld - pos);\n if (e == NULL)\n luaL_error(L, \"unfinished string in data\");\n size = (e - (data+pos)) + 1;\n lua_pushlstring(L, data+pos, size - 1);\n break;\n }\n default: controloptions(L, opt, &fmt, &h);\n }\n pos += size;\n }\n lua_pushinteger(L, pos + 1);\n return lua_gettop(L) - 2;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "varbit_in(PG_FUNCTION_ARGS)\n{\n\tchar\t *input_string = PG_GETARG_CSTRING(0);\n\n#ifdef NOT_USED\n\tOid\t\t\ttypelem = PG_GETARG_OID(1);\n#endif\n\tint32\t\tatttypmod = PG_GETARG_INT32(2);\n\tVarBit\t *result;\t\t\t/* The resulting bit string\t\t\t */\n\tchar\t *sp;\t\t\t\t/* pointer into the character string */\n\tbits8\t *r;\t\t\t\t/* pointer into the result */\n\tint\t\t\tlen,\t\t\t/* Length of the whole data structure */\n\t\t\t\tbitlen,\t\t\t/* Number of bits in the bit string */\n\t\t\t\tslen;\t\t\t/* Length of the input string\t\t */\n\tbool\t\tbit_not_hex;\t/* false = hex string true = bit string */\n\tint\t\t\tbc;\n\tbits8\t\tx = 0;\n\n\t/* Check that the first character is a b or an x */\n\tif (input_string[0] == 'b' || input_string[0] == 'B')\n\t{\n\t\tbit_not_hex = true;\n\t\tsp = input_string + 1;\n\t}\n\telse if (input_string[0] == 'x' || input_string[0] == 'X')\n\t{\n\t\tbit_not_hex = false;\n\t\tsp = input_string + 1;\n\t}\n\telse\n\t{\n\t\tbit_not_hex = true;\n\t\tsp = input_string;\n\t}\n\n\t/*\n\t * Determine bitlength from input string. MaxAllocSize ensures a regular\n\t * input is small enough, but we must check hex input.\n\t */\n\tslen = strlen(sp);\n\tif (bit_not_hex)\n\t\tbitlen = slen;\n\telse\n\t{\n\t\tif (slen > VARBITMAXLEN / 4)\n\t\t\tereport(ERROR,\n\t\t\t\t\t(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),\n\t\t\t\t errmsg(\"bit string length exceeds the maximum allowed (%d)\",\n\t\t\t\t\t\tVARBITMAXLEN)));\n\t\tbitlen = slen * 4;\n\t}\n\n\t/*\n\t * Sometimes atttypmod is not supplied. If it is supplied we need to make\n\t * sure that the bitstring fits.\n\t */\n\tif (atttypmod <= 0)\n\t\tatttypmod = bitlen;\n\telse if (bitlen > atttypmod)\n\t\tereport(ERROR,\n\t\t\t\t(errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),\n\t\t\t\t errmsg(\"bit string too long for type bit varying(%d)\",\n\t\t\t\t\t\tatttypmod)));\n\n\tlen = VARBITTOTALLEN(bitlen);\n\t/* set to 0 so that *r is always initialised and string is zero-padded */\n\tresult = (VarBit *) palloc0(len);\n\tSET_VARSIZE(result, len);\n\tVARBITLEN(result) = Min(bitlen, atttypmod);\n\n\tr = VARBITS(result);\n\tif (bit_not_hex)\n\t{\n\t\t/* Parse the bit representation of the string */\n\t\t/* We know it fits, as bitlen was compared to atttypmod */\n\t\tx = HIGHBIT;\n\t\tfor (; *sp; sp++)\n\t\t{\n\t\t\tif (*sp == '1')\n\t\t\t\t*r |= x;\n\t\t\telse if (*sp != '0')\n\t\t\t\tereport(ERROR,\n\t\t\t\t\t\t(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),\n\t\t\t\t\t\t errmsg(\"\\\"%c\\\" is not a valid binary digit\",\n\t\t\t\t\t\t\t\t*sp)));\n\n\t\t\tx >>= 1;\n\t\t\tif (x == 0)\n\t\t\t{\n\t\t\t\tx = HIGHBIT;\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t/* Parse the hex representation of the string */\n\t\tfor (bc = 0; *sp; sp++)\n\t\t{\n\t\t\tif (*sp >= '0' && *sp <= '9')\n\t\t\t\tx = (bits8) (*sp - '0');\n\t\t\telse if (*sp >= 'A' && *sp <= 'F')\n\t\t\t\tx = (bits8) (*sp - 'A') + 10;\n\t\t\telse if (*sp >= 'a' && *sp <= 'f')\n\t\t\t\tx = (bits8) (*sp - 'a') + 10;\n\t\t\telse\n\t\t\t\tereport(ERROR,\n\t\t\t\t\t\t(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),\n\t\t\t\t\t\t errmsg(\"\\\"%c\\\" is not a valid hexadecimal digit\",\n\t\t\t\t\t\t\t\t*sp)));\n\n\t\t\tif (bc)\n\t\t\t{\n\t\t\t\t*r++ |= x;\n\t\t\t\tbc = 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t*r = x << 4;\n\t\t\t\tbc = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tPG_RETURN_VARBIT_P(result);\n}", "label": 1, "label_name": "safe"} +{"code": " let writeNext = function() {\n if (pos >= data.length) {\n return body.end();\n }\n let char = data.slice(pos++, pos);\n body.write(char);\n setImmediate(writeNext);\n };", "label": 0, "label_name": "vulnerable"} +{"code": " it \"syncs the cluster\" do\n cluster.should_receive(:sync) do\n cluster.servers << server\n end\n cluster.socket_for :write\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def to_s\n @@string_format % data.unpack(\"C12\")\n end", "label": 1, "label_name": "safe"} +{"code": " def test_rescore_entrance_exam_with_invalid_exam(self):\n \"\"\" Test course has entrance exam id set while re-scoring. \"\"\"\n url = reverse('rescore_entrance_exam', kwargs={'course_id': unicode(self.course.id)})\n response = self.client.get(url, {\n 'unique_student_identifier': self.student.email,\n })\n self.assertEqual(response.status_code, 400)", "label": 0, "label_name": "vulnerable"} +{"code": "if(null!=d&&d==c)return a}for(a=a.firstChild;null!=a;){d=mxUtils.findNode(a,b,c);if(null!=d)return d;a=a.nextSibling}return null},getFunctionName:function(a){var b=null;null!=a&&(null!=a.name?b=a.name:(b=mxUtils.trim(a.toString()),/^function\\s/.test(b)&&(b=mxUtils.ltrim(b.substring(9)),a=b.indexOf(\"(\"),0page);\n}", "label": 1, "label_name": "safe"} +{"code": " private function doCreation(array $project, array $values)\n {\n $values['project_id'] = $project['id'];\n list($valid, ) = $this->actionValidator->validateCreation($values);\n\n if ($valid) {\n if ($this->actionModel->create($values) !== false) {\n $this->flash->success(t('Your automatic action have been created successfully.'));\n } else {\n $this->flash->failure(t('Unable to create your automatic action.'));\n }\n }\n\n $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));\n }", "label": 1, "label_name": "safe"} +{"code": "static inline int check_entry_size_and_hooks(struct arpt_entry *e,\n\t\t\t\t\t struct xt_table_info *newinfo,\n\t\t\t\t\t const unsigned char *base,\n\t\t\t\t\t const unsigned char *limit,\n\t\t\t\t\t const unsigned int *hook_entries,\n\t\t\t\t\t const unsigned int *underflows,\n\t\t\t\t\t unsigned int valid_hooks)\n{\n\tunsigned int h;\n\tint err;\n\n\tif ((unsigned long)e % __alignof__(struct arpt_entry) != 0 ||\n\t (unsigned char *)e + sizeof(struct arpt_entry) >= limit ||\n\t (unsigned char *)e + e->next_offset > limit) {\n\t\tduprintf(\"Bad offset %p\\n\", e);\n\t\treturn -EINVAL;\n\t}\n\n\tif (e->next_offset\n\t < sizeof(struct arpt_entry) + sizeof(struct xt_entry_target)) {\n\t\tduprintf(\"checking: element %p size %u\\n\",\n\t\t\t e, e->next_offset);\n\t\treturn -EINVAL;\n\t}\n\n\terr = check_entry(e);\n\tif (err)\n\t\treturn err;\n\n\t/* Check hooks & underflows */\n\tfor (h = 0; h < NF_ARP_NUMHOOKS; h++) {\n\t\tif (!(valid_hooks & (1 << h)))\n\t\t\tcontinue;\n\t\tif ((unsigned char *)e - base == hook_entries[h])\n\t\t\tnewinfo->hook_entry[h] = hook_entries[h];\n\t\tif ((unsigned char *)e - base == underflows[h]) {\n\t\t\tif (!check_underflow(e)) {\n\t\t\t\tpr_err(\"Underflows must be unconditional and \"\n\t\t\t\t \"use the STANDARD target with \"\n\t\t\t\t \"ACCEPT/DROP\\n\");\n\t\t\t\treturn -EINVAL;\n\t\t\t}\n\t\t\tnewinfo->underflow[h] = underflows[h];\n\t\t}\n\t}\n\n\t/* Clear counters and comefrom */\n\te->counters = ((struct xt_counters) { 0, 0 });\n\te->comefrom = 0;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " } elseif (!empty($this->params['src'])) {\r\n if ($this->params['src'] == $loc->src) {\r\n $this->config = $config->config;\r\n break;\r\n }\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " public function remove()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $category = $this->getCategory($project);\n\n if ($this->categoryModel->remove($category['id'])) {\n $this->flash->success(t('Category removed successfully.'));\n } else {\n $this->flash->failure(t('Unable to remove this category.'));\n }\n\n $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));\n }", "label": 1, "label_name": "safe"} +{"code": "static struct kioctx *ioctx_alloc(unsigned nr_events)\n{\n\tstruct mm_struct *mm = current->mm;\n\tstruct kioctx *ctx;\n\tint err = -ENOMEM;\n\n\t/*\n\t * We keep track of the number of available ringbuffer slots, to prevent\n\t * overflow (reqs_available), and we also use percpu counters for this.\n\t *\n\t * So since up to half the slots might be on other cpu's percpu counters\n\t * and unavailable, double nr_events so userspace sees what they\n\t * expected: additionally, we move req_batch slots to/from percpu\n\t * counters at a time, so make sure that isn't 0:\n\t */\n\tnr_events = max(nr_events, num_possible_cpus() * 4);\n\tnr_events *= 2;\n\n\t/* Prevent overflows */\n\tif ((nr_events > (0x10000000U / sizeof(struct io_event))) ||\n\t (nr_events > (0x10000000U / sizeof(struct kiocb)))) {\n\t\tpr_debug(\"ENOMEM: nr_events too high\\n\");\n\t\treturn ERR_PTR(-EINVAL);\n\t}\n\n\tif (!nr_events || (unsigned long)nr_events > (aio_max_nr * 2UL))\n\t\treturn ERR_PTR(-EAGAIN);\n\n\tctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);\n\tif (!ctx)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\tctx->max_reqs = nr_events;\n\n\tif (percpu_ref_init(&ctx->users, free_ioctx_users))\n\t\tgoto err;\n\n\tif (percpu_ref_init(&ctx->reqs, free_ioctx_reqs))\n\t\tgoto err;\n\n\tspin_lock_init(&ctx->ctx_lock);\n\tspin_lock_init(&ctx->completion_lock);\n\tmutex_init(&ctx->ring_lock);\n\tinit_waitqueue_head(&ctx->wait);\n\n\tINIT_LIST_HEAD(&ctx->active_reqs);\n\n\tctx->cpu = alloc_percpu(struct kioctx_cpu);\n\tif (!ctx->cpu)\n\t\tgoto err;\n\n\tif (aio_setup_ring(ctx) < 0)\n\t\tgoto err;\n\n\tatomic_set(&ctx->reqs_available, ctx->nr_events - 1);\n\tctx->req_batch = (ctx->nr_events - 1) / (num_possible_cpus() * 4);\n\tif (ctx->req_batch < 1)\n\t\tctx->req_batch = 1;\n\n\t/* limit the number of system wide aios */\n\tspin_lock(&aio_nr_lock);\n\tif (aio_nr + nr_events > (aio_max_nr * 2UL) ||\n\t aio_nr + nr_events < aio_nr) {\n\t\tspin_unlock(&aio_nr_lock);\n\t\terr = -EAGAIN;\n\t\tgoto err;\n\t}\n\taio_nr += ctx->max_reqs;\n\tspin_unlock(&aio_nr_lock);\n\n\tpercpu_ref_get(&ctx->users); /* io_setup() will drop this ref */\n\n\terr = ioctx_add_table(ctx, mm);\n\tif (err)\n\t\tgoto err_cleanup;\n\n\tpr_debug(\"allocated ioctx %p[%ld]: mm=%p mask=0x%x\\n\",\n\t\t ctx, ctx->user_id, mm, ctx->nr_events);\n\treturn ctx;\n\nerr_cleanup:\n\taio_nr_sub(ctx->max_reqs);\nerr:\n\taio_free_ring(ctx);\n\tfree_percpu(ctx->cpu);\n\tfree_percpu(ctx->reqs.pcpu_count);\n\tfree_percpu(ctx->users.pcpu_count);\n\tkmem_cache_free(kioctx_cachep, ctx);\n\tpr_debug(\"error allocating ioctx %d\\n\", err);\n\treturn ERR_PTR(err);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "(function(){var b=new mxObjectCodec(new ChangeGridColor,[\"ui\"]);b.beforeDecode=function(f,l,d){d.ui=f.ui;return l};mxCodecRegistry.register(b)})();(function(){EditorUi.VERSION=\"19.0.2\";EditorUi.compactUi=\"atlas\"!=uiTheme;Editor.isDarkMode()&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);EditorUi.enableLogging=\"1\"!=urlParams.stealth&&\"1\"!=urlParams.lockdown&&(/.*\\.draw\\.io$/.test(window.location.hostname)||/.*\\.diagrams\\.net$/.test(window.location.hostname))&&\"support.draw.io\"!=window.location.hostname;EditorUi.drawHost=window.DRAWIO_BASE_URL;EditorUi.lightboxHost=window.DRAWIO_LIGHTBOX_URL;EditorUi.lastErrorMessage=", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t$item = array();\n\t\t\t\t$item['id'] = $incident->id;\n\t\t\t\t$item['title'] = $incident->incident_title;\n\t\t\t\t$item['link'] = $site_url.'reports/view/'.$incident->id;\n\t\t\t\t$item['description'] = $incident->incident_description;\n\t\t\t\t$item['date'] = $incident->incident_date;\n\t\t\t\t$item['categories'] = $categories;\n\t\t\t\t\n\t\t\t\tif\n\t\t\t\t(\n\t\t\t\t\t$incident->location_id != 0 AND\n\t\t\t\t\t$incident->location->longitude AND\n\t\t\t\t\t$incident->location->latitude\n\t\t\t\t)\n\t\t\t\t{\n\t\t\t\t\t$item['point'] = array(\n\t\t\t\t\t\t$incident->location->latitude,\n\t\t\t\t\t $incident->location->longitude\n\t\t\t\t\t);\n\t\t\t\t\t$items[] = $item;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$cache->set($subdomain.'_feed_'.$limit.'_'.$page, $items, array('feed'), 3600); // 1 Hour\n\t\t\t$feed_items = $items;\n\t\t}\n\n\t\t$feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/';\n\n\t\t//header(\"Content-Type: text/xml; charset=utf-8\");\n\t\t$view = new View('feed/'.$feedtype);\n\t\t$view->feed_title = Kohana::config('settings.site_name');\n\t\t$view->site_url = $site_url;\n\t\t$view->georss = 1; // this adds georss namespace in the feed\n\t\t$view->feed_url = $site_url.$feedpath;\n\t\t$view->feed_date = gmdate(\"D, d M Y H:i:s T\", time());\n\t\t$view->feed_description = Kohana::lang('ui_admin.incident_feed').' '.Kohana::config('settings.site_name');\n\t\t$view->items = $feed_items;\n\t\t$view->render(TRUE);\n\t}", "label": 1, "label_name": "safe"} +{"code": " it 'should create a puppi::rollback step file' do\n should contain_file('/etc/puppi/projects/myapp/rollback/50-get').with_ensure('present')\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static void ext2_put_super (struct super_block * sb)\n{\n\tint db_count;\n\tint i;\n\tstruct ext2_sb_info *sbi = EXT2_SB(sb);\n\n\tdquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);\n\n\text2_xattr_put_super(sb);\n\tif (!(sb->s_flags & MS_RDONLY)) {\n\t\tstruct ext2_super_block *es = sbi->s_es;\n\n\t\tspin_lock(&sbi->s_lock);\n\t\tes->s_state = cpu_to_le16(sbi->s_mount_state);\n\t\tspin_unlock(&sbi->s_lock);\n\t\text2_sync_super(sb, es, 1);\n\t}\n\tdb_count = sbi->s_gdb_count;\n\tfor (i = 0; i < db_count; i++)\n\t\tif (sbi->s_group_desc[i])\n\t\t\tbrelse (sbi->s_group_desc[i]);\n\tkfree(sbi->s_group_desc);\n\tkfree(sbi->s_debts);\n\tpercpu_counter_destroy(&sbi->s_freeblocks_counter);\n\tpercpu_counter_destroy(&sbi->s_freeinodes_counter);\n\tpercpu_counter_destroy(&sbi->s_dirs_counter);\n\tbrelse (sbi->s_sbh);\n\tsb->s_fs_info = NULL;\n\tkfree(sbi->s_blockgroup_lock);\n\tkfree(sbi);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def group\n Log.add_info(request, params.inspect)\n\n date_s = params[:date]\n if date_s.nil? or date_s.empty?\n @date = Date.today\n else\n @date = Date.parse(date_s)\n end\n\n @group_id = params[:id]\n group_users = Group.get_users(params[:id])\n\n @user_schedule_hash = {}\n unless group_users.nil?\n @holidays = Schedule.get_holidays\n group_users.each do |user|\n @user_schedule_hash[user.id.to_s] = Schedule.get_somebody_week(@login_user, user.id, @date, @holidays)\n end\n end\n\n params[:display] = params[:action] + '_' + params[:id]\n end", "label": 0, "label_name": "vulnerable"} +{"code": " void newDocumentWebHomeFromURLTemplateProviderSpecifiedTerminal() throws Exception\n {\n // new document = xwiki:X.Y.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"X\", \"Y\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(true);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Specifying a template provider in the URL: templateprovider=XWiki.MyTemplateProvider\n String templateProviderFullName = \"XWiki.MyTemplateProvider\";\n when(mockRequest.getParameter(\"templateprovider\")).thenReturn(templateProviderFullName);\n\n // Mock 1 existing template provider\n mockExistingTemplateProviders(templateProviderFullName,\n new DocumentReference(\"xwiki\", Arrays.asList(\"XWiki\"), \"MyTemplateProvider\"), Collections.emptyList(),\n true);\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: We are creating the document X.Y as terminal and using a template, as specified in the template\n // provider.\n verify(mockURLFactory).createURL(\"X\", \"Y\", \"edit\", \"template=XWiki.MyTemplate&parent=Main.WebHome&title=Y\",\n null, \"xwiki\", context);\n }", "label": 1, "label_name": "safe"} +{"code": " it \"sets the current database\" do\n session.should_receive(:set_current_database).with(:admin)\n session.use :admin\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tselected: function(elem){\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\telem.parentNode.selectedIndex;\n\t\t\treturn elem.selected === true;\n\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": " public static function remove_all($object_type, $object_id)\r\n {\r\n global $DB;\r\n global $website;\r\n\r\n $DB->execute('\r\n DELETE FROM nv_notes\r\n WHERE website = '.protect($website->id).'\r\n AND item_type = '.protect($object_type).'\r\n AND item_id = '.protect($object_id).'\r\n LIMIT 1'\r\n );\r\n\r\n return 'true';\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "function db_properties($table)\n{\tglobal $DatabaseType,$DatabaseUsername;\n\n\tswitch($DatabaseType)\n\t{\n\t\tcase 'mysqli':\n\t\t\t$result = DBQuery(\"SHOW COLUMNS FROM $table\");\n\t\t\twhile($row = db_fetch_row($result))\n\t\t\t{\n\t\t\t\t$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'],strpos($row['TYPE'],'('));\n\t\t\t\tif(!$pos = strpos($row['TYPE'],','))\n\t\t\t\t\t$pos = strpos($row['TYPE'],')');\n\t\t\t\telse\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'],$pos+1);\n\n\t\t\t\t$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'],strpos($row['TYPE'],'(')+1,$pos);\n\n\t\t\t\tif($row['NULL']!='')\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['NULL'] = \"Y\";\n\t\t\t\telse\n\t\t\t\t\t$properties[strtoupper($row['FIELD'])]['NULL'] = \"N\";\n\t\t\t}\n\t\tbreak;\n\t}\n\treturn $properties;\n}", "label": 1, "label_name": "safe"} +{"code": "\t\tfile: function(elem){\n\t\t\treturn \"file\" === elem.type;\n\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteUnpackParams* data =\n reinterpret_cast(node->builtin_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), data->num);\n\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input));\n TF_LITE_ENSURE(context, NumElements(input) > 0);\n int axis = data->axis;\n if (axis < 0) {\n axis += NumDimensions(input);\n }\n TF_LITE_ENSURE(context, 0 <= axis && axis < NumDimensions(input));\n if (input->type != kTfLiteInt32 && input->type != kTfLiteFloat32 &&\n input->type != kTfLiteUInt8 && input->type != kTfLiteInt8 &&\n input->type != kTfLiteInt16 && input->type != kTfLiteBool) {\n context->ReportError(context, \"Type '%s' is not supported by unpack.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n\n const TfLiteIntArray* input_shape = input->dims;\n // Num should be equal to the shape[axis].\n // Resize outputs. rank will be R - 1.\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(input) - 1);\n int o = 0;\n for (int index = 0; index < NumDimensions(input); ++index) {\n if (index != axis) {\n output_shape->data[o++] = input_shape->data[index];\n }\n }\n\n TF_LITE_ENSURE_EQ(context, data->num, input_shape->data[axis]);\n for (int i = 0; i < data->num; ++i) {\n TfLiteIntArray* copied_output_shape = TfLiteIntArrayCopy(output_shape);\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, i, &output));\n TF_LITE_ENSURE_TYPES_EQ(context, output->type, input->type);\n // Guarantee input/output quantization params match as we do not support\n // rescaling of unpacked quantized tensors.\n TF_LITE_ENSURE_EQ(context, input->params.zero_point,\n output->params.zero_point);\n TF_LITE_ENSURE_EQ(context, input->params.scale, output->params.scale);\n TF_LITE_ENSURE_OK(\n context, context->ResizeTensor(context, output, copied_output_shape));\n }\n\n TfLiteIntArrayFree(output_shape);\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": "const addReplyToEvent = (event: any) => {\n const { processId, frameId } = event;\n event.reply = (...args: any[]) => {\n event.sender.sendToFrame([processId, frameId], ...args);\n };\n};", "label": 1, "label_name": "safe"} +{"code": " $criteria->addCondition (\"\n $userCondition OR\n user IN (\n SELECT DISTINCT b.username \n FROM x2_group_to_user a JOIN x2_group_to_user b \n ON a.groupId=b.groupId \n WHERE a.username=:getAccessCriteria_username\n ) OR (\n associationType='User' AND associationId in (\n SELECT DISTINCT b.id\n FROM x2_group_to_user a JOIN x2_group_to_user b\n ON a.groupId=b.groupId\n WHERE a.userId=:getAccessCriteria_userId\n )\n )\");\n } else { // default history privacy (public or assigned)\n $criteria->addCondition (\"\n $userCondition OR visibility=1\n \");\n }\n }\n\n if ($profile) {\n $criteria->params[':getAccessCriteria_profileUsername'] = $profile->username;\n /* only show events associated with current profile which current user has\n permission to see */\n $criteria->addCondition (\"user=:getAccessCriteria_profileUsername\");\n if (!Yii::app()->params->isAdmin) {\n $criteria->addCondition (\"visibility=1\");\n }\n }\n return $criteria;\n }", "label": 1, "label_name": "safe"} +{"code": "\"\",fa=0;fa_storage)) {\n trigger_error(\n \"Name $name produces collision, cannot re-register\",\n E_USER_ERROR\n );\n return;\n }\n $this->_storage[$name] =& $ref;\n }", "label": 1, "label_name": "safe"} +{"code": " public function __viewIndex()\n {\n $this->setPageType('table');\n $this->setTitle(__('%1$s – %2$s', array(__('Pages'), __('Symphony'))));\n\n $nesting = Symphony::Configuration()->get('pages_table_nest_children', 'symphony') == 'yes';\n\n if ($nesting && isset($_GET['parent']) && is_numeric($_GET['parent'])) {\n $parent = PageManager::fetchPageByID((int)$_GET['parent'], array('title', 'id'));\n }\n\n $this->appendSubheading(\n isset($parent)\n ? General::sanitize($parent['title'])\n : __('Pages'),\n Widget::Anchor(\n __('Create New'),\n Administration::instance()->getCurrentPageURL() . 'new/' . ($nesting && isset($parent) ? \"?parent={$parent['id']}\" : null),\n __('Create a new page'),\n 'create button',\n null,\n ['accesskey' => 'c']\n )\n );", "label": 1, "label_name": "safe"} +{"code": "Client.prototype.openssh_forwardInStreamLocal = function(socketPath, cb) {\n if (!this._sock\n || !this._sock.writable\n || !this._sshstream\n || !this._sshstream.writable)\n throw new Error('Not connected');\n\n var wantReply = (typeof cb === 'function');\n var self = this;\n\n if (!this.config.strictVendor\n || (this.config.strictVendor && RE_OPENSSH.test(this._remoteVer))) {\n if (wantReply) {\n this._callbacks.push(function(had_err) {\n if (had_err) {\n return cb(had_err !== true\n ? had_err\n : new Error('Unable to bind to ' + socketPath));\n }\n self._forwardingUnix[socketPath] = true;\n cb();\n });\n }\n\n return this._sshstream.openssh_streamLocalForward(socketPath, wantReply);\n } else if (wantReply) {\n process.nextTick(function() {\n cb(new Error('strictVendor enabled and server is not OpenSSH or compatible version'));\n });\n }\n\n return true;\n};", "label": 0, "label_name": "vulnerable"} +{"code": " it \"returns the right category group permissions for a user that can edit the category\" do\n SiteSetting.moderators_manage_categories_and_groups = true\n user.update!(moderator: true)\n\n json = described_class.new(category, scope: Guardian.new(user), root: false).as_json\n\n expect(json[:group_permissions]).to eq([\n { permission_type: CategoryGroup.permission_types[:readonly], group_name: group.name },\n { permission_type: CategoryGroup.permission_types[:full], group_name: private_group.name },\n { permission_type: CategoryGroup.permission_types[:full], group_name: user_group.name },\n { permission_type: CategoryGroup.permission_types[:readonly], group_name: 'everyone' },\n ])\n end", "label": 1, "label_name": "safe"} +{"code": " def self.trim(user_id, mail_account_id, max)\n\n SqlHelper.validate_token([user_id, mail_account_id])\n\n begin\n count = Email.where(\"mail_account_id=#{mail_account_id}\").count\n if count > max\n#logger.fatal(\"[INFO] Email.trim(user_id:#{user_id}, mail_account_id:#{mail_account_id}, max:#{max})\")\n over_num = count - max\n emails = []\n\n # First, empty Trashbox\n user = User.find(user_id)\n trashbox = MailFolder.get_for(user, mail_account_id, MailFolder::XTYPE_TRASH)\n trash_nodes = [trashbox.id.to_s]\n trash_nodes += MailFolder.get_childs(trash_nodes.first, true, false)\n con = \"mail_folder_id in (#{trash_nodes.join(',')})\"\n emails = Email.where(con).order('updated_at ASC').limit(over_num).to_a\n\n # Now, remove others\n if emails.length < over_num\n over_num -= emails.length\n emails += Email.where(\"mail_account_id=#{mail_account_id}\").order('updated_at ASC').limit(over_num).to_a\n end\n\n emails.each do |email|\n email.destroy\n end\n end\n rescue\n end\n end", "label": 1, "label_name": "safe"} +{"code": " public function validate($v, $config, $context)\n {\n return $this->clone->validate($v, $config, $context);\n }", "label": 1, "label_name": "safe"} +{"code": " def test_reset_entrance_exam_student_attempts_single(self):\n \"\"\" Test reset single student attempts for entrance exam. \"\"\"\n url = reverse('reset_student_attempts_for_entrance_exam',\n kwargs={'course_id': unicode(self.course.id)})\n response = self.client.post(url, {\n 'unique_student_identifier': self.student.email,\n })\n self.assertEqual(response.status_code, 200)\n # make sure problem attempts have been reset.\n changed_modules = StudentModule.objects.filter(module_state_key__in=self.ee_modules)\n for changed_module in changed_modules:\n self.assertEqual(\n json.loads(changed_module.state)['attempts'],\n 0\n )", "label": 1, "label_name": "safe"} +{"code": "static RList *r_bin_wasm_get_data_entries (RBinWasmObj *bin, RBinWasmSection *sec) {\n\tRList *ret = NULL;\n\tRBinWasmDataEntry *ptr = NULL;\n\tut32 len = sec->payload_len;\n\n\tif (!(ret = r_list_newf ((RListFree)free))) {\n\t\treturn NULL;\n\t}\n\n\tut8* buf = bin->buf->buf + (ut32)sec->payload_data;\n\tint buflen = bin->buf->length - (ut32)sec->payload_data;\n\tut32 count = sec->count;\n\tut32 i = 0, r = 0;\n\tsize_t n = 0;\n\n\twhile (i < len && len < buflen && r < count) {\n\t\tif (!(ptr = R_NEW0 (RBinWasmDataEntry))) {\n\t\t\treturn ret;\n\t\t}\n\t\tif (!(consume_u32 (buf + i, buf + len, &ptr->index, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tif (i + 4 >= buflen) {\n\t\t\tgoto beach;\n\t\t}\n\t\tif (!(n = consume_init_expr (buf + i, buf + len, R_BIN_WASM_END_OF_CODE, NULL, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tptr->offset.len = n;\n\t\tif (!(consume_u32 (buf + i, buf + len, &ptr->size, &i))) {\t\n\t\t\tgoto beach;\n\t\t}\n\t\tif (i + 4 >= buflen) {\n\t\t\tgoto beach;\n\t\t}\n\t\tptr->data = sec->payload_data + i;\n\n\t\tr_list_append (ret, ptr);\n\n\t\tr += 1;\n\n\t}\n\treturn ret;\nbeach:\n\tfree (ptr);\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,\n\t\t\t int mode)\n{\n\tstruct gfs2_inode *ip = GFS2_I(inode);\n\tstruct buffer_head *dibh;\n\tint error;\n\tunsigned int nr_blks;\n\tsector_t lblock = offset >> inode->i_blkbits;\n\n\terror = gfs2_meta_inode_buffer(ip, &dibh);\n\tif (unlikely(error))\n\t\treturn error;\n\n\tgfs2_trans_add_bh(ip->i_gl, dibh, 1);\n\n\tif (gfs2_is_stuffed(ip)) {\n\t\terror = gfs2_unstuff_dinode(ip, NULL);\n\t\tif (unlikely(error))\n\t\t\tgoto out;\n\t}\n\n\twhile (len) {\n\t\tstruct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };\n\t\tbh_map.b_size = len;\n\t\tset_buffer_zeronew(&bh_map);\n\n\t\terror = gfs2_block_map(inode, lblock, &bh_map, 1);\n\t\tif (unlikely(error))\n\t\t\tgoto out;\n\t\tlen -= bh_map.b_size;\n\t\tnr_blks = bh_map.b_size >> inode->i_blkbits;\n\t\tlblock += nr_blks;\n\t\tif (!buffer_new(&bh_map))\n\t\t\tcontinue;\n\t\tif (unlikely(!buffer_zeronew(&bh_map))) {\n\t\t\terror = -EIO;\n\t\t\tgoto out;\n\t\t}\n\t}\n\tif (offset + len > inode->i_size && !(mode & FALLOC_FL_KEEP_SIZE))\n\t\ti_size_write(inode, offset + len);\n\n\tmark_inode_dirty(inode);\n\nout:\n\tbrelse(dibh);\n\treturn error;\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic function delete() {\n\t global $db;\n\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];\n\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('Missing id for the comment you would like to delete'));\n\t expHistory::back();\n\t }\n\n\t // delete the comment\n $comment = new expComment($this->params['id']);\n $comment->delete();\n\n // delete the association too\n $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']);\n\n // send the user back where they came from.\n expHistory::back();\n\t}", "label": 1, "label_name": "safe"} +{"code": "var O=mxText.prototype.redraw;mxText.prototype.redraw=function(){O.apply(this,arguments);null!=this.node&&\"DIV\"==this.node.nodeName&&Graph.processFontAttributes(this.node)};Graph.prototype.createTagsDialog=function(u,D,K){function T(){for(var ja=R.getSelectionCells(),Ba=[],Da=0;Dan_counter; ++i) {\n\t\tevent = cpuhw->event[i];\n\n\t\tval = read_pmc(i);\n\t\tif ((int)val < 0) {\n\t\t\tif (event) {\n\t\t\t\t/* event has overflowed */\n\t\t\t\tfound = 1;\n\t\t\t\trecord_and_restart(event, val, regs);\n\t\t\t} else {\n\t\t\t\t/*\n\t\t\t\t * Disabled counter is negative,\n\t\t\t\t * reset it just in case.\n\t\t\t\t */\n\t\t\t\twrite_pmc(i, 0);\n\t\t\t}\n\t\t}\n\t}\n\n\t/* PMM will keep counters frozen until we return from the interrupt. */\n\tmtmsr(mfmsr() | MSR_PMM);\n\tmtpmr(PMRN_PMGC0, PMGC0_PMIE | PMGC0_FCECE);\n\tisync();\n\n\tif (nmi)\n\t\tnmi_exit();\n\telse\n\t\tirq_exit();\n}", "label": 1, "label_name": "safe"} +{"code": "string encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key) {\n CHECK_STATE(errStatus);\n CHECK_STATE(err_string);\n CHECK_STATE(_key);\n auto keyArray = make_shared>(BUF_LEN, 0);\n auto encryptedKey = make_shared>(BUF_LEN, 0);\n\n vector errMsg(BUF_LEN, 0);\n\n strncpy(keyArray->data(), _key, BUF_LEN);\n *errStatus = 0;\n unsigned int encryptedLen = 0;\n\n sgx_status_t status = trustedEncryptKeyAES(eid, errStatus, errMsg.data(), keyArray->data(), encryptedKey->data(), &encryptedLen);\n\n HANDLE_TRUSTED_FUNCTION_ERROR(status, *errStatus, errMsg.data());\n\n SAFE_CHAR_BUF(resultBuf, 2 * BUF_LEN + 1);\n\n carray2Hex(encryptedKey->data(), encryptedLen, resultBuf, 2 * BUF_LEN + 1);\n\n return string(resultBuf);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getBalanceTransactionReference()\n {\n return $this->getParameter('balanceTransactionReference');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "R_API bool r_sys_mkdirp(const char *dir) {\n\tbool ret = true;\n\tchar slash = R_SYS_DIR[0];\n\tchar *path = strdup (dir), *ptr = path;\n\tif (!path) {\n\t\teprintf (\"r_sys_mkdirp: Unable to allocate memory\\n\");\n\t\treturn false;\n\t}\n\tif (*ptr == slash) {\n\t\tptr++;\n\t}\n#if __WINDOWS__\n\t{\n\t\tchar *p = strstr (ptr, \":\\\\\");\n\t\tif (p) {\n\t\t\tptr = p + 3;\n\t\t}\n\t}\n#endif\n\tfor (;;) {\n\t\t// find next slash\n\t\tfor (; *ptr; ptr++) {\n\t\t\tif (*ptr == '/' || *ptr == '\\\\') {\n\t\t\t\tslash = *ptr;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!*ptr) {\n\t\t\tbreak;\n\t\t}\n\t\t*ptr = 0;\n\t\tif (!r_sys_mkdir (path) && r_sys_mkdir_failed ()) {\n\t\t\teprintf (\"r_sys_mkdirp: fail '%s' of '%s'\\n\", path, dir);\n\t\t\tfree (path);\n\t\t\treturn false;\n\t\t}\n\t\t*ptr = slash;\n\t\tptr++;\n\t}\n\tif (!r_sys_mkdir (path) && r_sys_mkdir_failed ()) {\n\t\tret = false;\n\t}\n\tfree (path);\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "def validate_and_sanitize_search_inputs(fn, instance, args, kwargs):\n\tkwargs.update(dict(zip(fn.__code__.co_varnames, args)))\n\tsanitize_searchfield(kwargs['searchfield'])\n\tkwargs['start'] = cint(kwargs['start'])\n\tkwargs['page_len'] = cint(kwargs['page_len'])\n\n\tif kwargs['doctype'] and not frappe.db.exists('DocType', kwargs['doctype']):\n\t\treturn []\n\n\treturn fn(**kwargs)", "label": 1, "label_name": "safe"} +{"code": " private function scale($r, $scale)\n {\n if ($scale < 0) {\n // The f sprintf type doesn't support negative numbers, so we\n // need to cludge things manually. First get the string.\n $r = sprintf('%.0f', (float)$r);\n // Due to floating point precision loss, $r will more than likely\n // look something like 4652999999999.9234. We grab one more digit\n // than we need to precise from $r and then use that to round\n // appropriately.\n $precise = (string)round(substr($r, 0, strlen($r) + $scale), -1);\n // Now we return it, truncating the zero that was rounded off.\n return substr($precise, 0, -1) . str_repeat('0', -$scale + 1);\n }\n return sprintf('%.' . $scale . 'f', (float)$r);\n }", "label": 1, "label_name": "safe"} +{"code": " public function testAssertAlnumFail()\n {\n $this->expectValidationException(\"Property in context must be alphanumeric\");\n $this->makeAtom('%a')->assertAlnum();\n }", "label": 1, "label_name": "safe"} +{"code": "func TestResolveChartRef(t *testing.T) {\n\ttests := []struct {\n\t\tname, ref, expect, version string\n\t\tfail bool\n\t}{\n\t\t{name: \"full URL\", ref: \"http://example.com/foo-1.2.3.tgz\", expect: \"http://example.com/foo-1.2.3.tgz\"},\n\t\t{name: \"full URL, HTTPS\", ref: \"https://example.com/foo-1.2.3.tgz\", expect: \"https://example.com/foo-1.2.3.tgz\"},\n\t\t{name: \"full URL, with authentication\", ref: \"http://username:password@example.com/foo-1.2.3.tgz\", expect: \"http://username:password@example.com/foo-1.2.3.tgz\"},\n\t\t{name: \"reference, testing repo\", ref: \"testing/alpine\", expect: \"http://example.com/alpine-1.2.3.tgz\"},\n\t\t{name: \"reference, version, testing repo\", ref: \"testing/alpine\", version: \"0.2.0\", expect: \"http://example.com/alpine-0.2.0.tgz\"},\n\t\t{name: \"reference, version, malformed repo\", ref: \"malformed/alpine\", version: \"1.2.3\", expect: \"http://dl.example.com/alpine-1.2.3.tgz\"},\n\t\t{name: \"reference, querystring repo\", ref: \"testing-querystring/alpine\", expect: \"http://example.com/alpine-1.2.3.tgz?key=value\"},\n\t\t{name: \"reference, testing-relative repo\", ref: \"testing-relative/foo\", expect: \"http://example.com/helm/charts/foo-1.2.3.tgz\"},\n\t\t{name: \"reference, testing-relative repo\", ref: \"testing-relative/bar\", expect: \"http://example.com/helm/bar-1.2.3.tgz\"},\n\t\t{name: \"reference, testing-relative-trailing-slash repo\", ref: \"testing-relative-trailing-slash/foo\", expect: \"http://example.com/helm/charts/foo-1.2.3.tgz\"},\n\t\t{name: \"reference, testing-relative-trailing-slash repo\", ref: \"testing-relative-trailing-slash/bar\", expect: \"http://example.com/helm/bar-1.2.3.tgz\"},\n\t\t{name: \"full URL, HTTPS, irrelevant version\", ref: \"https://example.com/foo-1.2.3.tgz\", version: \"0.1.0\", expect: \"https://example.com/foo-1.2.3.tgz\", fail: true},\n\t\t{name: \"full URL, file\", ref: \"file:///foo-1.2.3.tgz\", fail: true},\n\t\t{name: \"invalid\", ref: \"invalid-1.2.3\", fail: true},\n\t\t{name: \"not found\", ref: \"nosuchthing/invalid-1.2.3\", fail: true},\n\t}\n\n\tc := ChartDownloader{\n\t\tOut: os.Stderr,\n\t\tRepositoryConfig: repoConfig,\n\t\tRepositoryCache: repoCache,\n\t\tGetters: getter.All(&cli.EnvSettings{\n\t\t\tRepositoryConfig: repoConfig,\n\t\t\tRepositoryCache: repoCache,\n\t\t}),\n\t}\n\n\tfor _, tt := range tests {\n\t\tu, err := c.ResolveChartVersion(tt.ref, tt.version)\n\t\tif err != nil {\n\t\t\tif tt.fail {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tt.Errorf(\"%s: failed with error %s\", tt.name, err)\n\t\t\tcontinue\n\t\t}\n\t\tif got := u.String(); got != tt.expect {\n\t\t\tt.Errorf(\"%s: expected %s, got %s\", tt.name, tt.expect, got)\n\t\t}\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_converter/show', array(\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func isRepositoryGitPath(path string) bool {\n\treturn strings.HasSuffix(path, \".git\") ||\n\t\tstrings.Contains(path, \".git/\") ||\n\t\tstrings.Contains(path, `.git\\`) ||\n\t\t// Windows treats \".git.\" the same as \".git\"\n\t\tstrings.HasSuffix(path, \".git.\") ||\n\t\tstrings.Contains(path, \".git./\") ||\n\t\tstrings.Contains(path, `.git.\\`)\n}", "label": 1, "label_name": "safe"} +{"code": " private static function title_case_upper($s)\n {\n return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');\n }", "label": 1, "label_name": "safe"} +{"code": "Graph.sanitizeHtml = function(value, editing)\n{\n\treturn DOMPurify.sanitize(value, {ADD_ATTR: ['target'], FORBID_TAGS: ['form'],\n\t\tALLOWED_URI_REGEXP: /^(?:(?:https?|mailto|tel|callto|data):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i});\n};", "label": 0, "label_name": "vulnerable"} +{"code": " $BMCreateButtonNVP .= $BMButtonVarValue != '' ? \"&L_BUTTONVAR\" . $n . \"=\" . urlencode($BMButtonVarName . \"=\" . $BMButtonVarValue) : \"\";\n if($BMButtonVarValue != '')\n {\n $BMCreateButtonNVP .= \"&L_BUTTONVAR\" . $n . \"=\" . urlencode($BMButtonVarName . \"=\" . $BMButtonVarValue);\n $n++;\n }\n }\n\n $n = 0;\n $BMButtonOptions = isset($DataArray['BMButtonOptions']) ? $DataArray['BMButtonOptions'] : array();\n foreach($BMButtonOptions as $BMButtonOption)\n {\n $n_selection = 0;\n\n $ButtonOptionName = $BMButtonOption['name'];\n $ButtonOptionSelections = $BMButtonOption['selections'];\n\n $BMCreateButtonNVP .= '&OPTION'. $n . 'NAME=' . $ButtonOptionName;\n foreach($ButtonOptionSelections as $ButtonOptionSelection)\n {\n $BMCreateButtonNVP .= $ButtonOptionSelection['value'] != '' ? '&L_OPTION' . $n . 'SELECT' . $n_selection . '=' . urlencode($ButtonOptionSelection['value']) : '';\n $BMCreateButtonNVP .= $ButtonOptionSelection['price'] != '' ? '&L_OPTION' . $n . 'PRICE' . $n_selection . '=' . urlencode($ButtonOptionSelection['price']) : '';\n $BMCreateButtonNVP .= $ButtonOptionSelection['type'] != '' ? '&L_OPTION' . $n . 'TYPE' . $n_selection . '=' . urlencode($ButtonOptionSelection['type']) : '';\n\n $n_selection++;\n }\n\n $n++;\n }\n\n $NVPRequest = $this->NVPCredentials . $BMCreateButtonNVP;\n $NVPResponse = $this->CURLRequest($NVPRequest);\n $NVPRequestArray = $this->NVPToArray($NVPRequest);\n $NVPResponseArray = $this->NVPToArray($NVPResponse);\n\n $Errors = $this->GetErrors($NVPResponseArray);\n\n $this->Logger($this->LogPath, __FUNCTION__.'Request', $this->MaskAPIResult($NVPRequest));\n $this->Logger($this->LogPath, __FUNCTION__.'Response', $NVPResponse);\n\n $NVPResponseArray['ERRORS'] = $Errors;\n $NVPResponseArray['REQUESTDATA'] = $NVPRequestArray;\n $NVPResponseArray['RAWREQUEST'] = $NVPRequest;\n $NVPResponseArray['RAWRESPONSE'] = $NVPResponse;\n\n return $NVPResponseArray;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def _test_for_malicious_tarball(path, filename):\n \"\"\"Raises exception if extracting tarball would escape extract path\"\"\"\n tar_file = tarfile.open(filename, 'r|gz')\n for n in tar_file.getnames():\n if not os.path.abspath(os.path.join(path, n)).startswith(path):\n tar_file.close()\n raise exception.Error(_('Unsafe filenames in image'))\n tar_file.close()", "label": 1, "label_name": "safe"} +{"code": "static int __pyx_pf_17clickhouse_driver_14bufferedreader_14BufferedReader_8position_2__set__(struct __pyx_obj_17clickhouse_driver_14bufferedreader_BufferedReader *__pyx_v_self, PyObject *__pyx_v_value) {\n int __pyx_r;\n __Pyx_RefNannyDeclarations\n unsigned PY_LONG_LONG __pyx_t_1;\n int __pyx_lineno = 0;\n const char *__pyx_filename = NULL;\n int __pyx_clineno = 0;\n __Pyx_RefNannySetupContext(\"__set__\", 0);\n __pyx_t_1 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L1_error)\n __pyx_v_self->position = __pyx_t_1;\n\n /* function exit code */\n __pyx_r = 0;\n goto __pyx_L0;\n __pyx_L1_error:;\n __Pyx_AddTraceback(\"clickhouse_driver.bufferedreader.BufferedReader.position.__set__\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n __pyx_r = -1;\n __pyx_L0:;\n __Pyx_RefNannyFinishContext();\n return __pyx_r;\n}", "label": 1, "label_name": "safe"} +{"code": " def login(database, username, password)\n auth[database.to_s] = [username, password]\n end", "label": 0, "label_name": "vulnerable"} +{"code": "MagickExport void RemoveDuplicateLayers(Image **images,\n ExceptionInfo *exception)\n{\n register Image\n *curr,\n *next;\n\n RectangleInfo\n bounds;\n\n assert((*images) != (const Image *) NULL);\n assert((*images)->signature == MagickCoreSignature);\n if ((*images)->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",(*images)->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n\n curr=GetFirstImageInList(*images);\n for (; (next=GetNextImageInList(curr)) != (Image *) NULL; curr=next)\n {\n if ( curr->columns != next->columns || curr->rows != next->rows\n || curr->page.x != next->page.x || curr->page.y != next->page.y )\n continue;\n bounds=CompareImagesBounds(curr,next,CompareAnyLayer,exception);\n if ( bounds.x < 0 ) {\n /*\n the two images are the same, merge time delays and delete one.\n */\n size_t time;\n time = curr->delay*1000/curr->ticks_per_second;\n time += next->delay*1000/next->ticks_per_second;\n next->ticks_per_second = 100L;\n next->delay = time*curr->ticks_per_second/1000;\n next->iterations = curr->iterations;\n *images = curr;\n (void) DeleteImageFromList(images);\n }\n }\n *images = GetFirstImageInList(*images);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int requireDirective(MaState *state, cchar *key, cchar *value)\n{\n char *age, *type, *rest, *option, *ovalue, *tok;\n int domains;\n\n if (!maTokenize(state, value, \"%S ?*\", &type, &rest)) {\n return MPR_ERR_BAD_SYNTAX;\n }\n if (scaselesscmp(type, \"ability\") == 0) {\n httpSetAuthRequiredAbilities(state->auth, rest);\n\n /* Support require group for legacy support */\n // DEPRECATE \"group\"\n } else if (scaselesscmp(type, \"group\") == 0 || scaselesscmp(type, \"role\") == 0) {\n httpSetAuthRequiredAbilities(state->auth, rest);\n\n } else if (scaselesscmp(type, \"secure\") == 0) {\n domains = 0;\n age = 0;\n for (option = stok(sclone(rest), \" \\t\", &tok); option; option = stok(0, \" \\t\", &tok)) {\n option = stok(option, \" =\\t,\", &ovalue);\n ovalue = strim(ovalue, \"\\\"'\", MPR_TRIM_BOTH);\n if (smatch(option, \"age\")) {\n age = sfmt(\"%lld\", (int64) httpGetTicks(ovalue));\n } else if (smatch(option, \"domains\")) {\n domains = 1;\n }\n }\n if (age) {\n if (domains) {\n /* Negative age signifies subdomains */\n age = sjoin(\"-1\", age, NULL);\n }\n }\n addCondition(state, \"secure\", age, HTTP_ROUTE_STRICT_TLS);\n\n } else if (scaselesscmp(type, \"user\") == 0) {\n httpSetAuthPermittedUsers(state->auth, rest);\n\n } else if (scaselesscmp(type, \"valid-user\") == 0) {\n httpSetAuthAnyValidUser(state->auth);\n\n } else {\n return configError(state, key);\n }\n return 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public OldECIESwithCipher(BlockCipher baseCipher, int ivLength)\n {\n super(new OldIESEngine(new ECDHBasicAgreement(),\n new KDF2BytesGenerator(new SHA1Digest()),\n new HMac(new SHA1Digest()),\n new PaddedBufferedBlockCipher(baseCipher)), ivLength);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testRedirectLinkGenerationException () {\n $this->setExpectedException (\n 'StringUtilException', '',\n StringUtilException::PREG_REPLACE_CALLBACK_ERROR);\n\n // set this high enough to cause a redirect link replacement error, but not a CUrlRule error\n ini_set('pcre.backtrack_limit', '10');\n ini_set('pcre.recursion_limit', '10');\n\n Yii::app()->controller = new MarketingController (\n 'campaign', new MarketingModule ('campaign', null));\n $_SERVER['SERVER_NAME'] = 'localhost';\n $cmb = $this->instantiate();\n $contact = $this->contacts('testUser_unsent');\n list($subject,$message,$uniqueId) = $cmb->prepareEmail(\n $this->campaign('redirectLinkGeneration'), $contact, false);\n }", "label": 1, "label_name": "safe"} +{"code": "\"keydown\",mxUtils.bind(this,function(N){mxEvent.isConsumed(N)||((mxEvent.isControlDown(N)||mxClient.IS_MAC&&mxEvent.isMetaDown(N))&&13==N.keyCode?(I.click(),mxEvent.consume(N)):27==N.keyCode&&(u.click(),mxEvent.consume(N)))}));I.focus();I.className=\"geCommentEditBtn gePrimaryBtn\";ta.appendChild(I);U.insertBefore(ta,R);ia.style.display=\"none\";R.style.display=\"none\";la.focus()}function f(ja,U){U.innerHTML=\"\";ja=new Date(ja.modifiedDate);var J=b.timeSince(ja);null==J&&(J=mxResources.get(\"lessThanAMinute\"));\nmxUtils.write(U,mxResources.get(\"timeAgo\",[J],\"{1} ago\"));U.setAttribute(\"title\",ja.toLocaleDateString()+\" \"+ja.toLocaleTimeString())}function g(ja){var U=document.createElement(\"img\");U.className=\"geCommentBusyImg\";U.src=IMAGE_PATH+\"/spin.gif\";ja.appendChild(U);ja.busyImg=U}function m(ja){ja.style.border=\"1px solid red\";ja.removeChild(ja.busyImg)}function q(ja){ja.style.border=\"\";ja.removeChild(ja.busyImg)}function y(ja,U,J,V,P){function R(T,Q,Z){var na=document.createElement(\"li\");na.className=", "label": 0, "label_name": "vulnerable"} +{"code": " private function char() {\n return ($this->char < $this->EOF)\n ? $this->data[$this->char]\n : false;\n }", "label": 1, "label_name": "safe"} +{"code": "static void clear_evtchn_to_irq_row(unsigned row)\n{\n\tunsigned col;\n\n\tfor (col = 0; col < EVTCHN_PER_ROW; col++)\n\t\tevtchn_to_irq[row][col] = -1;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "{};h.each(a,function(a,c) {c&&(b[a]=Q(c))});return function(a,c,f,g) {var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if (null===a)return function(a) {return a};if (\"function\"===typeof a)return function(b,c,f,g) {return a(b,c,f,g)};if (\"string\"===typeof a&&(-1!==a.indexOf(\".\")||-1!==a.indexOf(\"[\")||-1!==a.indexOf(\"(\"))) {var c=function(a,b,f) {var g,j;if (\"\"!==f) {j=La(f);for(var i=0,o=j.length;i 1 && resource[:multiple].to_s != 'true'\n raise Puppet::Error, \"More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'\"\n end\n File.open(resource[:path], 'w') do |fh|\n lines.each do |l|\n fh.puts(regex.match(l) ? resource[:line] : l)\n end\n\n if (match_count == 0)\n fh.puts(resource[:line])\n end\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n const int num_inputs = NumInputs(node);\n const bool is_soft_nms = num_inputs == 6;\n if (num_inputs != 5 && num_inputs != 6) {\n context->ReportError(context, \"Found NMS op with invalid num inputs: %d\",\n NumInputs(node));\n return kTfLiteError;\n }\n\n // Boxes & Scores.\n const TfLiteTensor* input_boxes = GetInput(context, node, kInputTensorBoxes);\n TF_LITE_ENSURE_EQ(context, input_boxes->type, kTfLiteFloat32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_boxes), 2);\n TF_LITE_ENSURE_EQ(context, SizeOfDimension(input_boxes, 1), 4);\n const int num_boxes = SizeOfDimension(input_boxes, 0);\n const TfLiteTensor* input_scores =\n GetInput(context, node, kInputTensorScores);\n TF_LITE_ENSURE_EQ(context, input_scores->type, kTfLiteFloat32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_scores), 1);\n TF_LITE_ENSURE_EQ(context, num_boxes, SizeOfDimension(input_scores, 0));\n\n // Max output size.\n const TfLiteTensor* input_max_output_size =\n GetInput(context, node, kInputTensorMaxOutputSize);\n TF_LITE_ENSURE_EQ(context, input_max_output_size->type, kTfLiteInt32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_max_output_size), 0);\n const bool is_max_output_size_const = IsConstantTensor(input_max_output_size);\n int max_output_size_value = 0;\n if (is_max_output_size_const) {\n max_output_size_value = *GetTensorData(input_max_output_size);\n TF_LITE_ENSURE(context, (max_output_size_value >= 0));\n }\n\n // IoU & Score thresholds.\n const TfLiteTensor* input_iou_threshold =\n GetInput(context, node, kInputTensorIouThreshold);\n TF_LITE_ENSURE_EQ(context, input_iou_threshold->type, kTfLiteFloat32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_iou_threshold), 0);\n const TfLiteTensor* input_score_threshold =\n GetInput(context, node, kInputTensorScoreThreshold);\n TF_LITE_ENSURE_EQ(context, input_iou_threshold->type, kTfLiteFloat32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_score_threshold), 0);\n\n if (is_soft_nms) {\n const TfLiteTensor* input_sigma =\n GetInput(context, node, kInputTensorSigma);\n TF_LITE_ENSURE_EQ(context, input_sigma->type, kTfLiteFloat32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_sigma), 0);\n\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 3);\n TfLiteTensor* output_selected_indices =\n GetOutput(context, node, kSoftNMSOutputTensorSelectedIndices);\n output_selected_indices->type = kTfLiteInt32;\n TfLiteTensor* output_selected_scores =\n GetOutput(context, node, kSoftNMSOutputTensorSelectedScores);\n output_selected_scores->type = kTfLiteFloat32;\n TfLiteTensor* output_num_selected_indices =\n GetOutput(context, node, kSoftNMSOutputTensorNumSelectedIndices);\n output_num_selected_indices->type = kTfLiteInt32;\n SetTensorSizes(context, output_num_selected_indices, {});\n\n if (is_max_output_size_const) {\n SetTensorSizes(context, output_selected_indices, {max_output_size_value});\n SetTensorSizes(context, output_selected_scores, {max_output_size_value});\n } else {\n SetTensorToDynamic(output_selected_indices);\n SetTensorToDynamic(output_selected_scores);\n }\n } else {\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2);\n TfLiteTensor* output_selected_indices =\n GetOutput(context, node, kNMSOutputTensorSelectedIndices);\n output_selected_indices->type = kTfLiteInt32;\n TfLiteTensor* output_num_selected_indices =\n GetOutput(context, node, kNMSOutputTensorNumSelectedIndices);\n output_num_selected_indices->type = kTfLiteInt32;\n SetTensorSizes(context, output_num_selected_indices, {});\n\n if (is_max_output_size_const) {\n SetTensorSizes(context, output_selected_indices, {max_output_size_value});\n } else {\n SetTensorToDynamic(output_selected_indices);\n }\n }\n\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tthis.restoreSize = function() {\n\t\tthis.resize(width, height);\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function setUpBeforeClass()\n {\n foreach (spl_autoload_functions() as $function) {\n if (!is_array($function)) {\n continue;\n }\n\n // get class loaders wrapped by DebugClassLoader\n if ($function[0] instanceof DebugClassLoader) {\n $function = $function[0]->getClassLoader();\n }\n\n if ($function[0] instanceof ComposerClassLoader) {\n $function[0]->add('Symfony_Component_Debug_Tests_Fixtures', dirname(dirname(dirname(dirname(dirname(__DIR__))))));\n break;\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private void doRequestRateLimits() throws Throwable {\n setUp(true);\n\n this.host.setAuthorizationService(new AuthorizationContextService());\n this.host.setAuthorizationEnabled(true);\n this.host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros(100));\n this.host.start();\n\n this.host.setSystemAuthorizationContext();\n\n String userPath = UriUtils.buildUriPath(ServiceUriPaths.CORE_AUTHZ_USERS, \"example-user\");\n String exampleUser = \"example@localhost\";\n TestContext authCtx = this.host.testCreate(1);\n AuthorizationSetupHelper.create()\n .setHost(this.host)\n .setUserSelfLink(userPath)\n .setUserEmail(exampleUser)\n .setUserPassword(exampleUser)\n .setIsAdmin(false)\n .setDocumentKind(Utils.buildKind(ExampleServiceState.class))\n .setCompletion(authCtx.getCompletion())\n .start();\n authCtx.await();\n\n this.host.resetAuthorizationContext();\n\n this.host.assumeIdentity(userPath);\n\n URI factoryUri = UriUtils.buildUri(this.host, ExampleService.FACTORY_LINK);\n Map states = this.host.doFactoryChildServiceStart(null,\n this.serviceCount,\n ExampleServiceState.class, (op) -> {\n ExampleServiceState st = new ExampleServiceState();\n st.name = exampleUser;\n op.setBody(st);\n }, factoryUri);\n\n try {\n RequestRateInfo ri = new RequestRateInfo();\n this.host.setRequestRateLimit(userPath, ri);\n throw new IllegalStateException(\"call should have failed, rate limit is zero\");\n } catch (IllegalArgumentException e) {\n\n }\n\n try {\n RequestRateInfo ri = new RequestRateInfo();\n // use a custom time series but of the wrong aggregation type\n ri.timeSeries = new TimeSeriesStats(10,\n TimeUnit.SECONDS.toMillis(1),\n EnumSet.of(AggregationType.AVG));\n this.host.setRequestRateLimit(userPath, ri);\n throw new IllegalStateException(\"call should have failed, aggregation is not SUM\");\n } catch (IllegalArgumentException e) {\n\n }\n\n RequestRateInfo ri = new RequestRateInfo();\n ri.limit = 1.1;\n this.host.setRequestRateLimit(userPath, ri);\n // verify no side effects on instance we supplied\n assertTrue(ri.timeSeries == null);\n\n double limit = (this.rateLimitedRequestCount * this.serviceCount) / 100;\n\n // set limit for this user to 1 request / second, overwrite previous limit\n this.host.setRequestRateLimit(userPath, limit);\n\n ri = this.host.getRequestRateLimit(userPath);\n assertTrue(Double.compare(ri.limit, limit) == 0);\n assertTrue(!ri.options.isEmpty());\n assertTrue(ri.options.contains(RequestRateInfo.Option.FAIL));\n assertTrue(ri.timeSeries != null);\n assertTrue(ri.timeSeries.numBins == 60);\n assertTrue(ri.timeSeries.aggregationType.contains(AggregationType.SUM));\n\n // set maintenance to default time to see how throttling behaves with default interval\n this.host.setMaintenanceIntervalMicros(\n ServiceHostState.DEFAULT_MAINTENANCE_INTERVAL_MICROS);\n\n AtomicInteger failureCount = new AtomicInteger();\n AtomicInteger successCount = new AtomicInteger();\n\n // send N requests, at once, clearly violating the limit, and expect failures\n int count = this.rateLimitedRequestCount;\n TestContext ctx = this.host.testCreate(count * states.size());\n ctx.setTestName(\"Rate limiting with failure\").logBefore();\n CompletionHandler c = (o, e) -> {\n if (e != null) {\n if (o.getStatusCode() != Operation.STATUS_CODE_UNAVAILABLE) {\n ctx.failIteration(e);\n return;\n }\n failureCount.incrementAndGet();\n } else {\n successCount.incrementAndGet();\n }\n\n ctx.completeIteration();\n };\n\n ExampleServiceState patchBody = new ExampleServiceState();\n patchBody.name = Utils.getSystemNowMicrosUtc() + \"\";\n for (URI serviceUri : states.keySet()) {\n for (int i = 0; i < count; i++) {\n Operation op = Operation.createPatch(serviceUri)\n .setBody(patchBody)\n .forceRemote()\n .setCompletion(c);\n this.host.send(op);\n }\n }\n this.host.testWait(ctx);\n ctx.logAfter();\n\n assertTrue(failureCount.get() > 0);\n\n // now change the options, and instead of fail, request throttling. this will literally\n // throttle the HTTP listener (does not work on local, in process calls)\n\n ri = new RequestRateInfo();\n ri.limit = limit;\n ri.options = EnumSet.of(RequestRateInfo.Option.PAUSE_PROCESSING);\n this.host.setRequestRateLimit(userPath, ri);\n\n this.host.setSystemAuthorizationContext();\n ServiceStat rateLimitStatBefore = getRateLimitOpCountStat();\n this.host.resetSystemAuthorizationContext();\n\n this.host.assumeIdentity(userPath);\n\n if (rateLimitStatBefore == null) {\n rateLimitStatBefore = new ServiceStat();\n rateLimitStatBefore.latestValue = 0.0;\n }\n TestContext ctx2 = this.host.testCreate(count * states.size());\n ctx2.setTestName(\"Rate limiting with auto-read pause of channels\").logBefore();\n for (URI serviceUri : states.keySet()) {\n for (int i = 0; i < count; i++) {\n // expect zero failures, but rate limit applied stat should have hits\n Operation op = Operation.createPatch(serviceUri)\n .setBody(patchBody)\n .forceRemote()\n .setCompletion(ctx2.getCompletion());\n this.host.send(op);\n }\n }\n this.host.testWait(ctx2);\n ctx2.logAfter();\n\n this.host.setSystemAuthorizationContext();\n ServiceStat rateLimitStatAfter = getRateLimitOpCountStat();\n this.host.resetSystemAuthorizationContext();\n assertTrue(rateLimitStatAfter.latestValue > rateLimitStatBefore.latestValue);\n\n this.host.setMaintenanceIntervalMicros(\n TimeUnit.MILLISECONDS.toMicros(VerificationHost.FAST_MAINT_INTERVAL_MILLIS));\n\n // effectively remove limit, verify all requests complete\n ri = new RequestRateInfo();\n ri.limit = 1000000;\n ri.options = EnumSet.of(RequestRateInfo.Option.PAUSE_PROCESSING);\n this.host.setRequestRateLimit(userPath, ri);\n this.host.assumeIdentity(userPath);\n\n count = this.rateLimitedRequestCount;\n TestContext ctx3 = this.host.testCreate(count * states.size());\n ctx3.setTestName(\"No limit\").logBefore();\n for (URI serviceUri : states.keySet()) {\n for (int i = 0; i < count; i++) {\n // expect zero failures\n Operation op = Operation.createPatch(serviceUri)\n .setBody(patchBody)\n .forceRemote()\n .setCompletion(ctx3.getCompletion());\n this.host.send(op);\n }\n }\n this.host.testWait(ctx3);\n ctx3.logAfter();\n\n // verify rate limiting did not happen\n this.host.setSystemAuthorizationContext();\n ServiceStat rateLimitStatExpectSame = getRateLimitOpCountStat();\n this.host.resetSystemAuthorizationContext();\n assertTrue(rateLimitStatAfter.latestValue == rateLimitStatExpectSame.latestValue);\n }", "label": 1, "label_name": "safe"} +{"code": "null,\"Error fetching folder items\")+(null!=Ca?\" (\"+Ca+\")\":\"\"));V=!1;P.stop()}})}}function L(N){J.className=J.className.replace(\"odCatSelected\",\"\");J=N;J.className+=\" odCatSelected\"}function C(N){V||(T=null,z(\"search\",null,null,null,N))}var D=\"\";null==e&&(e=I,D='

    ');null==m&&(m=function(){var N=null;try{N=JSON.parse(localStorage.getItem(\"mxODPickerRecentList\"))}catch(Q){}return N});null==n&&(n=function(N){if(null!=N){var Q=m()||{};delete N[\"@microsoft.graph.downloadUrl\"];", "label": 0, "label_name": "vulnerable"} +{"code": " protected function loadSelectedViewName()\n {\n $code = $this->request->get('code', '');\n if (false === strpos($code, '-')) {\n $this->selectedViewName = $code;\n return;\n }\n\n $parts = explode('-', $code);\n $this->selectedViewName = empty($parts) ? $code : $parts[0];\n }", "label": 1, "label_name": "safe"} +{"code": " foreach ($collectors as $collector) {\n $this->add($collector);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic static String compileMustache(Map context, String template) {\n\t\tif (context == null || StringUtils.isBlank(template)) {\n\t\t\treturn \"\";\n\t\t}\n\t\tWriter writer = new StringWriter();\n\t\ttry {\n\t\t\tMustache.compiler().escapeHTML(false).emptyStringIsFalse(true).compile(template).execute(context, writer);\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\twriter.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tlogger.error(null, e);\n\t\t\t}\n\t\t}\n\t\treturn writer.toString();\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " def initialize\n @mutex = Mutex.new\n @id = 0\n end", "label": 0, "label_name": "vulnerable"} +{"code": "ethertype_print(netdissect_options *ndo,\n u_short ether_type, const u_char *p,\n u_int length, u_int caplen,\n const struct lladdr_info *src, const struct lladdr_info *dst)\n{\n\tswitch (ether_type) {\n\n\tcase ETHERTYPE_IP:\n\t ip_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_IPV6:\n\t\tip6_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ARP:\n\tcase ETHERTYPE_REVARP:\n\t arp_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_DN:\n\t\tdecnet_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ATALK:\n\t\tif (ndo->ndo_vflag)\n\t\t\tND_PRINT((ndo, \"et1 \"));\n\t\tatalk_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_AARP:\n\t\taarp_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_IPX:\n\t\tND_PRINT((ndo, \"(NOV-ETHII) \"));\n\t\tipx_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_ISO:\n\t\tif (length == 0 || caplen == 0) {\n\t\t\tND_PRINT((ndo, \" [|osi]\"));\n\t\t\treturn (1);\n\t\t}\n\t\tisoclns_print(ndo, p + 1, length - 1);\n\t\treturn(1);\n\n\tcase ETHERTYPE_PPPOED:\n\tcase ETHERTYPE_PPPOES:\n\tcase ETHERTYPE_PPPOED2:\n\tcase ETHERTYPE_PPPOES2:\n\t\tpppoe_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_EAPOL:\n\t eap_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_RRCP:\n\t rrcp_print(ndo, p, length, src, dst);\n\t\treturn (1);\n\n\tcase ETHERTYPE_PPP:\n\t\tif (length) {\n\t\t\tND_PRINT((ndo, \": \"));\n\t\t\tppp_print(ndo, p, length);\n\t\t}\n\t\treturn (1);\n\n\tcase ETHERTYPE_MPCP:\n\t mpcp_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_SLOW:\n\t slow_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_CFM:\n\tcase ETHERTYPE_CFM_OLD:\n\t\tcfm_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_LLDP:\n\t\tlldp_print(ndo, p, length);\n\t\treturn (1);\n\n case ETHERTYPE_NSH:\n nsh_print(ndo, p, length);\n return (1);\n\n case ETHERTYPE_LOOPBACK:\n\t\tloopback_print(ndo, p, length);\n return (1);\n\n\tcase ETHERTYPE_MPLS:\n\tcase ETHERTYPE_MPLS_MULTI:\n\t\tmpls_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_TIPC:\n\t\ttipc_print(ndo, p, length, caplen);\n\t\treturn (1);\n\n\tcase ETHERTYPE_MS_NLB_HB:\n\t\tmsnlb_print(ndo, p);\n\t\treturn (1);\n\n case ETHERTYPE_GEONET_OLD:\n case ETHERTYPE_GEONET:\n geonet_print(ndo, p, length, src);\n return (1);\n\n case ETHERTYPE_CALM_FAST:\n calm_fast_print(ndo, p, length, src);\n return (1);\n\n\tcase ETHERTYPE_AOE:\n\t\taoe_print(ndo, p, length);\n\t\treturn (1);\n\n\tcase ETHERTYPE_MEDSA:\n\t\tmedsa_print(ndo, p, length, caplen, src, dst);\n\t\treturn (1);\n\n\tcase ETHERTYPE_LAT:\n\tcase ETHERTYPE_SCA:\n\tcase ETHERTYPE_MOPRC:\n\tcase ETHERTYPE_MOPDL:\n\tcase ETHERTYPE_IEEE1905_1:\n\t\t/* default_print for now */\n\tdefault:\n\t\treturn (0);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " public function set($def, $config)\n {\n if (!$this->checkDefType($def)) {\n return;\n }\n $file = $this->generateFilePath($config);\n if (!$this->_prepareDir($config)) {\n return false;\n }\n return $this->_write($file, serialize($def), $config);\n }", "label": 1, "label_name": "safe"} +{"code": " public function test_addElementToContentSet()\n {\n $module = new HTMLPurifier_HTMLModule();\n\n $module->addElementToContentSet('b', 'Inline');\n $this->assertIdentical($module->content_sets, array('Inline' => 'b'));\n\n $module->addElementToContentSet('i', 'Inline');\n $this->assertIdentical($module->content_sets, array('Inline' => 'b | i'));\n\n }", "label": 1, "label_name": "safe"} +{"code": " public void fatalError(SAXParseException e) {\n }", "label": 1, "label_name": "safe"} +{"code": " void newDocumentWebHomeTopLevelFromURL() throws Exception\n {\n // new document = xwiki:X.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"X\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(true);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: The title is not \"WebHome\", but \"X\" (the space's name) to avoid exposing \"WebHome\" in the UI.\n verify(mockURLFactory).createURL(\"X\", \"WebHome\", \"edit\", \"template=&parent=Main.WebHome&title=X\", null, \"xwiki\",\n context);\n }", "label": 1, "label_name": "safe"} +{"code": " public function replace($def, $config)\n {\n return $this->cache->replace($def, $config);\n }", "label": 1, "label_name": "safe"} +{"code": " public function testIdempotence()\n {\n DebugClassLoader::enable();\n\n $functions = spl_autoload_functions();\n foreach ($functions as $function) {\n if (is_array($function) && $function[0] instanceof DebugClassLoader) {\n $reflClass = new \\ReflectionClass($function[0]);\n $reflProp = $reflClass->getProperty('classLoader');\n $reflProp->setAccessible(true);\n\n $this->assertNotInstanceOf('Symfony\\Component\\Debug\\DebugClassLoader', $reflProp->getValue($function[0]));\n\n return;\n }\n }\n\n $this->fail('DebugClassLoader did not register');\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private function characters($char_class, $start)\n {\n return preg_replace('#^(['.$char_class.']+).*#s', '\\\\1', substr($this->data, $start));\n }", "label": 1, "label_name": "safe"} +{"code": "static int pop_fetch_message (CONTEXT* ctx, MESSAGE* msg, int msgno)\n{\n int ret;\n void *uidl;\n char buf[LONG_STRING];\n char path[_POSIX_PATH_MAX];\n progress_t progressbar;\n POP_DATA *pop_data = (POP_DATA *)ctx->data;\n POP_CACHE *cache;\n HEADER *h = ctx->hdrs[msgno];\n unsigned short bcache = 1;\n\n /* see if we already have the message in body cache */\n if ((msg->fp = mutt_bcache_get (pop_data->bcache, cache_id (h->data))))\n return 0;\n\n /*\n * see if we already have the message in our cache in\n * case $message_cachedir is unset\n */\n cache = &pop_data->cache[h->index % POP_CACHE_LEN];\n\n if (cache->path)\n {\n if (cache->index == h->index)\n {\n /* yes, so just return a pointer to the message */\n msg->fp = fopen (cache->path, \"r\");\n if (msg->fp)\n\treturn 0;\n \n mutt_perror (cache->path);\n mutt_sleep (2);\n return -1;\n }\n else\n {\n /* clear the previous entry */\n unlink (cache->path);\n FREE (&cache->path);\n }\n }\n\n FOREVER\n {\n if (pop_reconnect (ctx) < 0)\n return -1;\n\n /* verify that massage index is correct */\n if (h->refno < 0)\n {\n mutt_error _(\"The message index is incorrect. Try reopening the mailbox.\");\n mutt_sleep (2);\n return -1;\n }\n\n mutt_progress_init (&progressbar, _(\"Fetching message...\"),\n\t\t\tMUTT_PROGRESS_SIZE, NetInc, h->content->length + h->content->offset - 1);\n\n /* see if we can put in body cache; use our cache as fallback */\n if (!(msg->fp = mutt_bcache_put (pop_data->bcache, cache_id (h->data), 1)))\n {\n /* no */\n bcache = 0;\n mutt_mktemp (path, sizeof (path));\n if (!(msg->fp = safe_fopen (path, \"w+\")))\n {\n\tmutt_perror (path);\n\tmutt_sleep (2);\n\treturn -1;\n }\n }\n\n snprintf (buf, sizeof (buf), \"RETR %d\\r\\n\", h->refno);\n\n ret = pop_fetch_data (pop_data, buf, &progressbar, fetch_message, msg->fp);\n if (ret == 0)\n break;\n\n safe_fclose (&msg->fp);\n\n /* if RETR failed (e.g. connection closed), be sure to remove either\n * the file in bcache or from POP's own cache since the next iteration\n * of the loop will re-attempt to put() the message */\n if (!bcache)\n unlink (path);\n\n if (ret == -2)\n {\n mutt_error (\"%s\", pop_data->err_msg);\n mutt_sleep (2);\n return -1;\n }\n\n if (ret == -3)\n {\n mutt_error _(\"Can't write message to temporary file!\");\n mutt_sleep (2);\n return -1;\n }\n }\n\n /* Update the header information. Previously, we only downloaded a\n * portion of the headers, those required for the main display.\n */\n if (bcache)\n mutt_bcache_commit (pop_data->bcache, cache_id (h->data));\n else\n {\n cache->index = h->index;\n cache->path = safe_strdup (path);\n }\n rewind (msg->fp);\n uidl = h->data;\n\n /* we replace envelop, key in subj_hash has to be updated as well */\n if (ctx->subj_hash && h->env->real_subj)\n hash_delete (ctx->subj_hash, h->env->real_subj, h, NULL);\n mutt_label_hash_remove (ctx, h);\n mutt_free_envelope (&h->env);\n h->env = mutt_read_rfc822_header (msg->fp, h, 0, 0);\n if (ctx->subj_hash && h->env->real_subj)\n hash_insert (ctx->subj_hash, h->env->real_subj, h);\n mutt_label_hash_add (ctx, h);\n\n h->data = uidl;\n h->lines = 0;\n fgets (buf, sizeof (buf), msg->fp);\n while (!feof (msg->fp))\n {\n ctx->hdrs[msgno]->lines++;\n fgets (buf, sizeof (buf), msg->fp);\n }\n\n h->content->length = ftello (msg->fp) - h->content->offset;\n\n /* This needs to be done in case this is a multipart message */\n if (!WithCrypto)\n h->security = crypt_query (h->content);\n\n mutt_clear_error();\n rewind (msg->fp);\n\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": " public ResetPasswordRequestResponse requestResetPassword(UserReference userReference) throws ResetPasswordException\n {\n if (this.checkUserReference(userReference)) {\n UserProperties userProperties = this.userPropertiesResolver.resolve(userReference);\n InternetAddress email = userProperties.getEmail();\n\n if (email != null) {\n DocumentUserReference documentUserReference = (DocumentUserReference) userReference;\n DocumentReference reference = documentUserReference.getReference();\n XWikiContext context = this.contextProvider.get();\n\n try {\n XWikiDocument userDocument = context.getWiki().getDocument(reference, context);\n\n if (userDocument.getXObject(LDAP_CLASS_REFERENCE) != null) {\n String exceptionMessage =\n this.localizationManager.getTranslationPlain(\"xe.admin.passwordReset.error.ldapUser\",\n userReference.toString());\n throw new ResetPasswordException(exceptionMessage);\n }\n\n BaseObject xObject = userDocument.getXObject(RESET_PASSWORD_REQUEST_CLASS_REFERENCE, true, context);\n String verificationCode = context.getWiki().generateRandomString(30);\n xObject.set(VERIFICATION_PROPERTY, verificationCode, context);\n\n String saveComment =\n this.localizationManager.getTranslationPlain(\"xe.admin.passwordReset.versionComment\");\n context.getWiki().saveDocument(userDocument, saveComment, true, context);\n\n return new DefaultResetPasswordRequestResponse(userReference, verificationCode);\n } catch (XWikiException e) {\n throw new ResetPasswordException(\n \"Error when reading user document to perform reset password request.\",\n e);\n }\n } else {\n // In case the mail is not configured, we log a message to the admin.\n this.logger.info(\"User [{}] asked to reset their password, but did not have any email configured.\",\n userReference);\n }\n }\n return new DefaultResetPasswordRequestResponse(userReference, null);\n }", "label": 1, "label_name": "safe"} +{"code": "\t\tprivate CipherSuite MapV2CipherCode(string prefix, int code)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tswitch (code)\n\t\t\t\t{\n\t\t\t\t\tcase 65664:\n\t\t\t\t\t\t// TLS_RC4_128_WITH_MD5\n\t\t\t\t\t\treturn this.Context.SupportedCiphers[prefix + \"RSA_WITH_RC4_128_MD5\"];\n\t\t\t\t\t\n\t\t\t\t\tcase 131200:\n\t\t\t\t\t\t// TLS_RC4_128_EXPORT40_WITH_MD5\n\t\t\t\t\t\treturn this.Context.SupportedCiphers[prefix + \"RSA_EXPORT_WITH_RC4_40_MD5\"];\n\t\t\t\t\t\n\t\t\t\t\tcase 196736:\n\t\t\t\t\t\t// TLS_RC2_CBC_128_CBC_WITH_MD5\n\t\t\t\t\t\treturn this.Context.SupportedCiphers[prefix + \"RSA_EXPORT_WITH_RC2_CBC_40_MD5\"];\n\t\t\t\t\t\n\t\t\t\t\tcase 262272:\n\t\t\t\t\t\t// TLS_RC2_CBC_128_CBC_EXPORT40_WITH_MD5\n\t\t\t\t\t\treturn this.Context.SupportedCiphers[prefix + \"RSA_EXPORT_WITH_RC2_CBC_40_MD5\"];\n\t\t\t\t\t\n\t\t\t\t\tcase 327808:\n\t\t\t\t\t\t// TLS_IDEA_128_CBC_WITH_MD5\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t\n\t\t\t\t\tcase 393280:\n\t\t\t\t\t\t// TLS_DES_64_CBC_WITH_MD5\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\tcase 458944:\n\t\t\t\t\t\t// TLS_DES_192_EDE3_CBC_WITH_MD5\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": "0){this.children.pop();this.add(a);return}}c.next=a}a.previous=c;a.parent=this;this.children.splice(b,0,a);if(!this._.hasInlineStarted)this._.hasInlineStarted=a.type==CKEDITOR.NODE_TEXT||a.type==CKEDITOR.NODE_ELEMENT&&!a._.isBlockLike},filter:function(a,b){b=this.getFilterContext(b);a.onRoot(b,this);this.filterChildren(a,false,b)},filterChildren:function(a,b,c){if(this.childrenFilteredBy!=a.id){c=this.getFilterContext(c);if(b&&!this.parent)a.onRoot(c,this);this.childrenFilteredBy=a.id;for(b=0;b 0) {\n // If a POJO is the value of a type key, make it a subdocument\n if (prefix) {\n this.nested[prefix.substring(0, prefix.length - 1)] = true;\n }\n const _schema = new Schema(_typeDef);\n const schemaWrappedPath = Object.assign({}, val, { type: _schema });\n this.path(prefix + key, schemaWrappedPath);\n } else {\n // Either the type is non-POJO or we interpret it as Mixed anyway\n if (prefix) {\n this.nested[prefix.substring(0, prefix.length - 1)] = true;\n }\n this.path(prefix + key, val);\n if (val != null && !(val.instanceOfSchema) && utils.isPOJO(val.discriminators)) {\n const schemaType = this.path(prefix + key);\n for (const key in val.discriminators) {\n schemaType.discriminator(key, val.discriminators[key]);\n }\n }\n }\n }\n }\n\n const addedKeys = Object.keys(obj).\n map(key => prefix ? prefix + key : key);\n aliasFields(this, addedKeys);\n return this;\n};", "label": 1, "label_name": "safe"} +{"code": " it \"should return :file if the URI protocol is set to 'file'\" do\n @request.expects(:protocol).returns \"file\"\n @object.select_terminus(@request).should == :file\n end", "label": 0, "label_name": "vulnerable"} +{"code": "DECLAREcpFunc(cpContig2SeparateByRow)\n{\n\ttsize_t scanlinesizein = TIFFScanlineSize(in);\n\ttsize_t scanlinesizeout = TIFFScanlineSize(out);\n\ttdata_t inbuf;\n\ttdata_t outbuf;\n\tregister uint8 *inp, *outp;\n\tregister uint32 n;\n\tuint32 row;\n\ttsample_t s;\n uint16 bps = 0;\n\n (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);\n if( bps != 8 )\n {\n TIFFError(TIFFFileName(in),\n \"Error, can only handle BitsPerSample=8 in %s\",\n \"cpContig2SeparateByRow\");\n return 0;\n }\n\n\tinbuf = _TIFFmalloc(scanlinesizein);\n\toutbuf = _TIFFmalloc(scanlinesizeout);\n\tif (!inbuf || !outbuf)\n\t\tgoto bad;\n\t_TIFFmemset(inbuf, 0, scanlinesizein);\n\t_TIFFmemset(outbuf, 0, scanlinesizeout);\n\t/* unpack channels */\n\tfor (s = 0; s < spp; s++) {\n\t\tfor (row = 0; row < imagelength; row++) {\n\t\t\tif (TIFFReadScanline(in, inbuf, row, 0) < 0\n\t\t\t && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t \"Error, can't read scanline %lu\",\n\t\t\t\t (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tinp = ((uint8*)inbuf) + s;\n\t\t\toutp = (uint8*)outbuf;\n\t\t\tfor (n = imagewidth; n-- > 0;) {\n\t\t\t\t*outp++ = *inp;\n\t\t\t\tinp += spp;\n\t\t\t}\n\t\t\tif (TIFFWriteScanline(out, outbuf, row, s) < 0) {\n\t\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t\t \"Error, can't write scanline %lu\",\n\t\t\t\t (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t}\n\t}\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 1;\nbad:\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "bool AveragePool(const float* input_data, const Dims<4>& input_dims, int stride,\n int pad_width, int pad_height, int filter_width,\n int filter_height, float* output_data,\n const Dims<4>& output_dims) {\n return AveragePool(input_data, input_dims, stride, stride, pad_width,\n pad_height, filter_width, filter_height, output_data,\n output_dims);\n}", "label": 1, "label_name": "safe"} +{"code": "\tprotected function _archive($dir, $files, $name, $arc)\n\t{\n\t\t// get current directory\n\t\t$cwd = getcwd();\n\n\t\t$tmpDir = $this->tempDir();\n\t\tif (!$tmpDir) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//download data\n\t\tif (!$this->ftp_download_files($dir, $files, $tmpDir)) {\n\t\t\t//cleanup\n\t\t\t$this->rmdirRecursive($tmpDir);\n\t\t\treturn false;\n\t\t}\n\n\t\t$remoteArchiveFile = false;\n\t\tif ($path = $this->makeArchive($tmpDir, $files, $name, $arc)) {\n\t\t\t$remoteArchiveFile = $this->_joinPath($dir, $name);\n\t\t\tif (!ftp_put($this->connect, $remoteArchiveFile, $path, FTP_BINARY)) {\n\t\t\t\t$remoteArchiveFile = false;\n\t\t\t}\n\t\t}\n\n\t\t//cleanup\n\t\tif (!$this->rmdirRecursive($tmpDir)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $remoteArchiveFile;\n\t}", "label": 1, "label_name": "safe"} +{"code": "\texports.deepCopy = function(target, source) {\n\t\tfor (var name in source) {\n\t\t\tvar tval = target[name],\n \t\t\t sval = source[name];\n\t\t\tif (tval !== sval) {\n\t\t\t\tif (shouldDeepCopy(sval)) {\n\t\t\t\t\tif (Object.prototype.toString.call(sval) === '[object Date]') { // use this date test to handle crossing frame boundaries\n\t\t\t\t\t\ttarget[name] = new Date(sval);\n\t\t\t\t\t} else if (lang.isArray(sval)) {\n \t\t\t\t\t\t target[name] = exports.deepCopyArray(sval);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (tval && typeof tval === 'object') {\n\t\t\t\t\t\t\texports.deepCopy(tval, sval);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttarget[name] = exports.deepCopy({}, sval);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttarget[name] = sval;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t};", "label": 0, "label_name": "vulnerable"} +{"code": " def testRaggedCountSparseOutput(self):\n splits = [0, 4, 7]\n values = [1, 1, 2, 1, 2, 10, 5]\n weights = [1, 2, 3, 4, 5, 6, 7]\n output_indices, output_values, output_shape = self.evaluate(\n gen_count_ops.RaggedCountSparseOutput(\n splits=splits, values=values, weights=weights, binary_output=False))\n self.assertAllEqual([[0, 1], [0, 2], [1, 2], [1, 5], [1, 10]],\n output_indices)\n self.assertAllEqual([7, 3, 5, 7, 6], output_values)\n self.assertAllEqual([2, 11], output_shape)", "label": 1, "label_name": "safe"} +{"code": "MpdCantataMounterInterface * RemoteFsDevice::mounter()\n{\n if (!mounterIface) {\n if (!QDBusConnection::systemBus().interface()->isServiceRegistered(MpdCantataMounterInterface::staticInterfaceName())) {\n QDBusConnection::systemBus().interface()->startService(MpdCantataMounterInterface::staticInterfaceName());\n }\n mounterIface=new MpdCantataMounterInterface(MpdCantataMounterInterface::staticInterfaceName(),\n \"/Mounter\", QDBusConnection::systemBus(), this);\n connect(mounterIface, SIGNAL(mountStatus(const QString &, int, int)), SLOT(mountStatus(const QString &, int, int)));\n connect(mounterIface, SIGNAL(umountStatus(const QString &, int, int)), SLOT(umountStatus(const QString &, int, int)));\n }\n return mounterIface;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testEditObjectParam()\n {\n $this->assertResult(\n '',\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": " protected function processJpeg()\n {\n $format = 'jpeg';\n $compression = \\Imagick::COMPRESSION_JPEG;\n\n $imagick = $this->image->getCore();\n $imagick->setImageBackgroundColor('white');\n $imagick->setBackgroundColor('white');\n $imagick = $imagick->mergeImageLayers(\\Imagick::LAYERMETHOD_MERGE);\n $imagick->setFormat($format);\n $imagick->setImageFormat($format);\n $imagick->setCompression($compression);\n $imagick->setImageCompression($compression);\n $imagick->setCompressionQuality($this->quality);\n $imagick->setImageCompressionQuality($this->quality);\n\n return $imagick->getImagesBlob();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\twp.updates.showErrorInCredentialsForm = function( message ) {\n\t\tvar $modal = $( '#request-filesystem-credentials-form' );\n\n\t\t// Remove any existing error.\n\t\t$modal.find( '.notice' ).remove();\n\t\t$modal.find( '#request-filesystem-credentials-title' ).after( '

    ' + message + '

    ' );\n\t};", "label": 1, "label_name": "safe"} +{"code": "int ecall_answer(struct ecall *ecall, enum icall_call_type call_type,\n\t\t bool audio_cbr)\n{\n\tint err = 0;\n\n\tif (!ecall)\n\t\treturn EINVAL;\n\n#ifdef ECALL_CBR_ALWAYS_ON\n\taudio_cbr = true;\n#endif\n\t\n\n\tinfo(\"ecall(%p): answer on pending econn %p call_type=%d\\n\", ecall, ecall->econn, call_type);\n\n\tif (!ecall->econn) {\n\t\twarning(\"ecall: answer: econn does not exist!\\n\");\n\t\treturn ENOENT;\n\t}\n\n\tif (ECONN_PENDING_INCOMING != econn_current_state(ecall->econn)) {\n\t\tinfo(\"ecall(%p): answer: invalid state (%s)\\n\", ecall,\n\t\t econn_state_name(econn_current_state(ecall->econn)));\n\t\treturn EPROTO;\n\t}\n\n\tif (!ecall->flow) {\n\t\twarning(\"ecall: answer: no mediaflow\\n\");\n\t\treturn EPROTO;\n\t}\n\n\tecall->call_type = call_type;\n\tIFLOW_CALL(ecall->flow, set_call_type, call_type);\n\n\tecall->audio_cbr = audio_cbr;\n\tIFLOW_CALL(ecall->flow, set_audio_cbr, audio_cbr);\n\n#if 0\n\tif (ecall->props_local) {\n\t\tconst char *vstate_string =\n\t\t\tcall_type == ICALL_CALL_TYPE_VIDEO ? \"true\" : \"false\";\n\t\tint err2 = econn_props_update(ecall->props_local, \"videosend\", vstate_string);\n\t\tif (err2) {\n\t\t\twarning(\"ecall(%p): econn_props_update(videosend)\",\n\t\t\t\t\" failed (%m)\\n\", ecall, err2);\n\t\t\t/* Non fatal, carry on */\n\t\t}\n\t}\n#endif\n\n\terr = generate_or_gather_answer(ecall, ecall->econn);\n\tif (err) {\n\t\twarning(\"ecall: answer: failed to gather_or_answer\\n\");\n\t\tgoto out;\n\t}\n\n\tecall->answered = true;\n\tecall->audio_setup_time = -1;\n\tecall->call_estab_time = -1;\n\tecall->ts_answered = tmr_jiffies();\n\n out:\n\treturn err;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "500);x(a.LocalizationButton);y(a.LocalizationLabel)},options_checkbox_send:function(b){delete b.id;b={osp:e.cookie.get(\"osp\"),udn:e.cookie.get(\"udn\"),cust_dic_ids:a.cust_dic_ids};e.postMessage.send({message:b,target:a.targetFromFrame[a.iframeNumber+\"_\"+a.dialog._.currentTabId],id:\"options_outer__page\"})},getOptions:function(b){var c=b.DefOptions.udn;a.LocalizationComing=b.DefOptions.localizationButtonsAndText;a.show_grammar=b.show_grammar;a.langList=b.lang;if(a.bnr=b.bannerId){a.setHeightBannerFrame();", "label": 1, "label_name": "safe"} +{"code": " public static function suite()\n {\n $suite = new PHPUnit_Framework_TestSuite('Net_URL2 tests');\n /** Add testsuites, if there is. */\n $suite->addTestSuite('Net_URL2Test');\n\n return $suite;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testTwoParagraphs()\n {\n $this->assertResult(\n'Par1\n\nPar2',\n\"

    Par1

    \n\n

    Par2

    \"\n );\n }", "label": 1, "label_name": "safe"} +{"code": " public function isTextNode()\n {\n return true;\n }", "label": 1, "label_name": "safe"} +{"code": " public function prepare($config, $context)\n {\n parent::prepare($config, $context);\n $this->config = $config;\n $this->context = $context;\n $this->removeNbsp = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp');\n $this->removeNbspExceptions = $config->get('AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions');\n $this->exclude = $config->get('AutoFormat.RemoveEmpty.Predicate');\n foreach ($this->exclude as $key => $attrs) {\n if (!is_array($attrs)) {\n // HACK, see HTMLPurifier/Printer/ConfigForm.php\n $this->exclude[$key] = explode(';', $attrs);\n }\n }\n $this->attrValidator = new HTMLPurifier_AttrValidator();\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\tforeach ( $titles as $title ) {\n\t\t\t\tif ( $this->parameters->getParameter( 'openreferences' ) ) {\n\t\t\t\t\tif ( $this->parameters->getParameter( 'ignorecase' ) ) {\n\t\t\t\t\t\t$_or = \"LOWER(CAST(pl_title AS char)) {$comparisonType}\" . strtolower( $this->DB->addQuotes( $title ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_or = \"pl_title {$comparisonType} \" . $this->DB->addQuotes( $title );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( $this->parameters->getParameter( 'ignorecase' ) ) {\n\t\t\t\t\t\t$_or = \"LOWER(CAST({$this->tableNames['page']}.page_title AS char)) {$comparisonType}\" . strtolower( $this->DB->addQuotes( $title ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_or = \"{$this->tableNames['page']}.page_title {$comparisonType}\" . $this->DB->addQuotes( $title );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$ors[] = $_or;\n\t\t\t}", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus GenericPrepare(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n const TfLiteTensor* input = GetInput(context, node, 0);\n TF_LITE_ENSURE(context, input != nullptr);\n TfLiteTensor* output = GetOutput(context, node, 0);\n TF_LITE_ENSURE(context, output != nullptr);\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);\n if (!IsSupportedType(input->type)) {\n TF_LITE_KERNEL_LOG(context, \"Input data type %s (%d) is not supported.\",\n TfLiteTypeGetName(input->type), input->type);\n return kTfLiteError;\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " function selectArraysBySql($sql) {\n $res = @mysqli_query($this->connection, $this->injectProof($sql));\n if ($res == null)\n return array();\n $arrays = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $arrays[] = mysqli_fetch_assoc($res);\n return $arrays;\n }", "label": 1, "label_name": "safe"} +{"code": " def createXsrfToken(): XsrfOk = {\n COULD_OPTIMIZE // skip the secure hash, when using the Double Submit Cookie pattern [4AW2J7].\n XsrfOk(timeDotRandomDotHash()) // [2AB85F2]\n }\n\n\n def createSessionIdAndXsrfToken(siteId: SiteId, userId: UserId): (SidOk, XsrfOk, List[Cookie]) = {", "label": 0, "label_name": "vulnerable"} +{"code": " def listUsernames(pageId: PageId, prefix: String): Action[Unit] = GetAction { request =>\n import request.dao\n\n val pageMeta = dao.getPageMeta(pageId) getOrElse throwIndistinguishableNotFound(\"EdE4Z0B8P5\")\n val categoriesRootLast = dao.getAncestorCategoriesRootLast(pageMeta.categoryId)\n\n SECURITY // Later: skip authors of hidden / deleted / whisper posts. [whispers]\n // Or if some time in the future there will be \"hidden\" accounts [hdn_acts]\n // \u2014 someone who don't want strangers and new members to see hens profile \u2014\n // then, would need to exclude those accounts here.\n\n throwNoUnless(Authz.maySeePage(\n pageMeta, request.user, dao.getGroupIdsOwnFirst(request.user),\n dao.getAnyPrivateGroupTalkMembers(pageMeta), categoriesRootLast,\n tooManyPermissions = dao.getPermsOnPages(categoriesRootLast)), \"EdEZBXKSM2\")\n\n // Also load deleted anon12345 members. Simpler, and they'll typically be very few or none. [5KKQXA4]\n val names = dao.listUsernames(\n pageId = pageId, prefix = prefix, caseSensitive = false, limit = 50)\n\n val json = JsArray(\n names map { nameAndUsername =>\n Json.obj(\n \"id\" -> nameAndUsername.id,\n \"username\" -> nameAndUsername.username,\n \"fullName\" -> nameAndUsername.fullName)\n })\n OkSafeJson(json)\n }\n\n\n /** maxBytes = 3000 because the about text might be fairly long.\n */\n def saveAboutMemberPrefs: Action[JsValue] = PostJsonAction(RateLimits.ConfigUser,", "label": 0, "label_name": "vulnerable"} +{"code": " public static function showModal($params) {\n\n if (!isset($params['argument']) || empty($params['argument'])) {\n return array(\n 'processed' => true,\n 'process_status' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatcommand', 'Please provide modal URL!')\n );\n }\n\n $paramsURL = explode(' ',$params['argument']);\n $URL = array_shift($paramsURL);\n\n if (is_numeric($URL)) {\n $URL = erLhcoreClassSystem::getHost() . erLhcoreClassDesign::baseurldirect('form/formwidget') . '/' . $URL;\n }\n\n // Store as message to visitor\n $msg = new erLhcoreClassModelmsg();\n $msg->msg = !empty($paramsURL) ? implode(' ',$paramsURL) : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatcommand','We will show a form in a moment!');\n $msg->meta_msg = '{\"content\":{\"execute_js\":{\"text\":\"\",\"ext_execute\":\"modal_ext\",\"ext_args\":\"{\\\"delay\\\":3,\\\"url\\\":\\\"' . $URL .'\\\"}\"}}}';\n $msg->chat_id = $params['chat']->id;\n $msg->user_id = $params['user']->id;\n $msg->time = time();\n $msg->name_support = $params['user']->name_support;\n $msg->saveThis();\n\n // Update last user msg time so auto responder work's correctly\n $params['chat']->last_op_msg_time = $params['chat']->last_user_msg_time = time();\n $params['chat']->last_msg_id = $msg->id;\n\n // All ok, we can make changes\n $params['chat']->updateThis(array('update' => array('last_msg_id', 'last_op_msg_time', 'status_sub', 'last_user_msg_time')));\n\n return array(\n 'status' => erLhcoreClassChatEventDispatcher::STOP_WORKFLOW,\n 'processed' => true,\n 'raw_message' => '!modal',\n 'process_status' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatcommand', 'Modal activated!') . ' ' . $URL\n );\n }", "label": 1, "label_name": "safe"} +{"code": "process_secondary_order(STREAM s)\n{\n\t/* The length isn't calculated correctly by the server.\n\t * For very compact orders the length becomes negative\n\t * so a signed integer must be used. */\n\tuint16 length;\n\tuint16 flags;\n\tuint8 type;\n\tuint8 *next_order;\n\tstruct stream packet = *s;\n\n\tin_uint16_le(s, length);\n\tin_uint16_le(s, flags);\t/* used by bmpcache2 */\n\tin_uint8(s, type);\n\n\tif (!s_check_rem(s, length + 7))\n\t{\n\t\trdp_protocol_error(\"process_secondary_order(), next order pointer would overrun stream\", &packet);\n\t}\n\n\tnext_order = s->p + (sint16) length + 7;\n\n\tswitch (type)\n\t{\n\t\tcase RDP_ORDER_RAW_BMPCACHE:\n\t\t\tprocess_raw_bmpcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_COLCACHE:\n\t\t\tprocess_colcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BMPCACHE:\n\t\t\tprocess_bmpcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_FONTCACHE:\n\t\t\tprocess_fontcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_RAW_BMPCACHE2:\n\t\t\tprocess_bmpcache2(s, flags, False);\t/* uncompressed */\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BMPCACHE2:\n\t\t\tprocess_bmpcache2(s, flags, True);\t/* compressed */\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BRUSHCACHE:\n\t\t\tprocess_brushcache(s, flags);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tlogger(Graphics, Warning,\n\t\t\t \"process_secondary_order(), unhandled secondary order %d\", type);\n\t}\n\n\ts->p = next_order;\n}", "label": 1, "label_name": "safe"} +{"code": "open_ssl_connection (rfbClient *client, int sockfd, rfbBool anonTLS, rfbCredential *cred)\n{\n SSL_CTX *ssl_ctx = NULL;\n SSL *ssl = NULL;\n int n, finished = 0;\n X509_VERIFY_PARAM *param;\n uint8_t verify_crls;\n\n if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method())))\n {\n rfbClientLog(\"Could not create new SSL context.\\n\");\n return NULL;\n }\n\n param = X509_VERIFY_PARAM_new();\n\n /* Setup verification if not anonymous */\n if (!anonTLS)\n {\n verify_crls = cred->x509Credential.x509CrlVerifyMode;\n if (cred->x509Credential.x509CACertFile)\n {\n if (!SSL_CTX_load_verify_locations(ssl_ctx, cred->x509Credential.x509CACertFile, NULL))\n {\n rfbClientLog(\"Failed to load CA certificate from %s.\\n\",\n cred->x509Credential.x509CACertFile);\n goto error_free_ctx;\n }\n } else {\n rfbClientLog(\"Using default paths for certificate verification.\\n\");\n SSL_CTX_set_default_verify_paths (ssl_ctx);\n }\n\n if (cred->x509Credential.x509CACrlFile)\n {\n if (!load_crls_from_file(cred->x509Credential.x509CACrlFile, ssl_ctx))\n {\n rfbClientLog(\"CRLs could not be loaded.\\n\");\n goto error_free_ctx;\n }\n if (verify_crls == rfbX509CrlVerifyNone) verify_crls = rfbX509CrlVerifyAll;\n }\n\n if (cred->x509Credential.x509ClientCertFile && cred->x509Credential.x509ClientKeyFile)\n {\n if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cred->x509Credential.x509ClientCertFile) != 1)\n {\n rfbClientLog(\"Client certificate could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_use_PrivateKey_file(ssl_ctx, cred->x509Credential.x509ClientKeyFile,\n SSL_FILETYPE_PEM) != 1)\n {\n rfbClientLog(\"Client private key could not be loaded.\\n\");\n goto error_free_ctx;\n }\n\n if (SSL_CTX_check_private_key(ssl_ctx) == 0) {\n rfbClientLog(\"Client certificate and private key do not match.\\n\");\n goto error_free_ctx;\n }\n }\n\n SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);\n\n if (verify_crls == rfbX509CrlVerifyClient) \n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\n else if (verify_crls == rfbX509CrlVerifyAll)\n X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);\n\n if(!X509_VERIFY_PARAM_set1_host(param, client->serverHost, strlen(client->serverHost)))\n {\n rfbClientLog(\"Could not set server name for verification.\\n\");\n goto error_free_ctx;\n }\n SSL_CTX_set1_param(ssl_ctx, param);\n }\n\n if (!(ssl = SSL_new (ssl_ctx)))\n {\n rfbClientLog(\"Could not create a new SSL session.\\n\");\n goto error_free_ctx;\n }\n\n /* TODO: finetune this list, take into account anonTLS bool */\n SSL_set_cipher_list(ssl, \"ALL\");\n\n SSL_set_fd (ssl, sockfd);\n SSL_CTX_set_app_data (ssl_ctx, client);\n\n do\n {\n n = SSL_connect(ssl);\n\t\t\n if (n != 1) \n {\n if (wait_for_data(ssl, n, 1) != 1) \n {\n finished = 1;\n SSL_shutdown(ssl);\n\n goto error_free_ssl;\n }\n }\n } while( n != 1 && finished != 1 );\n\n X509_VERIFY_PARAM_free(param);\n return ssl;\n\nerror_free_ssl:\n SSL_free(ssl);\n\nerror_free_ctx:\n X509_VERIFY_PARAM_free(param);\n SSL_CTX_free(ssl_ctx);\n\n return NULL;\n}", "label": 1, "label_name": "safe"} +{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"reject\")).to eq(\"function_reject\")\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\tautoToggle = function() {\n\t\t\t\tvar evTouchStart = 'touchstart.contextmenuAutoToggle';\n\t\t\t\tmenu.data('hideTm') && clearTimeout(menu.data('hideTm'));\n\t\t\t\tif (menu.is(':visible')) {\n\t\t\t\t\tmenu.on('touchstart', function(e) {\n\t\t\t\t\t\tif (e.originalEvent.touches.length > 1) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmenu.stop().show();\n\t\t\t\t\t\tmenu.data('hideTm') && clearTimeout(menu.data('hideTm'));\n\t\t\t\t\t})\n\t\t\t\t\t.data('hideTm', setTimeout(function() {\n\t\t\t\t\t\tcwd.find('.elfinder-cwd-file').off(evTouchStart);\n\t\t\t\t\t\tcwd.find('.elfinder-cwd-file.ui-selected')\n\t\t\t\t\t\t.one(evTouchStart, function(e) {\n\t\t\t\t\t\t\tif (e.originalEvent.touches.length > 1) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar tgt = $(e.target);\n\t\t\t\t\t\t\tif (menu.first().length && !tgt.is('input:checkbox') && !tgt.hasClass('elfinder-cwd-select')) {\n\t\t\t\t\t\t\t\topen(e.originalEvent.touches[0].pageX, e.originalEvent.touches[0].pageY);\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcwd.find('.elfinder-cwd-file').off(evTouchStart);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.one('unselect.'+fm.namespace, function() {\n\t\t\t\t\t\t\tcwd.find('.elfinder-cwd-file').off(evTouchStart);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tmenu.fadeOut({\n\t\t\t\t\t\t\tduration: 300,\n\t\t\t\t\t\t\tfail: function() {\n\t\t\t\t\t\t\t\tmenu.css('opacity', '1').show();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 4500));\n\t\t\t\t}\n\t\t\t},", "label": 1, "label_name": "safe"} +{"code": "\tprotected function _copy($source, $targetDir, $name) {\n\t\t$res = false;\n\t\t\n\t\tif ($this->tmp) {\n\t\t\t$local = $this->getTempFile();\n\t\t\t$target = $this->_joinPath($targetDir, $name);\n\n\t\t\tif (ftp_get($this->connect, $local, $source, FTP_BINARY)\n\t\t\t&& ftp_put($this->connect, $target, $local, $this->ftpMode($target))) {\n\t\t\t\t$res = $target;\n\t\t\t}\n\t\t\tunlink($local);\n\t\t}\n\t\t\n\t\treturn $res;\n\t}", "label": 1, "label_name": "safe"} +{"code": "static int unix_getpw(UNUSED void *instance, REQUEST *request,\n\t\t VALUE_PAIR **vp_list)\n{\n\tconst char\t*name;\n\tconst char\t*encrypted_pass;\n#ifdef HAVE_GETSPNAM\n\tstruct spwd\t*spwd = NULL;\n#endif\n#ifdef OSFC2\n\tstruct pr_passwd *pr_pw;\n#else\n\tstruct passwd\t*pwd;\n#endif\n#ifdef HAVE_GETUSERSHELL\n\tchar\t\t*shell;\n#endif\n\tVALUE_PAIR\t*vp;\n\n\t/*\n\t *\tWe can only authenticate user requests which HAVE\n\t *\ta User-Name attribute.\n\t */\n\tif (!request->username) {\n\t\treturn RLM_MODULE_NOOP;\n\t}\n\n\tname = (char *)request->username->vp_strvalue;\n\tencrypted_pass = NULL;\n\n#ifdef OSFC2\n\tif ((pr_pw = getprpwnam(name)) == NULL)\n\t\treturn RLM_MODULE_NOTFOUND;\n\tencrypted_pass = pr_pw->ufld.fd_encrypt;\n\n\t/*\n\t *\tCheck if account is locked.\n\t */\n\tif (pr_pw->uflg.fg_lock!=1) {\n\t\tradlog(L_AUTH, \"rlm_unix: [%s]: account locked\", name);\n\t\treturn RLM_MODULE_USERLOCK;\n\t}\n#else /* OSFC2 */\n\tif ((pwd = getpwnam(name)) == NULL) {\n\t\treturn RLM_MODULE_NOTFOUND;\n\t}\n\tencrypted_pass = pwd->pw_passwd;\n#endif /* OSFC2 */\n\n#ifdef HAVE_GETSPNAM\n\t/*\n\t * See if there is a shadow password.\n\t *\n\t *\tOnly query the _system_ shadow file if the encrypted\n\t *\tpassword from the passwd file is < 10 characters (i.e.\n\t *\ta valid password would never crypt() to it). This will\n\t *\tprevents users from using NULL password fields as things\n\t *\tstand right now.\n\t */\n\tif ((encrypted_pass == NULL) || (strlen(encrypted_pass) < 10)) {\n\t\tif ((spwd = getspnam(name)) == NULL) {\n\t\t\treturn RLM_MODULE_NOTFOUND;\n\t\t}\n\t\tencrypted_pass = spwd->sp_pwdp;\n\t}\n#endif\t/* HAVE_GETSPNAM */\n\n/*\n *\tThese require 'pwd != NULL', which isn't true on OSFC2\n */\n#ifndef OSFC2\n#ifdef DENY_SHELL\n\t/*\n\t *\tUsers with a particular shell are denied access\n\t */\n\tif (strcmp(pwd->pw_shell, DENY_SHELL) == 0) {\n\t\tradlog_request(L_AUTH, 0, request,\n\t\t\t \"rlm_unix: [%s]: invalid shell\", name);\n\t\treturn RLM_MODULE_REJECT;\n\t}\n#endif\n\n#ifdef HAVE_GETUSERSHELL\n\t/*\n\t *\tCheck /etc/shells for a valid shell. If that file\n\t *\tcontains /RADIUSD/ANY/SHELL then any shell will do.\n\t */\n\twhile ((shell = getusershell()) != NULL) {\n\t\tif (strcmp(shell, pwd->pw_shell) == 0 ||\n\t\t strcmp(shell, \"/RADIUSD/ANY/SHELL\") == 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tendusershell();\n\tif (shell == NULL) {\n\t\tradlog_request(L_AUTH, 0, request, \"[%s]: invalid shell [%s]\",\n\t\t name, pwd->pw_shell);\n\t\treturn RLM_MODULE_REJECT;\n\t}\n#endif\n#endif /* OSFC2 */\n\n#if defined(HAVE_GETSPNAM) && !defined(M_UNIX)\n\t/*\n\t * Check if password has expired.\n\t */\n\tif (spwd && spwd->sp_expire > 0 &&\n\t (request->timestamp / 86400) > spwd->sp_expire) {\n\t\tradlog_request(L_AUTH, 0, request, \"[%s]: password has expired\", name);\n\t\treturn RLM_MODULE_REJECT;\n\t}\n#endif\n\n#if defined(__FreeBSD__) || defined(bsdi) || defined(_PWF_EXPIRE)\n\t/*\n\t *\tCheck if password has expired.\n\t */\n\tif ((pwd->pw_expire > 0) &&\n\t (request->timestamp > pwd->pw_expire)) {\n\t\tradlog_request(L_AUTH, 0, request, \"[%s]: password has expired\", name);\n\t\treturn RLM_MODULE_REJECT;\n\t}\n#endif\n\n\t/*\n\t *\tWe might have a passwordless account.\n\t *\n\t *\tFIXME: Maybe add Auth-Type := Accept?\n\t */\n\tif (encrypted_pass[0] == 0)\n\t\treturn RLM_MODULE_NOOP;\n\n\tvp = pairmake(\"Crypt-Password\", encrypted_pass, T_OP_SET);\n\tif (!vp) return RLM_MODULE_FAIL;\n\n\tpairmove(vp_list, &vp);\n\tpairfree(&vp);\t\t/* might not be NULL; */\n\n\treturn RLM_MODULE_UPDATED;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int uio_mmap_physical(struct vm_area_struct *vma)\n{\n\tstruct uio_device *idev = vma->vm_private_data;\n\tint mi = uio_find_mem_index(vma);\n\tif (mi < 0)\n\t\treturn -EINVAL;\n\n\tvma->vm_ops = &uio_physical_vm_ops;\n\n\tvma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);\n\n\treturn remap_pfn_range(vma,\n\t\t\t vma->vm_start,\n\t\t\t idev->info->mem[mi].addr >> PAGE_SHIFT,\n\t\t\t vma->vm_end - vma->vm_start,\n\t\t\t vma->vm_page_prot);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function transform($attr, $config, $context)\n {\n // If we add support for other objects, we'll need to alter the\n // transforms.\n switch ($attr['name']) {\n // application/x-shockwave-flash\n // Keep this synchronized with Injector/SafeObject.php\n case 'allowScriptAccess':\n $attr['value'] = 'never';\n break;\n case 'allowNetworking':\n $attr['value'] = 'internal';\n break;\n case 'allowFullScreen':\n if ($config->get('HTML.FlashAllowFullScreen')) {\n $attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false';\n } else {\n $attr['value'] = 'false';\n }\n break;\n case 'wmode':\n $attr['value'] = $this->wmode->validate($attr['value'], $config, $context);\n break;\n case 'movie':\n case 'src':\n $attr['name'] = \"movie\";\n $attr['value'] = $this->uri->validate($attr['value'], $config, $context);\n break;\n case 'flashvars':\n // we're going to allow arbitrary inputs to the SWF, on\n // the reasoning that it could only hack the SWF, not us.\n break;\n // add other cases to support other param name/value pairs\n default:\n $attr['name'] = $attr['value'] = null;\n }\n return $attr;\n }", "label": 1, "label_name": "safe"} +{"code": "mxUtils.extend(Ka,mxActor);Ka.prototype.dx=20;Ka.prototype.dy=20;Ka.prototype.redrawPath=function(c,l,x,p,v){l=Math.max(0,Math.min(p,parseFloat(mxUtils.getValue(this.style,\"dx\",this.dx))));x=Math.max(0,Math.min(v,parseFloat(mxUtils.getValue(this.style,\"dy\",this.dy))));parseFloat(mxUtils.getValue(this.style,\"size\",this.size));var A=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(c,[new mxPoint(0,0),new mxPoint(p,0),new mxPoint(p,x),new mxPoint(l,x),\nnew mxPoint(l,v),new mxPoint(0,v)],this.isRounded,A,!0);c.end()};mxCellRenderer.registerShape(\"corner\",Ka);mxUtils.extend(bb,mxActor);bb.prototype.redrawPath=function(c,l,x,p,v){c.moveTo(0,0);c.lineTo(0,v);c.end();c.moveTo(p,0);c.lineTo(p,v);c.end();c.moveTo(0,v/2);c.lineTo(p,v/2);c.end()};mxCellRenderer.registerShape(\"crossbar\",bb);mxUtils.extend(Pa,mxActor);Pa.prototype.dx=20;Pa.prototype.dy=20;Pa.prototype.redrawPath=function(c,l,x,p,v){l=Math.max(0,Math.min(p,parseFloat(mxUtils.getValue(this.style,", "label": 0, "label_name": "vulnerable"} +{"code": " public async Task StartAsync()\n {\n if (!Directory.Exists(_Directory))\n Directory.CreateDirectory(_Directory);\n string chain = NBXplorerDefaultSettings.GetFolderName(ChainName.Regtest);\n string chainDirectory = Path.Combine(_Directory, chain);\n if (!Directory.Exists(chainDirectory))\n Directory.CreateDirectory(chainDirectory);\n\n StringBuilder config = new StringBuilder();\n config.AppendLine($\"{chain.ToLowerInvariant()}=1\");\n if (InContainer)\n {\n config.AppendLine($\"bind=0.0.0.0\");\n }\n config.AppendLine($\"port={Port}\");\n config.AppendLine($\"chains={string.Join(',', Chains)}\");\n if (Chains.Contains(\"BTC\", StringComparer.OrdinalIgnoreCase))\n {\n config.AppendLine($\"btc.explorer.url={NBXplorerUri.AbsoluteUri}\");\n config.AppendLine($\"btc.explorer.cookiefile=0\");\n }\n\n if (UseLightning)\n {\n config.AppendLine($\"btc.lightning={IntegratedLightning}\");\n var localLndBackupFile = Path.Combine(_Directory, \"walletunlock.json\");\n File.Copy(TestUtils.GetTestDataFullPath(\"LndSeedBackup/walletunlock.json\"), localLndBackupFile, true);\n config.AppendLine($\"btc.external.lndseedbackup={localLndBackupFile}\");\n }\n\n if (Chains.Contains(\"LTC\", StringComparer.OrdinalIgnoreCase))\n {\n config.AppendLine($\"ltc.explorer.url={LTCNBXplorerUri.AbsoluteUri}\");\n config.AppendLine($\"ltc.explorer.cookiefile=0\");\n }\n if (Chains.Contains(\"LBTC\", StringComparer.OrdinalIgnoreCase))\n {\n config.AppendLine($\"lbtc.explorer.url={LBTCNBXplorerUri.AbsoluteUri}\");\n config.AppendLine($\"lbtc.explorer.cookiefile=0\");\n }\n if (AllowAdminRegistration)\n config.AppendLine(\"allow-admin-registration=1\");\n\n config.AppendLine($\"torrcfile={TestUtils.GetTestDataFullPath(\"Tor/torrc\")}\");\n config.AppendLine($\"socksendpoint={SocksEndpoint}\");\n config.AppendLine($\"debuglog=debug.log\");\n\n\n if (!string.IsNullOrEmpty(SSHPassword) && string.IsNullOrEmpty(SSHKeyFile))\n config.AppendLine($\"sshpassword={SSHPassword}\");\n if (!string.IsNullOrEmpty(SSHKeyFile))\n config.AppendLine($\"sshkeyfile={SSHKeyFile}\");\n if (!string.IsNullOrEmpty(SSHConnection))\n config.AppendLine($\"sshconnection={SSHConnection}\");\n\n if (TestDatabase == TestDatabases.MySQL && !String.IsNullOrEmpty(MySQL))\n config.AppendLine($\"mysql=\" + MySQL);\n else if (!String.IsNullOrEmpty(Postgres))\n config.AppendLine($\"postgres=\" + Postgres);\n var confPath = Path.Combine(chainDirectory, \"settings.config\");\n await File.WriteAllTextAsync(confPath, config.ToString());\n\n ServerUri = new Uri(\"http://\" + HostName + \":\" + Port + \"/\");\n HttpClient = new HttpClient();\n HttpClient.BaseAddress = ServerUri;\n Environment.SetEnvironmentVariable(\"ASPNETCORE_ENVIRONMENT\", \"Development\");\n var conf = new DefaultConfiguration() { Logger = Logs.LogProvider.CreateLogger(\"Console\") }.CreateConfiguration(new[] { \"--datadir\", _Directory, \"--conf\", confPath, \"--disable-registration\", DisableRegistration ? \"true\" : \"false\" });\n _Host = new WebHostBuilder()\n .UseConfiguration(conf)\n .UseContentRoot(FindBTCPayServerDirectory())\n .UseWebRoot(Path.Combine(FindBTCPayServerDirectory(), \"wwwroot\"))\n .ConfigureServices(s =>\n {\n s.AddLogging(l =>\n {\n l.AddFilter(\"System.Net.Http.HttpClient\", LogLevel.Critical);\n l.SetMinimumLevel(LogLevel.Information)\n .AddFilter(\"Microsoft\", LogLevel.Error)\n .AddFilter(\"Hangfire\", LogLevel.Error)\n .AddFilter(\"Fido2NetLib.DistributedCacheMetadataService\", LogLevel.Error)\n .AddProvider(Logs.LogProvider);\n });\n })\n .ConfigureServices(services =>\n {\n services.TryAddSingleton(new BTCPayServer.Services.Fees.FixedFeeProvider(new FeeRate(100L, 1)));\n })\n .UseKestrel()\n .UseStartup()\n .Build();\n await _Host.StartWithTasksAsync();\n\n var urls = _Host.ServerFeatures.Get().Addresses;\n foreach (var url in urls)\n {\n Logs.Tester.LogInformation(\"Listening on \" + url);\n }\n Logs.Tester.LogInformation(\"Server URI \" + ServerUri);\n\n InvoiceRepository = (InvoiceRepository)_Host.Services.GetService(typeof(InvoiceRepository));\n StoreRepository = (StoreRepository)_Host.Services.GetService(typeof(StoreRepository));\n Networks = (BTCPayNetworkProvider)_Host.Services.GetService(typeof(BTCPayNetworkProvider));\n\n if (MockRates)\n {\n var rateProvider = (RateProviderFactory)_Host.Services.GetService(typeof(RateProviderFactory));\n rateProvider.Providers.Clear();\n\n coinAverageMock = new MockRateProvider();\n coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"BTC_USD\"), new BidAsk(5000m)));\n coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"BTC_CAD\"), new BidAsk(4500m)));\n coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"BTC_LTC\"), new BidAsk(162m)));\n coinAverageMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"LTC_USD\"), new BidAsk(500m)));\n rateProvider.Providers.Add(\"coingecko\", coinAverageMock);\n\n var bitflyerMock = new MockRateProvider();\n bitflyerMock.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"BTC_JPY\"), new BidAsk(700000m)));\n rateProvider.Providers.Add(\"bitflyer\", bitflyerMock);\n\n var ndax = new MockRateProvider();\n ndax.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"BTC_CAD\"), new BidAsk(6000m)));\n rateProvider.Providers.Add(\"ndax\", ndax);\n\n var bittrex = new MockRateProvider();\n bittrex.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"DOGE_BTC\"), new BidAsk(0.004m)));\n rateProvider.Providers.Add(\"bittrex\", bittrex);\n\n\n var bitfinex = new MockRateProvider();\n bitfinex.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"UST_BTC\"), new BidAsk(0.000136m)));\n rateProvider.Providers.Add(\"bitfinex\", bitfinex);\n\n var bitpay = new MockRateProvider();\n bitpay.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"ETB_BTC\"), new BidAsk(0.1m)));\n rateProvider.Providers.Add(\"bitpay\", bitpay);\n var kraken = new MockRateProvider();\n kraken.ExchangeRates.Add(new PairRate(CurrencyPair.Parse(\"ETH_BTC\"), new BidAsk(0.1m)));\n rateProvider.Providers.Add(\"kraken\", kraken);\n }\n\n\n Logs.Tester.LogInformation(\"Waiting site is operational...\");\n await WaitSiteIsOperational();\n Logs.Tester.LogInformation(\"Site is now operational\");\n }", "label": 0, "label_name": "vulnerable"} +{"code": "mxCodecRegistry.register(function(){var a=new mxObjectCodec(new mxCell,[\"children\",\"edges\",\"overlays\",\"mxTransient\"],[\"parent\",\"source\",\"target\"]);a.isCellCodec=function(){return!0};a.isNumericAttribute=function(b,c,d){return\"value\"!==c.nodeName&&mxObjectCodec.prototype.isNumericAttribute.apply(this,arguments)};a.isExcluded=function(b,c,d,e){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||e&&\"value\"==c&&d.nodeType==mxConstants.NODETYPE_ELEMENT};a.afterEncode=function(b,c,d){if(null!=", "label": 0, "label_name": "vulnerable"} +{"code": "function PMA_getUrlParams(\n $what, $reload, $action, $db, $table, $selected, $views,\n $original_sql_query, $original_url_query\n) {\n $_url_params = array(\n 'query_type' => $what,\n 'reload' => (! empty($reload) ? 1 : 0),\n );\n if (mb_strpos(' ' . $action, 'db_') == 1) {\n $_url_params['db']= $db;\n } elseif (mb_strpos(' ' . $action, 'tbl_') == 1\n || $what == 'row_delete'\n ) {\n $_url_params['db']= $db;\n $_url_params['table']= $table;\n }\n foreach ($selected as $sval) {\n if ($what == 'row_delete') {\n $_url_params['selected'][] = 'DELETE FROM '\n . PMA\\libraries\\Util::backquote($table)\n . ' WHERE ' . urldecode($sval) . ' LIMIT 1;';\n } else {\n $_url_params['selected'][] = $sval;\n }\n }\n if ($what == 'drop_tbl' && !empty($views)) {\n foreach ($views as $current) {\n $_url_params['views'][] = $current;\n }\n }\n if ($what == 'row_delete') {\n $_url_params['original_sql_query'] = $original_sql_query;\n if (! empty($original_url_query)) {\n $_url_params['original_url_query'] = $original_url_query;\n }\n }\n\n return $_url_params;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " cp.exec = function (cmd, extra, cb) {\n if (cmd.indexOf('-a') === -1) return cb(null);\n assert.equal('git tag -a v1.0.0 -m \"Message\"', cmd);\n done();\n };", "label": 0, "label_name": "vulnerable"} +{"code": " nextId: function(skip, init) {\n var id = 'v' + (this.state.nextId++);\n if (!skip) {\n this.current().vars.push(id + (init ? '=' + init : ''));\n }\n return id;\n },", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_reverse([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " function simulateMouseEvent (event, simulatedType) {\n\n\t// Ignore multi-touch events\n\tif (event.originalEvent.touches.length > 1) {\n\t return;\n\t}\n\n\tif (! $(event.currentTarget).hasClass('touch-punch-keep-default')) {\n\t\tevent.preventDefault();\n\t}\n\n\tvar touch = event.originalEvent.changedTouches[0],\n\t\tsimulatedEvent = document.createEvent('MouseEvents');\n\t\n\t// Initialize the simulated mouse event using the touch event's coordinates\n\tsimulatedEvent.initMouseEvent(\n\t simulatedType,\t// type\n\t true,\t\t\t\t// bubbles\t\t\t\t\t \n\t true,\t\t\t\t// cancelable\t\t\t\t \n\t window,\t\t\t// view\t\t\t\t\t\t \n\t 1,\t\t\t\t// detail\t\t\t\t\t \n\t touch.screenX,\t// screenX\t\t\t\t\t \n\t touch.screenY,\t// screenY\t\t\t\t\t \n\t touch.clientX,\t// clientX\t\t\t\t\t \n\t touch.clientY,\t// clientY\t\t\t\t\t \n\t false,\t\t\t// ctrlKey\t\t\t\t\t \n\t false,\t\t\t// altKey\t\t\t\t\t \n\t false,\t\t\t// shiftKey\t\t\t\t\t \n\t false,\t\t\t// metaKey\t\t\t\t\t \n\t 0,\t\t\t\t// button\t\t\t\t\t \n\t null\t\t\t\t// relatedTarget\t\t\t \n\t);\n\n\t// Dispatch the simulated event to the target element\n\tevent.target.dispatchEvent(simulatedEvent);\n }", "label": 1, "label_name": "safe"} +{"code": " foreach ($course_RET as $period_date)\n {\n // $period_days_append_sql .=\"(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR \";\n $period_days_append_sql .= \"(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND (cpv.course_period_date IS NULL OR cpv.course_period_date='$period_date[COURSE_PERIOD_DATE]') AND cpv.DAYS LIKE '%$period_date[DAYS]%') OR \";\n }", "label": 1, "label_name": "safe"} +{"code": " def create\n allvalidchains do |t, chain, table, protocol|\n if chain =~ InternalChains\n # can't create internal chains\n warning \"Attempting to create internal chain #{@resource[:name]}\"\n end\n if properties[:ensure] == protocol\n debug \"Skipping Inserting chain #{chain} on table #{table} (#{protocol}) already exists\"\n else\n debug \"Inserting chain #{chain} on table #{table} (#{protocol}) using #{t}\"\n t.call ['-t',table,'-N',chain]\n unless @resource[:policy].nil?\n t.call ['-t',table,'-P',chain,@resource[:policy].to_s.upcase]\n end\n end\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should populate correctly the puppi::todo step file' do\n should contain_file('/etc/puppi/todo/mytodo').with_content(/check_test/)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "SPL_METHOD(SplFileObject, setCsvControl)\n{\n\tspl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);\n\tchar delimiter = ',', enclosure = '\"', escape='\\\\';\n\tchar *delim = NULL, *enclo = NULL, *esc = NULL;\n\tint d_len = 0, e_len = 0, esc_len = 0;\n\t\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"|sss\", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) {\n\t\tswitch(ZEND_NUM_ARGS())\n\t\t{\n\t\tcase 3:\n\t\t\tif (esc_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"escape must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tescape = esc[0];\n\t\t\t/* no break */\n\t\tcase 2:\n\t\t\tif (e_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"enclosure must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tenclosure = enclo[0];\n\t\t\t/* no break */\n\t\tcase 1:\n\t\t\tif (d_len != 1) {\n\t\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"delimiter must be a character\");\n\t\t\t\tRETURN_FALSE;\n\t\t\t}\n\t\t\tdelimiter = delim[0];\n\t\t\t/* no break */\n\t\tcase 0:\n\t\t\tbreak;\n\t\t}\n\t\tintern->u.file.delimiter = delimiter;\n\t\tintern->u.file.enclosure = enclosure;\n\t\tintern->u.file.escape = escape;\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": "str2special(\n char_u\t**sp,\n int\t\tfrom)\t// TRUE for lhs of mapping\n{\n int\t\t\tc;\n static char_u\tbuf[7];\n char_u\t\t*str = *sp;\n int\t\t\tmodifiers = 0;\n int\t\t\tspecial = FALSE;\n\n if (has_mbyte)\n {\n\tchar_u\t*p;\n\n\t// Try to un-escape a multi-byte character. Return the un-escaped\n\t// string if it is a multi-byte character.\n\tp = mb_unescape(sp);\n\tif (p != NULL)\n\t return p;\n }\n\n c = *str;\n if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL)\n {\n\tif (str[1] == KS_MODIFIER)\n\t{\n\t modifiers = str[2];\n\t str += 3;\n\t c = *str;\n\t}\n\tif (c == K_SPECIAL && str[1] != NUL && str[2] != NUL)\n\t{\n\t c = TO_SPECIAL(str[1], str[2]);\n\t str += 2;\n\t}\n\tif (IS_SPECIAL(c) || modifiers)\t// special key\n\t special = TRUE;\n }\n\n if (has_mbyte && !IS_SPECIAL(c) && MB_BYTE2LEN(c) > 1)\n {\n\tchar_u\t*p;\n\n\t*sp = str;\n\t// Try to un-escape a multi-byte character after modifiers.\n\tp = mb_unescape(sp);\n\tif (p != NULL)\n\t // Since 'special' is TRUE the multi-byte character 'c' will be\n\t // processed by get_special_key_name()\n\t c = (*mb_ptr2char)(p);\n\telse\n\t // illegal byte\n\t *sp = str + 1;\n }\n else\n\t// single-byte character, NUL or illegal byte\n\t*sp = str + (*str == NUL ? 0 : 1);\n\n // Make special keys and C0 control characters in <> form, also .\n // Use only for lhs of a mapping.\n if (special || c < ' ' || (from && c == ' '))\n\treturn get_special_key_name(c, modifiers);\n buf[0] = c;\n buf[1] = NUL;\n return buf;\n}", "label": 1, "label_name": "safe"} +{"code": "\tprotected IBaseResource addCommonParams(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) {\n\t\tfinal String serverId = theRequest.getServerIdWithDefault(myConfig);\n\t\tfinal String serverBase = theRequest.getServerBase(theServletRequest, myConfig);\n\t\tfinal String serverName = theRequest.getServerName(myConfig);\n\t\tfinal String apiKey = theRequest.getApiKey(theServletRequest, myConfig);\n\t\ttheModel.put(\"serverId\", sanitizeInput(serverId));\n\t\ttheModel.put(\"base\", sanitizeInput(serverBase));\n\t\ttheModel.put(\"baseName\", sanitizeInput(serverName));\n\t\ttheModel.put(\"apiKey\", sanitizeInput(apiKey));\n\t\ttheModel.put(\"resourceName\", sanitizeInput(defaultString(theRequest.getResource())));\n\t\ttheModel.put(\"encoding\", sanitizeInput(theRequest.getEncoding()));\n\t\ttheModel.put(\"pretty\", sanitizeInput(theRequest.getPretty()));\n\t\ttheModel.put(\"_summary\", sanitizeInput(theRequest.get_summary()));\n\t\ttheModel.put(\"serverEntries\", myConfig.getIdToServerName());\n\n\t\treturn loadAndAddConf(theServletRequest, theRequest, theModel);\n\t}", "label": 1, "label_name": "safe"} +{"code": "def kick(bot, trigger):\n \"\"\"Kick a user from the channel.\"\"\"\n chanops = get_chanops(str(trigger.sender), bot.memory['channelmgnt']['jdcache'])\n dodeop = False\n if chanops:\n if bot.channels[trigger.sender].privileges[bot.nick] < OP and trigger.account in chanops:\n bot.say('Please wait...')\n bot.say('op ' + trigger.sender, 'ChanServ')\n time.sleep(1)\n dodeop = True\n text = trigger.group().split()\n argc = len(text)\n if argc < 2:\n return\n nick = Identifier(text[1])\n reason = ' '.join(text[2:])\n if ',' in str(nick):\n return bot.reply('Unable to kick. Kicking multiple users is not allowed.')\n if '#' in str(nick):\n return bot.reply('Unable to kick. Use of # when kicking is not expected.')\n if nick != bot.config.core.nick and trigger.account in chanops:\n bot.write(['KICK', trigger.sender, nick, ':' + reason])\n if dodeop:\n deopbot(trigger.sender, bot)\n else:\n bot.reply('Access Denied. If in error, please contact the channel founder.')\n else:\n bot.reply(f'No ChanOps Found. Please ask for assistance in {bot.settings.channelmgnt.support_channel}')", "label": 1, "label_name": "safe"} +{"code": " it \"should not support other values\" do\n expect { described_class.new(:name => 'foo', :ensure => :foo) }.to raise_error(Puppet::Error, /Invalid value/)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public static function slugify($text)\n {\n // strip tags\n $text = strip_tags($text);\n\n // replace non letter or digits by -\n $text = preg_replace('~[^\\\\pL\\d]+~u', '-', $text);\n\n // trim\n $text = trim($text, '-');\n\n // transliterate\n setlocale(LC_CTYPE, Options::v('country').'.utf8');\n $text = iconv('utf-8', 'ASCII//TRANSLIT', $text);\n // lowercase\n $text = strtolower($text);\n\n // remove unwanted characters\n $text = preg_replace('~[^-\\w]+~', '', $text);\n\n if (empty($text)) {\n return 'n-a';\n }\n\n return $text;\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 5);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* ids;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &ids));\n TF_LITE_ENSURE_EQ(context, NumDimensions(ids), 1);\n TF_LITE_ENSURE_EQ(context, ids->type, kTfLiteInt32);\n\n const TfLiteTensor* indices;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 1, &indices));\n TF_LITE_ENSURE_EQ(context, NumDimensions(indices), 2);\n TF_LITE_ENSURE_EQ(context, indices->type, kTfLiteInt32);\n\n const TfLiteTensor* shape;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 2, &shape));\n TF_LITE_ENSURE_EQ(context, NumDimensions(shape), 1);\n TF_LITE_ENSURE_EQ(context, shape->type, kTfLiteInt32);\n\n const TfLiteTensor* weights;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 3, &weights));\n TF_LITE_ENSURE_EQ(context, NumDimensions(weights), 1);\n TF_LITE_ENSURE_EQ(context, weights->type, kTfLiteFloat32);\n\n TF_LITE_ENSURE_EQ(context, SizeOfDimension(indices, 0),\n SizeOfDimension(ids, 0));\n TF_LITE_ENSURE_EQ(context, SizeOfDimension(indices, 0),\n SizeOfDimension(weights, 0));\n\n const TfLiteTensor* value;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 4, &value));\n TF_LITE_ENSURE(context, NumDimensions(value) >= 2);\n\n // Mark the output as a dynamic tensor.\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output));\n TF_LITE_ENSURE_TYPES_EQ(context, output->type, kTfLiteFloat32);\n output->allocation_type = kTfLiteDynamic;\n\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": "int CLASS parse_jpeg(int offset)\n{\n int len, save, hlen, mark;\n fseek(ifp, offset, SEEK_SET);\n if (fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8)\n return 0;\n\n while (fgetc(ifp) == 0xff && (mark = fgetc(ifp)) != 0xda)\n {\n order = 0x4d4d;\n len = get2() - 2;\n save = ftell(ifp);\n if (mark == 0xc0 || mark == 0xc3 || mark == 0xc9)\n {\n fgetc(ifp);\n raw_height = get2();\n raw_width = get2();\n }\n order = get2();\n hlen = get4();\n if (get4() == 0x48454150) /* \"HEAP\" */\n {\n#ifdef LIBRAW_LIBRARY_BUILD\n imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens;\n imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens;\n#endif\n parse_ciff(save + hlen, len - hlen, 0);\n }\n if (parse_tiff(save + 6))\n apply_tiff();\n fseek(ifp, save + len, SEEK_SET);\n }\n return 1;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function update_option_master() { \n global $db;\n\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;\n \n $opt->update($this->params);\n \n // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {\n \n }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);\n \n expHistory::back();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tprotected function configure() {\n\t\t// set ARGS\n\t\t$this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET;\n\t\t// set thumbnails path\n\t\t$path = $this->options['tmbPath'];\n\t\tif ($path) {\n\t\t\tif (!file_exists($path)) {\n\t\t\t\tif (mkdir($path)) {\n\t\t\t\t\tchmod($path, $this->options['tmbPathMode']);\n\t\t\t\t} else {\n\t\t\t\t\t$path = '';\n\t\t\t\t}\n\t\t\t} \n\t\t\t\n\t\t\tif (is_dir($path) && is_readable($path)) {\n\t\t\t\t$this->tmbPath = $path;\n\t\t\t\t$this->tmbPathWritable = is_writable($path);\n\t\t\t}\n\t\t}\n\t\t// set resouce path\n\t\tif (! is_dir($this->options['resourcePath'])) {\n\t\t\t$this->options['resourcePath'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resources';\n\t\t}\n\n\t\t// set image manipulation library\n\t\t$type = preg_match('/^(imagick|gd|convert|auto)$/i', $this->options['imgLib'])\n\t\t\t? strtolower($this->options['imgLib'])\n\t\t\t: 'auto';\n\n\t\t$imgLibFallback = extension_loaded('imagick')? 'imagick' : (function_exists('gd_info')? 'gd' : '');\n\t\tif (($type === 'imagick' || $type === 'auto') && extension_loaded('imagick')) {\n\t\t\t$this->imgLib = 'imagick';\n\t\t} else if (($type === 'gd' || $type === 'auto') && function_exists('gd_info')) {\n\t\t\t$this->imgLib = 'gd';\n\t\t} else {\n\t\t\t$convertCache = 'imgLibConvert';\n\t\t\tif (($convertCmd = $this->session->get($convertCache, false)) !== false) {\n\t\t\t\t$this->imgLib = $convertCmd;\n\t\t\t} else {\n\t\t\t\t$this->imgLib = ($this->procExec('convert -version') === 0)? 'convert' : '';\n\t\t\t\t$this->session->set($convertCache, $this->imgLib);\n\t\t\t}\n\t\t}\n\t\tif ($type !== 'auto' && $this->imgLib === '') {\n\t\t\t// fallback\n\t\t\t$this->imgLib = extension_loaded('imagick')? 'imagick' : (function_exists('gd_info')? 'gd' : '');\n\t\t}\n\t\t\n\t\t// check video to img converter\n\t\tif (! empty($this->options['imgConverter']) && is_array($this->options['imgConverter'])) {\n\t\t\tforeach($this->options['imgConverter'] as $_type => $_converter) {\n\t\t\t\tif (isset($_converter['func'])) {\n\t\t\t\t\t$this->imgConverter[strtolower($_type)] = $_converter;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (! isset($this->imgConverter['video'])) {\n\t\t\t$videoLibCache = 'videoLib';\n\t\t\tif (($videoLibCmd = $this->session->get($videoLibCache, false)) === false) {\n\t\t\t\t$videoLibCmd = ($this->procExec('ffmpeg -version') === 0)? 'ffmpeg' : '';\n\t\t\t\t$this->session->set($videoLibCache, $videoLibCmd);\n\t\t\t}\n\t\t\tif ($videoLibCmd) {\n\t\t\t\t$this->imgConverter['video'] = array(\n\t\t\t\t\t'func' => array($this, $videoLibCmd . 'ToImg'),\n\t\t\t\t\t'maxlen' => $this->options['tmbVideoConvLen']\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// check archivers\n\t\tif (empty($this->archivers['create'])) {\n\t\t\t$this->disabled[] ='archive';\n\t\t}\n\t\tif (empty($this->archivers['extract'])) {\n\t\t\t$this->disabled[] ='extract';\n\t\t}\n\t\t$_arc = $this->getArchivers();\n\t\tif (empty($_arc['create'])) {\n\t\t\t$this->disabled[] ='zipdl';\n\t\t}\n\t\t\n\t\t// check 'statOwner' for command `chmod`\n\t\tif (empty($this->options['statOwner'])) {\n\t\t\t$this->disabled[] ='chmod';\n\t\t}\n\t\t\n\t\t// check 'mimeMap'\n\t\tif (!is_array($this->options['mimeMap'])) {\n\t\t\t$this->options['mimeMap'] = array();\n\t\t}\n\t}", "label": 1, "label_name": "safe"} +{"code": " var doSynchronize = function(requisition, rescanExisting) {\n RequisitionsService.startTiming();\n RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(\n function() { // success\n growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')
    Use refresh to update the deployed statistics');\n requisition.setDeployed(true);\n },\n errorHandler\n );\n };", "label": 0, "label_name": "vulnerable"} +{"code": "b)},{type:\"button\"},!0)};return a}(),addUIElement:function(a,b){this._.uiElementBuilders[a]=b}});CKEDITOR.dialog._={uiElementBuilders:{},dialogDefinitions:{},currentTop:null,currentZIndex:null};CKEDITOR.event.implementOn(CKEDITOR.dialog);CKEDITOR.event.implementOn(CKEDITOR.dialog.prototype);var W={resizable:CKEDITOR.DIALOG_RESIZE_BOTH,minWidth:600,minHeight:400,buttons:[CKEDITOR.dialog.okButton,CKEDITOR.dialog.cancelButton]},z=function(a,b,c){for(var e=0,d;d=a[e];e++)if(d.id==b||c&&d[c]&&(d=z(d[c],\nb,c)))return d;return null},A=function(a,b,c,e,d){if(c){for(var g=0,f;f=a[g];g++){if(f.id==c)return a.splice(g,0,b),b;if(e&&f[e]&&(f=A(f[e],b,c,e,!0)))return f}if(d)return null}a.push(b);return b},B=function(a,b,c){for(var e=0,d;d=a[e];e++){if(d.id==b)return a.splice(e,1);if(c&&d[c]&&(d=B(d[c],b,c)))return d}return null},L=function(a,b){this.dialog=a;for(var c=b.contents,e=0,d;d=c[e];e++)c[e]=d&&new I(a,d);CKEDITOR.tools.extend(this,b)};L.prototype={getContents:function(a){return z(this.contents,", "label": 1, "label_name": "safe"} +{"code": "!g(a))&&a.fireOnce(\"customConfigLoaded\")}else CKEDITOR.scriptLoader.queue(b,function(){c.fn=CKEDITOR.editorConfig?CKEDITOR.editorConfig:function(){};g(a)});return true}function h(a,b){a.on(\"customConfigLoaded\",function(){if(b){if(b.on)for(var c in b.on)a.on(c,b.on[c]);CKEDITOR.tools.extend(a.config,b,true);delete a.config.on}c=a.config;a.readOnly=!(!c.readOnly&&!(a.elementMode==CKEDITOR.ELEMENT_MODE_INLINE?a.element.is(\"textarea\")?a.element.hasAttribute(\"disabled\"):a.element.isReadOnly():a.elementMode==", "label": 1, "label_name": "safe"} +{"code": " public function client_send($data)\n {\n $this->edebug(\"CLIENT -> SERVER: $data\", self::DEBUG_CLIENT);\n return fwrite($this->smtp_conn, $data);\n }", "label": 1, "label_name": "safe"} +{"code": " public function getArgument($index)\n {\n if (array_key_exists('index_'.$index, $this->arguments)) {\n return $this->arguments['index_'.$index];\n }\n\n $lastIndex = count(array_filter(array_keys($this->arguments), 'is_int')) - 1;\n\n if ($index < 0 || $index > $lastIndex) {\n throw new OutOfBoundsException(sprintf('The index \"%d\" is not in the range [0, %d].', $index, $lastIndex));\n }\n\n return $this->arguments[$index];\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function delete() {\n global $db;\n\n if (empty($this->params['id'])) return false;\n $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);\n $product = new $product_type($this->params['id'], true, false);\n //eDebug($product_type);\n //eDebug($product, true);\n //if (!empty($product->product_type_id)) {\n //$db->delete($product_type, 'id='.$product->product_id);\n //}\n\n $db->delete('option', 'product_id=' . $product->id . \" AND optiongroup_id IN (SELECT id from \" . $db->prefix . \"optiongroup WHERE product_id=\" . $product->id . \")\");\n $db->delete('optiongroup', 'product_id=' . $product->id);\n //die();\n $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type=\"' . $product_type . '\"');\n\n if ($product->product_type == \"product\") {\n if ($product->hasChildren()) {\n $this->deleteChildren();\n }\n }\n\n $product->delete();\n\n flash('message', gt('Product deleted successfully.'));\n expHistory::back();\n }", "label": 1, "label_name": "safe"} +{"code": " public function withParsedBody($data)\n {\n $new = clone $this;\n $new->parsedBody = $data;\n\n return $new;\n }", "label": 1, "label_name": "safe"} +{"code": " ...(options.role === 'anon' ? {} : {\n user: {\n title: 'System Task',\n role: options.role\n }\n }),\n res: {},\n t(key, options = {}) {\n return self.apos.i18n.i18next.t(key, {\n ...options,\n lng: req.locale\n });\n },\n data: {},\n protocol: 'http',\n get: function (propName) {\n return { Host: 'you-need-to-set-baseUrl-in-app-js.com' }[propName];\n },\n query: {},\n url: '/',\n locale: self.apos.argv.locale || self.apos.modules['@apostrophecms/i18n'].defaultLocale,\n mode: 'published',\n aposNeverLoad: {},\n aposStack: [],\n __(key) {\n self.apos.util.warnDevOnce('old-i18n-req-helper', stripIndent`\n The req.__() and res.__() functions are deprecated and do not localize in A3.\n Use req.t instead.\n `);\n return key;\n },\n session: {}\n };\n addCloneMethod(req);\n req.res.__ = req.__;\n const { role, ..._properties } = options || {};\n Object.assign(req, _properties);\n self.apos.i18n.setPrefixUrls(req);\n return req;\n\n function addCloneMethod(req) {\n req.clone = (properties = {}) => {\n const _req = {\n ...req,\n ...properties\n };\n self.apos.i18n.setPrefixUrls(_req);\n addCloneMethod(_req);\n return _req;\n };\n }\n },", "label": 1, "label_name": "safe"} +{"code": "$.fn.hideWidget = function() {\n $(this).each(function() {\n var widget = $(this);\n\n // slice of the \"x2widget_\" from the id to get widget name\n var widgetName = $(this).attr('id').slice(9); \n\n // console.log ('widgetName = ' + widgetName);\n $.post(yii.scriptUrl+'/site/hideWidget', {name: widgetName}, function(response) {\n widget.slideUp(function() {\n widget.remove();\n if (widgetName === 'RecordViewChart') removeChartWidget ();\n $('#x2-hidden-widgets-menu').replaceWith(response);\n // $('.x2-widget-menu-item').draggable({revert: 'invalid', helper:'clone', revertDuration:200, appendTo:'#x2-hidden-widgets-menu',iframeFix:true});\n $('.x2-hidden-widgets-menu-item').click(function() {\n return handleWidgetMenuItemClick($(this));\n });\n $('.x2-hidden-widgets-menu-item.widget-right').click(function() {\n return handleWidgetRightMenuItemClick($(this));\n });\n });\n });\n });\n};", "label": 0, "label_name": "vulnerable"} +{"code": " public function testExportParameters()\n {\n $dumper = new PhpDumper(new ContainerBuilder(new ParameterBag(array('foo' => new Reference('foo')))));\n $dumper->dump();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "Decontextify.value = (value, traps, deepTraps, flags, mock) => {\n\tif (Contextified.has(value)) {\n\t\t// Contextified object has returned back from vm\n\t\treturn Contextified.get(value);\n\t} else if (Decontextify.proxies.has(value)) {\n\t\t// Decontextified proxy already exists, reuse\n\t\treturn Decontextify.proxies.get(value);\n\t}\n\n\ttry {\n\t\tswitch (typeof value) {\n\t\t\tcase 'object':\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else if (instanceOf(value, Number)) { return host.Number(value);\n\t\t\t\t} else if (instanceOf(value, String)) { return host.String(value);\n\t\t\t\t} else if (instanceOf(value, Boolean)) { return host.Boolean(value);\n\t\t\t\t} else if (instanceOf(value, Date)) { return Decontextify.instance(value, host.Date, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, RangeError)) { return Decontextify.instance(value, host.RangeError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, ReferenceError)) { return Decontextify.instance(value, host.ReferenceError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, SyntaxError)) { return Decontextify.instance(value, host.SyntaxError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, TypeError)) { return Decontextify.instance(value, host.TypeError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, VMError)) { return Decontextify.instance(value, host.VMError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, EvalError)) { return Decontextify.instance(value, host.EvalError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, URIError)) { return Decontextify.instance(value, host.URIError, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, Error)) { return Decontextify.instance(value, host.Error, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, Array)) { return Decontextify.instance(value, host.Array, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, RegExp)) { return Decontextify.instance(value, host.RegExp, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, Map)) { return Decontextify.instance(value, host.Map, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, WeakMap)) { return Decontextify.instance(value, host.WeakMap, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, Set)) { return Decontextify.instance(value, host.Set, deepTraps, flags);\n\t\t\t\t} else if (instanceOf(value, WeakSet)) { return Decontextify.instance(value, host.WeakSet, deepTraps, flags);\n\t\t\t\t} else if (Promise && instanceOf(value, Promise)) { return Decontextify.instance(value, host.Promise, deepTraps, flags);\n\t\t\t\t} else if (local.Reflect.getPrototypeOf(value) === null) {\n\t\t\t\t\treturn Decontextify.instance(value, null, deepTraps, flags);\n\t\t\t\t} else {\n\t\t\t\t\treturn Decontextify.object(value, traps, deepTraps, flags, mock);\n\t\t\t\t}\n\t\t\tcase 'function':\n\t\t\t\treturn Decontextify.function(value, traps, deepTraps, flags, mock);\n\n\t\t\tcase 'undefined':\n\t\t\t\treturn undefined;\n\n\t\t\tdefault: // string, number, boolean, symbol\n\t\t\t\treturn value;\n\t\t}\n\t} catch (ex) {\n\t\t// Never pass the handled expcetion through! This block can't throw an exception under normal conditions.\n\t\treturn null;\n\t}\n};", "label": 0, "label_name": "vulnerable"} +{"code": " def test_change_to_invalid_due_date(self):\n url = reverse('change_due_date', kwargs={'course_id': self.course.id.to_deprecated_string()})\n response = self.client.get(url, {\n 'student': self.user1.username,\n 'url': self.week1.location.to_deprecated_string(),\n 'due_datetime': '01/01/2009 00:00'\n })\n self.assertEqual(response.status_code, 400, response.content)\n self.assertEqual(\n None,\n get_extended_due(self.course, self.week1, self.user1)\n )", "label": 0, "label_name": "vulnerable"} +{"code": "g.addClass(\"fc_inactive_element hidden\").slideUp(0).removeClass(\"fc_active_element\")):g.slideDown(0).addClass(\"fc_active_element\").removeClass(\"hidden fc_inactive_element\");c.click(function(){c.prop(\"checked\")&&\"show\"==d?g.removeClass(\"hidden\").slideUp(0).slideDown(b.toggle_speed,function(){g.addClass(\"fc_active_element\").removeClass(\"fc_inactive_element\")}):g.slideUp(b.toggle_speed,function(){g.addClass(\"fc_inactive_element hidden\").removeClass(\"fc_active_element\")})})}})}})(jQuery);(function(a){a.fn.resize_elements=function(b){var c={sidebar:a(\"#fc_sidebar\"),sidebar_content:a(\"#fc_sidebar_content\"),main_content:a(\"#fc_main_content\"),leftside:a(\"#fc_sidebar, #fc_content_container\"),rightside:a(\"#fc_content_container, #fc_content_footer\"),rightcontent:a(\"#fc_content_container\"),overview_list:a(\"#fc_list_overview\"),side_add:a(\"#fc_add_page\"),media:a(\"#fc_media_browser\"),bottomright:130,bottomleft:79};b=a.extend(c,b);return this.each(function(){var c=a(this);c.resize(function(){var e=\nparseInt(c.height(),10),d=parseInt(c.width(),10),g=parseInt(b.sidebar.width(),10);b.main_content.css({maxHeight:e-b.bottomright+\"px\"});b.media.css({maxHeight:e-b.bottomright+\"px\"});b.leftside.height(e-b.bottomright+30);b.sidebar.height(e-b.bottomright+48);b.rightcontent.height(e-b.bottomleft);b.rightside.width(d-g);b.sidebar_content.height(e-b.bottomright+26);d=0checkCSRFParam();\n $project = $this->getProject();\n $swimlane = $this->getSwimlane($project);\n\n if ($this->swimlaneModel->disable($project['id'], $swimlane['id'])) {\n $this->flash->success(t('Swimlane updated successfully.'));\n } else {\n $this->flash->failure(t('Unable to update this swimlane.'));\n }\n\n $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n }", "label": 1, "label_name": "safe"} +{"code": " public function testLogsAtAllLevels($level, $message)\n {\n $logger = $this->getLogger();\n $logger->{$level}($message, array('user' => 'Bob'));\n $logger->log($level, $message, array('user' => 'Bob'));\n\n $expected = array(\n $level.' message of level '.$level.' with context: Bob',\n $level.' message of level '.$level.' with context: Bob',\n );\n $this->assertEquals($expected, $this->getLogs());\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function delete_recurring() {\r\n $item = $this->event->find('first', 'id=' . $this->params['id']);\r\n if ($item->is_recurring == 1) { // need to give user options\r\n expHistory::set('editable', $this->params);\r\n assign_to_template(array(\r\n 'checked_date' => $this->params['date_id'],\r\n 'event' => $item,\r\n ));\r\n } else { // Process a regular delete\r\n $item->delete();\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " password: uuidv4(),\n token: invitationToken,\n role: 'developer',\n });\n\n expect(response.statusCode).toBe(201);\n\n const updatedUser = await getManager().findOneOrFail(User, { where: { email: user.email } });\n expect(updatedUser.firstName).toEqual('signupuser');\n expect(updatedUser.lastName).toEqual('user');\n expect(updatedUser.defaultOrganizationId).toEqual(organization.id);\n const organizationUser = await getManager().findOneOrFail(OrganizationUser, { where: { userId: user.id } });\n expect(organizationUser.status).toEqual('active');\n });", "label": 1, "label_name": "safe"} +{"code": "void rx63nEthInitGpio(NetInterface *interface)\n{\n //Unlock MPC registers\n MPC.PWPR.BIT.B0WI = 0;\n MPC.PWPR.BIT.PFSWE = 1;\n\n#if defined(USE_RDK_RX63N)\n //Select RMII interface mode\n MPC.PFENET.BIT.PHYMODE = 0;\n\n //Configure ET_MDIO (PA3)\n PORTA.PMR.BIT.B3 = 1;\n MPC.PA3PFS.BYTE = 0x11;\n\n //Configure ET_MDC (PA4)\n PORTA.PMR.BIT.B4 = 1;\n MPC.PA4PFS.BYTE = 0x11;\n\n //Configure ET_LINKSTA (PA5)\n PORTA.PMR.BIT.B5 = 1;\n MPC.PA5PFS.BYTE = 0x11;\n\n //Configure RMII_RXD1 (PB0)\n PORTB.PMR.BIT.B0 = 1;\n MPC.PB0PFS.BYTE = 0x12;\n\n //Configure RMII_RXD0 (PB1)\n PORTB.PMR.BIT.B1 = 1;\n MPC.PB1PFS.BYTE = 0x12;\n\n //Configure REF50CK (PB2)\n PORTB.PMR.BIT.B2 = 1;\n MPC.PB2PFS.BYTE = 0x12;\n\n //Configure RMII_RX_ER (PB3)\n PORTB.PMR.BIT.B3 = 1;\n MPC.PB3PFS.BYTE = 0x12;\n\n //Configure RMII_TXD_EN (PB4)\n PORTB.PMR.BIT.B4 = 1;\n MPC.PB4PFS.BYTE = 0x12;\n\n //Configure RMII_TXD0 (PB5)\n PORTB.PMR.BIT.B5 = 1;\n MPC.PB5PFS.BYTE = 0x12;\n\n //Configure RMII_TXD1 (PB6)\n PORTB.PMR.BIT.B6 = 1;\n MPC.PB6PFS.BYTE = 0x12;\n\n //Configure RMII_CRS_DV (PB7)\n PORTB.PMR.BIT.B7 = 1;\n MPC.PB7PFS.BYTE = 0x12;\n\n#elif defined(USE_RSK_RX63N)\n //Select MII interface mode\n MPC.PFENET.BIT.PHYMODE = 1;\n\n //Configure ET_MDIO (P71)\n PORT7.PMR.BIT.B1 = 1;\n MPC.P71PFS.BYTE = 0x11;\n\n //Configure ET_MDC (P72)\n PORT7.PMR.BIT.B2 = 1;\n MPC.P72PFS.BYTE = 0x11;\n\n //Configure ET_ERXD1 (P74)\n PORT7.PMR.BIT.B4 = 1;\n MPC.P74PFS.BYTE = 0x11;\n\n //Configure ET_ERXD0 P75)\n PORT7.PMR.BIT.B5 = 1;\n MPC.P75PFS.BYTE = 0x11;\n\n //Configure ET_RX_CLK (P76)\n PORT7.PMR.BIT.B6 = 1;\n MPC.P76PFS.BYTE = 0x11;\n\n //Configure ET_RX_ER (P77)\n PORT7.PMR.BIT.B7 = 1;\n MPC.P77PFS.BYTE = 0x11;\n\n //Configure ET_TX_EN (P80)\n PORT8.PMR.BIT.B0 = 1;\n MPC.P80PFS.BYTE = 0x11;\n\n //Configure ET_ETXD0 (P81)\n PORT8.PMR.BIT.B1 = 1;\n MPC.P81PFS.BYTE = 0x11;\n\n //Configure ET_ETXD1 (P82)\n PORT8.PMR.BIT.B2 = 1;\n MPC.P82PFS.BYTE = 0x11;\n\n //Configure ET_CRS (P83)\n PORT8.PMR.BIT.B3 = 1;\n MPC.P83PFS.BYTE = 0x11;\n\n //Configure ET_ERXD3 (PC0)\n PORTC.PMR.BIT.B0 = 1;\n MPC.PC0PFS.BYTE = 0x11;\n\n //Configure ET_ERXD2 (PC1)\n PORTC.PMR.BIT.B1 = 1;\n MPC.PC1PFS.BYTE = 0x11;\n\n //Configure ET_RX_DV (PC2)\n PORTC.PMR.BIT.B2 = 1;\n MPC.PC2PFS.BYTE = 0x11;\n\n //Configure ET_TX_ER (PC3)\n PORTC.PMR.BIT.B3 = 1;\n MPC.PC3PFS.BYTE = 0x11;\n\n //Configure ET_TX_CLK (PC4)\n PORTC.PMR.BIT.B4 = 1;\n MPC.PC4PFS.BYTE = 0x11;\n\n //Configure ET_ETXD2 (PC5)\n PORTC.PMR.BIT.B5 = 1;\n MPC.PC5PFS.BYTE = 0x11;\n\n //Configure ET_ETXD3 (PC6)\n PORTC.PMR.BIT.B6 = 1;\n MPC.PC6PFS.BYTE = 0x11;\n\n //Configure ET_COL (PC7)\n PORTC.PMR.BIT.B7 = 1;\n MPC.PC7PFS.BYTE = 0x11;\n#endif\n\n //Lock MPC registers\n MPC.PWPR.BIT.PFSWE = 0;\n MPC.PWPR.BIT.B0WI = 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function isBoolean( $parameter ) {\n\t\tif ( array_key_exists( $parameter, $this->data ) ) {\n\t\t\tif ( array_key_exists( 'boolean', $this->data[$parameter] ) ) {\n\t\t\t\treturn (bool)$this->data[$parameter]['boolean'];\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow new MWException( __METHOD__ . \": Attempted to load a parameter that does not exist.\" );\n\t}", "label": 1, "label_name": "safe"} +{"code": " public ActionResult Index()\n {\n if (CurrentUser == null)\n {\n return NotFound(\"Could not find user\");\n }\n\n var invites = db.OrganisationInvites.Where(uc => uc.InviteEmail.ToLower() == CurrentUser.Email.ToLower() && uc.AcceptedOn == null && uc.RejectedOn == null);\n\n if (invites.Any() == false)\n {\n // No invites to look at, redirect to home\n return RedirectToAction(\"Index\", \"Home\");\n }\n\n List viewModels = new List();\n\n foreach(var orgGrp in invites\n .Include(c => c.CreatedBy)\n .GroupBy(c => c.OrganisationId))\n {\n InvitationViewModel viewModel = new InvitationViewModel\n {\n OrganisationInviteId = orgGrp.First().OrganisationInviteId\n };\n \n Organisation organisation = db.Organisations.First(ba => ba.OrganisationId == orgGrp.Key);\n viewModel.OrganisationId = organisation.OrganisationId;\n\n viewModel.Invitees = orgGrp\n .Select(g => g.CreatedBy.UserName)\n .OrderBy(_ => _)\n .Distinct()\n .ToList();\n \n viewModel.OrganisationName = organisation.OrganisationName;\n \n viewModels.Add(viewModel);\n }\n\n if (viewModels.Any())\n {\n List databasesMerged = new List();\n List databasesLost = new List();\n \n List databases = db.DatabaseConnections\n .Where(d => d.OrganisationId == CurrentUser.OrganisationId)\n .ToList()\n .Select(d => d.Name)\n .OrderBy(d => d)\n .ToList();\n\n // are the the sole owner of the organisation?\n // if so we should transfer databases to the new organisation\n bool soleOwner = db.ApplicationUsers.Any(u => u.OrganisationId == CurrentUser.OrganisationId && CurrentUser.Id != u.Id) == false;\n\n if (soleOwner)\n {\n databasesMerged = databases;\n }\n else\n {\n databasesLost = databases;\n }\n \n foreach(var viewModel in viewModels)\n {\n viewModel.DatabasesMerged = databasesMerged;\n viewModel.DatabasesLost = databasesLost;\n }\n }\n\n return View(viewModels);\n }", "label": 1, "label_name": "safe"} +{"code": "BOOL update_write_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3,\n UINT16* flags)\n{\n\tBYTE bitsPerPixelId;\n\tBITMAP_DATA_EX* bitmapData;\n\n\tif (!Stream_EnsureRemainingCapacity(\n\t s, update_approximate_cache_bitmap_v3_order(cache_bitmap_v3, flags)))\n\t\treturn FALSE;\n\n\tbitmapData = &cache_bitmap_v3->bitmapData;\n\tbitsPerPixelId = BPP_CBR23[cache_bitmap_v3->bpp];\n\t*flags = (cache_bitmap_v3->cacheId & 0x00000003) |\n\t ((cache_bitmap_v3->flags << 7) & 0x0000FF80) | ((bitsPerPixelId << 3) & 0x00000078);\n\tStream_Write_UINT16(s, cache_bitmap_v3->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Write_UINT32(s, cache_bitmap_v3->key1); /* key1 (4 bytes) */\n\tStream_Write_UINT32(s, cache_bitmap_v3->key2); /* key2 (4 bytes) */\n\tStream_Write_UINT8(s, bitmapData->bpp);\n\tStream_Write_UINT8(s, 0); /* reserved1 (1 byte) */\n\tStream_Write_UINT8(s, 0); /* reserved2 (1 byte) */\n\tStream_Write_UINT8(s, bitmapData->codecID); /* codecID (1 byte) */\n\tStream_Write_UINT16(s, bitmapData->width); /* width (2 bytes) */\n\tStream_Write_UINT16(s, bitmapData->height); /* height (2 bytes) */\n\tStream_Write_UINT32(s, bitmapData->length); /* length (4 bytes) */\n\tStream_Write(s, bitmapData->data, bitmapData->length);\n\treturn TRUE;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *Tree) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: Tree: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: Tree: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Or\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.Or == nil {\n\t\t\t\tm.Or = &OrBranch{}\n\t\t\t}\n\t\t\tif err := m.Or.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tcase 2:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field And\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.And == nil {\n\t\t\t\tm.And = &AndBranch{}\n\t\t\t}\n\t\t\tif err := m.And.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tcase 3:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Leaf\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.Leaf == nil {\n\t\t\t\tm.Leaf = &Leaf{}\n\t\t\t}\n\t\t\tif err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def _on_load_started(self) -> None:\n self._progress = 0\n self._has_ssl_errors = False\n self.data.viewing_source = False\n self._set_load_status(usertypes.LoadStatus.loading)\n self.load_started.emit()", "label": 0, "label_name": "vulnerable"} +{"code": "int lstat_cache_aware_rmdir(const char *path)\n{\n\t/* Any change in this function must be made also in `mingw_rmdir()` */\n\tint ret = rmdir(path);\n\n\tif (!ret)\n\t\tinvalidate_lstat_cache();\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)\n{\n\tstruct elo_priv *priv;\n\tint ret;\n\tstruct usb_device *udev;\n\n\tif (!hid_is_usb(hdev))\n\t\treturn -EINVAL;\n\n\tpriv = kzalloc(sizeof(*priv), GFP_KERNEL);\n\tif (!priv)\n\t\treturn -ENOMEM;\n\n\tINIT_DELAYED_WORK(&priv->work, elo_work);\n\tudev = interface_to_usbdev(to_usb_interface(hdev->dev.parent));\n\tpriv->usbdev = usb_get_dev(udev);\n\n\thid_set_drvdata(hdev, priv);\n\n\tret = hid_parse(hdev);\n\tif (ret) {\n\t\thid_err(hdev, \"parse failed\\n\");\n\t\tgoto err_free;\n\t}\n\n\tret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);\n\tif (ret) {\n\t\thid_err(hdev, \"hw start failed\\n\");\n\t\tgoto err_free;\n\t}\n\n\tif (elo_broken_firmware(priv->usbdev)) {\n\t\thid_info(hdev, \"broken firmware found, installing workaround\\n\");\n\t\tqueue_delayed_work(wq, &priv->work, ELO_PERIODIC_READ_INTERVAL);\n\t}\n\n\treturn 0;\nerr_free:\n\tusb_put_dev(udev);\n\tkfree(priv);\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "\tfunction doSearch(searchStr)\n\t{\n\t\tif (lastSearchStr == searchStr && isGetAll == lastGetAll) return;\n\t\t\n\t\tdeselectTempCat();\n\t\ttempDlgContent.scrollTop = 0;\n\t\tdiagramsTiles.innerText = '';\n\t\tdiagramsListTitle.innerHTML = mxUtils.htmlEntities(mxResources.get('searchResults')) + \n\t\t\t\t\t\t\t\t\t\t' \"' + mxUtils.htmlEntities(searchStr) + '\"';\n\t\tdelayTimer = null;\n\n\t\tif (inTempScreen)\n\t\t{\n\t\t\t//Do search in templates\n\t\t\tfilterTemplates(searchStr);\n\t\t}\n\t\telse if (searchDocsCallback)\n\t\t{\n\t\t\tif (searchStr)\n\t\t\t{\n\t\t\t\tspinner.spin(diagramsTiles);\n\t\t\t\tcancelPendingCall = false;\n\t\t\t\tcallInitiated = true;\n\t\t\t\t//TODO use request id to allow only last request to show results\n\t\t\t\tsearchDocsCallback(searchStr, extDiagramsCallback, function()\n\t\t\t\t{\n\t\t\t\t\tshowError(mxResources.get('searchFailed'));\n\t\t\t\t\textDiagramsCallback([]);\n\t\t\t\t}, isGetAll? null : username);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgetRecentDocs(isGetAll); //Load recent doc again\n\t\t\t}\n\t\t}\n\t\t\n\t\tlastSearchStr = searchStr;\n\t\tlastGetAll = isGetAll;\n\t};", "label": 1, "label_name": "safe"} +{"code": " public function addPlugin(PluginInterface $plugin)\n {\n $this->plugins[$plugin->getMethod()] = $plugin;\n\n return $this;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static unsigned int khugepaged_scan_mm_slot(unsigned int pages,\n\t\t\t\t\t struct page **hpage)\n{\n\tstruct mm_slot *mm_slot;\n\tstruct mm_struct *mm;\n\tstruct vm_area_struct *vma;\n\tint progress = 0;\n\n\tVM_BUG_ON(!pages);\n\tVM_BUG_ON(!spin_is_locked(&khugepaged_mm_lock));\n\n\tif (khugepaged_scan.mm_slot)\n\t\tmm_slot = khugepaged_scan.mm_slot;\n\telse {\n\t\tmm_slot = list_entry(khugepaged_scan.mm_head.next,\n\t\t\t\t struct mm_slot, mm_node);\n\t\tkhugepaged_scan.address = 0;\n\t\tkhugepaged_scan.mm_slot = mm_slot;\n\t}\n\tspin_unlock(&khugepaged_mm_lock);\n\n\tmm = mm_slot->mm;\n\tdown_read(&mm->mmap_sem);\n\tif (unlikely(khugepaged_test_exit(mm)))\n\t\tvma = NULL;\n\telse\n\t\tvma = find_vma(mm, khugepaged_scan.address);\n\n\tprogress++;\n\tfor (; vma; vma = vma->vm_next) {\n\t\tunsigned long hstart, hend;\n\n\t\tcond_resched();\n\t\tif (unlikely(khugepaged_test_exit(mm))) {\n\t\t\tprogress++;\n\t\t\tbreak;\n\t\t}\n\n\t\tif ((!(vma->vm_flags & VM_HUGEPAGE) &&\n\t\t !khugepaged_always()) ||\n\t\t (vma->vm_flags & VM_NOHUGEPAGE)) {\n\t\tskip:\n\t\t\tprogress++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!vma->anon_vma || vma->vm_ops)\n\t\t\tgoto skip;\n\t\tif (is_vma_temporary_stack(vma))\n\t\t\tgoto skip;\n\t\t/*\n\t\t * If is_pfn_mapping() is true is_learn_pfn_mapping()\n\t\t * must be true too, verify it here.\n\t\t */\n\t\tVM_BUG_ON(is_linear_pfn_mapping(vma) ||\n\t\t\t vma->vm_flags & VM_NO_THP);\n\n\t\thstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;\n\t\thend = vma->vm_end & HPAGE_PMD_MASK;\n\t\tif (hstart >= hend)\n\t\t\tgoto skip;\n\t\tif (khugepaged_scan.address > hend)\n\t\t\tgoto skip;\n\t\tif (khugepaged_scan.address < hstart)\n\t\t\tkhugepaged_scan.address = hstart;\n\t\tVM_BUG_ON(khugepaged_scan.address & ~HPAGE_PMD_MASK);\n\n\t\twhile (khugepaged_scan.address < hend) {\n\t\t\tint ret;\n\t\t\tcond_resched();\n\t\t\tif (unlikely(khugepaged_test_exit(mm)))\n\t\t\t\tgoto breakouterloop;\n\n\t\t\tVM_BUG_ON(khugepaged_scan.address < hstart ||\n\t\t\t\t khugepaged_scan.address + HPAGE_PMD_SIZE >\n\t\t\t\t hend);\n\t\t\tret = khugepaged_scan_pmd(mm, vma,\n\t\t\t\t\t\t khugepaged_scan.address,\n\t\t\t\t\t\t hpage);\n\t\t\t/* move to next address */\n\t\t\tkhugepaged_scan.address += HPAGE_PMD_SIZE;\n\t\t\tprogress += HPAGE_PMD_NR;\n\t\t\tif (ret)\n\t\t\t\t/* we released mmap_sem so break loop */\n\t\t\t\tgoto breakouterloop_mmap_sem;\n\t\t\tif (progress >= pages)\n\t\t\t\tgoto breakouterloop;\n\t\t}\n\t}\nbreakouterloop:\n\tup_read(&mm->mmap_sem); /* exit_mmap will destroy ptes after this */\nbreakouterloop_mmap_sem:\n\n\tspin_lock(&khugepaged_mm_lock);\n\tVM_BUG_ON(khugepaged_scan.mm_slot != mm_slot);\n\t/*\n\t * Release the current mm_slot if this mm is about to die, or\n\t * if we scanned all vmas of this mm.\n\t */\n\tif (khugepaged_test_exit(mm) || !vma) {\n\t\t/*\n\t\t * Make sure that if mm_users is reaching zero while\n\t\t * khugepaged runs here, khugepaged_exit will find\n\t\t * mm_slot not pointing to the exiting mm.\n\t\t */\n\t\tif (mm_slot->mm_node.next != &khugepaged_scan.mm_head) {\n\t\t\tkhugepaged_scan.mm_slot = list_entry(\n\t\t\t\tmm_slot->mm_node.next,\n\t\t\t\tstruct mm_slot, mm_node);\n\t\t\tkhugepaged_scan.address = 0;\n\t\t} else {\n\t\t\tkhugepaged_scan.mm_slot = NULL;\n\t\t\tkhugepaged_full_scans++;\n\t\t}\n\n\t\tcollect_mm_slot(mm_slot);\n\t}\n\n\treturn progress;\n}", "label": 1, "label_name": "safe"} +{"code": " private boolean isStale(URL source, File target) {\n \n if( source.getProtocol().equals(\"jar\") ) {\n // unwrap the jar protocol...\n try {\n String parts[] = source.getFile().split(Pattern.quote(\"!\"));\n source = new URL(parts[0]);\n } catch (MalformedURLException e) {\n return false;\n }\n }\n \n File sourceFile=null;\n if( source.getProtocol().equals(\"file\") ) {\n sourceFile = new File(source.getFile());\n }\n if( sourceFile!=null && sourceFile.exists() ) {\n if( sourceFile.lastModified() > target.lastModified() ) {\n return true;\n }\n }\n return false;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " value = value.replace(/href=\" *javascript\\:(.*?)\"/gi, function(m, $1) {\n return 'removed=\"\"';\n });", "label": 1, "label_name": "safe"} +{"code": "(\"/\"==R.charAt(0)?\"\":u)+R);E.push('url(\"'+R+'\"'+J[Q].substring(T))}else E.push(J[Q])}else E=[u]}return null!=E?E.join(\"\"):null};Editor.prototype.mapFontUrl=function(u,E,J){/^https?:\\/\\//.test(E)&&!this.isCorsEnabledForUrl(E)&&(E=PROXY_URL+\"?url=\"+encodeURIComponent(E));J(u,E)};Editor.prototype.embedCssFonts=function(u,E){var J=u.split(\"url(\"),T=0;null==this.cachedFonts&&(this.cachedFonts={});var N=mxUtils.bind(this,function(){if(0==T){for(var ba=[J[0]],ea=1;ea=U.status&&(d(U.responseText,P,J,F,H,S,V,\"fixed\",mxEvent.isAltDown(E)?null:V.substring(0,V.lastIndexOf(\".\")).replace(/_/g,\" \")),x.scrollTop=x.scrollHeight))})):(b.spinner.stop(),b.showError(mxResources.get(\"error\"),mxResources.get(\"notInOffline\"))):\n(d(G,P,J,F,H,S,V,\"fixed\",mxEvent.isAltDown(E)?null:V.substring(0,V.lastIndexOf(\".\")).replace(/_/g,\" \")),x.scrollTop=x.scrollHeight)}};mxEvent.addListener(x,\"dragover\",g);mxEvent.addListener(x,\"drop\",k);mxEvent.addListener(y,\"dragover\",g);mxEvent.addListener(y,\"drop\",k);f.appendChild(x);c=document.createElement(\"div\");c.style.textAlign=\"right\";c.style.marginTop=\"20px\";e=mxUtils.button(mxResources.get(\"cancel\"),function(){b.hideDialog(!0)});e.setAttribute(\"id\",\"btnCancel\");e.className=\"geBtn\";b.editor.cancelFirst&&", "label": 1, "label_name": "safe"} +{"code": " it 'works correctly' do\n Facter.fact(:osfamily).stubs(:value).returns('RedHat')\n File.stubs(:exists?).with('/var/lib/rabbitmq/.erlang.cookie').returns(true)\n File.stubs(:read).with('/var/lib/rabbitmq/.erlang.cookie').returns('THISISACOOKIE')\n Facter.fact(:rabbitmq_erlang_cookie).value.should == 'THISISACOOKIE'\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function transform($attr, $config, $context)\n {\n if (!isset($attr['name'])) {\n return $attr;\n }\n $name = $attr['name'];\n if (isset($attr['id']) && $attr['id'] === $name) {\n return $attr;\n }\n $result = $this->idDef->validate($name, $config, $context);\n if ($result === false) {\n unset($attr['name']);\n } else {\n $attr['name'] = $result;\n }\n return $attr;\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus StoreAllDecodedSequences(\n TfLiteContext* context,\n const std::vector>>& sequences,\n TfLiteNode* node, int top_paths) {\n const int32_t batch_size = sequences.size();\n std::vector num_entries(top_paths, 0);\n\n // Calculate num_entries per path\n for (const auto& batch_s : sequences) {\n TF_LITE_ENSURE_EQ(context, batch_s.size(), top_paths);\n for (int p = 0; p < top_paths; ++p) {\n num_entries[p] += batch_s[p].size();\n }\n }\n\n for (int p = 0; p < top_paths; ++p) {\n const int32_t p_num = num_entries[p];\n\n // Resize the decoded outputs.\n TfLiteTensor* indices;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, p, &indices));\n TF_LITE_ENSURE_OK(context, Resize(context, {p_num, 2}, indices));\n\n TfLiteTensor* values;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, p + top_paths, &values));\n TF_LITE_ENSURE_OK(context, Resize(context, {p_num}, values));\n\n TfLiteTensor* decoded_shape;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, p + 2 * top_paths,\n &decoded_shape));\n TF_LITE_ENSURE_OK(context, Resize(context, {2}, decoded_shape));\n\n int32_t max_decoded = 0;\n int32_t offset = 0;\n\n int32_t* indices_data = GetTensorData(indices);\n int32_t* values_data = GetTensorData(values);\n int32_t* decoded_shape_data = GetTensorData(decoded_shape);\n for (int b = 0; b < batch_size; ++b) {\n auto& p_batch = sequences[b][p];\n int32_t num_decoded = p_batch.size();\n max_decoded = std::max(max_decoded, num_decoded);\n\n std::copy_n(p_batch.begin(), num_decoded, values_data + offset);\n for (int32_t t = 0; t < num_decoded; ++t, ++offset) {\n indices_data[offset * 2] = b;\n indices_data[offset * 2 + 1] = t;\n }\n }\n\n decoded_shape_data[0] = batch_size;\n decoded_shape_data[1] = max_decoded;\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " private function insertBefore($token)\n {\n // NB not $this->zipper->insertBefore(), due to positioning\n // differences\n $splice = $this->zipper->splice($this->token, 0, array($token));\n\n return $splice[1];\n }", "label": 1, "label_name": "safe"} +{"code": "func (e ErrLatestSnapshot) Error() string {\n\treturn fmt.Sprintf(\"tuf: the local snapshot version (%d) is the latest\", e.Version)\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void perf_bp_event(struct perf_event *bp, void *data)\n{\n\tstruct perf_sample_data sample;\n\tstruct pt_regs *regs = data;\n\n\tperf_sample_data_init(&sample, bp->attr.bp_addr);\n\n\tif (!bp->hw.state && !perf_exclude_event(bp, regs))\n\t\tperf_swevent_event(bp, 1, &sample, regs);\n}", "label": 1, "label_name": "safe"} +{"code": " public EntityResolver getEntityResolver() {\n return entityResolver;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def to_yaml(self, **kwargs):\n \"\"\"Returns a yaml string containing the network configuration.\n\n Note: Since TF 2.6, this method is no longer supported and will raise a\n RuntimeError.\n\n To load a network from a yaml save file, use\n `keras.models.model_from_yaml(yaml_string, custom_objects={})`.\n\n `custom_objects` should be a dictionary mapping\n the names of custom losses / layers / etc to the corresponding\n functions / classes.\n\n Args:\n **kwargs: Additional keyword arguments\n to be passed to `yaml.dump()`.\n\n Returns:\n A YAML string.\n\n Raises:\n RuntimeError: announces that the method poses a security risk\n \"\"\"\n raise RuntimeError(\n 'Method `model.to_yaml()` has been removed due to security risk of '\n 'arbitrary code execution. Please use `model.to_json()` instead.'\n )", "label": 1, "label_name": "safe"} +{"code": " var doSynchronize = function(requisition, rescanExisting) {\n RequisitionsService.startTiming();\n RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(\n function() { // success\n growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')
    Use refresh to update the deployed statistics');\n requisition.setDeployed(true);\n },\n errorHandler\n );\n };", "label": 0, "label_name": "vulnerable"} +{"code": "func (x *StorageCollectionsList) Reset() {\n\t*x = StorageCollectionsList{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_console_proto_msgTypes[35]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " it 'return if valid url passed' do\n expect(helper.url_valid?('https://app.chatwoot.com/')).to eq true\n end", "label": 1, "label_name": "safe"} +{"code": "def test_protected_splash_manual_headers_auth(settings_auth):\n AUTH_HEADERS = {'Authorization': basic_auth_header('user', 'userpass')}\n kwargs = {'splash_headers': AUTH_HEADERS}\n\n # auth via splash_headers should work\n items, url, crawler = yield crawl_items(LuaSpider, HelloWorld,\n settings_auth, kwargs)\n response = assert_single_response(items)\n assert 'hello' in response.body_as_unicode()\n assert response.status == 200\n assert response.splash_response_status == 200\n\n # but only for Splash, not for a remote website\n items, url, crawler = yield crawl_items(LuaSpider, HelloWorldProtected,\n settings_auth, kwargs)\n response = assert_single_response(items)\n assert 'hello' not in response.body_as_unicode()\n assert response.status == 401\n assert response.splash_response_status == 200", "label": 1, "label_name": "safe"} +{"code": " public function test_invite_set_password()\n {\n Notification::fake();\n $user = $this->getViewer();\n $inviteService = app(UserInviteService::class);\n\n $inviteService->sendInvitation($user);\n $token = DB::table('user_invites')->where('user_id', '=', $user->id)->first()->token;\n\n $setPasswordPageResp = $this->get('/register/invite/' . $token);\n $setPasswordPageResp->assertSuccessful();\n $setPasswordPageResp->assertSee('Welcome to BookStack!');\n $setPasswordPageResp->assertSee('Password');\n $setPasswordPageResp->assertSee('Confirm Password');\n\n $setPasswordResp = $this->followingRedirects()->post('/register/invite/' . $token, [\n 'password' => 'my test password',\n ]);\n $setPasswordResp->assertSee('Password set, you now have access to BookStack!');\n $newPasswordValid = auth()->validate([\n 'email' => $user->email,\n 'password' => 'my test password',\n ]);\n $this->assertTrue($newPasswordValid);\n $this->assertDatabaseMissing('user_invites', [\n 'user_id' => $user->id,\n ]);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\tfilename := sanitize(vars[\"filename\"])\n\n\tcontentLength := r.ContentLength\n\n\tvar reader io.Reader\n\n\treader = r.Body\n\n\tdefer r.Body.Close()\n\n\tif contentLength == -1 {\n\t\t// queue file to disk, because s3 needs content length\n\t\tvar err error\n\t\tvar f io.Reader\n\n\t\tf = reader\n\n\t\tvar b bytes.Buffer\n\n\t\tn, err := io.CopyN(&b, f, _24K+1)\n\t\tif err != nil && err != io.EOF {\n\t\t\tlog.Printf(\"Error putting new file: %s\", err.Error())\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\treturn\n\t\t}\n\n\t\tvar file *os.File\n\n\t\tif n > _24K {\n\t\t\tfile, err = ioutil.TempFile(s.tempPath, \"transfer-\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%s\", err.Error())\n\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdefer cleanTmpFile(file)\n\n\t\t\tn, err = io.Copy(file, io.MultiReader(&b, f))\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"%s\", err.Error())\n\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\treader, err = os.Open(file.Name())\n\t\t} else {\n\t\t\treader = bytes.NewReader(b.Bytes())\n\t\t}\n\n\t\tcontentLength = n\n\t}\n\n\tif s.maxUploadSize > 0 && contentLength > s.maxUploadSize {\n\t\tlog.Print(\"Entity too large\")\n\t\thttp.Error(w, http.StatusText(http.StatusRequestEntityTooLarge), http.StatusRequestEntityTooLarge)\n\t\treturn\n\t}\n\n\tif contentLength == 0 {\n\t\tlog.Print(\"Empty content-length\")\n\t\thttp.Error(w, errors.New(\"Could not upload empty file\").Error(), 400)\n\t\treturn\n\t}\n\n\tcontentType := r.Header.Get(\"Content-Type\")\n\n\tif contentType == \"\" {\n\t\tcontentType = mime.TypeByExtension(filepath.Ext(vars[\"filename\"]))\n\t}\n\n\ttoken := Encode(INIT_SEED, s.randomTokenLength)\n\n\tmetadata := MetadataForRequest(contentType, s.randomTokenLength, r)\n\n\tbuffer := &bytes.Buffer{}\n\tif err := json.NewEncoder(buffer).Encode(metadata); err != nil {\n\t\tlog.Printf(\"%s\", err.Error())\n\t\thttp.Error(w, errors.New(\"Could not encode metadata\").Error(), 500)\n\t\treturn\n\t} else if err := s.storage.Put(token, fmt.Sprintf(\"%s.metadata\", filename), buffer, \"text/json\", uint64(buffer.Len())); err != nil {\n\t\tlog.Printf(\"%s\", err.Error())\n\t\thttp.Error(w, errors.New(\"Could not save metadata\").Error(), 500)\n\t\treturn\n\t}\n\n\tlog.Printf(\"Uploading %s %s %d %s\", token, filename, contentLength, contentType)\n\n\tvar err error\n\n\tif err = s.storage.Put(token, filename, reader, contentType, uint64(contentLength)); err != nil {\n\t\tlog.Printf(\"Error putting new file: %s\", err.Error())\n\t\thttp.Error(w, errors.New(\"Could not save file\").Error(), 500)\n\t\treturn\n\t}\n\n\t// w.Statuscode = 200\n\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\n\tfilename = url.PathEscape(filename)\n\trelativeURL, _ := url.Parse(path.Join(s.proxyPath, token, filename))\n\tdeleteURL, _ := url.Parse(path.Join(s.proxyPath, token, filename, metadata.DeletionToken))\n\n\tw.Header().Set(\"X-Url-Delete\", resolveURL(r, deleteURL, s.proxyPort))\n\n\tfmt.Fprint(w, resolveURL(r, relativeURL, s.proxyPort))\n}", "label": 0, "label_name": "vulnerable"} +{"code": " protected function _compileRegex()\n {\n $raw = str_replace(' ', '', $this->dtd_regex);\n if ($raw[0] != '(') {\n $raw = \"($raw)\";\n }\n $el = '[#a-zA-Z0-9_.-]+';\n $reg = $raw;\n\n // COMPLICATED! AND MIGHT BE BUGGY! I HAVE NO CLUE WHAT I'M\n // DOING! Seriously: if there's problems, please report them.\n\n // collect all elements into the $elements array\n preg_match_all(\"/$el/\", $reg, $matches);\n foreach ($matches[0] as $match) {\n $this->elements[$match] = true;\n }\n\n // setup all elements as parentheticals with leading commas\n $reg = preg_replace(\"/$el/\", '(,\\\\0)', $reg);\n\n // remove commas when they were not solicited\n $reg = preg_replace(\"/([^,(|]\\(+),/\", '\\\\1', $reg);\n\n // remove all non-paranthetical commas: they are handled by first regex\n $reg = preg_replace(\"/,\\(/\", '(', $reg);\n\n $this->_pcre_regex = $reg;\n }", "label": 1, "label_name": "safe"} +{"code": " init: function () {\n this.createField('createdAt', null, null, 'views/fields/datetime-short');\n this.isUserStream = this.options.isUserStream;\n this.isThis = !this.isUserStream;\n\n this.parentModel = this.options.parentModel;\n\n if (!this.isUserStream) {\n if (this.parentModel) {\n if (\n this.parentModel.name != this.model.get('parentType') ||\n this.parentModel.id != this.model.get('parentId')\n ) {\n this.isThis = false;\n }\n }\n }\n\n if (this.getUser().isAdmin()) {\n this.isRemovable = true;\n }\n\n if (this.messageName && this.isThis) {\n this.messageName += 'This';\n }\n\n if (!this.isThis) {\n this.createField('parent');\n }\n\n this.messageData = {\n 'user': 'field:createdBy',\n 'entity': 'field:parent',\n 'entityType': this.translateEntityType(this.model.get('parentType')),\n };\n\n if (!this.options.noEdit && (this.isEditable || this.isRemovable)) {\n this.createView('right', 'views/stream/row-actions/default', {\n el: this.options.el + ' .right-container',\n acl: this.options.acl,\n model: this.model,\n isEditable: this.isEditable,\n isRemovable: this.isRemovable\n });\n }\n },\n\n translateEntityType: function (entityType, isPlural) {\n var string;\n\n if (!isPlural) {\n string = (this.translate(entityType, 'scopeNames') || '');\n } else {\n string = (this.translate(entityType, 'scopeNamesPlural') || '');\n }\n\n string = string.toLowerCase();\n\n var language = this.getPreferences().get('language') || this.getConfig().get('language');\n\n if (~['de_DE', 'nl_NL'].indexOf(language)) {\n string = Espo.Utils.upperCaseFirst(string);\n }\n return string;\n },\n\n createField: function (name, type, params, view, options) {\n type = type || this.model.getFieldType(name) || 'base';\n var o = {\n model: this.model,\n defs: {\n name: name,\n params: params || {}\n },\n el: this.options.el + ' .cell-' + name,\n mode: 'list'\n };\n if (options) {\n for (var i in options) {\n o[i] = options[i];\n }\n }\n this.createView(name, view || this.getFieldManager().getViewName(type), o);\n },\n\n isMale: function () {\n return this.model.get('createdByGender') === 'Male';\n },\n\n isFemale: function () {\n return this.model.get('createdByGender') === 'Female';\n },\n\n createMessage: function () {\n if (!this.messageTemplate) {\n var isTranslated = false;\n\n var parentType = this.model.get('parentType');\n\n if (this.isMale()) {\n this.messageTemplate = this.translate(this.messageName, 'streamMessagesMale', parentType || null) || '';\n if (this.messageTemplate !== this.messageName) {\n isTranslated = true;\n }\n } else if (this.isFemale()) {\n this.messageTemplate = this.translate(this.messageName, 'streamMessagesFemale', parentType || null) || '';\n if (this.messageTemplate !== this.messageName) {\n isTranslated = true;\n }\n }\n if (!isTranslated) {\n this.messageTemplate = this.translate(this.messageName, 'streamMessages', parentType || null) || '';\n }\n }\n\n this.createView('message', 'views/stream/message', {\n messageTemplate: this.messageTemplate,\n el: this.options.el + ' .message',\n model: this.model,\n messageData: this.messageData\n });\n },\n\n getAvatarHtml: function () {\n var id = this.model.get('createdById');\n if (this.isSystemAvatar) {\n id = 'system';\n }\n return this.getHelper().getAvatarHtml(id, 'small', 20);\n },\n\n getIconHtml: function (scope, id) {\n if (this.isThis && scope === this.parentModel.name) return;\n var iconClass = this.getMetadata().get(['clientDefs', scope, 'iconClass']);\n if (!iconClass) return;\n return '';\n }\n\n });", "label": 0, "label_name": "vulnerable"} +{"code": " def _dump(self, file=None, format=None):\n import tempfile, os\n if not file:\n f, file = tempfile.mkstemp(format or '')\n os.close(f)\n \n self.load()\n if not format or format == \"PPM\":\n self.im.save_ppm(file)\n else:\n if file.endswith(format):\n file = file + \".\" + format\n self.save(file, format)\n return file", "label": 1, "label_name": "safe"} +{"code": " public function confirm()\n {\n $task = $this->getTask();\n $link_id = $this->request->getIntegerParam('link_id');\n $link = $this->taskExternalLinkModel->getById($link_id);\n\n if (empty($link)) {\n throw new PageNotFoundException();\n }\n\n $this->response->html($this->template->render('task_external_link/remove', array(\n 'link' => $link,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "mxSettings.settings.sidebarTitles),this.formatWidth=mxSettings.getFormatWidth());var d=this,g=this.editor.graph;Editor.isDarkMode()&&(g.view.defaultGridColor=mxGraphView.prototype.defaultDarkGridColor);Graph.touchStyle&&(g.panningHandler.isPanningTrigger=function(E){var G=E.getEvent();return null==E.getState()&&!mxEvent.isMouseEvent(G)&&!g.freehand.isDrawing()||mxEvent.isPopupTrigger(G)&&(null==E.getState()||mxEvent.isControlDown(G)||mxEvent.isShiftDown(G))});g.cellEditor.editPlantUmlData=function(E,", "label": 1, "label_name": "safe"} +{"code": " public function getPrevious()\n {\n return $this->previous;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\tselectAll = function() {\n\t\t\t\tvar phash = fm.cwd().hash;\n\n\t\t\t\tcwd.find('[id]:not(.'+clSelected+'):not(.elfinder-cwd-parent)').trigger(evtSelect);\n\t\t\t\tif (lastSearch.length) {\n\t\t\t\t\tselectedFiles = $.map(lastSearch, function(f) { return f.hash; });\n\t\t\t\t} else {\n\t\t\t\t\tselectedFiles = $.map(fm.files(), function(f) { return f.phash == phash ? f.hash : null ;});\n\t\t\t\t}\n\t\t\t\ttrigger();\n\t\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": "ins_comp_get_next_word_or_line(\n\tbuf_T\t*ins_buf,\t\t// buffer being scanned\n\tpos_T\t*cur_match_pos,\t\t// current match position\n\tint\t*match_len,\n\tint\t*cont_s_ipos)\t\t// next ^X<> will set initial_pos\n{\n char_u\t*ptr;\n int\t\tlen;\n\n *match_len = 0;\n ptr = ml_get_buf(ins_buf, cur_match_pos->lnum, FALSE) +\n\tcur_match_pos->col;\n if (ctrl_x_mode_line_or_eval())\n {\n\tif (compl_status_adding())\n\t{\n\t if (cur_match_pos->lnum >= ins_buf->b_ml.ml_line_count)\n\t\treturn NULL;\n\t ptr = ml_get_buf(ins_buf, cur_match_pos->lnum + 1, FALSE);\n\t if (!p_paste)\n\t\tptr = skipwhite(ptr);\n\t}\n\tlen = (int)STRLEN(ptr);\n }\n else\n {\n\tchar_u\t*tmp_ptr = ptr;\n\n\tif (compl_status_adding())\n\t{\n\t tmp_ptr += compl_length;\n\t // Skip if already inside a word.\n\t if (vim_iswordp(tmp_ptr))\n\t\treturn NULL;\n\t // Find start of next word.\n\t tmp_ptr = find_word_start(tmp_ptr);\n\t}\n\t// Find end of this word.\n\ttmp_ptr = find_word_end(tmp_ptr);\n\tlen = (int)(tmp_ptr - ptr);\n\n\tif (compl_status_adding() && len == compl_length)\n\t{\n\t if (cur_match_pos->lnum < ins_buf->b_ml.ml_line_count)\n\t {\n\t\t// Try next line, if any. the new word will be\n\t\t// \"join\" as if the normal command \"J\" was used.\n\t\t// IOSIZE is always greater than\n\t\t// compl_length, so the next STRNCPY always\n\t\t// works -- Acevedo\n\t\tSTRNCPY(IObuff, ptr, len);\n\t\tptr = ml_get_buf(ins_buf, cur_match_pos->lnum + 1, FALSE);\n\t\ttmp_ptr = ptr = skipwhite(ptr);\n\t\t// Find start of next word.\n\t\ttmp_ptr = find_word_start(tmp_ptr);\n\t\t// Find end of next word.\n\t\ttmp_ptr = find_word_end(tmp_ptr);\n\t\tif (tmp_ptr > ptr)\n\t\t{\n\t\t if (*ptr != ')' && IObuff[len - 1] != TAB)\n\t\t {\n\t\t\tif (IObuff[len - 1] != ' ')\n\t\t\t IObuff[len++] = ' ';\n\t\t\t// IObuf =~ \"\\k.* \", thus len >= 2\n\t\t\tif (p_js\n\t\t\t\t&& (IObuff[len - 2] == '.'\n\t\t\t\t || (vim_strchr(p_cpo, CPO_JOINSP)\n\t\t\t\t\t== NULL\n\t\t\t\t\t&& (IObuff[len - 2] == '?'\n\t\t\t\t\t || IObuff[len - 2] == '!'))))\n\t\t\t IObuff[len++] = ' ';\n\t\t }\n\t\t // copy as much as possible of the new word\n\t\t if (tmp_ptr - ptr >= IOSIZE - len)\n\t\t\ttmp_ptr = ptr + IOSIZE - len - 1;\n\t\t STRNCPY(IObuff + len, ptr, tmp_ptr - ptr);\n\t\t len += (int)(tmp_ptr - ptr);\n\t\t *cont_s_ipos = TRUE;\n\t\t}\n\t\tIObuff[len] = NUL;\n\t\tptr = IObuff;\n\t }\n\t if (len == compl_length)\n\t\treturn NULL;\n\t}\n }\n\n *match_len = len;\n return ptr;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int oidc_request_post_preserved_restore(request_rec *r,\n\t\tconst char *original_url) {\n\n\toidc_debug(r, \"enter: original_url=%s\", original_url);\n\n\tconst char *method = \"postOnLoad\";\n\tconst char *script =\n\t\t\tapr_psprintf(r->pool,\n\t\t\t\t\t\" \\n\", method, original_url);\n\n\tconst char *body = \"

    Restoring...

    \\n\"\n\t\t\t\"
    \\n\";\n\n\treturn oidc_util_html_send(r, \"Restoring...\", script, method, body,\n\t\t\tOK);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " void copyBytes(InStream* is, int length) {\n while (length > 0) {\n int n = check(1, length);\n is->readBytes(ptr, n);\n ptr += n;\n length -= n;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def test_captcha_validate_value(self):\n captcha = FlaskSessionCaptcha(self.app)\n _default_routes(captcha, self.app)\n\n with self.app.test_request_context('/'):\n captcha.generate()\n answer = captcha.get_answer()\n assert not captcha.validate(value=\"wrong\")\n captcha.generate()\n answer = captcha.get_answer()\n assert captcha.validate(value=answer)", "label": 0, "label_name": "vulnerable"} +{"code": "(z=2);return z};var I=mxVertexHandler.prototype.getSelectionBorderBounds;mxVertexHandler.prototype.getSelectionBorderBounds=function(){return I.apply(this,arguments).grow(-this.getSelectionBorderInset())};var V=null,Q=mxVertexHandler.prototype.createCustomHandles;mxVertexHandler.prototype.createCustomHandles=function(){null==V&&(V=mxCellRenderer.defaultShapes.tableLine);var z=Q.apply(this,arguments);if(this.graph.isTable(this.state.cell)){var L=function(Ta,za,wa){for(var Ea=[],Da=0;Daparser->default = 'NEW-ID';\n $this->assertParse('Default.txt', array(\n 'NEW-ID' => 'DefaultValue',\n ));\n }", "label": 1, "label_name": "safe"} +{"code": " protected function processDataUrl()\n {\n $mime = $this->image->mime ? $this->image->mime : 'image/png';\n\n return sprintf('data:%s;base64,%s',\n $mime,\n base64_encode($this->process($this->image, $mime, $this->quality))\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": " protected void configure(HttpSecurity http) throws Exception {\n\n RESTRequestParameterProcessingFilter restAuthenticationFilter = new RESTRequestParameterProcessingFilter();\n restAuthenticationFilter.setAuthenticationManager(authenticationManagerBean());\n restAuthenticationFilter.setSecurityService(securityService);\n restAuthenticationFilter.setEventPublisher(eventPublisher);\n http = http.addFilterBefore(restAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);\n\n http\n .csrf()\n .requireCsrfProtectionMatcher(csrfSecurityRequestMatcher)\n .and().headers()\n .frameOptions()\n .sameOrigin()\n .and().authorizeRequests()\n .antMatchers(\"/recover*\", \"/accessDenied*\",\n \"/style/**\", \"/icons/**\", \"/flash/**\", \"/script/**\",\n \"/sonos/**\", \"/crossdomain.xml\", \"/login\", \"/error\")\n .permitAll()\n .antMatchers(\"/personalSettings*\", \"/passwordSettings*\",\n \"/playerSettings*\", \"/shareSettings*\", \"/passwordSettings*\")\n .hasRole(\"SETTINGS\")\n .antMatchers(\"/generalSettings*\", \"/advancedSettings*\", \"/userSettings*\",\n \"/musicFolderSettings*\", \"/databaseSettings*\", \"/transcodeSettings*\", \"/rest/startScan*\")\n .hasRole(\"ADMIN\")\n .antMatchers(\"/deletePlaylist*\", \"/savePlaylist*\", \"/db*\")\n .hasRole(\"PLAYLIST\")\n .antMatchers(\"/download*\")\n .hasRole(\"DOWNLOAD\")\n .antMatchers(\"/upload*\")\n .hasRole(\"UPLOAD\")\n .antMatchers(\"/createShare*\")\n .hasRole(\"SHARE\")\n .antMatchers(\"/changeCoverArt*\", \"/editTags*\")\n .hasRole(\"COVERART\")\n .antMatchers(\"/setMusicFileInfo*\")\n .hasRole(\"COMMENT\")\n .antMatchers(\"/podcastReceiverAdmin*\")\n .hasRole(\"PODCAST\")\n .antMatchers(\"/**\")\n .hasRole(\"USER\")\n .anyRequest().authenticated()\n .and().formLogin()\n .loginPage(\"/login\")\n .permitAll()\n .defaultSuccessUrl(\"/index\", true)\n .failureUrl(FAILURE_URL)\n .usernameParameter(\"j_username\")\n .passwordParameter(\"j_password\")\n // see http://docs.spring.io/spring-security/site/docs/3.2.4.RELEASE/reference/htmlsingle/#csrf-logout\n .and().logout().logoutRequestMatcher(new AntPathRequestMatcher(\"/logout\", \"GET\")).logoutSuccessUrl(\n \"/login?logout\")\n .and().rememberMe().key(\"airsonic\");\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function &getContainer() {\n //echo __METHOD__ . \"\\n\";\n static $pop3_container;\n\n $file = 'Net/POP3.php';\n if (!$fp = @fopen($file, 'r', true)) {\n $this->markTestSkipped(\"$file package is not installed.\");\n }\n fclose($fp);\n\n if(!isset($pop3_container)){\n require_once 'Auth/Container/POP3.php';\n include dirname(__FILE__) . '/auth_container_pop3_options.php';\n $pop3_container = new Auth_Container_POP3($options);\n }\n return $pop3_container;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int b_unpack (lua_State *L) {\n Header h;\n const char *fmt = luaL_checkstring(L, 1);\n size_t ld;\n const char *data = luaL_checklstring(L, 2, &ld);\n size_t pos = luaL_optinteger(L, 3, 1);\n luaL_argcheck(L, pos > 0, 3, \"offset must be 1 or greater\");\n pos--; /* Lua indexes are 1-based, but here we want 0-based for C\n * pointer math. */\n int n = 0; /* number of results */\n defaultoptions(&h);\n while (*fmt) {\n int opt = *fmt++;\n size_t size = optsize(L, opt, &fmt);\n pos += gettoalign(pos, &h, opt, size);\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n /* stack space for item + next position */\n luaL_checkstack(L, 2, \"too many results\");\n switch (opt) {\n case 'b': case 'B': case 'h': case 'H':\n case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */\n int issigned = islower(opt);\n lua_Number res = getinteger(data+pos, h.endian, issigned, size);\n lua_pushnumber(L, res); n++;\n break;\n }\n case 'x': {\n break;\n }\n case 'f': {\n float f;\n memcpy(&f, data+pos, size);\n correctbytes((char *)&f, sizeof(f), h.endian);\n lua_pushnumber(L, f); n++;\n break;\n }\n case 'd': {\n double d;\n memcpy(&d, data+pos, size);\n correctbytes((char *)&d, sizeof(d), h.endian);\n lua_pushnumber(L, d); n++;\n break;\n }\n case 'c': {\n if (size == 0) {\n if (n == 0 || !lua_isnumber(L, -1))\n luaL_error(L, \"format 'c0' needs a previous size\");\n size = lua_tonumber(L, -1);\n lua_pop(L, 1); n--;\n luaL_argcheck(L, size <= ld && pos <= ld - size,\n 2, \"data string too short\");\n }\n lua_pushlstring(L, data+pos, size); n++;\n break;\n }\n case 's': {\n const char *e = (const char *)memchr(data+pos, '\\0', ld - pos);\n if (e == NULL)\n luaL_error(L, \"unfinished string in data\");\n size = (e - (data+pos)) + 1;\n lua_pushlstring(L, data+pos, size - 1); n++;\n break;\n }\n default: controloptions(L, opt, &fmt, &h);\n }\n pos += size;\n }\n lua_pushinteger(L, pos + 1); /* next position */\n return n + 1;\n}", "label": 1, "label_name": "safe"} +{"code": "func (evpool *Pool) removePendingEvidence(evidence types.Evidence) {\n\tkey := keyPending(evidence)\n\tif err := evpool.evidenceStore.Delete(key); err != nil {\n\t\tevpool.logger.Error(\"Unable to delete pending evidence\", \"err\", err)\n\t} else {\n\t\tatomic.AddUint32(&evpool.evidenceSize, ^uint32(0))\n\t\tevpool.logger.Info(\"Deleted pending evidence\", \"evidence\", evidence)\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": " $this->assertSame((string)$urlA, (string)$urlB);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private function validationRegex(){\n return '/^.*\\.('.implode('|',[\"php\",\"php5\",\"php7\"]).')$/i';\n }", "label": 1, "label_name": "safe"} +{"code": "document.body.clientWidth||document.documentElement.clientWidth)-this.table.clientWidth));E=Math.max(0,Math.min(E,H-this.table.clientHeight-48));this.getX()==J&&this.getY()==E||mxWindow.prototype.setLocation.apply(this,arguments)};var N=mxUtils.bind(this,function(){var J=this.window.getX(),E=this.window.getY();this.window.setLocation(J,E)});mxEvent.addListener(window,\"resize\",N);this.destroy=function(){mxEvent.removeListener(window,\"resize\",N);this.window.destroy()}},ConfirmDialog=function(b,f,l,\nd,u,t,D,c,e,g,k){var m=document.createElement(\"div\");m.style.textAlign=\"center\";k=null!=k?k:44;var q=document.createElement(\"div\");q.style.padding=\"6px\";q.style.overflow=\"auto\";q.style.maxHeight=k+\"px\";q.style.lineHeight=\"1.2em\";mxUtils.write(q,f);m.appendChild(q);null!=g&&(q=document.createElement(\"div\"),q.style.padding=\"6px 0 6px 0\",f=document.createElement(\"img\"),f.setAttribute(\"src\",g),q.appendChild(f),m.appendChild(q));g=document.createElement(\"div\");g.style.textAlign=\"center\";g.style.whiteSpace=\n\"nowrap\";var v=document.createElement(\"input\");v.setAttribute(\"type\",\"checkbox\");t=mxUtils.button(t||mxResources.get(\"cancel\"),function(){b.hideDialog();null!=d&&d(v.checked)});t.className=\"geBtn\";null!=c&&(t.innerHTML=c+\"
    \"+t.innerHTML,t.style.paddingBottom=\"8px\",t.style.paddingTop=\"8px\",t.style.height=\"auto\",t.style.width=\"40%\");b.editor.cancelFirst&&g.appendChild(t);var y=mxUtils.button(u||mxResources.get(\"ok\"),function(){b.hideDialog();null!=l&&l(v.checked)});g.appendChild(y);null!=D?(y.innerHTML=\nD+\"
    \"+y.innerHTML+\"
    \",y.style.paddingBottom=\"8px\",y.style.paddingTop=\"8px\",y.style.height=\"auto\",y.className=\"geBtn\",y.style.width=\"40%\"):y.className=\"geBtn gePrimaryBtn\";b.editor.cancelFirst||g.appendChild(t);m.appendChild(g);e?(g.style.marginTop=\"10px\",q=document.createElement(\"p\"),q.style.marginTop=\"20px\",q.style.marginBottom=\"0px\",q.appendChild(v),u=document.createElement(\"span\"),mxUtils.write(u,\" \"+mxResources.get(\"rememberThisSetting\")),q.appendChild(u),m.appendChild(q),mxEvent.addListener(u,\n\"click\",function(A){v.checked=!v.checked;mxEvent.consume(A)})):g.style.marginTop=\"12px\";this.init=function(){y.focus()};this.container=m};EditorUi.DIFF_INSERT=\"i\";EditorUi.DIFF_REMOVE=\"r\";EditorUi.DIFF_UPDATE=\"u\";EditorUi.transientViewStateProperties=\"defaultParent currentRoot scrollLeft scrollTop scale translate lastPasteXml pasteCounter\".split(\" \");EditorUi.prototype.viewStateProperties={background:!0,backgroundImage:!0,shadowVisible:!0,foldingEnabled:!0,pageScale:!0,mathEnabled:!0,pageFormat:!0,extFonts:!0};", "label": 1, "label_name": "safe"} +{"code": "func (m *NestedScope) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: NestedScope: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: NestedScope: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field A\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.A == nil {\n\t\t\t\tm.A = &NestedDefinition_NestedMessage_NestedNestedMsg{}\n\t\t\t}\n\t\t\tif err := m.A.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field B\", wireType)\n\t\t\t}\n\t\t\tvar v NestedDefinition_NestedEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= NestedDefinition_NestedEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.B = &v\n\t\tcase 3:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field C\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.C == nil {\n\t\t\t\tm.C = &NestedDefinition_NestedMessage{}\n\t\t\t}\n\t\t\tif err := m.C.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " $chrootPath = realpath($chrootPath);\n if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) {\n $chrootValid = true;\n break;\n }\n }\n if ($chrootValid !== true) {\n Helpers::record_warnings(E_USER_WARNING, \"Permission denied on $file. The file could not be found under the paths specified by Options::chroot.\", __FILE__, __LINE__);\n return;\n }\n }\n\n if (!$realfile) {\n Helpers::record_warnings(E_USER_WARNING, \"File '$realfile' not found.\", __FILE__, __LINE__);\n return;\n }\n\n $file = $realfile;\n }\n \n [$css, $http_response_header] = Helpers::getFileContent($file, $this->_dompdf->getHttpContext());\n\n $good_mime_type = true;\n\n // See http://the-stickman.com/web-development/php/getting-http-response-headers-when-using-file_get_contents/\n if (isset($http_response_header) && !$this->_dompdf->getQuirksmode()) {\n foreach ($http_response_header as $_header) {\n if (preg_match(\"@Content-Type:\\s*([\\w/]+)@i\", $_header, $matches) &&\n ($matches[1] !== \"text/css\")\n ) {\n $good_mime_type = false;\n }\n }\n }\n\n if (!$good_mime_type || $css === null) {\n Helpers::record_warnings(E_USER_WARNING, \"Unable to load css file $file\", __FILE__, __LINE__);\n return;\n }\n }\n\n $this->_parse_css($css);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int userfaultfd_release(struct inode *inode, struct file *file)\n{\n\tstruct userfaultfd_ctx *ctx = file->private_data;\n\tstruct mm_struct *mm = ctx->mm;\n\tstruct vm_area_struct *vma, *prev;\n\t/* len == 0 means wake all */\n\tstruct userfaultfd_wake_range range = { .len = 0, };\n\tunsigned long new_flags;\n\n\tWRITE_ONCE(ctx->released, true);\n\n\tif (!mmget_not_zero(mm))\n\t\tgoto wakeup;\n\n\t/*\n\t * Flush page faults out of all CPUs. NOTE: all page faults\n\t * must be retried without returning VM_FAULT_SIGBUS if\n\t * userfaultfd_ctx_get() succeeds but vma->vma_userfault_ctx\n\t * changes while handle_userfault released the mmap_sem. So\n\t * it's critical that released is set to true (above), before\n\t * taking the mmap_sem for writing.\n\t */\n\tdown_write(&mm->mmap_sem);\n\tif (!mmget_still_valid(mm))\n\t\tgoto skip_mm;\n\tprev = NULL;\n\tfor (vma = mm->mmap; vma; vma = vma->vm_next) {\n\t\tcond_resched();\n\t\tBUG_ON(!!vma->vm_userfaultfd_ctx.ctx ^\n\t\t !!(vma->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP)));\n\t\tif (vma->vm_userfaultfd_ctx.ctx != ctx) {\n\t\t\tprev = vma;\n\t\t\tcontinue;\n\t\t}\n\t\tnew_flags = vma->vm_flags & ~(VM_UFFD_MISSING | VM_UFFD_WP);\n\t\tprev = vma_merge(mm, prev, vma->vm_start, vma->vm_end,\n\t\t\t\t new_flags, vma->anon_vma,\n\t\t\t\t vma->vm_file, vma->vm_pgoff,\n\t\t\t\t vma_policy(vma),\n\t\t\t\t NULL_VM_UFFD_CTX);\n\t\tif (prev)\n\t\t\tvma = prev;\n\t\telse\n\t\t\tprev = vma;\n\t\tvma->vm_flags = new_flags;\n\t\tvma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;\n\t}\nskip_mm:\n\tup_write(&mm->mmap_sem);\n\tmmput(mm);\nwakeup:\n\t/*\n\t * After no new page faults can wait on this fault_*wqh, flush\n\t * the last page faults that may have been already waiting on\n\t * the fault_*wqh.\n\t */\n\tspin_lock(&ctx->fault_pending_wqh.lock);\n\t__wake_up_locked_key(&ctx->fault_pending_wqh, TASK_NORMAL, &range);\n\t__wake_up(&ctx->fault_wqh, TASK_NORMAL, 1, &range);\n\tspin_unlock(&ctx->fault_pending_wqh.lock);\n\n\t/* Flush pending events that may still wait on event_wqh */\n\twake_up_all(&ctx->event_wqh);\n\n\twake_up_poll(&ctx->fd_wqh, EPOLLHUP);\n\tuserfaultfd_ctx_put(ctx);\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "UrlQuery::UrlQuery(const std::string& encoded_str) {\n if (!encoded_str.empty()) {\n // Split into key value pairs separated by '&'.\n for (std::size_t i = 0; i != std::string::npos;) {\n std::size_t j = encoded_str.find_first_of('&', i);\n\n std::string kv;\n if (j == std::string::npos) {\n kv = encoded_str.substr(i);\n i = std::string::npos;\n } else {\n kv = encoded_str.substr(i, j - i);\n i = j + 1;\n }\n\n string_view key;\n string_view value;\n if (SplitKV(kv, '=', false, &key, &value)) {\n parameters_.push_back({ DecodeUnsafe(key), DecodeUnsafe(value) });\n }\n }\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public SAXEntityResolver(String uriPrefix) {\n this.uriPrefix = uriPrefix;\n }", "label": 1, "label_name": "safe"} +{"code": "null!=this.linkHint&&(this.linkHint.style.visibility=\"\")};var $a=mxEdgeHandler.prototype.destroy;mxEdgeHandler.prototype.destroy=function(){$a.apply(this,arguments);null!=this.linkHint&&(this.linkHint.parentNode.removeChild(this.linkHint),this.linkHint=null);null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getSelectionModel().removeListener(this.changeHandler),this.changeHandler=null)}}();(function(){function b(c,l,x){mxShape.call(this);this.line=c;this.stroke=l;this.strokewidth=null!=x?x:1;this.updateBoundsFromLine()}function e(){mxSwimlane.call(this)}function k(){mxSwimlane.call(this)}function n(){mxCylinder.call(this)}function D(){mxCylinder.call(this)}function t(){mxActor.call(this)}function F(){mxCylinder.call(this)}function d(){mxCylinder.call(this)}function f(){mxCylinder.call(this)}function g(){mxCylinder.call(this)}function m(){mxShape.call(this)}function q(){mxShape.call(this)}", "label": 1, "label_name": "safe"} +{"code": " function dump() {\n\n if (!$this->output)\n $this->output = fopen('php://output', 'w');\n\n // Detect delimeter from the current locale settings. For locales\n // which use comma (,) as the decimal separator, the semicolon (;)\n // should be used as the field separator\n $delimiter = ',';\n if (class_exists('NumberFormatter')) {\n $nf = NumberFormatter::create(Internationalization::getCurrentLocale(),\n NumberFormatter::DECIMAL);\n $s = $nf->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);\n if ($s == ',')\n $delimiter = ';';\n }\n\n // Output a UTF-8 BOM (byte order mark)\n fputs($this->output, chr(0xEF) . chr(0xBB) . chr(0xBF));\n fputcsv($this->output, $this->getHeaders(), $delimiter);\n while ($row=$this->next())\n fputcsv($this->output, $row, $delimiter);\n\n fclose($this->output);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def grant(user, table, privileges, options)\n user_string = self.class.cmd_user(user)\n priv_string = self.class.cmd_privs(privileges)\n table_string = self.class.cmd_table(table)\n query = \"GRANT #{priv_string}\"\n query << \" ON #{table_string}\"\n query << \" TO #{user_string}\"\n query << self.class.cmd_options(options) unless options.nil?\n mysql([defaults_file, '-e', query].compact)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function unserialize( $serialized ) {\n\t}", "label": 1, "label_name": "safe"} +{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n lambda { scope.function_staging_parse([]) }.should( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus PrepareMeanOrSum(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_OK(context, PrepareSimple(context, node));\n OpData* data = reinterpret_cast(node->user_data);\n\n // reduce_mean requires a buffer to store intermediate sum result.\n OpContext op_context(context, node);\n if (op_context.input->type == kTfLiteInt8 ||\n op_context.input->type == kTfLiteUInt8 ||\n op_context.input->type == kTfLiteInt16) {\n const double real_multiplier =\n static_cast(op_context.input->params.scale) /\n static_cast(op_context.output->params.scale);\n int exponent;\n QuantizeMultiplier(real_multiplier, &data->multiplier, &exponent);\n data->shift = exponent;\n }\n TfLiteTensor* temp_sum;\n TF_LITE_ENSURE_OK(context,\n GetTemporarySafe(context, node, /*index=*/2, &temp_sum));\n if (!IsConstantTensor(op_context.axis)) {\n SetTensorToDynamic(temp_sum);\n return kTfLiteOk;\n }\n temp_sum->allocation_type = kTfLiteArenaRw;\n return ResizeTempSum(context, &op_context, temp_sum);\n}", "label": 1, "label_name": "safe"} +{"code": "\nstatic void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */\n{\n\tphp_mcrypt *pm = (php_mcrypt *) rsrc->ptr;\n\tif (pm) {\t\n\t\tmcrypt_generic_deinit(pm->td);\n\t\tmcrypt_module_close(pm->td);\n\t\tefree(pm);\n\t\tpm = NULL;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testResolvesUris($base, $rel, $expected)\n {\n $uri = new Uri($base);\n $actual = Uri::resolve($uri, $rel);\n $this->assertSame($expected, (string) $actual);\n }", "label": 1, "label_name": "safe"} +{"code": " title: \" \" + $(\"#navigrid-extension-options\").attr(\"title\")\r\n }).dialogExtend(\r\n {\r\n maximizable: true\r\n });\r\n });\r\n\r\n $(\".navigrid-extensions-remove\").bind(\"click\", function()\r\n {\r\n var extension = $(this).parent().attr(\"extension\");\r\n\r\n $(\"#navigrid-extensions-remove-confirmation\").dialog(\r\n {\r\n resizable: true,\r\n width: 300,\r\n height: 150,\r\n modal: true,\r\n buttons:\r\n [\r\n {\r\n text: navigate_lang_dictionary[190],\r\n click: function()\r\n {\r\n $.post(\r\n NAVIGATE_APP + \"?fid=extensions&act=remove&extension=\" + extension,\r\n { },\r\n function(data)\r\n {\r\n if(data==\"true\")\r\n {\r\n $(\"#item-\" + extension).fadeOut(\"slow\", function(){ $(\"#item-\" + extension).remove(); });\r\n }\r\n else\r\n {\r\n navigate_notification(navigate_lang_dictionary[56]);\r\n }\r\n }\r\n );\r\n $( this ).dialog( \"close\" );\r\n }\r\n },\r\n {\r\n text: navigate_lang_dictionary[58],\r\n click: function()\r\n {\r\n $( this ).dialog( \"close\" );\r\n }\r\n }\r\n ]\r\n });\r\n return false;\r\n });\r\n\r\n $(\".navigrid-extensions-update\").on(\"click\", function()\r\n {\r\n var extension = $(this).parent().attr(\"extension\");\r\n\r\n $(\"#navigrid-extensions-update\").dialog(\r\n {\r\n resizable: false,\r\n width: 980,\r\n height: 650,\r\n modal: true\r\n }\r\n );\r\n\r\n $(\"#navigrid-extensions-update\").find('iframe').\r\n css({\r\n \"width\": \"960\",\r\n \"height\": 600\r\n }).\r\n attr('src', 'http://www.navigatecms.com/en/marketplace/purchase?extension='+extension+'&get_update')\r\n\r\n return false;\r\n });\r\n\r\n $(\".navigrid-item-buttonset\").each(function(i, el)\r\n {\r\n $(el).hide().css(\"visibility\", \"visible\");\r\n $(el).fadeIn();\r\n $(\".navigrid-extensions-disable\").addClass(\"ui-corner-right\");\r\n });\r\n\r\n $(\"#extension-upload-button\").on(\"click\", function()\r\n {\r\n $(\"#extension-upload-button\").parent().find(\"form\").remove();\r\n $(\"#extension-upload-button\").after('
    ');\r\n $(\"#extension-upload-button\").next().append('');\r\n $(\"#extension-upload-button\").next().append('');\r\n\r\n $(\"#extension-upload-button\").next().find(\"input\").on(\"change\", function()\r\n {\r\n if($(this).val()!=\"\")\r\n {\r\n $(this).parent().submit();\r\n }\r\n });\r\n $(\"#extension-upload-button\").next().find(\"input\").trigger(\"click\");\r\n\r\n return false;\r\n });\r\n}\r", "label": 1, "label_name": "safe"} +{"code": "static void read_conf(FILE *conffile)\n{\n char *buffer, *line, *val;\n\n buffer = loadfile(conffile);\n for (line = strtok(buffer, \"\\r\\n\"); line; line = strtok(NULL, \"\\r\\n\")) {\n if (!strncmp(line, \"export \", 7))\n continue;\n val = strchr(line, '=');\n if (!val) {\n printf(\"invalid configuration line\\n\");\n break;\n }\n *val++ = '\\0';\n\n if (!strcmp(line, \"JSON_INDENT\"))\n conf.indent = atoi(val);\n if (!strcmp(line, \"JSON_COMPACT\"))\n conf.compact = atoi(val);\n if (!strcmp(line, \"JSON_ENSURE_ASCII\"))\n conf.ensure_ascii = atoi(val);\n if (!strcmp(line, \"JSON_PRESERVE_ORDER\"))\n conf.preserve_order = atoi(val);\n if (!strcmp(line, \"JSON_SORT_KEYS\"))\n conf.sort_keys = atoi(val);\n if (!strcmp(line, \"STRIP\"))\n conf.strip = atoi(val);\n if (!strcmp(line, \"HASHSEED\")) {\n conf.have_hashseed = 1;\n conf.hashseed = atoi(val);\n } else {\n conf.have_hashseed = 0;\n }\n }\n\n free(buffer);\n}", "label": 1, "label_name": "safe"} +{"code": " def login_success\n if params[:ref].blank?\n redirect_to default_logged_in_path\n elsif params[:ref] =~ /^\\/[^\\/]/\n redirect_to params[:ref]\n else\n render \"sns/login/redirect\"\n end\n end", "label": 1, "label_name": "safe"} +{"code": " void Compute(OpKernelContext* ctx) override {\n auto value = ctx->input(0);\n // Value should be at least rank 1. Also the 0th dimension should be\n // at least loc_.\n OP_REQUIRES(ctx, value.dims() >= 1,\n errors::InvalidArgument(\"value should be at least rank 1.\"));\n OP_REQUIRES(\n ctx, value.dim_size(0) > loc_,\n errors::InvalidArgument(\"0th dimension of value = \", value.dim_size(0),\n \" is less than loc_=\", loc_));\n\n auto update = ctx->input(1);\n\n OP_REQUIRES(\n ctx, value.dims() == update.dims(),\n errors::InvalidArgument(\"value and update shape doesn't match: \",\n value.shape().DebugString(), \" vs. \",\n update.shape().DebugString()));\n for (int i = 1; i < value.dims(); ++i) {\n OP_REQUIRES(\n ctx, value.dim_size(i) == update.dim_size(i),\n errors::InvalidArgument(\"value and update shape doesn't match \",\n value.shape().DebugString(), \" vs. \",\n update.shape().DebugString()));\n }\n OP_REQUIRES(ctx, 1 == update.dim_size(0),\n errors::InvalidArgument(\"update shape doesn't match: \",\n update.shape().DebugString()));\n\n Tensor output = value; // This creates an alias intentionally.\n const auto& d = ctx->eigen_device();\n OP_REQUIRES_OK(\n ctx, ::tensorflow::functor::DoParallelConcat(d, update, loc_, &output));\n ctx->set_output(0, output);\n }", "label": 1, "label_name": "safe"} +{"code": " public function validateDirective($d)\n {\n $id = $d->id->toString();\n $this->context[] = \"directive '$id'\";\n $this->validateId($d->id);\n\n $this->with($d, 'description')\n ->assertNotEmpty();\n\n // BEGIN - handled by InterchangeBuilder\n $this->with($d, 'type')\n ->assertNotEmpty();\n $this->with($d, 'typeAllowsNull')\n ->assertIsBool();\n try {\n // This also tests validity of $d->type\n $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);\n } catch (HTMLPurifier_VarParserException $e) {\n $this->error('default', 'had error: ' . $e->getMessage());\n }\n // END - handled by InterchangeBuilder\n\n if (!is_null($d->allowed) || !empty($d->valueAliases)) {\n // allowed and valueAliases require that we be dealing with\n // strings, so check for that early.\n $d_int = HTMLPurifier_VarParser::$types[$d->type];\n if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {\n $this->error('type', 'must be a string type when used with allowed or value aliases');\n }\n }\n\n $this->validateDirectiveAllowed($d);\n $this->validateDirectiveValueAliases($d);\n $this->validateDirectiveAliases($d);\n\n array_pop($this->context);\n }", "label": 1, "label_name": "safe"} +{"code": "static void WritePixels(struct ngiflib_img * i, struct ngiflib_decode_context * context, const u8 * pixels, u16 n) {\n\tu16 tocopy;\t\n\tstruct ngiflib_gif * p = i->parent;\n\n\twhile(n > 0) {\n\t\ttocopy = (context->Xtogo < n) ? context->Xtogo : n;\n\t\tif(!i->gce.transparent_flag) {\n#ifndef NGIFLIB_INDEXED_ONLY\n\t\t\tif(p->mode & NGIFLIB_MODE_INDEXED) {\n#endif /* NGIFLIB_INDEXED_ONLY */\n\t\t\t\tngiflib_memcpy(context->frbuff_p.p8, pixels, tocopy);\n\t\t\t\tpixels += tocopy;\n\t\t\t\tcontext->frbuff_p.p8 += tocopy;\n#ifndef NGIFLIB_INDEXED_ONLY\n\t\t\t} else {\n\t\t\t\tint j;\n\t\t\t\tfor(j = (int)tocopy; j > 0; j--) {\n\t\t\t\t\t*(context->frbuff_p.p32++) =\n\t\t\t\t\t GifIndexToTrueColor(i->palette, *pixels++);\n\t\t\t\t}\n\t\t\t}\n#endif /* NGIFLIB_INDEXED_ONLY */\n\t\t} else {\n\t\t\tint j;\n#ifndef NGIFLIB_INDEXED_ONLY\n\t\t\tif(p->mode & NGIFLIB_MODE_INDEXED) {\n#endif /* NGIFLIB_INDEXED_ONLY */\n\t\t\t\tfor(j = (int)tocopy; j > 0; j--) {\n\t\t\t\t\tif(*pixels != i->gce.transparent_color) *context->frbuff_p.p8 = *pixels;\n\t\t\t\t\tpixels++;\n\t\t\t\t\tcontext->frbuff_p.p8++;\n\t\t\t\t}\n#ifndef NGIFLIB_INDEXED_ONLY\n\t\t\t} else {\n\t\t\t\tfor(j = (int)tocopy; j > 0; j--) {\n\t\t\t\t\tif(*pixels != i->gce.transparent_color) {\n\t\t\t\t\t\t*context->frbuff_p.p32 = GifIndexToTrueColor(i->palette, *pixels);\n\t\t\t\t\t}\n\t\t\t\t\tpixels++;\n\t\t\t\t\tcontext->frbuff_p.p32++;\n\t\t\t\t}\n\t\t\t}\n#endif /* NGIFLIB_INDEXED_ONLY */\n\t\t}\n\t\tcontext->Xtogo -= tocopy;\n\t\tif(context->Xtogo == 0) {\n\t\t\t#ifdef NGIFLIB_ENABLE_CALLBACKS\n\t\t\tif(p->line_cb) p->line_cb(p, context->line_p, context->curY);\n\t\t\t#endif /* NGIFLIB_ENABLE_CALLBACKS */\n\t\t\tcontext->Xtogo = i->width;\n\t\t\tswitch(context->pass) {\n\t\t\tcase 0:\n\t\t\t\tcontext->curY++;\n\t\t\t\tbreak;\n\t\t\tcase 1:\t/* 1st pass : every eighth row starting from 0 */\n\t\t\t\tcontext->curY += 8;\n\t\t\t\tif(context->curY >= p->height) {\n\t\t\t\t\tcontext->pass++;\n\t\t\t\t\tcontext->curY = i->posY + 4;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 2:\t/* 2nd pass : every eighth row starting from 4 */\n\t\t\t\tcontext->curY += 8;\n\t\t\t\tif(context->curY >= p->height) {\n\t\t\t\t\tcontext->pass++;\n\t\t\t\t\tcontext->curY = i->posY + 2;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 3:\t/* 3rd pass : every fourth row starting from 2 */\n\t\t\t\tcontext->curY += 4;\n\t\t\t\tif(context->curY >= p->height) {\n\t\t\t\t\tcontext->pass++;\n\t\t\t\t\tcontext->curY = i->posY + 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 4:\t/* 4th pass : every odd row */\n\t\t\t\tcontext->curY += 2;\n\t\t\t\tbreak;\n\t\t\t}\n#ifndef NGIFLIB_INDEXED_ONLY\n\t\t\tif(p->mode & NGIFLIB_MODE_INDEXED) {\n#endif /* NGIFLIB_INDEXED_ONLY */\n\t\t\t\t#ifdef NGIFLIB_ENABLE_CALLBACKS\n\t\t\t\tcontext->line_p.p8 = p->frbuff.p8 + (u32)context->curY*p->width;\n\t\t\t\tcontext->frbuff_p.p8 = context->line_p.p8 + i->posX;\n\t\t\t\t#else\n\t\t\t\tcontext->frbuff_p.p8 = p->frbuff.p8 + (u32)context->curY*p->width + i->posX;\n\t\t\t\t#endif /* NGIFLIB_ENABLE_CALLBACKS */\n#ifndef NGIFLIB_INDEXED_ONLY\n\t\t\t} else {\n\t\t\t\t#ifdef NGIFLIB_ENABLE_CALLBACKS\n\t\t\t\tcontext->line_p.p32 = p->frbuff.p32 + (u32)context->curY*p->width;\n\t\t\t\tcontext->frbuff_p.p32 = context->line_p.p32 + i->posX;\n\t\t\t\t#else\n\t\t\t\tcontext->frbuff_p.p32 = p->frbuff.p32 + (u32)context->curY*p->width + i->posX;\n\t\t\t\t#endif /* NGIFLIB_ENABLE_CALLBACKS */\n\t\t\t}\n#endif /* NGIFLIB_INDEXED_ONLY */\n\t\t}\n\t\tn -= tocopy;\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": " private void checkMimeType(String given, String expected) throws IOException, URISyntaxException {\n HttpExchange exchange = prepareExchange(\"http://localhost:8080/jolokia/read/java.lang:type=Memory/HeapMemoryUsage?mimeType=\" + given);\n\n // Simple GET method\n expect(exchange.getRequestMethod()).andReturn(\"GET\");\n\n Headers header = new Headers();\n ByteArrayOutputStream out = prepareResponse(handler, exchange, header);\n\n handler.doHandle(exchange);\n\n assertEquals(header.getFirst(\"content-type\"),expected + \"; charset=utf-8\");\n }", "label": 1, "label_name": "safe"} +{"code": "static inline void find_entity_for_char(\n\tunsigned int k,\n\tenum entity_charset charset,\n\tconst entity_stage1_row *table,\n\tconst unsigned char **entity,\n\tsize_t *entity_len,\n\tunsigned char *old,\n\tsize_t oldlen,\n\tsize_t *cursor)\n{\n\tunsigned stage1_idx = ENT_STAGE1_INDEX(k);\n\tconst entity_stage3_row *c;\n\t\n\tif (stage1_idx > 0x1D) {\n\t\t*entity = NULL;\n\t\t*entity_len = 0;\n\t\treturn;\n\t}\n\n\tc = &table[stage1_idx][ENT_STAGE2_INDEX(k)][ENT_STAGE3_INDEX(k)];\n\n\tif (!c->ambiguous) {\n\t\t*entity = (const unsigned char *)c->data.ent.entity;\n\t\t*entity_len = c->data.ent.entity_len;\n\t} else {\n\t\t/* peek at next char */\n\t\tsize_t\t cursor_before\t= *cursor;\n\t\tint\t\t status\t\t\t= SUCCESS;\n\t\tunsigned next_char;\n\n\t\tif (!(*cursor < oldlen))\n\t\t\tgoto no_suitable_2nd;\n\n\t\tnext_char = get_next_char(charset, old, oldlen, cursor, &status); \n\n\t\tif (status == FAILURE)\n\t\t\tgoto no_suitable_2nd;\n\n\t\t{\n\t\t\tconst entity_multicodepoint_row *s, *e;\n\n\t\t\ts = &c->data.multicodepoint_table[1];\n\t\t\te = s - 1 + c->data.multicodepoint_table[0].leading_entry.size;\n\t\t\t/* we could do a binary search but it's not worth it since we have\n\t\t\t * at most two entries... */\n\t\t\tfor ( ; s <= e; s++) {\n\t\t\t\tif (s->normal_entry.second_cp == next_char) {\n\t\t\t\t\t*entity = s->normal_entry.entity;\n\t\t\t\t\t*entity_len = s->normal_entry.entity_len;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nno_suitable_2nd:\n\t\t*cursor = cursor_before;\n\t\t*entity = (const unsigned char *)\n\t\t\tc->data.multicodepoint_table[0].leading_entry.default_entity;\n\t\t*entity_len = c->data.multicodepoint_table[0].leading_entry.default_entity_len;\n\t}\t\n}", "label": 0, "label_name": "vulnerable"} +{"code": " onPacket = () => {\n kaTimer && kaTimer.refresh();\n kaCurCount = 0;\n };", "label": 1, "label_name": "safe"} +{"code": "Writer.prototype._stat = function (current) {\n var self = this\n var props = self.props\n var stat = props.follow ? 'stat' : 'lstat'\n var who = self._proxy || self\n\n if (current) statCb(null, current)\n else fs[stat](self._path, statCb)\n\n function statCb (er, current) {\n if (self.filter && !self.filter.call(who, who, current)) {\n self._aborted = true\n self.emit('end')\n self.emit('close')\n return\n }\n\n // if it's not there, great. We'll just create it.\n // if it is there, then we'll need to change whatever differs\n if (er || !current) {\n return create(self)\n }\n\n self._old = current\n var currentType = getType(current)\n\n // if it's a type change, then we need to clobber or error.\n // if it's not a type change, then let the impl take care of it.\n if (currentType !== self.type) {\n return rimraf(self._path, function (er) {\n if (er) return self.error(er)\n self._old = null\n create(self)\n })\n }\n\n // otherwise, just handle in the app-specific way\n // this creates a fs.WriteStream, or mkdir's, or whatever\n create(self)\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def comments_closed?\n !(allow_comments? && in_feedback_window?)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static plist_t parse_bin_node(struct bplist_data *bplist, const char** object)\n{\n uint16_t type = 0;\n uint64_t size = 0;\n\n if (!object)\n return NULL;\n\n type = (**object) & BPLIST_MASK;\n size = (**object) & BPLIST_FILL;\n (*object)++;\n\n if (size == BPLIST_FILL) {\n switch (type) {\n case BPLIST_DATA:\n case BPLIST_STRING:\n case BPLIST_UNICODE:\n case BPLIST_ARRAY:\n case BPLIST_SET:\n case BPLIST_DICT:\n {\n uint16_t next_size = **object & BPLIST_FILL;\n if ((**object & BPLIST_MASK) != BPLIST_UINT) {\n PLIST_BIN_ERR(\"%s: invalid size node type for node type 0x%02x: found 0x%02x, expected 0x%02x\\n\", __func__, type, **object & BPLIST_MASK, BPLIST_UINT);\n return NULL;\n }\n (*object)++;\n next_size = 1 << next_size;\n if (*object + next_size > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: size node data bytes for node type 0x%02x point outside of valid range\\n\", __func__, type);\n return NULL;\n }\n size = UINT_TO_HOST(*object, next_size);\n (*object) += next_size;\n break;\n }\n default:\n break;\n }\n }\n\n switch (type)\n {\n\n case BPLIST_NULL:\n switch (size)\n {\n\n case BPLIST_TRUE:\n {\n plist_data_t data = plist_new_plist_data();\n data->type = PLIST_BOOLEAN;\n data->boolval = TRUE;\n data->length = 1;\n return node_create(NULL, data);\n }\n\n case BPLIST_FALSE:\n {\n plist_data_t data = plist_new_plist_data();\n data->type = PLIST_BOOLEAN;\n data->boolval = FALSE;\n data->length = 1;\n return node_create(NULL, data);\n }\n\n case BPLIST_NULL:\n default:\n return NULL;\n }\n\n case BPLIST_UINT:\n if (*object + (uint64_t)(1 << size) > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_UINT data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_uint_node(object, size);\n\n case BPLIST_REAL:\n if (*object + (uint64_t)(1 << size) > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_REAL data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_real_node(object, size);\n\n case BPLIST_DATE:\n if (3 != size) {\n PLIST_BIN_ERR(\"%s: invalid data size for BPLIST_DATE node\\n\", __func__);\n return NULL;\n }\n if (*object + (uint64_t)(1 << size) > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_DATE data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_date_node(object, size);\n\n case BPLIST_DATA:\n if (*object + size > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_DATA data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_data_node(object, size);\n\n case BPLIST_STRING:\n if (*object + size > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_STRING data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_string_node(object, size);\n\n case BPLIST_UNICODE:\n if (size*2 < size) {\n PLIST_BIN_ERR(\"%s: Integer overflow when calculating BPLIST_UNICODE data size.\\n\", __func__);\n return NULL;\n }\n if (*object + size*2 > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_UNICODE data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_unicode_node(object, size);\n\n case BPLIST_SET:\n case BPLIST_ARRAY:\n if (*object + size > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_ARRAY data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_array_node(bplist, object, size);\n\n case BPLIST_UID:\n if (*object + size+1 > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_UID data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_uid_node(object, size);\n\n case BPLIST_DICT:\n if (*object + size > bplist->offset_table) {\n PLIST_BIN_ERR(\"%s: BPLIST_REAL data bytes point outside of valid range\\n\", __func__);\n return NULL;\n }\n return parse_dict_node(bplist, object, size);\n\n default:\n PLIST_BIN_ERR(\"%s: unexpected node type 0x%02x\\n\", __func__, type);\n return NULL;\n }\n return NULL;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "Ka);null==D&&(L(da),t(Pa,\"geTempDlgDiagramTileActive\",ha[ra]));Ra=document.createElement(\"div\");Ra.className=\"geTempDlgDiagramTileImg geTempDlgDiagramTileImgLoading\";var Qa=document.createElement(\"img\");Qa.style.display=\"none\";(function(Ma,Ta,Ua){Qa.onload=function(){Ta.className=\"geTempDlgDiagramTileImg\";Ma.style.display=\"\"};Qa.onerror=function(){this.src!=Ua?this.src=Ua:Ta.className=\"geTempDlgDiagramTileImg geTempDlgDiagramTileImgError\"}})(Qa,Ra,Ia?Ia.replace(\".drawio.xml\",\"\").replace(\".drawio\",", "label": 1, "label_name": "safe"} +{"code": " @Override public void handle(HttpExchange httpExchange) {\n String token = getToken(httpExchange.getRequestURI().getPath());\n String currentUsersHomeDir = System.getProperty(\"user.home\");\n String settingsTomlPath = String.valueOf(Paths.get(currentUsersHomeDir, \".ballerina\", SETTINGS_TOML_FILE));\n FileOutputStream outputStream = null;\n try {\n outputStream = new FileOutputStream(settingsTomlPath);\n String str = \"[central]\\naccesstoken=\\\"\" + token + \"\\\"\";\n outputStream.write(str.getBytes(StandardCharsets.UTF_8));\n } catch (FileNotFoundException e) {\n throw ErrorUtil.createCommandException(\"Settings.toml file could not be found: \" + settingsTomlPath);\n } catch (IOException e) {\n throw ErrorUtil.createCommandException(\n \"error occurred while writing to the Settings.toml file: \" + e.getMessage());\n } finally {\n try {\n if (outputStream != null) {\n outputStream.close();\n }\n } catch (IOException e) {\n errStream.println(\"error occurred while closing the output stream: \" + e.getMessage());\n }\n }\n outStream.println(\"token updated\");\n\n OutputStream os = null;\n try {\n String response = \"\";\n httpExchange.getResponseHeaders()\n .put(HttpHeaders.CONTENT_TYPE, Collections.singletonList(\"image/svg+xml\"));\n httpExchange.sendResponseHeaders(HttpURLConnection.HTTP_OK,\n response.getBytes(StandardCharsets.UTF_8).length);\n os = httpExchange.getResponseBody();\n os.write(response.getBytes(StandardCharsets.UTF_8));\n } catch (IOException e) {\n throw ErrorUtil\n .createCommandException(\"error occurred while generating the response: \" + e.getMessage());\n } finally {\n try {\n if (os != null) {\n os.close();\n }\n } catch (IOException e) {\n errStream.println(\"error occurred while closing the output stream: \" + e.getMessage());\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,\n\t\t\t unsigned long textaccess, unsigned long address)\n{\n\tstruct task_struct *tsk;\n\tstruct mm_struct *mm;\n\tstruct vm_area_struct * vma;\n\tconst struct exception_table_entry *fixup;\n\tpte_t *pte;\n\tint fault;\n\n\t/* SIM\n\t * Note this is now called with interrupts still disabled\n\t * This is to cope with being called for a missing IO port\n\t * address with interrupts disabled. This should be fixed as\n\t * soon as we have a better 'fast path' miss handler.\n\t *\n\t * Plus take care how you try and debug this stuff.\n\t * For example, writing debug data to a port which you\n\t * have just faulted on is not going to work.\n\t */\n\n\ttsk = current;\n\tmm = tsk->mm;\n\n\t/* Not an IO address, so reenable interrupts */\n\tlocal_irq_enable();\n\n\tperf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);\n\n\t/*\n\t * If we're in an interrupt or have no user\n\t * context, we must not take the fault..\n\t */\n\tif (in_atomic() || !mm)\n\t\tgoto no_context;\n\n\t/* TLB misses upon some cache flushes get done under cli() */\n\tdown_read(&mm->mmap_sem);\n\n\tvma = find_vma(mm, address);\n\n\tif (!vma) {\n#ifdef DEBUG_FAULT\n\t\tprint_task(tsk);\n\t\tprintk(\"%s:%d fault, address is 0x%08x PC %016Lx textaccess %d writeaccess %d\\n\",\n\t\t __func__, __LINE__,\n\t\t address,regs->pc,textaccess,writeaccess);\n\t\tshow_regs(regs);\n#endif\n\t\tgoto bad_area;\n\t}\n\tif (vma->vm_start <= address) {\n\t\tgoto good_area;\n\t}\n\n\tif (!(vma->vm_flags & VM_GROWSDOWN)) {\n#ifdef DEBUG_FAULT\n\t\tprint_task(tsk);\n\t\tprintk(\"%s:%d fault, address is 0x%08x PC %016Lx textaccess %d writeaccess %d\\n\",\n\t\t __func__, __LINE__,\n\t\t address,regs->pc,textaccess,writeaccess);\n\t\tshow_regs(regs);\n\n\t\tprint_vma(vma);\n#endif\n\t\tgoto bad_area;\n\t}\n\tif (expand_stack(vma, address)) {\n#ifdef DEBUG_FAULT\n\t\tprint_task(tsk);\n\t\tprintk(\"%s:%d fault, address is 0x%08x PC %016Lx textaccess %d writeaccess %d\\n\",\n\t\t __func__, __LINE__,\n\t\t address,regs->pc,textaccess,writeaccess);\n\t\tshow_regs(regs);\n#endif\n\t\tgoto bad_area;\n\t}\n/*\n * Ok, we have a good vm_area for this memory access, so\n * we can handle it..\n */\ngood_area:\n\tif (textaccess) {\n\t\tif (!(vma->vm_flags & VM_EXEC))\n\t\t\tgoto bad_area;\n\t} else {\n\t\tif (writeaccess) {\n\t\t\tif (!(vma->vm_flags & VM_WRITE))\n\t\t\t\tgoto bad_area;\n\t\t} else {\n\t\t\tif (!(vma->vm_flags & VM_READ))\n\t\t\t\tgoto bad_area;\n\t\t}\n\t}\n\n\t/*\n\t * If for any reason at all we couldn't handle the fault,\n\t * make sure we exit gracefully rather than endlessly redo\n\t * the fault.\n\t */\n\tfault = handle_mm_fault(mm, vma, address, writeaccess ? FAULT_FLAG_WRITE : 0);\n\tif (unlikely(fault & VM_FAULT_ERROR)) {\n\t\tif (fault & VM_FAULT_OOM)\n\t\t\tgoto out_of_memory;\n\t\telse if (fault & VM_FAULT_SIGBUS)\n\t\t\tgoto do_sigbus;\n\t\tBUG();\n\t}\n\n\tif (fault & VM_FAULT_MAJOR) {\n\t\ttsk->maj_flt++;\n\t\tperf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,\n\t\t\t\t regs, address);\n\t} else {\n\t\ttsk->min_flt++;\n\t\tperf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,\n\t\t\t\t regs, address);\n\t}\n\n\t/* If we get here, the page fault has been handled. Do the TLB refill\n\t now from the newly-setup PTE, to avoid having to fault again right\n\t away on the same instruction. */\n\tpte = lookup_pte (mm, address);\n\tif (!pte) {\n\t\t/* From empirical evidence, we can get here, due to\n\t\t !pte_present(pte). (e.g. if a swap-in occurs, and the page\n\t\t is swapped back out again before the process that wanted it\n\t\t gets rescheduled?) */\n\t\tgoto no_pte;\n\t}\n\n\t__do_tlb_refill(address, textaccess, pte);\n\nno_pte:\n\n\tup_read(&mm->mmap_sem);\n\treturn;\n\n/*\n * Something tried to access memory that isn't in our memory map..\n * Fix it, but check if it's kernel or user first..\n */\nbad_area:\n#ifdef DEBUG_FAULT\n\tprintk(\"fault:bad area\\n\");\n#endif\n\tup_read(&mm->mmap_sem);\n\n\tif (user_mode(regs)) {\n\t\tstatic int count=0;\n\t\tsiginfo_t info;\n\t\tif (count < 4) {\n\t\t\t/* This is really to help debug faults when starting\n\t\t\t * usermode, so only need a few */\n\t\t\tcount++;\n\t\t\tprintk(\"user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\\n\",\n\t\t\t\taddress, task_pid_nr(current), current->comm,\n\t\t\t\t(unsigned long) regs->pc);\n#if 0\n\t\t\tshow_regs(regs);\n#endif\n\t\t}\n\t\tif (is_global_init(tsk)) {\n\t\t\tpanic(\"INIT had user mode bad_area\\n\");\n\t\t}\n\t\ttsk->thread.address = address;\n\t\ttsk->thread.error_code = writeaccess;\n\t\tinfo.si_signo = SIGSEGV;\n\t\tinfo.si_errno = 0;\n\t\tinfo.si_addr = (void *) address;\n\t\tforce_sig_info(SIGSEGV, &info, tsk);\n\t\treturn;\n\t}\n\nno_context:\n#ifdef DEBUG_FAULT\n\tprintk(\"fault:No context\\n\");\n#endif\n\t/* Are we prepared to handle this kernel fault? */\n\tfixup = search_exception_tables(regs->pc);\n\tif (fixup) {\n\t\tregs->pc = fixup->fixup;\n\t\treturn;\n\t}\n\n/*\n * Oops. The kernel tried to access some bad page. We'll have to\n * terminate things with extreme prejudice.\n *\n */\n\tif (address < PAGE_SIZE)\n\t\tprintk(KERN_ALERT \"Unable to handle kernel NULL pointer dereference\");\n\telse\n\t\tprintk(KERN_ALERT \"Unable to handle kernel paging request\");\n\tprintk(\" at virtual address %08lx\\n\", address);\n\tprintk(KERN_ALERT \"pc = %08Lx%08Lx\\n\", regs->pc >> 32, regs->pc & 0xffffffff);\n\tdie(\"Oops\", regs, writeaccess);\n\tdo_exit(SIGKILL);\n\n/*\n * We ran out of memory, or some other thing happened to us that made\n * us unable to handle the page fault gracefully.\n */\nout_of_memory:\n\tup_read(&mm->mmap_sem);\n\tif (!user_mode(regs))\n\t\tgoto no_context;\n\tpagefault_out_of_memory();\n\treturn;\n\ndo_sigbus:\n\tprintk(\"fault:Do sigbus\\n\");\n\tup_read(&mm->mmap_sem);\n\n\t/*\n\t * Send a sigbus, regardless of whether we were in kernel\n\t * or user mode.\n\t */\n\ttsk->thread.address = address;\n\ttsk->thread.error_code = writeaccess;\n\ttsk->thread.trap_no = 14;\n\tforce_sig(SIGBUS, tsk);\n\n\t/* Kernel mode? Handle exceptions or die */\n\tif (!user_mode(regs))\n\t\tgoto no_context;\n}", "label": 1, "label_name": "safe"} +{"code": "ast_for_expr_stmt(struct compiling *c, const node *n)\n{\n REQ(n, expr_stmt);\n /* expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |\n [('=' (yield_expr|testlist_star_expr))+ [TYPE_COMMENT]] )\n annassign: ':' test ['=' (yield_expr|testlist)]\n testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']\n augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |\n '<<=' | '>>=' | '**=' | '//=')\n test: ... here starts the operator precedence dance\n */\n int num = NCH(n);\n\n if (num == 1) {\n expr_ty e = ast_for_testlist(c, CHILD(n, 0));\n if (!e)\n return NULL;\n\n return Expr(e, LINENO(n), n->n_col_offset,\n n->n_end_lineno, n->n_end_col_offset, c->c_arena);\n }\n else if (TYPE(CHILD(n, 1)) == augassign) {\n expr_ty expr1, expr2;\n operator_ty newoperator;\n node *ch = CHILD(n, 0);\n\n expr1 = ast_for_testlist(c, ch);\n if (!expr1)\n return NULL;\n if(!set_context(c, expr1, Store, ch))\n return NULL;\n /* set_context checks that most expressions are not the left side.\n Augmented assignments can only have a name, a subscript, or an\n attribute on the left, though, so we have to explicitly check for\n those. */\n switch (expr1->kind) {\n case Name_kind:\n case Attribute_kind:\n case Subscript_kind:\n break;\n default:\n ast_error(c, ch, \"illegal expression for augmented assignment\");\n return NULL;\n }\n\n ch = CHILD(n, 2);\n if (TYPE(ch) == testlist)\n expr2 = ast_for_testlist(c, ch);\n else\n expr2 = ast_for_expr(c, ch);\n if (!expr2)\n return NULL;\n\n newoperator = ast_for_augassign(c, CHILD(n, 1));\n if (!newoperator)\n return NULL;\n\n return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset,\n n->n_end_lineno, n->n_end_col_offset, c->c_arena);\n }\n else if (TYPE(CHILD(n, 1)) == annassign) {\n expr_ty expr1, expr2, expr3;\n node *ch = CHILD(n, 0);\n node *deep, *ann = CHILD(n, 1);\n int simple = 1;\n\n /* we keep track of parens to qualify (x) as expression not name */\n deep = ch;\n while (NCH(deep) == 1) {\n deep = CHILD(deep, 0);\n }\n if (NCH(deep) > 0 && TYPE(CHILD(deep, 0)) == LPAR) {\n simple = 0;\n }\n expr1 = ast_for_testlist(c, ch);\n if (!expr1) {\n return NULL;\n }\n switch (expr1->kind) {\n case Name_kind:\n if (forbidden_name(c, expr1->v.Name.id, n, 0)) {\n return NULL;\n }\n expr1->v.Name.ctx = Store;\n break;\n case Attribute_kind:\n if (forbidden_name(c, expr1->v.Attribute.attr, n, 1)) {\n return NULL;\n }\n expr1->v.Attribute.ctx = Store;\n break;\n case Subscript_kind:\n expr1->v.Subscript.ctx = Store;\n break;\n case List_kind:\n ast_error(c, ch,\n \"only single target (not list) can be annotated\");\n return NULL;\n case Tuple_kind:\n ast_error(c, ch,\n \"only single target (not tuple) can be annotated\");\n return NULL;\n default:\n ast_error(c, ch,\n \"illegal target for annotation\");\n return NULL;\n }\n\n if (expr1->kind != Name_kind) {\n simple = 0;\n }\n ch = CHILD(ann, 1);\n expr2 = ast_for_expr(c, ch);\n if (!expr2) {\n return NULL;\n }\n if (NCH(ann) == 2) {\n return AnnAssign(expr1, expr2, NULL, simple,\n LINENO(n), n->n_col_offset,\n n->n_end_lineno, n->n_end_col_offset, c->c_arena);\n }\n else {\n ch = CHILD(ann, 3);\n if (TYPE(ch) == testlist) {\n expr3 = ast_for_testlist(c, ch);\n }\n else {\n expr3 = ast_for_expr(c, ch);\n }\n if (!expr3) {\n return NULL;\n }\n return AnnAssign(expr1, expr2, expr3, simple,\n LINENO(n), n->n_col_offset,\n n->n_end_lineno, n->n_end_col_offset, c->c_arena);\n }\n }\n else {\n int i, nch_minus_type, has_type_comment;\n asdl_seq *targets;\n node *value;\n expr_ty expression;\n string type_comment;\n\n /* a normal assignment */\n REQ(CHILD(n, 1), EQUAL);\n\n has_type_comment = TYPE(CHILD(n, num - 1)) == TYPE_COMMENT;\n nch_minus_type = num - has_type_comment;\n\n targets = _Py_asdl_seq_new(nch_minus_type / 2, c->c_arena);\n if (!targets)\n return NULL;\n for (i = 0; i < nch_minus_type - 2; i += 2) {\n expr_ty e;\n node *ch = CHILD(n, i);\n if (TYPE(ch) == yield_expr) {\n ast_error(c, ch, \"assignment to yield expression not possible\");\n return NULL;\n }\n e = ast_for_testlist(c, ch);\n if (!e)\n return NULL;\n\n /* set context to assign */\n if (!set_context(c, e, Store, CHILD(n, i)))\n return NULL;\n\n asdl_seq_SET(targets, i / 2, e);\n }\n value = CHILD(n, nch_minus_type - 1);\n if (TYPE(value) == testlist_star_expr)\n expression = ast_for_testlist(c, value);\n else\n expression = ast_for_expr(c, value);\n if (!expression)\n return NULL;\n if (has_type_comment) {\n type_comment = NEW_TYPE_COMMENT(CHILD(n, nch_minus_type));\n if (!type_comment)\n return NULL;\n }\n else\n type_comment = NULL;\n return Assign(targets, expression, type_comment, LINENO(n), n->n_col_offset,\n n->n_end_lineno, n->n_end_col_offset, c->c_arena);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "static bool couldRecur(const Variant& v, const Array& arr) {\n return v.isReferenced() ||\n arr.get()->kind() == ArrayData::kGlobalsKind ||\n arr.get()->kind() == ArrayData::kProxyKind;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)\n{\n\tint i;\n\tint ret;\n\n\tret = xen_pcibk_read_config_word(dev, offset, value, data);\n\tif (!pci_is_enabled(dev))\n\t\treturn ret;\n\n\tfor (i = 0; i < PCI_ROM_RESOURCE; i++) {\n\t\tif (dev->resource[i].flags & IORESOURCE_IO)\n\t\t\t*value |= PCI_COMMAND_IO;\n\t\tif (dev->resource[i].flags & IORESOURCE_MEM)\n\t\t\t*value |= PCI_COMMAND_MEMORY;\n\t}\n\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tprotected function query($sql) {\t \n\t\t$this->sqlCnt++;\n\t\t$sql = str_replace(utf8_encode('\"'), \"'\", $sql);\n\t\t$res = odbc_exec($this->conn, $sql);\n\t\tif (!$res) {\n\t\t\t$this->dbError = odbc_errormsg($this->conn);\n\t\t}\n\t\treturn $res;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "static int br_multicast_add_group(struct net_bridge *br,\n\t\t\t\t struct net_bridge_port *port,\n\t\t\t\t struct br_ip *group)\n{\n\tstruct net_bridge_mdb_entry *mp;\n\tstruct net_bridge_port_group *p;\n\tstruct net_bridge_port_group __rcu **pp;\n\tunsigned long now = jiffies;\n\tint err;\n\n\tspin_lock(&br->multicast_lock);\n\tif (!netif_running(br->dev) ||\n\t (port && port->state == BR_STATE_DISABLED))\n\t\tgoto out;\n\n\tmp = br_multicast_new_group(br, port, group);\n\terr = PTR_ERR(mp);\n\tif (IS_ERR(mp))\n\t\tgoto err;\n\n\tif (!port) {\n\t\thlist_add_head(&mp->mglist, &br->mglist);\n\t\tmod_timer(&mp->timer, now + br->multicast_membership_interval);\n\t\tgoto out;\n\t}\n\n\tfor (pp = &mp->ports;\n\t (p = mlock_dereference(*pp, br)) != NULL;\n\t pp = &p->next) {\n\t\tif (p->port == port)\n\t\t\tgoto found;\n\t\tif ((unsigned long)p->port < (unsigned long)port)\n\t\t\tbreak;\n\t}\n\n\tp = kzalloc(sizeof(*p), GFP_ATOMIC);\n\terr = -ENOMEM;\n\tif (unlikely(!p))\n\t\tgoto err;\n\n\tp->addr = *group;\n\tp->port = port;\n\tp->next = *pp;\n\thlist_add_head(&p->mglist, &port->mglist);\n\tsetup_timer(&p->timer, br_multicast_port_group_expired,\n\t\t (unsigned long)p);\n\tsetup_timer(&p->query_timer, br_multicast_port_group_query_expired,\n\t\t (unsigned long)p);\n\n\trcu_assign_pointer(*pp, p);\n\nfound:\n\tmod_timer(&p->timer, now + br->multicast_membership_interval);\nout:\n\terr = 0;\n\nerr:\n\tspin_unlock(&br->multicast_lock);\n\treturn err;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " privPEM = genOpenSSLECDSAPriv(oid, ecpub, ecpriv);\n break;\n }\n default:\n return new Error(`Unsupported OpenSSH private key type: ${type}`);\n }\n\n const privComment = readString(data, data._pos, true);\n if (privComment === undefined)\n return new Error('Malformed OpenSSH private key');\n\n keys.push(\n new OpenSSH_Private(type, privComment, privPEM, pubPEM, pubSSH, algo,\n decrypted)\n );\n }", "label": 1, "label_name": "safe"} +{"code": "horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)\n{\n int32 r1, g1, b1, a1, r2, g2, b2, a2, mask;\n float fltsize = Fltsize;\n\n#define CLAMP(v) ( (v<(float)0.) ? 0\t\t\t\t\\\n\t\t : (v<(float)2.) ? FromLT2[(int)(v*fltsize)]\t\\\n\t\t : (v>(float)24.2) ? 2047\t\t\t\\\n\t\t : LogK1*log(v*LogK2) + 0.5 )\n\n mask = CODE_MASK;\n if (n >= stride) {\n\tif (stride == 3) {\n\t r2 = wp[0] = (uint16) CLAMP(ip[0]);\n\t g2 = wp[1] = (uint16) CLAMP(ip[1]);\n\t b2 = wp[2] = (uint16) CLAMP(ip[2]);\n\t n -= 3;\n\t while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\tip += 3;\n\t\tr1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;\n\t }\n\t} else if (stride == 4) {\n\t r2 = wp[0] = (uint16) CLAMP(ip[0]);\n\t g2 = wp[1] = (uint16) CLAMP(ip[1]);\n\t b2 = wp[2] = (uint16) CLAMP(ip[2]);\n\t a2 = wp[3] = (uint16) CLAMP(ip[3]);\n\t n -= 4;\n\t while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\tip += 4;\n\t\tr1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\ta1 = (int32) CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;\n\t }\n\t} else {\n\t ip += n - 1;\t/* point to last one */\n\t wp += n - 1;\t/* point to last one */\n\t n -= stride;\n\t while (n > 0) {\n\t\tREPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]);\n\t\t\t\twp[stride] -= wp[0];\n\t\t\t\twp[stride] &= mask;\n\t\t\t\twp--; ip--)\n\t\tn -= stride;\n\t }\n\t REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp--; ip--)\n\t}\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function recent($vars, $type = 'post') {\n $sql = \"SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `date` DESC LIMIT {$vars}\";\n $posts = Db::result($sql);\n if(isset($posts['error'])){\n $posts['error'] = \"No Posts found.\";\n }else{\n $posts = $posts;\n }\n return $posts;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should expand all comments and emails on a specific contact\" do\n comment = double(Comment)\n Comment.should_receive(:find).with(\"1\").and_return(comment)\n comment.should_receive(:update_attribute).with(:state, 'Expanded')\n xhr :get, :timeline, :type => \"comment\", :id => \"1\", :state => \"Expanded\"\n end", "label": 1, "label_name": "safe"} +{"code": "\"\",d.className=\"\");b.inline=d.style.cssText||\"\";e||(d.style.cssText=\"position: static; overflow: visible\");o(f);return b}function p(a,e){var f=l(a),b=a.$;\"class\"in e&&(b.className=e[\"class\"]);\"inline\"in e&&(b.style.cssText=e.inline);o(f)}function q(a){if(!a.editable().isInline()){var e=CKEDITOR.instances,f;for(f in e){var b=e[f];\"wysiwyg\"==b.mode&&!b.readOnly&&(b=b.document.getBody(),b.setAttribute(\"contentEditable\",!1),b.setAttribute(\"contentEditable\",!0))}a.editable().hasFocus&&(a.toolbox.focus(),", "label": 1, "label_name": "safe"} +{"code": " public function testDump()\n {\n $data = new Data(array(array(123)));\n\n $collector = new DumpDataCollector();\n\n $this->assertSame('dump', $collector->getName());\n\n $collector->dump($data);\n $line = __LINE__ - 1;\n $this->assertSame(1, $collector->getDumpsCount());\n\n $dump = $collector->getDumps('html');\n $this->assertTrue(isset($dump[0]['data']));\n $dump[0]['data'] = preg_replace('/^.*?
     \"
    123\\n
    \\n\",\n 'name' => 'DumpDataCollectorTest.php',\n 'file' => __FILE__,\n 'line' => $line,\n 'fileExcerpt' => false,\n ),\n );\n $this->assertEquals($xDump, $dump);\n\n $this->assertStringMatchesFormat(\n 'a:1:{i:0;a:5:{s:4:\"data\";O:39:\"Symfony\\Component\\VarDumper\\Cloner\\Data\":4:{s:45:\"Symfony\\Component\\VarDumper\\Cloner\\Datadata\";a:1:{i:0;a:1:{i:0;i:123;}}s:49:\"Symfony\\Component\\VarDumper\\Cloner\\DatamaxDepth\";i:%i;s:57:\"Symfony\\Component\\VarDumper\\Cloner\\DatamaxItemsPerDepth\";i:%i;s:54:\"Symfony\\Component\\VarDumper\\Cloner\\DatauseRefHandles\";i:%i;}s:4:\"name\";s:25:\"DumpDataCollectorTest.php\";s:4:\"file\";s:%a',\n str_replace(\"\\0\", '', $collector->serialize())\n );\n\n $this->assertSame(0, $collector->getDumpsCount());\n $this->assertSame('a:0:{}', $collector->serialize());\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should use the provided CSR's content as the issuer\" do\n Puppet::SSL::CertificateFactory.expects(:build).with do |*args|\n args[2].subject == \"myhost\"\n end.returns \"my real cert\"\n @ca.sign(@name, :ca, @request)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " protected function _AnalyzeRequest(&$Request, $FolderDepth = 1) {\n // Here is the basic format of a request:\n // [/application]/controller[/method[.json|.xml]]/argn|argn=valn\n\n // Here are some examples of what this method could/would receive:\n // /application/controller/method/argn\n // /controller/method/argn\n // /application/controller/argn\n // /controller/argn\n // /controller\n\n\n // Clear the slate\n $this->_ApplicationFolder = '';\n $this->_ControllerFolder = '';\n $this->_ControllerName = '';\n $this->_ControllerMethod = 'index';\n $this->_ControllerMethodArgs = array();\n $this->Request = $Request->Path();\n\n $PathAndQuery = $Request->PathAndQuery();\n $MatchRoute = Gdn::Router()->MatchRoute($PathAndQuery);\n\n // We have a route. Take action.\n if ($MatchRoute !== FALSE) {\n switch ($MatchRoute['Type']) {\n case 'Internal':\n $Request->PathAndQuery($MatchRoute['FinalDestination']);\n $this->Request = $MatchRoute['FinalDestination'];\n break;\n\n case 'Temporary':\n Header( \"HTTP/1.1 302 Moved Temporarily\" );\n Header( \"Location: \".$MatchRoute['FinalDestination'] );\n exit();\n break;\n\n case 'Permanent':\n Header( \"HTTP/1.1 301 Moved Permanently\" );\n Header( \"Location: \".$MatchRoute['FinalDestination'] );\n exit();\n break;\n\n case 'NotFound':\n Header( \"HTTP/1.1 404 Not Found\" );\n $this->Request = $MatchRoute['FinalDestination'];\n break;\n }\n }\n\n\n switch ($Request->OutputFormat()) {\n case 'rss':\n $this->_SyndicationMethod = SYNDICATION_RSS;\n break;\n case 'atom':\n $this->_SyndicationMethod = SYNDICATION_ATOM;\n break;\n case 'default':\n default:\n $this->_SyndicationMethod = SYNDICATION_NONE;\n break;\n }\n\n if ($this->Request == '')\n {\n $DefaultController = Gdn::Router()->GetRoute('DefaultController');\n $this->Request = $DefaultController['Destination'];\n }\n \n $Parts = explode('/', $this->Request);\n $Length = count($Parts);\n if ($Length == 1 || $FolderDepth <= 0) {\n $FolderDepth = 0;\n $this->_ControllerName = $Parts[0];\n $this->_MapParts($Parts, 0);\n $this->_FetchController(TRUE); // Throw an error if this fails because there's nothing else to check\n } else if ($Length == 2) {\n // Force a depth of 1 because only one of the two url parts can be a folder.\n $FolderDepth = 1;\n }\n if ($FolderDepth == 2) {\n $this->_ApplicationFolder = $Parts[0];\n $this->_ControllerFolder = $Parts[1];\n $this->_MapParts($Parts, 2);\n\n if (!$this->_FetchController()) {\n // echo '
    Failed. AppFolder: '.$this->_ApplicationFolder.'; Cont Folder: '.$this->_ControllerFolder.'; Cont: '.$this->_ControllerName.';
    ';\n $this->_AnalyzeRequest($Request, 1);\n }\n\n } else if ($FolderDepth == 1) {\n // Try the application folder first\n $Found = FALSE;\n if (in_array($Parts[0], $this->EnabledApplicationFolders())) {\n // Check to see if the first part is an application\n $this->_ApplicationFolder = $Parts[0];\n $this->_MapParts($Parts, 1);\n $Found = $this->_FetchController();\n }\n if (!$Found) {\n // echo '
    Failed. AppFolder: '.$this->_ApplicationFolder.'; Cont Folder: '.$this->_ControllerFolder.'; Cont: '.$this->_ControllerName.';
    ';\n // Check to see if the first part is a controller folder\n $this->_ApplicationFolder = '';\n $this->_ControllerFolder = $Parts[0];\n $this->_MapParts($Parts, 1);\n if (!$this->_FetchController()) {\n // echo '
    Failed. AppFolder: '.$this->_ApplicationFolder.'; Cont Folder: '.$this->_ControllerFolder.'; Cont: '.$this->_ControllerName.';
    ';\n $this->_AnalyzeRequest($Request, 0);\n }\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "seamless_process(STREAM s)\n{\n\tunsigned int pkglen;\n\tchar *buf;\n\tstruct stream packet = *s;\n\n\tif (!s_check(s))\n\t{\n\t\trdp_protocol_error(\"seamless_process(), stream is in unstable state\", &packet);\n\t}\n\n\tpkglen = s->end - s->p;\n\t/* str_handle_lines requires null terminated strings */\n\tbuf = xmalloc(pkglen + 1);\n\tSTRNCPY(buf, (char *) s->p, pkglen + 1);\n\tstr_handle_lines(buf, &seamless_rest, seamless_line_handler, NULL);\n\n\txfree(buf);\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic boolean isInPath(String path) {\n\t\treturn getDelegate().isInPath(path);\n\t}", "label": 1, "label_name": "safe"} +{"code": "choose_volume(struct archive_read *a, struct iso9660 *iso9660)\n{\n\tstruct file_info *file;\n\tint64_t skipsize;\n\tstruct vd *vd;\n\tconst void *block;\n\tchar seenJoliet;\n\n\tvd = &(iso9660->primary);\n\tif (!iso9660->opt_support_joliet)\n\t\tiso9660->seenJoliet = 0;\n\tif (iso9660->seenJoliet &&\n\t\tvd->location > iso9660->joliet.location)\n\t\t/* This condition is unlikely; by way of caution. */\n\t\tvd = &(iso9660->joliet);\n\n\tskipsize = LOGICAL_BLOCK_SIZE * vd->location;\n\tskipsize = __archive_read_consume(a, skipsize);\n\tif (skipsize < 0)\n\t\treturn ((int)skipsize);\n\tiso9660->current_position = skipsize;\n\n\tblock = __archive_read_ahead(a, vd->size, NULL);\n\tif (block == NULL) {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Failed to read full block when scanning \"\n\t\t \"ISO9660 directory list\");\n\t\treturn (ARCHIVE_FATAL);\n\t}\n\n\t/*\n\t * While reading Root Directory, flag seenJoliet must be zero to\n\t * avoid converting special name 0x00(Current Directory) and\n\t * next byte to UCS2.\n\t */\n\tseenJoliet = iso9660->seenJoliet;/* Save flag. */\n\tiso9660->seenJoliet = 0;\n\tfile = parse_file_info(a, NULL, block);\n\tif (file == NULL)\n\t\treturn (ARCHIVE_FATAL);\n\tiso9660->seenJoliet = seenJoliet;\n\n\t/*\n\t * If the iso image has both RockRidge and Joliet, we preferentially\n\t * use RockRidge Extensions rather than Joliet ones.\n\t */\n\tif (vd == &(iso9660->primary) && iso9660->seenRockridge\n\t && iso9660->seenJoliet)\n\t\tiso9660->seenJoliet = 0;\n\n\tif (vd == &(iso9660->primary) && !iso9660->seenRockridge\n\t && iso9660->seenJoliet) {\n\t\t/* Switch reading data from primary to joliet. */\n\t\tvd = &(iso9660->joliet);\n\t\tskipsize = LOGICAL_BLOCK_SIZE * vd->location;\n\t\tskipsize -= iso9660->current_position;\n\t\tskipsize = __archive_read_consume(a, skipsize);\n\t\tif (skipsize < 0)\n\t\t\treturn ((int)skipsize);\n\t\tiso9660->current_position += skipsize;\n\n\t\tblock = __archive_read_ahead(a, vd->size, NULL);\n\t\tif (block == NULL) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Failed to read full block when scanning \"\n\t\t\t \"ISO9660 directory list\");\n\t\t\treturn (ARCHIVE_FATAL);\n\t\t}\n\t\tiso9660->seenJoliet = 0;\n\t\tfile = parse_file_info(a, NULL, block);\n\t\tif (file == NULL)\n\t\t\treturn (ARCHIVE_FATAL);\n\t\tiso9660->seenJoliet = seenJoliet;\n\t}\n\n\t/* Store the root directory in the pending list. */\n\tif (add_entry(a, iso9660, file) != ARCHIVE_OK)\n\t\treturn (ARCHIVE_FATAL);\n\tif (iso9660->seenRockridge) {\n\t\ta->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE;\n\t\ta->archive.archive_format_name =\n\t\t \"ISO9660 with Rockridge extensions\";\n\t}\n\n\treturn (ARCHIVE_OK);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public void warning(SAXParseException e) {\n }", "label": 0, "label_name": "vulnerable"} +{"code": " callParserIfExistsQuery(parseNumberTypeQueryParams([['requiredNum', false, false], ['optionalNum', true, false], ['optionalNumArr', true, true], ['emptyNum', true, false], ['requiredNumArr', false, true]])),\n callParserIfExistsQuery(parseBooleanTypeQueryParams([['bool', false, false], ['optionalBool', true, false], ['boolArray', false, true], ['optionalBoolArray', true, true]])),\n normalizeQuery,\n createValidateHandler(req => [\n Object.keys(req.query as any).length ? validateOrReject(Object.assign(new Validators.Query(), req.query as any), validatorOptions) : null\n ])\n ]\n },\n asyncMethodToHandler(controller0.get)\n )", "label": 0, "label_name": "vulnerable"} +{"code": "function html_operation_successful( $p_redirect_url, $p_message = '' ) {\n\techo '
    ';\n\n\tif( !is_blank( $p_message ) ) {\n\t\techo $p_message . '
    ';\n\t}\n\n\techo lang_get( 'operation_successful' ).'
    ';\n\tprint_bracket_link( $p_redirect_url, lang_get( 'proceed' ) );\n\techo '
    ';\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it \"changes the current database\" do\n session.use \"moped_test_2\"\n session.command(dbStats: 1)[\"db\"].should eq \"moped_test_2\"\n end", "label": 1, "label_name": "safe"} +{"code": " public function rawPosition($l, $c)\n {\n if ($c === -1) {\n $l++;\n }\n $this->line = $l;\n $this->col = $c;\n }", "label": 1, "label_name": "safe"} +{"code": "replace(const char *s, const char *old, const char *new)\n{\n\tchar *ret;\n\tint i, count = 0;\n\tsize_t newlen = strlen(new);\n\tsize_t oldlen = strlen(old);\n\n\tfor (i = 0; s[i] != '\\0'; i++) {\n\t\tif (strstr(&s[i], old) == &s[i]) {\n\t\t\tcount++;\n\t\t\ti += oldlen - 1;\n\t\t}\n\t}\n\tret = malloc(i + 1 + count * (newlen - oldlen));\n\tif (ret != NULL) {\n\t\ti = 0;\n\t\twhile (*s) {\n\t\t\tif (strstr(s, old) == s) {\n\t\t\t\tstrcpy(&ret[i], new);\n\t\t\t\ti += newlen;\n\t\t\t\ts += oldlen;\n\t\t\t} else {\n\t\t\t\tret[i++] = *s++;\n\t\t\t}\n\t\t}\n\t\tret[i] = '\\0';\n\t}\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} +{"code": "LIBOPENMPT_MODPLUG_API unsigned int ModPlug_InstrumentName(ModPlugFile* file, unsigned int qual, char* buff)\n{\n\tconst char* str;\n\tunsigned int retval;\n\tsize_t tmpretval;\n\tif(!file) return 0;\n\tstr = openmpt_module_get_instrument_name(file->mod,qual-1);\n\tif(!str){\n\t\tif(buff){\n\t\t\t*buff = '\\0';\n\t\t}\n\t\treturn 0;\n\t}\n\ttmpretval = strlen(str);\n\tif(tmpretval>=INT_MAX){\n\t\ttmpretval = INT_MAX-1;\n\t}\n\tretval = (int)tmpretval;\n\tif(buff){\n\t\tmemcpy(buff,str,retval+1);\n\t\tbuff[retval] = '\\0';\n\t}\n\topenmpt_free_string(str);\n\treturn retval;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function manage() {\n expHistory::set('manageable', $this->params);\n \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n $sql = 'SELECT n.* FROM '.DB_TABLE_PREFIX.'_expSimpleNote n ';\n $sql .= 'JOIN '.DB_TABLE_PREFIX.'_content_expSimpleNote cnt ON n.id=cnt.expsimplenote_id ';\n $sql .= 'WHERE cnt.content_id='.$this->params['content_id'].\" AND cnt.content_type='\".$this->params['content_type'].\"' \";\n $sql .= 'AND n.approved=0';\n \n $page = new expPaginator(array(\n// 'model'=>'expSimpleNote', // brings in all of model\n 'sql'=>$sql, \n 'limit'=>10,\n 'order'=>'created_at',\n 'dir'=>'DESC',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->baseclassname,\n 'action'=>$this->params['action'],\n 'columns'=>array(\n gt('Approved')=>'approved',\n gt('Poster')=>'name',\n gt('Comment')=>'body'\n ),\n ));\n \n //FIXME here is where we might sanitize the notes before displaying them\n\n assign_to_template(array(\n 'page'=>$page,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " hello: () => \"world\"\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function editspeed() {\n global $db;\n\n if (empty($this->params['id'])) return false;\n $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);\n $calc = new $calcname($this->params['id']);\n assign_to_template(array(\n 'calculator'=>$calc\n ));\n\n }", "label": 1, "label_name": "safe"} +{"code": " public function getAlphaValue()\n {\n return round($this->pixel->getColorValue(\\Imagick::COLOR_ALPHA), 2);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function draw_vdef_preview($vdef_id) {\n\t?>\n\t\n\t\t\n\t\t\t
    vdef=
    \n\t\t\n\t\n\t categs = categoryService.getListByLineage(store, lineage);\n\t\tcategs.add(category);\n\n\n\t\tStringBuilder subCategoriesCacheKey = new StringBuilder();\n\t\tsubCategoriesCacheKey\n\t\t.append(store.getId())\n\t\t.append(\"_\")\n\t\t.append(category.getId())\n\t\t.append(\"_\")\n\t\t.append(Constants.SUBCATEGORIES_CACHE_KEY)\n\t\t.append(\"-\")\n\t\t.append(language.getCode());\n\t\t\n\t\tStringBuilder subCategoriesMissed = new StringBuilder();\n\t\tsubCategoriesMissed\n\t\t.append(subCategoriesCacheKey.toString())\n\t\t.append(Constants.MISSED_CACHE_KEY);\n\t\t\n\t\tList prices = new ArrayList();\n\t\tList subCategories = null;\n\t\tMap countProductsByCategories = null;\n\n\t\tif(store.isUseCache()) {\n\n\t\t\t//get from the cache\n\t\t\tsubCategories = (List) cache.getFromCache(subCategoriesCacheKey.toString());\n\t\t\tif(subCategories==null) {\n\t\t\t\t//get from missed cache\n\t\t\t\t//Boolean missedContent = (Boolean)cache.getFromCache(subCategoriesMissed.toString());\n\n\t\t\t\t//if(missedContent==null) {\n\t\t\t\t countProductsByCategories = getProductsByCategory(store, categs);\n\t\t\t\t\tsubCategories = getSubCategories(store,category,countProductsByCategories,language,locale);\n\t\t\t\t\t\n\t\t\t\t\tif(subCategories!=null) {\n\t\t\t\t\t\tcache.putInCache(subCategories, subCategoriesCacheKey.toString());\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//cache.putInCache(new Boolean(true), subCategoriesCacheKey.toString());\n\t\t\t\t\t}\n\t\t\t\t//}\n\t\t\t}\n\t\t} else {\n\t\t\tcountProductsByCategories = getProductsByCategory(store, categs);\n\t\t\tsubCategories = getSubCategories(store,category,countProductsByCategories,language,locale);\n\t\t}\n\n\t\t//Parent category\n\t\tReadableCategory parentProxy = null;\n\n\t\tif(category.getParent()!=null) {\n\t\t\tCategory parent = categoryService.getById(category.getParent().getId(), store.getId());\n\t\t\tparentProxy = populator.populate(parent, new ReadableCategory(), store, language);\n\t\t}\n\t\t\n\t\t\n\t\t//** List of manufacturers **//\n\t\tList manufacturerList = getManufacturersByProductAndCategory(store,category,categs,language);\n\n\t\tmodel.addAttribute(\"manufacturers\", manufacturerList);\n\t\tmodel.addAttribute(\"parent\", parentProxy);\n\t\tmodel.addAttribute(\"category\", categoryProxy);\n\t\tmodel.addAttribute(\"subCategories\", subCategories);\n\t\t\n\t\tif(parentProxy!=null) {\n\t\t\trequest.setAttribute(Constants.LINK_CODE, parentProxy.getDescription().getFriendlyUrl());\n\t\t}\n\t\t\n\t\t\n\t\t/** template **/\n\t\tStringBuilder template = new StringBuilder().append(ControllerConstants.Tiles.Category.category).append(\".\").append(store.getStoreTemplate());\n\n\t\treturn template.toString();\n\t}", "label": 1, "label_name": "safe"} +{"code": "Client.prototype.destroy = function() {\n this._sock && this._sock.destroy();\n};", "label": 0, "label_name": "vulnerable"} +{"code": "function ajax_wrapper(options) {\n // get original callback functions\n var error_original = function(xhr, status, error) {};\n if (options.error) {\n error_original = options.error;\n }\n var complete_original = function(xhr, status) {};\n if (options.complete) {\n complete_original = options.complete;\n }\n\n // prepare new callback functions\n var options_new = $.extend(true, {}, options);\n // display login dialog on error\n options_new.error = function(xhr, status, error) {\n if (xhr.status == 401) {\n ajax_queue.push(options);\n if (!login_dialog_opened) {\n login_dialog(function() {\n var item;\n while (ajax_queue.length > 0) {\n item = ajax_queue.shift();\n ajax_wrapper(item);\n }\n });\n }\n }\n else {\n error_original(xhr, status, error);\n }\n }\n // Do not run complete function if login dialog is open.\n // Once user is logged in again, the original complete function will be run\n // in repeated ajax call run by login dialog on success.\n options_new.complete = function(xhr, status) {\n if (xhr.status == 401) {\n return;\n }\n else {\n complete_original(xhr, status);\n }\n }\n\n // run ajax request or put it into a queue\n if (login_dialog_opened) {\n ajax_queue.push(options);\n }\n else {\n $.ajax(options_new);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "\"dblclick\",x);mxEvent.addListener(Na,\"click\",function(Za){M(La,Ta,Ua,Za)})})(fa[qa],Pa,Na);aa.appendChild(Pa)}}for(var Ya in ja)fa=ja[Ya],0ba?ba:fa.length;for(var ja=0;jai_sb)->s_orphan_lock);\n\tif (list_empty(&ei->i_orphan))\n\t\tgoto out;\n\n\tino_next = NEXT_ORPHAN(inode);\n\tprev = ei->i_orphan.prev;\n\tsbi = EXT4_SB(inode->i_sb);\n\n\tjbd_debug(4, \"remove inode %lu from orphan list\\n\", inode->i_ino);\n\n\tlist_del_init(&ei->i_orphan);\n\n\t/* If we're on an error path, we may not have a valid\n\t * transaction handle with which to update the orphan list on\n\t * disk, but we still need to remove the inode from the linked\n\t * list in memory. */\n\tif (sbi->s_journal && !handle)\n\t\tgoto out;\n\n\terr = ext4_reserve_inode_write(handle, inode, &iloc);\n\tif (err)\n\t\tgoto out_err;\n\n\tif (prev == &sbi->s_orphan) {\n\t\tjbd_debug(4, \"superblock will point to %u\\n\", ino_next);\n\t\tBUFFER_TRACE(sbi->s_sbh, \"get_write_access\");\n\t\terr = ext4_journal_get_write_access(handle, sbi->s_sbh);\n\t\tif (err)\n\t\t\tgoto out_brelse;\n\t\tsbi->s_es->s_last_orphan = cpu_to_le32(ino_next);\n\t\terr = ext4_handle_dirty_super(handle, inode->i_sb);\n\t} else {\n\t\tstruct ext4_iloc iloc2;\n\t\tstruct inode *i_prev =\n\t\t\t&list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode;\n\n\t\tjbd_debug(4, \"orphan inode %lu will point to %u\\n\",\n\t\t\t i_prev->i_ino, ino_next);\n\t\terr = ext4_reserve_inode_write(handle, i_prev, &iloc2);\n\t\tif (err)\n\t\t\tgoto out_brelse;\n\t\tNEXT_ORPHAN(i_prev) = ino_next;\n\t\terr = ext4_mark_iloc_dirty(handle, i_prev, &iloc2);\n\t}\n\tif (err)\n\t\tgoto out_brelse;\n\tNEXT_ORPHAN(inode) = 0;\n\terr = ext4_mark_iloc_dirty(handle, inode, &iloc);\n\nout_err:\n\text4_std_error(inode->i_sb, err);\nout:\n\tmutex_unlock(&EXT4_SB(inode->i_sb)->s_orphan_lock);\n\treturn err;\n\nout_brelse:\n\tbrelse(iloc.bh);\n\tgoto out_err;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "njs_function_lambda_call(njs_vm_t *vm)\n{\n uint32_t n;\n njs_int_t ret;\n njs_frame_t *frame;\n njs_value_t *args, **local, *value;\n njs_value_t **cur_local, **cur_closures, **cur_temp;\n njs_function_t *function;\n njs_declaration_t *declr;\n njs_function_lambda_t *lambda;\n\n frame = (njs_frame_t *) vm->top_frame;\n function = frame->native.function;\n\n if (function->global && !function->closure_copied) {\n ret = njs_function_capture_global_closures(vm, function);\n if (njs_slow_path(ret != NJS_OK)) {\n return NJS_ERROR;\n }\n }\n\n lambda = function->u.lambda;\n\n args = vm->top_frame->arguments;\n local = vm->top_frame->local + function->args_offset;\n\n /* Move all arguments. */\n\n for (n = 0; n < function->args_count; n++) {\n if (!njs_is_valid(args)) {\n njs_set_undefined(args);\n }\n\n *local++ = args++;\n }\n\n /* Store current level. */\n\n cur_local = vm->levels[NJS_LEVEL_LOCAL];\n cur_closures = vm->levels[NJS_LEVEL_CLOSURE];\n cur_temp = vm->levels[NJS_LEVEL_TEMP];\n\n /* Replace current level. */\n\n vm->levels[NJS_LEVEL_LOCAL] = vm->top_frame->local;\n vm->levels[NJS_LEVEL_CLOSURE] = njs_function_closures(function);\n vm->levels[NJS_LEVEL_TEMP] = frame->native.temp;\n\n if (lambda->rest_parameters) {\n ret = njs_function_rest_parameters_init(vm, &frame->native);\n if (njs_slow_path(ret != NJS_OK)) {\n return NJS_ERROR;\n }\n }\n\n /* Self */\n\n if (lambda->self != NJS_INDEX_NONE) {\n value = njs_scope_value(vm, lambda->self);\n\n if (!njs_is_valid(value)) {\n njs_set_function(value, function);\n }\n }\n\n vm->active_frame = frame;\n\n /* Closures */\n\n n = lambda->ndeclarations;\n\n while (n != 0) {\n n--;\n\n declr = &lambda->declarations[n];\n value = njs_scope_value(vm, declr->index);\n\n *value = *declr->value;\n\n function = njs_function_value_copy(vm, value);\n if (njs_slow_path(function == NULL)) {\n return NJS_ERROR;\n }\n\n ret = njs_function_capture_closure(vm, function, function->u.lambda);\n if (njs_slow_path(ret != NJS_OK)) {\n return ret;\n }\n }\n\n ret = njs_vmcode_interpreter(vm, lambda->start);\n\n /* Restore current level. */\n vm->levels[NJS_LEVEL_LOCAL] = cur_local;\n vm->levels[NJS_LEVEL_CLOSURE] = cur_closures;\n vm->levels[NJS_LEVEL_TEMP] = cur_temp;\n\n return ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def write(self):\n self._create_dirs()\n for component in self.components:\n text = ical.serialize(\n self.tag, self.headers, [component] + self.timezones)\n name = (\n component.name if sys.version_info[0] >= 3 else\n component.name.encode(filesystem.FILESYSTEM_ENCODING))\n if not pathutils.is_safe_filesystem_path_component(name):\n log.LOGGER.debug(\n \"Can't tranlate name safely to filesystem, \"\n \"skipping component: %s\", name)\n continue\n filesystem_path = os.path.join(self._filesystem_path, name)\n with filesystem.open(filesystem_path, \"w\") as fd:\n fd.write(text)", "label": 1, "label_name": "safe"} +{"code": " $contents = ['form' => tep_draw_form('zones', 'zones.php', 'page=' . (int)$_GET['page'] . '&action=insert')];", "label": 1, "label_name": "safe"} +{"code": "export function applyCommandArgs(configuration: any, argv: string[]) {\n\tif (!argv || !argv.length) {\n\t\treturn;\n\t}\n\n\targv = argv.slice(2);\n\n\tconst parsedArgv = yargs(argv);\n\tconst argvKeys = Object.keys(parsedArgv);\n\tif (!argvKeys.length) {\n\t\treturn;\n\t}\n\n\tdebug(\"Appling command arguments:\", parsedArgv);\n\n\tconst CONFIG_PROP = 'config';\n\n\tif (parsedArgv[CONFIG_PROP]) {\n\t\tconst configFile = path.resolve(process.cwd(), parsedArgv[CONFIG_PROP]);\n\t\tapplyConfigFile(configuration, configFile);\n\t}\n\n\tfor (const key in parsedArgv) {\n\t\tif (!parsedArgv.hasOwnProperty(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key.startsWith('_')) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (key.endsWith('_')) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (key === CONFIG_PROP) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst configKey = key\n\t\t\t.replace(/_/g, \".\");\n\n\t\tdebug(`Found config value from cmd args '${key}' to '${configKey}'`);\n\n\t\tsetDeepProperty(configuration, configKey, parsedArgv[key]);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " public void testValidUserIds() {\n testInvalidUserId(\"John-Doe\",false);\n testInvalidUserId(\"Jane/Doe\",false);\n testInvalidUserId(\"John.Doe\",false);\n testInvalidUserId(\"Jane#Doe\", false);\n testInvalidUserId(\"John@D\u00f6e.com\", false);\n testInvalidUserId(\"JohnDo\u00e9\", false);\n }", "label": 1, "label_name": "safe"} +{"code": " public function getBatchSerial($namespace)\n {\n if (empty($this->serials[$namespace])) {\n $batch = $this->getBatch($namespace);\n unset($batch['DefinitionRev']);\n $this->serials[$namespace] = sha1(serialize($batch));\n }\n return $this->serials[$namespace];\n }", "label": 1, "label_name": "safe"} +{"code": "this.put(\"editCell\",new Menu(mxUtils.bind(this,function(R,fa){var la=this.editorUi.editor.graph,ra=la.getSelectionCell();ka.call(this,R,ra,null,fa);this.addMenuItems(R,[\"editTooltip\"],fa);la.model.isVertex(ra)&&this.addMenuItems(R,[\"editGeometry\"],fa);this.addMenuItems(R,[\"-\",\"edit\"],fa)})));this.addPopupMenuCellEditItems=function(R,fa,la,ra){R.addSeparator();this.addSubmenu(\"editCell\",R,ra,mxResources.get(\"edit\"))};this.put(\"file\",new Menu(mxUtils.bind(this,function(R,fa){var la=O.getCurrentFile();", "label": 0, "label_name": "vulnerable"} +{"code": "exports.basicAuth = function (req, res, next) {\n var hookResultMangle = function (cb) {\n return function (err, data) {\n return cb(!err && data.length && data[0]);\n }\n }\n\n var authorize = function (cb) {\n // Do not require auth for static paths and the API...this could be a bit brittle\n if (req.path.match(/^\\/(static|javascripts|pluginfw|api)/)) return cb(true);\n\n if (req.path.indexOf('/admin') != 0) {\n if (!settings.requireAuthentication) return cb(true);\n if (!settings.requireAuthorization && req.session && req.session.user) return cb(true);\n }\n\n if (req.session && req.session.user && req.session.user.is_admin) return cb(true);\n\n hooks.aCallFirst(\"authorize\", {req: req, res:res, next:next, resource: req.path}, hookResultMangle(cb));\n }\n\n var authenticate = function (cb) {\n // If auth headers are present use them to authenticate...\n if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {\n var userpass = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString().split(\":\")\n var username = userpass.shift();\n var password = userpass.join(':');\n\n if (settings.users[username] != undefined && settings.users[username].password === password) {\n settings.users[username].username = username;\n req.session.user = settings.users[username];\n return cb(true);\n }\n return hooks.aCallFirst(\"authenticate\", {req: req, res:res, next:next, username: username, password: password}, hookResultMangle(cb));\n }\n hooks.aCallFirst(\"authenticate\", {req: req, res:res, next:next}, hookResultMangle(cb));\n }\n\n\n /* Authentication OR authorization failed. */\n var failure = function () {\n return hooks.aCallFirst(\"authFailure\", {req: req, res:res, next:next}, hookResultMangle(function (ok) {\n if (ok) return;\n /* No plugin handler for invalid auth. Return Auth required\n * Headers, delayed for 1 second, if authentication failed\n * before. */\n res.header('WWW-Authenticate', 'Basic realm=\"Protected Area\"');\n if (req.headers.authorization) {\n setTimeout(function () {\n res.status(401).send('Authentication required');\n }, 1000);\n } else {\n res.status(401).send('Authentication required');\n }\n }));\n }\n\n\n /* This is the actual authentication/authorization hoop. It is done in four steps:\n\n 1) Try to just access the thing\n 2) If not allowed using whatever creds are in the current session already, try to authenticate\n 3) If authentication using already supplied credentials succeeds, try to access the thing again\n 4) If all els fails, give the user a 401 to request new credentials\n\n Note that the process could stop already in step 3 with a redirect to login page.\n\n */\n\n authorize(function (ok) {\n if (ok) return next();\n authenticate(function (ok) {\n if (!ok) return failure();\n authorize(function (ok) {\n if (ok) return next();\n failure();\n });\n });\n });\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function setUp()\n {\n $this->request = Mockery::mock('\\Omnipay\\Stripe\\Message\\AbstractRequest')->makePartial();\n $this->request->initialize();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tvar apply = function(color, disableUpdate, forceUpdate)\n\t{\n\t\tif (!applying)\n\t\t{\n\t\t\tvar defaultValue = (defaultColor == 'null') ? null : defaultColor;\n\n\t\t\tapplying = true;\n\t\t\tcolor = (/(^#?[a-zA-Z0-9]*$)/.test(color)) ? color : defaultValue;\n\t\t\tvar tempColor = (color != null && color != mxConstants.NONE) ? color : defaultValue;\n\n\t\t\tvar div = document.createElement('div');\n\t\t\tdiv.style.width = '36px';\n\t\t\tdiv.style.height = '12px';\n\t\t\tdiv.style.margin = '3px';\n\t\t\tdiv.style.border = '1px solid black';\n\t\t\tdiv.style.backgroundColor = (tempColor == 'default') ? defaultColorValue : tempColor;\n\t\t\tbtn.innerHTML = '';\n\t\t\tbtn.appendChild(div);\n\n\t\t\tif (color != null && color != mxConstants.NONE && color.length > 1 && typeof color === 'string')\n\t\t\t{\n\t\t\t\tvar clr = (color.charAt(0) == '#') ? color.substring(1).toUpperCase() : color;\n\t\t\t\tvar name = ColorDialog.prototype.colorNames[clr];\n\t\t\t\tbtn.setAttribute('title', (name != null) ? name + ' (' + title + ')' : title);\n\t\t\t}\n\t\t\t\n\t\t\tif (color != null && color != mxConstants.NONE)\n\t\t\t{\n\t\t\t\tcb.setAttribute('checked', 'checked');\n\t\t\t\tcb.defaultChecked = true;\n\t\t\t\tcb.checked = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcb.removeAttribute('checked');\n\t\t\t\tcb.defaultChecked = false;\n\t\t\t\tcb.checked = false;\n\t\t\t}\n\t\n\t\t\tbtn.style.display = (cb.checked || hideCheckbox) ? '' : 'none';\n\n\t\t\tif (callbackFn != null)\n\t\t\t{\n\t\t\t\tcallbackFn(color == 'null' ? null : color);\n\t\t\t}\n\n\t\t\tvalue = color;\n\n\t\t\tif (!disableUpdate)\n\t\t\t{\n\t\t\t\t// Checks if the color value needs to be updated in the model\n\t\t\t\tif (forceUpdate || hideCheckbox || getColorFn() != value)\n\t\t\t\t{\n\t\t\t\t\tsetColorFn(value == 'null' ? null : value, value);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tapplying = false;\n\t\t}\n\t};", "label": 0, "label_name": "vulnerable"} +{"code": "\tnormalize : function(data) {\n\t\tvar filter = function(file) { \n\t\t\n\t\t\tif (file && file.hash && file.name && file.mime) {\n\t\t\t\tif (file.mime == 'application/x-empty') {\n\t\t\t\t\tfile.mime = 'text/plain';\n\t\t\t\t}\n\t\t\t\treturn file;\n\t\t\t}\n\t\t\treturn null;\n\t\t};\n\t\t\n\n\t\tif (data.files) {\n\t\t\tdata.files = $.map(data.files, filter);\n\t\t} \n\t\tif (data.tree) {\n\t\t\tdata.tree = $.map(data.tree, filter);\n\t\t}\n\t\tif (data.added) {\n\t\t\tdata.added = $.map(data.added, filter);\n\t\t}\n\t\tif (data.changed) {\n\t\t\tdata.changed = $.map(data.changed, filter);\n\t\t}\n\t\tif (data.api) {\n\t\t\tdata.init = true;\n\t\t}\n\t\treturn data;\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " def make_homeserver(self, reactor, clock):\n hs = self.setup_test_homeserver(http_client=None)\n self.handler = hs.get_federation_handler()\n self.store = hs.get_datastore()\n return hs", "label": 0, "label_name": "vulnerable"} +{"code": " $percent = round($percent, 0);\n } else {\n $percent = round($percent, 2); // school default\n }\n if ($ret == '%')\n return $percent;\n\n if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id])\n $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\\'' . $cp[1]['SYEAR'] . '\\' AND SCHOOL_ID=\\'' . $cp[1]['SCHOOL_ID'] . '\\' AND GRADE_SCALE_ID=\\'' . $grade_scale_id . '\\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER'));\n\n foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) {\n if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF'])\n return $ret == 'ID' ? $grade['ID'] : $grade['TITLE'];\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "var F=this.editorUi,G=F.editor.graph;if(G.isEnabled()&&\"1\"==urlParams.sketch){var N=this.createOption(mxResources.get(\"sketch\"),function(){return Editor.sketchMode},function(J,E){F.setSketchMode(!Editor.sketchMode);null!=E&&mxEvent.isShiftDown(E)||G.updateCellStyles({sketch:J?\"1\":null},G.getVerticesAndEdges())},{install:function(J){this.listener=function(){J(Editor.sketchMode)};F.addListener(\"sketchModeChanged\",this.listener)},destroy:function(){F.removeListener(this.listener)}});B.appendChild(N)}return B};", "label": 0, "label_name": "vulnerable"} +{"code": " public function setArticles($articles)\n {\n $return = $this->setOneToMany($articles, Article::class, 'articles', 'container');\n $this->setType('ctArticles');\n\n return $return;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def wf_issue\n Log.add_info(request, params.inspect)\n\n begin\n @item = Item.find(params[:id])\n @workflow = @item.workflow\n rescue => evar\n Log.add_error(request, evar)\n end\n \n attrs = ActionController::Parameters.new({status: Workflow::STATUS_ACTIVE, issued_at: Time.now})\n @workflow.update_attributes(attrs.permit(Workflow::PERMIT_BASE))\n\n @orders = @workflow.get_orders\n\n render(:partial => 'ajax_workflow', :layout => false)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t\t\t\tparent.animate({ scrollTop : parent.scrollTop() + tgtTop - top - treeH / 3 }, { duration : 'fast' });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}, 100));", "label": 1, "label_name": "safe"} +{"code": " 'entityType': this.getHelper().escapeString(this.translateEntityType(this.model.get('parentType'))),", "label": 1, "label_name": "safe"} +{"code": "struct error_obj run_pam_auth(const char *username, char *password) {\n // PAM frees pam_response for us.\n struct pam_response *reply = malloc(sizeof(struct pam_response));\n if (reply == NULL) {\n struct error_obj ret_val;\n ret_val.status = 2;\n ret_val.func_name = \"malloc\";\n ret_val.error_msg = \"Out of memory\";\n return ret_val;\n }\n reply->resp = password;\n reply->resp_retcode = 0;\n\n const struct pam_conv local_conv = { conv_func, reply };\n pam_handle_t *local_auth = NULL;\n int status = pam_start(\"maddy\", username, &local_conv, &local_auth);\n if (status != PAM_SUCCESS) {\n struct error_obj ret_val;\n ret_val.status = 2;\n ret_val.func_name = \"pam_start\";\n ret_val.error_msg = pam_strerror(local_auth, status);\n return ret_val;\n }\n\n status = pam_authenticate(local_auth, PAM_SILENT|PAM_DISALLOW_NULL_AUTHTOK);\n if (status != PAM_SUCCESS) {\n struct error_obj ret_val;\n if (status == PAM_AUTH_ERR || status == PAM_USER_UNKNOWN) {\n ret_val.status = 1;\n } else {\n ret_val.status = 2;\n }\n ret_val.func_name = \"pam_authenticate\";\n ret_val.error_msg = pam_strerror(local_auth, status);\n return ret_val;\n }\n\n status = pam_acct_mgmt(local_auth, PAM_SILENT|PAM_DISALLOW_NULL_AUTHTOK);\n if (status != PAM_SUCCESS) {\n struct error_obj ret_val;\n if (status == PAM_AUTH_ERR || status == PAM_USER_UNKNOWN || status == PAM_NEW_AUTHTOK_REQD) {\n ret_val.status = 1;\n } else {\n ret_val.status = 2;\n }\n ret_val.func_name = \"pam_acct_mgmt\";\n ret_val.error_msg = pam_strerror(local_auth, status);\n return ret_val;\n }\n\n status = pam_end(local_auth, status);\n if (status != PAM_SUCCESS) {\n struct error_obj ret_val;\n ret_val.status = 2;\n ret_val.func_name = \"pam_end\";\n ret_val.error_msg = pam_strerror(local_auth, status);\n return ret_val;\n }\n\n struct error_obj ret_val;\n ret_val.status = 0;\n ret_val.func_name = NULL;\n ret_val.error_msg = NULL;\n return ret_val;\n}", "label": 1, "label_name": "safe"} +{"code": "0;N>>8;return u};Editor.crc32=function(u){for(var E=-1,J=0;J>>8^Editor.crcTable[(E^u.charCodeAt(J))&255];return(E^-1)>>>0};Editor.writeGraphModelToPng=function(u,E,J,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label": 0, "label_name": "vulnerable"} +{"code": " it { should contain_class(\"apache\") }", "label": 0, "label_name": "vulnerable"} +{"code": " public String list(Model model, // TODO model should no longer be injected\n @RequestParam(required = false, defaultValue = \"FILENAME\") SortBy sortBy,\n @RequestParam(required = false, defaultValue = \"false\") boolean desc,\n @RequestParam(required = false) String base) throws IOException, TemplateException {\n securityCheck(base);\n\n Path currentFolder = loggingPath(base);\n\n List files = getFileProvider(currentFolder).getFileEntries(currentFolder);\n List sortedFiles = sortFiles(files, sortBy, desc);\n\n model.addAttribute(\"sortBy\", sortBy);\n model.addAttribute(\"desc\", desc);\n model.addAttribute(\"files\", sortedFiles);\n model.addAttribute(\"currentFolder\", currentFolder.toAbsolutePath().toString());\n model.addAttribute(\"base\", base != null ? URLEncoder.encode(base, \"UTF-8\") : \"\");\n model.addAttribute(\"parent\", getParent(currentFolder));\n model.addAttribute(\"stylesheets\", stylesheets);\n\n return FreeMarkerTemplateUtils.processTemplateIntoString(freemarkerConfig.getTemplate(\"logview.ftl\"), model);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def update_auth\n Log.add_info(request, params.inspect)\n\n return unless request.post?\n\n auth = nil\n\n if params[:check_auth_all] == '1'\n\n auth = User::AUTH_ALL\n\n else\n\n auth_selected = params[:auth_selected]\n\n unless auth_selected.nil? or auth_selected.empty?\n auth = '|' + auth_selected.join('|') + '|'\n end\n\n if auth_selected.nil? or !auth_selected.include?(User::AUTH_USER)\n\n user_admin_err = false\n\n user_admins = User.where(\"auth like '%|#{User::AUTH_USER}|%' or auth='#{User::AUTH_ALL}'\").to_a\n\n if user_admins.nil? or user_admins.empty?\n\n user_admin_err = true\n\n elsif user_admins.length == 1\n\n if user_admins.first.id.to_s == params[:id]\n user_admin_err = true\n end\n\n end\n\n if user_admin_err\n render(:text => t('user.no_user_auth'))\n return\n end\n end\n\n end\n\n begin\n user = User.find(params[:id])\n rescue => evar\n Log.add_error(request, evar)\n end\n\n if user.nil?\n\n render(:text => t('msg.already_deleted', :name => User.model_name.human))\n else\n\n user.update_attribute(:auth, auth)\n\n if user.id == @login_user.id\n @login_user = user\n end\n\n render(:text => '')\n end\n end", "label": 1, "label_name": "safe"} +{"code": "\t\t\tsync = function(noCwd, dirs) {\n\t\t\t\tvar cwd = fm.cwd(),\n\t\t\t\t\tcwdhash = cwd.hash,\n\t\t\t\t\tcurrent = $('#'+fm.navHash2Id(cwdhash)), \n\t\t\t\t\tnoCwd = noCwd || false,\n\t\t\t\t\tdirs = dirs || [],\n\t\t\t\t\trootNode, dir, link, subs, subsLen, cnt;\n\t\t\t\t\n\t\t\t\tif (openRoot) {\n\t\t\t\t\trootNode = $('#'+fm.navHash2Id(fm.root()));\n\t\t\t\t\trootNode.hasClass(loaded) && rootNode.addClass(expanded).next('.'+subtree).show();\n\t\t\t\t\topenRoot = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!current.hasClass(active)) {\n\t\t\t\t\ttree.find(selNavdir+'.'+active).removeClass(active);\n\t\t\t\t\tcurrent.addClass(active);\n\t\t\t\t}\n\n\t\t\t\tif (opts.syncTree || !current.length) {\n\t\t\t\t\tif (current.length) {\n\t\t\t\t\t\tif (!noCwd) {\n\t\t\t\t\t\t\tcurrent.addClass(loaded);\n\t\t\t\t\t\t\tif (openCwd && current.hasClass(collapsed)) {\n\t\t\t\t\t\t\t\tcurrent.addClass(expanded).next('.'+subtree).slideDown();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsubs = current.parentsUntil('.'+root).filter('.'+subtree);\n\t\t\t\t\t\tsubsLen = subs.length;\n\t\t\t\t\t\tcnt = 1;\n\t\t\t\t\t\tsubs.show().prev(selNavdir).addClass(expanded, function() {\n\t\t\t\t\t\t\t!noCwd && subsLen == cnt++ && autoScroll();\n\t\t\t\t\t\t});\n\t\t\t\t\t\t!subsLen && !noCwd && autoScroll();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (fm.newAPI) {\n\t\t\t\t\t\tdir = fm.file(cwdhash);\n\t\t\t\t\t\tif (dir && dir.phash) {\n\t\t\t\t\t\t\tlink = $('#'+fm.navHash2Id(dir.phash));\n\t\t\t\t\t\t\tif (link.length && link.hasClass(loaded)) {\n\t\t\t\t\t\t\t\tfm.lazy(function() {\n\t\t\t\t\t\t\t\t\tupdateTree([dir]);\n\t\t\t\t\t\t\t\t\tsync(noCwd);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlink = cwd.root? $('#'+fm.navHash2Id(cwd.root)) : null;\n\t\t\t\t\t\tif (link) {\n\t\t\t\t\t\t\tspinner.insertBefore(link.children('.'+arrow));\n\t\t\t\t\t\t\tlink.removeClass(collapsed);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfm.request({\n\t\t\t\t\t\t\tdata : {cmd : 'parents', target : cwdhash},\n\t\t\t\t\t\t\tpreventFail : true\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.done(function(data) {\n\t\t\t\t\t\t\tif (fm.api < 2.1) {\n\t\t\t\t\t\t\t\tdata.tree = data.tree.concat([cwd]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdirs = $.merge(dirs, filter(data.tree));\n\t\t\t\t\t\t\tupdateTree(dirs);\n\t\t\t\t\t\t\tupdateArrows(dirs, loaded);\n\t\t\t\t\t\t\tcwdhash == cwd.hash && fm.visible() && sync(noCwd);\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.always(function(data) {\n\t\t\t\t\t\t\tif (link) {\n\t\t\t\t\t\t\t\tspinner.remove();\n\t\t\t\t\t\t\t\tlink.addClass(collapsed+' '+loaded);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t},", "label": 1, "label_name": "safe"} +{"code": " public function testParagraphInsideBlockNode()\n {\n $this->assertResult(\n'
    Par1\n\nPar2
    ',\n'

    Par1

    \n\n

    Par2

    '\n );\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus EqualEval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor1, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor2, &input2));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n bool requires_broadcast = !HaveSameShapes(input1, input2);\n switch (input1->type) {\n case kTfLiteBool:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteFloat32:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteInt32:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteInt64:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteUInt8:\n ComparisonQuantized(\n input1, input2, output, requires_broadcast);\n break;\n case kTfLiteInt8:\n ComparisonQuantized(\n input1, input2, output, requires_broadcast);\n break;\n case kTfLiteString:\n ComparisonString(reference_ops::StringRefEqualFn, input1, input2, output,\n requires_broadcast);\n break;\n default:\n context->ReportError(\n context,\n \"Does not support type %d, requires bool|float|int|uint8|string\",\n input1->type);\n return kTfLiteError;\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": "void* TFE_HandleToDLPack(TFE_TensorHandle* h, TF_Status* status) {\n auto tf_dlm_context = GetDlContext(h, status);\n if (!status->status.ok()) {\n return nullptr;\n }\n\n auto* tf_dlm_data = TFE_TensorHandleDevicePointer(h, status);\n if (!status->status.ok()) {\n return nullptr;\n }\n\n const Tensor* tensor = GetTensorFromHandle(h, status);\n TF_DataType data_type = static_cast(tensor->dtype());\n\n auto tf_dlm_type = GetDlDataType(data_type, status);\n if (!status->status.ok()) {\n return nullptr;\n }\n\n TensorReference tensor_ref(*tensor); // This will call buf_->Ref()\n auto* tf_dlm_tensor_ctx = new TfDlManagedTensorCtx(tensor_ref);\n tf_dlm_tensor_ctx->reference = tensor_ref;\n\n DLManagedTensor* dlm_tensor = &tf_dlm_tensor_ctx->tensor;\n dlm_tensor->manager_ctx = tf_dlm_tensor_ctx;\n dlm_tensor->deleter = &DLManagedTensorDeleter;\n dlm_tensor->dl_tensor.ctx = tf_dlm_context;\n int ndim = tensor->dims();\n dlm_tensor->dl_tensor.ndim = ndim;\n dlm_tensor->dl_tensor.data = tf_dlm_data;\n dlm_tensor->dl_tensor.dtype = tf_dlm_type;\n\n std::vector* shape_arr = &tf_dlm_tensor_ctx->shape;\n std::vector* stride_arr = &tf_dlm_tensor_ctx->strides;\n shape_arr->resize(ndim);\n stride_arr->resize(ndim, 1);\n for (int i = 0; i < ndim; i++) {\n (*shape_arr)[i] = tensor->dim_size(i);\n }\n for (int i = ndim - 2; i >= 0; --i) {\n (*stride_arr)[i] = (*shape_arr)[i + 1] * (*stride_arr)[i + 1];\n }\n\n dlm_tensor->dl_tensor.shape = shape_arr->data();\n // There are two ways to represent compact row-major data\n // 1) nullptr indicates tensor is compact and row-majored.\n // 2) fill in the strides array as the real case for compact row-major data.\n // Here we choose option 2, since some frameworks didn't handle the strides\n // argument properly.\n dlm_tensor->dl_tensor.strides = stride_arr->data();\n\n dlm_tensor->dl_tensor.byte_offset =\n 0; // TF doesn't handle the strides and byte_offsets here\n return static_cast(dlm_tensor);\n}", "label": 1, "label_name": "safe"} +{"code": " public Invoice InvoicePendingCharges(Invoice invoice = null)\n {\n var i = invoice ?? new Invoice();\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Post,\n UrlPrefix + Uri.EscapeUriString(AccountCode) + \"/invoices\",\n i.WriteXml,\n i.ReadXml);\n\n return i;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "def _ssl_wrap_socket(\n sock, key_file, cert_file, disable_validation, ca_certs, ssl_version, hostname, key_password", "label": 0, "label_name": "vulnerable"} +{"code": "EditorUi.prototype.createPageMenuTab=function(b,f){b=this.createControlTab(3,'
    ',b);b.setAttribute(\"title\",mxResources.get(\"pages\"));b.style.position=\"absolute\";b.style.marginLeft=\"0px\";b.style.top=\"0px\";b.style.left=\"1px\";var l=b.getElementsByTagName(\"div\")[0];l.style.display=\"inline-block\";l.style.marginTop=\"5px\";l.style.width=\"21px\";l.style.height=\"21px\";mxEvent.addListener(b,\"click\",mxUtils.bind(this,function(d){this.editor.graph.popupMenuHandler.hideMenu();\nvar u=new mxPopupMenu(mxUtils.bind(this,function(c,e){var g=mxUtils.bind(this,function(){for(var v=0;vmiddleware('guest');\n $this->middleware('guard:standard');\n\n $this->inviteService = $inviteService;\n $this->userRepo = $userRepo;\n }", "label": 1, "label_name": "safe"} +{"code": "def show_unit_extensions(request, course_id):\n \"\"\"\n Shows all of the students which have due date extensions for the given unit.\n \"\"\"\n course = get_course_by_id(SlashSeparatedCourseKey.from_deprecated_string(course_id))\n unit = find_unit(course, request.POST.get('url'))\n return JsonResponse(dump_module_extensions(course, unit))", "label": 1, "label_name": "safe"} +{"code": " public function Data($msg_data) {\n $this->error = null; // so no confusion is caused\n\n if(!$this->connected()) {\n $this->error = array(\n \"error\" => \"Called Data() without being connected\");\n return false;\n }\n\n fputs($this->smtp_conn,\"DATA\" . $this->CRLF);\n\n $rply = $this->get_lines();\n $code = substr($rply,0,3);\n\n if($this->do_debug >= 2) {\n $this->edebug(\"SMTP -> FROM SERVER:\" . $rply . $this->CRLF . '
    ');\n }\n\n if($code != 354) {\n $this->error =\n array(\"error\" => \"DATA command not accepted from server\",\n \"smtp_code\" => $code,\n \"smtp_msg\" => substr($rply,4));\n if($this->do_debug >= 1) {\n $this->edebug(\"SMTP -> ERROR: \" . $this->error[\"error\"] . \": \" . $rply . $this->CRLF . '
    ');\n }\n return false;\n }\n\n /* the server is ready to accept data!\n * according to rfc 821 we should not send more than 1000\n * including the CRLF\n * characters on a single line so we will break the data up\n * into lines by \\r and/or \\n then if needed we will break\n * each of those into smaller lines to fit within the limit.\n * in addition we will be looking for lines that start with\n * a period '.' and append and additional period '.' to that\n * line. NOTE: this does not count towards limit.\n */\n\n // normalize the line breaks so we know the explode works\n $msg_data = str_replace(\"\\r\\n\",\"\\n\",$msg_data);\n $msg_data = str_replace(\"\\r\",\"\\n\",$msg_data);\n $lines = explode(\"\\n\",$msg_data);\n\n /* we need to find a good way to determine is headers are\n * in the msg_data or if it is a straight msg body\n * currently I am assuming rfc 822 definitions of msg headers\n * and if the first field of the first line (':' sperated)\n * does not contain a space then it _should_ be a header\n * and we can process all lines before a blank \"\" line as\n * headers.\n */\n\n $field = substr($lines[0],0,strpos($lines[0],\":\"));\n $in_headers = false;\n if(!empty($field) && !strstr($field,\" \")) {\n $in_headers = true;\n }\n\n $max_line_length = 998; // used below; set here for ease in change\n\n while(list(,$line) = @each($lines)) {\n $lines_out = null;\n if($line == \"\" && $in_headers) {\n $in_headers = false;\n }\n // ok we need to break this line up into several smaller lines\n while(strlen($line) > $max_line_length) {\n $pos = strrpos(substr($line,0,$max_line_length),\" \");\n\n // Patch to fix DOS attack\n if(!$pos) {\n $pos = $max_line_length - 1;\n $lines_out[] = substr($line,0,$pos);\n $line = substr($line,$pos);\n } else {\n $lines_out[] = substr($line,0,$pos);\n $line = substr($line,$pos + 1);\n }\n\n /* if processing headers add a LWSP-char to the front of new line\n * rfc 822 on long msg headers\n */\n if($in_headers) {\n $line = \"\\t\" . $line;\n }\n }\n $lines_out[] = $line;\n\n // send the lines to the server\n while(list(,$line_out) = @each($lines_out)) {\n if(strlen($line_out) > 0)\n {\n if(substr($line_out, 0, 1) == \".\") {\n $line_out = \".\" . $line_out;\n }\n }\n fputs($this->smtp_conn,$line_out . $this->CRLF);\n }\n }\n\n // message data has been sent\n fputs($this->smtp_conn, $this->CRLF . \".\" . $this->CRLF);\n\n $rply = $this->get_lines();\n $code = substr($rply,0,3);\n\n if($this->do_debug >= 2) {\n $this->edebug(\"SMTP -> FROM SERVER:\" . $rply . $this->CRLF . '
    ');\n }\n\n if($code != 250) {\n $this->error =\n array(\"error\" => \"DATA not accepted from server\",\n \"smtp_code\" => $code,\n \"smtp_msg\" => substr($rply,4));\n if($this->do_debug >= 1) {\n $this->edebug(\"SMTP -> ERROR: \" . $this->error[\"error\"] . \": \" . $rply . $this->CRLF . '
    ');\n }\n return false;\n }\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def initialize(data = nil, time = nil)\n if data\n @data = data\n elsif time\n @data = @@generator.generate(time.to_i)\n else\n @data = @@generator.next\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testLinkifyInBlock()\n {\n $this->assertResult(\n '
    This %Namespace.Directive thing
    ',\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": "static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info,\n const PrimitiveInfo *primitive_info,Image *image,ExceptionInfo *exception)\n{\n DrawInfo\n *clone_info;\n\n double\n length,\n maximum_length,\n offset,\n scale,\n total_length;\n\n MagickStatusType\n status;\n\n PrimitiveInfo\n *dash_polygon;\n\n register ssize_t\n i;\n\n register double\n dx,\n dy;\n\n size_t\n number_vertices;\n\n ssize_t\n j,\n n;\n\n assert(draw_info != (const DrawInfo *) NULL);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(DrawEvent,GetMagickModule(),\" begin draw-dash\");\n for (i=0; primitive_info[i].primitive != UndefinedPrimitive; i++) ;\n number_vertices=(size_t) i;\n dash_polygon=(PrimitiveInfo *) AcquireQuantumMemory((size_t)\n (2UL*number_vertices+1UL),sizeof(*dash_polygon));\n if (dash_polygon == (PrimitiveInfo *) NULL)\n return(MagickFalse);\n clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info);\n clone_info->miterlimit=0;\n dash_polygon[0]=primitive_info[0];\n scale=ExpandAffine(&draw_info->affine);\n length=scale*(draw_info->dash_pattern[0]-0.5);\n offset=draw_info->dash_offset != 0.0 ? scale*draw_info->dash_offset : 0.0;\n j=1;\n for (n=0; offset > 0.0; j=0)\n {\n if (draw_info->dash_pattern[n] <= 0.0)\n break;\n length=scale*(draw_info->dash_pattern[n]+(n == 0 ? -0.5 : 0.5));\n if (offset > length)\n {\n offset-=length;\n n++;\n length=scale*(draw_info->dash_pattern[n]+0.5);\n continue;\n }\n if (offset < length)\n {\n length-=offset;\n offset=0.0;\n break;\n }\n offset=0.0;\n n++;\n }\n status=MagickTrue;\n maximum_length=0.0;\n total_length=0.0;\n for (i=1; (i < (ssize_t) number_vertices) && (length >= 0.0); i++)\n {\n dx=primitive_info[i].point.x-primitive_info[i-1].point.x;\n dy=primitive_info[i].point.y-primitive_info[i-1].point.y;\n maximum_length=hypot((double) dx,dy);\n if (length == 0.0)\n {\n n++;\n if (draw_info->dash_pattern[n] == 0.0)\n n=0;\n length=scale*(draw_info->dash_pattern[n]+(n == 0 ? -0.5 : 0.5));\n }\n for (total_length=0.0; (length >= 0.0) && (maximum_length >= (total_length+length)); )\n {\n total_length+=length;\n if ((n & 0x01) != 0)\n {\n dash_polygon[0]=primitive_info[0];\n dash_polygon[0].point.x=(double) (primitive_info[i-1].point.x+dx*\n total_length/maximum_length);\n dash_polygon[0].point.y=(double) (primitive_info[i-1].point.y+dy*\n total_length/maximum_length);\n j=1;\n }\n else\n {\n if ((j+1) > (ssize_t) (2*number_vertices))\n break;\n dash_polygon[j]=primitive_info[i-1];\n dash_polygon[j].point.x=(double) (primitive_info[i-1].point.x+dx*\n total_length/maximum_length);\n dash_polygon[j].point.y=(double) (primitive_info[i-1].point.y+dy*\n total_length/maximum_length);\n dash_polygon[j].coordinates=1;\n j++;\n dash_polygon[0].coordinates=(size_t) j;\n dash_polygon[j].primitive=UndefinedPrimitive;\n status&=DrawStrokePolygon(image,clone_info,dash_polygon,exception);\n }\n n++;\n if (draw_info->dash_pattern[n] == 0.0)\n n=0;\n length=scale*(draw_info->dash_pattern[n]+(n == 0 ? -0.5 : 0.5));\n }\n length-=(maximum_length-total_length);\n if ((n & 0x01) != 0)\n continue;\n dash_polygon[j]=primitive_info[i];\n dash_polygon[j].coordinates=1;\n j++;\n }\n if ((total_length <= maximum_length) && ((n & 0x01) == 0) && (j > 1))\n {\n dash_polygon[j]=primitive_info[i-1];\n dash_polygon[j].point.x+=MagickEpsilon;\n dash_polygon[j].point.y+=MagickEpsilon;\n dash_polygon[j].coordinates=1;\n j++;\n dash_polygon[0].coordinates=(size_t) j;\n dash_polygon[j].primitive=UndefinedPrimitive;\n status&=DrawStrokePolygon(image,clone_info,dash_polygon,exception);\n }\n dash_polygon=(PrimitiveInfo *) RelinquishMagickMemory(dash_polygon);\n clone_info=DestroyDrawInfo(clone_info);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(DrawEvent,GetMagickModule(),\" end draw-dash\");\n return(status != 0 ? MagickTrue : MagickFalse);\n}", "label": 1, "label_name": "safe"} +{"code": "def save_cover(img, book_path):\n content_type = img.headers.get('content-type')\n\n if use_IM:\n if content_type not in ('image/jpeg', 'image/png', 'image/webp', 'image/bmp'):\n log.error(\"Only jpg/jpeg/png/webp/bmp files are supported as coverfile\")\n return False, _(\"Only jpg/jpeg/png/webp/bmp files are supported as coverfile\")\n # convert to jpg because calibre only supports jpg\n if content_type != 'image/jpg':\n try:\n if hasattr(img, 'stream'):\n imgc = Image(blob=img.stream)\n else:\n imgc = Image(blob=io.BytesIO(img.content))\n imgc.format = 'jpeg'\n imgc.transform_colorspace(\"rgb\")\n img = imgc\n except (BlobError, MissingDelegateError):\n log.error(\"Invalid cover file content\")\n return False, _(\"Invalid cover file content\")\n else:\n if content_type not in 'image/jpeg':\n log.error(\"Only jpg/jpeg files are supported as coverfile\")\n return False, _(\"Only jpg/jpeg files are supported as coverfile\")\n\n if config.config_use_google_drive:\n tmp_dir = os.path.join(gettempdir(), 'calibre_web')\n\n if not os.path.isdir(tmp_dir):\n os.mkdir(tmp_dir)\n ret, message = save_cover_from_filestorage(tmp_dir, \"uploaded_cover.jpg\", img)\n if ret is True:\n gd.uploadFileToEbooksFolder(os.path.join(book_path, 'cover.jpg').replace(\"\\\\\", \"/\"),\n os.path.join(tmp_dir, \"uploaded_cover.jpg\"))\n log.info(\"Cover is saved on Google Drive\")\n return True, None\n else:\n return False, message\n else:\n return save_cover_from_filestorage(os.path.join(config.config_calibre_dir, book_path), \"cover.jpg\", img)", "label": 1, "label_name": "safe"} +{"code": " This function encrypts the plaintext */\nPHP_FUNCTION(mcrypt_generic)\n{\n\tzval *mcryptind;\n\tchar *data;\n\tint data_len;\n\tphp_mcrypt *pm;\n\tunsigned char* data_s;\n\tint block_size, data_size;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"rs\", &mcryptind, &data, &data_len) == FAILURE) {\n\t\treturn;\n\t}\n\t\n\tZEND_FETCH_RESOURCE(pm, php_mcrypt *, &mcryptind, -1, \"MCrypt\", le_mcrypt);\n\tPHP_MCRYPT_INIT_CHECK\n\n\tif (data_len == 0) {\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"An empty string was passed\");\n\t\tRETURN_FALSE\n\t}\n\n\t/* Check blocksize */\n\tif (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */\n\t\tblock_size = mcrypt_enc_get_block_size(pm->td);\n\t\tdata_size = (((data_len - 1) / block_size) + 1) * block_size;\n\t\tdata_s = emalloc(data_size + 1);\n\t\tmemset(data_s, 0, data_size);\n\t\tmemcpy(data_s, data, data_len);\n\t} else { /* It's not a block algorithm */\n\t\tdata_size = data_len;\n\t\tdata_s = emalloc(data_size + 1);\n\t\tmemset(data_s, 0, data_size);\n\t\tmemcpy(data_s, data, data_len);\n\t}\n\t\n\tmcrypt_generic(pm->td, data_s, data_size);\n\tdata_s[data_size] = '\\0';\n\n\tRETVAL_STRINGL(data_s, data_size, 1);\n\tefree(data_s);", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct($embeds_resource = false)\n {\n $this->parser = new HTMLPurifier_URIParser();\n $this->embedsResource = (bool)$embeds_resource;\n }", "label": 1, "label_name": "safe"} +{"code": "static struct page *follow_page_pte(struct vm_area_struct *vma,\n\t\tunsigned long address, pmd_t *pmd, unsigned int flags)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tstruct dev_pagemap *pgmap = NULL;\n\tstruct page *page;\n\tspinlock_t *ptl;\n\tpte_t *ptep, pte;\n\nretry:\n\tif (unlikely(pmd_bad(*pmd)))\n\t\treturn no_page_table(vma, flags);\n\n\tptep = pte_offset_map_lock(mm, pmd, address, &ptl);\n\tpte = *ptep;\n\tif (!pte_present(pte)) {\n\t\tswp_entry_t entry;\n\t\t/*\n\t\t * KSM's break_ksm() relies upon recognizing a ksm page\n\t\t * even while it is being migrated, so for that case we\n\t\t * need migration_entry_wait().\n\t\t */\n\t\tif (likely(!(flags & FOLL_MIGRATION)))\n\t\t\tgoto no_page;\n\t\tif (pte_none(pte))\n\t\t\tgoto no_page;\n\t\tentry = pte_to_swp_entry(pte);\n\t\tif (!is_migration_entry(entry))\n\t\t\tgoto no_page;\n\t\tpte_unmap_unlock(ptep, ptl);\n\t\tmigration_entry_wait(mm, pmd, address);\n\t\tgoto retry;\n\t}\n\tif ((flags & FOLL_NUMA) && pte_protnone(pte))\n\t\tgoto no_page;\n\tif ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) {\n\t\tpte_unmap_unlock(ptep, ptl);\n\t\treturn NULL;\n\t}\n\n\tpage = vm_normal_page(vma, address, pte);\n\tif (!page && pte_devmap(pte) && (flags & FOLL_GET)) {\n\t\t/*\n\t\t * Only return device mapping pages in the FOLL_GET case since\n\t\t * they are only valid while holding the pgmap reference.\n\t\t */\n\t\tpgmap = get_dev_pagemap(pte_pfn(pte), NULL);\n\t\tif (pgmap)\n\t\t\tpage = pte_page(pte);\n\t\telse\n\t\t\tgoto no_page;\n\t} else if (unlikely(!page)) {\n\t\tif (flags & FOLL_DUMP) {\n\t\t\t/* Avoid special (like zero) pages in core dumps */\n\t\t\tpage = ERR_PTR(-EFAULT);\n\t\t\tgoto out;\n\t\t}\n\n\t\tif (is_zero_pfn(pte_pfn(pte))) {\n\t\t\tpage = pte_page(pte);\n\t\t} else {\n\t\t\tint ret;\n\n\t\t\tret = follow_pfn_pte(vma, address, ptep, flags);\n\t\t\tpage = ERR_PTR(ret);\n\t\t\tgoto out;\n\t\t}\n\t}\n\n\tif (flags & FOLL_SPLIT && PageTransCompound(page)) {\n\t\tint ret;\n\t\tget_page(page);\n\t\tpte_unmap_unlock(ptep, ptl);\n\t\tlock_page(page);\n\t\tret = split_huge_page(page);\n\t\tunlock_page(page);\n\t\tput_page(page);\n\t\tif (ret)\n\t\t\treturn ERR_PTR(ret);\n\t\tgoto retry;\n\t}\n\n\tif (flags & FOLL_GET) {\n\t\tget_page(page);\n\n\t\t/* drop the pgmap reference now that we hold the page */\n\t\tif (pgmap) {\n\t\t\tput_dev_pagemap(pgmap);\n\t\t\tpgmap = NULL;\n\t\t}\n\t}\n\tif (flags & FOLL_TOUCH) {\n\t\tif ((flags & FOLL_WRITE) &&\n\t\t !pte_dirty(pte) && !PageDirty(page))\n\t\t\tset_page_dirty(page);\n\t\t/*\n\t\t * pte_mkyoung() would be more correct here, but atomic care\n\t\t * is needed to avoid losing the dirty bit: it is easier to use\n\t\t * mark_page_accessed().\n\t\t */\n\t\tmark_page_accessed(page);\n\t}\n\tif ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {\n\t\t/* Do not mlock pte-mapped THP */\n\t\tif (PageTransCompound(page))\n\t\t\tgoto out;\n\n\t\t/*\n\t\t * The preliminary mapping check is mainly to avoid the\n\t\t * pointless overhead of lock_page on the ZERO_PAGE\n\t\t * which might bounce very badly if there is contention.\n\t\t *\n\t\t * If the page is already locked, we don't need to\n\t\t * handle it now - vmscan will handle it later if and\n\t\t * when it attempts to reclaim the page.\n\t\t */\n\t\tif (page->mapping && trylock_page(page)) {\n\t\t\tlru_add_drain(); /* push cached pages to LRU */\n\t\t\t/*\n\t\t\t * Because we lock page here, and migration is\n\t\t\t * blocked by the pte's page reference, and we\n\t\t\t * know the page is still mapped, we don't even\n\t\t\t * need to check for file-cache page truncation.\n\t\t\t */\n\t\t\tmlock_vma_page(page);\n\t\t\tunlock_page(page);\n\t\t}\n\t}\nout:\n\tpte_unmap_unlock(ptep, ptl);\n\treturn page;\nno_page:\n\tpte_unmap_unlock(ptep, ptl);\n\tif (!pte_none(pte))\n\t\treturn NULL;\n\treturn no_page_table(vma, flags);\n}", "label": 1, "label_name": "safe"} +{"code": " public function test_toString_path()\n {\n $this->assertToString(\n '/path/to',\n null, null, null, null, '/path/to', null, null\n );\n }", "label": 1, "label_name": "safe"} +{"code": "static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv)\n{\n\tstruct kvaser_cmd *cmd;\n\tint rc;\n\n\tcmd = kzalloc(sizeof(*cmd), GFP_KERNEL);\n\tif (!cmd)\n\t\treturn -ENOMEM;\n\n\tcmd->id = CMD_FLUSH_QUEUE;\n\tcmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_flush_queue);\n\tcmd->u.flush_queue.channel = priv->channel;\n\tcmd->u.flush_queue.flags = 0x00;\n\n\trc = kvaser_usb_send_cmd(priv->dev, cmd, cmd->len);\n\n\tkfree(cmd);\n\treturn rc;\n}", "label": 1, "label_name": "safe"} +{"code": "CURLcode Curl_urldecode(struct SessionHandle *data,\n const char *string, size_t length,\n char **ostring, size_t *olen,\n bool reject_ctrl)\n{\n size_t alloc = (length?length:strlen(string))+1;\n char *ns = malloc(alloc);\n unsigned char in;\n size_t strindex=0;\n unsigned long hex;\n CURLcode res;\n\n if(!ns)\n return CURLE_OUT_OF_MEMORY;\n\n while(--alloc > 0) {\n in = *string;\n if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) {\n /* this is two hexadecimal digits following a '%' */\n char hexstr[3];\n char *ptr;\n hexstr[0] = string[1];\n hexstr[1] = string[2];\n hexstr[2] = 0;\n\n hex = strtoul(hexstr, &ptr, 16);\n\n in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */\n\n res = Curl_convert_from_network(data, &in, 1);\n if(res) {\n /* Curl_convert_from_network calls failf if unsuccessful */\n free(ns);\n return res;\n }\n\n string+=2;\n alloc-=2;\n }\n if(reject_ctrl && (in < 0x20)) {\n free(ns);\n return CURLE_URL_MALFORMAT;\n }\n\n ns[strindex++] = in;\n string++;\n }\n ns[strindex]=0; /* terminate it */\n\n if(olen)\n /* store output size */\n *olen = strindex;\n\n if(ostring)\n /* store output string */\n *ostring = ns;\n\n return CURLE_OK;\n}", "label": 1, "label_name": "safe"} +{"code": "svcauth_gss_accept_sec_context(struct svc_req *rqst,\n\t\t\t struct rpc_gss_init_res *gr)\n{\n\tstruct svc_rpc_gss_data\t*gd;\n\tstruct rpc_gss_cred\t*gc;\n\tgss_buffer_desc\t\t recv_tok, seqbuf;\n\tgss_OID\t\t\t mech;\n\tOM_uint32\t\t maj_stat = 0, min_stat = 0, ret_flags, seq;\n\n\tlog_debug(\"in svcauth_gss_accept_context()\");\n\n\tgd = SVCAUTH_PRIVATE(rqst->rq_xprt->xp_auth);\n\tgc = (struct rpc_gss_cred *)rqst->rq_clntcred;\n\tmemset(gr, 0, sizeof(*gr));\n\n\t/* Deserialize arguments. */\n\tmemset(&recv_tok, 0, sizeof(recv_tok));\n\n\tif (!svc_getargs(rqst->rq_xprt, xdr_rpc_gss_init_args,\n\t\t\t (caddr_t)&recv_tok))\n\t\treturn (FALSE);\n\n\tgr->gr_major = gss_accept_sec_context(&gr->gr_minor,\n\t\t\t\t\t &gd->ctx,\n\t\t\t\t\t svcauth_gss_creds,\n\t\t\t\t\t &recv_tok,\n\t\t\t\t\t GSS_C_NO_CHANNEL_BINDINGS,\n\t\t\t\t\t &gd->client_name,\n\t\t\t\t\t &mech,\n\t\t\t\t\t &gr->gr_token,\n\t\t\t\t\t &ret_flags,\n\t\t\t\t\t NULL,\n\t\t\t\t\t NULL);\n\n\tsvc_freeargs(rqst->rq_xprt, xdr_rpc_gss_init_args, (caddr_t)&recv_tok);\n\n\tlog_status(\"accept_sec_context\", gr->gr_major, gr->gr_minor);\n\tif (gr->gr_major != GSS_S_COMPLETE &&\n\t gr->gr_major != GSS_S_CONTINUE_NEEDED) {\n\t\tbadauth(gr->gr_major, gr->gr_minor, rqst->rq_xprt);\n\t\tgd->ctx = GSS_C_NO_CONTEXT;\n\t\tgoto errout;\n\t}\n\tgr->gr_ctx.value = \"xxxx\";\n\tgr->gr_ctx.length = 4;\n\n\t/* gr->gr_win = 0x00000005; ANDROS: for debugging linux kernel version... */\n\tgr->gr_win = sizeof(gd->seqmask) * 8;\n\n\t/* Save client info. */\n\tgd->sec.mech = mech;\n\tgd->sec.qop = GSS_C_QOP_DEFAULT;\n\tgd->sec.svc = gc->gc_svc;\n\tgd->seq = gc->gc_seq;\n\tgd->win = gr->gr_win;\n\n\tif (gr->gr_major == GSS_S_COMPLETE) {\n#ifdef SPKM\n\t\t/* spkm3: no src_name (anonymous) */\n\t\tif(!g_OID_equal(gss_mech_spkm3, mech)) {\n#endif\n\t\t maj_stat = gss_display_name(&min_stat, gd->client_name,\n\t\t\t\t\t &gd->cname, &gd->sec.mech);\n#ifdef SPKM\n\t\t}\n#endif\n\t\tif (maj_stat != GSS_S_COMPLETE) {\n\t\t\tlog_status(\"display_name\", maj_stat, min_stat);\n\t\t\tgoto errout;\n\t\t}\n#ifdef DEBUG\n#ifdef HAVE_HEIMDAL\n\t\tlog_debug(\"accepted context for %.*s with \"\n\t\t\t \"\",\n\t\t\t gd->cname.length, (char *)gd->cname.value,\n\t\t\t gd->sec.qop, gd->sec.svc);\n#else\n\t\t{\n\t\t\tgss_buffer_desc mechname;\n\n\t\t\tgss_oid_to_str(&min_stat, mech, &mechname);\n\n\t\t\tlog_debug(\"accepted context for %.*s with \"\n\t\t\t\t \"\",\n\t\t\t\t gd->cname.length, (char *)gd->cname.value,\n\t\t\t\t mechname.length, (char *)mechname.value,\n\t\t\t\t gd->sec.qop, gd->sec.svc);\n\n\t\t\tgss_release_buffer(&min_stat, &mechname);\n\t\t}\n#endif\n#endif /* DEBUG */\n\t\tseq = htonl(gr->gr_win);\n\t\tseqbuf.value = &seq;\n\t\tseqbuf.length = sizeof(seq);\n\n\t\tgss_release_buffer(&min_stat, &gd->checksum);\n\t\tmaj_stat = gss_sign(&min_stat, gd->ctx, GSS_C_QOP_DEFAULT,\n\t\t\t\t &seqbuf, &gd->checksum);\n\n\t\tif (maj_stat != GSS_S_COMPLETE) {\n\t\t\tgoto errout;\n\t\t}\n\n\n\t\trqst->rq_xprt->xp_verf.oa_flavor = RPCSEC_GSS;\n\t\trqst->rq_xprt->xp_verf.oa_base = gd->checksum.value;\n\t\trqst->rq_xprt->xp_verf.oa_length = gd->checksum.length;\n\t}\n\treturn (TRUE);\nerrout:\n\tgss_release_buffer(&min_stat, &gr->gr_token);\n\treturn (FALSE);\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic function initializeObject() {\n\t\t$this->initializeFormStateFromRequest();\n\t\t$this->initializeCurrentPageFromRequest();\n\n\t\tif (!$this->isFirstRequest() && $this->getRequest()->getHttpRequest()->getMethod() === 'POST') {\n\t\t\t$this->processSubmittedFormValues();\n\t\t}\n\t}", "label": 1, "label_name": "safe"} +{"code": " function update() {\n global $user;\n \n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];\n\n if (COMMENTS_REQUIRE_LOGIN && !$user->isLoggedIn()) {\n expValidator::failAndReturnToForm('You must be logged on to post a comment!', $this->params);\n }\n // check the anti-spam control\n if (!(ANTI_SPAM_USERS_SKIP && $user->isLoggedIn())) {\n expValidator::check_antispam($this->params, gt('Your comment was not posted.') . ' ' . gt(\"Anti-spam verification failed. Please try again. Please try again.\"));\n }\n \n // figure out the name and email address\n if (!empty($user->id) && empty($this->params['id'])) {\n $this->params['name'] = $user->firstname.\" \".$user->lastname;\n $this->params['email'] = $user->email;\n }\n \n // save the comment\n if (empty($require_approval)) {\n $this->expComment->approved=1;\n }\n $this->expComment->update($this->params);\n \n // attach the comment to the datatype it belongs to (blog, news, etc..);\n// $obj = new stdClass();\n//\t\t$obj->content_type = $this->params['content_type'];\n//\t\t$obj->content_id = $this->params['content_id'];\n//\t\t$obj->expcomments_id = $this->expComment->id;\n//\t\tif(isset($this->params['subtype'])) $obj->subtype = $this->params['subtype'];\n//\t\t$db->insertObject($obj, $this->expComment->attachable_table);\n $this->expComment->attachComment($this->params['content_type'], $this->params['content_id'], $this->params['subtype']);\n\n\t\t$msg = 'Thank you for posting a comment.';\n\t\tif ($require_approval == 1 && !$user->isAdmin()) {\n\t\t $msg .= ' '.gt('Your comment is now pending approval. You will receive an email to').' ';\n\t\t $msg .= $this->expComment->email.' '.gt('letting you know when it has been approved.');\n\t\t}\n\t\t\n\t\tif ($require_notification && !$user->isAdmin()) {\n\t\t $this->sendNotification($this->expComment,$this->params);\n\t\t}\n if ($require_approval==1 && $this->params['approved']==1 && $this->expComment->poster != $user->id) {\n\t\t $this->sendApprovalNotification($this->expComment,$this->params);\n }\n\n\t\tflash('message', $msg);\n\t\t\n\t\texpHistory::back();\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " def ensure_primary\n Threaded.begin :ensure_primary\n yield\n ensure\n Threaded.end :ensure_primary", "label": 1, "label_name": "safe"} +{"code": "j=a.oInstance,i=function(b) {v(a,null,\"xhr\",[a,b,a.jqXHR]);c(b)};if (h.isPlainObject(g)&&g.data) {f=g.data;var o=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&o?o:h.extend(!0,b,o);delete g.data}o={data:b,success:function(b) {var c=b.error||b.sError;c&&K(a,0,c);a.json=b;i(b)},dataType:\"json\",cache:!1,type:a.sServerMethod,error:function(b,c) {var d=v(a,null,\"xhr\",[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&(\"parsererror\"==c?K(a,0,\"Invalid JSON response\",1):4===b.readyState&&K(a,0,\"Ajax error\",7));C(a,!1)}};a.oAjaxData=", "label": 1, "label_name": "safe"} +{"code": "ast_for_arg(struct compiling *c, const node *n)\n{\n identifier name;\n expr_ty annotation = NULL;\n node *ch;\n arg_ty ret;\n\n assert(TYPE(n) == tfpdef || TYPE(n) == vfpdef);\n ch = CHILD(n, 0);\n name = NEW_IDENTIFIER(ch);\n if (!name)\n return NULL;\n if (forbidden_name(c, name, ch, 0))\n return NULL;\n\n if (NCH(n) == 3 && TYPE(CHILD(n, 1)) == COLON) {\n annotation = ast_for_expr(c, CHILD(n, 2));\n if (!annotation)\n return NULL;\n }\n\n ret = arg(name, annotation, LINENO(n), n->n_col_offset,\n n->n_end_lineno, n->n_end_col_offset, c->c_arena);\n if (!ret)\n return NULL;\n return ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "mark_context_stack(mrb_state *mrb, struct mrb_context *c)\n{\n size_t i;\n size_t e;\n\n if (c->stack == NULL) return;\n e = c->stack - c->stbase;\n if (c->ci) e += c->ci->nregs;\n if (c->stbase + e > c->stend) e = c->stend - c->stbase;\n for (i=0; istbase[i];\n\n if (!mrb_immediate_p(v)) {\n if (mrb_basic_ptr(v)->tt == MRB_TT_FREE) {\n c->stbase[i] = mrb_nil_value();\n }\n else {\n mrb_gc_mark(mrb, mrb_basic_ptr(v));\n }\n }\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static void mark_object(struct object *obj, struct strbuf *path,\n\t\t\tconst char *name, void *data)\n{\n\tupdate_progress(data);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should set suphp_UserGroup' do\n is_expected.to contain_file(\"25-#{title}.conf\").with_content(\n /^ suPHP_UserGroup myappuser myappgroup/\n )\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct()\n {\n }", "label": 1, "label_name": "safe"} +{"code": "function testImage() {\n return testContainer.firstChild;\n}", "label": 1, "label_name": "safe"} +{"code": "null,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(C,E,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(C,[\"copyAsImage\"],null,G)};EditorUi.prototype.toggleFormatPanel=function(C){null!=this.formatWindow?this.formatWindow.window.setVisible(null!=C?C:!this.formatWindow.window.isVisible()):b(this)};DiagramFormatPanel.prototype.isMathOptionVisible=function(){return!0};var B=EditorUi.prototype.destroy;EditorUi.prototype.destroy=", "label": 1, "label_name": "safe"} +{"code": "unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name)\n{\n int\t\ti;\n u_entry_T\t*uep;\n char_u\t**array = NULL;\n char_u\t*line;\n int\t\tline_len;\n\n uep = (u_entry_T *)U_ALLOC_LINE(sizeof(u_entry_T));\n if (uep == NULL)\n\treturn NULL;\n vim_memset(uep, 0, sizeof(u_entry_T));\n#ifdef U_DEBUG\n uep->ue_magic = UE_MAGIC;\n#endif\n uep->ue_top = undo_read_4c(bi);\n uep->ue_bot = undo_read_4c(bi);\n uep->ue_lcount = undo_read_4c(bi);\n uep->ue_size = undo_read_4c(bi);\n if (uep->ue_size > 0)\n {\n\tif (uep->ue_size < LONG_MAX / (int)sizeof(char_u *))\n\t array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue_size);\n\tif (array == NULL)\n\t{\n\t *error = TRUE;\n\t return uep;\n\t}\n\tvim_memset(array, 0, sizeof(char_u *) * uep->ue_size);\n }\n uep->ue_array = array;\n\n for (i = 0; i < uep->ue_size; ++i)\n {\n\tline_len = undo_read_4c(bi);\n\tif (line_len >= 0)\n\t line = read_string_decrypt(bi, line_len);\n\telse\n\t{\n\t line = NULL;\n\t corruption_error(\"line length\", file_name);\n\t}\n\tif (line == NULL)\n\t{\n\t *error = TRUE;\n\t return uep;\n\t}\n\tarray[i] = line;\n }\n return uep;\n}", "label": 1, "label_name": "safe"} +{"code": " public function testUlConvertTypeSquare()\n {\n $this->assertResult(\n '
      ',\n '
        '\n );\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n OpData* data = reinterpret_cast(node->user_data);\n\n const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);\n const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);\n TfLiteTensor* output = GetOutput(context, node, kOutputTensor);\n\n switch (input1->type) {\n case kTfLiteInt32: {\n return EvalImpl(context, data->requires_broadcast, input1,\n input2, output);\n }\n case kTfLiteInt64: {\n return EvalImpl(context, data->requires_broadcast, input1,\n input2, output);\n }\n case kTfLiteFloat32: {\n return EvalImpl(context, data->requires_broadcast, input1, input2,\n output);\n }\n default: {\n context->ReportError(context, \"Type '%s' is not supported by floor_mod.\",\n TfLiteTypeGetName(input1->type));\n return kTfLiteError;\n }\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "hb_set_union (hb_set_t *set,\n\t const hb_set_t *other)\n{\n if (unlikely (hb_object_is_immutable (set)))\n return;\n\n set->union_ (*other);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " channelEOF(chan) {\n // Does not consume window space\n\n let p = this._packetRW.write.allocStart;\n const packet = this._packetRW.write.alloc(1 + 4);\n\n packet[p] = MESSAGE.CHANNEL_EOF;\n\n writeUInt32BE(packet, chan, ++p);\n\n this._debug && this._debug(`Outbound: Sending CHANNEL_EOF (r:${chan})`);\n sendPacket(this, this._packetRW.write.finalize(packet));\n }", "label": 1, "label_name": "safe"} +{"code": " fwrite(STDERR, sprintf(\"%2d %s ==> %s\\n\", $i + 1, $test, var_export($result, true)));", "label": 0, "label_name": "vulnerable"} +{"code": "\tprivate function getTempDir($volumeTempPath = null) {\n\t\t$testDirs = array();\n\t\tif ($this->uploadTempPath) {\n\t\t\t$testDirs[] = rtrim(realpath($this->uploadTempPath), DIRECTORY_SEPARATOR);\n\t\t}\n\t\tif ($volumeTempPath) {\n\t\t\t$testDirs[] = rtrim(realpath($volumeTempPath), DIRECTORY_SEPARATOR);\n\t\t}\n\t\tif (function_exists('sys_get_temp_dir')) {\n\t\t\t$testDirs[] = sys_get_temp_dir();\n\t\t}\n\t\t$tempDir = '';\n\t\tforeach($testDirs as $testDir) {\n\t\t\tif (!$testDir || !is_dir($testDir)) continue;\n\t\t\tif (is_writable($testDir)) {\n\t\t\t\t$tempDir = $testDir;\n\t\t\t\t$gc = time() - 3600;\n\t\t\t\tforeach(glob($tempDir . DIRECTORY_SEPARATOR .'ELF*') as $cf) {\n\t\t\t\t\tif (filemtime($cf) < $gc) {\n\t\t\t\t\t\tunlink($cf);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $tempDir;\n\t}", "label": 1, "label_name": "safe"} +{"code": " def __init__(self):\n super().__init__(entity_substitution=EntitySubstitution.substitute_html)", "label": 1, "label_name": "safe"} +{"code": " this.getAdaptersInfo = function (host, update, updateRepo, callback) {\n if (!host) return;\n\n if (!callback) throw 'Callback cannot be null or undefined';\n if (update) {\n // Do not update too often\n if (!this.curRepoLastUpdate || ((new Date()).getTime() - this.curRepoLastUpdate > 1000)) {\n this.curRepository = null;\n this.curInstalled = null;\n }\n }\n\n if (this.curRunning) {\n this.curRunning.push(callback);\n return;\n }\n\n if (!this.curRepository || this.curRepoLastHost !== host) {\n this.curRepository = null;\n this.main.socket.emit('sendToHost', host, 'getRepository', {repo: this.main.systemConfig.common.activeRepo, update: updateRepo}, function (_repository) {\n if (_repository === 'permissionError') {\n console.error('May not read \"getRepository\"');\n _repository = {};\n }\n\n that.curRepository = _repository || {};\n if (that.curRepository && that.curInstalled && that.curRunning) {\n that.curRepoLastUpdate = (new Date()).getTime();\n setTimeout(function () {\n for (var c = 0; c < that.curRunning.length; c++) {\n that.curRunning[c](that.curRepository, that.curInstalled);\n }\n that.curRunning = null;\n }, 0);\n }\n });\n }\n if (!this.curInstalled || this.curRepoLastHost !== host) {\n this.curInstalled = null;\n this.main.socket.emit('sendToHost', host, 'getInstalled', null, function (_installed) {\n if (_installed === 'permissionError') {\n console.error('May not read \"getInstalled\"');\n _installed = {};\n }\n\n that.curInstalled = _installed || {};\n if (that.curRepository && that.curInstalled) {\n that.curRepoLastUpdate = (new Date()).getTime();\n setTimeout(function () {\n for (var c = 0; c < that.curRunning.length; c++) {\n that.curRunning[c](that.curRepository, that.curInstalled);\n }\n that.curRunning = null;\n }, 0);\n }\n });\n }\n\n this.curRepoLastHost = host;\n\n if (this.curInstalled && this.curRepository) {\n setTimeout(function () {\n if (that.curRunning) {\n for (var c = 0; c < that.curRunning.length; c++) {\n that.curRunning[c](that.curRepository, that.curInstalled);\n }\n that.curRunning = null;\n }\n if (callback) callback(that.curRepository, that.curInstalled);\n }, 0);\n } else {\n this.curRunning = [callback];\n }\n };", "label": 0, "label_name": "vulnerable"} +{"code": "func (a *Actions) UpdateProject(updater func(project *v1alpha1.AppProject)) *Actions {\n\tproj, err := fixture.AppClientset.ArgoprojV1alpha1().AppProjects(fixture.ArgoCDNamespace).Get(context.TODO(), a.context.name, v1.GetOptions{})\n\trequire.NoError(a.context.t, err)\n\tupdater(proj)\n\t_, err = fixture.AppClientset.ArgoprojV1alpha1().AppProjects(fixture.ArgoCDNamespace).Update(context.TODO(), proj, v1.UpdateOptions{})\n\trequire.NoError(a.context.t, err)\n\treturn a\n}", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t\t\t\t\tend: function end() {\n\t\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": " public function setClass($class)\n {\n $this->class = $class;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"does not create a new Resource\" do\n expect { post :upload, params: { upload: upload } }.\n not_to change(Resource, :count)\n end", "label": 1, "label_name": "safe"} +{"code": "\tpublic static function onParserFirstCallInit( Parser $parser ) {\n\t\tself::init();\n\n\t\t// DPL offers the same functionality as Intersection. So we register the tag in case LabeledSection Extension is not installed so that the section markers are removed.\n\t\tif ( Config::getSetting( 'handleSectionTag' ) ) {\n\t\t\t$parser->setHook( 'section', [ __CLASS__, 'dplTag' ] );\n\t\t}\n\n\t\t$parser->setHook( 'DPL', [ __CLASS__, 'dplTag' ] );\n\t\t$parser->setHook( 'DynamicPageList', [ __CLASS__, 'intersectionTag' ] );\n\n\t\t$parser->setFunctionHook( 'dpl', [ __CLASS__, 'dplParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplnum', [ __CLASS__, 'dplNumParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplvar', [ __CLASS__, 'dplVarParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplreplace', [ __CLASS__, 'dplReplaceParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplchapter', [ __CLASS__, 'dplChapterParserFunction' ] );\n\t\t$parser->setFunctionHook( 'dplmatrix', [ __CLASS__, 'dplMatrixParserFunction' ] );\n\t}", "label": 1, "label_name": "safe"} +{"code": "setTimeout(function(){Fa.style.display=\"none\"},4E3)}function B(){null!=X&&(X.style.fontWeight=\"normal\",X.style.textDecoration=\"none\",u=X,X=null)}function I(ha,da,ca,la,ia,ma,qa){if(-1assertValidation('http://google.com');\n }", "label": 1, "label_name": "safe"} +{"code": " def test_modify_access_revoke_self(self):\n \"\"\"\n Test that an instructor cannot remove instructor privelages from themself.\n \"\"\"\n url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})\n response = self.client.get(url, {\n 'unique_student_identifier': self.instructor.email,\n 'rolename': 'instructor',\n 'action': 'revoke',\n })\n self.assertEqual(response.status_code, 200)\n # check response content\n expected = {\n 'unique_student_identifier': self.instructor.username,\n 'rolename': 'instructor',\n 'action': 'revoke',\n 'removingSelfAsInstructor': True,\n }\n res_json = json.loads(response.content)\n self.assertEqual(res_json, expected)", "label": 0, "label_name": "vulnerable"} +{"code": " foreach ($col_array as $col => $struct) {\n $this->_renderStruct($ret, $struct, $line, $col);\n }", "label": 1, "label_name": "safe"} +{"code": "static void _perf_event_reset(struct perf_event *event)\n{\n\t(void)perf_event_read(event);\n\tlocal64_set(&event->count, 0);\n\tperf_event_update_userpage(event);\n}", "label": 1, "label_name": "safe"} +{"code": " from: globalDb.getServerTitle() + \" <\" + returnAddress + \">\",\n subject: \"Testing your Sandstorm's SMTP setting\",\n text: \"Success! Your outgoing SMTP is working.\",\n smtpConfig: restConfig,\n });\n } catch (e) {\n // Attempt to give more accurate error messages for a variety of known failure modes,\n // and the actual exception data in the event a user hits a new failure mode.\n if (e.syscall === \"getaddrinfo\") {\n if (e.code === \"EIO\" || e.code === \"ENOTFOUND\") {\n throw new Meteor.Error(\"getaddrinfo \" + e.code, \"Couldn't resolve \\\"\" + smtpConfig.hostname + \"\\\" - check for typos or broken DNS.\");\n }\n } else if (e.syscall === \"connect\") {\n if (e.code === \"ECONNREFUSED\") {\n throw new Meteor.Error(\"connect ECONNREFUSED\", \"Server at \" + smtpConfig.hostname + \":\" + smtpConfig.port + \" refused connection. Check your settings, firewall rules, and that your mail server is up.\");\n }\n } else if (e.name === \"AuthError\") {\n throw new Meteor.Error(\"auth error\", \"Authentication failed. Check your credentials. Message from \" +\n smtpConfig.hostname + \": \" + e.data);\n }\n\n throw new Meteor.Error(\"other-email-sending-error\", \"Error while trying to send test email: \" + JSON.stringify(e));\n }\n },", "label": 0, "label_name": "vulnerable"} +{"code": "D=K}return D};Graph.prototype.getCellsById=function(u){var D=[];if(null!=u)for(var K=0;K escaped_size) {\n\t\t\tchar *bigger_escaped;\n\t\t\tescaped_size += 128;\n\t\t\tbigger_escaped = realloc(escaped, escaped_size);\n\t\t\tif (!bigger_escaped) {\n\t\t\t\tfree(escaped);\t/* avoid leaking memory */\n\t\t\t\tescaped = NULL;\n\t\t\t\tescaped_size = 0;\n\t\t\t\t/* Error string is cleverly chosen to fail XML validation */\n\t\t\t\treturn \">>> out of memory <<<\";\n\t\t\t}\n\t\t\tout = bigger_escaped + len;\n\t\t\tescaped = bigger_escaped;\n\t\t}\n\t\tswitch (*text) {\n\t\t\tcase '&':\n\t\t\t\tstrcpy(out, \"&\");\n\t\t\t\tlen += strlen(out) - 1;\n\t\t\t\tout = escaped + len;\n\t\t\t\tbreak;\n\t\t\tcase '<':\n\t\t\t\tstrcpy(out, \"<\");\n\t\t\t\tlen += strlen(out) - 1;\n\t\t\t\tout = escaped + len;\n\t\t\t\tbreak;\n\t\t\tcase '>':\n\t\t\t\tstrcpy(out, \">\");\n\t\t\t\tlen += strlen(out) - 1;\n\t\t\t\tout = escaped + len;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t*out = *text;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t*out = '\\x0'; /* NUL terminate the string */\n\treturn escaped;\n}", "label": 1, "label_name": "safe"} +{"code": "\"function\"==typeof b)this._.dialogDefinitions[a]=b},exists:function(a){return!!this._.dialogDefinitions[a]},getCurrent:function(){return CKEDITOR.dialog._.currentTop},isTabEnabled:function(a,b,c){a=a.config.removeDialogTabs;return!(a&&a.match(RegExp(\"(?:^|;)\"+b+\":\"+c+\"(?:$|;)\",\"i\")))},okButton:function(){var a=function(a,c){c=c||{};return CKEDITOR.tools.extend({id:\"ok\",type:\"button\",label:a.lang.common.ok,\"class\":\"cke_dialog_ui_button_ok\",onClick:function(a){a=a.data.dialog;!1!==a.fire(\"ok\",{hide:!0}).hide&&", "label": 1, "label_name": "safe"} +{"code": " public function paramRules(){\n // $eventTypes = array('auto'=>Yii::t('app','Auto')) + Dropdowns::getItems(113,'app');\n $eventTypes = Dropdowns::getItems(113, 'studio');\n\n return array(\n 'title' => Yii::t('studio', $this->title),\n 'info' => Yii::t('studio', $this->info),\n 'options' => array(\n array(\n 'name' => 'type', \n 'label' => Yii::t('studio', 'Post Type'), \n 'type' => 'dropdown', \n 'options' => $eventTypes\n ),\n array(\n 'name' => 'text',\n 'label' => Yii::t('studio', 'Text'),\n 'type' => 'text'\n ),\n array(\n 'name' => 'visibility',\n 'label' => Yii::t('studio', 'Visibility'),\n 'type' => 'dropdown',\n 'options' => array (\n 1 => Yii::t('events','Public'),\n 0 => Yii::t('events','Private'),\n ),\n 'defaultVal' => 1\n ),\n array(\n 'name' => 'feed',\n 'optional' => 1,\n 'label' => 'User (optional)',\n 'type' => 'dropdown', \n 'options' => array(\n '' => '----------',\n 'auto' => 'Auto'\n ) + X2Model::getAssignmentOptions(false, false)),\n array(\n 'name' => 'user',\n 'optional' => 1,\n 'label' => 'Author',\n 'type' => 'dropdown', \n 'options' => array(\n 'admin' => 'admin',\n 'auto' => Yii::t('studio', 'Auto'),\n ) + array_diff_key (\n X2Model::getAssignmentOptions(false, false),\n array ('admin' => '')\n ),\n 'defaultVal' => 'admin',\n ),\n array(\n 'name' => 'createNotif', \n 'label' => Yii::t('studio', 'Create Notification?'),\n 'type' => 'boolean',\n 'defaultVal' => true\n ),\n )\n );\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus EqualEval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor1, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor2, &input2));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n bool requires_broadcast = !HaveSameShapes(input1, input2);\n switch (input1->type) {\n case kTfLiteBool:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteFloat32:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteInt32:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteInt64:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteUInt8:\n ComparisonQuantized(\n input1, input2, output, requires_broadcast);\n break;\n case kTfLiteInt8:\n ComparisonQuantized(\n input1, input2, output, requires_broadcast);\n break;\n case kTfLiteString:\n ComparisonString(reference_ops::StringRefEqualFn, input1, input2, output,\n requires_broadcast);\n break;\n default:\n context->ReportError(\n context,\n \"Does not support type %d, requires bool|float|int|uint8|string\",\n input1->type);\n return kTfLiteError;\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " def createXsrfToken(): XsrfOk = {\n COULD_OPTIMIZE // skip the secure hash, when using the Double Submit Cookie pattern [4AW2J7].\n XsrfOk(timeDotRandomDotHash()) // [2AB85F2]\n }\n\n\n\n def createSessionIdAndXsrfToken(req: AuthnReqHeader, userId: PatId)", "label": 1, "label_name": "safe"} +{"code": "\tpublic void onTurnEnded(TurnEndedEvent event) {\n\t\tsuper.onTurnEnded(event);\n\n\t\tfinal String out = event.getTurnSnapshot().getRobots()[0].getOutputStreamSnapshot();\n\n\t\tif (out.contains(\"SYSTEM: Using socket is not allowed\")) {\n\t\t\tsecurityExceptionOccurred = true;\t\n\t\t}\t\n\t}", "label": 1, "label_name": "safe"} +{"code": "cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\n\n\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}\n\n#if defined(__CYGWIN__)\n\tcleanup_pathname_win(a);\n#endif\n\t/* Skip leading '/'. */\n\tif (*src == '/') {\n\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Path is absolute\");\n\t\t\treturn (ARCHIVE_FAILED);\n\t\t}\n\n\t\tseparator = *src++;\n\t}\n\n\t/* Scan the pathname one element at a time. */\n\tfor (;;) {\n\t\t/* src points to first char after '/' */\n\t\tif (src[0] == '\\0') {\n\t\t\tbreak;\n\t\t} else if (src[0] == '/') {\n\t\t\t/* Found '//', ignore second one. */\n\t\t\tsrc++;\n\t\t\tcontinue;\n\t\t} else if (src[0] == '.') {\n\t\t\tif (src[1] == '\\0') {\n\t\t\t\t/* Ignore trailing '.' */\n\t\t\t\tbreak;\n\t\t\t} else if (src[1] == '/') {\n\t\t\t\t/* Skip './'. */\n\t\t\t\tsrc += 2;\n\t\t\t\tcontinue;\n\t\t\t} else if (src[1] == '.') {\n\t\t\t\tif (src[2] == '/' || src[2] == '\\0') {\n\t\t\t\t\t/* Conditionally warn about '..' */\n\t\t\t\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {\n\t\t\t\t\t\tarchive_set_error(&a->archive,\n\t\t\t\t\t\t ARCHIVE_ERRNO_MISC,\n\t\t\t\t\t\t \"Path contains '..'\");\n\t\t\t\t\t\treturn (ARCHIVE_FAILED);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Note: Under no circumstances do we\n\t\t\t\t * remove '..' elements. In\n\t\t\t\t * particular, restoring\n\t\t\t\t * '/foo/../bar/' should create the\n\t\t\t\t * 'foo' dir as a side-effect.\n\t\t\t\t */\n\t\t\t}\n\t\t}\n\n\t\t/* Copy current element, including leading '/'. */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\twhile (*src != '\\0' && *src != '/') {\n\t\t\t*dest++ = *src++;\n\t\t}\n\n\t\tif (*src == '\\0')\n\t\t\tbreak;\n\n\t\t/* Skip '/' separator. */\n\t\tseparator = *src++;\n\t}\n\t/*\n\t * We've just copied zero or more path elements, not including the\n\t * final '/'.\n\t */\n\tif (dest == a->name) {\n\t\t/*\n\t\t * Nothing got copied. The path must have been something\n\t\t * like '.' or '/' or './' or '/././././/./'.\n\t\t */\n\t\tif (separator)\n\t\t\t*dest++ = '/';\n\t\telse\n\t\t\t*dest++ = '.';\n\t}\n\t/* Terminate the result. */\n\t*dest = '\\0';\n\treturn (ARCHIVE_OK);\n}", "label": 1, "label_name": "safe"} +{"code": " def set_admin\n User.current = users(:admin)\n end", "label": 1, "label_name": "safe"} +{"code": "c,!c&&r[a]&&(d.extend(r[a]),q&&!q.date&&console.warn(\"This method of applying plugins is deprecated. See documentation for details.\")))};d.locale(m,{});\"object\"===typeof module&&\"object\"===typeof module.exports?module.exports=d:\"function\"===typeof define&&define.amd?define([],function(){return d}):q.date=d})(this);", "label": 0, "label_name": "vulnerable"} +{"code": "function(n){g.editorUiRefresh.apply(b,arguments);u()};u();var q=document.createElement(\"canvas\");q.width=m.offsetWidth;q.height=m.offsetHeight;m.style.overflow=\"hidden\";q.style.position=\"relative\";m.appendChild(q);var v=q.getContext(\"2d\");this.ui=b;var y=b.editor.graph;this.graph=y;this.container=m;this.canvas=q;var A=function(n,x,K,B,F){n=Math.round(n);x=Math.round(x);K=Math.round(K);B=Math.round(B);v.beginPath();v.moveTo(n+.5,x+.5);v.lineTo(K+.5,B+.5);v.stroke();F&&(l?(v.save(),v.translate(n,x),", "label": 1, "label_name": "safe"} +{"code": "$.fn.elfUiWidgetInstance = function(name) {\n\ttry {\n\t\treturn this[name]('instance');\n\t} catch(e) {\n\t\t// fallback for jQuery UI < 1.11\n\t\tvar data = this.data('ui-' + name);\n\t\tif (data && typeof data === 'object' && data.widgetFullName === 'ui-' + name) {\n\t\t\treturn data;\n\t\t}\n\t\treturn null;\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " [_sanitize](svg) {\n return svg.removeAttr('onload');\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testDeprecatedSuperInSameNamespace()\n {\n set_error_handler(function () { return false; });\n $e = error_reporting(0);\n trigger_error('', E_USER_NOTICE);\n\n class_exists('Symfony\\Bridge\\Debug\\Tests\\Fixtures\\ExtendsDeprecatedParent', true);\n\n error_reporting($e);\n restore_error_handler();\n\n $lastError = error_get_last();\n unset($lastError['file'], $lastError['line']);\n\n $xError = array(\n 'type' => E_USER_NOTICE,\n 'message' => '',\n );\n\n $this->assertSame($xError, $lastError);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function(){function O(za,wa,Ea){var Da=U.menus.get(za),La=R.addMenu(mxResources.get(za),mxUtils.bind(this,function(){Da.funct.apply(this,arguments)}),Q);La.className=\"1\"==urlParams.sketch?\"geToolbarButton\":\"geMenuItem\";La.style.display=\"inline-block\";La.style.boxSizing=\"border-box\";La.style.top=\"6px\";La.style.marginRight=\"6px\";La.style.height=\"30px\";La.style.paddingTop=\"6px\";La.style.paddingBottom=\"6px\";La.style.cursor=\"pointer\";La.setAttribute(\"title\",mxResources.get(za));U.menus.menuCreated(Da,\nLa,\"geMenuItem\");null!=Ea?(La.style.backgroundImage=\"url(\"+Ea+\")\",La.style.backgroundPosition=\"center center\",La.style.backgroundRepeat=\"no-repeat\",La.style.backgroundSize=\"24px 24px\",La.style.width=\"34px\",La.innerHTML=\"\"):wa||(La.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\",La.style.backgroundPosition=\"right 6px center\",La.style.backgroundRepeat=\"no-repeat\",La.style.paddingRight=\"22px\");return La}function X(za,wa,Ea,Da,La,Za){var Va=document.createElement(\"a\");Va.className=", "label": 1, "label_name": "safe"} +{"code": "\tfunction selectBillingOptions() {\n\t\t\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "\"1\":null},ea.getVerticesAndEdges())},{install:function(ja){this.listener=function(){ja(Editor.sketchMode)};X.addListener(\"sketchModeChanged\",this.listener)},destroy:function(){X.removeListener(this.listener)}});O.appendChild(ka)}return O};var ba=Menus.prototype.init;Menus.prototype.init=function(){ba.apply(this,arguments);var O=this.editorUi,X=O.editor.graph;O.actions.get(\"editDiagram\").label=mxResources.get(\"formatXml\")+\"...\";O.actions.get(\"createShape\").label=mxResources.get(\"shape\")+\"...\";O.actions.get(\"outline\").label=", "label": 1, "label_name": "safe"} +{"code": "\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();\n\t\t\n\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len,\n const cdf_header_t *h, cdf_secid_t id)\n{\n\tsize_t ss = CDF_SEC_SIZE(h);\n\tsize_t pos = CDF_SEC_POS(h, id);\n\tassert(ss == len);\n\treturn cdf_read(info, (off_t)pos, ((char *)buf) + offs, len);\n}", "label": 1, "label_name": "safe"} +{"code": "Jsi_RC Jsi_RegExpMatch(Jsi_Interp *interp, Jsi_Value *pattern, const char *v, int *rc, Jsi_DString *dStr)\n{\n Jsi_Regex *re;\n int regexec_flags = 0;\n if (rc)\n *rc = 0;\n if (pattern == NULL || pattern->vt != JSI_VT_OBJECT || pattern->d.obj->ot != JSI_OT_REGEXP) \n return Jsi_LogError(\"expected pattern\");\n re = pattern->d.obj->d.robj;\n regex_t *reg = &re->reg;\n \n regmatch_t pos = {};\n if (dStr)\n Jsi_DSInit(dStr);\n \n int r = regexec(reg, v, 1, &pos, regexec_flags);\n\n if (r >= REG_BADPAT) {\n char buf[100];\n\n regerror(r, reg, buf, sizeof(buf));\n return Jsi_LogError(\"error while matching pattern: %s\", buf);\n }\n if (r != REG_NOMATCH) {\n if (rc) *rc = 1;\n if (dStr && pos.rm_so >= 0 && pos.rm_eo >= 0 && pos.rm_eo >= pos.rm_so)\n Jsi_DSAppendLen(dStr, v + pos.rm_so, pos.rm_eo - pos.rm_so);\n }\n \n return JSI_OK;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function prepareInputForAdd($input) {\n global $DB;\n\n if (isset($input['_stop_import'])) {\n return false;\n }\n\n if (!Auth::isValidLogin($input['name'])) {\n Session::addMessageAfterRedirect(__('The login is not valid. Unable to add the user.'),\n false, ERROR);\n return false;\n }\n\n // avoid xss (picture field is autogenerated)\n if (isset($input['picture'])) {\n $input['picture'] = 'NULL';\n }\n\n if (!isset($input[\"authtype\"])) {\n $input[\"authtype\"] = Auth::DB_GLPI;\n }\n\n if (!isset($input[\"auths_id\"])) {\n $input[\"auths_id\"] = 0;\n }\n\n // Check if user does not exists\n $iterator = $DB->request([\n 'FROM' => $this->getTable(),\n 'WHERE' => [\n 'name' => $input['name'],\n 'authtype' => $input['authtype'],\n 'auths_id' => $input['auths_id']\n ],\n 'LIMIT' => 1\n ]);\n\n if (count($iterator)) {\n Session::addMessageAfterRedirect(__('Unable to add. The user already exists.'),\n false, ERROR);\n return false;\n }\n\n if (isset($input[\"password2\"])) {\n if (empty($input[\"password\"])) {\n unset ($input[\"password\"]);\n\n } else {\n if ($input[\"password\"] == $input[\"password2\"]) {\n if (Config::validatePassword($input[\"password\"])) {\n $input[\"password\"]\n = Auth::getPasswordHash(Toolbox::unclean_cross_side_scripting_deep(stripslashes($input[\"password\"])));\n } else {\n unset($input[\"password\"]);\n }\n unset($input[\"password2\"]);\n } else {\n Session::addMessageAfterRedirect(__('Error: the two passwords do not match'),\n false, ERROR);\n return false;\n }\n }\n }\n\n if (isset($input[\"_extauth\"])) {\n $input[\"password\"] = \"\";\n }\n\n // Force DB default values : not really needed\n if (!isset($input[\"is_active\"])) {\n $input[\"is_active\"] = 1;\n }\n\n if (!isset($input[\"is_deleted\"])) {\n $input[\"is_deleted\"] = 0;\n }\n\n if (!isset($input[\"entities_id\"])) {\n $input[\"entities_id\"] = 0;\n }\n\n if (!isset($input[\"profiles_id\"])) {\n $input[\"profiles_id\"] = 0;\n }\n\n return $input;\n }", "label": 1, "label_name": "safe"} +{"code": "Va.style.cursor=\"pointer\"):(Va.setAttribute(\"disabled\",\"disabled\"),Va.style.cursor=\"default\")},La.addListener(\"stateChanged\",za),I.addListener(\"enabledChanged\",za),za());return Va}function ea(za,wa,Ea){Ea=document.createElement(\"div\");Ea.className=\"geMenuItem\";Ea.style.display=\"inline-block\";Ea.style.verticalAlign=\"top\";Ea.style.marginRight=\"6px\";Ea.style.padding=\"0 4px 0 4px\";Ea.style.height=\"30px\";Ea.style.position=\"relative\";Ea.style.top=\"0px\";\"1\"==urlParams.sketch&&(Ea.style.boxShadow=\"none\");\nfor(var Da=0;DaS.offsetTop-S.offsetHeight/2?\"70px\":\"10px\");else{for(var za=", "label": 1, "label_name": "safe"} +{"code": " it 'activates user when must_approve_users? is enabled' do\n SiteSetting.must_approve_users = true\n invite.invited_by = Fabricate(:admin)\n\n user = invite.redeem\n expect(user.approved?).to eq(true)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function getFileContent($file, $identifier)\n {\n $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));\n $this->process->execute($resource, $content, $this->repoDir);\n\n if (!trim($content)) {\n return null;\n }\n\n return $content;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static void doPost(HttpRequest req, HttpResponse res) {\n set_content_type(res, \"text/html\");\n if (ACTION(RUN))\n handle_run(req, res);\n else if (ACTION(STATUS))\n print_status(req, res, 1);\n else if (ACTION(STATUS2))\n print_status(req, res, 2);\n else if (ACTION(SUMMARY))\n print_summary(req, res);\n else if (ACTION(REPORT))\n _printReport(req, res);\n else if (ACTION(DOACTION))\n handle_do_action(req, res);\n else\n handle_action(req, res);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *OldB) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: OldB: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: OldB: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field C\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.C == nil {\n\t\t\t\tm.C = &OldC{}\n\t\t\t}\n\t\t\tif err := m.C.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tcase 5:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field F\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif m.F == nil {\n\t\t\t\tm.F = &OldC{}\n\t\t\t}\n\t\t\tif err := m.F.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipUnrecognized(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 1, "label_name": "safe"} +{"code": "func NewLocalLoginAttemptCache() LoginAttemptCache {\n\tctx, ctxCancelFn := context.WithCancel(context.Background())\n\n\tc := &LocalLoginAttemptCache{\n\t\taccountCache: make(map[string]*lockoutStatus),\n\t\tipCache: make(map[string]*lockoutStatus),\n\n\t\tctx: ctx,\n\t\tctxCancelFn: ctxCancelFn,\n\t}\n\n\tgo func() {\n\t\tticker := time.NewTicker(10 * time.Minute)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-c.ctx.Done():\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\tcase t := <-ticker.C:\n\t\t\t\tnow := t.UTC()\n\t\t\t\tc.Lock()\n\t\t\t\tfor account, status := range c.accountCache {\n\t\t\t\t\tif status.trim(now, lockoutPeriodAccount) {\n\t\t\t\t\t\tdelete(c.accountCache, account)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor ip, status := range c.ipCache {\n\t\t\t\t\tif status.trim(now, lockoutPeriodIp) {\n\t\t\t\t\t\tdelete(c.ipCache, ip)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tc.Unlock()\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn c\n}", "label": 1, "label_name": "safe"} +{"code": " public function addBlankElement($element_name)\n {\n $module = $this->getAnonymousModule();\n $element = $module->addBlankElement($element_name);\n return $element;\n }", "label": 1, "label_name": "safe"} +{"code": " void Compute(OpKernelContext* ctx) override {\n const Tensor& a = ctx->input(0);\n const Tensor& b = ctx->input(1);\n OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(a.shape()),\n errors::InvalidArgument(\"a is not a matrix\"));\n OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(b.shape()),\n errors::InvalidArgument(\"b is not a matrix\"));\n\n const int m = transpose_a_ ? a.dim_size(1) : a.dim_size(0);\n const int k = transpose_a_ ? a.dim_size(0) : a.dim_size(1);\n const int n = transpose_b_ ? b.dim_size(0) : b.dim_size(1);\n const int k2 = transpose_b_ ? b.dim_size(1) : b.dim_size(0);\n\n OP_REQUIRES(ctx, k == k2,\n errors::InvalidArgument(\n \"Matrix size incompatible: a: \", a.shape().DebugString(),\n \", b: \", b.shape().DebugString()));\n OP_REQUIRES(ctx, m >= 0 && n >= 0 && k >= 0,\n errors::InvalidArgument(\n \"Matrix dimensions cannot be negative: a: \",\n a.shape().DebugString(), \", b: \", b.shape().DebugString()));\n Tensor* output = nullptr;\n OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({m, n}), &output));\n\n // Return early if at least one of the output dimension size is 0.\n if (m == 0 || n == 0) {\n return;\n }\n\n if (k == 0) {\n // If the inner dimension k in the matrix multiplication is zero, we fill\n // the output with zeros.\n functor::SetZeroFunctor f;\n f(ctx->eigen_device(), output->flat());\n return;\n }\n\n auto out = output->matrix();\n\n std::unique_ptr a_float;\n std::unique_ptr b_float;\n if (!a_is_sparse_ && !b_is_sparse_) {\n auto left = &a;\n auto right = &b;\n // TODO(agarwal): multi-thread the conversions from bfloat16 to float.\n if (std::is_same::value) {\n a_float.reset(new Tensor(DT_FLOAT, a.shape()));\n BFloat16ToFloat(a.flat().data(),\n a_float->flat().data(), a.NumElements());\n left = a_float.get();\n }\n if (std::is_same::value) {\n b_float.reset(new Tensor(DT_FLOAT, b.shape()));\n BFloat16ToFloat(b.flat().data(),\n b_float->flat().data(), b.NumElements());\n right = b_float.get();\n }\n Eigen::array, 1> dim_pair;\n dim_pair[0].first = transpose_a_ ? 0 : 1;\n dim_pair[0].second = transpose_b_ ? 1 : 0;\n\n out.device(ctx->template eigen_device()) =\n left->matrix().contract(right->matrix(), dim_pair);\n return;\n }\n\n auto left = &a;\n auto right = &b;\n bool transpose_output = false;\n bool transpose_a = transpose_a_;\n bool transpose_b = transpose_b_;\n if (!a_is_sparse_) {\n // Swap the order of multiplications using the identity:\n // A * B = (B' * A')'.\n std::swap(left, right);\n std::swap(transpose_a, transpose_b);\n transpose_a = !transpose_a;\n transpose_b = !transpose_b;\n transpose_output = !transpose_output;\n }\n\n std::unique_ptr right_tr;\n if (transpose_b) {\n // TODO(agarwal): avoid transposing the matrix here and directly handle\n // transpose in CreateDenseSlices.\n OP_REQUIRES(ctx, right->dim_size(0) != 0,\n errors::InvalidArgument(\"b has an entry 0 in it's shape.\"));\n OP_REQUIRES(ctx, right->dim_size(1) != 0,\n errors::InvalidArgument(\"b has an entry 0 in it's shape.\"));\n right_tr.reset(\n new Tensor(right->dtype(),\n TensorShape({right->dim_size(1), right->dim_size(0)})));\n\n const auto perm = dsizes_10();\n if (transpose_output) {\n right_tr->matrix().device(ctx->template eigen_device()) =\n right->matrix().shuffle(perm);\n } else {\n right_tr->matrix().device(ctx->template eigen_device()) =\n right->matrix().shuffle(perm);\n }\n right = right_tr.get();\n }\n\n if (transpose_output) {\n DoMatMul::Compute(&this->cache_tr_, left->matrix(),\n right->matrix(), transpose_a,\n ctx->device()->tensorflow_cpu_worker_threads(),\n transpose_output, &out);\n } else {\n DoMatMul::Compute(&this->cache_nt_, left->matrix(),\n right->matrix(), transpose_a,\n ctx->device()->tensorflow_cpu_worker_threads(),\n transpose_output, &out);\n }\n }", "label": 1, "label_name": "safe"} +{"code": "static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, void __user *user_arg)\n{\n\tstruct hid_device *hid = hiddev->hid;\n\tstruct hiddev_report_info rinfo;\n\tstruct hiddev_usage_ref_multi *uref_multi = NULL;\n\tstruct hiddev_usage_ref *uref;\n\tstruct hid_report *report;\n\tstruct hid_field *field;\n\tint i;\n\n\turef_multi = kmalloc(sizeof(struct hiddev_usage_ref_multi), GFP_KERNEL);\n\tif (!uref_multi)\n\t\treturn -ENOMEM;\n\turef = &uref_multi->uref;\n\tif (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {\n\t\tif (copy_from_user(uref_multi, user_arg,\n\t\t\t\t sizeof(*uref_multi)))\n\t\t\tgoto fault;\n\t} else {\n\t\tif (copy_from_user(uref, user_arg, sizeof(*uref)))\n\t\t\tgoto fault;\n\t}\n\n\tswitch (cmd) {\n\tcase HIDIOCGUCODE:\n\t\trinfo.report_type = uref->report_type;\n\t\trinfo.report_id = uref->report_id;\n\t\tif ((report = hiddev_lookup_report(hid, &rinfo)) == NULL)\n\t\t\tgoto inval;\n\n\t\tif (uref->field_index >= report->maxfield)\n\t\t\tgoto inval;\n\n\t\tfield = report->field[uref->field_index];\n\t\tif (uref->usage_index >= field->maxusage)\n\t\t\tgoto inval;\n\n\t\turef->usage_code = field->usage[uref->usage_index].hid;\n\n\t\tif (copy_to_user(user_arg, uref, sizeof(*uref)))\n\t\t\tgoto fault;\n\n\t\tgoto goodreturn;\n\n\tdefault:\n\t\tif (cmd != HIDIOCGUSAGE &&\n\t\t cmd != HIDIOCGUSAGES &&\n\t\t uref->report_type == HID_REPORT_TYPE_INPUT)\n\t\t\tgoto inval;\n\n\t\tif (uref->report_id == HID_REPORT_ID_UNKNOWN) {\n\t\t\tfield = hiddev_lookup_usage(hid, uref);\n\t\t\tif (field == NULL)\n\t\t\t\tgoto inval;\n\t\t} else {\n\t\t\trinfo.report_type = uref->report_type;\n\t\t\trinfo.report_id = uref->report_id;\n\t\t\tif ((report = hiddev_lookup_report(hid, &rinfo)) == NULL)\n\t\t\t\tgoto inval;\n\n\t\t\tif (uref->field_index >= report->maxfield)\n\t\t\t\tgoto inval;\n\n\t\t\tfield = report->field[uref->field_index];\n\n\t\t\tif (cmd == HIDIOCGCOLLECTIONINDEX) {\n\t\t\t\tif (uref->usage_index >= field->maxusage)\n\t\t\t\t\tgoto inval;\n\t\t\t} else if (uref->usage_index >= field->report_count)\n\t\t\t\tgoto inval;\n\n\t\t\telse if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&\n\t\t\t\t (uref_multi->num_values > HID_MAX_MULTI_USAGES ||\n\t\t\t\t uref->usage_index + uref_multi->num_values > field->report_count))\n\t\t\t\tgoto inval;\n\t\t}\n\n\t\tswitch (cmd) {\n\t\tcase HIDIOCGUSAGE:\n\t\t\turef->value = field->value[uref->usage_index];\n\t\t\tif (copy_to_user(user_arg, uref, sizeof(*uref)))\n\t\t\t\tgoto fault;\n\t\t\tgoto goodreturn;\n\n\t\tcase HIDIOCSUSAGE:\n\t\t\tfield->value[uref->usage_index] = uref->value;\n\t\t\tgoto goodreturn;\n\n\t\tcase HIDIOCGCOLLECTIONINDEX:\n\t\t\ti = field->usage[uref->usage_index].collection_index;\n\t\t\tkfree(uref_multi);\n\t\t\treturn i;\n\t\tcase HIDIOCGUSAGES:\n\t\t\tfor (i = 0; i < uref_multi->num_values; i++)\n\t\t\t\turef_multi->values[i] =\n\t\t\t\t field->value[uref->usage_index + i];\n\t\t\tif (copy_to_user(user_arg, uref_multi,\n\t\t\t\t\t sizeof(*uref_multi)))\n\t\t\t\tgoto fault;\n\t\t\tgoto goodreturn;\n\t\tcase HIDIOCSUSAGES:\n\t\t\tfor (i = 0; i < uref_multi->num_values; i++)\n\t\t\t\tfield->value[uref->usage_index + i] =\n\t\t\t\t uref_multi->values[i];\n\t\t\tgoto goodreturn;\n\t\t}\n\ngoodreturn:\n\t\tkfree(uref_multi);\n\t\treturn 0;\nfault:\n\t\tkfree(uref_multi);\n\t\treturn -EFAULT;\ninval:\n\t\tkfree(uref_multi);\n\t\treturn -EINVAL;\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": "fa=Array(Z.length);for(var aa=0;aa 'bar'));\n $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined');\n $this->assertTrue($bag->has('Foo'), '->has() converts the key to lowercase');\n $this->assertFalse($bag->has('bar'), '->has() returns false if a parameter is not defined');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "this.showDialog(d.container,300,(p?25:0)+(l?125:210),!0,!0)};EditorUi.prototype.showExportDialog=function(d,g,k,l,p,q,x,y,A){x=null!=x?x:Editor.defaultIncludeDiagram;var B=document.createElement(\"div\");B.style.whiteSpace=\"nowrap\";var I=this.editor.graph,O=\"jpeg\"==y?220:300,t=document.createElement(\"h3\");mxUtils.write(t,d);t.style.cssText=\"width:100%;text-align:center;margin-top:0px;margin-bottom:10px\";B.appendChild(t);mxUtils.write(B,mxResources.get(\"zoom\")+\":\");var z=document.createElement(\"input\");\nz.setAttribute(\"type\",\"text\");z.style.marginRight=\"16px\";z.style.width=\"60px\";z.style.marginLeft=\"4px\";z.style.marginRight=\"12px\";z.value=this.lastExportZoom||\"100%\";B.appendChild(z);mxUtils.write(B,mxResources.get(\"borderWidth\")+\":\");var L=document.createElement(\"input\");L.setAttribute(\"type\",\"text\");L.style.marginRight=\"16px\";L.style.width=\"60px\";L.style.marginLeft=\"4px\";L.value=this.lastExportBorder||\"0\";B.appendChild(L);mxUtils.br(B);var C=this.addCheckbox(B,mxResources.get(\"selectionOnly\"),!1,\nI.isSelectionEmpty()),D=document.createElement(\"input\");D.style.marginTop=\"16px\";D.style.marginRight=\"8px\";D.style.marginLeft=\"24px\";D.setAttribute(\"disabled\",\"disabled\");D.setAttribute(\"type\",\"checkbox\");var G=document.createElement(\"select\");G.style.marginTop=\"16px\";G.style.marginLeft=\"8px\";d=[\"selectionOnly\",\"diagram\",\"page\"];var P={};for(t=0;tgetProject();\n $tag = $this->getProjectTag($project);\n\n $this->response->html($this->template->render('project_tag/remove', array(\n 'tag' => $tag,\n 'project' => $project,\n )));\n }", "label": 1, "label_name": "safe"} +{"code": " private List GetDisplayInformation()\n {\n var displays = new List();\n for (var i = 0; i < Screen.AllScreens.Length; i++)\n {\n var friendly = Display.GetDeviceFriendlyName(i);\n var display = new DisplayInformation {FriendlyName = friendly};\n var currentScreen = Screen.AllScreens[i];\n display.CurrentResolution = new ResolutionInformation\n {\n BitsPerPixel = currentScreen.BitsPerPixel,\n Frequency = 60,\n Height = currentScreen.Bounds.Height,\n Width = currentScreen.Bounds.Width,\n Orientation = \"Unknown\",\n X = currentScreen.Bounds.X,\n Y = currentScreen.Bounds.Y\n };\n displays.Add(display);\n }\n return displays;\n }", "label": 1, "label_name": "safe"} +{"code": "function send_reset_confirmation_request($name)\n{\n global $sitename;\n\n $rs = safe_row(\"user_id, email, nonce, pass\", 'txp_users', \"name = '\".doSlash($name).\"'\");\n\n if ($rs) {\n extract($rs);\n\n $uid = assert_int($user_id);\n\n // The selector becomes an indirect reference to the txp_users row,\n // which does not leak information.\n $selector = Txp::get('\\Textpattern\\Password\\Random')->generate(12);\n $expiry = strftime('%Y-%m-%d %H:%M:%S', time() + (60 * RESET_EXPIRY_MINUTES));\n\n // Use a hash of the nonce, selector and password.\n // This ensures that confirmation requests expire automatically when:\n // a) The person next logs in, or\n // b) They successfully change their password (usually as a result of this reset request)\n // Using the selector in the hash just injects randomness, otherwise two requests\n // back-to-back would generate the same confirmation code.\n // Old requests for the same user id are purged every time a new request is made.\n $token = bin2hex(pack('H*', substr(hash(HASHING_ALGORITHM, $nonce . $selector . $pass), 0, SALT_LENGTH)));\n $confirm = $token.$selector;\n\n // Remove any previous reset tokens and insert the new one.\n safe_delete(\"txp_token\", \"reference_id = $uid AND type = 'password_reset'\");\n safe_insert(\"txp_token\",\n \"reference_id = $uid,\n type = 'password_reset',\n selector = '\".doSlash($selector).\"',\n token = '\".doSlash($token).\"',\n expires = '\".doSlash($expiry).\"'\n \");\n\n $message = gTxt('greeting').' '.$name.','.\n n.n.gTxt('password_reset_confirmation').\n n.hu.'textpattern/index.php?confirm='.$confirm;\n if (txpMail($email, \"[$sitename] \".gTxt('password_reset_confirmation_request'), $message)) {\n return gTxt('password_reset_confirmation_request_sent');\n } else {\n return array(gTxt('could_not_mail'), E_ERROR);\n }\n } else {\n // Though 'unknown_author' could be thrown, send generic 'request_sent'\n // message instead so that (non-)existence of account names are not leaked.\n // There's a possibility of a timing attack revealing the existence of\n // an account, which we could defend against to some degree.\n return gTxt('password_reset_confirmation_request_sent');\n }\n}", "label": 1, "label_name": "safe"} +{"code": "process_bitmap_updates(STREAM s)\n{\n\tint i;\n\tuint16 num_updates;\n\t\n\tin_uint16_le(s, num_updates); /* rectangles */\n\n\tfor (i = 0; i < num_updates; i++)\n\t{\n\t\tprocess_bitmap_data(s);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " function fopen($filename, $mode)\n {\n if (\\yiiunit\\framework\\base\\SecurityTest::$fopen !== null) {\n return \\yiiunit\\framework\\base\\SecurityTest::$fopen;\n }\n\n return \\fopen($filename, $mode);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "MagickExport MemoryInfo *RelinquishVirtualMemory(MemoryInfo *memory_info)\n{\n assert(memory_info != (MemoryInfo *) NULL);\n assert(memory_info->signature == MagickSignature);\n if (memory_info->blob != (void *) NULL)\n switch (memory_info->type)\n {\n case AlignedVirtualMemory:\n {\n memory_info->blob=RelinquishAlignedMemory(memory_info->blob);\n RelinquishMagickResource(MemoryResource,memory_info->length);\n break;\n }\n case MapVirtualMemory:\n {\n (void) UnmapBlob(memory_info->blob,memory_info->length);\n memory_info->blob=NULL;\n RelinquishMagickResource(MapResource,memory_info->length);\n if (*memory_info->filename != '\\0')\n {\n (void) RelinquishUniqueFileResource(memory_info->filename);\n RelinquishMagickResource(DiskResource,memory_info->length);\n }\n break;\n }\n case UnalignedVirtualMemory:\n default:\n {\n memory_info->blob=RelinquishMagickMemory(memory_info->blob);\n break;\n }\n }\n memory_info->signature=(~MagickSignature);\n memory_info=(MemoryInfo *) RelinquishAlignedMemory(memory_info);\n return(memory_info);\n}", "label": 1, "label_name": "safe"} +{"code": "def add_meta_attr(auth_user, resource, key, value)\n stdout, stderr, retval = run_cmd(\n auth_user, PCS, \"resource\", \"meta\", resource, key.to_s + \"=\" + value.to_s\n )\n return retval\nend", "label": 1, "label_name": "safe"} +{"code": "\tprotected function _setContent($path, $fp) {\n\t\telFinder::rewind($fp);\n\t\t$fstat = fstat($fp);\n\t\t$size = $fstat['size'];\n\t\t\n\t\t\n\t}", "label": 1, "label_name": "safe"} +{"code": " public function testProcessAppendsMethodCallsAlways()\n {\n $container = new ContainerBuilder();\n\n $container\n ->register('parent')\n ->addMethodCall('foo', array('bar'))\n ;\n\n $container\n ->setDefinition('child', new DefinitionDecorator('parent'))\n ->addMethodCall('bar', array('foo'))\n ;\n\n $this->process($container);\n\n $def = $container->getDefinition('child');\n $this->assertEquals(array(\n array('foo', array('bar')),\n array('bar', array('foo')),\n ), $def->getMethodCalls());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "(function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler(\"remove\")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a(\"*\",this).add([this]).each(function(){try{a(this).triggerHandler(\"remove\")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(\".\")[0],f;b=b.split(\".\")[1],f=e+\"-\"+b,d||(d=c,c=a.Widget),a.expr[\":\"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e==\"string\",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)===\"_\"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:\"widget\",widgetEventPrefix:\"\",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind(\"remove.\"+this.widgetName,function(){d.destroy()}),this._create(),this._trigger(\"create\"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind(\".\"+this.widgetName).removeData(this.widgetName),this.widget().unbind(\".\"+this.widgetName).removeAttr(\"aria-disabled\").removeClass(this.widgetBaseClass+\"-disabled \"+\"ui-state-disabled\")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c==\"string\"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a===\"disabled\"&&this.widget()[b?\"addClass\":\"removeClass\"](this.widgetBaseClass+\"-disabled\"+\" \"+\"ui-state-disabled\").attr(\"aria-disabled\",b),this},enable:function(){return this._setOption(\"disabled\",!1)},disable:function(){return this._setOption(\"disabled\",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15", "label": 0, "label_name": "vulnerable"} +{"code": "block_insert(\n oparg_T\t\t*oap,\n char_u\t\t*s,\n int\t\t\tb_insert,\n struct block_def\t*bdp)\n{\n int\t\tts_val;\n int\t\tcount = 0;\t// extra spaces to replace a cut TAB\n int\t\tspaces = 0;\t// non-zero if cutting a TAB\n colnr_T\toffset;\t\t// pointer along new line\n colnr_T\tstartcol;\t// column where insert starts\n unsigned\ts_len;\t\t// STRLEN(s)\n char_u\t*newp, *oldp;\t// new, old lines\n linenr_T\tlnum;\t\t// loop var\n int\t\toldstate = State;\n\n State = INSERT;\t\t// don't want REPLACE for State\n s_len = (unsigned)STRLEN(s);\n\n for (lnum = oap->start.lnum + 1; lnum <= oap->end.lnum; lnum++)\n {\n\tblock_prep(oap, bdp, lnum, TRUE);\n\tif (bdp->is_short && b_insert)\n\t continue;\t// OP_INSERT, line ends before block start\n\n\toldp = ml_get(lnum);\n\n\tif (b_insert)\n\t{\n\t ts_val = bdp->start_char_vcols;\n\t spaces = bdp->startspaces;\n\t if (spaces != 0)\n\t\tcount = ts_val - 1; // we're cutting a TAB\n\t offset = bdp->textcol;\n\t}\n\telse // append\n\t{\n\t ts_val = bdp->end_char_vcols;\n\t if (!bdp->is_short) // spaces = padding after block\n\t {\n\t\tspaces = (bdp->endspaces ? ts_val - bdp->endspaces : 0);\n\t\tif (spaces != 0)\n\t\t count = ts_val - 1; // we're cutting a TAB\n\t\toffset = bdp->textcol + bdp->textlen - (spaces != 0);\n\t }\n\t else // spaces = padding to block edge\n\t {\n\t\t// if $ used, just append to EOL (ie spaces==0)\n\t\tif (!bdp->is_MAX)\n\t\t spaces = (oap->end_vcol - bdp->end_vcol) + 1;\n\t\tcount = spaces;\n\t\toffset = bdp->textcol + bdp->textlen;\n\t }\n\t}\n\n\tif (has_mbyte && spaces > 0)\n\t{\n\t int off;\n\n\t // Avoid starting halfway a multi-byte character.\n\t if (b_insert)\n\t {\n\t\toff = (*mb_head_off)(oldp, oldp + offset + spaces);\n\t\tspaces -= off;\n\t\tcount -= off;\n\t }\n\t else\n\t {\n\t\t// spaces fill the gap, the character that's at the edge moves\n\t\t// right\n\t\toff = (*mb_head_off)(oldp, oldp + offset);\n\t\toffset -= off;\n\t }\n\t}\n\tif (spaces < 0) // can happen when the cursor was moved\n\t spaces = 0;\n\n\t// Make sure the allocated size matches what is actually copied below.\n\tnewp = alloc(STRLEN(oldp) + spaces + s_len\n\t\t + (spaces > 0 && !bdp->is_short ? ts_val - spaces : 0)\n\t\t\t\t\t\t\t\t + count + 1);\n\tif (newp == NULL)\n\t continue;\n\n\t// copy up to shifted part\n\tmch_memmove(newp, oldp, (size_t)offset);\n\toldp += offset;\n\n\t// insert pre-padding\n\tvim_memset(newp + offset, ' ', (size_t)spaces);\n\tstartcol = offset + spaces;\n\n\t// copy the new text\n\tmch_memmove(newp + startcol, s, (size_t)s_len);\n\toffset += s_len;\n\n\tif (spaces > 0 && !bdp->is_short)\n\t{\n\t if (*oldp == TAB)\n\t {\n\t\t// insert post-padding\n\t\tvim_memset(newp + offset + spaces, ' ',\n\t\t\t\t\t\t (size_t)(ts_val - spaces));\n\t\t// we're splitting a TAB, don't copy it\n\t\toldp++;\n\t\t// We allowed for that TAB, remember this now\n\t\tcount++;\n\t }\n\t else\n\t\t// Not a TAB, no extra spaces\n\t\tcount = spaces;\n\t}\n\n\tif (spaces > 0)\n\t offset += count;\n\tSTRMOVE(newp + offset, oldp);\n\n\tml_replace(lnum, newp, FALSE);\n\n\tif (b_insert)\n\t // correct any text properties\n\t inserted_bytes(lnum, startcol, s_len);\n\n\tif (lnum == oap->end.lnum)\n\t{\n\t // Set \"']\" mark to the end of the block instead of the end of\n\t // the insert in the first line.\n\t curbuf->b_op_end.lnum = oap->end.lnum;\n\t curbuf->b_op_end.col = offset;\n\t}\n } // for all lnum\n\n changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L);\n\n State = oldstate;\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct()\n {\n $this->percentEncoder = new HTMLPurifier_PercentEncoder();\n }", "label": 1, "label_name": "safe"} +{"code": "null!=this.linkHint&&(this.linkHint.style.visibility=\"\")};var Za=mxEdgeHandler.prototype.destroy;mxEdgeHandler.prototype.destroy=function(){Za.apply(this,arguments);null!=this.linkHint&&(this.linkHint.parentNode.removeChild(this.linkHint),this.linkHint=null);null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getSelectionModel().removeListener(this.changeHandler),this.changeHandler=null)}}();(function(){function b(c,l,x){mxShape.call(this);this.line=c;this.stroke=l;this.strokewidth=null!=x?x:1;this.updateBoundsFromLine()}function e(){mxSwimlane.call(this)}function k(){mxSwimlane.call(this)}function n(){mxCylinder.call(this)}function D(){mxCylinder.call(this)}function t(){mxActor.call(this)}function F(){mxCylinder.call(this)}function d(){mxCylinder.call(this)}function f(){mxCylinder.call(this)}function g(){mxCylinder.call(this)}function m(){mxShape.call(this)}function q(){mxShape.call(this)}", "label": 0, "label_name": "vulnerable"} +{"code": "static int DefragMfIpv4Test(void)\n{\n int retval = 0;\n int ip_id = 9;\n Packet *p = NULL;\n\n DefragInit();\n\n Packet *p1 = BuildTestPacket(ip_id, 2, 1, 'C', 8);\n Packet *p2 = BuildTestPacket(ip_id, 0, 1, 'A', 8);\n Packet *p3 = BuildTestPacket(ip_id, 1, 0, 'B', 8);\n if (p1 == NULL || p2 == NULL || p3 == NULL) {\n goto end;\n }\n\n p = Defrag(NULL, NULL, p1, NULL);\n if (p != NULL) {\n goto end;\n }\n\n p = Defrag(NULL, NULL, p2, NULL);\n if (p != NULL) {\n goto end;\n }\n\n /* This should return a packet as MF=0. */\n p = Defrag(NULL, NULL, p3, NULL);\n if (p == NULL) {\n goto end;\n }\n\n /* Expected IP length is 20 + 8 + 8 = 36 as only 2 of the\n * fragments should be in the re-assembled packet. */\n if (IPV4_GET_IPLEN(p) != 36) {\n goto end;\n }\n\n retval = 1;\nend:\n if (p1 != NULL) {\n SCFree(p1);\n }\n if (p2 != NULL) {\n SCFree(p2);\n }\n if (p3 != NULL) {\n SCFree(p3);\n }\n if (p != NULL) {\n SCFree(p);\n }\n DefragDestroy();\n return retval;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testTextState11Root()\n {\n $this->assertResult('
        ');\n }", "label": 1, "label_name": "safe"} +{"code": "TEST_F(AsStringGraphTest, Int64) {\n TF_ASSERT_OK(Init(DT_INT64));\n\n AddInputFromArray(TensorShape({3}), {-42, 0, 42});\n TF_ASSERT_OK(RunOpKernel());\n Tensor expected(allocator(), DT_STRING, TensorShape({3}));\n test::FillValues(&expected, {\"-42\", \"0\", \"42\"});\n test::ExpectTensorEqual(expected, *GetOutput(0));\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct () {\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "KCleanup::expandVariables( const KFileInfo *\titem,\n\t\t\t const QString &\tunexpanded ) const\n{\n QString expanded = unexpanded;\n\n expanded.replace( QRegExp( \"%p\" ),\n\t\t \"'\" + QString::fromLocal8Bit( item->url() ) + \"'\" );\n expanded.replace( QRegExp( \"%n\" ),\n\t\t \"'\" + QString::fromLocal8Bit( item->name() ) + \"'\" );\n\n // if ( KDE::versionMajor() >= 3 && KDE::versionMinor() >= 4 )\n\texpanded.replace( QRegExp( \"%t\" ), \"trash:/\" );\n //else\n\t//expanded.replace( QRegExp( \"%t\" ), KGlobalSettings::trashPath() );\n\n return expanded;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function showall() {\n global $db;\n\n expHistory::set('viewable', $this->params);\n\n // remove abaondoned carts\n /*$count = $db->countObjects('orders', 'purchased=0');\n for($i=0; $i<$count; $i++) {\n // get the cart\n $cart = $db->selectObject('orders','purchased=0');\n \n // check to make sure this isn't an active session\n $ticket = $db->selectObject('sessionticket', \"ticket='\".$cart->sessionticket_ticket.\"'\");\n if (empty($ticket)) {\n // delete all the order items for this cart and their shippingmethods\n foreach($db->selectObjects('orderitems', 'orders_id='.$cart->id) as $oi) {\n $db->delete('shippingmethods', 'id='.$oi->shippingmethods_id);\n $db->delete('orderitems', 'orders_id='.$cart->id); \n }\n \n // delete the billing methods for this cart.\n $db->delete('billingmethods', 'orders_id='.$cart->id);\n $db->delete('orders', 'id='.$cart->id);\n } \n \n } */\n\n // find orders with a \"closed\" status type\n// $closed_count = 0;\n if (empty($this->params['showclosed'])) {\n $closed_status = $db->selectColumn('order_status', 'id', 'treat_as_closed=1');\n $closed_status = implode(',',$closed_status);\n// $status_where = '';\n $status_where = ' AND order_status_id NOT IN (' . $closed_status . ')';\n\n// foreach ($closed_status as $status) {\n// if (empty($status_where)) {\n// $status_where .= ' AND (order_status_id!=' . $status;\n// } else {\n// $status_where .= ' AND order_status_id!=' . $status;\n// }\n// $closed_count += $db->countObjects('orders', 'order_status_id=' . $status);\n// }\n $closed_count = $db->countObjects('orders', 'order_status_id IN (' . $closed_status . ')');\n } else {\n $status_where = '';\n $closed_count = -1;\n }\n\n // build out a SQL query that gets all the data we need and is sortable.\n $sql = 'SELECT o.*, b.firstname as firstname, b.billing_cost as total, b.transaction_state as paid, b.billingcalculator_id as method, b.middlename as middlename, b.lastname as lastname, os.title as status, ot.title as order_type ';\n $sql .= 'FROM ' . $db->prefix . 'orders o, ' . $db->prefix . 'billingmethods b, ';\n $sql .= $db->prefix . 'order_status os, ';\n $sql .= $db->prefix . 'order_type ot ';\n $sql .= 'WHERE o.id = b.orders_id AND o.order_status_id = os.id AND o.order_type_id = ot.id AND o.purchased > 0';\n //FIXME this sql isn't correct???\n// if (!empty($status_where)) {\n// $status_where .= ')';\n $sql .= $status_where;\n// }\n if (ECOM_LARGE_DB) {\n $limit = empty($this->config['limit']) ? 50 : $this->config['limit'];\n } else {\n $limit = 0; // we'll paginate on the page\n }\n //eDebug($sql, true);\n $page = new expPaginator(array(\n //'model'=>'order',\n 'sql' => $sql,\n 'order' => 'purchased',\n 'dir' => 'DESC',\n 'limit' => $limit,\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->params['controller'],\n 'action' => $this->params['action'],\n 'columns' => array(\n gt('Customer') => 'lastname',\n gt('Inv #') => 'invoice_id',\n gt('Total') => 'total',\n gt('Payment') => 'method',\n gt('Purchased') => 'purchased',\n gt('Type') => 'order_type_id',\n gt('Status') => 'order_status_id',\n gt('Ref') => 'orig_referrer',\n )\n ));\n //eDebug($page,true);\n assign_to_template(array(\n 'page' => $page,\n 'closed_count'=> $closed_count,\n 'new_order' => order::getDefaultOrderStatus()\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void next_character(void)\n{\n if (!recovery_started) {\n recovery_abort();\n fsm_sendFailure(FailureType_Failure_UnexpectedMessage, \"Not in Recovery mode\");\n layoutHome();\n return;\n }\n\n /* Scramble cipher */\n strlcpy(cipher, english_alphabet, ENGLISH_ALPHABET_BUF);\n random_permute_char(cipher, strlen(cipher));\n\n static char CONFIDENTIAL current_word[CURRENT_WORD_BUF];\n get_current_word(current_word);\n\n /* Words should never be longer than 4 characters */\n if (strlen(current_word) > 4) {\n memzero(current_word, sizeof(current_word));\n\n recovery_abort();\n fsm_sendFailure(FailureType_Failure_SyntaxError,\n \"Words were not entered correctly. Make sure you are using the substition cipher.\");\n layoutHome();\n return;\n }\n\n CharacterRequest resp;\n memset(&resp, 0, sizeof(CharacterRequest));\n\n resp.word_pos = get_current_word_pos();\n resp.character_pos = strlen(current_word);\n\n msg_write(MessageType_MessageType_CharacterRequest, &resp);\n\n /* Attempt to auto complete if we have at least 3 characters */\n bool auto_completed = false;\n if (strlen(current_word) >= 3) {\n auto_completed = attempt_auto_complete(current_word);\n }\n\n#if DEBUG_LINK\n if (auto_completed) {\n strlcpy(auto_completed_word, current_word, CURRENT_WORD_BUF);\n } else {\n auto_completed_word[0] = '\\0';\n }\n#endif\n\n /* Format current word and display it along with cipher */\n format_current_word(current_word, auto_completed);\n\n /* Show cipher and partial word */\n layout_cipher(current_word, cipher);\n memzero(current_word, sizeof(current_word));\n}", "label": 1, "label_name": "safe"} +{"code": "fa=Array(Z.length);for(var aa=0;aanf_state[from];\n st->st_arc = (nfaarc *)PyObject_REALLOC(st->st_arc,\n sizeof(nfaarc) * (st->st_narcs + 1));\n if (st->st_arc == NULL)\n Py_FatalError(\"out of mem\");\n ar = &st->st_arc[st->st_narcs++];\n ar->ar_label = lbl;\n ar->ar_arrow = to;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "D);null!=T&&K.setAttribute(\"backgroundImage\",JSON.stringify(T));K.setAttribute(\"math\",this.graph.mathEnabled?\"1\":\"0\");K.setAttribute(\"shadow\",this.graph.shadowVisible?\"1\":\"0\");null!=this.graph.extFonts&&0buf);\n char *pn = imap_next_word(s);\n\n if ((idata->state >= IMAP_SELECTED) && isdigit((unsigned char) *s))\n {\n pn = s;\n s = imap_next_word(s);\n\n /* EXISTS and EXPUNGE are always related to the SELECTED mailbox for the\n * connection, so update that one.\n */\n if (mutt_str_strncasecmp(\"EXISTS\", s, 6) == 0)\n {\n mutt_debug(2, \"Handling EXISTS\\n\");\n\n /* new mail arrived */\n if (mutt_str_atoui(pn, &count) < 0)\n {\n mutt_debug(1, \"Malformed EXISTS: '%s'\\n\", pn);\n }\n\n if (!(idata->reopen & IMAP_EXPUNGE_PENDING) && count < idata->max_msn)\n {\n /* Notes 6.0.3 has a tendency to report fewer messages exist than\n * it should. */\n mutt_debug(1, \"Message count is out of sync\\n\");\n return 0;\n }\n /* at least the InterChange server sends EXISTS messages freely,\n * even when there is no new mail */\n else if (count == idata->max_msn)\n mutt_debug(3, \"superfluous EXISTS message.\\n\");\n else\n {\n if (!(idata->reopen & IMAP_EXPUNGE_PENDING))\n {\n mutt_debug(2, \"New mail in %s - %d messages total.\\n\", idata->mailbox, count);\n idata->reopen |= IMAP_NEWMAIL_PENDING;\n }\n idata->new_mail_count = count;\n }\n }\n /* pn vs. s: need initial seqno */\n else if (mutt_str_strncasecmp(\"EXPUNGE\", s, 7) == 0)\n cmd_parse_expunge(idata, pn);\n else if (mutt_str_strncasecmp(\"FETCH\", s, 5) == 0)\n cmd_parse_fetch(idata, pn);\n }\n else if (mutt_str_strncasecmp(\"CAPABILITY\", s, 10) == 0)\n cmd_parse_capability(idata, s);\n else if (mutt_str_strncasecmp(\"OK [CAPABILITY\", s, 14) == 0)\n cmd_parse_capability(idata, pn);\n else if (mutt_str_strncasecmp(\"OK [CAPABILITY\", pn, 14) == 0)\n cmd_parse_capability(idata, imap_next_word(pn));\n else if (mutt_str_strncasecmp(\"LIST\", s, 4) == 0)\n cmd_parse_list(idata, s);\n else if (mutt_str_strncasecmp(\"LSUB\", s, 4) == 0)\n cmd_parse_lsub(idata, s);\n else if (mutt_str_strncasecmp(\"MYRIGHTS\", s, 8) == 0)\n cmd_parse_myrights(idata, s);\n else if (mutt_str_strncasecmp(\"SEARCH\", s, 6) == 0)\n cmd_parse_search(idata, s);\n else if (mutt_str_strncasecmp(\"STATUS\", s, 6) == 0)\n cmd_parse_status(idata, s);\n else if (mutt_str_strncasecmp(\"ENABLED\", s, 7) == 0)\n cmd_parse_enabled(idata, s);\n else if (mutt_str_strncasecmp(\"BYE\", s, 3) == 0)\n {\n mutt_debug(2, \"Handling BYE\\n\");\n\n /* check if we're logging out */\n if (idata->status == IMAP_BYE)\n return 0;\n\n /* server shut down our connection */\n s += 3;\n SKIPWS(s);\n mutt_error(\"%s\", s);\n cmd_handle_fatal(idata);\n\n return -1;\n }\n else if (ImapServernoise && (mutt_str_strncasecmp(\"NO\", s, 2) == 0))\n {\n mutt_debug(2, \"Handling untagged NO\\n\");\n\n /* Display the warning message from the server */\n mutt_error(\"%s\", s + 3);\n }\n\n return 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)\n{\n\tif (mm->context.asce_limit == (1UL << 31))\n\t\tpgtable_pmd_page_dtor(virt_to_page(pgd));\n\tcrst_table_free(mm, (unsigned long *) pgd);\n}", "label": 1, "label_name": "safe"} +{"code": " public function transform($attr, $config, $context)\n {\n if (!isset($attr['href'])) {\n return $attr;\n }\n\n // XXX Kind of inefficient\n $url = $this->parser->parse($attr['href']);\n $scheme = $url->getSchemeObj($config, $context);\n\n if ($scheme->browsable && !$url->isBenign($config, $context)) {\n $attr['target'] = '_blank';\n }\n return $attr;\n }", "label": 1, "label_name": "safe"} +{"code": "static bool w2p(char *ip, char *op) {\n FILE *fp = openr(ip);\n if(!fp) return 1;\n bool openwdone = 0;\n uint8_t *x = 0, *b = 0;\n png_struct *p = 0;\n png_info *n = 0;\n uint8_t i[12];\n char *k[] = {\"Out of memory\", \"Broken config, file a bug report\",\n \"Invalid WebP\", \"???\", \"???\", \"???\", \"I/O error\"};\n // unsupported feature, suspended, canceled\n if(!fread(i, 12, 1, fp)) {\n PF(\"ERROR reading %s: %s\", IP, k[6]);\n goto w2p_close;\n }\n if(memcmp(i, (char[4]){\"RIFF\"}, 4) || memcmp(i + 8, (char[4]){\"WEBP\"}, 4)) {\n PF(\"ERROR reading %s: %s\", IP, k[2]);\n goto w2p_close;\n }\n size_t l = ((uint32_t)(i[4] | (i[5] << 8) | (i[6] << 16) | (i[7] << 24))) + 8;\n // ^ RIFF header size\n if(l <= 12\n#ifdef SSIZE_MAX\n || l - 12 > SSIZE_MAX\n#endif\n ) {\n PF(\"ERROR reading %s: %s\", IP, k[2]);\n goto w2p_close;\n }\n x = malloc(l);\n if(!x) {\n PF(\"ERROR reading %s: %s\", IP, *k);\n goto w2p_close;\n }\n memcpy(x, i, 12); // should optimize out\n if(!fread(x + 12, l - 12, 1, fp)) {\n PF(\"ERROR reading %s: %s\", IP, k[6]);\n goto w2p_close;\n }\n fclose(fp);\n#if defined LOSSYISERROR || defined NOTHREADS\n WebPBitstreamFeatures I;\n#else\n WebPDecoderConfig c = {.options.use_threads = 1};\n#define I c.input\n#endif\n VP8StatusCode r = WebPGetFeatures(x, l, &I);\n if(r) {\n PF(\"ERROR reading %s: %s\", IP, k[r - 1]);\n goto w2p_free;\n }\n#define V I.format\n#define W ((uint32_t)I.width)\n#define H ((uint32_t)I.height)\n#define A I.has_alpha\n#ifdef LOSSYISERROR\n#define FMTSTR\n#define FMTARG\n#define ANMSTR \"%s\"\n#define ANMARG , \"animat\"\n#else\n char *f[] = {\"undefined/mixed\", \"lossy\", \"lossless\"};\n#define FMTSTR \"\\nFormat: %s\"\n#define FMTARG , f[V]\n#define ANMSTR \"animat\"\n#define ANMARG\n#endif\n PFV(\"Info: %s:\\nDimensions: %\" PRIu32 \" x %\" PRIu32\n \"\\nSize: %zu bytes (%.15g bpp)\\nUses alpha: %s\" FMTSTR,\n IP, W, H, l, (double)l * 8 / (W * H), A ? \"yes\" : \"no\" FMTARG);\n if(I.has_animation) {\n PF(\"ERROR reading %s: Unsupported feature: \" ANMSTR \"ion\", IP ANMARG);\n goto w2p_free;\n }\n#ifdef LOSSYISERROR\n if(V != 2) {\n PF(\"ERROR reading %s: Unsupported feature: %sion\", IP, \"lossy compress\");\n goto w2p_free;\n }\n#endif\n#define B ((unsigned)(3 + A))\n b = malloc(W * H * B);\n if(!b) {\n PF(\"ERROR reading %s: %s\", IP, *k);\n goto w2p_free;\n }\n#if defined LOSSYISERROR || defined NOTHREADS\n if(!(A ? WebPDecodeRGBAInto : WebPDecodeRGBInto)(\n x, l, b, W * H * B, (int)(W * B))) {\n PF(\"ERROR reading %s: %s\", IP, k[2]);\n goto w2p_free;\n }\n#else\n c.output.colorspace = A ? MODE_RGBA : MODE_RGB;\n c.output.is_external_memory = 1;\n#define D c.output.u.RGBA\n D.rgba = b;\n D.stride = (int)(W * B);\n D.size = W * H * B;\n r = WebPDecode(x, l, &c);\n if(r) {\n PF(\"ERROR reading %s: %s\", IP, k[r - 1]);\n goto w2p_free;\n }\n#endif\n free(x);\n x = 0;\n if(!(fp = openw(op))) goto w2p_free;\n openwdone = !!op;\n p = png_create_write_struct(PNG_LIBPNG_VER_STRING, op, pngwerr, pngwarn);\n if(!p) {\n PF(\"ERROR writing %s: %s\", OP, *k);\n goto w2p_close;\n }\n n = png_create_info_struct(p);\n if(!n) {\n PF(\"ERROR writing %s: %s\", OP, *k);\n goto w2p_close;\n }\n if(setjmp(png_jmpbuf(p))) {\n w2p_close:\n fclose(fp);\n w2p_free:\n if(openwdone) remove(op);\n free(x);\n free(b);\n png_destroy_write_struct(&p, &n);\n return 1;\n }\n pnglen = 0;\n png_set_write_fn(p, fp, pngwrite, pngflush);\n png_set_filter(p, 0, PNG_ALL_FILTERS);\n png_set_compression_level(p, 9);\n // png_set_compression_memlevel(p, 9);\n png_set_IHDR(p, n, W, H, 8, A ? 6 : 2, 0, 0, 0);\n png_write_info(p, n);\n uint8_t *w = b;\n for(unsigned y = H; y; y--) {\n png_write_row(p, w);\n w += W * B;\n }\n png_write_end(p, n);\n png_destroy_write_struct(&p, &n);\n p = 0;\n n = 0;\n free(b);\n b = 0;\n if(fclose(fp)) {\n PF(\"ERROR closing %s: %s\", OP, strerror(errno));\n goto w2p_free;\n }\n PFV(\"Info: %s:\\nDimensions: %\" PRIu32 \" x %\" PRIu32\n \"\\nSize: %zu bytes (%.15g bpp)\\nFormat: %u-bit %s%s%s\\nGamma: %.5g\",\n OP, W, H, pnglen, (double)pnglen * 8 / (W * H), 8, A ? \"RGBA\" : \"RGB\", \"\",\n \"\", 1 / 2.2);\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": "urlParams.edge;Graph.prototype.hiddenTags=null;Graph.prototype.defaultMathEnabled=!1;var A=Graph.prototype.init;Graph.prototype.init=function(){function u(N){E=N}A.apply(this,arguments);this.hiddenTags=[];window.mxFreehand&&(this.freehand=new mxFreehand(this));var E=null;mxEvent.addListener(this.container,\"mouseenter\",u);mxEvent.addListener(this.container,\"mousemove\",u);mxEvent.addListener(this.container,\"mouseleave\",function(N){E=null});this.isMouseInsertPoint=function(){return null!=E};var J=this.getInsertPoint;\nthis.getInsertPoint=function(){return null!=E?this.getPointForEvent(E):J.apply(this,arguments)};var T=this.layoutManager.getLayout;this.layoutManager.getLayout=function(N){var Q=this.graph.getCellStyle(N);if(null!=Q&&\"rack\"==Q.childLayout){var R=new mxStackLayout(this.graph,!1);R.gridSize=null!=Q.rackUnitSize?parseFloat(Q.rackUnitSize):\"undefined\"!==typeof mxRackContainer?mxRackContainer.unitSize:20;R.marginLeft=Q.marginLeft||0;R.marginRight=Q.marginRight||0;R.marginTop=Q.marginTop||0;R.marginBottom=\nQ.marginBottom||0;R.allowGaps=Q.allowGaps||0;R.horizontal=\"1\"==mxUtils.getValue(Q,\"horizontalRack\",\"0\");R.resizeParent=!1;R.fill=!0;return R}return T.apply(this,arguments)};this.updateGlobalUrlVariables()};var B=Graph.prototype.postProcessCellStyle;Graph.prototype.postProcessCellStyle=function(u,E){return Graph.processFontStyle(B.apply(this,arguments))};var I=mxSvgCanvas2D.prototype.updateTextNodes;mxSvgCanvas2D.prototype.updateTextNodes=function(u,E,J,T,N,Q,R,Y,ba,ea,Z){I.apply(this,arguments);Graph.processFontAttributes(Z)};", "label": 0, "label_name": "vulnerable"} +{"code": " $banner->increaseImpressions();\n }\n }\n \n // assign banner to the template and show it!\n assign_to_template(array(\n 'banners'=>$banners\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,\n\t\t\t int relocated)\n{\n\tint flags = relocated ? RR_RELOC_DE : 0;\n\tint result = parse_rock_ridge_inode_internal(de, inode, flags);\n\n\t/*\n\t * if rockridge flag was reset and we didn't look for attributes\n\t * behind eventual XA attributes, have a look there\n\t */\n\tif ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)\n\t && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {\n\t\tresult = parse_rock_ridge_inode_internal(de, inode,\n\t\t\t\t\t\t\t flags | RR_REGARD_XA);\n\t}\n\treturn result;\n}", "label": 1, "label_name": "safe"} +{"code": "static void smp_task_timedout(struct timer_list *t)\n{\n\tstruct sas_task_slow *slow = from_timer(slow, t, timer);\n\tstruct sas_task *task = slow->task;\n\tunsigned long flags;\n\n\tspin_lock_irqsave(&task->task_state_lock, flags);\n\tif (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {\n\t\ttask->task_state_flags |= SAS_TASK_STATE_ABORTED;\n\t\tcomplete(&task->slow_task->completion);\n\t}\n\tspin_unlock_irqrestore(&task->task_state_lock, flags);\n}", "label": 1, "label_name": "safe"} +{"code": "const addReplyToEvent = (event: any) => {\n event.reply = (...args: any[]) => {\n event.sender.sendToFrame(event.frameId, ...args);\n };\n};", "label": 0, "label_name": "vulnerable"} +{"code": "function load_gallery($auc_id)\n{\n $UPLOADED_PICTURES = array();\n if (is_dir(UPLOAD_PATH . $auc_id)) {\n if ($dir = opendir(UPLOAD_PATH . $auc_id)) {\n while ($file = @readdir($dir)) {\n if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false) {\n $UPLOADED_PICTURES[] = $file;\n }\n }\n closedir($dir);\n }\n }\n return $UPLOADED_PICTURES;\n}", "label": 1, "label_name": "safe"} +{"code": " public function testClearTags()\n {\n $def = new Definition('stdClass');\n $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface');\n $def->addTag('foo', array('foo' => 'bar'));\n $def->clearTags();\n $this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t$ip = getenv('HTTP_FORWARDED');\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$ip = $_SERVER['REMOTE_ADDR'];\n\t\t\t}\n\t\t\treturn $ip;\n\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": " def test_get_files_from_storage(self):\n content = b\"test_get_files_from_storage\"\n name = storage.save(\n \"tmp/s3file/test_get_files_from_storage\", ContentFile(content)\n )\n files = S3FileMiddleware.get_files_from_storage(\n [os.path.join(storage.aws_location, name)]\n )\n file = next(files)\n assert file.read() == content", "label": 0, "label_name": "vulnerable"} +{"code": "def create(request, topic_id):\n topic = get_object_or_404(Topic, pk=topic_id)\n form = FavoriteForm(user=request.user, topic=topic, data=request.POST)\n\n if form.is_valid():\n form.save()\n else:\n messages.error(request, utils.render_form_errors(form))\n\n return safe_redirect(request, 'next', topic.get_absolute_url(), method='POST')", "label": 1, "label_name": "safe"} +{"code": "\tprotected function _chmod($path, $mode) {\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " $this->emitToken($this->token);\n\n $this->char--;\n $this->state = 'data';\n\n } elseif($char === '/') {\n /* U+002F SOLIDUS (/)\n Parse error unless this is a permitted slash. Switch to the before\n attribute name state. */\n $this->state = 'beforeAttributeName';\n\n } else {\n /* Anything else\n Append the current input character to the current tag token's tag name.\n Stay in the tag name state. */\n $this->token['name'] .= strtolower($char);\n $this->state = 'tagName';\n }\n }", "label": 1, "label_name": "safe"} +{"code": "def new_user():\n content = ub.User()\n languages = calibre_db.speaking_language()\n translations = [LC('en')] + babel.list_translations()\n kobo_support = feature_support['kobo'] and config.config_kobo_sync\n if request.method == \"POST\":\n to_save = request.form.to_dict()\n _handle_new_user(to_save, content, languages, translations, kobo_support)\n else:\n content.role = config.config_default_role\n content.sidebar_view = config.config_default_show\n content.locale = config.config_default_locale\n content.default_language = config.config_default_language\n return render_title_template(\"user_edit.html\", new_user=1, content=content,\n config=config, translations=translations,\n languages=languages, title=_(u\"Add new user\"), page=\"newuser\",\n kobo_support=kobo_support, registered_oauth=oauth_check)", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t\tscope.findPirate = function() {\n\t\t\t\t\t\treturn scope.ship.pirate;\n\t\t\t\t\t};", "label": 1, "label_name": "safe"} +{"code": " public static float GetGpuTemp(string gpuName)\r\n {\r\n try\r\n {\r\n var myComputer = new Computer();\r\n myComputer.Open();\r\n //possible fix for gpu temps on laptops\r\n myComputer.GPUEnabled = true;\r\n float temp = -1;\r\n foreach (var hardwareItem in myComputer.Hardware)\r\n {\r\n hardwareItem.Update();\r\n switch (hardwareItem.HardwareType)\r\n {\r\n case HardwareType.GpuNvidia:\r\n foreach (\r\n var sensor in\r\n hardwareItem.Sensors.Where(\r\n sensor =>\r\n sensor.SensorType == SensorType.Temperature &&\r\n hardwareItem.Name.Contains(gpuName)))\r\n {\r\n if (sensor.Value != null)\r\n {\r\n temp = (float)sensor.Value;\r\n }\r\n }\r\n break;\r\n case HardwareType.GpuAti:\r\n foreach (\r\n var sensor in\r\n hardwareItem.Sensors.Where(\r\n sensor =>\r\n sensor.SensorType == SensorType.Temperature &&\r\n hardwareItem.Name.Contains(gpuName)))\r\n {\r\n if (sensor.Value != null)\r\n {\r\n temp = (float)sensor.Value;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n myComputer.Close();\r\n return temp;\r\n }\r\n catch (AccessViolationException)\r\n {\r\n return -1;\r\n }\r\n }\r", "label": 1, "label_name": "safe"} +{"code": " private function runCallback() {\n foreach ($this->records as &$record) {\n if (isset($record->ref_type)) {\n $refType = $record->ref_type;\n if (class_exists($record->ref_type)) {\n $type = new $refType();\n $classinfo = new ReflectionClass($type);\n if ($classinfo->hasMethod('paginationCallback')) {\n $item = new $type($record->original_id);\n $item->paginationCallback($record);\n }\n }\n }\n } \n }", "label": 0, "label_name": "vulnerable"} +{"code": "static void setup_namespaces(struct lo_data *lo, struct fuse_session *se)\n{\n pid_t child;\n\n /*\n * Create a new pid namespace for *child* processes. We'll have to\n * fork in order to enter the new pid namespace. A new mount namespace\n * is also needed so that we can remount /proc for the new pid\n * namespace.\n *\n * Our UNIX domain sockets have been created. Now we can move to\n * an empty network namespace to prevent TCP/IP and other network\n * activity in case this process is compromised.\n */\n if (unshare(CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWNET) != 0) {\n fuse_log(FUSE_LOG_ERR, \"unshare(CLONE_NEWPID | CLONE_NEWNS): %m\\n\");\n exit(1);\n }\n\n child = fork();\n if (child < 0) {\n fuse_log(FUSE_LOG_ERR, \"fork() failed: %m\\n\");\n exit(1);\n }\n if (child > 0) {\n pid_t waited;\n int wstatus;\n\n setup_wait_parent_capabilities();\n\n /* The parent waits for the child */\n do {\n waited = waitpid(child, &wstatus, 0);\n } while (waited < 0 && errno == EINTR && !se->exited);\n\n /* We were terminated by a signal, see fuse_signals.c */\n if (se->exited) {\n exit(0);\n }\n\n if (WIFEXITED(wstatus)) {\n exit(WEXITSTATUS(wstatus));\n }\n\n exit(1);\n }\n\n /* Send us SIGTERM when the parent thread terminates, see prctl(2) */\n prctl(PR_SET_PDEATHSIG, SIGTERM);\n\n /*\n * If the mounts have shared propagation then we want to opt out so our\n * mount changes don't affect the parent mount namespace.\n */\n if (mount(NULL, \"/\", NULL, MS_REC | MS_SLAVE, NULL) < 0) {\n fuse_log(FUSE_LOG_ERR, \"mount(/, MS_REC|MS_SLAVE): %m\\n\");\n exit(1);\n }\n\n /* The child must remount /proc to use the new pid namespace */\n if (mount(\"proc\", \"/proc\", \"proc\",\n MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) {\n fuse_log(FUSE_LOG_ERR, \"mount(/proc): %m\\n\");\n exit(1);\n }\n\n /*\n * We only need /proc/self/fd. Prevent \"..\" from accessing parent\n * directories of /proc/self/fd by bind-mounting it over /proc. Since / was\n * previously remounted with MS_REC | MS_SLAVE this mount change only\n * affects our process.\n */\n if (mount(\"/proc/self/fd\", \"/proc\", NULL, MS_BIND, NULL) < 0) {\n fuse_log(FUSE_LOG_ERR, \"mount(/proc/self/fd, MS_BIND): %m\\n\");\n exit(1);\n }\n\n /* Get the /proc (actually /proc/self/fd, see above) file descriptor */\n lo->proc_self_fd = open(\"/proc\", O_PATH);\n if (lo->proc_self_fd == -1) {\n fuse_log(FUSE_LOG_ERR, \"open(/proc, O_PATH): %m\\n\");\n exit(1);\n }\n}", "label": 1, "label_name": "safe"} +{"code": " public function setContainer($container)\n {\n $this->container = $container;\n $container->setType(Container::TYPE_LINKS);\n }", "label": 1, "label_name": "safe"} +{"code": "\tprivate static function getTemplateParmValues( $text, $template ) {\n\t\t$matches = [];\n\t\t$noMatches = preg_match_all( '/\\{\\{\\s*' . preg_quote( $template, '/' ) . '\\s*[|}]/i', $text, $matches, PREG_OFFSET_CAPTURE );\n\n\t\tif ( $noMatches <= 0 ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$textLen = strlen( $text );\n\t\t$tval = [];\n\t\t$call = -1;\n\n\t\tforeach ( $matches as $matchA ) {\n\t\t\tforeach ( $matchA as $matchB ) {\n\t\t\t\t$match = $matchB[0];\n\t\t\t\t$start = $matchB[1];\n\t\t\t\t$tval[++$call] = [];\n\t\t\t\t$nr = 0;\n\t\t\t\t$parmValue = '';\n\t\t\t\t$parmName = '';\n\t\t\t\t$parm = '';\n\n\t\t\t\tif ( $match[strlen( $match ) - 1] == '}' ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// search to the end of the template call\n\t\t\t\t$cbrackets = 2;\n\n\t\t\t\tfor ( $i = $start + strlen( $match ); $i < $textLen; $i++ ) {\n\t\t\t\t\t$c = $text[$i];\n\t\t\t\t\tif ( $c == '{' || $c == '[' ) {\n\t\t\t\t\t\t$cbrackets++;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( $c == '}' || $c == ']' ) {\n\t\t\t\t\t\t$cbrackets--;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( $cbrackets == 2 && $c == '|' ) || ( $cbrackets == 1 && $c == '}' ) ) {\n\t\t\t\t\t\t// parameter (name or value) found\n\t\t\t\t\t\tif ( $parmName == '' ) {\n\t\t\t\t\t\t\t$tval[$call][++$nr] = trim( $parm );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$tval[$call][$parmName] = trim( $parmValue );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$parmName = '';\n\t\t\t\t\t\t$parmValue = '';\n\t\t\t\t\t\t$parm = '';\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( $parmName == '' ) {\n\t\t\t\t\t\t\tif ( $c == '=' ) {\n\t\t\t\t\t\t\t\t$parmName = trim( $parm );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$parmValue .= $c;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$parm .= $c;\n\t\t\t\t\tif ( $cbrackets == 0 ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $tval;\n\t}", "label": 1, "label_name": "safe"} +{"code": "Context.prototype.timeout = function(ms) {\n this.runnable().timeout(ms);\n return this;\n};", "label": 1, "label_name": "safe"} +{"code": " protected function getCustomFilter(array $project)\n {\n $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));\n\n if (empty($filter)) {\n throw new PageNotFoundException();\n }\n\n if ($filter['project_id'] != $project['id']) {\n throw new AccessForbiddenException();\n }\n\n return $filter;\n }", "label": 1, "label_name": "safe"} +{"code": " public function testAuthHeader()\n {\n $GLOBALS['cfg']['LoginCookieDeleteAll'] = false;\n $GLOBALS['cfg']['Servers'] = array(1);\n\n $restoreInstance = PMA\\libraries\\Response::getInstance();\n\n $mockResponse = $this->getMockBuilder('PMA\\libraries\\Response')\n ->disableOriginalConstructor()\n ->setMethods(array('isAjax', 'headersSent', 'header'))\n ->getMock();\n\n $mockResponse->expects($this->any())\n ->method('headersSent')\n ->with()\n ->will($this->returnValue(false));\n\n $mockResponse->expects($this->once())\n ->method('header')\n ->with('Location: http://www.phpmyadmin.net/logout' . ((SID) ? '?' . SID : ''));", "label": 1, "label_name": "safe"} +{"code": "void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)\n{\n\tstruct nci_dev *ndev = priv->ndev;\n\n\tif (priv->ndev->nfc_dev->fw_download_in_progress)\n\t\tnfcmrvl_fw_dnld_abort(priv);\n\n\tnfcmrvl_fw_dnld_deinit(priv);\n\n\tif (gpio_is_valid(priv->config.reset_n_io))\n\t\tgpio_free(priv->config.reset_n_io);\n\n\tnci_unregister_device(ndev);\n\tnci_free_device(ndev);\n\tkfree(priv);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tfunction GetXMLRequestEnvelope()\n\t{\n\t\t$XML = '';\n\t\t$XML .= '' . $this -> DetailLevel . '';\n\t\t$XML .= '' . $this -> ErrorLanguage . '';\n\t\t$XML .= '';\n\t\t\n\t\treturn $XML;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function mb_list_encodings()\n {\n return array('UTF-8');\n }", "label": 1, "label_name": "safe"} +{"code": "const set = (obj, path, val, options = {}) => {\n\tlet internalPath = path,\n\t\tobjPart;\n\t\n\toptions = {\n\t\t\"transformRead\": returnWhatWasGiven,\n\t\t\"transformKey\": returnWhatWasGiven,\n\t\t\"transformWrite\": returnWhatWasGiven,\n\t\t...options\n\t};\n\t\n\t// No object data\n\tif (obj === undefined || obj === null) {\n\t\treturn;\n\t}\n\t\n\t// No path string\n\tif (!internalPath) {\n\t\treturn;\n\t}\n\t\n\tinternalPath = clean(internalPath);\n\t\n\t// Path is not a string, throw error\n\tif (typeof internalPath !== \"string\") {\n\t\tthrow new Error(\"Path argument must be a string\");\n\t}\n\t\n\tif (typeof obj !== \"object\") {\n\t\treturn;\n\t}\n\t\n\t// Path has no dot-notation, set key/value\n\tif (isNonCompositePath(internalPath)) {\n\t\t// Do not allow prototype pollution\n\t\tif (internalPath === \"__proto__\") return obj;\n\n\t\tobj = decouple(obj, options);\n\t\tobj[options.transformKey(unEscape(internalPath))] = val;\n\t\treturn obj;\n\t}\n\t\n\tconst newObj = decouple(obj, options);\n\tconst pathParts = split(internalPath);\n\tconst pathPart = pathParts.shift();\n\tconst transformedPathPart = options.transformKey(pathPart);\n\n\t// Do not allow prototype pollution\n\tif (transformedPathPart === \"__proto__\") return obj;\n\n\tlet childPart = newObj[transformedPathPart];\n\t\n\tif (typeof childPart !== \"object\") {\n\t\t// Create an object or array on the path\n\t\tif (String(parseInt(transformedPathPart, 10)) === transformedPathPart) {\n\t\t\t// This is an array index\n\t\t\tnewObj[transformedPathPart] = [];\n\t\t} else {\n\t\t\tnewObj[transformedPathPart] = {};\n\t\t}\n\t\t\n\t\tobjPart = newObj[transformedPathPart];\n\t} else {\n\t\tobjPart = childPart;\n\t}\n\t\n\treturn set(newObj, transformedPathPart, set(objPart, pathParts.join('.'), val, options), options);\n};", "label": 1, "label_name": "safe"} +{"code": " public void iteratorShouldReturnAllNameValuePairs() {\n final HttpHeadersBase headers1 = newEmptyHeaders();\n headers1.add(\"name1\", \"value1\", \"value2\");\n headers1.add(\"name2\", \"value3\");\n headers1.add(\"name3\", \"value4\", \"value5\", \"value6\");\n headers1.add(\"name1\", \"value7\", \"value8\");\n assertThat(headers1.size()).isEqualTo(8);\n\n final HttpHeadersBase headers2 = newEmptyHeaders();\n for (Map.Entry entry : headers1) {\n headers2.add(entry.getKey(), entry.getValue());\n }\n\n assertThat(headers2).isEqualTo(headers1);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "module.exports = async function(destination, { hard = true } = {}) {\n\tif (destination && typeof destination === 'string') {\n\t\treturn await exec(`git reset ${JSON.stringify(destination)} ${hard ? '--hard' : ''}`);\n\t}\n\n\tif (destination && typeof destination === 'number') {\n\t\treturn await exec(`git reset HEAD~${Math.abs(destination)} ${hard ? '--hard' : ''}`);\n\t}\n\n\tthrow new TypeError(`No case for handling destination ${destination} (${typeof destination})`);\n};", "label": 0, "label_name": "vulnerable"} +{"code": " public function get_discount_type()\n {\n if (empty($this->coupon_data)) {\n return false;\n }\n\n return $this->coupon_data['discount_type'];\n }", "label": 0, "label_name": "vulnerable"} +{"code": "Jsi_RC jsi_ArgTypeCheck(Jsi_Interp *interp, int typ, Jsi_Value *arg, const char *p1,\n const char *p2, int index, Jsi_Func *func, bool isdefault) {\n Jsi_RC rc = JSI_OK;\n char idxBuf[JSI_MAX_NUMBER_STRING*2];\n idxBuf[0] = 0;\n if (func && arg->vt == JSI_VT_UNDEF && !interp->typeCheck.noundef && index>0 && !isdefault && !(typ&JSI_TT_UNDEFINED)) {\n snprintf(idxBuf, sizeof(idxBuf), \" arg %d\", index);\n jsi_TypeMismatch(interp);\n \n Jsi_DString fStr = {};\n rc = Jsi_LogType(\"call with undefined var %s%s '%s'%s\", p1, idxBuf, p2, jsiFuncInfo(interp, &fStr, func, arg));\n Jsi_DSFree(&fStr);\n return rc;\n }\n if (typ <= 0)\n return JSI_OK;\n //if (typ&JSI_TT_VOID)\n // return JSI_OK;\n if (interp->typeCheck.all==0) {\n if (func ? (interp->typeCheck.run==0) : (interp->typeCheck.parse==0))\n return JSI_OK;\n }\n if (index == 0 && func && func->type == FC_BUILDIN && \n interp->typeCheck.all == 0) // Normally do not check return types for builtins.\n return JSI_OK; \n if ((typ&JSI_TT_ANY)) return JSI_OK;\n if (index == 0 && arg->vt == JSI_VT_UNDEF) {\n if (!(typ&JSI_TT_VOID)) \n goto done;\n return JSI_OK;\n }\n if (isdefault && index && typ&JSI_TT_VOID && arg->vt == JSI_VT_UNDEF)\n return JSI_OK;\n if (typ&JSI_TT_UNDEFINED && Jsi_ValueIsUndef(interp, arg)) return rc;\n if (typ&JSI_TT_NUMBER && Jsi_ValueIsNumber(interp, arg)) return rc;\n if (typ&JSI_TT_STRING && Jsi_ValueIsString(interp, arg)) return rc;\n if (typ&JSI_TT_BOOLEAN && Jsi_ValueIsBoolean(interp, arg)) return rc;\n if (typ&JSI_TT_ARRAY && Jsi_ValueIsArray(interp, arg)) return rc;\n if (typ&JSI_TT_FUNCTION && Jsi_ValueIsFunction(interp, arg)) return rc;\n if (typ&JSI_TT_REGEXP && Jsi_ValueIsObjType(interp, arg, JSI_OT_REGEXP)) return rc;\n if (typ&JSI_TT_USEROBJ && Jsi_ValueIsObjType(interp, arg, JSI_OT_USEROBJ)) return rc;\n if (typ&JSI_TT_ITEROBJ && Jsi_ValueIsObjType(interp, arg, JSI_OT_ITER)) return rc;\n if (typ&JSI_TT_OBJECT && (\n Jsi_ValueIsObjType(interp, arg, JSI_OT_OBJECT) && Jsi_ValueIsArray(interp, arg)==0))\n return rc;\n if (typ&JSI_TT_NULL && Jsi_ValueIsNull(interp, arg)) return rc;\ndone:\n {\n Jsi_DString dStr = {};\n const char *exp = jsi_typeName(interp, typ, &dStr);\n const char *vtyp = jsi_ValueTypeName(interp, arg);\n if (index>0)\n snprintf(idxBuf, sizeof(idxBuf), \" arg %d\", index);\n if (interp->typeCheck.error)\n rc = JSI_ERROR;\n jsi_TypeMismatch(interp);\n Jsi_DString fStr = {};\n rc = Jsi_LogType(\"type mismatch %s%s '%s': expected \\\"%s\\\" but got \\\"%s\\\"%s\",\n p1, idxBuf, p2, exp, vtyp, jsiFuncInfo(interp, &fStr, func, arg));\n Jsi_DSFree(&fStr);\n Jsi_DSFree(&dStr);\n }\n return rc;\n}", "label": 1, "label_name": "safe"} +{"code": " function manage() {\n expHistory::set('viewable', $this->params);\n // $category = new storeCategory();\n // $categories = $category->getFullTree();\n // \n // // foreach($categories as $i=>$val){\n // // if (!empty($this->values) && in_array($val->id,$this->values)) {\n // // $this->tags[$i]->value = true;\n // // } else {\n // // $this->tags[$i]->value = false;\n // // }\n // // $this->tags[$i]->draggable = $this->draggable; \n // // $this->tags[$i]->checkable = $this->checkable; \n // // }\n //\n // $obj = json_encode($categories); \n }", "label": 0, "label_name": "vulnerable"} +{"code": " constructor() {\n super();\n\n this.name = this.constructor.name + counter;\n counter += 1;\n\n this._timerId = null;\n this._timeout = 30000; // 30 seconds timeout\n this._socket = null;\n this.headerSize = 8;\n this.protocolVersion = 0;\n\n this._disconnecting = false;\n this._pendingBuffer = undefined;\n\n this.bytesWritten = 0;\n this.bytesRead = 0;\n\n this._theCallback = undefined;\n this.chunkWrittenCount = 0;\n this.chunkReadCount = 0;\n\n this._onSocketClosedHasBeenCalled = false;\n this._onSocketEndedHasBeenCalled = false;\n TCP_transport.registry.register(this);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def nextRandomLong(min: Int = 0): Long = {\n require(min < Long.MaxValue / 2, \"TyE4KGKRY\")\n var result = 0L\n do {\n result = _random.nextLong()\n }\n while (result < min)\n result\n }\n\n\n /** Generates a 130 bit string, almost 26 chars long since each char in a 32 chars\n * alphabet has 5 bits (but we use 36 chars here).\n * Wikipedia says: \"128-bit keys are commonly used and considered very strong\".\n * Here: http://en.wikipedia.org/wiki/Key_(cryptography)\n */\n def nextRandomString(): String =", "label": 0, "label_name": "vulnerable"} +{"code": "iperf_json_printf(const char *format, ...)\n{\n cJSON* o;\n va_list argp;\n const char *cp;\n char name[100];\n char* np;\n cJSON* j;\n\n o = cJSON_CreateObject();\n if (o == NULL)\n return NULL;\n va_start(argp, format);\n np = name;\n for (cp = format; *cp != '\\0'; ++cp) {\n\tswitch (*cp) {\n\t case ' ':\n\t break;\n\t case ':':\n\t *np = '\\0';\n\t break;\n\t case '%':\n\t ++cp;\n\t switch (*cp) {\n\t\tcase 'b':\n\t\tj = cJSON_CreateBool(va_arg(argp, int));\n\t\tbreak;\n\t\tcase 'd':\n\t\tj = cJSON_CreateInt(va_arg(argp, int64_t));\n\t\tbreak;\n\t\tcase 'f':\n\t\tj = cJSON_CreateFloat(va_arg(argp, double));\n\t\tbreak;\n\t\tcase 's':\n\t\tj = cJSON_CreateString(va_arg(argp, char *));\n\t\tbreak;\n\t\tdefault:\n\t\treturn NULL;\n\t }\n\t if (j == NULL)\n\t\treturn NULL;\n\t cJSON_AddItemToObject(o, name, j);\n\t np = name;\n\t break;\n\t default:\n\t *np++ = *cp;\n\t break;\n\t}\n }\n va_end(argp);\n return o;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "this.editingHandler);L=this.graph.getLinkForCell(this.state.cell);M=this.graph.getLinksForState(this.state);this.updateLinkHint(L,M);if(null!=L||null!=M&&0name));\n\tif (ioc->events == NULL) {\n\t\t/* Have not yet allocated memory - do so now.\n\t\t */\n\t\tint sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS);\n\t\tioc->events = kzalloc(sz, GFP_KERNEL);\n\t\tif (!ioc->events) {\n\t\t\tprintk(MYIOC_s_ERR_FMT\n\t\t\t \": ERROR - Insufficient memory to add adapter!\\n\",\n\t\t\t ioc->name);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t\tioc->alloc_total += sz;\n\n\t\tioc->eventContext = 0;\n }\n\n\t/* Update the IOC event logging flag.\n\t */\n\tioc->eventTypes = karg.eventTypes;\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def path_exists?\n File.directory?(@resource.value(:path))\n end", "label": 0, "label_name": "vulnerable"} +{"code": "const TfLiteTensor* GetIntermediates(TfLiteContext* context,\n const TfLiteNode* node, int index) {\n const int tensor_index = ValidateTensorIndexing(\n context, index, node->intermediates->size, node->intermediates->data);\n if (tensor_index < 0) {\n return nullptr;\n }\n return GetTensorAtIndex(context, tensor_index);\n}", "label": 1, "label_name": "safe"} +{"code": "static int airspy_probe(struct usb_interface *intf,\n\t\tconst struct usb_device_id *id)\n{\n\tstruct airspy *s;\n\tint ret;\n\tu8 u8tmp, buf[BUF_SIZE];\n\n\ts = kzalloc(sizeof(struct airspy), GFP_KERNEL);\n\tif (s == NULL) {\n\t\tdev_err(&intf->dev, \"Could not allocate memory for state\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tmutex_init(&s->v4l2_lock);\n\tmutex_init(&s->vb_queue_lock);\n\tspin_lock_init(&s->queued_bufs_lock);\n\tINIT_LIST_HEAD(&s->queued_bufs);\n\ts->dev = &intf->dev;\n\ts->udev = interface_to_usbdev(intf);\n\ts->f_adc = bands[0].rangelow;\n\ts->f_rf = bands_rf[0].rangelow;\n\ts->pixelformat = formats[0].pixelformat;\n\ts->buffersize = formats[0].buffersize;\n\n\t/* Detect device */\n\tret = airspy_ctrl_msg(s, CMD_BOARD_ID_READ, 0, 0, &u8tmp, 1);\n\tif (ret == 0)\n\t\tret = airspy_ctrl_msg(s, CMD_VERSION_STRING_READ, 0, 0,\n\t\t\t\tbuf, BUF_SIZE);\n\tif (ret) {\n\t\tdev_err(s->dev, \"Could not detect board\\n\");\n\t\tgoto err_free_mem;\n\t}\n\n\tbuf[BUF_SIZE - 1] = '\\0';\n\n\tdev_info(s->dev, \"Board ID: %02x\\n\", u8tmp);\n\tdev_info(s->dev, \"Firmware version: %s\\n\", buf);\n\n\t/* Init videobuf2 queue structure */\n\ts->vb_queue.type = V4L2_BUF_TYPE_SDR_CAPTURE;\n\ts->vb_queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ;\n\ts->vb_queue.drv_priv = s;\n\ts->vb_queue.buf_struct_size = sizeof(struct airspy_frame_buf);\n\ts->vb_queue.ops = &airspy_vb2_ops;\n\ts->vb_queue.mem_ops = &vb2_vmalloc_memops;\n\ts->vb_queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;\n\tret = vb2_queue_init(&s->vb_queue);\n\tif (ret) {\n\t\tdev_err(s->dev, \"Could not initialize vb2 queue\\n\");\n\t\tgoto err_free_mem;\n\t}\n\n\t/* Init video_device structure */\n\ts->vdev = airspy_template;\n\ts->vdev.queue = &s->vb_queue;\n\ts->vdev.queue->lock = &s->vb_queue_lock;\n\tvideo_set_drvdata(&s->vdev, s);\n\n\t/* Register the v4l2_device structure */\n\ts->v4l2_dev.release = airspy_video_release;\n\tret = v4l2_device_register(&intf->dev, &s->v4l2_dev);\n\tif (ret) {\n\t\tdev_err(s->dev, \"Failed to register v4l2-device (%d)\\n\", ret);\n\t\tgoto err_free_mem;\n\t}\n\n\t/* Register controls */\n\tv4l2_ctrl_handler_init(&s->hdl, 5);\n\ts->lna_gain_auto = v4l2_ctrl_new_std(&s->hdl, &airspy_ctrl_ops,\n\t\t\tV4L2_CID_RF_TUNER_LNA_GAIN_AUTO, 0, 1, 1, 0);\n\ts->lna_gain = v4l2_ctrl_new_std(&s->hdl, &airspy_ctrl_ops,\n\t\t\tV4L2_CID_RF_TUNER_LNA_GAIN, 0, 14, 1, 8);\n\tv4l2_ctrl_auto_cluster(2, &s->lna_gain_auto, 0, false);\n\ts->mixer_gain_auto = v4l2_ctrl_new_std(&s->hdl, &airspy_ctrl_ops,\n\t\t\tV4L2_CID_RF_TUNER_MIXER_GAIN_AUTO, 0, 1, 1, 0);\n\ts->mixer_gain = v4l2_ctrl_new_std(&s->hdl, &airspy_ctrl_ops,\n\t\t\tV4L2_CID_RF_TUNER_MIXER_GAIN, 0, 15, 1, 8);\n\tv4l2_ctrl_auto_cluster(2, &s->mixer_gain_auto, 0, false);\n\ts->if_gain = v4l2_ctrl_new_std(&s->hdl, &airspy_ctrl_ops,\n\t\t\tV4L2_CID_RF_TUNER_IF_GAIN, 0, 15, 1, 0);\n\tif (s->hdl.error) {\n\t\tret = s->hdl.error;\n\t\tdev_err(s->dev, \"Could not initialize controls\\n\");\n\t\tgoto err_free_controls;\n\t}\n\n\tv4l2_ctrl_handler_setup(&s->hdl);\n\n\ts->v4l2_dev.ctrl_handler = &s->hdl;\n\ts->vdev.v4l2_dev = &s->v4l2_dev;\n\ts->vdev.lock = &s->v4l2_lock;\n\n\tret = video_register_device(&s->vdev, VFL_TYPE_SDR, -1);\n\tif (ret) {\n\t\tdev_err(s->dev, \"Failed to register as video device (%d)\\n\",\n\t\t\t\tret);\n\t\tgoto err_unregister_v4l2_dev;\n\t}\n\tdev_info(s->dev, \"Registered as %s\\n\",\n\t\t\tvideo_device_node_name(&s->vdev));\n\tdev_notice(s->dev, \"SDR API is still slightly experimental and functionality changes may follow\\n\");\n\treturn 0;\n\nerr_free_controls:\n\tv4l2_ctrl_handler_free(&s->hdl);\nerr_unregister_v4l2_dev:\n\tv4l2_device_unregister(&s->v4l2_dev);\nerr_free_mem:\n\tkfree(s);\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " }) => Awaitable\n /**\n * By default, we are generating a random verification token.\n * You can make it predictable or modify it as you like with this method.\n * @example\n * ```js\n * Providers.Email({\n * async generateVerificationToken() {\n * return \"ABC123\"\n * }\n * })\n * ```\n * [Documentation](https://next-auth.js.org/providers/email#customising-the-verification-token)\n */\n generateVerificationToken?: () => Awaitable", "label": 0, "label_name": "vulnerable"} +{"code": " def address\n \"#{@host}:#{@port}\"\n end", "label": 1, "label_name": "safe"} +{"code": " public function testCannotRetrieveStreamAfterMove()\n {\n $stream = \\GuzzleHttp\\Psr7\\stream_for('Foo bar!');\n $upload = new UploadedFile($stream, 0, UPLOAD_ERR_OK);\n\n $this->cleanup[] = $to = tempnam(sys_get_temp_dir(), 'diac');\n $upload->moveTo($to);\n $this->assertFileExists($to);\n\n $this->setExpectedException('RuntimeException', 'moved');\n $upload->getStream();\n }", "label": 1, "label_name": "safe"} +{"code": " async def on_GET(self, origin, content, query, room_id, user_id):\n content = await self.handler.on_make_leave_request(origin, room_id, user_id)\n return 200, content", "label": 1, "label_name": "safe"} +{"code": " protected TestPolicy(Policy.ParseContext parseContext) {\n super(parseContext);\n }", "label": 1, "label_name": "safe"} +{"code": " $contents[] = ['class' => 'text-center', 'text' => '
        ' . tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('languages.php', 'page=' . (int)$_GET['page'] . '&lID=' . $lInfo->languages_id), null, null, 'btn-light')];", "label": 1, "label_name": "safe"} +{"code": "\tpublic function approve_submit() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('No ID supplied for comment to approve'));\n\t expHistory::back();\n\t }\n \n /* The global constants can be overriden by passing appropriate params */ \n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];\n\t \n\t $comment = new expComment($this->params['id']);\n\t $comment->body = $this->params['body'];\n\t $comment->approved = $this->params['approved'];\n\t $comment->save();\n\t expHistory::back();\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "def _is_javascript_scheme(s):\n if _is_image_dataurl(s):\n return None\n return _is_possibly_malicious_scheme(s)", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* params;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kParams, ¶ms));\n const TfLiteTensor* indices;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kIndices, &indices));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n switch (params->type) {\n case kTfLiteFloat32:\n case kTfLiteUInt8:\n case kTfLiteInt8:\n case kTfLiteInt64:\n case kTfLiteInt32:\n case kTfLiteString:\n break;\n default:\n context->ReportError(\n context, \"Params of type '%s' are not supported by gather_nd.\",\n TfLiteTypeGetName(params->type));\n return kTfLiteError;\n }\n switch (indices->type) {\n case kTfLiteInt64:\n case kTfLiteInt32:\n break;\n default:\n context->ReportError(\n context, \"Indices of type '%s' are not supported by gather_nd.\",\n TfLiteTypeGetName(indices->type));\n return kTfLiteError;\n }\n\n const int params_rank = NumDimensions(params);\n const int indices_rank = NumDimensions(indices);\n const int indices_nd = SizeOfDimension(indices, indices_rank - 1);\n if (params_rank < 1) {\n context->ReportError(context, \"Params must be at least a vector.\");\n return kTfLiteError;\n }\n if (indices_rank < 1) {\n context->ReportError(context, \"Indices must be at least a vector.\");\n return kTfLiteError;\n }\n if (indices_nd > params_rank) {\n context->ReportError(\n context, \"Index innermost dimension length must be <= params rank.\");\n return kTfLiteError;\n }\n\n // Assign to output the input type.\n output->type = params->type;\n\n // The result shape is\n // indices.shape[:-1] + params.shape[indices.shape[-1]:]\n const int output_rank = indices_rank + params_rank - indices_nd - 1;\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(output_rank);\n int output_index = 0;\n for (int i = 0; i < indices_rank - 1; ++i) {\n output_shape->data[output_index++] = indices->dims->data[i];\n }\n for (int i = indices_nd; i < params_rank; ++i) {\n output_shape->data[output_index++] = params->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}", "label": 1, "label_name": "safe"} +{"code": "def test_adjust_timeout():\n mw = _get_mw()\n req1 = scrapy.Request(\"http://example.com\", meta = {\n 'splash': {'args': {'timeout': 60, 'html': 1}},\n\n # download_timeout is always present,\n # it is set by DownloadTimeoutMiddleware\n 'download_timeout': 30,\n })\n req1 = mw.process_request(req1, None)\n assert req1.meta['download_timeout'] > 60\n\n req2 = scrapy.Request(\"http://example.com\", meta = {\n 'splash': {'args': {'html': 1}},\n 'download_timeout': 30,\n })\n req2 = mw.process_request(req2, None)\n assert req2.meta['download_timeout'] == 30", "label": 0, "label_name": "vulnerable"} +{"code": "ber_parse_header(STREAM s, int tagval, uint32 *length)\n{\n\tint tag, len;\n\n\tif (tagval > 0xff)\n\t{\n\t\tin_uint16_be(s, tag);\n\t}\n\telse\n\t{\n\t\tin_uint8(s, tag);\n\t}\n\n\tif (tag != tagval)\n\t{\n\t\tlogger(Core, Error, \"ber_parse_header(), expected tag %d, got %d\", tagval, tag);\n\t\treturn False;\n\t}\n\n\tin_uint8(s, len);\n\n\tif (len & 0x80)\n\t{\n\t\tlen &= ~0x80;\n\t\t*length = 0;\n\t\twhile (len--)\n\t\t\tnext_be(s, *length);\n\t}\n\telse\n\t\t*length = len;\n\n\treturn s_check(s);\n}", "label": 1, "label_name": "safe"} +{"code": "d.parent(\".dropdown-menu\").length&&(d=d.closest(\"li.dropdown\").addClass(\"active\")),d.trigger(\"activate.bs.scrollspy\")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,\".active\").removeClass(\"active\")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on(\"load.bs.scrollspy.data-api\",function(){a('[data-spy=\"scroll\"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.tab\");e||d.data(\"bs.tab\",e=new c(this)),\"string\"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION=\"3.3.6\",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest(\"ul:not(.dropdown-menu)\"),d=b.data(\"target\");if(d||(d=b.attr(\"href\"),d=d&&d.replace(/.*(?=#[^\\s]*$)/,\"\")),!b.parent(\"li\").hasClass(\"active\")){var e=c.find(\".active:last a\"),f=a.Event(\"hide.bs.tab\",{relatedTarget:b[0]}),g=a.Event(\"show.bs.tab\",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest(\"li\"),c),this.activate(h,h.parent(),function(){e.trigger({type:\"hidden.bs.tab\",relatedTarget:b[0]}),b.trigger({type:\"shown.bs.tab\",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass(\"active\").find(\"> .dropdown-menu > .active\").removeClass(\"active\").end().find('[data-toggle=\"tab\"]').attr(\"aria-expanded\",!1),b.addClass(\"active\").find('[data-toggle=\"tab\"]').attr(\"aria-expanded\",!0),h?(b[0].offsetWidth,b.addClass(\"in\")):b.removeClass(\"fade\"),b.parent(\".dropdown-menu\").length&&b.closest(\"li.dropdown\").addClass(\"active\").end().find('[data-toggle=\"tab\"]').attr(\"aria-expanded\",!0),e&&e()}var g=d.find(\"> .active\"),h=e&&a.support.transition&&(g.length&&g.hasClass(\"fade\")||!!d.find(\"> .fade\").length);g.length&&h?g.one(\"bsTransitionEnd\",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass(\"in\")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),\"show\")};a(document).on(\"click.bs.tab.data-api\",'[data-toggle=\"tab\"]',e).on(\"click.bs.tab.data-api\",'[data-toggle=\"pill\"]',e)}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.affix\"),f=\"object\"==typeof b&&b;e||d.data(\"bs.affix\",e=new c(this,f)),\"string\"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on(\"scroll.bs.affix.data-api\",a.proxy(this.checkPosition,this)).on(\"click.bs.affix.data-api\",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION=\"3.3.6\",c.RESET=\"affix affix-top affix-bottom\",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&\"top\"==this.affixed)return c>e?\"top\":!1;if(\"bottom\"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:\"bottom\":a-d>=e+g?!1:\"bottom\";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?\"top\":null!=d&&i+j>=a-d?\"bottom\":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass(\"affix\");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(\":visible\")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());\"object\"!=typeof d&&(f=e=d),\"function\"==typeof e&&(e=d.top(this.$element)),\"function\"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css(\"top\",\"\");var i=\"affix\"+(h?\"-\"+h:\"\"),j=a.Event(i+\".bs.affix\");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin=\"bottom\"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace(\"affix\",\"affixed\")+\".bs.affix\")}\"bottom\"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on(\"load\",function(){a('[data-spy=\"affix\"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);", "label": 0, "label_name": "vulnerable"} +{"code": " function reset_stats() {\n// global $db;\n\n // reset the counters\n// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');\n banner::resetImpressions();\n// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');\n banner::resetClicks();\n\n // let the user know we did stuff.\n flash('message', gt(\"Banner statistics reset.\"));\n expHistory::back();\n }", "label": 1, "label_name": "safe"} +{"code": "function(){e.handleFileSuccess(\"manual\"==DrawioFile.SYNC)}),mxUtils.bind(this,function(g){e.handleFileError(g,!0)}))))};EditorUi.prototype.getFileData=function(c,e,g,k,m,q,v,x,A,z,L){m=null!=m?m:!0;q=null!=q?q:!1;var M=this.editor.graph;if(e||!c&&null!=A&&/(\\.svg)$/i.test(A.getTitle())){var n=null!=M.themes&&\"darkTheme\"==M.defaultThemeName;z=!1;if(n||null!=this.pages&&this.currentPage!=this.pages[0]){var y=M.getGlobalVariable;M=this.createTemporaryGraph(n?M.getDefaultStylesheet():M.getStylesheet());\nM.setBackgroundImage=this.editor.graph.setBackgroundImage;M.background=this.editor.graph.background;var K=this.pages[0];this.currentPage==K?M.setBackgroundImage(this.editor.graph.backgroundImage):null!=K.viewState&&null!=K.viewState&&M.setBackgroundImage(K.viewState.backgroundImage);M.getGlobalVariable=function(B){return\"page\"==B?K.getName():\"pagenumber\"==B?1:y.apply(this,arguments)};document.body.appendChild(M.container);M.model.setRoot(K.root)}}v=null!=v?v:this.getXmlFileData(m,q,z,L);A=null!=A?\nA:this.getCurrentFile();c=this.createFileData(v,M,A,window.location.href,c,e,g,k,m,x,z);M!=this.editor.graph&&M.container.parentNode.removeChild(M.container);return c};EditorUi.prototype.getHtml=function(c,e,g,k,m,q){q=null!=q?q:!0;var v=null,x=EditorUi.drawHost+\"/js/embed-static.min.js\";if(null!=e){v=q?e.getGraphBounds():e.getBoundingBox(e.getSelectionCells());var A=e.view.scale;q=Math.floor(v.x/A-e.view.translate.x);A=Math.floor(v.y/A-e.view.translate.y);v=e.background;null==m&&(e=this.getBasenames().join(\";\"),", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input));\n const TfLiteTensor* fft_length;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kFftLengthTensor, &fft_length));\n const int32_t* fft_length_data = GetTensorData(fft_length);\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n if (output->type != kTfLiteComplex64) {\n context->ReportError(context,\n \"Type '%s' for output is not supported by rfft2d.\",\n TfLiteTypeGetName(output->type));\n return kTfLiteError;\n }\n\n // Resize the output tensor if the fft_length tensor is not constant.\n // Otherwise, check if the output shape is correct.\n if (!IsConstantTensor(fft_length)) {\n TF_LITE_ENSURE_STATUS(ResizeOutputandTemporaryTensors(context, node));\n } else {\n int num_dims_output = NumDimensions(output);\n const RuntimeShape output_shape = GetTensorShape(output);\n TF_LITE_ENSURE_EQ(context, num_dims_output, NumDimensions(input));\n TF_LITE_ENSURE(context, num_dims_output >= 2);\n TF_LITE_ENSURE_EQ(context, output_shape.Dims(num_dims_output - 2),\n fft_length_data[0]);\n TF_LITE_ENSURE_EQ(context, output_shape.Dims(num_dims_output - 1),\n fft_length_data[1] / 2 + 1);\n }\n\n return Rfft2dHelper(context, node);\n}", "label": 1, "label_name": "safe"} +{"code": "func (m *NidNestedStruct) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: NidNestedStruct: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: NidNestedStruct: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field1\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tif err := m.Field1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tcase 2:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field2\", wireType)\n\t\t\t}\n\t\t\tvar msglen int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tmsglen |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif msglen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + msglen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.Field2 = append(m.Field2, NidRepStruct{})\n\t\t\tif err := m.Field2[len(m.Field2)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 1, "label_name": "safe"} +{"code": "\t_refreshItems: function(event) {\n\n\t\tthis.items = [];\n\t\tthis.containers = [this];\n\n\t\tvar i, j, cur, inst, targetData, _queries, item, queriesLength,\n\t\t\titems = this.items,\n\t\t\tqueries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],\n\t\t\tconnectWith = this._connectWith();\n\n\t\tif(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down\n\t\t\tfor (i = connectWith.length - 1; i >= 0; i--){\n\t\t\t\tcur = $(connectWith[i], this.document[0]);\n\t\t\t\tfor (j = cur.length - 1; j >= 0; j--){\n\t\t\t\t\tinst = $.data(cur[j], this.widgetFullName);\n\t\t\t\t\tif(inst && inst !== this && !inst.options.disabled) {\n\t\t\t\t\t\tqueries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);\n\t\t\t\t\t\tthis.containers.push(inst);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (i = queries.length - 1; i >= 0; i--) {\n\t\t\ttargetData = queries[i][1];\n\t\t\t_queries = queries[i][0];\n\n\t\t\tfor (j=0, queriesLength = _queries.length; j < queriesLength; j++) {\n\t\t\t\titem = $(_queries[j]);\n\n\t\t\t\titem.data(this.widgetName + \"-item\", targetData); // Data for target checking (mouse manager)\n\n\t\t\t\titems.push({\n\t\t\t\t\titem: item,\n\t\t\t\t\tinstance: targetData,\n\t\t\t\t\twidth: 0, height: 0,\n\t\t\t\t\tleft: 0, top: 0\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " $additional_value .= ', ' . $this->db->getTextValue($value);\n }\n }\n\n $query = sprintf(\"INSERT INTO %s (%s, %s%s) VALUES (%s, %s%s)\",\n $this->options['final_table'],\n $this->options['final_usernamecol'],\n $this->options['final_passwordcol'],\n $additional_key,\n $this->db->getTextValue($username),\n $this->db->getTextValue($password),\n $additional_value\n );\n\n $this->log('Running SQL against MDB: '.$query, AUTH_LOG_DEBUG);\n\n $res = $this->query($query);\n\n if (MDB::isError($res)) {\n return PEAR::raiseError($res->getMessage(), $res->getCode(),\n null, null, $res->getUserInfo());\n }\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "void sctp_generate_t3_rtx_event(unsigned long peer)\n{\n\tint error;\n\tstruct sctp_transport *transport = (struct sctp_transport *) peer;\n\tstruct sctp_association *asoc = transport->asoc;\n\tstruct net *net = sock_net(asoc->base.sk);\n\n\t/* Check whether a task is in the sock. */\n\n\tbh_lock_sock(asoc->base.sk);\n\tif (sock_owned_by_user(asoc->base.sk)) {\n\t\tpr_debug(\"%s: sock is busy\\n\", __func__);\n\n\t\t/* Try again later. */\n\t\tif (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20)))\n\t\t\tsctp_transport_hold(transport);\n\t\tgoto out_unlock;\n\t}\n\n\t/* Is this transport really dead and just waiting around for\n\t * the timer to let go of the reference?\n\t */\n\tif (transport->dead)\n\t\tgoto out_unlock;\n\n\t/* Run through the state machine. */\n\terror = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,\n\t\t\t SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_T3_RTX),\n\t\t\t asoc->state,\n\t\t\t asoc->ep, asoc,\n\t\t\t transport, GFP_ATOMIC);\n\n\tif (error)\n\t\tasoc->base.sk->sk_err = -error;\n\nout_unlock:\n\tbh_unlock_sock(asoc->base.sk);\n\tsctp_transport_put(transport);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function getUserPrivRowHTML($privname, $rownum, $privs, $types, \n $cascadeprivs, $usergroup, $disabled) {\n\t$allprivs = $cascadeprivs + $privs;\n\t$text = \"\";\n\t$js = \"\";\n\t$text .= \"\";\n\tif($usergroup == 'group') {\n\t\t$id = $allprivs[$privname]['id'];\n\t\t$text .= \"$privname\";\n\t\tif($usergroup == 'group' && ! empty($allprivs[$privname]['affiliation']))\n\t\t\t$text .= \"@{$allprivs[$privname]['affiliation']}\";\n\t\t$text .= \"\";\n\t}\n\telse\n\t\t$text .= \"$privname\";\n\n\tif($disabled)\n\t\t$disabled = 'disabled=disabled';\n\telse\n\t\t$disabled = '';\n\n\t# block rights\n\tif(array_key_exists($privname, $privs) && \n\t (($usergroup == 'user' &&\n\t in_array(\"block\", $privs[$privname])) ||\n\t ($usergroup == 'group' &&\n\t in_array(\"block\", $privs[$privname]['privs'])))) {\n\t\t$checked = \"checked\";\n\t\t$blocked = 1;\n\t}\n\telse {\n\t\t$checked = \"\";\n\t\t$blocked = 0;\n\t}\n\t$count = count($types) + 1;\n\tif($usergroup == 'user') {\n\t\t$usergroup = 1;\n\t\t$name = \"privrow[$privname:block]\";\n\t}\n\telseif($usergroup == 'group') {\n\t\t$usergroup = 2;\n\t\t$name = \"privrow[{$allprivs[$privname]['id']}:block]\";\n\t}\n\t$text .= \" \";\n\n\t#cascade rights\n\tif(array_key_exists($privname, $privs) && \n\t (($usergroup == 1 &&\n\t in_array(\"cascade\", $privs[$privname])) ||\n\t\t($usergroup == 2 &&\n\t in_array(\"cascade\", $privs[$privname]['privs']))))\n\t\t$checked = \"checked\";\n\telse\n\t\t$checked = \"\";\n\tif($usergroup == 1)\n\t\t$name = \"privrow[$privname:cascade]\";\n\telse\n\t\t$name = \"privrow[{$allprivs[$privname]['id']}:cascade]\";\n\t$text .= \" \";\n\t$text .= \"\";\n\n\t# normal rights\n\t$j = 1;\n\tforeach($types as $type) {\n\t\t$bgcolor = \"\";\n\t\t$checked = \"\";\n\t\t$value = \"\";\n\t\t$cascaded = 0;\n\t\tif(array_key_exists($privname, $cascadeprivs) && \n\t\t (($usergroup == 1 &&\n\t\t in_array($type, $cascadeprivs[$privname])) ||\n\t\t ($usergroup == 2 &&\n\t\t in_array($type, $cascadeprivs[$privname]['privs'])))) {\n\t\t\t$bgcolor = \"bgcolor=\\\"#008000\\\"\";\n\t\t\t$checked = \"checked\";\n\t\t\t$value = \"value=cascade\";\n\t\t\t$cascaded = 1;\n\t\t}\n\t\tif(array_key_exists($privname, $privs) && \n\t\t (($usergroup == 1 &&\n\t\t in_array($type, $privs[$privname])) ||\n\t\t ($usergroup == 2 &&\n\t\t in_array($type, $privs[$privname]['privs'])))) {\n\t\t\tif($cascaded) {\n\t\t\t\t$value = \"value=cascadesingle\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$checked = \"checked\";\n\t\t\t\t$value = \"value=single\";\n\t\t\t}\n\t\t}\n\t\tif($usergroup == 1)\n\t\t\t$name = \"privrow[$privname:$type]\";\n\t\telse\n\t\t\t$name = \"privrow[{$allprivs[$privname]['id']}:$type]\";\n\t\t$text .= \" \";\n\t\t#$text .= \"onBlur=\\\"nodeCheck(this.checked, $rownum, $j, $usergroup)\\\">\";\n\t\t$text .= \"\";\n\t\t$j++;\n\t}\n\t$text .= \" \";\n\t$count = count($types) + 1;\n\tif($blocked) {\n\t\t$js .= \"changeCascadedRights(true, $rownum, $count, 0, 0);\";\n\t}\n\treturn array('html' => $text,\n\t 'javascript' => $js);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static inline void o2nm_lock_subsystem(void)\n{\n\tmutex_lock(&o2nm_cluster_group.cs_subsys.su_mutex);\n}", "label": 1, "label_name": "safe"} +{"code": " public function authForm()\n {\n /* Perform logout to custom URL */\n if (!empty($_REQUEST['old_usr'])\n && !empty($GLOBALS['cfg']['Server']['LogoutURL'])\n ) {\n PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']);\n if (!defined('TESTSUITE')) {\n exit;\n } else {\n return false;\n }\n }\n\n if (empty($GLOBALS['cfg']['Server']['auth_http_realm'])) {\n if (empty($GLOBALS['cfg']['Server']['verbose'])) {\n $server_message = $GLOBALS['cfg']['Server']['host'];\n } else {\n $server_message = $GLOBALS['cfg']['Server']['verbose'];\n }\n $realm_message = 'phpMyAdmin ' . $server_message;\n } else {\n $realm_message = $GLOBALS['cfg']['Server']['auth_http_realm'];\n }\n\n $response = Response::getInstance();\n\n // remove non US-ASCII to respect RFC2616\n $realm_message = preg_replace('/[^\\x20-\\x7e]/i', '', $realm_message);\n $response->header('WWW-Authenticate: Basic realm=\"' . $realm_message . '\"');\n $response->header('HTTP/1.0 401 Unauthorized');\n if (php_sapi_name() !== 'cgi-fcgi') {\n $response->header('status: 401 Unauthorized');\n }\n\n /* HTML header */\n $footer = $response->getFooter();\n $footer->setMinimal();\n $header = $response->getHeader();\n $header->setTitle(__('Access denied!'));\n $header->disableMenuAndConsole();\n $header->setBodyId('loginform');\n\n $response->addHTML('

        ');\n $response->addHTML(sprintf(__('Welcome to %s'), ' phpMyAdmin'));\n $response->addHTML('

        ');\n $response->addHTML('

        ');\n $response->addHTML(\n Message::error(\n __('Wrong username/password. Access denied.')\n )\n );\n $response->addHTML('

        ');\n\n if (@file_exists(CUSTOM_FOOTER_FILE)) {\n include CUSTOM_FOOTER_FILE;\n }\n\n if (!defined('TESTSUITE')) {\n exit;\n } else {\n return false;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "this.ui.handleError({message:mxResources.get(\"fileNotFound\")})})))}else this.ui.spinner.stop(),this.ui.handleError({message:mxResources.get(\"invalidName\")})}}),mxResources.get(\"enterValue\"));this.ui.showDialog(P.container,300,80,!0,!1);P.init()}))),mxUtils.br(k),mxUtils.br(k));for(var G=0;Gpgd);\n\t\ttrace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);\n\n\t\t/* Stop flush ipis for the previous mm */\n\t\tcpumask_clear_cpu(cpu, mm_cpumask(prev));\n\n\t\t/* Load per-mm CR4 state */\n\t\tload_mm_cr4(next);\n\n#ifdef CONFIG_MODIFY_LDT_SYSCALL\n\t\t/*\n\t\t * Load the LDT, if the LDT is different.\n\t\t *\n\t\t * It's possible that prev->context.ldt doesn't match\n\t\t * the LDT register. This can happen if leave_mm(prev)\n\t\t * was called and then modify_ldt changed\n\t\t * prev->context.ldt but suppressed an IPI to this CPU.\n\t\t * In this case, prev->context.ldt != NULL, because we\n\t\t * never set context.ldt to NULL while the mm still\n\t\t * exists. That means that next->context.ldt !=\n\t\t * prev->context.ldt, because mms never share an LDT.\n\t\t */\n\t\tif (unlikely(prev->context.ldt != next->context.ldt))\n\t\t\tload_mm_ldt(next);\n#endif\n\t}\n#ifdef CONFIG_SMP\n\t else {\n\t\tthis_cpu_write(cpu_tlbstate.state, TLBSTATE_OK);\n\t\tBUG_ON(this_cpu_read(cpu_tlbstate.active_mm) != next);\n\n\t\tif (!cpumask_test_cpu(cpu, mm_cpumask(next))) {\n\t\t\t/*\n\t\t\t * On established mms, the mm_cpumask is only changed\n\t\t\t * from irq context, from ptep_clear_flush() while in\n\t\t\t * lazy tlb mode, and here. Irqs are blocked during\n\t\t\t * schedule, protecting us from simultaneous changes.\n\t\t\t */\n\t\t\tcpumask_set_cpu(cpu, mm_cpumask(next));\n\t\t\t/*\n\t\t\t * We were in lazy tlb mode and leave_mm disabled\n\t\t\t * tlb flush IPI delivery. We must reload CR3\n\t\t\t * to make sure to use no freed page tables.\n\t\t\t */\n\t\t\tload_cr3(next->pgd);\n\t\t\ttrace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);\n\t\t\tload_mm_cr4(next);\n\t\t\tload_mm_ldt(next);\n\t\t}\n\t}\n#endif\n}", "label": 0, "label_name": "vulnerable"} +{"code": "T){var N=Graph.customFontElements[T];null!=N&&N.url!=E&&(N.elt.parentNode.removeChild(N.elt),N=null);null==N?(N=E,\"http:\"==E.substring(0,5)&&(N=PROXY_URL+\"?url=\"+encodeURIComponent(E)),N={name:u,url:E,elt:Graph.createFontElement(u,N)},Graph.customFontElements[T]=N,Graph.recentCustomFonts[T]=N,E=document.getElementsByTagName(\"head\")[0],null!=J&&(\"link\"==N.elt.nodeName.toLowerCase()?(N.elt.onload=J,N.elt.onerror=J):J()),null!=E&&E.appendChild(N.elt)):null!=J&&J()}else null!=J&&J()}else null!=J&&J();\nreturn u};Graph.getFontUrl=function(u,E){u=Graph.customFontElements[u.toLowerCase()];null!=u&&(E=u.url);return E};Graph.processFontAttributes=function(u){u=u.getElementsByTagName(\"*\");for(var E=0;Eeval_tofree != NULL)\n {\n\tif (ga_grow(&evalarg->eval_tofree_ga, 1) == OK)\n\t ((char_u **)evalarg->eval_tofree_ga.ga_data)\n\t\t[evalarg->eval_tofree_ga.ga_len++]\n\t\t= evalarg->eval_tofree;\n\telse\n\t vim_free(evalarg->eval_tofree);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "ka-aa,ha=ua+(ya.y-ua)/ka-aa,da=new Image;da.onload=function(){try{for(var ca=-Math.round(sa-mxUtils.mod((wa-xa)*Y,sa)),la=-Math.round(sa-mxUtils.mod((ua-ha)*Y,sa));ca list) { // This appears to only be used by unit tests and the copy constructor\n if (workUnitList.size() + list.size() > MAX_UNITS) {\n throw new IllegalStateException(\"WorkBundle may not contain more than \" + MAX_UNITS + \" WorkUnits.\");\n }\n workUnitList.addAll(list);\n return workUnitList.size();\n }", "label": 1, "label_name": "safe"} +{"code": "Runner.prototype.hook = function(name, fn){\n var suite = this.suite\n , hooks = suite['_' + name]\n , self = this\n , timer;\n\n function next(i) {\n var hook = hooks[i];\n if (!hook) return fn();\n if (self.failures && suite.bail()) return fn();\n self.currentRunnable = hook;\n\n hook.ctx.currentTest = self.test;\n\n self.emit('hook', hook);\n\n hook.on('error', function(err){\n self.failHook(hook, err);\n });\n\n hook.run(function(err){\n hook.removeAllListeners('error');\n var testError = hook.error();\n if (testError) self.fail(self.test, testError);\n if (err) {\n self.failHook(hook, err);\n\n // stop executing hooks, notify callee of hook err\n return fn(err);\n }\n self.emit('hook end', hook);\n delete hook.ctx.currentTest;\n next(++i);\n });\n }\n\n Runner.immediately(function(){\n next(0);\n });\n};", "label": 0, "label_name": "vulnerable"} +{"code": " public function assertIsLookup()\n {\n $this->assertIsArray();\n foreach ($this->contents as $v) {\n if ($v !== true) {\n $this->error('must be a lookup array');\n }\n }\n return $this;\n }", "label": 1, "label_name": "safe"} +{"code": "text:\"Ignore all words\"},Options:{instance:null,text:\"Options\",optionsDialog:{instance:null}},AddWord:{instance:null,text:\"Add word\"},FinishChecking:{instance:null,text:\"Finish Checking\"}};a.LocalizationLabel={ChangeTo:{instance:null,text:\"Change to\"},Suggestions:{instance:null,text:\"Suggestions\"}};var x=function(b){for(var c in b)b[c].instance.getElement().setText(a.LocalizationComing[c])},y=function(b){for(var c in b){if(!b[c].instance.setLabel)break;b[c].instance.setLabel(a.LocalizationComing[c])}},", "label": 1, "label_name": "safe"} +{"code": "cJSON *cJSON_CreateIntArray(const int *numbers,int count)\t\t{int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && ichild=n;else suffix_object(p,n);p=n;}return a;}", "label": 1, "label_name": "safe"} +{"code": "jQuery.fn.extend({\n\tposition: function() {\n\t\tvar left = 0, top = 0, results;\n\n\t\tif ( this[0] ) {\n\t\t\t// Get *real* offsetParent\n\t\t\tvar offsetParent = this.offsetParent(),\n\n\t\t\t// Get correct offsets\n\t\t\toffset = this.offset(),\n\t\t\tparentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();\n\n\t\t\t// Subtract element margins\n\t\t\t// note: when an element has margin: auto the offsetLeft and marginLeft \n\t\t\t// are the same in Safari causing offset.left to incorrectly be 0\n\t\t\toffset.top -= num( this, 'marginTop' );\n\t\t\toffset.left -= num( this, 'marginLeft' );\n\n\t\t\t// Add offsetParent borders\n\t\t\tparentOffset.top += num( offsetParent, 'borderTopWidth' );\n\t\t\tparentOffset.left += num( offsetParent, 'borderLeftWidth' );\n\n\t\t\t// Subtract the two offsets\n\t\t\tresults = {\n\t\t\t\ttop: offset.top - parentOffset.top,\n\t\t\t\tleft: offset.left - parentOffset.left\n\t\t\t};\n\t\t}\n\n\t\treturn results;\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": "static uint64_t unpack_timestamp(const struct efi_time *timestamp)\n{\n\tuint64_t val = 0;\n\tuint16_t year = le32_to_cpu(timestamp->year);\n\n\t/* pad1, nanosecond, timezone, daylight and pad2 are meant to be zero */\n\tval |= ((uint64_t) timestamp->pad1 & 0xFF) << 0;\n\tval |= ((uint64_t) timestamp->second & 0xFF) << (1*8);\n\tval |= ((uint64_t) timestamp->minute & 0xFF) << (2*8);\n\tval |= ((uint64_t) timestamp->hour & 0xFF) << (3*8);\n\tval |= ((uint64_t) timestamp->day & 0xFF) << (4*8);\n\tval |= ((uint64_t) timestamp->month & 0xFF) << (5*8);\n\tval |= ((uint64_t) year) << (6*8);\n\n\treturn val;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " it 'applies cleanly' do\n pp = <<-EOS\n class { '::firewall': }\n firewall { '001 - test': ensure => present }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end\n\n end", "label": 0, "label_name": "vulnerable"} +{"code": "$jscomp.getGlobal=function(a){return\"undefined\"!=typeof window&&window===a?a:\"undefined\"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(\".\");for(d=0;d 0:\n request.setResponseCode(400)\n msg = \"Missing parameters: \"+(\",\".join(missing))\n request.write(dict_to_json_bytes({'errcode': 'M_MISSING_PARAMS', 'error': msg}))\n request.finish()\n return\n\n threepid = body['threepid']\n mxid = body['mxid']\n\n if 'medium' not in threepid or 'address' not in threepid:\n request.setResponseCode(400)\n request.write(dict_to_json_bytes({'errcode': 'M_MISSING_PARAMS', 'error': 'Threepid lacks medium / address'}))\n request.finish()\n return\n\n # We now check for authentication in two different ways, depending\n # on the contents of the request. If the user has supplied \"sid\"\n # (the Session ID returned by Sydent during the original binding)\n # and \"client_secret\" fields, they are trying to prove that they\n # were the original author of the bind. We then check that what\n # they supply matches and if it does, allow the unbind.\n #\n # However if these fields are not supplied, we instead check\n # whether the request originated from a homeserver, and if so the\n # same homeserver that originally created the bind. We do this by\n # checking the signature of the request. If it all matches up, we\n # allow the unbind.\n #\n # Only one method of authentication is required.\n if 'sid' in body and 'client_secret' in body:\n sid = body['sid']\n client_secret = body['client_secret']\n\n if not is_valid_client_secret(client_secret):\n request.setResponseCode(400)\n request.write(dict_to_json_bytes({\n 'errcode': 'M_INVALID_PARAM',\n 'error': 'Invalid client_secret provided'\n }))\n request.finish()\n return\n\n valSessionStore = ThreePidValSessionStore(self.sydent)\n\n try:\n s = valSessionStore.getValidatedSession(sid, client_secret)\n except (IncorrectClientSecretException, InvalidSessionIdException):\n request.setResponseCode(401)\n request.write(dict_to_json_bytes({\n 'errcode': 'M_NO_VALID_SESSION',\n 'error': \"No valid session was found matching that sid and client secret\"\n }))\n request.finish()\n return\n except SessionNotValidatedException:\n request.setResponseCode(403)\n request.write(dict_to_json_bytes({\n 'errcode': 'M_SESSION_NOT_VALIDATED',\n 'error': \"This validation session has not yet been completed\"\n }))\n return\n\n if s.medium != threepid['medium'] or s.address != threepid['address']:\n request.setResponseCode(403)\n request.write(dict_to_json_bytes({\n 'errcode': 'M_FORBIDDEN',\n 'error': 'Provided session information does not match medium/address combo',\n }))\n request.finish()\n return\n else:\n try:\n origin_server_name = yield self.sydent.sig_verifier.authenticate_request(request, body)\n except SignatureVerifyException as ex:\n request.setResponseCode(401)\n request.write(dict_to_json_bytes({'errcode': 'M_FORBIDDEN', 'error': str(ex)}))\n request.finish()\n return\n except NoAuthenticationError as ex:\n request.setResponseCode(401)\n request.write(dict_to_json_bytes({'errcode': 'M_FORBIDDEN', 'error': str(ex)}))\n request.finish()\n return\n except InvalidServerName as ex:\n request.setResponseCode(400)\n request.write(dict_to_json_bytes({'errcode': 'M_INVALID_PARAM', 'error': str(ex)}))\n request.finish()\n return\n except Exception:\n logger.exception(\"Exception whilst authenticating unbind request\")\n request.setResponseCode(500)\n request.write(dict_to_json_bytes({'errcode': 'M_UNKNOWN', 'error': 'Internal Server Error'}))\n request.finish()\n return\n\n if not mxid.endswith(':' + origin_server_name):\n request.setResponseCode(403)\n request.write(dict_to_json_bytes({'errcode': 'M_FORBIDDEN', 'error': 'Origin server name does not match mxid'}))\n request.finish()\n return\n\n self.sydent.threepidBinder.removeBinding(threepid, mxid)\n\n request.write(dict_to_json_bytes({}))\n request.finish()\n except Exception as ex:\n logger.exception(\"Exception whilst handling unbind\")\n request.setResponseCode(500)\n request.write(dict_to_json_bytes({'errcode': 'M_UNKNOWN', 'error': str(ex)}))\n request.finish()", "label": 1, "label_name": "safe"} +{"code": " public function decorate(&$cache)\n {\n $decorator = $this->copy();\n // reference is necessary for mocks in PHP 4\n $decorator->cache =& $cache;\n $decorator->type = $cache->type;\n return $decorator;\n }", "label": 1, "label_name": "safe"} +{"code": " public function testSingleSpan()\n {\n $this->assertResult(\n 'foo',\n 'foo'\n );\n }", "label": 1, "label_name": "safe"} +{"code": "static void tv_details_row_activated(\n GtkTreeView *tree_view,\n GtkTreePath *tree_path_UNUSED,\n GtkTreeViewColumn *column,\n gpointer user_data)\n{\n gchar *item_name;\n struct problem_item *item = get_current_problem_item_or_NULL(tree_view, &item_name);\n if (!item || !(item->flags & CD_FLAG_TXT))\n goto ret;\n if (!strchr(item->content, '\\n')) /* one line? */\n goto ret; /* yes */\n\n gint exitcode;\n gchar *arg[3];\n arg[0] = (char *) \"xdg-open\";\n arg[1] = concat_path_file(g_dump_dir_name, item_name);\n arg[2] = NULL;\n\n const gboolean spawn_ret = g_spawn_sync(NULL, arg, NULL,\n G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL,\n NULL, NULL, NULL, NULL, &exitcode, NULL);\n\n if (spawn_ret == FALSE || exitcode != EXIT_SUCCESS)\n {\n GtkWidget *dialog = gtk_dialog_new_with_buttons(_(\"View/edit a text file\"),\n GTK_WINDOW(g_wnd_assistant),\n GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,\n NULL, NULL);\n GtkWidget *vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));\n GtkWidget *scrolled = gtk_scrolled_window_new(NULL, NULL);\n GtkWidget *textview = gtk_text_view_new();\n\n gtk_dialog_add_button(GTK_DIALOG(dialog), _(\"_Save\"), GTK_RESPONSE_OK);\n gtk_dialog_add_button(GTK_DIALOG(dialog), _(\"_Cancel\"), GTK_RESPONSE_CANCEL);\n\n gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0);\n gtk_widget_set_size_request(scrolled, 640, 480);\n gtk_widget_show(scrolled);\n\n#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 7) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 7 && GTK_MICRO_VERSION < 8))\n /* http://developer.gnome.org/gtk3/unstable/GtkScrolledWindow.html#gtk-scrolled-window-add-with-viewport */\n /* gtk_scrolled_window_add_with_viewport has been deprecated since version 3.8 and should not be used in newly-written code. */\n gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), textview);\n#else\n /* gtk_container_add() will now automatically add a GtkViewport if the child doesn't implement GtkScrollable. */\n gtk_container_add(GTK_CONTAINER(scrolled), textview);\n#endif\n\n gtk_widget_show(textview);\n\n load_text_to_text_view(GTK_TEXT_VIEW(textview), item_name);\n\n if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)\n {\n save_text_from_text_view(GTK_TEXT_VIEW(textview), item_name);\n problem_data_reload_from_dump_dir();\n update_gui_state_from_problem_data(/* don't update selected event */ 0);\n }\n\n gtk_widget_destroy(textview);\n gtk_widget_destroy(scrolled);\n gtk_widget_destroy(dialog);\n }\n\n free(arg[1]);\n ret:\n g_free(item_name);\n}", "label": 1, "label_name": "safe"} +{"code": "\tpublic void configure(ServletContextHandler context) {\n\t\tcontext.setContextPath(\"/\");\n\t\t\n\t\tcontext.getSessionHandler().setMaxInactiveInterval(serverConfig.getSessionTimeout());\n\t\t\n\t\tcontext.setInitParameter(EnvironmentLoader.ENVIRONMENT_CLASS_PARAM, DefaultWebEnvironment.class.getName());\n\t\tcontext.addEventListener(new EnvironmentLoaderListener());\n\t\tcontext.addFilter(new FilterHolder(shiroFilter), \"/*\", EnumSet.allOf(DispatcherType.class));\n\t\t\n context.addFilter(new FilterHolder(gitFilter), \"/*\", EnumSet.allOf(DispatcherType.class));\n\t\t\n\t\tcontext.addServlet(new ServletHolder(preReceiveServlet), GitPreReceiveCallback.PATH + \"/*\");\n \n context.addServlet(new ServletHolder(postReceiveServlet), GitPostReceiveCallback.PATH + \"/*\");\n \n\t\t/*\n\t\t * Add wicket servlet as the default servlet which will serve all requests failed to \n\t\t * match a path pattern\n\t\t */\n\t\tcontext.addServlet(new ServletHolder(wicketServlet), \"/\");\n\t\t\n\t\tcontext.addServlet(new ServletHolder(attachmentUploadServlet), \"/attachment_upload\");\n\t\t\n\t\tcontext.addServlet(new ServletHolder(new ClasspathAssetServlet(ImageScope.class)), \"/img/*\");\n\t\tcontext.addServlet(new ServletHolder(new ClasspathAssetServlet(IconScope.class)), \"/icon/*\");\n\t\t\n\t\tcontext.getSessionHandler().addEventListener(new HttpSessionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void sessionCreated(HttpSessionEvent se) {\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void sessionDestroyed(HttpSessionEvent se) {\n\t\t\t\twebSocketManager.onDestroySession(se.getSession().getId());\n\t\t\t}\n\t\t\t\n\t\t});\n\t\t\n\t\t/*\n\t\t * Configure a servlet to serve contents under site folder. Site folder can be used \n\t\t * to hold site specific web assets. \n\t\t */\n\t\tServletHolder fileServletHolder = new ServletHolder(new FileAssetServlet(Bootstrap.getSiteDir()));\n\t\tcontext.addServlet(fileServletHolder, \"/site/*\");\n\t\tcontext.addServlet(fileServletHolder, \"/robots.txt\");\n\t\t\n\t\tcontext.addServlet(new ServletHolder(jerseyServlet), \"/rest/*\");\t\t\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " def initialize(app, options={})\n super\n @pool_timestamp = Hash.new()\n end", "label": 1, "label_name": "safe"} +{"code": "e[g].parentNode));return c};EditorUi.prototype.synchronizeCurrentFile=function(c){var e=this.getCurrentFile();null!=e&&(e.savingFile?this.handleError({message:mxResources.get(\"busy\")}):!c&&e.invalidChecksum?e.handleFileError(null,!0):this.spinner.spin(document.body,mxResources.get(\"updatingDocument\"))&&(e.clearAutosave(),this.editor.setStatus(\"\"),c?e.reloadFile(mxUtils.bind(this,function(){e.handleFileSuccess(\"manual\"==DrawioFile.SYNC)}),mxUtils.bind(this,function(g){e.handleFileError(g,!0)})):e.synchronizeFile(mxUtils.bind(this,\nfunction(){e.handleFileSuccess(\"manual\"==DrawioFile.SYNC)}),mxUtils.bind(this,function(g){e.handleFileError(g,!0)}))))};EditorUi.prototype.getFileData=function(c,e,g,k,m,q,v,x,A,z,L){m=null!=m?m:!0;q=null!=q?q:!1;var M=this.editor.graph;if(e||!c&&null!=A&&/(\\.svg)$/i.test(A.getTitle())){var n=null!=M.themes&&\"darkTheme\"==M.defaultThemeName;z=!1;if(n||null!=this.pages&&this.currentPage!=this.pages[0]){var y=M.getGlobalVariable;M=this.createTemporaryGraph(n?M.getDefaultStylesheet():M.getStylesheet());", "label": 0, "label_name": "vulnerable"} +{"code": " public static function makeFromSerial()\n {\n $contents = file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser');\n $r = unserialize($contents);\n if (!$r) {\n $hash = sha1($contents);\n trigger_error(\"Unserialization of configuration schema failed, sha1 of file was $hash\", E_USER_ERROR);\n }\n return $r;\n }", "label": 1, "label_name": "safe"} +{"code": "decode_unicode_with_escapes(struct compiling *c, const node *n, const char *s,\n size_t len)\n{\n PyObject *v, *u;\n char *buf;\n char *p;\n const char *end;\n const char *first_invalid_escape;\n\n /* check for integer overflow */\n if (len > SIZE_MAX / 6)\n return NULL;\n /* \"\u00e4\" (2 bytes) may become \"\\U000000E4\" (10 bytes), or 1:5\n \"\\\u00e4\" (3 bytes) may become \"\\u005c\\U000000E4\" (16 bytes), or ~1:6 */\n u = PyBytes_FromStringAndSize((char *)NULL, len * 6);\n if (u == NULL)\n return NULL;\n p = buf = PyBytes_AsString(u);\n end = s + len;\n while (s < end) {\n if (*s == '\\\\') {\n *p++ = *s++;\n if (s >= end || *s & 0x80) {\n strcpy(p, \"u005c\");\n p += 5;\n if (s >= end)\n break;\n }\n }\n if (*s & 0x80) { /* XXX inefficient */\n PyObject *w;\n int kind;\n void *data;\n Py_ssize_t len, i;\n w = decode_utf8(c, &s, end);\n if (w == NULL) {\n Py_DECREF(u);\n return NULL;\n }\n kind = PyUnicode_KIND(w);\n data = PyUnicode_DATA(w);\n len = PyUnicode_GET_LENGTH(w);\n for (i = 0; i < len; i++) {\n Py_UCS4 chr = PyUnicode_READ(kind, data, i);\n sprintf(p, \"\\\\U%08x\", chr);\n p += 10;\n }\n /* Should be impossible to overflow */\n assert(p - buf <= PyBytes_GET_SIZE(u));\n Py_DECREF(w);\n } else {\n *p++ = *s++;\n }\n }\n len = p - buf;\n s = buf;\n\n v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);\n\n if (v != NULL && first_invalid_escape != NULL) {\n if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {\n /* We have not decref u before because first_invalid_escape points\n inside u. */\n Py_XDECREF(u);\n Py_DECREF(v);\n return NULL;\n }\n }\n Py_XDECREF(u);\n return v;\n}", "label": 1, "label_name": "safe"} +{"code": "function uploadFile($file_array, $destination_directory, $destination_filename = null)\n{\n if ((! isset($file_array['name'])) || (! isset($file_array['tmp_name'])) || (! isset($file_array['error']))) {\n throw new Exception(_('Ung\u00fcltiges Array \u00fcbergeben!'));\n }\n\n //Dont allow to upload a PHP file.\n if(strpos($file_array['name'], \".php\") != false\n || strpos($destination_filename, \".php\") != false)\n {\n throw new \\Exception(_(\"Es ist nicht erlaubt PHP Dateien hochzuladen!\"));\n }\n\n if ($destination_filename == null) {\n $destination_filename = $file_array['name'];\n }\n\n $destination = $destination_directory.$destination_filename;\n\n if ((mb_substr($destination_directory, -1, 1) != '/') || (! isPathabsoluteAndUnix($destination_directory, false))) {\n throw new Exception(sprintf(_('\"%s\" ist kein g\u00fcltiges Verzeichnis!'), $destination_directory));\n }\n\n try {\n createPath($destination_directory);\n } catch (Exception $ex) {\n throw new Exception(_(\"Das Verzeichniss konnte nicht angelegt werden!\"));\n }\n\n if (! is_writable($destination_directory)) {\n throw new Exception(_('Sie haben keine Schreibrechte im Verzeichnis \"').$destination_directory.'\"!');\n }\n\n if (file_exists($destination)) {\n // there is already a file with the same filename, check if it is exactly the same file\n $new_file_md5 = md5_file($file_array['tmp_name']);\n $existing_file_md5 = md5_file($destination);\n\n if (($new_file_md5 == $existing_file_md5) && ($new_file_md5 != false)) {\n return $destination;\n } // it's exactly the same file, we don't need to upload it again, re-use it!\n\n throw new Exception(_('Es existiert bereits eine Datei mit dem Dateinamen \"').$destination.'\"!');\n }\n\n switch ($file_array['error']) {\n case UPLOAD_ERR_OK:\n // all OK, upload was successfully\n break;\n case UPLOAD_ERR_INI_SIZE:\n throw new Exception(_('Die maximal m\u00f6gliche Dateigr\u00f6sse f\u00fcr Uploads wurde \u00fcberschritten (\"upload_max_filesize\" in \"php.ini\")! ').\n ''._(\"Hilfe\").'');\n case UPLOAD_ERR_FORM_SIZE:\n throw new Exception(_('Die maximal m\u00f6gliche Dateigr\u00f6sse f\u00fcr Uploads wurde \u00fcberschritten!'));\n case UPLOAD_ERR_PARTIAL:\n throw new Exception(_('Die Datei wurde nur teilweise hochgeladen!'));\n case UPLOAD_ERR_NO_FILE:\n throw new Exception(_('Es wurde keine Datei hochgeladen!'));\n case UPLOAD_ERR_NO_TMP_DIR:\n throw new Exception(_('Es gibt keinen tempor\u00e4ren Ordner f\u00fcr hochgeladene Dateien!'));\n case UPLOAD_ERR_CANT_WRITE:\n throw new Exception(_('Das Speichern der Datei auf die Festplatte ist fehlgeschlagen!'));\n case UPLOAD_ERR_EXTENSION:\n throw new Exception(_('Eine PHP Erweiterung hat den Upload der Datei gestoppt!'));\n default:\n throw new Exception(_('Beim Hochladen der Datei trat ein unbekannter Fehler auf!'));\n }\n\n if (! move_uploaded_file($file_array['tmp_name'], $destination)) {\n throw new Exception(_('Beim Hochladen der Datei trat ein unbekannter Fehler auf!'));\n }\n\n return $destination;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function add(DataCollectorInterface $collector)\n {\n $this->collectors[$collector->getName()] = $collector;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask($task);\n\n $this->response->html($this->template->render('subtask_restriction/show', array(\n 'status_list' => array(\n SubtaskModel::STATUS_TODO => t('Todo'),\n SubtaskModel::STATUS_DONE => t('Done'),\n ),\n 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 1, "label_name": "safe"} +{"code": "Sidebar.prototype.defaultImageWidth=80;Sidebar.prototype.defaultImageHeight=80;Sidebar.prototype.tooltipMouseDown=null;Sidebar.prototype.refresh=function(){this.graph.stylesheet.styles=mxUtils.clone(this.editorUi.editor.graph.stylesheet.styles);this.container.innerText=\"\";this.palettes={};this.init()};", "label": 1, "label_name": "safe"} +{"code": "\"geTempDlgCreateBtn geTempDlgBtnDisabled\")}function z(ha,da){if(null!=J){var ca=function(pa){qa.isExternal?g(qa,function(na){la(na,pa)},ia):qa.url?mxUtils.get(TEMPLATE_PATH+\"/\"+qa.url,mxUtils.bind(this,function(na){200<=na.getStatus()&&299>=na.getStatus()?la(na.getText(),pa):ia()})):la(b.emptyDiagramXml,pa)},la=function(pa,na){y||b.hideDialog(!0);e(pa,na,qa,da)},ia=function(){A(mxResources.get(\"cannotLoad\"));ma()},ma=function(){J=qa;za.className=\"geTempDlgCreateBtn\";da&&(Ga.className=\"geTempDlgOpenBtn\")},", "label": 0, "label_name": "vulnerable"} +{"code": "void ntlm_print_av_pair_list(NTLM_AV_PAIR* pAvPairList, size_t cbAvPairList)\n{\n\tsize_t cbAvPair = cbAvPairList;\n\tNTLM_AV_PAIR* pAvPair = pAvPairList;\n\n\tif (!ntlm_av_pair_check(pAvPair, cbAvPair))\n\t\treturn;\n\n\tWLog_INFO(TAG, \"AV_PAIRs =\");\n\n\twhile (pAvPair && ntlm_av_pair_get_id(pAvPair) != MsvAvEOL)\n\t{\n\t\tWLog_INFO(TAG, \"\\t%s AvId: %\" PRIu16 \" AvLen: %\" PRIu16 \"\",\n\t\t AV_PAIR_STRINGS[ntlm_av_pair_get_id(pAvPair)], ntlm_av_pair_get_id(pAvPair),\n\t\t ntlm_av_pair_get_len(pAvPair));\n\t\twinpr_HexDump(TAG, WLOG_INFO, ntlm_av_pair_get_value_pointer(pAvPair),\n\t\t ntlm_av_pair_get_len(pAvPair));\n\n\t\tpAvPair = ntlm_av_pair_next(pAvPair, &cbAvPair);\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": "func remount(m *configs.Mount, rootfs string) error {\n\tvar (\n\t\tdest = m.Destination\n\t)\n\tif !strings.HasPrefix(dest, rootfs) {\n\t\tdest = filepath.Join(rootfs, dest)\n\t}\n\treturn unix.Mount(m.Source, dest, m.Device, uintptr(m.Flags|unix.MS_REMOUNT), \"\")\n}", "label": 0, "label_name": "vulnerable"} +{"code": " private function entityInAttributeValueState()\n {\n // Attempt to consume an entity.\n $entity = $this->entity();\n\n // If nothing is returned, append a U+0026 AMPERSAND character to the\n // current attribute's value. Otherwise, emit the character token that\n // was returned.\n $char = (!$entity)\n ? '&'\n : $entity;\n\n $this->emitToken($char);\n }", "label": 1, "label_name": "safe"} +{"code": " public void testFileRegionCountLargerThenFile(ServerBootstrap sb, Bootstrap cb) throws Throwable {\n File file = File.createTempFile(\"netty-\", \".tmp\");\n file.deleteOnExit();\n\n final FileOutputStream out = new FileOutputStream(file);\n out.write(data);\n out.close();\n\n sb.childHandler(new SimpleChannelInboundHandler() {\n @Override\n protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {\n // Just drop the message.\n }\n });\n cb.handler(new ChannelInboundHandlerAdapter());\n\n Channel sc = sb.bind().sync().channel();\n Channel cc = cb.connect(sc.localAddress()).sync().channel();\n\n // Request file region which is bigger then the underlying file.\n FileRegion region = new DefaultFileRegion(\n new RandomAccessFile(file, \"r\").getChannel(), 0, data.length + 1024);\n\n assertThat(cc.writeAndFlush(region).await().cause(), CoreMatchers.instanceOf(IOException.class));\n cc.close().sync();\n sc.close().sync();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "jQuery.multiFilter = function( expr, elems, not ) {\n\tif ( not ) {\n\t\texpr = \":not(\" + expr + \")\";\n\t}\n\n\treturn Sizzle.matches(expr, elems);\n};", "label": 0, "label_name": "vulnerable"} +{"code": "static inline bool isValid(const RemoteFsDevice::Details &d)\n{\n return d.isLocalFile() || RemoteFsDevice::constSshfsProtocol==d.url.scheme();\n}", "label": 1, "label_name": "safe"} +{"code": "g=new CKEDITOR.htmlParser.fragment,h=[],f=0,d=g,r;e.onTagOpen=function(a,g,f){var l=new CKEDITOR.htmlParser.element(a,g);if(CKEDITOR.dtd.$removeEmpty[a])h.push(l);else{var t=d.name,n=t&&(CKEDITOR.dtd[t]||(d._.isBlockLike?CKEDITOR.dtd.div:CKEDITOR.dtd.span));if(n&&!n[a]){var n=!1,j;a==t?i(d,d.parent):(a in CKEDITOR.dtd.$listItem?(e.onTagOpen(\"ul\",{}),j=d):(i(d,d.parent),h.unshift(d)),n=!0);d=j?j:d.returnPoint||d.parent;if(n){e.onTagOpen.apply(this,arguments);return}}b(a);c(a);l.parent=d;l.returnPoint=\nr;r=0;l.isEmpty?i(l):d=l}};e.onTagClose=function(a){for(var e=h.length-1;0<=e;e--)if(a==h[e].name){h.splice(e,1);return}for(var b=[],c=[],g=d;g.type&&g.name!=a;)g._.isBlockLike||c.unshift(g),b.push(g),g=g.parent;if(g.type){for(e=0;eresolver = $resolver;\n $this->stopwatch = $stopwatch;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " $ds = self::connectToServer($replicate[\"host\"], $replicate[\"port\"],\n $ldap_method['rootdn'],\n Toolbox::decrypt($ldap_method['rootdn_passwd'], GLPIKEY),\n $ldap_method['use_tls'], $ldap_method['deref_option']);\n\n // Test with login and password of the user\n if (!$ds\n && !empty($login)) {\n $ds = self::connectToServer($replicate[\"host\"], $replicate[\"port\"], $login,\n $password, $ldap_method['use_tls'],\n $ldap_method['deref_option']);\n }\n if ($ds) {\n return $ds;\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "sa=F.actions.get(\"resetView\");P=F.actions.get(\"fullscreen\");var Ga=F.actions.get(\"undo\"),Ka=F.actions.get(\"redo\"),Ma=B(\"\",Ga.funct,null,mxResources.get(\"undo\")+\" (\"+Ga.shortcut+\")\",Ga,Editor.undoImage),Ia=B(\"\",Ka.funct,null,mxResources.get(\"redo\")+\" (\"+Ka.shortcut+\")\",Ka,Editor.redoImage),Ea=B(\"\",P.funct,null,mxResources.get(\"fullscreen\"),P,Editor.fullscreenImage);if(null!=I){sa=function(){pa.style.display=null!=F.pages&&(\"0\"!=urlParams.pages||1selectObjects('section', 'parent=' . $id, 'rank');\n //FIXME $manage_all is moot w/ cascading perms now?\n $manage_all = false;\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {\n $manage_all = true;\n }\n //FIXME recode to use foreach $key=>$value\n $navcount = count($nav);\n for ($i = 0; $i < $navcount; $i++) {\n if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {\n $nav[$i]->manage = 1;\n $view = true;\n } else {\n $nav[$i]->manage = 0;\n $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));\n }\n $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);\n if (!$view) unset($nav[$i]);\n }\n $nav= array_values($nav);\n// $nav[$navcount - 1]->last = true;\n if (count($nav)) $nav[count($nav) - 1]->last = true;\n// echo expJavascript::ajaxReply(201, '', $nav);\n $ar = new expAjaxReply(201, '', $nav);\n $ar->send();\n }", "label": 1, "label_name": "safe"} +{"code": "function pa(){mxEllipse.call(this)}function ua(){mxEllipse.call(this)}function ya(){mxRhombus.call(this)}function Fa(){mxEllipse.call(this)}function Ma(){mxEllipse.call(this)}function Oa(){mxEllipse.call(this)}function Qa(){mxEllipse.call(this)}function Ta(){mxActor.call(this)}function za(){mxActor.call(this)}function wa(){mxActor.call(this)}function Ea(c,l,x,p){mxShape.call(this);this.bounds=c;this.fill=l;this.stroke=x;this.strokewidth=null!=p?p:1;this.rectStyle=\"square\";this.size=10;this.absoluteCornerSize=", "label": 0, "label_name": "vulnerable"} +{"code": " it 'avoids xss attacks' do\n h = last_response.headers['X-MiniProfiler-Ids']\n id = ::JSON.parse(h)[0]\n get \"/mini-profiler-resources/results?id=%22%3E%3Cqss%3E\"\n last_response.should_not be_ok\n last_response.body.should_not =~ //\n last_response.body.should =~ /<qss>/\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def setup\n @namespace = \"theplaylist\"\n @store = Redis::Store.new :namespace => @namespace, :marshalling => false # TODO remove mashalling option\n @client = @store.instance_variable_get(:@client)\n @rabbit = \"bunny\"\n @default_store = Redis::Store.new\n @other_namespace = 'other'\n @other_store = Redis::Store.new :namespace => @other_namespace\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)\n{\n\tunsigned long pmnc;\n\tstruct perf_sample_data data;\n\tstruct cpu_hw_events *cpuc;\n\tstruct pt_regs *regs;\n\tint idx;\n\n\t/*\n\t * Get and reset the IRQ flags\n\t */\n\tpmnc = armv7_pmnc_getreset_flags();\n\n\t/*\n\t * Did an overflow occur?\n\t */\n\tif (!armv7_pmnc_has_overflowed(pmnc))\n\t\treturn IRQ_NONE;\n\n\t/*\n\t * Handle the counter(s) overflow(s)\n\t */\n\tregs = get_irq_regs();\n\n\tperf_sample_data_init(&data, 0);\n\n\tcpuc = &__get_cpu_var(cpu_hw_events);\n\tfor (idx = 0; idx <= armpmu->num_events; ++idx) {\n\t\tstruct perf_event *event = cpuc->events[idx];\n\t\tstruct hw_perf_event *hwc;\n\n\t\tif (!test_bit(idx, cpuc->active_mask))\n\t\t\tcontinue;\n\n\t\t/*\n\t\t * We have a single interrupt for all counters. Check that\n\t\t * each counter has overflowed before we process it.\n\t\t */\n\t\tif (!armv7_pmnc_counter_has_overflowed(pmnc, idx))\n\t\t\tcontinue;\n\n\t\thwc = &event->hw;\n\t\tarmpmu_event_update(event, hwc, idx, 1);\n\t\tdata.period = event->hw.last_period;\n\t\tif (!armpmu_event_set_period(event, hwc, idx))\n\t\t\tcontinue;\n\n\t\tif (perf_event_overflow(event, &data, regs))\n\t\t\tarmpmu->disable(hwc, idx);\n\t}\n\n\t/*\n\t * Handle the pending perf events.\n\t *\n\t * Note: this call *must* be run with interrupts disabled. For\n\t * platforms that can have the PMU interrupts raised as an NMI, this\n\t * will not work.\n\t */\n\tirq_work_run();\n\n\treturn IRQ_HANDLED;\n}", "label": 1, "label_name": "safe"} +{"code": "static struct rpmsg_device *rpmsg_virtio_add_ctrl_dev(struct virtio_device *vdev)\n{\n\tstruct virtproc_info *vrp = vdev->priv;\n\tstruct virtio_rpmsg_channel *vch;\n\tstruct rpmsg_device *rpdev_ctrl;\n\tint err = 0;\n\n\tvch = kzalloc(sizeof(*vch), GFP_KERNEL);\n\tif (!vch)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\t/* Link the channel to the vrp */\n\tvch->vrp = vrp;\n\n\t/* Assign public information to the rpmsg_device */\n\trpdev_ctrl = &vch->rpdev;\n\trpdev_ctrl->ops = &virtio_rpmsg_ops;\n\n\trpdev_ctrl->dev.parent = &vrp->vdev->dev;\n\trpdev_ctrl->dev.release = virtio_rpmsg_release_device;\n\trpdev_ctrl->little_endian = virtio_is_little_endian(vrp->vdev);\n\n\terr = rpmsg_ctrldev_register_device(rpdev_ctrl);\n\tif (err) {\n\t\t/* vch will be free in virtio_rpmsg_release_device() */\n\t\treturn ERR_PTR(err);\n\t}\n\n\treturn rpdev_ctrl;\n}", "label": 1, "label_name": "safe"} +{"code": "decrypt_response(struct sc_card *card, unsigned char *in, size_t inlen, unsigned char *out, size_t * out_len)\n{\n\tsize_t cipher_len;\n\tsize_t i;\n\tunsigned char iv[16] = { 0 };\n\tunsigned char plaintext[4096] = { 0 };\n\tepass2003_exdata *exdata = NULL;\n\n\tif (!card->drv_data) \n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\n\texdata = (epass2003_exdata *)card->drv_data;\n\n\t/* no cipher */\n\tif (in[0] == 0x99)\n\t\treturn 0;\n\n\t/* parse cipher length */\n\tif (0x01 == in[2] && 0x82 != in[1]) {\n\t\tcipher_len = in[1];\n\t\ti = 3;\n\t}\n\telse if (0x01 == in[3] && 0x81 == in[1]) {\n\t\tcipher_len = in[2];\n\t\ti = 4;\n\t}\n\telse if (0x01 == in[4] && 0x82 == in[1]) {\n\t\tcipher_len = in[2] * 0x100;\n\t\tcipher_len += in[3];\n\t\ti = 5;\n\t}\n\telse {\n\t\treturn -1;\n\t}\n\n\tif (cipher_len < 2 || i+cipher_len > inlen || cipher_len > sizeof plaintext)\n\t\treturn -1;\n\n\t/* decrypt */\n\tif (KEY_TYPE_AES == exdata->smtype)\n\t\taes128_decrypt_cbc(exdata->sk_enc, 16, iv, &in[i], cipher_len - 1, plaintext);\n\telse\n\t\tdes3_decrypt_cbc(exdata->sk_enc, 16, iv, &in[i], cipher_len - 1, plaintext);\n\n\t/* unpadding */\n\twhile (0x80 != plaintext[cipher_len - 2] && (cipher_len - 2 > 0))\n\t\tcipher_len--;\n\n\tif (2 == cipher_len)\n\t\treturn -1;\n\n\tmemcpy(out, plaintext, cipher_len - 2);\n\t*out_len = cipher_len - 2;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function forEach(obj, iterator, context) {\n\tvar key, length;\n\tif (obj) {\n\t\tif (isFunction(obj)) {\n\t\t\tfor (key in obj) {\n\t\t\t\tif (\n\t\t\t\t\tkey !== \"prototype\" &&\n\t\t\t\t\tkey !== \"length\" &&\n\t\t\t\t\tkey !== \"name\" &&\n\t\t\t\t\tobj.hasOwnProperty(key)\n\t\t\t\t) {\n\t\t\t\t\titerator.call(context, obj[key], key, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isArray(obj) || isArrayLike(obj)) {\n\t\t\tvar isPrimitive = typeof obj !== \"object\";\n\t\t\tfor (key = 0, length = obj.length; key < length; key++) {\n\t\t\t\tif (isPrimitive || key in obj) {\n\t\t\t\t\titerator.call(context, obj[key], key, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (obj.forEach && obj.forEach !== forEach) {\n\t\t\tobj.forEach(iterator, context, obj);\n\t\t} else if (isBlankObject(obj)) {\n\t\t\t// createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n\t\t\t// eslint-disable-next-line guard-for-in\n\t\t\tfor (key in obj) {\n\t\t\t\titerator.call(context, obj[key], key, obj);\n\t\t\t}\n\t\t} else if (typeof obj.hasOwnProperty === \"function\") {\n\t\t\t// Slow path for objects inheriting Object.prototype, hasOwnProperty check needed\n\t\t\tfor (key in obj) {\n\t\t\t\tif (obj.hasOwnProperty(key)) {\n\t\t\t\t\titerator.call(context, obj[key], key, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Slow path for objects which do not have a method `hasOwnProperty`\n\t\t\tfor (key in obj) {\n\t\t\t\tif (hasOwnProperty.call(obj, key)) {\n\t\t\t\t\titerator.call(context, obj[key], key, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn obj;\n}", "label": 1, "label_name": "safe"} +{"code": " def make_homeserver(self, reactor, clock):\n\n presence_handler = Mock()\n presence_handler.set_state.return_value = defer.succeed(None)\n\n hs = self.setup_test_homeserver(\n \"red\",\n http_client=None,\n federation_client=Mock(),\n presence_handler=presence_handler,\n )\n\n return hs", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus SimpleOpEval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, /*index=*/0, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, /*index=*/1, &input2));\n\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, /*index=*/0, &output));\n\n int32_t* output_data = output->data.i32;\n *output_data = *(input1->data.i32) + *(input2->data.i32);\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": "def add_run_subparser(subparsers):\n \"\"\"Add parser for `run`.\"\"\"\n run_msg = ('Usage example:\\n'\n 'To run input tensors from files through a MetaGraphDef and save'\n ' the output tensors to files:\\n'\n '$saved_model_cli show --dir /tmp/saved_model --tag_set serve \\\\\\n'\n ' --signature_def serving_default \\\\\\n'\n ' --inputs input1_key=/tmp/124.npz[x],input2_key=/tmp/123.npy '\n '\\\\\\n'\n ' --input_exprs \\'input3_key=np.ones(2)\\' \\\\\\n'\n ' --input_examples '\n '\\'input4_key=[{\"id\":[26],\"weights\":[0.5, 0.5]}]\\' \\\\\\n'\n ' --outdir=/out\\n\\n'\n 'For more information about input file format, please see:\\n'\n 'https://www.tensorflow.org/guide/saved_model_cli\\n')\n parser_run = subparsers.add_parser(\n 'run', description=run_msg, formatter_class=argparse.RawTextHelpFormatter)\n parser_run.add_argument(\n '--dir',\n type=str,\n required=True,\n help='directory containing the SavedModel to execute')\n parser_run.add_argument(\n '--tag_set',\n type=str,\n required=True,\n help='tag-set of graph in SavedModel to load, separated by \\',\\'')\n parser_run.add_argument(\n '--signature_def',\n type=str,\n required=True,\n metavar='SIGNATURE_DEF_KEY',\n help='key of SignatureDef to run')\n msg = ('Loading inputs from files, in the format of \\'=,'\n ' or \\'=[]\\', separated by \\';\\'.'\n ' The file format can only be from .npy, .npz or pickle.')\n parser_run.add_argument('--inputs', type=str, default='', help=msg)\n msg = ('Specifying inputs by python expressions, in the format of'\n ' \"=\\'\\'\", separated by \\';\\'. '\n 'numpy module is available as \\'np\\'. Please note that the expression '\n 'will be evaluated as-is, and is susceptible to code injection. '\n 'When this is set, the value will override duplicate input keys from '\n '--inputs option.')\n parser_run.add_argument('--input_exprs', type=str, default='', help=msg)\n msg = (\n 'Specifying tf.Example inputs as list of dictionaries. For example: '\n '=[{feature0:value_list,feature1:value_list}]. Use \";\" to '\n 'separate input keys. Will override duplicate input keys from --inputs '\n 'and --input_exprs option.')\n parser_run.add_argument('--input_examples', type=str, default='', help=msg)\n parser_run.add_argument(\n '--outdir',\n type=str,\n default=None,\n help='if specified, output tensor(s) will be saved to given directory')\n parser_run.add_argument(\n '--overwrite',\n action='store_true',\n help='if set, output file will be overwritten if it already exists.')\n parser_run.add_argument(\n '--tf_debug',\n action='store_true',\n help='if set, will use TensorFlow Debugger (tfdbg) to watch the '\n 'intermediate Tensors and runtime GraphDefs while running the '\n 'SavedModel.')\n parser_run.add_argument(\n '--worker',\n type=str,\n default=None,\n help='if specified, a Session will be run on the worker. '\n 'Valid worker specification is a bns or gRPC path.')\n parser_run.add_argument(\n '--init_tpu',\n action='store_true',\n default=None,\n help='if specified, tpu.initialize_system will be called on the Session. '\n 'This option should be only used if the worker is a TPU job.')\n parser_run.set_defaults(func=run)", "label": 1, "label_name": "safe"} +{"code": " it { should be_file }", "label": 0, "label_name": "vulnerable"} +{"code": " static function description() {\n return \"Manage events and schedules, and optionally publish them.\";\n }", "label": 1, "label_name": "safe"} +{"code": "def table_xchange_author_title():\n vals = request.get_json().get('xchange')\n edited_books_id = False\n if vals:\n for val in vals:\n modify_date = False\n book = calibre_db.get_book(val)\n authors = book.title\n book.authors = calibre_db.order_authors([book])\n author_names = []\n for authr in book.authors:\n author_names.append(authr.name.replace('|', ','))\n\n title_change = handle_title_on_edit(book, \" \".join(author_names))\n input_authors, authorchange, renamed = handle_author_on_edit(book, authors)\n if authorchange or title_change:\n edited_books_id = book.id\n modify_date = True\n\n if config.config_use_google_drive:\n gdriveutils.updateGdriveCalibreFromLocal()\n\n if edited_books_id:\n helper.update_dir_structure(edited_books_id, config.config_calibre_dir, input_authors[0],\n renamed_author=renamed)\n if modify_date:\n book.last_modified = datetime.utcnow()\n try:\n calibre_db.session.commit()\n except (OperationalError, IntegrityError) as e:\n calibre_db.session.rollback()\n log.error_or_exception(\"Database error: %s\", e)\n return json.dumps({'success': False})\n\n if config.config_use_google_drive:\n gdriveutils.updateGdriveCalibreFromLocal()\n return json.dumps({'success': True})\n return \"\"", "label": 1, "label_name": "safe"} +{"code": "static ssize_t _hostfs_writev(\n oe_fd_t* desc,\n const struct oe_iovec* iov,\n int iovcnt)\n{\n ssize_t ret = -1;\n file_t* file = _cast_file(desc);\n void* buf = NULL;\n size_t buf_size = 0;\n\n if (!file || !iov || iovcnt < 0 || iovcnt > OE_IOV_MAX)\n OE_RAISE_ERRNO(OE_EINVAL);\n\n /* Flatten the IO vector into contiguous heap memory. */\n if (oe_iov_pack(iov, iovcnt, &buf, &buf_size) != 0)\n OE_RAISE_ERRNO(OE_ENOMEM);\n\n /* Call the host. */\n if (oe_syscall_writev_ocall(&ret, file->host_fd, buf, iovcnt, buf_size) !=\n OE_OK)\n {\n OE_RAISE_ERRNO(OE_EINVAL);\n }\n\ndone:\n\n if (buf)\n oe_free(buf);\n\n return ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "image_load_gif(image_t *img,\t/* I - Image pointer */\n FILE *fp,\t/* I - File to load from */\n int gray,\t/* I - 0 = color, 1 = grayscale */\n int load_data)/* I - 1 = load image data, 0 = just info */\n{\n uchar\t\tbuf[1024];\t/* Input buffer */\n gif_cmap_t\tcmap;\t\t/* Colormap */\n int\t\tncolors,\t/* Bits per pixel */\n\t\ttransparent;\t/* Transparent color index */\n\n\n /*\n * Read the header; we already know it is a GIF file...\n */\n\n fread(buf, 13, 1, fp);\n\n img->width = (buf[7] << 8) | buf[6];\n img->height = (buf[9] << 8) | buf[8];\n ncolors = 2 << (buf[10] & 0x07);\n\n if (img->width <= 0 || img->width > IMAGE_MAX_DIM || img->height <= 0 || img->height > IMAGE_MAX_DIM)\n return (-1);\n\n // If we are writing an encrypted PDF file, bump the use count so we create\n // an image object (Acrobat 6 bug workaround)\n if (Encryption)\n img->use ++;\n\n if (buf[10] & GIF_COLORMAP)\n if (gif_read_cmap(fp, ncolors, cmap, &gray))\n return (-1);\n\n transparent = -1;\n\n while (1)\n {\n switch (getc(fp))\n {\n case ';' :\t/* End of image */\n return (-1);\t\t/* Early end of file */\n\n case '!' :\t/* Extension record */\n buf[0] = (uchar)getc(fp);\n if (buf[0] == 0xf9)\t/* Graphic Control Extension */\n {\n gif_get_block(fp, buf);\n if (buf[0] & 1)\t/* Get transparent color index */\n transparent = buf[3];\n }\n\n while (gif_get_block(fp, buf) != 0);\n break;\n\n case ',' :\t/* Image data */\n fread(buf, 9, 1, fp);\n\n if (buf[8] & GIF_COLORMAP)\n {\n ncolors = 2 << (buf[8] & 0x07);\n\n\t if (gif_read_cmap(fp, ncolors, cmap, &gray))\n\t return (-1);\n\t }\n\n img->width = (buf[5] << 8) | buf[4];\n img->height = (buf[7] << 8) | buf[6];\n img->depth = gray ? 1 : 3;\n\n\t if (img->width <= 0 || img->width > IMAGE_MAX_DIM || img->height <= 0 || img->height > IMAGE_MAX_DIM)\n\t return (-1);\n\n if (transparent >= 0)\n {\n /*\n * Map transparent color to background color...\n */\n\n if (BodyColor[0])\n\t {\n\t float rgb[3]; /* RGB color */\n\n\n\t get_color((uchar *)BodyColor, rgb);\n\n\t cmap[transparent][0] = (uchar)(rgb[0] * 255.0f + 0.5f);\n\t cmap[transparent][1] = (uchar)(rgb[1] * 255.0f + 0.5f);\n\t cmap[transparent][2] = (uchar)(rgb[2] * 255.0f + 0.5f);\n\t }\n\t else\n\t {\n\t cmap[transparent][0] = 255;\n cmap[transparent][1] = 255;\n cmap[transparent][2] = 255;\n\t }\n\n /*\n\t * Allocate a mask image...\n\t */\n\n image_need_mask(img);\n\t }\n\n\t if (!load_data)\n\t return (0);\n\n img->pixels = (uchar *)malloc((size_t)(img->width * img->height * img->depth));\n if (img->pixels == NULL)\n return (-1);\n\n\t return (gif_read_image(fp, img, cmap, buf[8] & GIF_INTERLACE, transparent));\n }\n }\n}", "label": 1, "label_name": "safe"} +{"code": "Runnable.prototype.clearTimeout = function(){\n clearTimeout(this.timer);\n};", "label": 0, "label_name": "vulnerable"} +{"code": " public override void Start(Session session, KeyExchangeInitMessage message)\n {\n base.Start(session, message);\n\n Session.RegisterMessage(\"SSH_MSG_KEX_ECDH_REPLY\");\n\n Session.KeyExchangeEcdhReplyMessageReceived += Session_KeyExchangeEcdhReplyMessageReceived;\n\n var basepoint = new byte[MontgomeryCurve25519.PublicKeySizeInBytes];\n basepoint[0] = 9;\n\n var rnd = new Random();\n _privateKey = new byte[MontgomeryCurve25519.PrivateKeySizeInBytes];\n rnd.NextBytes(_privateKey);\n\n _clientExchangeValue = new byte[MontgomeryCurve25519.PublicKeySizeInBytes];\n MontgomeryOperations.scalarmult(_clientExchangeValue, 0, _privateKey, 0, basepoint, 0);\n\n SendMessage(new KeyExchangeEcdhInitMessage(_clientExchangeValue));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"is a kind of OperationFailure\" do\n Moped::Errors::QueryFailure.ancestors.should \\\n include Moped::Errors::OperationFailure\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,\n\t\t const struct in6_addr *force_saddr)\n{\n\tstruct net *net = dev_net(skb->dev);\n\tstruct inet6_dev *idev = NULL;\n\tstruct ipv6hdr *hdr = ipv6_hdr(skb);\n\tstruct sock *sk;\n\tstruct ipv6_pinfo *np;\n\tconst struct in6_addr *saddr = NULL;\n\tstruct dst_entry *dst;\n\tstruct icmp6hdr tmp_hdr;\n\tstruct flowi6 fl6;\n\tstruct icmpv6_msg msg;\n\tstruct sockcm_cookie sockc_unused = {0};\n\tstruct ipcm6_cookie ipc6;\n\tint iif = 0;\n\tint addr_type = 0;\n\tint len;\n\tint err = 0;\n\tu32 mark = IP6_REPLY_MARK(net, skb->mark);\n\n\tif ((u8 *)hdr < skb->head ||\n\t (skb_network_header(skb) + sizeof(*hdr)) > skb_tail_pointer(skb))\n\t\treturn;\n\n\t/*\n\t *\tMake sure we respect the rules\n\t *\ti.e. RFC 1885 2.4(e)\n\t *\tRule (e.1) is enforced by not using icmp6_send\n\t *\tin any code that processes icmp errors.\n\t */\n\taddr_type = ipv6_addr_type(&hdr->daddr);\n\n\tif (ipv6_chk_addr(net, &hdr->daddr, skb->dev, 0) ||\n\t ipv6_chk_acast_addr_src(net, skb->dev, &hdr->daddr))\n\t\tsaddr = &hdr->daddr;\n\n\t/*\n\t *\tDest addr check\n\t */\n\n\tif (addr_type & IPV6_ADDR_MULTICAST || skb->pkt_type != PACKET_HOST) {\n\t\tif (type != ICMPV6_PKT_TOOBIG &&\n\t\t !(type == ICMPV6_PARAMPROB &&\n\t\t code == ICMPV6_UNK_OPTION &&\n\t\t (opt_unrec(skb, info))))\n\t\t\treturn;\n\n\t\tsaddr = NULL;\n\t}\n\n\taddr_type = ipv6_addr_type(&hdr->saddr);\n\n\t/*\n\t *\tSource addr check\n\t */\n\n\tif (__ipv6_addr_needs_scope_id(addr_type))\n\t\tiif = skb->dev->ifindex;\n\telse {\n\t\tdst = skb_dst(skb);\n\t\tiif = l3mdev_master_ifindex(dst ? dst->dev : skb->dev);\n\t}\n\n\t/*\n\t *\tMust not send error if the source does not uniquely\n\t *\tidentify a single node (RFC2463 Section 2.4).\n\t *\tWe check unspecified / multicast addresses here,\n\t *\tand anycast addresses will be checked later.\n\t */\n\tif ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) {\n\t\tnet_dbg_ratelimited(\"icmp6_send: addr_any/mcast source [%pI6c > %pI6c]\\n\",\n\t\t\t\t &hdr->saddr, &hdr->daddr);\n\t\treturn;\n\t}\n\n\t/*\n\t *\tNever answer to a ICMP packet.\n\t */\n\tif (is_ineligible(skb)) {\n\t\tnet_dbg_ratelimited(\"icmp6_send: no reply to icmp error [%pI6c > %pI6c]\\n\",\n\t\t\t\t &hdr->saddr, &hdr->daddr);\n\t\treturn;\n\t}\n\n\tmip6_addr_swap(skb);\n\n\tmemset(&fl6, 0, sizeof(fl6));\n\tfl6.flowi6_proto = IPPROTO_ICMPV6;\n\tfl6.daddr = hdr->saddr;\n\tif (force_saddr)\n\t\tsaddr = force_saddr;\n\tif (saddr)\n\t\tfl6.saddr = *saddr;\n\tfl6.flowi6_mark = mark;\n\tfl6.flowi6_oif = iif;\n\tfl6.fl6_icmp_type = type;\n\tfl6.fl6_icmp_code = code;\n\tsecurity_skb_classify_flow(skb, flowi6_to_flowi(&fl6));\n\n\tsk = icmpv6_xmit_lock(net);\n\tif (!sk)\n\t\treturn;\n\tsk->sk_mark = mark;\n\tnp = inet6_sk(sk);\n\n\tif (!icmpv6_xrlim_allow(sk, type, &fl6))\n\t\tgoto out;\n\n\ttmp_hdr.icmp6_type = type;\n\ttmp_hdr.icmp6_code = code;\n\ttmp_hdr.icmp6_cksum = 0;\n\ttmp_hdr.icmp6_pointer = htonl(info);\n\n\tif (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))\n\t\tfl6.flowi6_oif = np->mcast_oif;\n\telse if (!fl6.flowi6_oif)\n\t\tfl6.flowi6_oif = np->ucast_oif;\n\n\tipc6.tclass = np->tclass;\n\tfl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel);\n\n\tdst = icmpv6_route_lookup(net, skb, sk, &fl6);\n\tif (IS_ERR(dst))\n\t\tgoto out;\n\n\tipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);\n\tipc6.dontfrag = np->dontfrag;\n\tipc6.opt = NULL;\n\n\tmsg.skb = skb;\n\tmsg.offset = skb_network_offset(skb);\n\tmsg.type = type;\n\n\tlen = skb->len - msg.offset;\n\tlen = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) - sizeof(struct icmp6hdr));\n\tif (len < 0) {\n\t\tnet_dbg_ratelimited(\"icmp: len problem [%pI6c > %pI6c]\\n\",\n\t\t\t\t &hdr->saddr, &hdr->daddr);\n\t\tgoto out_dst_release;\n\t}\n\n\trcu_read_lock();\n\tidev = __in6_dev_get(skb->dev);\n\n\terr = ip6_append_data(sk, icmpv6_getfrag, &msg,\n\t\t\t len + sizeof(struct icmp6hdr),\n\t\t\t sizeof(struct icmp6hdr),\n\t\t\t &ipc6, &fl6, (struct rt6_info *)dst,\n\t\t\t MSG_DONTWAIT, &sockc_unused);\n\tif (err) {\n\t\tICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);\n\t\tip6_flush_pending_frames(sk);\n\t} else {\n\t\terr = icmpv6_push_pending_frames(sk, &fl6, &tmp_hdr,\n\t\t\t\t\t\t len + sizeof(struct icmp6hdr));\n\t}\n\trcu_read_unlock();\nout_dst_release:\n\tdst_release(dst);\nout:\n\ticmpv6_xmit_unlock(sk);\n}", "label": 1, "label_name": "safe"} +{"code": " $cost = $opt[2] == '$' ? $opt[4] : $basePrice * ($opt[4] * .01);\n $cost = $opt[3] == '+' ? $cost : $cost * -1;\n $price += $cost;\n $options[] = $opt;\n }\n }\n $params['options'] = serialize($options);\n $params['products_price'] = $price;\n $params['product_id'] = $product->id;\n $params['product_type'] = $product->product_type;\n\n $newitem = new orderitem($params);\n //eDebug($item, true);\n $newitem->products_price = $price;\n $newitem->options = serialize($options);\n\n $sm = $order->getCurrentShippingMethod();\n $newitem->shippingmethods_id = $sm->id;\n $newitem->save();\n $order->refresh();\n }\n }\n $order->save();\n /*eDebug($items);\n \n \n $options = array(); \n foreach ($this->optiongroup as $og) {\n if ($og->required && empty($params['options'][$og->id][0])) {\n \n flash('error', $this->title.' '.gt('requires some options to be selected before you can add it to your cart.'));\n redirect_to(array('controller'=>store, 'action'=>'show', 'id'=>$this->id));\n }\n if (!empty($params['options'][$og->id])) {\n foreach ($params['options'][$og->id] as $opt_id) {\n $selected_option = new option($opt_id);\n $cost = $selected_option->modtype == '$' ? $selected_option->amount : $this->getBasePrice() * ($selected_option->amount * .01);\n $cost = $selected_option->updown == '+' ? $cost : $cost * -1; \n $price += $cost;\n $options[] = array($selected_option->id,$selected_option->title,$selected_option->modtype,$selected_option->updown,$selected_option->amount);\n }\n }\n }\n //die();\n // add the product to the cart.\n $params['options'] = serialize($options);\n $params['products_price'] = $price;\n $item = new orderitem($params);\n //eDebug($item, true);\n $item->products_price = $price;\n $item->options = serialize($options);\n \n $sm = $order->getCurrentShippingMethod();\n $item->shippingmethods_id = $sm->id;\n $item->save(); */\n return true;\n\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tfilter = function(hashes, inExec) {\n\t\t\tvar czipdl = (fm.api > 2)? fm.command('zipdl') : null,\n\t\t\t\tmixed = false,\n\t\t\t\tcroot = '';\n\t\t\t\n\t\t\tif (czipdl !== null && fm.searchStatus.state > 1 && fm.searchStatus.target === '') {\n\t\t\t\tcroot = fm.root(hashes[0]);\n\t\t\t\t$.each(hashes, function(i, h) {\n\t\t\t\t\tif (mixed = (croot !== fm.root(h))) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tzipOn = (! mixed && czipdl !== null && fm.isCommandEnabled('zipdl', hashes[0]));\n\n\t\t\tif (mixed) {\n\t\t\t\thashes = $.map(hashes, function(h) {\n\t\t\t\t\treturn fm.isCommandEnabled('download', h)? h : null;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (!fm.isCommandEnabled('download', hashes[0])) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn $.map(self.files(hashes), function(f) { \n\t\t\t\tinExec && ! f.read && $('#' + fm.cwdHash2Id(f.hash)).trigger('unselect');\n\t\t\t\treturn (! f.read || (! zipOn && f.mime == 'directory')) ? null : f;\n\t\t\t});\n\t\t};", "label": 1, "label_name": "safe"} +{"code": "function add_application($uniq_name_orig,$uniq_name,$process_name,$display,$url,$command,$type,$min_value,$bdd){\n\tif($type != 'MIN'){\n\t\t$min_value = \"\";\n\t}\n\t$sql = \"select count(*) from bp where name = ?;\";\n\t$req = $bdd->prepare($sql);\n\t$req->execute(array($uniq_name));\n\t$bp_exist = $req->fetch();\n\n\t// add\n\tif($bp_exist[0] == 0 and empty($uniq_name_orig)){\n\t\t$sql = \"insert into bp (name,description,priority,type,command,url,min_value) values(?,?,?,?,?,?,?)\";\n\t\t$req = $bdd->prepare($sql);\n\t\t$req->execute(array($uniq_name,$process_name,$display,$type,$command,$url,$min_value));\n\t}\n\t// uniq name modification\n\telseif($uniq_name_orig != $uniq_name) {\n\t\tif($bp_exist[0] != 0){\n\t\t\t// TODO QUENTIN\n\t\t} else {\n\t\t\t$sql = \"update bp set name = ?,description = ?,priority = ?,type = ?,command = ?,url = ?,min_value = ? where name = ?\";\n\t\t\t$req = $bdd->prepare($sql);\n\t\t\t$req->execute(array($uniq_name,$process_name,$display,$type,$command,$url,$min_value,$uniq_name_orig));\n\t\t\t$sql = \"update bp_links set bp_name = ? where bp_name = ?\";\n\t\t\t$req = $bdd->prepare($sql);\n\t\t\t$req->execute(array($uniq_name,$uniq_name_orig));\t\n\t\t\t$sql = \"update bp_links set bp_link = ? where bp_link = ?\";\n\t\t\t$req = $bdd->prepare($sql);\n\t\t\t$req->execute(array($uniq_name,$uniq_name_orig));\n\t\t\t$sql = \"update bp_services set bp_name = ? where bp_name = ?\";\t\t\t\t\t\n\t\t\t$req = $bdd->prepare($sql);\n\t\t\t$req->execute(array($uniq_name,$uniq_name_orig));\t\n\t\t}\n\t}\t\n\t// modification\n\telse{\n\t\t$sql = \"update bp set name = ?,description = ?,priority = ?,type = ?,command = ?,url = ?,min_value = ? where name = ?\";\n\t\t$req = $bdd->prepare($sql);\n\t\t$req->execute(array($uniq_name,$process_name,$display,$type,$command,$url,$min_value,$uniq_name));\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "static Array HHVM_METHOD(Memcache, getextendedstats,\n const String& /*type*/ /* = null_string */,\n int /*slabid*/ /* = 0 */, int /*limit*/ /* = 100 */) {\n auto data = Native::data(this_);\n memcached_return_t ret;\n memcached_stat_st *stats;\n\n stats = memcached_stat(&data->m_memcache, nullptr, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n return Array();\n }\n\n int server_count = memcached_server_count(&data->m_memcache);\n\n Array return_val;\n\n for (int server_id = 0; server_id < server_count; server_id++) {\n memcached_stat_st *stat;\n LMCD_SERVER_POSITION_INSTANCE_TYPE instance =\n memcached_server_instance_by_position(&data->m_memcache, server_id);\n const char *hostname = LMCD_SERVER_HOSTNAME(instance);\n in_port_t port = LMCD_SERVER_PORT(instance);\n\n stat = stats + server_id;\n\n Array server_stats = memcache_build_stats(&data->m_memcache, stat, &ret);\n if (ret != MEMCACHED_SUCCESS) {\n continue;\n }\n\n auto const port_str = folly::to(port);\n auto const key_len = strlen(hostname) + 1 + port_str.length();\n auto key = String(key_len, ReserveString);\n key += hostname;\n key += \":\";\n key += port_str;\n return_val.set(key, server_stats);\n }\n\n free(stats);\n return return_val;\n}", "label": 1, "label_name": "safe"} +{"code": " public static final void testUnterminatedObject() {\n // Found by Fabian Meumertzheim using CI Fuzz (https://www.code-intelligence.com)\n String input = \"?\\u0000\\u0000\\u0000{{\\u0000\\ufffd\\u0003]ve{R]\\u00000\\ufffd\\u0016&e{\\u0003]\\ufffda EncryptedReadRecordLayer::read(\n folly::IOBufQueue& buf) {\n auto decryptedBuf = getDecryptedBuf(buf);\n if (!decryptedBuf) {\n return folly::none;\n }\n\n TLSMessage msg;\n // Iterate over the buffers while trying to find\n // the first non-zero octet. This is much faster than\n // first iterating and then trimming.\n auto currentBuf = decryptedBuf->get();\n bool nonZeroFound = false;\n do {\n currentBuf = currentBuf->prev();\n size_t i = currentBuf->length();\n while (i > 0 && !nonZeroFound) {\n nonZeroFound = (currentBuf->data()[i - 1] != 0);\n i--;\n }\n if (nonZeroFound) {\n msg.type = static_cast(currentBuf->data()[i]);\n }\n currentBuf->trimEnd(currentBuf->length() - i);\n } while (!nonZeroFound && currentBuf != decryptedBuf->get());\n if (!nonZeroFound) {\n throw std::runtime_error(\"No content type found\");\n }\n msg.fragment = std::move(*decryptedBuf);\n\n switch (msg.type) {\n case ContentType::handshake:\n case ContentType::alert:\n case ContentType::application_data:\n break;\n default:\n throw std::runtime_error(folly::to(\n \"received encrypted content type \",\n static_cast(msg.type)));\n }\n\n if (!msg.fragment || msg.fragment->empty()) {\n if (msg.type == ContentType::application_data) {\n msg.fragment = folly::IOBuf::create(0);\n } else {\n throw std::runtime_error(\"received empty fragment\");\n }\n }\n\n return msg;\n}", "label": 1, "label_name": "safe"} +{"code": "0;N>>8;return u};Editor.crc32=function(u){for(var E=-1,J=0;J>>8^Editor.crcTable[(E^u.charCodeAt(J))&255];return(E^-1)>>>0};Editor.writeGraphModelToPng=function(u,E,J,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label": 0, "label_name": "vulnerable"} +{"code": "\tprotected function _scandir($path) {\n\t\treturn isset($this->dirsCache[$path])\n\t\t\t? $this->dirsCache[$path]\n\t\t\t: $this->cacheDir($path);\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function getPath($hash) {\n\t\treturn $this->decode($hash);\n\t}", "label": 1, "label_name": "safe"} +{"code": "void Avahi::addService(int, int, const QString &name, const QString &type, const QString &domain, uint)\n{\n if (isLocalDomain(domain) && !services.contains(name)) {\n AvahiService *srv=new AvahiService(name, type, domain);\n services.insert(name, srv);\n connect(srv, SIGNAL(serviceResolved(QString)), this, SIGNAL(serviceAdded(QString)));\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public void translate(GeyserSession session, ServerVehicleMovePacket packet) {\n Entity entity = session.getRidingVehicleEntity();\n if (entity == null) return;\n\n entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, true);\n }", "label": 1, "label_name": "safe"} +{"code": "M.setBackgroundImage=this.editor.graph.setBackgroundImage;M.background=this.editor.graph.background;var K=this.pages[0];this.currentPage==K?M.setBackgroundImage(this.editor.graph.backgroundImage):null!=K.viewState&&null!=K.viewState&&M.setBackgroundImage(K.viewState.backgroundImage);M.getGlobalVariable=function(B){return\"page\"==B?K.getName():\"pagenumber\"==B?1:x.apply(this,arguments)};document.body.appendChild(M.container);M.model.setRoot(K.root)}}v=null!=v?v:this.getXmlFileData(m,q,z,L);A=null!=A?", "label": 1, "label_name": "safe"} +{"code": "\tfunction _fnInitialise ( settings )\r\n\t{\r\n\t\tvar i, iLen, iAjaxStart=settings.iInitDisplayStart;\r\n\t\tvar columns = settings.aoColumns, column;\r\n\t\tvar features = settings.oFeatures;\r\n\t\r\n\t\t/* Ensure that the table data is fully initialised */\r\n\t\tif ( ! settings.bInitialised ) {\r\n\t\t\tsetTimeout( function(){ _fnInitialise( settings ); }, 200 );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\r\n\t\t/* Show the display HTML options */\r\n\t\t_fnAddOptionsHtml( settings );\r\n\t\r\n\t\t/* Build and draw the header / footer for the table */\r\n\t\t_fnBuildHead( settings );\r\n\t\t_fnDrawHead( settings, settings.aoHeader );\r\n\t\t_fnDrawHead( settings, settings.aoFooter );\r\n\t\r\n\t\t/* Okay to show that something is going on now */\r\n\t\t_fnProcessingDisplay( settings, true );\r\n\t\r\n\t\t/* Calculate sizes for columns */\r\n\t\tif ( features.bAutoWidth ) {\r\n\t\t\t_fnCalculateColumnWidths( settings );\r\n\t\t}\r\n\t\r\n\t\tfor ( i=0, iLen=columns.length ; ioldFactory = HTMLPurifier_DefinitionCacheFactory::instance();\n HTMLPurifier_DefinitionCacheFactory::instance($factory);\n generate_mock_once(\"HTMLPurifier_DefinitionCache\");\n $mock = new HTMLPurifier_DefinitionCacheMock();\n $config = HTMLPurifier_Config::createDefault();\n $factory->returns('create', $mock, array($type, $config));\n return array($mock, $config);\n }", "label": 1, "label_name": "safe"} +{"code": "isoclns_print(netdissect_options *ndo, const uint8_t *p, u_int length)\n{\n\tif (!ND_TTEST(*p)) { /* enough bytes on the wire ? */\n\t\tND_PRINT((ndo, \"|OSI\"));\n\t\treturn;\n\t}\n\n\tif (ndo->ndo_eflag)\n\t\tND_PRINT((ndo, \"OSI NLPID %s (0x%02x): \", tok2str(nlpid_values, \"Unknown\", *p), *p));\n\n\tswitch (*p) {\n\n\tcase NLPID_CLNP:\n\t\tif (!clnp_print(ndo, p, length))\n\t\t\tprint_unknown_data(ndo, p, \"\\n\\t\", length);\n\t\tbreak;\n\n\tcase NLPID_ESIS:\n\t\tesis_print(ndo, p, length);\n\t\treturn;\n\n\tcase NLPID_ISIS:\n\t\tif (!isis_print(ndo, p, length))\n\t\t\tprint_unknown_data(ndo, p, \"\\n\\t\", length);\n\t\tbreak;\n\n\tcase NLPID_NULLNS:\n\t\tND_PRINT((ndo, \"%slength: %u\", ndo->ndo_eflag ? \"\" : \", \", length));\n\t\tbreak;\n\n\tcase NLPID_Q933:\n\t\tq933_print(ndo, p + 1, length - 1);\n\t\tbreak;\n\n\tcase NLPID_IP:\n\t\tip_print(ndo, p + 1, length - 1);\n\t\tbreak;\n\n\tcase NLPID_IP6:\n\t\tip6_print(ndo, p + 1, length - 1);\n\t\tbreak;\n\n\tcase NLPID_PPP:\n\t\tppp_print(ndo, p + 1, length - 1);\n\t\tbreak;\n\n\tdefault:\n\t\tif (!ndo->ndo_eflag)\n\t\t\tND_PRINT((ndo, \"OSI NLPID 0x%02x unknown\", *p));\n\t\tND_PRINT((ndo, \"%slength: %u\", ndo->ndo_eflag ? \"\" : \", \", length));\n\t\tif (length > 1)\n\t\t\tprint_unknown_data(ndo, p, \"\\n\\t\", length);\n\t\tbreak;\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "function(c,e){if(Graph.isPageLink(e)){var g=c[e.substring(e.indexOf(\",\")+1)];e=null!=g?\"data:page/id,\"+g:null}else if(\"data:action/json,\"==e.substring(0,17))try{var k=JSON.parse(e.substring(17));if(null!=k.actions){for(var m=0;m= 64 {\n\t\t\t\treturn ErrIntOverflowCasttype\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: Wilson: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: Wilson: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Int64\", wireType)\n\t\t\t}\n\t\t\tvar v int64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowCasttype\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Int64 = &v\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipCasttype(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthCasttype\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthCasttype\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static void ImportCbYCrYQuantum(const Image *image,QuantumInfo *quantum_info,\n const MagickSizeType number_pixels,const unsigned char *magick_restrict p,\n Quantum *magick_restrict q,ExceptionInfo *exception)\n{\n QuantumAny\n range;\n\n register ssize_t\n x;\n\n unsigned int\n pixel;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n switch (quantum_info->depth)\n {\n case 10:\n {\n Quantum\n cbcr[4];\n\n pixel=0;\n if (quantum_info->pack == MagickFalse)\n {\n register ssize_t\n i;\n\n size_t\n quantum;\n\n ssize_t\n n;\n\n n=0;\n quantum=0;\n for (x=0; x < (ssize_t) number_pixels; x+=2)\n {\n for (i=0; i < 4; i++)\n {\n switch (n % 3)\n {\n case 0:\n {\n p=PushLongPixel(quantum_info->endian,p,&pixel);\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 22) & 0x3ff) << 6)));\n break;\n }\n case 1:\n {\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 12) & 0x3ff) << 6)));\n break;\n }\n case 2:\n {\n quantum=(size_t) (ScaleShortToQuantum((unsigned short)\n (((pixel >> 2) & 0x3ff) << 6)));\n break;\n }\n }\n cbcr[i]=(Quantum) (quantum);\n n++;\n }\n p+=quantum_info->pad;\n SetPixelRed(image,cbcr[1],q);\n SetPixelGreen(image,cbcr[0],q);\n SetPixelBlue(image,cbcr[2],q);\n q+=GetPixelChannels(image);\n SetPixelRed(image,cbcr[3],q);\n SetPixelGreen(image,cbcr[0],q);\n SetPixelBlue(image,cbcr[2],q);\n q+=GetPixelChannels(image);\n }\n break;\n }\n }\n default:\n {\n range=GetQuantumRange(quantum_info->depth);\n for (x=0; x < (ssize_t) number_pixels; x++)\n {\n p=PushQuantumPixel(quantum_info,p,&pixel);\n SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q);\n p=PushQuantumPixel(quantum_info,p,&pixel);\n SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q);\n q+=GetPixelChannels(image);\n }\n break;\n }\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function edit_internalalias() {\r\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\r\n if ($section->parent == -1) {\r\n notfoundController::handle_not_found();\r\n exit;\r\n } // doesn't work for standalone pages\r\n if (empty($section->id)) {\r\n $section->public = 1;\r\n if (!isset($section->parent)) {\r\n // This is another precaution. The parent attribute\r\n // should ALWAYS be set by the caller.\r\n //FJD - if that's the case, then we should die.\r\n notfoundController::handle_not_authorized();\r\n exit;\r\n //$section->parent = 0;\r\n }\r\n }\r\n assign_to_template(array(\r\n 'section' => $section,\r\n 'glyphs' => self::get_glyphs(),\r\n ));\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "IMAGE_PATH+'/spin.gif\" valign=\"middle\"> '+mxUtils.htmlEntities(mxResources.get(\"loading\"))+\"...\";C=b.canReplyToReplies();b.commentsSupported()?b.getComments(function(J){function V(P){if(null!=P){P.sort(function(ia,la){return new Date(ia.modifiedDate)-new Date(la.modifiedDate)});for(var R=0;Rnexthdr;\n\n\twhile (offset <= packet_len) {\n\t\tstruct ipv6_opt_hdr *exthdr;\n\t\tunsigned int len;\n\n\t\tswitch (**nexthdr) {\n\n\t\tcase NEXTHDR_HOP:\n\t\t\tbreak;\n\t\tcase NEXTHDR_ROUTING:\n\t\t\tfound_rhdr = 1;\n\t\t\tbreak;\n\t\tcase NEXTHDR_DEST:\n#if IS_ENABLED(CONFIG_IPV6_MIP6)\n\t\t\tif (ipv6_find_tlv(skb, offset, IPV6_TLV_HAO) >= 0)\n\t\t\t\tbreak;\n#endif\n\t\t\tif (found_rhdr)\n\t\t\t\treturn offset;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn offset;\n\t\t}\n\n\t\tif (offset + sizeof(struct ipv6_opt_hdr) > packet_len)\n\t\t\treturn -EINVAL;\n\n\t\texthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) +\n\t\t\t\t\t\t offset);\n\t\tlen = ipv6_optlen(exthdr);\n\t\tif (len + offset >= IPV6_MAXPLEN)\n\t\t\treturn -EINVAL;\n\t\toffset += len;\n\t\t*nexthdr = &exthdr->nexthdr;\n\t}\n\n\treturn -EINVAL;\n}", "label": 1, "label_name": "safe"} +{"code": "def pascal_case(value: str) -> str:\n return stringcase.pascalcase(_sanitize(value))", "label": 1, "label_name": "safe"} +{"code": "return null}))}),L,l,I,X.size)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get(\"invalidOrMissingFile\")})})))}else K=D.target.result,p(K,X.type,g+U*F,k+U*F,240,160,X.name,function(ba){M(U,function(){return ba})},X)});/(\\.v(dx|sdx?))($|\\?)/i.test(X.name)||/(\\.vs(x|sx?))($|\\?)/i.test(X.name)?p(null,X.type,g+U*F,k+U*F,240,160,X.name,function(D){M(U,function(){return D})},X):\"image\"==X.type.substring(0,5)||\"application/pdf\"==X.type?u.readAsDataURL(X):u.readAsText(X)}})(W)});if(C){C=", "label": 1, "label_name": "safe"} +{"code": "\tpublic static void copyDb(\n\t String jdbcDriverSource,\n\t String usernameSource,\n\t String passwordSource,\n\t String jdbcUrlSource,\n\t String jdbcDriverTarget,\n\t String usernameTarget,\n\t String passwordTarget,\n\t String jdbcUrlTarget,\n\t List includeDbObjects,\n\t List excludeDbObjects,\n\t List valuePatterns,\n\t List valueReplacements,\n\t PrintStream out\n\t) throws ServiceException {\n\t\t{\n\t\t\tDBOBJECTS.clear();\n\t\t\tList tableNames = new ArrayList();\n\t\t\ttry {\n\t\t\t\ttableNames = DbSchemaUtils.getTableNames();\n\t\t\t} catch (Exception e) {\n\t\t\t\tnew ServiceException(e).log();\n\t\t\t}\n\t\t\tfor(String tableName : tableNames) {\n\t\t\t\tif(\n\t\t\t\t\ttableName.indexOf(\"_\") > 0 &&\n\t\t\t\t\ttableName.indexOf(\"_TOBJ_\") < 0 &&\n\t\t\t\t\ttableName.indexOf(\"_JOIN_\") < 0 &&\n\t\t\t\t\t!tableName.endsWith(\"_\")\n\t\t\t\t) {\n\t\t\t\t\tDBOBJECTS.add(tableName);\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t}\n\t\ttry {\n\t\t\t// Source connection\n\t\t\tClass.forName(jdbcDriverSource);\n\t\t\tProperties props = new Properties();\n\t\t\tprops.put(\"user\", usernameSource);\n\t\t\tprops.put(\"password\", passwordSource);\n\t\t\tConnection connSource = DriverManager.getConnection(jdbcUrlSource, props);\n\t\t\tconnSource.setAutoCommit(true);\n\t\t\t// Target connection\n\t\t\tClass.forName(jdbcDriverTarget);\n\t\t\tprops = new Properties();\n\t\t\tprops.put(\"user\", usernameTarget);\n\t\t\tprops.put(\"password\", passwordTarget);\n\t\t\tConnection connTarget = DriverManager.getConnection(jdbcUrlTarget, props);\n\t\t\tconnTarget.setAutoCommit(true);\n\t\t\tCopyDb.copyNamespace(\n\t\t\t\tconnSource, \n\t\t\t\tconnTarget,\n\t\t\t\tfilterDbObjects(\n\t\t\t\t\tDBOBJECTS, \n\t\t\t\t\tincludeDbObjects, \n\t\t\t\t\texcludeDbObjects\n\t\t\t\t),\n\t\t\t valuePatterns, \n\t\t\t valueReplacements, \n\t\t\t out\n\t\t\t);\n\t\t} catch (Exception e) {\n\t\t\tthrow new ServiceException(e);\n\t\t}\n\t\tout.println();\n\t\tout.println(\"!!! DONE !!!\");\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function returnChildrenAsJSON() {\r\n global $db;\r\n\r\n //$nav = section::levelTemplate(intval($_REQUEST['id'], 0));\r\n $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;\r\n $nav = $db->selectObjects('section', 'parent=' . $id, 'rank');\r\n //FIXME $manage_all is moot w/ cascading perms now?\r\n $manage_all = false;\r\n if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {\r\n $manage_all = true;\r\n }\r\n //FIXME recode to use foreach $key=>$value\r\n $navcount = count($nav);\r\n for ($i = 0; $i < $navcount; $i++) {\r\n if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {\r\n $nav[$i]->manage = 1;\r\n $view = true;\r\n } else {\r\n $nav[$i]->manage = 0;\r\n $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));\r\n }\r\n $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);\r\n if (!$view) unset($nav[$i]);\r\n }\r\n $nav= array_values($nav);\r\n// $nav[$navcount - 1]->last = true;\r\n if (count($nav)) $nav[count($nav) - 1]->last = true;\r\n// echo expJavascript::ajaxReply(201, '', $nav);\r\n $ar = new expAjaxReply(201, '', $nav);\r\n $ar->send();\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "H.x+\" \"+H.y;S=\"\";d=[];for(V=2;Vf;)x.shift()},P=", "label": 0, "label_name": "vulnerable"} +{"code": " public void testRenameTo() throws Exception {\n TestHttpData test = new TestHttpData(\"test\", UTF_8, 0);\n try {\n File tmpFile = PlatformDependent.createTempFile(UUID.randomUUID().toString(), \".tmp\", null);\n tmpFile.deleteOnExit();\n final int totalByteCount = 4096;\n byte[] bytes = new byte[totalByteCount];\n PlatformDependent.threadLocalRandom().nextBytes(bytes);\n ByteBuf content = Unpooled.wrappedBuffer(bytes);\n test.setContent(content);\n boolean succ = test.renameTo(tmpFile);\n assertTrue(succ);\n FileInputStream fis = new FileInputStream(tmpFile);\n try {\n byte[] buf = new byte[totalByteCount];\n int count = 0;\n int offset = 0;\n int size = totalByteCount;\n while ((count = fis.read(buf, offset, size)) > 0) {\n offset += count;\n size -= count;\n if (offset >= totalByteCount || size <= 0) {\n break;\n }\n }\n assertArrayEquals(bytes, buf);\n assertEquals(0, fis.available());\n } finally {\n fis.close();\n }\n } finally {\n //release the ByteBuf in AbstractMemoryHttpData\n test.delete();\n }\n }", "label": 1, "label_name": "safe"} +{"code": " public void sendError(int sc, String msg) throws IOException {\n if (isIncluding()) {\n Logger.log(Logger.ERROR, Launcher.RESOURCES, \"IncludeResponse.Error\",\n new String[] { \"\" + sc, msg });\n return;\n }\n \n Logger.log(Logger.DEBUG, Launcher.RESOURCES,\n \"WinstoneResponse.SendingError\", new String[] { \"\" + sc, msg });\n\n if ((this.webAppConfig != null) && (this.req != null)) {\n \n RequestDispatcher rd = this.webAppConfig\n .getErrorDispatcherByCode(req.getRequestURI(), sc, msg, null);\n if (rd != null) {\n try {\n rd.forward(this.req, this);\n return;\n } catch (IllegalStateException err) {\n throw err;\n } catch (IOException err) {\n throw err;\n } catch (Throwable err) {\n Logger.log(Logger.WARNING, Launcher.RESOURCES,\n \"WinstoneResponse.ErrorInErrorPage\", new String[] {\n rd.getName(), sc + \"\" }, err);\n return;\n }\n }\n }\n // If we are here there was no webapp and/or no request object, so \n // show the default error page\n if (this.errorStatusCode == null) {\n this.statusCode = sc;\n }\n String output = Launcher.RESOURCES.getString(\"WinstoneResponse.ErrorPage\",\n new String[] { sc + \"\", (msg == null ? \"\" : msg), \"\",\n Launcher.RESOURCES.getString(\"ServerVersion\"),\n \"\" + new Date() });\n setContentLength(output.getBytes(getCharacterEncoding()).length);\n Writer out = getWriter();\n out.write(output);\n out.flush();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static void cancel_att_send_op(void *data)\n{\n\tstruct att_send_op *op = data;\n\n\tif (op->destroy)\n\t\top->destroy(op->user_data);\n\n\top->user_data = NULL;\n\top->callback = NULL;\n\top->destroy = NULL;\n}", "label": 1, "label_name": "safe"} +{"code": " public function getAccessToken($grant, array $options = [])\n {\n $grant = $this->verifyGrant($grant);\n\n $params = [\n 'client_id' => $this->clientId,\n 'client_secret' => $this->clientSecret,\n 'redirect_uri' => $this->redirectUri,\n ];\n\n $params = $grant->prepareRequestParameters($params, $options);\n $request = $this->getAccessTokenRequest($params);\n $response = $this->getResponse($request);\n $prepared = $this->prepareAccessTokenResponse($response);\n $token = $this->createAccessToken($prepared, $grant);\n\n return $token;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " def string_to_port(value, proto)\n proto = proto.to_s\n unless proto =~ /^(tcp|udp)$/\n proto = 'tcp'\n end\n\n if value.kind_of?(String)\n if value.match(/^\\d+(-\\d+)?$/)\n return value\n else\n return Socket.getservbyname(value, proto).to_s\n end\n else\n Socket.getservbyname(value.to_s, proto).to_s\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " function getAuth()\n {\n $this->log('Auth::getAuth() called.', AUTH_LOG_DEBUG);\n return $this->checkAuth();\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function confirm() {\n global $db;\n \n // make sure we have what we need.\n if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));\n if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));\n \n // verify the id/key pair \n $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash=\"'.$this->params['key'].'\"');\n if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));\n \n // activate this users pending subscriptions\n $sub = new stdClass();\n $sub->enabled = 1;\n $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id);\n \n // find the users active subscriptions\n $ealerts = expeAlerts::getBySubscriber($id);\n assign_to_template(array(\n 'ealerts'=>$ealerts\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "mxCodecRegistry.register(function(){var a=new mxObjectCodec(new mxCell,[\"children\",\"edges\",\"overlays\",\"mxTransient\"],[\"parent\",\"source\",\"target\"]);a.isCellCodec=function(){return!0};a.isNumericAttribute=function(b,c,d){return\"value\"!==c.nodeName&&mxObjectCodec.prototype.isNumericAttribute.apply(this,arguments)};a.isExcluded=function(b,c,d,e){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||e&&\"value\"==c&&mxUtils.isNode(d)};a.afterEncode=function(b,c,d){if(null!=c.value&&mxUtils.isNode(c.value)){var e=\nd;d=mxUtils.importNode(b.document,c.value,!0);d.appendChild(e);b=e.getAttribute(\"id\");d.setAttribute(\"id\",b);e.removeAttribute(\"id\")}return d};a.beforeDecode=function(b,c,d){var e=c.cloneNode(!0),f=this.getName();c.nodeName!=f?(e=c.getElementsByTagName(f)[0],null!=e&&e.parentNode==c?(mxUtils.removeWhitespace(e,!0),mxUtils.removeWhitespace(e,!1),e.parentNode.removeChild(e)):e=null,d.value=c.cloneNode(!0),c=d.value.getAttribute(\"id\"),null!=c&&(d.setId(c),d.value.removeAttribute(\"id\"))):d.setId(c.getAttribute(\"id\"));", "label": 1, "label_name": "safe"} +{"code": "func (f *ScmpFilter) addRuleGeneric(call ScmpSyscall, action ScmpAction, exact bool, conds []ScmpCondition) error {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tif !f.valid {\n\t\treturn errBadFilter\n\t}\n\n\tif len(conds) == 0 {\n\t\tif err := f.addRuleWrapper(call, action, exact, nil); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// We don't support conditional filtering in library version v2.1\n\t\tif !checkVersionAbove(2, 2, 1) {\n\t\t\treturn VersionError{\n\t\t\t\tmessage: \"conditional filtering is not supported\",\n\t\t\t\tminimum: \"2.2.1\",\n\t\t\t}\n\t\t}\n\n\t\tfor _, cond := range conds {\n\t\t\tcmpStruct := C.make_struct_arg_cmp(C.uint(cond.Argument), cond.Op.toNative(), C.uint64_t(cond.Operand1), C.uint64_t(cond.Operand2))\n\t\t\tdefer C.free(cmpStruct)\n\n\t\t\tif err := f.addRuleWrapper(call, action, exact, C.scmp_cast_t(cmpStruct)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getCustomerReference()\n {\n return $this->getParameter('customerReference');\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function writeCb(err) {\n if (err)\n return onerror(err);\n\n total += nb;\n onstep && onstep(total, nb, fsize);\n\n if (nb < origChunkLen)\n return singleRead(datapos, dstpos + nb, origChunkLen - nb);\n\n if (total === fsize) {\n dst.close(dstHandle, (err) => {\n dstHandle = undefined;\n if (err)\n return onerror(err);\n src.close(srcHandle, (err) => {\n srcHandle = undefined;\n if (err)\n return onerror(err);\n cb();\n });\n });\n return;\n }\n\n if (pdst >= fsize)\n return;\n\n const chunk =\n (pdst + chunkSize > fsize ? fsize - pdst : chunkSize);\n singleRead(datapos, pdst, chunk);\n pdst += chunk;\n }", "label": 1, "label_name": "safe"} +{"code": "static void __exit acpi_custom_method_exit(void)\n{\n\tif (cm_dentry)\n\t\tdebugfs_remove(cm_dentry);\n }", "label": 1, "label_name": "safe"} +{"code": "long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)\n{\n\tstruct file *eventfp, *filep = NULL;\n\tstruct eventfd_ctx *ctx = NULL;\n\tu64 p;\n\tlong r;\n\tint i, fd;\n\n\t/* If you are not the owner, you can become one */\n\tif (ioctl == VHOST_SET_OWNER) {\n\t\tr = vhost_dev_set_owner(d);\n\t\tgoto done;\n\t}\n\n\t/* You must be the owner to do anything else */\n\tr = vhost_dev_check_owner(d);\n\tif (r)\n\t\tgoto done;\n\n\tswitch (ioctl) {\n\tcase VHOST_SET_MEM_TABLE:\n\t\tr = vhost_set_memory(d, argp);\n\t\tbreak;\n\tcase VHOST_SET_LOG_BASE:\n\t\tif (copy_from_user(&p, argp, sizeof p)) {\n\t\t\tr = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tif ((u64)(unsigned long)p != p) {\n\t\t\tr = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tfor (i = 0; i < d->nvqs; ++i) {\n\t\t\tstruct vhost_virtqueue *vq;\n\t\t\tvoid __user *base = (void __user *)(unsigned long)p;\n\t\t\tvq = d->vqs[i];\n\t\t\tmutex_lock(&vq->mutex);\n\t\t\t/* If ring is inactive, will check when it's enabled. */\n\t\t\tif (vq->private_data && !vq_log_access_ok(vq, base))\n\t\t\t\tr = -EFAULT;\n\t\t\telse\n\t\t\t\tvq->log_base = base;\n\t\t\tmutex_unlock(&vq->mutex);\n\t\t}\n\t\tbreak;\n\tcase VHOST_SET_LOG_FD:\n\t\tr = get_user(fd, (int __user *)argp);\n\t\tif (r < 0)\n\t\t\tbreak;\n\t\teventfp = fd == -1 ? NULL : eventfd_fget(fd);\n\t\tif (IS_ERR(eventfp)) {\n\t\t\tr = PTR_ERR(eventfp);\n\t\t\tbreak;\n\t\t}\n\t\tif (eventfp != d->log_file) {\n\t\t\tfilep = d->log_file;\n\t\t\td->log_file = eventfp;\n\t\t\tctx = d->log_ctx;\n\t\t\td->log_ctx = eventfp ?\n\t\t\t\teventfd_ctx_fileget(eventfp) : NULL;\n\t\t} else\n\t\t\tfilep = eventfp;\n\t\tfor (i = 0; i < d->nvqs; ++i) {\n\t\t\tmutex_lock(&d->vqs[i]->mutex);\n\t\t\td->vqs[i]->log_ctx = d->log_ctx;\n\t\t\tmutex_unlock(&d->vqs[i]->mutex);\n\t\t}\n\t\tif (ctx)\n\t\t\teventfd_ctx_put(ctx);\n\t\tif (filep)\n\t\t\tfput(filep);\n\t\tbreak;\n\tdefault:\n\t\tr = -ENOIOCTLCMD;\n\t\tbreak;\n\t}\ndone:\n\treturn r;\n}", "label": 1, "label_name": "safe"} +{"code": "function setDeepProperty(obj, propertyPath, value) {\n const a = splitPath(propertyPath);\n const n = a.length;\n for (let i = 0; i < n - 1; i++) {\n const k = a[i];\n if (!(k in obj)) {\n obj[k] = {};\n }\n obj = obj[k];\n }\n obj[a[n - 1]] = value;\n return;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "def get_node_attributes(auth_user, cib_dom=nil)\n unless cib_dom\n cib_dom = get_cib_dom(auth_user)\n return {} unless cib_dom\n end\n node_attrs = {}\n cib_dom.elements.each(\n '/cib/configuration/nodes/node/instance_attributes/nvpair'\n ) { |e|\n node = e.parent.parent.attributes['uname']\n node_attrs[node] ||= []\n node_attrs[node] << {\n :id => e.attributes['id'],\n :key => e.attributes['name'],\n :value => e.attributes['value']\n }\n }\n node_attrs.each { |_, val| val.sort_by! { |obj| obj[:key] }}\n return node_attrs\nend", "label": 1, "label_name": "safe"} +{"code": "func (p *Pack) teamPack() (*uint, error) {\n\tif !p.isTeamPack() {\n\t\treturn nil, nil\n\t}\n\tt := strings.TrimPrefix(*p.Type, \"team-\")\n\tteamID, err := strconv.ParseUint(t, 10, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ptr.Uint(uint(teamID)), nil\n}", "label": 1, "label_name": "safe"} +{"code": "blkxor(void * dest, void * src, size_t len)\n{\n size_t * D = (size_t *) dest;\n size_t * S = (size_t *) src;\n size_t L = len / sizeof(size_t);\n size_t i;\n\n for (i = 0; i < L; i++)\n D[i] ^= S[i];\n}", "label": 0, "label_name": "vulnerable"} +{"code": "this.sidebar.showEntries(\"search\")):(this.sidebar.showPalette(\"search\",mxSettings.settings.search),this.editor.chromeless&&!this.editor.editable||!(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))||(this.toggleScratchpad(),mxSettings.save())));this.addListener(\"formatWidthChanged\",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})}};EditorUi.prototype.copyImage=function(c,e,g){try{null!=navigator.clipboard&&this.spinner.spin(document.body,mxResources.get(\"exporting\"))&&\nthis.editor.exportToCanvas(mxUtils.bind(this,function(k,m){try{this.spinner.stop();var q=this.createImageDataUri(k,e,\"png\"),v=parseInt(m.getAttribute(\"width\")),x=parseInt(m.getAttribute(\"height\"));this.writeImageToClipboard(q,v,x,mxUtils.bind(this,function(A){this.handleError(A)}))}catch(A){this.handleError(A)}}),null,null,null,mxUtils.bind(this,function(k){this.spinner.stop();this.handleError(k)}),null,null,null!=g?g:4,null==this.editor.graph.background||this.editor.graph.background==mxConstants.NONE,\nnull,null,null,10,null,null,!1,null,0'],{type:\"text/html\"})});navigator.clipboard.write([c])[\"catch\"](k)};EditorUi.prototype.copyCells=function(c,e){var g=this.editor.graph;if(g.isSelectionEmpty())c.innerHTML=\"\";else{var k=", "label": 0, "label_name": "vulnerable"} +{"code": " def with_verbose_disabled\n verbose, $VERBOSE = $VERBOSE, nil\n result = yield\n $VERBOSE = verbose\n return result\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function toNode() {\n throw new Exception(\"HTMLPurifier_Token_End->toNode not supported!\");\n }", "label": 1, "label_name": "safe"} +{"code": "(\"/\"==R.charAt(0)?\"\":u)+R);D.push('url(\"'+R+'\"'+K[Q].substring(T))}else D.push(K[Q])}else D=[u]}return null!=D?D.join(\"\"):null};Editor.prototype.mapFontUrl=function(u,D,K){/^https?:\\/\\//.test(D)&&!this.isCorsEnabledForUrl(D)&&(D=PROXY_URL+\"?url=\"+encodeURIComponent(D));K(u,D)};Editor.prototype.embedCssFonts=function(u,D){var K=u.split(\"url(\"),T=0;null==this.cachedFonts&&(this.cachedFonts={});var N=mxUtils.bind(this,function(){if(0==T){for(var ba=[K[0]],ea=1;eafilterScheme($scheme);\n\n if ($this->scheme === $scheme) {\n return $this;\n }\n\n $new = clone $this;\n $new->scheme = $scheme;\n $new->port = $new->filterPort($new->scheme, $new->host, $new->port);\n return $new;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "299>=n.getStatus()?A(\"data:image/png;base64,\"+n.getText()):x({message:mxResources.get(\"unknownError\")})}))}else x({message:mxResources.get(\"drawingTooLarge\")})};EditorUi.prototype.createEmbedSvg=function(c,e,g,k,m,q,v){var x=this.editor.graph.getSvg(null,null,null,null,null,null,null,null,null,null,!g),A=x.getElementsByTagName(\"a\");if(null!=A)for(var z=0;z\")}))}else n=\"\",k&&(e=this.getSelectedPageIndex(),x.setAttribute(\"onclick\",\"(function(svg){var src=window.event.target||window.event.srcElement;while (src!=null&&src.nodeName.toLowerCase()!='a'){src=src.parentNode;}if(src==null){if(svg.wnd!=null&&!svg.wnd.closed){svg.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==svg.wnd){svg.wnd.postMessage(decodeURIComponent(svg.getAttribute('content')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);svg.wnd=window.open('\"+\nEditorUi.lightboxHost+\"/?client=1\"+(null!=e?\"&page=\"+e:\"\")+(m?\"&edit=_blank\":\"\")+(q?\"&layers=1\":\"\")+\"');}}})(this);\"),n+=\"cursor:pointer;\"),c&&(c=parseInt(x.getAttribute(\"width\")),m=parseInt(x.getAttribute(\"height\")),x.setAttribute(\"viewBox\",\"-0.5 -0.5 \"+c+\" \"+m),n+=\"max-width:100%;max-height:\"+m+\"px;\",x.removeAttribute(\"height\")),\"\"!=n&&x.setAttribute(\"style\",n),this.editor.addFontCss(x),this.editor.graph.mathEnabled&&this.editor.addMathCss(x),v(mxUtils.getXml(x))};EditorUi.prototype.timeSince=function(c){c=", "label": 0, "label_name": "vulnerable"} +{"code": " def deserialize(self, content, format='application/json'):\n \"\"\"\n Given some data and a format, calls the correct method to deserialize\n the data and returns the result.\n \"\"\"\n desired_format = None\n\n format = format.split(';')[0]\n\n for short_format, long_format in self.content_types.items():\n if format == long_format:\n if hasattr(self, \"from_%s\" % short_format):\n desired_format = short_format\n break\n \n if desired_format is None:\n raise UnsupportedFormat(\"The format indicated '%s' had no available deserialization method. Please check your ``formats`` and ``content_types`` on your Serializer.\" % format)\n \n deserialized = getattr(self, \"from_%s\" % desired_format)(content)\n return deserialized", "label": 0, "label_name": "vulnerable"} +{"code": " public static Process Parent(this Process process)\r\n {\r\n return FindPidFromIndexedProcessName(FindIndexedProcessName(process.Id));\r\n }\r", "label": 1, "label_name": "safe"} +{"code": "function mocks (server) {\n var auth = 'Bearer 0xabad1dea'\n server.get(tarballPath, { authorization: auth }).reply(403, {\n error: 'token leakage',\n reason: 'This token should not be sent.'\n })\n server.get(tarballPath).replyWithFile(200, tarball)\n}", "label": 1, "label_name": "safe"} +{"code": "f_settabvar(typval_T *argvars, typval_T *rettv)\n{\n tabpage_T\t*save_curtab;\n tabpage_T\t*tp;\n char_u\t*varname, *tabvarname;\n typval_T\t*varp;\n\n rettv->vval.v_number = 0;\n\n if (check_secure())\n\treturn;\n\n tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL));\n varname = tv_get_string_chk(&argvars[1]);\n varp = &argvars[2];\n\n if (varname != NULL && varp != NULL && tp != NULL)\n {\n\tsave_curtab = curtab;\n\tgoto_tabpage_tp(tp, FALSE, FALSE);\n\n\ttabvarname = alloc((unsigned)STRLEN(varname) + 3);\n\tif (tabvarname != NULL)\n\t{\n\t STRCPY(tabvarname, \"t:\");\n\t STRCPY(tabvarname + 2, varname);\n\t set_var(tabvarname, varp, TRUE);\n\t vim_free(tabvarname);\n\t}\n\n\t/* Restore current tabpage */\n\tif (valid_tabpage(save_curtab))\n\t goto_tabpage_tp(save_curtab, FALSE, FALSE);\n }\n}", "label": 1, "label_name": "safe"} +{"code": "void luaV_concat (lua_State *L, int total) {\n if (total == 1)\n return; /* \"all\" values already concatenated */\n do {\n StkId top = L->top;\n int n = 2; /* number of elements handled in this pass (at least 2) */\n if (!(ttisstring(s2v(top - 2)) || cvt2str(s2v(top - 2))) ||\n !tostring(L, s2v(top - 1)))\n luaT_tryconcatTM(L);\n else if (isemptystr(s2v(top - 1))) /* second operand is empty? */\n cast_void(tostring(L, s2v(top - 2))); /* result is first operand */\n else if (isemptystr(s2v(top - 2))) { /* first operand is empty string? */\n setobjs2s(L, top - 2, top - 1); /* result is second op. */\n }\n else {\n /* at least two non-empty string values; get as many as possible */\n size_t tl = vslen(s2v(top - 1));\n TString *ts;\n /* collect total length and number of strings */\n for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) {\n size_t l = vslen(s2v(top - n - 1));\n if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl))\n luaG_runerror(L, \"string length overflow\");\n tl += l;\n }\n if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */\n char buff[LUAI_MAXSHORTLEN];\n copy2buff(top, n, buff); /* copy strings to buffer */\n ts = luaS_newlstr(L, buff, tl);\n }\n else { /* long string; copy strings directly to final result */\n ts = luaS_createlngstrobj(L, tl);\n copy2buff(top, n, getstr(ts));\n }\n setsvalue2s(L, top - n, ts); /* create result */\n }\n total -= n-1; /* got 'n' strings to create 1 new */\n L->top -= n-1; /* popped 'n' strings and pushed one */\n } while (total > 1); /* repeat until only 1 result left */\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function filter()\n {\n //print_r(self::$hooks[$var]);\n $hooks = self::$hooks;\n $num_args = func_num_args();\n $args = func_get_args();\n // print_r($args);\n // if ($num_args < 2)\n // trigger_error(\"Insufficient arguments\", E_USER_ERROR);\n\n // Hook name should always be first argument\n $hook_name = array_shift($args);\n\n if (!isset($hooks[$hook_name])) {\n return;\n } // No plugins have registered this hook\n // print_r($args[0]);\n // $args = (is_array($args))?$args[0]: $args;\n if (is_array($hooks[$hook_name])) {\n foreach ($hooks[$hook_name] as $func) {\n if ($func != '') {\n // $args = call_user_func_array($func, $args); //\n $args = $func((array) $args);\n } else {\n $args = $args;\n }\n }\n\n $args = $args;\n } else {\n $args = $args;\n }\n\n $args = is_array($args) ? $args[0] : $args;\n\n return $args;\n }", "label": 1, "label_name": "safe"} +{"code": "Aa.style.padding=\"0px\";Aa.style.boxShadow=\"none\";Aa.className=\"geMenuItem\";Aa.style.display=\"inline-block\";Aa.style.width=\"40px\";Aa.style.height=\"12px\";Aa.style.marginBottom=\"-2px\";Aa.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\";Aa.style.backgroundPosition=\"top center\";Aa.style.backgroundRepeat=\"no-repeat\";Aa.setAttribute(\"title\",\"Minimize\");var za=!1,Ca=mxUtils.bind(this,function(){W.innerText=\"\";if(!za){var ua=function(Fa,Ra,db){Fa=X(\"\",Fa.funct,null,Ra,Fa,db);Fa.style.width=\n\"40px\";Fa.style.opacity=\"0.7\";return ya(Fa,null,\"pointer\")},ya=function(Fa,Ra,db){null!=Ra&&Fa.setAttribute(\"title\",Ra);Fa.style.cursor=null!=db?db:\"default\";Fa.style.margin=\"2px 0px\";W.appendChild(Fa);mxUtils.br(W);return Fa};ya(U.sidebar.createVertexTemplate(\"text;strokeColor=none;fillColor=none;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;\",60,30,\"Text\",mxResources.get(\"text\"),!0,!1,null,!0,!0),mxResources.get(\"text\")+\" (\"+Editor.ctrlKey+\"+Shift+X)\");ya(U.sidebar.createVertexTemplate(\"shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;fontColor=#000000;darkOpacity=0.05;fillColor=#FFF9B2;strokeColor=none;fillStyle=solid;direction=west;gradientDirection=north;gradientColor=#FFF2A1;shadow=1;size=20;pointerEvents=1;\",", "label": 1, "label_name": "safe"} +{"code": "D=K}return D};Graph.prototype.getCellsById=function(u){var D=[];if(null!=u)for(var K=0;Kthis.hiddenTags.length)return!1;for(var D=0;DmxUtils.indexOf(this.hiddenTags,u[D]))return!1;return!0};Graph.prototype.getCellsForTags=function(u,D,K,T){var N=[];if(null!=u){D=null!=D?D:this.model.getDescendants(this.model.getRoot());for(var Q=0,R={},Y=0;Y 'onKernelResponse',\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public static final void testUnopenedArray() {\n // Discovered by fuzzer with seed -Dfuzz.seed=df3b4778ce54d00a\n assertSanitized(\"-1742461140214282\", \"\\ufeff-01742461140214282]\");\n }", "label": 1, "label_name": "safe"} +{"code": " userId: projectUsers.findOne().users.find((elem) => elem._id === entry._id.userId)?.profile?.name,", "label": 0, "label_name": "vulnerable"} +{"code": " def test_modify_access_with_inactive_user(self):\n self.other_user.is_active = False\n self.other_user.save() # pylint: disable=no-member\n url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})\n response = self.client.post(url, {\n 'unique_student_identifier': self.other_user.username,\n 'rolename': 'beta',\n 'action': 'allow',\n })\n self.assertEqual(response.status_code, 200)\n expected = {\n 'unique_student_identifier': self.other_user.username,\n 'inactiveUser': True,\n }\n res_json = json.loads(response.content)\n self.assertEqual(res_json, expected)", "label": 1, "label_name": "safe"} +{"code": " it \"delegates to the current database\" do\n database = mock(Moped::Database)\n session.should_receive(:current_database).and_return(database)\n database.should_receive(:drop)\n session.drop\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function confirm()\n {\n $project = $this->getProject();\n $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));\n\n $this->response->html($this->helper->layout->project('custom_filter/remove', array(\n 'project' => $project,\n 'filter' => $filter,\n 'title' => t('Remove a custom filter')\n )));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "a.searchDelay?a.searchDelay:\"ssp\"===y(a)?400:0,i=h(\"input\",b).val(e.sSearch).attr(\"placeholder\",d.sSearchPlaceholder).bind(\"keyup.DT search.DT input.DT paste.DT cut.DT\",g?ua(f,g):f).bind(\"keypress.DT\",function(a){if(13==a.keyCode)return!1}).attr(\"aria-controls\",c);h(a.nTable).on(\"search.dt.DT\",function(b,c){if(a===c)try{i[0]!==H.activeElement&&i.val(e.sSearch)}catch(d){}});return b[0]}function ha(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;\nd.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Ia(a);if(\"ssp\"!=y(a)){wb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b 1 ? 'elfinder-cwd-icon-group' : fm.mime2class(file.mime));\n\t\tif (cnt > 1) {\n\t\t\ttitle = tpl.groupTitle.replace('{items}', fm.i18n('items')).replace('{num}', cnt);\n\t\t} else {\n\t\t\ttitle = tpl.itemTitle.replace('{name}', file.name).replace('{kind}', fm.mime2kind(file));\n\t\t\ttmb = fm.tmb(file);\n\t\t}\n\n\t\tdataTable = makeDataTable(makeperm(files), files.length == 1? files[0] : {});\n\n\t\tview = view.replace('{title}', title).replace('{dataTable}', dataTable).replace(/{id}/g, id);\n\n\t\tdialog = fm.dialog(view, opts);\n\t\tdialog.attr('id', id);\n\n\t\t// load thumbnail\n\t\tif (tmb) {\n\t\t\t$('')\n\t\t\t\t.on('load', function() { dialog.find('.elfinder-cwd-icon').addClass(tmb.className).css('background-image', \"url('\"+tmb.url+\"')\"); })\n\t\t\t\t.attr('src', tmb.url);\n\t\t}\n\n\t\t$('#' + id + '-table-perm :checkbox').on('click', function() {setperm('perm');});\n\t\t$('#' + id + '-perm').on('keydown', function(e) {\n\t\t\tvar c = e.keyCode;\n\t\t\te.stopPropagation();\n\t\t\tif (c == 13) {\n\t\t\t\tsave();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}).on('focus', function(e) {\n\t\t\t$(this).select();\n\t\t}).on('keyup', function(e) {\n\t\t\tif ($(this).val().length == 3) {\n\t\t\t\t$(this).select();\n\t\t\t\tsetcheck($(this).val());\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn dfrd;\n\t};", "label": 1, "label_name": "safe"} +{"code": "function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null)\n{\n\tglobal $conf;\n\n\t// Check is done after replacement\n\tswitch ($check) {\n\t\tcase 'none':\n\t\t\tbreak;\n\t\tcase 'int': // Check param is a numeric value (integer but also float or hexadecimal)\n\t\t\tif (!is_numeric($out)) {\n\t\t\t\t$out = '';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'intcomma':\n\t\t\tif (preg_match('/[^0-9,-]+/i', $out)) {\n\t\t\t\t$out = '';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'san_alpha':\n\t\t\t$out = filter_var($out, FILTER_SANITIZE_STRING);\n\t\t\tbreak;\n\t\tcase 'email':\n\t\t\t$out = filter_var($out, FILTER_SANITIZE_EMAIL);\n\t\t\tbreak;\n\t\tcase 'aZ':\n\t\t\tif (!is_array($out)) {\n\t\t\t\t$out = trim($out);\n\t\t\t\tif (preg_match('/[^a-z]+/i', $out)) {\n\t\t\t\t\t$out = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'aZ09':\n\t\t\tif (!is_array($out)) {\n\t\t\t\t$out = trim($out);\n\t\t\t\tif (preg_match('/[^a-z0-9_\\-\\.]+/i', $out)) {\n\t\t\t\t\t$out = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'aZ09comma':\t\t// great to sanitize sortfield or sortorder params that can be t.abc,t.def_gh\n\t\t\tif (!is_array($out)) {\n\t\t\t\t$out = trim($out);\n\t\t\t\tif (preg_match('/[^a-z0-9_\\-\\.,]+/i', $out)) {\n\t\t\t\t\t$out = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'nohtml':\t\t// No html\n\t\t\t$out = dol_string_nohtmltag($out, 0);\n\t\t\tbreak;\n\t\tcase 'alpha':\t\t// No html and no ../ and \"\n\t\tcase 'alphanohtml':\t// Recommended for most scalar parameters and search parameters\n\t\t\tif (!is_array($out)) {\n\t\t\t\t$out = trim($out);\n\t\t\t\tdo {\n\t\t\t\t\t$oldstringtoclean = $out;\n\t\t\t\t\t// Remove html tags\n\t\t\t\t\t$out = dol_string_nohtmltag($out, 0);\n\t\t\t\t\t// Remove also other dangerous string sequences\n\t\t\t\t\t// '\"' is dangerous because param in url can close the href= or src= and add javascript functions.\n\t\t\t\t\t// '../' is dangerous because it allows dir transversals\n\t\t\t\t\t// Note &, '&', '&'... is a simple char like '&' alone but there is no reason to accept such way to encode input data.\n\t\t\t\t\t$out = str_ireplace(array('&', '&', '&', '"', '"', '"', '"', '\"', '/', '/', '/', '../'), '', $out);\n\t\t\t\t} while ($oldstringtoclean != $out);\n\t\t\t\t// keep lines feed\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'alphawithlgt':\t\t// No \" and no ../ but we keep balanced < > tags with no special chars inside. Can be used for email string like \"Name \"\n\t\t\tif (!is_array($out)) {\n\t\t\t\t$out = trim($out);\n\t\t\t\tdo {\n\t\t\t\t\t$oldstringtoclean = $out;\n\t\t\t\t\t// Remove html tags\n\t\t\t\t\t$out = dol_html_entity_decode($out, ENT_COMPAT | ENT_HTML5, 'UTF-8');\n\t\t\t\t\t// '\"' is dangerous because param in url can close the href= or src= and add javascript functions.\n\t\t\t\t\t// '../' is dangerous because it allows dir transversals\n\t\t\t\t\t// Note &, '&', '&'... is a simple char like '&' alone but there is no reason to accept such way to encode input data.\n\t\t\t\t\t$out = str_ireplace(array('&', '&', '&', '"', '"', '"', '"', '\"', '/', '/', '/', '../'), '', $out);\n\t\t\t\t} while ($oldstringtoclean != $out);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'restricthtml':\t\t// Recommended for most html textarea\n\t\t\tdo {\n\t\t\t\t$oldstringtoclean = $out;\n\n\t\t\t\t// We replace chars encoded with numeric HTML entities with real char (to avoid to have numeric entities used for obfuscation of injections)\n\t\t\t\t$out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+);/i', 'realCharForNumericEntities', $out);\n\t\t\t\t$out = preg_replace('/&#x?[0-9]+/i', '', $out);\t// For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'.\n\n\t\t\t\t$out = dol_string_onlythesehtmltags($out, 0, 1, 1);\n\n\t\t\t\t// We should also exclude non expected attributes\n\t\t\t\tif (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {\n\t\t\t\t\t$out = dol_string_onlythesehtmlattributes($out);\n\t\t\t\t}\n\t\t\t} while ($oldstringtoclean != $out);\n\t\t\tbreak;\n\t\tcase 'custom':\n\t\t\tif (empty($filter)) {\n\t\t\t\treturn 'BadFourthParameterForGETPOST';\n\t\t\t}\n\t\t\t$out = filter_var($out, $filter, $options);\n\t\t\tbreak;\n\t}\n\n\treturn $out;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t\toptions.buttons[this.i18n(opts.accept.label)] = function() {\n\t\t\topts.accept.callback(!!(checkbox && checkbox.prop('checked')))\n\t\t\tcomplete = true;\n\t\t\t$(this).elfinderdialog('close');\n\t\t};", "label": 1, "label_name": "safe"} +{"code": " public function save()\n {\n $project = $this->getProject();\n $values = $this->request->getValues() + array('hide_in_dashboard' => 0);\n $values['project_id'] = $project['id'];\n\n list($valid, $errors) = $this->columnValidator->validateCreation($values);\n\n if ($valid) {\n $result = $this->columnModel->create(\n $project['id'],\n $values['title'],\n $values['task_limit'],\n $values['description'],\n $values['hide_in_dashboard']\n );\n\n if ($result !== false) {\n $this->flash->success(t('Column created successfully.'));\n $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);\n return;\n } else {\n $errors['title'] = array(t('Another column with the same name exists in the project'));\n }\n }\n\n $this->create($values, $errors);\n }", "label": 1, "label_name": "safe"} +{"code": " public static bool ProgramIsRunning(string fullPath)\r\n {\r\n return Process.GetProcessesByName(Path.GetFileNameWithoutExtension(fullPath)).Count() > 1;\r\n }\r", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n auto* params =\n reinterpret_cast(node->builtin_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n TF_LITE_ENSURE_EQ(context, NumDimensions(input), 4);\n\n auto data_type = output->type;\n TF_LITE_ENSURE(context,\n data_type == kTfLiteFloat32 || data_type == kTfLiteUInt8 ||\n data_type == kTfLiteInt8 || data_type == kTfLiteInt32 ||\n data_type == kTfLiteInt64);\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);\n\n const int block_size = params->block_size;\n TF_LITE_ENSURE(context, block_size > 0);\n const int input_height = input->dims->data[1];\n const int input_width = input->dims->data[2];\n int output_height = input_height / block_size;\n int output_width = input_width / block_size;\n\n TF_LITE_ENSURE_EQ(context, input_height, output_height * block_size);\n TF_LITE_ENSURE_EQ(context, input_width, output_width * block_size);\n\n TfLiteIntArray* output_size = TfLiteIntArrayCreate(4);\n output_size->data[0] = input->dims->data[0];\n output_size->data[1] = output_height;\n output_size->data[2] = output_width;\n output_size->data[3] = input->dims->data[3] * block_size * block_size;\n\n return context->ResizeTensor(context, output, output_size);\n}", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n auto* params =\n reinterpret_cast(node->builtin_data);\n\n const TfLiteTensor* input = GetInput(context, node, kInputTensor);\n TfLiteTensor* output = GetOutput(context, node, kOutputTensor);\n\n#define TF_LITE_DEPTH_TO_SPACE(type, scalar) \\\n tflite::DepthToSpaceParams op_params; \\\n op_params.block_size = params->block_size; \\\n type::DepthToSpace(op_params, GetTensorShape(input), \\\n GetTensorData(input), GetTensorShape(output), \\\n GetTensorData(output))\n switch (input->type) { // Already know in/out types are same.\n case kTfLiteFloat32:\n if (kernel_type == kReference) {\n TF_LITE_DEPTH_TO_SPACE(reference_ops, float);\n } else {\n TF_LITE_DEPTH_TO_SPACE(optimized_ops, float);\n }\n break;\n case kTfLiteUInt8:\n if (kernel_type == kReference) {\n TF_LITE_DEPTH_TO_SPACE(reference_ops, uint8_t);\n } else {\n TF_LITE_DEPTH_TO_SPACE(optimized_ops, uint8_t);\n }\n break;\n case kTfLiteInt8:\n if (kernel_type == kReference) {\n TF_LITE_DEPTH_TO_SPACE(reference_ops, int8_t);\n } else {\n TF_LITE_DEPTH_TO_SPACE(optimized_ops, int8_t);\n }\n break;\n case kTfLiteInt32:\n if (kernel_type == kReference) {\n TF_LITE_DEPTH_TO_SPACE(reference_ops, int32_t);\n } else {\n TF_LITE_DEPTH_TO_SPACE(optimized_ops, int32_t);\n }\n break;\n case kTfLiteInt64:\n if (kernel_type == kReference) {\n TF_LITE_DEPTH_TO_SPACE(reference_ops, int64_t);\n } else {\n TF_LITE_DEPTH_TO_SPACE(optimized_ops, int64_t);\n }\n break;\n default:\n context->ReportError(context, \"Type '%s' not currently supported.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n#undef TF_LITE_DEPTH_TO_SPACE\n\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " async validate(token: string) {\n const apiToken = await this.authService.validateApiToken(token);\n if (!apiToken) {\n throw new UnauthorizedException();\n }\n return apiToken;\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t\tslug: $( this ).data( 'slug' )\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttarget.postMessage( JSON.stringify( update ), window.location.origin );\n\t\t} );", "label": 1, "label_name": "safe"} +{"code": " private void validateCallbackIfGiven(HttpServletRequest pReq) {\n String callback = pReq.getParameter(ConfigKey.CALLBACK.getKeyValue());\n if (callback != null && !MimeTypeUtil.isValidCallback(callback)) {\n throw new IllegalArgumentException(\"Invalid callback name given, which must be a valid javascript function name\");\n }\n }", "label": 1, "label_name": "safe"} +{"code": " public static string ToUnsecureString(this SecureString secureString)\r\n {\r\n if (secureString == null) throw new ArgumentNullException(\"secureString\");\r\n\r\n var unmanagedString = IntPtr.Zero;\r\n try\r\n {\r\n unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(secureString);\r\n return Marshal.PtrToStringUni(unmanagedString);\r\n }\r\n finally\r\n {\r\n Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString);\r\n }\r\n }\r", "label": 1, "label_name": "safe"} +{"code": " public function testInfoWithoutUrl()\n {\n $this->assertRequestIsRedirect('info');\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testCaseInsensitive()\n {\n $this->assertResult(\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n auto* params =\n reinterpret_cast(node->builtin_data);\n TfLiteTensor* output = GetOutput(context, node, 0);\n const TfLiteTensor* ids = GetInput(context, node, 0);\n const TfLiteTensor* indices = GetInput(context, node, 1);\n const TfLiteTensor* dense_shape = GetInput(context, node, 2);\n const TfLiteTensor* weights = GetInput(context, node, 3);\n const TfLiteTensor* value = GetInput(context, node, 4);\n\n const int lookup_rank = SizeOfDimension(indices, 1);\n const int embedding_rank = NumDimensions(value);\n const int num_lookups = SizeOfDimension(ids, 0);\n const int num_rows = SizeOfDimension(value, 0);\n\n // The last dimension gets replaced by the embedding.\n const int output_rank = (lookup_rank - 1) + (embedding_rank - 1);\n\n // Make sure that the actual dense shape of the sparse tensor represented by\n // (loopkup, indices, dense_shape) is consistent.\n TF_LITE_ENSURE_EQ(context, SizeOfDimension(dense_shape, 0), lookup_rank);\n\n // Resize output tensor.\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(output_rank);\n int k = 0;\n int embedding_size = 1;\n int lookup_size = 1;\n for (int i = 0; i < lookup_rank - 1; i++, k++) {\n const int dim = dense_shape->data.i32[i];\n lookup_size *= dim;\n output_shape->data[k] = dim;\n }\n for (int i = 1; i < embedding_rank; i++, k++) {\n const int dim = SizeOfDimension(value, i);\n embedding_size *= dim;\n output_shape->data[k] = dim;\n }\n TF_LITE_ENSURE_STATUS(context->ResizeTensor(context, output, output_shape));\n const int output_size = lookup_size * embedding_size;\n TfLiteTensorRealloc(output_size * sizeof(float), output);\n\n float* output_ptr = GetTensorData(output);\n const float* weights_ptr = GetTensorData(weights);\n const float* value_ptr = GetTensorData(value);\n\n std::fill_n(output_ptr, output_size, 0.0f);\n\n // Keep track of the current bucket for aggregation/combination.\n int current_output_offset = 0;\n float current_total_weight = 0.0;\n float current_squares_weight = 0.0;\n int num_elements = 0;\n\n for (int i = 0; i < num_lookups; i++) {\n int idx = ids->data.i32[i];\n if (idx >= num_rows || idx < 0) {\n context->ReportError(context,\n \"Embedding Lookup Sparse: index out of bounds. \"\n \"Got %d, and bounds are [0, %d]\",\n idx, num_rows - 1);\n return kTfLiteError;\n }\n\n // Check where we need to aggregate.\n const int example_indices_offset = i * lookup_rank;\n int output_bucket = 0;\n int stride = 1;\n for (int k = (lookup_rank - 1) - 1; k >= 0; k--) {\n output_bucket += indices->data.i32[example_indices_offset + k] * stride;\n stride *= dense_shape->data.i32[k];\n }\n const int output_offset = output_bucket * embedding_size;\n\n // If we are in a new aggregation bucket and the combiner is not the sum,\n // go back and finalize the result of the previous bucket.\n if (output_offset != current_output_offset) {\n FinalizeAggregation(params->combiner, num_elements, current_total_weight,\n current_squares_weight, embedding_size,\n &output_ptr[current_output_offset]);\n\n // Track next bucket.\n num_elements = 0;\n current_total_weight = 0.0;\n current_squares_weight = 0.0;\n current_output_offset = output_offset;\n }\n\n // Add element to aggregation.\n ++num_elements;\n const int example_embedding_offset = idx * embedding_size;\n const float w = weights_ptr[i];\n current_squares_weight += w * w;\n current_total_weight += w;\n for (int k = 0; k < embedding_size; k++) {\n output_ptr[current_output_offset + k] +=\n value_ptr[example_embedding_offset + k] * w;\n }\n }\n\n // Finalize last bucket.\n FinalizeAggregation(params->combiner, num_elements, current_total_weight,\n current_squares_weight, embedding_size,\n &GetTensorData(output)[current_output_offset]);\n\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " private static function evaluate($func, $a, $b) {\n\n $r = false;\n\n if (\\is_null($a) && $func != '$exists') {\n return false;\n }\n\n switch ($func) {\n case '$eq' :\n $r = $a == $b;\n break;\n\n case '$ne' :\n $r = $a != $b;\n break;\n\n case '$gte' :\n if ( (\\is_numeric($a) && \\is_numeric($b)) || (\\is_string($a) && \\is_string($b)) ) {\n $r = $a >= $b;\n }\n break;\n\n case '$gt' :\n if ( (\\is_numeric($a) && \\is_numeric($b)) || (\\is_string($a) && \\is_string($b)) ) {\n $r = $a > $b;\n }\n break;\n\n case '$lte' :\n if ( (\\is_numeric($a) && \\is_numeric($b)) || (\\is_string($a) && \\is_string($b)) ) {\n $r = $a <= $b;\n }\n break;\n\n case '$lt' :\n if ( (\\is_numeric($a) && \\is_numeric($b)) || (\\is_string($a) && \\is_string($b)) ) {\n $r = $a < $b;\n }\n break;\n\n case '$in' :\n if (\\is_array($a)) {\n $r = \\is_array($b) ? \\count(\\array_intersect($a, $b)) : false;\n } else {\n $r = \\is_array($b) ? \\in_array($a, $b) : false;\n }\n break;\n\n case '$nin' :\n if (\\is_array($a)) {\n $r = \\is_array($b) ? (\\count(\\array_intersect($a, $b)) === 0) : false;\n } else {\n $r = \\is_array($b) ? (\\in_array($a, $b) === false) : false;\n }\n break;\n\n case '$has' :\n if (\\is_array($b))\n throw new \\InvalidArgumentException('Invalid argument for $has array not supported');\n if (!\\is_array($a)) $a = @\\json_decode($a, true) ? : [];\n $r = \\in_array($b, $a);\n break;\n\n case '$all' :\n if (!\\is_array($a)) $a = @\\json_decode($a, true) ? : [];\n if (!\\is_array($b))\n throw new \\InvalidArgumentException('Invalid argument for $all option must be array');\n $r = \\count(\\array_intersect_key($a, $b)) == \\count($b);\n break;\n\n case '$regex' :\n case '$preg' :\n case '$match' :\n case '$not':\n $r = (boolean) @\\preg_match(isset($b[0]) && $b[0]=='/' ? $b : '/'.$b.'/iu', $a, $match);\n if ($func === '$not') {\n $r = !$r;\n }\n break;\n\n case '$size' :\n if (!\\is_array($a)) $a = @\\json_decode($a, true) ? : [];\n $r = (int) $b == \\count($a);\n break;\n\n case '$mod' :\n if (! \\is_array($b))\n throw new \\InvalidArgumentException('Invalid argument for $mod option must be array');\n $r = $a % $b[0] == $b[1] ?? 0;\n break;\n\n case '$func' :\n case '$fn' :\n case '$f' :\n if (\\is_string($b) || !\\is_callable($b))\n throw new \\InvalidArgumentException('Function should be callable');\n $r = $b($a);\n break;\n\n case '$exists':\n $r = $b ? !\\is_null($a) : \\is_null($a);\n break;\n\n case '$fuzzy':\n case '$text':\n\n $distance = 3;\n $minScore = 0.7;\n\n if (\\is_array($b) && isset($b['$search'])) {\n\n if (isset($b['$minScore']) && \\is_numeric($b['$minScore'])) $minScore = $b['$minScore'];\n if (isset($b['$distance']) && \\is_numeric($b['$distance'])) $distance = $b['$distance'];\n\n $b = $b['search'];\n }\n\n $r = fuzzy_search($b, $a, $distance) >= $minScore;\n break;\n\n default :\n throw new \\ErrorException(\"Condition not valid ... Use {$func} for custom operations\");\n break;\n }\n\n return $r;\n }", "label": 1, "label_name": "safe"} +{"code": " def org_login(org_slug):\n session[\"org_slug\"] = current_org.slug\n return redirect(url_for(\".authorize\", next=request.args.get(\"next\", None)))", "label": 1, "label_name": "safe"} +{"code": "static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,\n\t\t char *const argv[])\n{\n\tuint\tchip;\n\tuint\taddr, length;\n\tuint\talen;\n\tuint\tj, nbytes, linebytes;\n\tint ret;\n#if CONFIG_IS_ENABLED(DM_I2C)\n\tstruct udevice *dev;\n#endif\n\n\t/* We use the last specified parameters, unless new ones are\n\t * entered.\n\t */\n\tchip = i2c_dp_last_chip;\n\taddr = i2c_dp_last_addr;\n\talen = i2c_dp_last_alen;\n\tlength = i2c_dp_last_length;\n\n\tif (argc < 3)\n\t\treturn CMD_RET_USAGE;\n\n\tif ((flag & CMD_FLAG_REPEAT) == 0) {\n\t\t/*\n\t\t * New command specified.\n\t\t */\n\n\t\t/*\n\t\t * I2C chip address\n\t\t */\n\t\tchip = hextoul(argv[1], NULL);\n\n\t\t/*\n\t\t * I2C data address within the chip. This can be 1 or\n\t\t * 2 bytes long. Some day it might be 3 bytes long :-).\n\t\t */\n\t\taddr = hextoul(argv[2], NULL);\n\t\talen = get_alen(argv[2], DEFAULT_ADDR_LEN);\n\t\tif (alen > 3)\n\t\t\treturn CMD_RET_USAGE;\n\n\t\t/*\n\t\t * If another parameter, it is the length to display.\n\t\t * Length is the number of objects, not number of bytes.\n\t\t */\n\t\tif (argc > 3)\n\t\t\tlength = hextoul(argv[3], NULL);\n\t}\n\n#if CONFIG_IS_ENABLED(DM_I2C)\n\tret = i2c_get_cur_bus_chip(chip, &dev);\n\tif (!ret && alen != -1)\n\t\tret = i2c_set_chip_offset_len(dev, alen);\n\tif (ret)\n\t\treturn i2c_report_err(ret, I2C_ERR_READ);\n#endif\n\n\t/*\n\t * Print the lines.\n\t *\n\t * We buffer all read data, so we can make sure data is read only\n\t * once.\n\t */\n\tnbytes = length;\n\tdo {\n\t\tunsigned char\tlinebuf[DISP_LINE_LEN];\n\t\tunsigned char\t*cp;\n\n\t\tlinebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;\n\n#if CONFIG_IS_ENABLED(DM_I2C)\n\t\tret = dm_i2c_read(dev, addr, linebuf, linebytes);\n#else\n\t\tret = i2c_read(chip, addr, alen, linebuf, linebytes);\n#endif\n\t\tif (ret)\n\t\t\treturn i2c_report_err(ret, I2C_ERR_READ);\n\t\telse {\n\t\t\tprintf(\"%04x:\", addr);\n\t\t\tcp = linebuf;\n\t\t\tfor (j=0; j 0x7e))\n\t\t\t\t\tputs (\".\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%c\", *cp);\n\t\t\t\tcp++;\n\t\t\t}\n\t\t\tputc ('\\n');\n\t\t}\n\t\tnbytes -= linebytes;\n\t} while (nbytes > 0);\n\n\ti2c_dp_last_chip = chip;\n\ti2c_dp_last_addr = addr;\n\ti2c_dp_last_alen = alen;\n\ti2c_dp_last_length = length;\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": "void ZlibInStream::removeUnderlying()\n{\n ptr = end = start;\n if (!underlying) return;\n\n while (bytesIn > 0) {\n decompress(true);\n end = start; // throw away any data\n }\n underlying = 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t$this->run('mv', $from, $to);\n\t\t\t}\n\n\t\t\treturn $this;\n\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": "void ZydisFormatterBufferInitTokenized(ZydisFormatterBuffer* buffer,\n ZydisFormatterToken** first_token, void* user_buffer, ZyanUSize length)\n{\n ZYAN_ASSERT(buffer);\n ZYAN_ASSERT(first_token);\n ZYAN_ASSERT(user_buffer);\n ZYAN_ASSERT(length);\n\n *first_token = user_buffer;\n (*first_token)->type = ZYDIS_TOKEN_INVALID;\n (*first_token)->next = 0;\n\n user_buffer = (ZyanU8*)user_buffer + sizeof(ZydisFormatterToken);\n length -= sizeof(ZydisFormatterToken);\n\n buffer->is_token_list = ZYAN_TRUE;\n buffer->capacity = length;\n buffer->string.flags = ZYAN_STRING_HAS_FIXED_CAPACITY;\n buffer->string.vector.allocator = ZYAN_NULL;\n buffer->string.vector.element_size = sizeof(char);\n buffer->string.vector.size = 1;\n buffer->string.vector.capacity = length;\n buffer->string.vector.data = user_buffer;\n *(char*)user_buffer = '\\0';\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function test_extractStyleBlocks_allStyle()\n {\n $this->assertExtractStyleBlocks('', '', array('foo'));\n }", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus GreaterEqualEval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);\n const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);\n TfLiteTensor* output = GetOutput(context, node, kOutputTensor);\n bool requires_broadcast = !HaveSameShapes(input1, input2);\n switch (input1->type) {\n case kTfLiteFloat32:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteInt32:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteInt64:\n Comparison(input1, input2, output,\n requires_broadcast);\n break;\n case kTfLiteUInt8:\n ComparisonQuantized(\n input1, input2, output, requires_broadcast);\n break;\n case kTfLiteInt8:\n ComparisonQuantized(\n input1, input2, output, requires_broadcast);\n break;\n default:\n context->ReportError(context,\n \"Does not support type %d, requires float|int|uint8\",\n input1->type);\n return kTfLiteError;\n }\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void sctp_generate_proto_unreach_event(unsigned long data)\n{\n\tstruct sctp_transport *transport = (struct sctp_transport *) data;\n\tstruct sctp_association *asoc = transport->asoc;\n\tstruct net *net = sock_net(asoc->base.sk);\n\n\tbh_lock_sock(asoc->base.sk);\n\tif (sock_owned_by_user(asoc->base.sk)) {\n\t\tpr_debug(\"%s: sock is busy\\n\", __func__);\n\n\t\t/* Try again later. */\n\t\tif (!mod_timer(&transport->proto_unreach_timer,\n\t\t\t\tjiffies + (HZ/20)))\n\t\t\tsctp_association_hold(asoc);\n\t\tgoto out_unlock;\n\t}\n\n\t/* Is this structure just waiting around for us to actually\n\t * get destroyed?\n\t */\n\tif (asoc->base.dead)\n\t\tgoto out_unlock;\n\n\tsctp_do_sm(net, SCTP_EVENT_T_OTHER,\n\t\t SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH),\n\t\t asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC);\n\nout_unlock:\n\tbh_unlock_sock(asoc->base.sk);\n\tsctp_association_put(asoc);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct($type)\n {\n $this->type = $type;\n }", "label": 1, "label_name": "safe"} +{"code": "\tprotected function _fopen($path, $mode='rb') {\n\t\t$fp = $this->tmbPath\n\t\t\t? @fopen($this->getTempFile($path), 'w+')\n\t\t\t: @tmpfile();\n\n\t\tif ($fp) {\n\t\t\t$sql = \"SET TEXTSIZE 2147483647 \"; // increase mssql or odbc data size limit\n\t\t\t$sql .= 'SELECT convert(varbinary(max),content) as content FROM '.$this->tbf.' WHERE id=\"'.$path.'\"';\t\t\t\n\t\t\t\n\t\t\t$res = $this->query($sql);\n\t\t\t\n\t\t\todbc_binmode($res, ODBC_BINMODE_RETURN); //long binary handling\n\t\t\todbc_longreadlen($res,100000000);\t\t //increase mssql or odbc data size 100 Megabytes\n\t\t\t\n\t\t\tif ($res && ($r = odbc_fetch_array($res))) {\t\t\t\t\n\t\t\t\tfwrite($fp, base64_decode($r['content']));\n\t\t\t\trewind($fp);\n\t\t\t\treturn $fp;\n\t\t\t} else {\n\t\t\t\t$this->_fclose($fp, $path);\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " isDirectory() {\n return ((this.mode & constants.S_IFMT) === constants.S_IFDIR);\n }", "label": 1, "label_name": "safe"} +{"code": "fn decode_chunk(\n input: &[u8],\n index_at_start_of_input: usize,\n decode_table: &[u8; 256],\n output: &mut [u8],\n) -> Result<(), DecodeError> {\n let mut accum: u64;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[0] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[0], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(index_at_start_of_input, input[0]));\n }\n accum = (morsel as u64) << 58;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[1] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[1], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 1,\n input[1],\n ));\n }\n accum |= (morsel as u64) << 52;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[2] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[2], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 2,\n input[2],\n ));\n }\n accum |= (morsel as u64) << 46;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[3] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[3], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 3,\n input[3],\n ));\n }\n accum |= (morsel as u64) << 40;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[4] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[4], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 4,\n input[4],\n ));\n }\n accum |= (morsel as u64) << 34;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[5] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[5], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 5,\n input[5],\n ));\n }\n accum |= (morsel as u64) << 28;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[6] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[6], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 6,\n input[6],\n ));\n }\n accum |= (morsel as u64) << 22;\n\n #[cfg(not(feature = \"slow_but_safe\"))]\n let morsel = decode_table[input[7] as usize];\n #[cfg(feature = \"slow_but_safe\")]\n let morsel = decode_aligned(input[7], decode_table);\n if morsel == tables::INVALID_VALUE {\n return Err(DecodeError::InvalidByte(\n index_at_start_of_input + 7,\n input[7],\n ));\n }\n accum |= (morsel as u64) << 16;\n\n write_u64(output, accum);\n\n Ok(())\n}", "label": 1, "label_name": "safe"} +{"code": "\tassign: function(id, value) {\n\t\tif (!id) return;\n\t\tthis.current().body.push(id, \"=\", value, \";\");\n\t\treturn id;\n\t},", "label": 1, "label_name": "safe"} +{"code": "rdpsnd_process_training(STREAM in)\n{\n\tuint16 tick;\n\tuint16 packsize;\n\tSTREAM out;\n\tstruct stream packet = *in;\n\n\tif (!s_check_rem(in, 4))\n\t{\n\t\trdp_protocol_error(\"rdpsnd_process_training(), consume of training data from stream would overrun\", &packet);\n\t}\n\n\tin_uint16_le(in, tick);\n\tin_uint16_le(in, packsize);\n\n\tlogger(Sound, Debug, \"rdpsnd_process_training(), tick=0x%04x\", (unsigned) tick);\n\n\tout = rdpsnd_init_packet(SNDC_TRAINING, 4);\n\tout_uint16_le(out, tick);\n\tout_uint16_le(out, packsize);\n\ts_mark_end(out);\n\trdpsnd_send(out);\n}", "label": 1, "label_name": "safe"} +{"code": "function merge(obj) {\n var i = 1\n , target\n , key;\n\n for (; i < arguments.length; i++) {\n target = arguments[i];\n for (key in target) {\n if (Object.prototype.hasOwnProperty.call(target, key)) {\n obj[key] = target[key];\n }\n }\n }\n\n return obj;\n}", "label": 1, "label_name": "safe"} +{"code": " public function install()\n {\n Session::start();\n System::gZip();\n Theme::install('header');\n Control::handler('install');\n Theme::install('footer');\n System::Zipped();\n }", "label": 1, "label_name": "safe"} +{"code": "\tstartDir : function() {\n\t\tvar locHash = window.location.hash;\n\t\tif (locHash && locHash.match(/^#elf_/)) {\n\t\t\treturn locHash.replace(/^#elf_/, '');\n\t\t} else {\n\t\t\treturn this.lastDir();\n\t\t}\n\t},", "label": 0, "label_name": "vulnerable"} +{"code": " $scope.addRequisition = function() {\n bootbox.prompt('A requisition is required, please enter the name for a new requisition', function(foreignSource) {\n if (foreignSource) {\n RequisitionsService.addRequisition(foreignSource).then(\n function() { // success\n RequisitionsService.synchronizeRequisition(foreignSource, false).then(\n function() {\n growl.success('The requisition ' + foreignSource + ' has been created and synchronized.');\n $scope.foreignSources.push(foreignSource);\n },\n $scope.errorHandler\n );\n },\n $scope.errorHandler\n );\n } else {\n window.location.href = Util.getBaseHref() + 'admin/opennms/index.jsp'; // TODO Is this the best way ?\n }\n });\n };", "label": 0, "label_name": "vulnerable"} +{"code": "pixFillMapHoles(PIX *pix,\n l_int32 nx,\n l_int32 ny,\n l_int32 filltype)\n{\nl_int32 w, h, y, nmiss, goodcol, i, j, found, ival, valtest;\nl_uint32 val, lastval;\nNUMA *na; /* indicates if there is any data in the column */\n\n PROCNAME(\"pixFillMapHoles\");\n\n if (!pix || pixGetDepth(pix) != 8)\n return ERROR_INT(\"pix not defined or not 8 bpp\", procName, 1);\n if (pixGetColormap(pix))\n return ERROR_INT(\"pix is colormapped\", procName, 1);\n\n /* ------------- Fill holes in the mapping image columns ----------- */\n pixGetDimensions(pix, &w, &h, NULL);\n na = numaCreate(0); /* holds flag for which columns have data */\n nmiss = 0;\n valtest = (filltype == L_FILL_WHITE) ? 255 : 0;\n for (j = 0; j < nx; j++) { /* do it by columns */\n found = FALSE;\n for (i = 0; i < ny; i++) {\n pixGetPixel(pix, j, i, &val);\n if (val != valtest) {\n y = i;\n found = TRUE;\n break;\n }\n }\n if (found == FALSE) {\n numaAddNumber(na, 0); /* no data in the column */\n nmiss++;\n }\n else {\n numaAddNumber(na, 1); /* data in the column */\n for (i = y - 1; i >= 0; i--) /* replicate upwards to top */\n pixSetPixel(pix, j, i, val);\n pixGetPixel(pix, j, 0, &lastval);\n for (i = 1; i < h; i++) { /* set going down to bottom */\n pixGetPixel(pix, j, i, &val);\n if (val == valtest)\n pixSetPixel(pix, j, i, lastval);\n else\n lastval = val;\n }\n }\n }\n numaAddNumber(na, 0); /* last column */\n\n if (nmiss == nx) { /* no data in any column! */\n numaDestroy(&na);\n L_WARNING(\"no bg found; no data in any column\\n\", procName);\n return 1;\n }\n\n /* ---------- Fill in missing columns by replication ----------- */\n if (nmiss > 0) { /* replicate columns */\n /* Find the first good column */\n goodcol = 0;\n for (j = 0; j < w; j++) {\n numaGetIValue(na, j, &ival);\n if (ival == 1) {\n goodcol = j;\n break;\n }\n }\n if (goodcol > 0) { /* copy cols backward */\n for (j = goodcol - 1; j >= 0; j--)\n pixRasterop(pix, j, 0, 1, h, PIX_SRC, pix, j + 1, 0);\n }\n for (j = goodcol + 1; j < w; j++) { /* copy cols forward */\n numaGetIValue(na, j, &ival);\n if (ival == 0) {\n /* Copy the column to the left of j */\n pixRasterop(pix, j, 0, 1, h, PIX_SRC, pix, j - 1, 0);\n }\n }\n }\n if (w > nx) { /* replicate the last column */\n for (i = 0; i < h; i++) {\n pixGetPixel(pix, w - 2, i, &val);\n pixSetPixel(pix, w - 1, i, val);\n }\n }\n\n numaDestroy(&na);\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": " def compile_to_ral(manifest)\n catalog = compile_to_catalog(manifest)\n ral = catalog.to_ral\n ral.finalize\n ral\n end", "label": 0, "label_name": "vulnerable"} +{"code": "ins_compl_infercase_gettext(\n\tchar_u\t*str,\n\tint\tactual_len,\n\tint\tactual_compl_length,\n\tint\tmin_len)\n{\n int\t\t*wca;\t\t\t// Wide character array.\n char_u\t*p;\n int\t\ti, c;\n int\t\thas_lower = FALSE;\n int\t\twas_letter = FALSE;\n\n IObuff[0] = NUL;\n\n // Allocate wide character array for the completion and fill it.\n wca = ALLOC_MULT(int, actual_len);\n if (wca == NULL)\n\treturn IObuff;\n\n p = str;\n for (i = 0; i < actual_len; ++i)\n\tif (has_mbyte)\n\t wca[i] = mb_ptr2char_adv(&p);\n\telse\n\t wca[i] = *(p++);\n\n // Rule 1: Were any chars converted to lower?\n p = compl_orig_text;\n for (i = 0; i < min_len; ++i)\n {\n\tif (has_mbyte)\n\t c = mb_ptr2char_adv(&p);\n\telse\n\t c = *(p++);\n\tif (MB_ISLOWER(c))\n\t{\n\t has_lower = TRUE;\n\t if (MB_ISUPPER(wca[i]))\n\t {\n\t\t// Rule 1 is satisfied.\n\t\tfor (i = actual_compl_length; i < actual_len; ++i)\n\t\t wca[i] = MB_TOLOWER(wca[i]);\n\t\tbreak;\n\t }\n\t}\n }\n\n // Rule 2: No lower case, 2nd consecutive letter converted to\n // upper case.\n if (!has_lower)\n {\n\tp = compl_orig_text;\n\tfor (i = 0; i < min_len; ++i)\n\t{\n\t if (has_mbyte)\n\t\tc = mb_ptr2char_adv(&p);\n\t else\n\t\tc = *(p++);\n\t if (was_letter && MB_ISUPPER(c) && MB_ISLOWER(wca[i]))\n\t {\n\t\t// Rule 2 is satisfied.\n\t\tfor (i = actual_compl_length; i < actual_len; ++i)\n\t\t wca[i] = MB_TOUPPER(wca[i]);\n\t\tbreak;\n\t }\n\t was_letter = MB_ISLOWER(c) || MB_ISUPPER(c);\n\t}\n }\n\n // Copy the original case of the part we typed.\n p = compl_orig_text;\n for (i = 0; i < min_len; ++i)\n {\n\tif (has_mbyte)\n\t c = mb_ptr2char_adv(&p);\n\telse\n\t c = *(p++);\n\tif (MB_ISLOWER(c))\n\t wca[i] = MB_TOLOWER(wca[i]);\n\telse if (MB_ISUPPER(c))\n\t wca[i] = MB_TOUPPER(wca[i]);\n }\n\n // Generate encoding specific output from wide character array.\n // Multi-byte characters can occupy up to five bytes more than\n // ASCII characters, and we also need one byte for NUL, so stay\n // six bytes away from the edge of IObuff.\n p = IObuff;\n i = 0;\n while (i < actual_len && (p - IObuff + 6) < IOSIZE)\n\tif (has_mbyte)\n\t p += (*mb_char2bytes)(wca[i++], p);\n\telse\n\t *(p++) = wca[i++];\n *p = NUL;\n\n vim_free(wca);\n\n return IObuff;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "PlayerGeneric::~PlayerGeneric()\n{\n\n\tif (player)\n\t{\n\t\tif (mixer && mixer->isActive() && !mixer->isDeviceRemoved(player))\n\t\t\tmixer->removeDevice(player);\n\t\tdelete player;\n\t}\n\t\n\tif (mixer)\n\t\tdelete mixer;\n\n\tdelete[] audioDriverName;\n\t\n\tdelete listener;\n}", "label": 1, "label_name": "safe"} +{"code": " public function getEndpoint()\n {\n return $this->endpoint.'/charges';\n }", "label": 0, "label_name": "vulnerable"} +{"code": "0;kl2tp_family != AF_INET)\n\t\treturn -EINVAL;\n\n\tret = -EADDRINUSE;\n\tread_lock_bh(&l2tp_ip_lock);\n\tif (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr,\n\t\t\t\t sk->sk_bound_dev_if, addr->l2tp_conn_id))\n\t\tgoto out_in_use;\n\n\tread_unlock_bh(&l2tp_ip_lock);\n\n\tlock_sock(sk);\n\tif (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_l2tpip))\n\t\tgoto out;\n\n\tchk_addr_ret = inet_addr_type(net, addr->l2tp_addr.s_addr);\n\tret = -EADDRNOTAVAIL;\n\tif (addr->l2tp_addr.s_addr && chk_addr_ret != RTN_LOCAL &&\n\t chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)\n\t\tgoto out;\n\n\tif (addr->l2tp_addr.s_addr)\n\t\tinet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;\n\tif (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)\n\t\tinet->inet_saddr = 0; /* Use device */\n\tsk_dst_reset(sk);\n\n\tl2tp_ip_sk(sk)->conn_id = addr->l2tp_conn_id;\n\n\twrite_lock_bh(&l2tp_ip_lock);\n\tsk_add_bind_node(sk, &l2tp_ip_bind_table);\n\tsk_del_node_init(sk);\n\twrite_unlock_bh(&l2tp_ip_lock);\n\tret = 0;\n\tsock_reset_flag(sk, SOCK_ZAPPED);\n\nout:\n\trelease_sock(sk);\n\n\treturn ret;\n\nout_in_use:\n\tread_unlock_bh(&l2tp_ip_lock);\n\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void fmtutil_macbitmap_read_pixmap_only_fields(deark *c, dbuf *f, struct fmtutil_macbitmap_info *bi,\n\ti64 pos)\n{\n\ti64 pixmap_version;\n\ti64 pack_size;\n\ti64 plane_bytes;\n\ti64 n;\n\n\tde_dbg(c, \"additional PixMap header fields, at %d\", (int)pos);\n\tde_dbg_indent(c, 1);\n\n\tpixmap_version = dbuf_getu16be(f, pos+0);\n\tde_dbg(c, \"pixmap version: %d\", (int)pixmap_version);\n\n\tbi->packing_type = dbuf_getu16be(f, pos+2);\n\tde_dbg(c, \"packing type: %d\", (int)bi->packing_type);\n\n\tpack_size = dbuf_getu32be(f, pos+4);\n\tde_dbg(c, \"pixel data length: %d\", (int)pack_size);\n\n\tbi->hdpi = pict_read_fixed(f, pos+8);\n\tbi->vdpi = pict_read_fixed(f, pos+12);\n\tde_dbg(c, \"dpi: %.2f\"DE_CHAR_TIMES\"%.2f\", bi->hdpi, bi->vdpi);\n\n\tbi->pixeltype = dbuf_getu16be(f, pos+16);\n\tbi->pixelsize = dbuf_getu16be(f, pos+18);\n\tbi->cmpcount = dbuf_getu16be(f, pos+20);\n\tbi->cmpsize = dbuf_getu16be(f, pos+22);\n\tde_dbg(c, \"pixel type=%d, bits/pixel=%d, components/pixel=%d, bits/comp=%d\",\n\t\t(int)bi->pixeltype, (int)bi->pixelsize, (int)bi->cmpcount, (int)bi->cmpsize);\n\n\tif(bi->pixelsize>0) {\n\t\tbi->pdwidth = (bi->rowbytes*8)/bi->pixelsize;\n\t}\n\tif(bi->pdwidth < bi->npwidth) {\n\t\tbi->pdwidth = bi->npwidth;\n\t}\n\n\tplane_bytes = dbuf_getu32be(f, pos+24);\n\tde_dbg(c, \"plane bytes: %d\", (int)plane_bytes);\n\n\tbi->pmTable = (u32)dbuf_getu32be(f, pos+28);\n\tde_dbg(c, \"pmTable: 0x%08x\", (unsigned int)bi->pmTable);\n\n\tn = dbuf_getu32be(f, pos+32);\n\tde_dbg(c, \"pmReserved: 0x%08x\", (unsigned int)n);\n\n\tde_dbg_indent(c, -1);\n}", "label": 1, "label_name": "safe"} +{"code": " public function test_getHTMLDefinition_inconsistentOptimizedError2()\n {\n $this->expectException(new HTMLPurifier_Exception(\"Inconsistent use of optimized and unoptimized raw definition retrievals\"));\n $config = HTMLPurifier_Config::create(array('HTML.DefinitionID' => 'HTMLPurifier_ConfigTest->test_getHTMLDefinition_inconsistentOptimizedError2'));\n $config->chatty = false;\n $config->getHTMLDefinition(true, true);\n $config->getHTMLDefinition(true, false);\n }", "label": 1, "label_name": "safe"} +{"code": "Array HHVM_FUNCTION(__SystemLib_compact_sl,\n const Variant& varname,\n const Array& args /* = null array */) {\n Array ret = Array::attach(PackedArray::MakeReserve(args.size() + 1));\n VarEnv* v = g_context->getOrCreateVarEnv();\n if (v) {\n PointerSet seen;\n compact(seen, v, ret, varname);\n if (!args.empty()) compact(seen, v, ret, args);\n }\n return ret;\n}", "label": 1, "label_name": "safe"} +{"code": " `${c.amount(d.value, d.name)}${day(d.date)}`,\n });\n}", "label": 0, "label_name": "vulnerable"} +{"code": "u[E]}catch(J){null!=window.console&&console.log(\"Error in vars URL parameter: \"+J)}};Graph.prototype.getExportVariables=function(){return null!=this.globalVars?mxUtils.clone(this.globalVars):{}};var z=Graph.prototype.getGlobalVariable;Graph.prototype.getGlobalVariable=function(u){var E=z.apply(this,arguments);null==E&&null!=this.globalVars&&(E=this.globalVars[u]);return E};Graph.prototype.getDefaultStylesheet=function(){if(null==this.defaultStylesheet){var u=this.themes[\"default-style2\"];this.defaultStylesheet=", "label": 0, "label_name": "vulnerable"} +{"code": " public function testSingleSpan()\n {\n $this->assertResult(\n 'foo',\n 'foo'\n );\n }", "label": 1, "label_name": "safe"} +{"code": "S&&S(La)}};za.onerror=function(wa){null!=S&&S(wa)};za.src=ua}else L()}catch(wa){null!=S&&S(wa)}});$a.onerror=function(L){null!=S&&S(L)};Aa&&this.graph.addSvgShadow(Ua);this.graph.mathEnabled&&this.addMathCss(Ua);var z=mxUtils.bind(this,function(){try{null!=this.resolvedFontCss&&this.addFontCss(Ua,this.resolvedFontCss),$a.src=Editor.createSvgDataUri(mxUtils.getXml(Ua))}catch(L){null!=S&&S(L)}});this.embedExtFonts(mxUtils.bind(this,function(L){try{null!=L&&this.addFontCss(Ua,L),this.loadFonts(z)}catch(M){null!=", "label": 1, "label_name": "safe"} +{"code": "horizontalDifference8(unsigned char *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From8)\n{\n register int r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n#undef\t CLAMP\n#define CLAMP(v) (From8[(v)])\n\n mask = CODE_MASK;\n if (n >= stride) {\n\tif (stride == 3) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]);\n\t n -= 3;\n\t while (n > 0) {\n\t\tn -= 3;\n\t\tr1 = CLAMP(ip[3]); wp[3] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[4]); wp[4] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[5]); wp[5] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\twp += 3;\n\t\tip += 3;\n\t }\n\t} else if (stride == 4) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);\n\t n -= 4;\n\t while (n > 0) {\n\t\tn -= 4;\n\t\tr1 = CLAMP(ip[4]); wp[4] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[5]); wp[5] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[6]); wp[6] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\ta1 = CLAMP(ip[7]); wp[7] = (uint16)((a1-a2) & mask); a2 = a1;\n\t\twp += 4;\n\t\tip += 4;\n\t }\n\t} else {\n\t wp += n + stride - 1;\t/* point to last one */\n\t ip += n + stride - 1;\t/* point to last one */\n\t n -= stride;\n\t while (n > 0) {\n\t\tREPEAT(stride, wp[0] = CLAMP(ip[0]);\n\t\t\t\twp[stride] -= wp[0];\n\t\t\t\twp[stride] &= mask;\n\t\t\t\twp--; ip--)\n\t\tn -= stride;\n\t }\n\t REPEAT(stride, wp[0] = CLAMP(ip[0]); wp--; ip--)\n\t}\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "EditorUi.lightboxHost+\"/js/viewer-static.min.js\")+'\">\\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(c,e,g,k){var m=document.createElement(\"div\");m.style.whiteSpace=\"nowrap\";var q=document.createElement(\"h3\");mxUtils.write(q,mxResources.get(\"html\"));q.style.cssText=\"width:100%;text-align:center;margin-top:0px;margin-bottom:12px\";m.appendChild(q);var v=document.createElement(\"div\");v.style.cssText=\"border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;\";var x=document.createElement(\"input\");\nx.style.cssText=\"margin-right:8px;margin-top:8px;margin-bottom:8px;\";x.setAttribute(\"value\",\"url\");x.setAttribute(\"type\",\"radio\");x.setAttribute(\"name\",\"type-embedhtmldialog\");q=x.cloneNode(!0);q.setAttribute(\"value\",\"copy\");v.appendChild(q);var A=document.createElement(\"span\");mxUtils.write(A,mxResources.get(\"includeCopyOfMyDiagram\"));v.appendChild(A);mxUtils.br(v);v.appendChild(x);A=document.createElement(\"span\");mxUtils.write(A,mxResources.get(\"publicDiagramUrl\"));v.appendChild(A);var z=this.getCurrentFile();\nnull==g&&null!=z&&z.constructor==window.DriveFile&&(A=document.createElement(\"a\"),A.style.paddingLeft=\"12px\",A.style.color=\"gray\",A.style.cursor=\"pointer\",mxUtils.write(A,mxResources.get(\"share\")),v.appendChild(A),mxEvent.addListener(A,\"click\",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(z.getId())})));q.setAttribute(\"checked\",\"checked\");null==g&&x.setAttribute(\"disabled\",\"disabled\");m.appendChild(v);var L=this.addLinkSection(m),M=this.addCheckbox(m,mxResources.get(\"zoom\"),\n!0,null,!0);mxUtils.write(m,\":\");var n=document.createElement(\"input\");n.setAttribute(\"type\",\"text\");n.style.marginRight=\"16px\";n.style.width=\"60px\";n.style.marginLeft=\"4px\";n.style.marginRight=\"12px\";n.value=\"100%\";m.appendChild(n);var y=this.addCheckbox(m,mxResources.get(\"fit\"),!0);v=null!=this.pages&&1controller->modelClass;\n $model = X2Model::model($modelClass);\n\n if (isset($model)) {\n $modelClass::checkThrowAttrError (array ($valueAttr, $nameAttr));\n $tableName = $model->tableName();\n $qterm = $term . '%';\n $params = array (\n ':qterm' => $qterm,\n );\n $sql = \"\n SELECT $nameAttr as id, $valueAttr as value \n FROM \" . $tableName . \" as t\n WHERE $valueAttr LIKE :qterm\";\n if ($model->asa ('permissions')) {\n list ($accessCond, $permissionsParams) = $model->getAccessSQLCondition ();\n $sql .= ' AND '.$accessCond;\n $params = array_merge ($params, $permissionsParams);\n }\n \n $sql .= \"ORDER BY $valueAttr ASC\";\n $command = Yii::app()->db->createCommand($sql);\n $result = $command->queryAll(true, $params);\n echo CJSON::encode($result);\n }\n Yii::app()->end();\n }", "label": 1, "label_name": "safe"} +{"code": " public PropertiesRequest getRequestedFields( InputStream in ) {\r\n\t\tfinal Set set = new LinkedHashSet();\r\n try {\r\n ByteArrayOutputStream bout = new ByteArrayOutputStream();\r\n StreamUtils.readTo( in, bout, false, true );\r\n byte[] arr = bout.toByteArray();\r\n if( arr.length > 1 ) {\r\n ByteArrayInputStream bin = new ByteArrayInputStream( arr );\r\n XMLReader reader = XMLReaderFactory.createXMLReader();\r\n\t\t\t\treader.setFeature(\"http://xml.org/sax/features/external-parameter-entities\", false);\r\n\t\t\t\t// https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Processing\r\n\t\t\t\treader.setFeature(\"http://apache.org/xml/features/disallow-doctype-decl\", true);\r\n\t\t\t\treader.setFeature(\"http://xml.org/sax/features/external-general-entities\", false);\r\n PropFindSaxHandler handler = new PropFindSaxHandler();\r\n reader.setContentHandler( handler );\r\n try {\r\n reader.parse( new InputSource( bin ) );\r\n if( handler.isAllProp() ) {\r\n return new PropertiesRequest();\r\n } else {\r\n set.addAll( handler.getAttributes().keySet() );\r\n }\r\n } catch( IOException e ) {\r\n log.warn( \"exception parsing request body\", e );\r\n // ignore\r\n } catch( SAXException e ) {\r\n log.warn( \"exception parsing request body\", e );\r\n // ignore\r\n }\r\n }\r\n } catch( Exception ex ) {\r\n\t\t\t// There's a report of an exception being thrown here by IT Hit Webdav client\r\n\t\t\t// Perhaps we can just log the error and return an empty set. Usually this\r\n\t\t\t// class is wrapped by the MsPropFindRequestFieldParser which will use a default\r\n\t\t\t// set of properties if this returns an empty set\r\n\t\t\tlog.warn(\"Exception parsing PROPFIND request fields. Returning empty property set\", ex);\r\n //throw new RuntimeException( ex );\r\n }\r\n\t\treturn PropertiesRequest.toProperties(set);\r\n }\r", "label": 1, "label_name": "safe"} +{"code": " def edit\n Log.add_info(request, params.inspect)\n\n address_id = params[:id]\n\n begin\n @address = Address.find(address_id)\n rescue => evar\n @address = nil\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n render(:layout => (!request.xhr?))\n end", "label": 1, "label_name": "safe"} +{"code": " def testRaggedCountSparseOutputEmptySplits(self):\n splits = []\n values = [1, 1, 2, 1, 2, 10, 5]\n weights = [1, 2, 3, 4, 5, 6, 7]\n with self.assertRaisesRegex(\n errors.InvalidArgumentError,\n \"Must provide at least 2 elements for the splits argument\"):\n self.evaluate(\n gen_count_ops.RaggedCountSparseOutput(\n splits=splits,\n values=values,\n weights=weights,\n binary_output=False))", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus PreluPrepare(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output = GetOutput(context, node, 0);\n const TfLiteTensor* alpha = GetInput(context, node, 1);\n PreluOpData* data = reinterpret_cast(node->user_data);\n\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, alpha->type);\n\n output->type = input->type;\n\n if (output->type == kTfLiteUInt8 || output->type == kTfLiteInt8 ||\n output->type == kTfLiteInt16) {\n // prelu(x) = x if x >= 0 else x * alpha.\n // So if we translate that for quantized computation:\n //\n // input_float = (input_q - input_zp) * input_scale\n // output_float = (output_q - output_zp) * output_scale\n // alpha_float = (alpha_q - alpha_zp) * alpha_scale\n //\n // When input_q - input_zp >= 0:\n // ouput_q = (input_q - input_zp) * input_scale / output_scale + output_q\n // else:\n // output_q = (input_q - input_zp) * (alpha_q - alpha_zp) * input_scale\n // * alpha_scale / output_scale + output_q\n //\n // So for input_q - input_zp >= 0:\n // output real multiplier 1 is input_scale / output_scale;\n // for input_q - input_zp < 0:\n // output real multiplier 2 is input_scale * alpha_scale/ output_scale.\n double real_multiplier_1 = input->params.scale / output->params.scale;\n double real_multiplier_2 =\n input->params.scale * alpha->params.scale / output->params.scale;\n QuantizeMultiplier(real_multiplier_1, &data->output_multiplier_1,\n &data->output_shift_1);\n QuantizeMultiplier(real_multiplier_2, &data->output_multiplier_2,\n &data->output_shift_2);\n }\n\n data->requires_broadcast = !HaveSameShapes(input, alpha);\n // PRelu (parameteric Relu) shares the same alpha value on \"shared axis\".\n // This means it's always required to \"broadcast\" alpha values in PRelu.\n TfLiteIntArray* output_size = nullptr;\n TF_LITE_ENSURE_OK(\n context, CalculateShapeForBroadcast(context, input, alpha, &output_size));\n\n TF_LITE_ENSURE_OK(context,\n context->ResizeTensor(context, output, output_size));\n // After broadcasting, the output shape should always be the same as the\n // input shape.\n TF_LITE_ENSURE(context, HaveSameShapes(input, output));\n\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testImportantWithSpace()\n {\n $this->setMock('23');\n $this->assertDef('23 ! important ', '23 !important');\n }", "label": 1, "label_name": "safe"} +{"code": "this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1),null!=this.menus.findReplaceWindow&&this.menus.findReplaceWindow.window.setVisible(!1))};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);if((window.opener||window.parent)!=window&&(\"1\"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get(\"loading\")))){var c=!1;this.installMessageHandler(mxUtils.bind(this,function(e,g,k,m){c||(c=!0,this.spinner.stop(),this.addEmbedButtons(),this.setGraphEnabled(!0));\nif(null==e||0==e.length)e=this.emptyDiagramXml;this.setCurrentFile(new EmbedFile(this,e,{}));this.mode=App.MODE_EMBED;this.setFileData(e);if(m)try{var q=this.editor.graph;q.setGridEnabled(!1);q.pageVisible=!1;var v=q.model.cells,y;for(y in v){var A=v[y];null!=A&&null!=A.style&&(A.style+=\";sketch=1;\"+(-1==A.style.indexOf(\"fontFamily=\")||-1 u8 {\n let mut result: u8 = 0x00;\n let mut mask: u8;\n let idx: [u8;2] = [ b64ch % 64, b64ch % 64 + 64];\n for i in 0..2 {\n mask = 0xFF ^ (((idx[i] == b64ch) as i8 - 1) as u8);\n result = result | (decode_table[idx[i] as usize] & mask);\n }\n result\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, $throwAt = E_ALL, $scream = true, $fileLinkFormat = null)\n {\n $this->exceptionHandler = $exceptionHandler;\n $this->logger = $logger;\n $this->levels = null === $levels ? E_ALL : $levels;\n $this->throwAt = is_numeric($throwAt) ? (int) $throwAt : (null === $throwAt ? null : ($throwAt ? E_ALL : null));\n $this->scream = (bool) $scream;\n $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "accountsController.uploadImage = function (req, res) {\n const fs = require('fs')\n const path = require('path')\n const Busboy = require('busboy')\n const busboy = Busboy({\n headers: req.headers,\n limits: {\n files: 1,\n fileSize: 1024 * 1024 * 3 // 3mb limit\n }\n })\n\n const object = {}\n let error\n\n busboy.on('field', function (fieldname, val) {\n if (fieldname === '_id') object._id = val\n if (fieldname === 'username') object.username = val\n })\n\n busboy.on('file', function (name, file, info) {\n const filename = info.filename\n const mimetype = info.mimeType\n const ext = path.extname(filename)\n if (mimetype.indexOf('image/') === -1 || ext === '.svg') {\n error = {\n status: 400,\n message: 'Invalid File Type'\n }\n\n return file.resume()\n }\n\n const savePath = path.join(__dirname, '../../public/uploads/users')\n if (!fs.existsSync(savePath)) fs.mkdirSync(savePath)\n\n object.filePath = path.join(savePath, 'aProfile_' + object.username + path.extname(filename))\n object.filename = 'aProfile_' + object.username + path.extname(filename)\n object.mimetype = mimetype\n\n file.on('limit', function () {\n error = {\n status: 400,\n message: 'File too large'\n }\n\n // Delete the temp file\n // if (fs.existsSync(object.filePath)) fs.unlinkSync(object.filePath);\n\n return file.resume()\n })\n\n file.pipe(fs.createWriteStream(object.filePath))\n })\n\n busboy.once('finish', function () {\n if (error) {\n winston.warn(error)\n return res.status(error.status).send(error.message)\n }\n\n if (\n _.isUndefined(object._id) ||\n _.isUndefined(object.username) ||\n _.isUndefined(object.filePath) ||\n _.isUndefined(object.filename)\n ) {\n return res.status(400).send('Invalid Form Data')\n }\n\n // Everything Checks out lets make sure the file exists and then add it to the attachments array\n if (!fs.existsSync(object.filePath)) return res.status(400).send('File Failed to Save to Disk')\n if (path.extname(object.filename) === '.jpg' || path.extname(object.filename) === '.jpeg') {\n require('../helpers/utils').stripExifData(object.filePath)\n }\n\n userSchema.getUser(object._id, function (err, user) {\n if (err) return handleError(res, err)\n\n user.image = object.filename\n\n user.save(function (err) {\n if (err) return handleError(res, err)\n\n emitter.emit('trudesk:profileImageUpdate', {\n userid: user._id,\n img: user.image\n })\n\n return res.status(200).send('/uploads/users/' + object.filename)\n })\n })\n })\n\n req.pipe(busboy)\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\tfn.assign = function(scope, value, locals) {\n\t\t\t\treturn assign(scope, locals, value);\n\t\t\t};", "label": 1, "label_name": "safe"} +{"code": "\"25px\";btn.className=\"geColorBtn\";return btn}function Y(za,ta,ka,oa,sa,ya,wa){if(0 maxSize * 1024) {\n\t\t\tthrow new Error(`[[error:file-too-big, ${maxSize}]]`);\n\t\t}\n\t\tif (socketUploads[method].imageData.length < data.params.size) {\n\t\t\treturn;\n\t\t}\n\t\tdata.params.imageData = socketUploads[method].imageData;\n\t\tconst result = await methodToFunc[data.params.method](socket, data.params);\n\t\tdelete socketUploads[method];\n\t\treturn result;\n\t} catch (err) {\n\t\tdelete inProgress[socket.id];\n\t\tthrow err;\n\t}\n};", "label": 1, "label_name": "safe"} +{"code": " def create_info_block(options)\n return nil unless options\n assignments = options.map { |k, v| \"img.#{k} = #{v}\" }\n code = \"lambda { |img| \" + assignments.join(\";\") + \"}\"\n eval code\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function execute($image)\n {\n $mode = $this->argument(0)->type('bool')->value(true);\n\n imageinterlace($image->getCore(), $mode);\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function tearDown () {\n // try to replace mocks with original components in case mocks were set during test case\n TestingAuxLib::restoreX2WebUser ();\n TestingAuxLib::restoreX2AuthManager ();\n return parent::tearDown ();\n }", "label": 1, "label_name": "safe"} +{"code": "function test_sql_and_script_inject($val, $type)\n{\n\t$inj = 0;\n\t// For SQL Injection (only GET are used to be included into bad escaped SQL requests)\n\tif ($type == 1 || $type == 3)\n\t{\n\t\t$inj += preg_match('/delete\\s+from/i',\t $val);\n\t\t$inj += preg_match('/create\\s+table/i',\t $val);\n\t\t$inj += preg_match('/insert\\s+into/i', \t $val);\n\t\t$inj += preg_match('/select\\s+from/i', \t $val);\n\t\t$inj += preg_match('/into\\s+(outfile|dumpfile)/i', $val);\n\t\t$inj += preg_match('/user\\s*\\(/i', $val);\t\t\t\t\t\t// avoid to use function user() that return current database login\n\t\t$inj += preg_match('/information_schema/i', $val);\t\t\t\t// avoid to use request that read information_schema database\n\t}\n\tif ($type == 3)\n\t{\n\t\t$inj += preg_match('/select|update|delete|replace|group\\s+by|concat|count|from/i',\t $val);\n\t}\n\tif ($type != 2)\t// Not common key strings, so we can check them both on GET and POST\n\t{\n\t\t$inj += preg_match('/updatexml\\(/i', \t $val);\n\t\t$inj += preg_match('/update.+set.+=/i', $val);\n\t\t$inj += preg_match('/union.+select/i', \t $val);\n\t\t$inj += preg_match('/(\\.\\.%2f)+/i',\t\t $val);\n\t}\n\t// For XSS Injection done by adding javascript with script\n\t// This is all cases a browser consider text is javascript:\n\t// When it found '\n\t$inj += preg_match('/onerror\\s*=/i', $val); // onerror can be set on img or any html tag like \n\t$inj += preg_match('/onfocus\\s*=/i', $val); // onfocus can be set on input text html tag like \n\t$inj += preg_match('/onload\\s*=/i', $val); // onload can be set on svg tag or other tag like body \n\t$inj += preg_match('/onloadstart\\s*=/i', $val); // onload can be set on audio tag