prompt
stringclasses 1
value | completions
listlengths 1
1.33k
| labels
listlengths 1
1.33k
| source
stringclasses 1
value | other_info
dict | index
int64 0
151k
|
|---|---|---|---|---|---|
Determine whether the code is vulnerable or not.
|
[
"psf_get_date_str (char *str, int maxlen)\n{\ttime_t\t\tcurrent ;\n\tstruct tm\ttimedata, *tmptr ;",
"\ttime (¤t) ;",
"#if defined (HAVE_GMTIME_R)\n\t/* If the re-entrant version is available, use it. */\n\ttmptr = gmtime_r (¤t, &timedata) ;\n#elif defined (HAVE_GMTIME)\n\t/* Otherwise use the standard one and copy the data to local storage. */\n\ttmptr = gmtime (¤t) ;\n\tmemcpy (&timedata, tmptr, sizeof (timedata)) ;\n#else\n\ttmptr = NULL ;\n#endif",
"\tif (tmptr)\n\t\tsnprintf (str, maxlen, \"%4d-%02d-%02d %02d:%02d:%02d UTC\",\n\t\t\t1900 + timedata.tm_year, timedata.tm_mon, timedata.tm_mday,\n\t\t\ttimedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;\n\telse\n\t\tsnprintf (str, maxlen, \"Unknown date\") ;",
"\treturn ;\n} /* psf_get_date_str */\n"
] |
[
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-7586",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-7586/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/erikd/libsndfile/commit/708e996c87c5fae77b104ccfeb8f6db784c32074",
"commit_id": "708e996c87c5fae77b104ccfeb8f6db784c32074",
"commit_message": "src/ : Move to a variable length header buffer\n\nPreviously, the `psf->header` buffer was a fixed length specified by\n`SF_HEADER_LEN` which was set to `12292`. This was problematic for\ntwo reasons; this value was un-necessarily large for the majority\nof files and too small for some others.\n\nNow the size of the header buffer starts at 256 bytes and grows as\nnecessary up to a maximum of 100k.",
"lang": "C",
"project": "libsndfile"
}
| 0
|
Determine whether the code is vulnerable or not.
|
[
"void MultibufferDataSource::CreateResourceLoader(int64_t first_byte_position,\n int64_t last_byte_position) {\n DCHECK(render_task_runner_->BelongsToCurrentThread());",
" SetReader(new MultiBufferReader(\n url_data()->multibuffer(), first_byte_position, last_byte_position,\n base::Bind(&MultibufferDataSource::ProgressCallback, weak_ptr_)));\n reader_->SetIsClientAudioElement(is_client_audio_element_);\n UpdateBufferSizes();\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-18352",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-18352/",
"CWE ID": "CWE-732",
"codeLink": "https://github.com/chromium/chromium/commit/a9cbaa7a40e2b2723cfc2f266c42f4980038a949",
"commit_id": "a9cbaa7a40e2b2723cfc2f266c42f4980038a949",
"commit_message": "Simplify \"WouldTaintOrigin\" concept in media/blink\n\nCurrently WebMediaPlayer has three predicates:\n - DidGetOpaqueResponseFromServiceWorker\n - HasSingleSecurityOrigin\n - DidPassCORSAccessCheck\n. These are used to determine whether the response body is available\nfor scripts. They are known to be confusing, and actually\nMediaElementAudioSourceHandler::WouldTaintOrigin misuses them.\n\nThis CL merges the three predicates to one, WouldTaintOrigin, to remove\nthe confusion. Now the \"response type\" concept is available and we\ndon't need a custom CORS check, so this CL removes\nBaseAudioContext::WouldTaintOrigin. This CL also renames\nURLData::has_opaque_data_ and its (direct and indirect) data accessors\nto match the spec.\n\nBug: 849942, 875153\nChange-Id: I6acf50169d7445c4ff614e80ac606f79ee577d2a\nReviewed-on: https://chromium-review.googlesource.com/c/1238098\nReviewed-by: Fredrik Hubinette <hubbe@chromium.org>\nReviewed-by: Kinuko Yasuda <kinuko@chromium.org>\nReviewed-by: Raymond Toy <rtoy@chromium.org>\nCommit-Queue: Yutaka Hirano <yhirano@chromium.org>\nCr-Commit-Position: refs/heads/master@{#598258}",
"lang": "C",
"project": "Chrome"
}
| 1
|
Determine whether the code is vulnerable or not.
|
[
"fbStore_a2r2g2b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed)\n{\n int i;\n CARD8 *pixel = ((CARD8 *) bits) + x;\n for (i = 0; i < width; ++i) {\n Splita(READ(values + i));\n WRITE(pixel++, ((a ) & 0xc0) |\n\t ((r >> 2) & 0x30) |\n\t ((g >> 4) & 0x0c) |\n\t ((b >> 6) ));\n }\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2010-1166",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2010-1166/",
"CWE ID": "CWE-189",
"codeLink": "https://cgit.freedesktop.org/xorg/xserver/commit/?id=d2f813f7db",
"commit_id": "d2f813f7db157fc83abc4b3726821c36ee7e40b1",
"commit_message": null,
"lang": "C",
"project": "xserver"
}
| 2
|
Determine whether the code is vulnerable or not.
|
[
"void UsageTracker::DidGetClientGlobalUsage(StorageType type,\n int64 usage,\n int64 unlimited_usage) {\n DCHECK_EQ(type, type_);\n global_usage_.usage += usage;\n global_usage_.unlimited_usage += unlimited_usage;\n if (--global_usage_.pending_clients == 0) {\n if (global_usage_.usage < 0)\n global_usage_.usage = 0;\n if (global_usage_.unlimited_usage > global_usage_.usage)\n global_usage_.unlimited_usage = global_usage_.usage;\n else if (global_usage_.unlimited_usage < 0)\n global_usage_.unlimited_usage = 0;",
" global_usage_callbacks_.Run(type, global_usage_.usage,\n global_usage_.unlimited_usage);\n }\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": null,
"CVE Page": null,
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/610f904d8215075c4681be4eb413f4348860bf9f",
"commit_id": "610f904d8215075c4681be4eb413f4348860bf9f",
"commit_message": "Retrieve per host storage usage from QuotaManager.\n\nR=kinuko@chromium.org\nBUG=none\nTEST=QuotaManagerTest.GetUsage\n\nReview URL: http://codereview.chromium.org/8079004\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@103921 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 3
|
Determine whether the code is vulnerable or not.
|
[
"void BlobURLRequestJob::DidRead(int result) {\n if (result < 0) {\n NotifyFailure(net::ERR_FAILED);\n return;\n }\n SetStatus(net::URLRequestStatus()); // Clear the IO_PENDING status",
" AdvanceBytesRead(result);",
" if (!read_buf_remaining_bytes_) {\n int bytes_read = ReadCompleted();\n NotifyReadComplete(bytes_read);\n return;\n }",
" int bytes_read = 0;\n if (ReadLoop(&bytes_read))\n NotifyReadComplete(bytes_read);\n}\n"
] |
[
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": null,
"CVE Page": null,
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/957973753ec4159003ff7930d946b7e89c7e09f3",
"commit_id": "957973753ec4159003ff7930d946b7e89c7e09f3",
"commit_message": "Make NotifyHeadersComplete the last call in the function.\n\nBUG=82903\nReview URL: http://codereview.chromium.org/7038017\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@85719 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 4
|
Determine whether the code is vulnerable or not.
|
[
"gss_get_mic (minor_status,\n\t context_handle,\n\t qop_req,\n\t message_buffer,\n\t msg_token)",
"OM_uint32 *\t\tminor_status;\ngss_ctx_id_t\t\tcontext_handle;\ngss_qop_t\t\tqop_req;\ngss_buffer_t\t\tmessage_buffer;\ngss_buffer_t\t\tmsg_token;",
"{\n OM_uint32\t\tstatus;\n gss_union_ctx_id_t\tctx;\n gss_mechanism\tmech;",
" status = val_get_mic_args(minor_status, context_handle,\n\t\t\t qop_req, message_buffer, msg_token);\n if (status != GSS_S_COMPLETE)\n\treturn (status);",
" /*\n * select the approprate underlying mechanism routine and\n * call it.\n */\n \n ctx = (gss_union_ctx_id_t) context_handle;",
"",
" mech = gssint_get_mechanism (ctx->mech_type);\n \n if (mech) {\n\tif (mech->gss_get_mic) {\n\t status = mech->gss_get_mic(\n\t\t\t\t minor_status,\n\t\t\t\t ctx->internal_ctx_id,\n\t\t\t\t qop_req,\n\t\t\t\t message_buffer,\n\t\t\t\t msg_token);\n\t if (status != GSS_S_COMPLETE)\n\t\tmap_error(minor_status, mech);\n\t} else\n\t status = GSS_S_UNAVAILABLE;",
"\treturn(status);\n }",
" return (GSS_S_BAD_MECH);\n}"
] |
[
1,
1,
1,
1,
1,
0,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-11462",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-11462/",
"CWE ID": "CWE-415",
"codeLink": "https://github.com/krb5/krb5/commit/56f7b1bc95a2a3eeb420e069e7655fb181ade5cf",
"commit_id": "56f7b1bc95a2a3eeb420e069e7655fb181ade5cf",
"commit_message": "Preserve GSS context on init/accept failure\n\nAfter gss_init_sec_context() or gss_accept_sec_context() has created a\ncontext, don't delete the mechglue context on failures from subsequent\ncalls, even if the mechanism deletes the mech-specific context (which\nis allowed by RFC 2744 but not preferred). Check for union contexts\nwith no mechanism context in each GSS function which accepts a\ngss_ctx_id_t.\n\nCVE-2017-11462:\n\nRFC 2744 permits a GSS-API implementation to delete an existing\nsecurity context on a second or subsequent call to\ngss_init_sec_context() or gss_accept_sec_context() if the call results\nin an error. This API behavior has been found to be dangerous,\nleading to the possibility of memory errors in some callers. For\nsafety, GSS-API implementations should instead preserve existing\nsecurity contexts on error until the caller deletes them.\n\nAll versions of MIT krb5 prior to this change may delete acceptor\ncontexts on error. Versions 1.13.4 through 1.13.7, 1.14.1 through\n1.14.5, and 1.15 through 1.15.1 may also delete initiator contexts on\nerror.\n\nticket: 8598 (new)\ntarget_version: 1.15-next\ntarget_version: 1.14-next\ntags: pullup",
"lang": "C",
"project": "krb5"
}
| 5
|
Determine whether the code is vulnerable or not.
|
[
"gss_get_mic (minor_status,\n\t context_handle,\n\t qop_req,\n\t message_buffer,\n\t msg_token)",
"OM_uint32 *\t\tminor_status;\ngss_ctx_id_t\t\tcontext_handle;\ngss_qop_t\t\tqop_req;\ngss_buffer_t\t\tmessage_buffer;\ngss_buffer_t\t\tmsg_token;",
"{\n OM_uint32\t\tstatus;\n gss_union_ctx_id_t\tctx;\n gss_mechanism\tmech;",
" status = val_get_mic_args(minor_status, context_handle,\n\t\t\t qop_req, message_buffer, msg_token);\n if (status != GSS_S_COMPLETE)\n\treturn (status);",
" /*\n * select the approprate underlying mechanism routine and\n * call it.\n */\n \n ctx = (gss_union_ctx_id_t) context_handle;",
" if (ctx->internal_ctx_id == GSS_C_NO_CONTEXT)\n\treturn (GSS_S_NO_CONTEXT);",
" mech = gssint_get_mechanism (ctx->mech_type);\n \n if (mech) {\n\tif (mech->gss_get_mic) {\n\t status = mech->gss_get_mic(\n\t\t\t\t minor_status,\n\t\t\t\t ctx->internal_ctx_id,\n\t\t\t\t qop_req,\n\t\t\t\t message_buffer,\n\t\t\t\t msg_token);\n\t if (status != GSS_S_COMPLETE)\n\t\tmap_error(minor_status, mech);\n\t} else\n\t status = GSS_S_UNAVAILABLE;",
"\treturn(status);\n }",
" return (GSS_S_BAD_MECH);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-11462",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-11462/",
"CWE ID": "CWE-415",
"codeLink": "https://github.com/krb5/krb5/commit/56f7b1bc95a2a3eeb420e069e7655fb181ade5cf",
"commit_id": "56f7b1bc95a2a3eeb420e069e7655fb181ade5cf",
"commit_message": "Preserve GSS context on init/accept failure\n\nAfter gss_init_sec_context() or gss_accept_sec_context() has created a\ncontext, don't delete the mechglue context on failures from subsequent\ncalls, even if the mechanism deletes the mech-specific context (which\nis allowed by RFC 2744 but not preferred). Check for union contexts\nwith no mechanism context in each GSS function which accepts a\ngss_ctx_id_t.\n\nCVE-2017-11462:\n\nRFC 2744 permits a GSS-API implementation to delete an existing\nsecurity context on a second or subsequent call to\ngss_init_sec_context() or gss_accept_sec_context() if the call results\nin an error. This API behavior has been found to be dangerous,\nleading to the possibility of memory errors in some callers. For\nsafety, GSS-API implementations should instead preserve existing\nsecurity contexts on error until the caller deletes them.\n\nAll versions of MIT krb5 prior to this change may delete acceptor\ncontexts on error. Versions 1.13.4 through 1.13.7, 1.14.1 through\n1.14.5, and 1.15 through 1.15.1 may also delete initiator contexts on\nerror.\n\nticket: 8598 (new)\ntarget_version: 1.15-next\ntarget_version: 1.14-next\ntags: pullup",
"lang": "C",
"project": "krb5"
}
| 5
|
Determine whether the code is vulnerable or not.
|
[
"void PluginServiceImpl::RegisterFilePathWatcher(FilePathWatcher* watcher,\n const FilePath& path) {\n bool result = watcher->Watch(path, false,\n base::Bind(&NotifyPluginDirChanged));\n DCHECK(result);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0910",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0910/",
"CWE ID": "CWE-287",
"codeLink": "https://github.com/chromium/chromium/commit/ac8bd041b81e46e4e4fcd5021aaa5499703952e6",
"commit_id": "ac8bd041b81e46e4e4fcd5021aaa5499703952e6",
"commit_message": "Follow-on fixes and naming changes for https://codereview.chromium.org/12086077/\n\nBUG=172573\nReview URL: https://codereview.chromium.org/12177018\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@180600 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 6
|
Determine whether the code is vulnerable or not.
|
[
"record_loop_stats(\n\tdouble\toffset,\t\t/* offset */\n\tdouble\tfreq,\t\t/* frequency (PPM) */\n\tdouble\tjitter,\t\t/* jitter */\n\tdouble\twander,\t\t/* wander (PPM) */\n\tint spoll\n\t)\n{\n\tl_fp\tnow;\n\tu_long\tday;",
"\tif (!stats_control)\n\t\treturn;",
"\tget_systime(&now);\n\tfilegen_setup(&loopstats, now.l_ui);\n\tday = now.l_ui / 86400 + MJD_1900;\n\tnow.l_ui %= 86400;\n\tif (loopstats.fp != NULL) {\n\t\tfprintf(loopstats.fp, \"%lu %s %.9f %.3f %.9f %.6f %d\\n\",\n\t\t day, ulfptoa(&now, 3), offset, freq * 1e6, jitter,\n\t\t wander * 1e6, spoll);\n\t\tfflush(loopstats.fp);\n\t}\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2015-5195",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2015-5195/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/ntp-project/ntp/commit/52e977d79a0c4ace997e5c74af429844da2f27be",
"commit_id": "52e977d79a0c4ace997e5c74af429844da2f27be",
"commit_message": "[Bug 1773] openssl not detected during ./configure.\n[Bug 1774] Segfaults if cryptostats enabled and built without OpenSSL.",
"lang": "C",
"project": "ntp"
}
| 7
|
Determine whether the code is vulnerable or not.
|
[
"static void hns_xgmac_exc_irq_en(struct mac_driver *drv, u32 en)\n{\n\tu32 clr_vlue = 0xfffffffful;\n\tu32 msk_vlue = en ? 0xfffffffful : 0; /*1 is en, 0 is dis*/",
"\tdsaf_write_dev(drv, XGMAC_INT_STATUS_REG, clr_vlue);\n\tdsaf_write_dev(drv, XGMAC_INT_ENABLE_REG, msk_vlue);\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-18222",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-18222/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/torvalds/linux/commit/412b65d15a7f8a93794653968308fc100f2aa87c",
"commit_id": "412b65d15a7f8a93794653968308fc100f2aa87c",
"commit_message": "net: hns: fix ethtool_get_strings overflow in hns driver\n\nhns_get_sset_count() returns HNS_NET_STATS_CNT and the data space allocated\nis not enough for ethtool_get_strings(), which will cause random memory\ncorruption.\n\nWhen SLAB and DEBUG_SLAB are both enabled, memory corruptions like the\nthe following can be observed without this patch:\n[ 43.115200] Slab corruption (Not tainted): Acpi-ParseExt start=ffff801fb0b69030, len=80\n[ 43.115206] Redzone: 0x9f911029d006462/0x5f78745f31657070.\n[ 43.115208] Last user: [<5f7272655f746b70>](0x5f7272655f746b70)\n[ 43.115214] 010: 70 70 65 31 5f 74 78 5f 70 6b 74 00 6b 6b 6b 6b ppe1_tx_pkt.kkkk\n[ 43.115217] 030: 70 70 65 31 5f 74 78 5f 70 6b 74 5f 6f 6b 00 6b ppe1_tx_pkt_ok.k\n[ 43.115218] Next obj: start=ffff801fb0b69098, len=80\n[ 43.115220] Redzone: 0x706d655f6f666966/0x9f911029d74e35b.\n[ 43.115229] Last user: [<ffff0000084b11b0>](acpi_os_release_object+0x28/0x38)\n[ 43.115231] 000: 74 79 00 6b 6b 6b 6b 6b 70 70 65 31 5f 74 78 5f ty.kkkkkppe1_tx_\n[ 43.115232] 010: 70 6b 74 5f 65 72 72 5f 63 73 75 6d 5f 66 61 69 pkt_err_csum_fai\n\nSigned-off-by: Timmy Li <lixiaoping3@huawei.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
"lang": "C",
"project": "linux"
}
| 8
|
Determine whether the code is vulnerable or not.
|
[
"void BaseRenderingContext2D::clip(Path2D* dom_path,\n const String& winding_rule_string) {\n ClipInternal(dom_path->GetPath(), winding_rule_string);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-6077",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-6077/",
"CWE ID": "CWE-200",
"codeLink": "https://github.com/chromium/chromium/commit/6ed26f014f76f10e76e80636027a2db9dcbe1664",
"commit_id": "6ed26f014f76f10e76e80636027a2db9dcbe1664",
"commit_message": "[PE] Distinguish between tainting due to canvas content and filter.\n\nA filter on a canvas can itself lead to origin tainting, for reasons\nother than that the canvas contents are tainted. This CL changes\nto distinguish these two causes, so that we recompute filters\non content-tainting change.\n\nBug: 778506\nChange-Id: I3cec8ef3b2772f2af78cdd4b290520113092cca6\nReviewed-on: https://chromium-review.googlesource.com/811767\nReviewed-by: Fredrik Söderquist <fs@opera.com>\nCommit-Queue: Chris Harrelson <chrishtr@chromium.org>\nCr-Commit-Position: refs/heads/master@{#522274}",
"lang": "C",
"project": "Chrome"
}
| 9
|
Determine whether the code is vulnerable or not.
|
[
"int http_process_request(struct session *s, struct channel *req, int an_bit)\n{\n\tstruct http_txn *txn = &s->txn;\n\tstruct http_msg *msg = &txn->req;\n\tstruct connection *cli_conn = objt_conn(req->prod->end);",
"\tif (unlikely(msg->msg_state < HTTP_MSG_BODY)) {\n\t\t/* we need more data */\n\t\tchannel_dont_connect(req);\n\t\treturn 0;\n\t}",
"\tDPRINTF(stderr,\"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\\n\",\n\t\tnow_ms, __FUNCTION__,\n\t\ts,\n\t\treq,\n\t\treq->rex, req->wex,\n\t\treq->flags,\n\t\treq->buf->i,\n\t\treq->analysers);",
"\tif (s->fe->comp || s->be->comp)\n\t\tselect_compression_request_header(s, req->buf);",
"\t/*\n\t * Right now, we know that we have processed the entire headers\n\t * and that unwanted requests have been filtered out. We can do\n\t * whatever we want with the remaining request. Also, now we\n\t * may have separate values for ->fe, ->be.\n\t */",
"\t/*\n\t * If HTTP PROXY is set we simply get remote server address parsing\n\t * incoming request. Note that this requires that a connection is\n\t * allocated on the server side.\n\t */\n\tif ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SN_ADDR_SET)) {\n\t\tstruct connection *conn;\n\t\tchar *path;",
"\t\t/* Note that for now we don't reuse existing proxy connections */\n\t\tif (unlikely((conn = si_alloc_conn(req->cons, 0)) == NULL)) {\n\t\t\ttxn->req.msg_state = HTTP_MSG_ERROR;\n\t\t\ttxn->status = 500;\n\t\t\treq->analysers = 0;\n\t\t\tstream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_500));",
"\t\t\tif (!(s->flags & SN_ERR_MASK))\n\t\t\t\ts->flags |= SN_ERR_RESOURCE;\n\t\t\tif (!(s->flags & SN_FINST_MASK))\n\t\t\t\ts->flags |= SN_FINST_R;",
"\t\t\treturn 0;\n\t\t}",
"\t\tpath = http_get_path(txn);\n\t\turl2sa(req->buf->p + msg->sl.rq.u,\n\t\t path ? path - (req->buf->p + msg->sl.rq.u) : msg->sl.rq.u_l,\n\t\t &conn->addr.to, NULL);\n\t\t/* if the path was found, we have to remove everything between\n\t\t * req->buf->p + msg->sl.rq.u and path (excluded). If it was not\n\t\t * found, we need to replace from req->buf->p + msg->sl.rq.u for\n\t\t * u_l characters by a single \"/\".\n\t\t */\n\t\tif (path) {\n\t\t\tchar *cur_ptr = req->buf->p;\n\t\t\tchar *cur_end = cur_ptr + txn->req.sl.rq.l;\n\t\t\tint delta;",
"\t\t\tdelta = buffer_replace2(req->buf, req->buf->p + msg->sl.rq.u, path, NULL, 0);\n\t\t\thttp_msg_move_end(&txn->req, delta);\n\t\t\tcur_end += delta;\n\t\t\tif (http_parse_reqline(&txn->req, HTTP_MSG_RQMETH, cur_ptr, cur_end + 1, NULL, NULL) == NULL)\n\t\t\t\tgoto return_bad_req;\n\t\t}\n\t\telse {\n\t\t\tchar *cur_ptr = req->buf->p;\n\t\t\tchar *cur_end = cur_ptr + txn->req.sl.rq.l;\n\t\t\tint delta;",
"\t\t\tdelta = buffer_replace2(req->buf, req->buf->p + msg->sl.rq.u,\n\t\t\t\t\t\treq->buf->p + msg->sl.rq.u + msg->sl.rq.u_l, \"/\", 1);\n\t\t\thttp_msg_move_end(&txn->req, delta);\n\t\t\tcur_end += delta;\n\t\t\tif (http_parse_reqline(&txn->req, HTTP_MSG_RQMETH, cur_ptr, cur_end + 1, NULL, NULL) == NULL)\n\t\t\t\tgoto return_bad_req;\n\t\t}\n\t}",
"\t/*\n\t * 7: Now we can work with the cookies.\n\t * Note that doing so might move headers in the request, but\n\t * the fields will stay coherent and the URI will not move.\n\t * This should only be performed in the backend.\n\t */\n\tif ((s->be->cookie_name || s->be->appsession_name || s->fe->capture_name)\n\t && !(txn->flags & (TX_CLDENY|TX_CLTARPIT)))\n\t\tmanage_client_side_cookies(s, req);",
"\t/*\n\t * 8: the appsession cookie was looked up very early in 1.2,\n\t * so let's do the same now.\n\t */",
"\t/* It needs to look into the URI unless persistence must be ignored */\n\tif ((txn->sessid == NULL) && s->be->appsession_name && !(s->flags & SN_IGNORE_PRST)) {\n\t\tget_srv_from_appsession(s, req->buf->p + msg->sl.rq.u, msg->sl.rq.u_l);\n\t}",
"\t/* add unique-id if \"header-unique-id\" is specified */",
"\tif (!LIST_ISEMPTY(&s->fe->format_unique_id)) {\n\t\tif ((s->unique_id = pool_alloc2(pool2_uniqueid)) == NULL)\n\t\t\tgoto return_bad_req;\n\t\ts->unique_id[0] = '\\0';\n\t\tbuild_logline(s, s->unique_id, UNIQUEID_LEN, &s->fe->format_unique_id);\n\t}",
"\tif (s->fe->header_unique_id && s->unique_id) {\n\t\tchunk_printf(&trash, \"%s: %s\", s->fe->header_unique_id, s->unique_id);\n\t\tif (trash.len < 0)\n\t\t\tgoto return_bad_req;\n\t\tif (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, trash.len) < 0))\n\t\t goto return_bad_req;\n\t}",
"\t/*\n\t * 9: add X-Forwarded-For if either the frontend or the backend\n\t * asks for it.\n\t */\n\tif ((s->fe->options | s->be->options) & PR_O_FWDFOR) {\n\t\tstruct hdr_ctx ctx = { .idx = 0 };\n\t\tif (!((s->fe->options | s->be->options) & PR_O_FF_ALWAYS) &&\n\t\t\thttp_find_header2(s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_name : s->fe->fwdfor_hdr_name,\n\t\t\t s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_len : s->fe->fwdfor_hdr_len,\n\t\t\t req->buf->p, &txn->hdr_idx, &ctx)) {\n\t\t\t/* The header is set to be added only if none is present\n\t\t\t * and we found it, so don't do anything.\n\t\t\t */\n\t\t}\n\t\telse if (cli_conn && cli_conn->addr.from.ss_family == AF_INET) {\n\t\t\t/* Add an X-Forwarded-For header unless the source IP is\n\t\t\t * in the 'except' network range.\n\t\t\t */\n\t\t\tif ((!s->fe->except_mask.s_addr ||\n\t\t\t (((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr.s_addr & s->fe->except_mask.s_addr)\n\t\t\t != s->fe->except_net.s_addr) &&\n\t\t\t (!s->be->except_mask.s_addr ||\n\t\t\t (((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr.s_addr & s->be->except_mask.s_addr)\n\t\t\t != s->be->except_net.s_addr)) {\n\t\t\t\tint len;\n\t\t\t\tunsigned char *pn;\n\t\t\t\tpn = (unsigned char *)&((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr;",
"\t\t\t\t/* Note: we rely on the backend to get the header name to be used for\n\t\t\t\t * x-forwarded-for, because the header is really meant for the backends.\n\t\t\t\t * However, if the backend did not specify any option, we have to rely\n\t\t\t\t * on the frontend's header name.\n\t\t\t\t */\n\t\t\t\tif (s->be->fwdfor_hdr_len) {\n\t\t\t\t\tlen = s->be->fwdfor_hdr_len;\n\t\t\t\t\tmemcpy(trash.str, s->be->fwdfor_hdr_name, len);\n\t\t\t\t} else {\n\t\t\t\t\tlen = s->fe->fwdfor_hdr_len;\n\t\t\t\t\tmemcpy(trash.str, s->fe->fwdfor_hdr_name, len);\n\t\t\t\t}\n\t\t\t\tlen += snprintf(trash.str + len, trash.size - len, \": %d.%d.%d.%d\", pn[0], pn[1], pn[2], pn[3]);",
"\t\t\t\tif (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))\n\t\t\t\t\tgoto return_bad_req;\n\t\t\t}\n\t\t}\n\t\telse if (cli_conn && cli_conn->addr.from.ss_family == AF_INET6) {\n\t\t\t/* FIXME: for the sake of completeness, we should also support\n\t\t\t * 'except' here, although it is mostly useless in this case.\n\t\t\t */\n\t\t\tint len;\n\t\t\tchar pn[INET6_ADDRSTRLEN];\n\t\t\tinet_ntop(AF_INET6,\n\t\t\t\t (const void *)&((struct sockaddr_in6 *)(&cli_conn->addr.from))->sin6_addr,\n\t\t\t\t pn, sizeof(pn));",
"\t\t\t/* Note: we rely on the backend to get the header name to be used for\n\t\t\t * x-forwarded-for, because the header is really meant for the backends.\n\t\t\t * However, if the backend did not specify any option, we have to rely\n\t\t\t * on the frontend's header name.\n\t\t\t */\n\t\t\tif (s->be->fwdfor_hdr_len) {\n\t\t\t\tlen = s->be->fwdfor_hdr_len;\n\t\t\t\tmemcpy(trash.str, s->be->fwdfor_hdr_name, len);\n\t\t\t} else {\n\t\t\t\tlen = s->fe->fwdfor_hdr_len;\n\t\t\t\tmemcpy(trash.str, s->fe->fwdfor_hdr_name, len);\n\t\t\t}\n\t\t\tlen += snprintf(trash.str + len, trash.size - len, \": %s\", pn);",
"\t\t\tif (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))\n\t\t\t\tgoto return_bad_req;\n\t\t}\n\t}",
"\t/*\n\t * 10: add X-Original-To if either the frontend or the backend\n\t * asks for it.\n\t */\n\tif ((s->fe->options | s->be->options) & PR_O_ORGTO) {",
"\t\t/* FIXME: don't know if IPv6 can handle that case too. */\n\t\tif (cli_conn && cli_conn->addr.from.ss_family == AF_INET) {\n\t\t\t/* Add an X-Original-To header unless the destination IP is\n\t\t\t * in the 'except' network range.\n\t\t\t */\n\t\t\tconn_get_to_addr(cli_conn);",
"\t\t\tif (cli_conn->addr.to.ss_family == AF_INET &&\n\t\t\t ((!s->fe->except_mask_to.s_addr ||\n\t\t\t (((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr.s_addr & s->fe->except_mask_to.s_addr)\n\t\t\t != s->fe->except_to.s_addr) &&\n\t\t\t (!s->be->except_mask_to.s_addr ||\n\t\t\t (((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr.s_addr & s->be->except_mask_to.s_addr)\n\t\t\t != s->be->except_to.s_addr))) {\n\t\t\t\tint len;\n\t\t\t\tunsigned char *pn;\n\t\t\t\tpn = (unsigned char *)&((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr;",
"\t\t\t\t/* Note: we rely on the backend to get the header name to be used for\n\t\t\t\t * x-original-to, because the header is really meant for the backends.\n\t\t\t\t * However, if the backend did not specify any option, we have to rely\n\t\t\t\t * on the frontend's header name.\n\t\t\t\t */\n\t\t\t\tif (s->be->orgto_hdr_len) {\n\t\t\t\t\tlen = s->be->orgto_hdr_len;\n\t\t\t\t\tmemcpy(trash.str, s->be->orgto_hdr_name, len);\n\t\t\t\t} else {\n\t\t\t\t\tlen = s->fe->orgto_hdr_len;\n\t\t\t\t\tmemcpy(trash.str, s->fe->orgto_hdr_name, len);\n\t\t\t\t}\n\t\t\t\tlen += snprintf(trash.str + len, trash.size - len, \": %d.%d.%d.%d\", pn[0], pn[1], pn[2], pn[3]);",
"\t\t\t\tif (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))\n\t\t\t\t\tgoto return_bad_req;\n\t\t\t}\n\t\t}\n\t}",
"\t/* 11: add \"Connection: close\" or \"Connection: keep-alive\" if needed and not yet set.\n\t * If an \"Upgrade\" token is found, the header is left untouched in order not to have\n\t * to deal with some servers bugs : some of them fail an Upgrade if anything but\n\t * \"Upgrade\" is present in the Connection header.\n\t */\n\tif (!(txn->flags & TX_HDR_CONN_UPG) &&\n\t (((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN) ||\n\t ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||\n\t (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL))) {\n\t\tunsigned int want_flags = 0;",
"\t\tif (msg->flags & HTTP_MSGF_VER_11) {\n\t\t\tif (((txn->flags & TX_CON_WANT_MSK) >= TX_CON_WANT_SCL ||\n\t\t\t ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||\n\t\t\t (s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)) &&\n\t\t\t !((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA))\n\t\t\t\twant_flags |= TX_CON_CLO_SET;\n\t\t} else {\n\t\t\tif (((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL &&\n\t\t\t ((s->fe->options & PR_O_HTTP_MODE) != PR_O_HTTP_PCL &&\n\t\t\t (s->be->options & PR_O_HTTP_MODE) != PR_O_HTTP_PCL)) ||\n\t\t\t ((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA))\n\t\t\t\twant_flags |= TX_CON_KAL_SET;\n\t\t}",
"\t\tif (want_flags != (txn->flags & (TX_CON_CLO_SET|TX_CON_KAL_SET)))\n\t\t\thttp_change_connection_header(txn, msg, want_flags);\n\t}",
"\n\t/* If we have no server assigned yet and we're balancing on url_param\n\t * with a POST request, we may be interested in checking the body for\n\t * that parameter. This will be done in another analyser.\n\t */\n\tif (!(s->flags & (SN_ASSIGNED|SN_DIRECT)) &&\n\t s->txn.meth == HTTP_METH_POST && s->be->url_param_name != NULL &&\n\t (msg->flags & (HTTP_MSGF_CNT_LEN|HTTP_MSGF_TE_CHNK))) {\n\t\tchannel_dont_connect(req);\n\t\treq->analysers |= AN_REQ_HTTP_BODY;\n\t}",
"\tif (msg->flags & HTTP_MSGF_XFER_LEN) {\n\t\treq->analysers |= AN_REQ_HTTP_XFER_BODY;\n#ifdef TCP_QUICKACK\n\t\t/* We expect some data from the client. Unless we know for sure\n\t\t * we already have a full request, we have to re-enable quick-ack\n\t\t * in case we previously disabled it, otherwise we might cause\n\t\t * the client to delay further data.\n\t\t */\n\t\tif ((s->listener->options & LI_O_NOQUICKACK) &&\n\t\t cli_conn && conn_ctrl_ready(cli_conn) &&\n\t\t ((msg->flags & HTTP_MSGF_TE_CHNK) ||\n\t\t (msg->body_len > req->buf->i - txn->req.eoh - 2)))\n\t\t\tsetsockopt(cli_conn->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));\n#endif\n\t}",
"\t/*************************************************************\n\t * OK, that's finished for the headers. We have done what we *\n\t * could. Let's switch to the DATA state. *\n\t ************************************************************/\n\treq->analyse_exp = TICK_ETERNITY;\n\treq->analysers &= ~an_bit;",
"\t/* if the server closes the connection, we want to immediately react\n\t * and close the socket to save packets and syscalls.\n\t */\n\tif (!(req->analysers & AN_REQ_HTTP_XFER_BODY))\n\t\treq->cons->flags |= SI_FL_NOHALF;",
"\ts->logs.tv_request = now;\n\t/* OK let's go on with the BODY now */\n\treturn 1;",
" return_bad_req: /* let's centralize all bad requests */\n\tif (unlikely(msg->msg_state == HTTP_MSG_ERROR) || msg->err_pos >= 0) {\n\t\t/* we detected a parsing error. We want to archive this request\n\t\t * in the dedicated proxy area for later troubleshooting.\n\t\t */\n\t\thttp_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);\n\t}",
"\ttxn->req.msg_state = HTTP_MSG_ERROR;\n\ttxn->status = 400;\n\treq->analysers = 0;\n\tstream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400));",
"\ts->fe->fe_counters.failed_req++;\n\tif (s->listener->counters)\n\t\ts->listener->counters->failed_req++;",
"\tif (!(s->flags & SN_ERR_MASK))\n\t\ts->flags |= SN_ERR_PRXCOND;\n\tif (!(s->flags & SN_FINST_MASK))\n\t\ts->flags |= SN_FINST_R;\n\treturn 0;\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2014-6269",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2014-6269/",
"CWE ID": "CWE-189",
"codeLink": "https://git.haproxy.org/?p=haproxy-1.5.git;a=commitdiff;h=b4d05093bc89f71377230228007e69a1434c1a0c",
"commit_id": "b4d05093bc89f71377230228007e69a1434c1a0c",
"commit_message": null,
"lang": "C",
"project": "haproxy"
}
| 10
|
Determine whether the code is vulnerable or not.
|
[
"void crypto_aes_encrypt_x86(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)\n{\n\taes_enc_blk(ctx, dst, src);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-7421",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-7421/",
"CWE ID": "CWE-264",
"codeLink": "https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b",
"commit_id": "5d26a105b5a73e5635eae0629b42fa0a90e07b7b",
"commit_message": "crypto: prefix module autoloading with \"crypto-\"\n\nThis prefixes all crypto module loading with \"crypto-\" so we never run\nthe risk of exposing module auto-loading to userspace via a crypto API,\nas demonstrated by Mathias Krause:\n\nhttps://lkml.org/lkml/2013/3/4/70\n\nSigned-off-by: Kees Cook <keescook@chromium.org>\nSigned-off-by: Herbert Xu <herbert@gondor.apana.org.au>",
"lang": "C",
"project": "linux"
}
| 11
|
Determine whether the code is vulnerable or not.
|
[
"error::Error GLES2DecoderPassthroughImpl::DoDeletePathsCHROMIUM(GLuint path,\n GLsizei range) {\n NOTIMPLEMENTED();\n return error::kNoError;\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-5219",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-5219/",
"CWE ID": "CWE-416",
"codeLink": "https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae",
"commit_id": "a4150b688a754d3d10d2ca385155b1c95d77d6ae",
"commit_message": "Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM\n\nThis makes the query of GL_COMPLETION_STATUS_KHR to programs much\ncheaper by minimizing the round-trip to the GPU thread.\n\nBug: 881152, 957001\nChange-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a\nReviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630\nCommit-Queue: Kenneth Russell <kbr@chromium.org>\nReviewed-by: Kentaro Hara <haraken@chromium.org>\nReviewed-by: Geoff Lang <geofflang@chromium.org>\nReviewed-by: Kenneth Russell <kbr@chromium.org>\nCr-Commit-Position: refs/heads/master@{#657568}",
"lang": "C",
"project": "Chrome"
}
| 12
|
Determine whether the code is vulnerable or not.
|
[
"void VideoCaptureImpl::OnBufferCreated(int32_t buffer_id,\n mojo::ScopedSharedBufferHandle handle) {\n DVLOG(1) << __func__ << \" buffer_id: \" << buffer_id;\n DCHECK(io_thread_checker_.CalledOnValidThread());\n DCHECK(handle.is_valid());\n \n base::SharedMemoryHandle memory_handle;\n size_t memory_size = 0;",
" bool read_only_flag = false;",
" \n const MojoResult result = mojo::UnwrapSharedMemoryHandle(",
" std::move(handle), &memory_handle, &memory_size, &read_only_flag);",
" DCHECK_EQ(MOJO_RESULT_OK, result);\n DCHECK_GT(memory_size, 0u);\n ",
"",
" std::unique_ptr<base::SharedMemory> shm(\n new base::SharedMemory(memory_handle, true /* read_only */));\n if (!shm->Map(memory_size)) {\n DLOG(ERROR) << \"OnBufferCreated: Map failed.\";\n return;\n }\n const bool inserted =\n client_buffers_\n .insert(std::make_pair(buffer_id,\n new ClientBuffer(std::move(shm), memory_size)))\n .second;\n DCHECK(inserted);\n}"
] |
[
1,
0,
1,
0,
1,
0,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-6063",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-6063/",
"CWE ID": "CWE-787",
"codeLink": "https://github.com/chromium/chromium/commit/673ce95d481ea9368c4d4d43ac756ba1d6d9e608",
"commit_id": "673ce95d481ea9368c4d4d43ac756ba1d6d9e608",
"commit_message": "Correct mojo::WrapSharedMemoryHandle usage\n\nFixes some incorrect uses of mojo::WrapSharedMemoryHandle which\nwere assuming that the call actually has any control over the memory\nprotection applied to a handle when mapped.\n\nWhere fixing usage is infeasible for this CL, TODOs are added to\nannotate follow-up work.\n\nAlso updates the API and documentation to (hopefully) improve clarity\nand avoid similar mistakes from being made in the future.\n\nBUG=792900\n\nCq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel\nChange-Id: I0578aaa9ca3bfcb01aaf2451315d1ede95458477\nReviewed-on: https://chromium-review.googlesource.com/818282\nReviewed-by: Wei Li <weili@chromium.org>\nReviewed-by: Lei Zhang <thestig@chromium.org>\nReviewed-by: John Abd-El-Malek <jam@chromium.org>\nReviewed-by: Daniel Cheng <dcheng@chromium.org>\nReviewed-by: Sadrul Chowdhury <sadrul@chromium.org>\nReviewed-by: Yuzhu Shen <yzshen@chromium.org>\nReviewed-by: Robert Sesek <rsesek@chromium.org>\nCommit-Queue: Ken Rockot <rockot@chromium.org>\nCr-Commit-Position: refs/heads/master@{#530268}",
"lang": "C",
"project": "Chrome"
}
| 13
|
Determine whether the code is vulnerable or not.
|
[
"void VideoCaptureImpl::OnBufferCreated(int32_t buffer_id,\n mojo::ScopedSharedBufferHandle handle) {\n DVLOG(1) << __func__ << \" buffer_id: \" << buffer_id;\n DCHECK(io_thread_checker_.CalledOnValidThread());\n DCHECK(handle.is_valid());\n \n base::SharedMemoryHandle memory_handle;\n size_t memory_size = 0;",
" mojo::UnwrappedSharedMemoryHandleProtection protection;",
" \n const MojoResult result = mojo::UnwrapSharedMemoryHandle(",
" std::move(handle), &memory_handle, &memory_size, &protection);",
" DCHECK_EQ(MOJO_RESULT_OK, result);\n DCHECK_GT(memory_size, 0u);\n ",
" // TODO(https://crbug.com/803136): We should also be able to assert that the\n // unwrapped handle was shared for read-only mapping. That condition is not\n // currently guaranteed to be met.\n",
" std::unique_ptr<base::SharedMemory> shm(\n new base::SharedMemory(memory_handle, true /* read_only */));\n if (!shm->Map(memory_size)) {\n DLOG(ERROR) << \"OnBufferCreated: Map failed.\";\n return;\n }\n const bool inserted =\n client_buffers_\n .insert(std::make_pair(buffer_id,\n new ClientBuffer(std::move(shm), memory_size)))\n .second;\n DCHECK(inserted);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-6063",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-6063/",
"CWE ID": "CWE-787",
"codeLink": "https://github.com/chromium/chromium/commit/673ce95d481ea9368c4d4d43ac756ba1d6d9e608",
"commit_id": "673ce95d481ea9368c4d4d43ac756ba1d6d9e608",
"commit_message": "Correct mojo::WrapSharedMemoryHandle usage\n\nFixes some incorrect uses of mojo::WrapSharedMemoryHandle which\nwere assuming that the call actually has any control over the memory\nprotection applied to a handle when mapped.\n\nWhere fixing usage is infeasible for this CL, TODOs are added to\nannotate follow-up work.\n\nAlso updates the API and documentation to (hopefully) improve clarity\nand avoid similar mistakes from being made in the future.\n\nBUG=792900\n\nCq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel\nChange-Id: I0578aaa9ca3bfcb01aaf2451315d1ede95458477\nReviewed-on: https://chromium-review.googlesource.com/818282\nReviewed-by: Wei Li <weili@chromium.org>\nReviewed-by: Lei Zhang <thestig@chromium.org>\nReviewed-by: John Abd-El-Malek <jam@chromium.org>\nReviewed-by: Daniel Cheng <dcheng@chromium.org>\nReviewed-by: Sadrul Chowdhury <sadrul@chromium.org>\nReviewed-by: Yuzhu Shen <yzshen@chromium.org>\nReviewed-by: Robert Sesek <rsesek@chromium.org>\nCommit-Queue: Ken Rockot <rockot@chromium.org>\nCr-Commit-Position: refs/heads/master@{#530268}",
"lang": "C",
"project": "Chrome"
}
| 13
|
Determine whether the code is vulnerable or not.
|
[
"void FFmpegVideoDecodeEngine::DecodeFrame(scoped_refptr<Buffer> buffer) {\n scoped_refptr<VideoFrame> video_frame;",
" AVPacket packet;\n av_init_packet(&packet);\n packet.data = const_cast<uint8*>(buffer->GetData());\n packet.size = buffer->GetDataSize();",
" PipelineStatistics statistics;\n statistics.video_bytes_decoded = buffer->GetDataSize();",
" codec_context_->reordered_opaque = buffer->GetTimestamp().InMicroseconds();",
" av_frame_->reordered_opaque = codec_context_->reordered_opaque;",
" int frame_decoded = 0;\n int result = avcodec_decode_video2(codec_context_,\n av_frame_.get(),\n &frame_decoded,\n &packet);",
" if (result < 0) {\n LOG(ERROR) << \"Error decoding a video frame with timestamp: \"\n << buffer->GetTimestamp().InMicroseconds() << \" us, duration: \"\n << buffer->GetDuration().InMicroseconds() << \" us, packet size: \"\n << buffer->GetDataSize() << \" bytes\";\n event_handler_->OnError();\n return;\n }",
" if (frame_decoded == 0) {\n if (buffer->IsEndOfStream()) { // We had started flushing.\n event_handler_->ConsumeVideoFrame(video_frame, statistics);\n output_eos_reached_ = true;\n } else {\n ReadInput();\n }\n return;\n }",
" if (!av_frame_->data[VideoFrame::kYPlane] ||\n !av_frame_->data[VideoFrame::kUPlane] ||\n !av_frame_->data[VideoFrame::kVPlane]) {\n event_handler_->OnError();\n return;\n }",
" DCHECK_LE(av_frame_->repeat_pict, 2); // Sanity check.\n AVRational doubled_time_base;\n doubled_time_base.num = frame_rate_denominator_;\n doubled_time_base.den = frame_rate_numerator_ * 2;",
" base::TimeDelta timestamp =\n base::TimeDelta::FromMicroseconds(av_frame_->reordered_opaque);\n base::TimeDelta duration =\n ConvertFromTimeBase(doubled_time_base, 2 + av_frame_->repeat_pict);",
" DCHECK(frame_queue_available_.size());\n video_frame = frame_queue_available_.front();\n frame_queue_available_.pop_front();",
" size_t height = codec_context_->height;\n CopyPlane(VideoFrame::kYPlane, video_frame.get(), av_frame_.get(), height);\n CopyPlane(VideoFrame::kUPlane, video_frame.get(), av_frame_.get(), height);\n CopyPlane(VideoFrame::kVPlane, video_frame.get(), av_frame_.get(), height);",
" video_frame->SetTimestamp(timestamp);\n video_frame->SetDuration(duration);",
" pending_output_buffers_--;\n event_handler_->ConsumeVideoFrame(video_frame, statistics);\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-2843",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-2843/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/d304b5ec1b16766ea2cb552a27dc14df848d6a0e",
"commit_id": "d304b5ec1b16766ea2cb552a27dc14df848d6a0e",
"commit_message": "Don't forget the ffmpeg input buffer padding when allocating a codec's\nextradata buffer.\n\nBUG=82438\nReview URL: http://codereview.chromium.org/7137002\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@88354 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 14
|
Determine whether the code is vulnerable or not.
|
[
"void Performance::BuildJSONValue(V8ObjectBuilder& builder) const {\n builder.AddNumber(\"timeOrigin\", timeOrigin());\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-6159",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-6159/",
"CWE ID": "CWE-200",
"codeLink": "https://github.com/chromium/chromium/commit/01b42e2bc2aac531b17596729ae4e5c223ae7124",
"commit_id": "01b42e2bc2aac531b17596729ae4e5c223ae7124",
"commit_message": "Fix timing allow check algorithm for service workers\n\nThis CL uses the OriginalURLViaServiceWorker() in the timing allow check\nalgorithm if the response WasFetchedViaServiceWorker(). This way, if a\nservice worker changes a same origin request to become cross origin,\nthen the timing allow check algorithm will still fail.\n\nresource-timing-worker.js is changed so it avoids an empty Response,\nwhich is an odd case in terms of same origin checks.\n\nBug: 837275\nChange-Id: I7e497a6fcc2ee14244121b915ca5f5cceded417a\nReviewed-on: https://chromium-review.googlesource.com/1038229\nCommit-Queue: Nicolás Peña Moreno <npm@chromium.org>\nReviewed-by: Yoav Weiss <yoav@yoav.ws>\nReviewed-by: Timothy Dresser <tdresser@chromium.org>\nCr-Commit-Position: refs/heads/master@{#555476}",
"lang": "C",
"project": "Chrome"
}
| 15
|
Determine whether the code is vulnerable or not.
|
[
"void RenderView::OnRedo() {\n if (!webview())\n return;",
" webview()->focusedFrame()->executeCommand(WebString::fromUTF8(\"Redo\"));\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-2861",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-2861/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/chromium/chromium/commit/8262245d384be025f13e2a5b3a03b7e5c98374ce",
"commit_id": "8262245d384be025f13e2a5b3a03b7e5c98374ce",
"commit_message": "DevTools: move DevToolsAgent/Client into content.\n\nBUG=84078\nTEST=\n\nReview URL: http://codereview.chromium.org/7461019\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@93596 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 16
|
Determine whether the code is vulnerable or not.
|
[
"void RenderWidgetHostImpl::AddMouseEventCallback(\n const MouseEventCallback& callback) {\n mouse_event_callbacks_.push_back(callback);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-1647",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-1647/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/e5787005a9004d7be289cc649c6ae4f3051996cd",
"commit_id": "e5787005a9004d7be289cc649c6ae4f3051996cd",
"commit_message": "Check that RWHI isn't deleted manually while owned by a scoped_ptr in RVHI\n\nBUG=590284\n\nReview URL: https://codereview.chromium.org/1747183002\n\nCr-Commit-Position: refs/heads/master@{#378844}",
"lang": "C",
"project": "Chrome"
}
| 17
|
Determine whether the code is vulnerable or not.
|
[
"void HTMLFormControlElement::didChangeForm() {\n ListedElement::didChangeForm();\n formOwnerSetNeedsValidityCheck();\n if (formOwner() && isConnected() && canBeSuccessfulSubmitButton())\n formOwner()->invalidateDefaultButtonStyle();\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-5016",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-5016/",
"CWE ID": "CWE-1021",
"codeLink": "https://github.com/chromium/chromium/commit/a8e17a3031b6ad69c399e5e04dd0084e577097fc",
"commit_id": "a8e17a3031b6ad69c399e5e04dd0084e577097fc",
"commit_message": "Form validation: Do not show validation bubble if the page is invisible.\n\nBUG=673163\n\nReview-Url: https://codereview.chromium.org/2572813003\nCr-Commit-Position: refs/heads/master@{#438476}",
"lang": "C",
"project": "Chrome"
}
| 18
|
Determine whether the code is vulnerable or not.
|
[
"IMPEG2D_ERROR_CODES_T impeg2d_pre_pic_dec_proc(dec_state_t *ps_dec)\n{\n WORD32 u4_get_disp;\n pic_buf_t *ps_disp_pic;\n IMPEG2D_ERROR_CODES_T e_error = (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE;",
" u4_get_disp = 0;\n ps_disp_pic = NULL;",
" /* Field Picture */\n if(ps_dec->u2_picture_structure != FRAME_PICTURE)\n {\n ps_dec->u2_num_vert_mb = (ps_dec->u2_vertical_size + 31) >> 5;",
" if(ps_dec->u2_num_flds_decoded == 0)\n {\n pic_buf_t *ps_pic_buf;\n u4_get_disp = 1;",
" ps_pic_buf = impeg2_buf_mgr_get_next_free(ps_dec->pv_pic_buf_mg, &ps_dec->i4_cur_buf_id);",
" if (NULL == ps_pic_buf)\n {\n return IMPEG2D_NO_FREE_BUF_ERR;\n }",
" impeg2_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_pic_buf_mg, ps_dec->i4_cur_buf_id, BUF_MGR_DISP);\n impeg2_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_pic_buf_mg, ps_dec->i4_cur_buf_id, BUF_MGR_REF);",
" ps_pic_buf->u4_ts = ps_dec->u4_inp_ts;\n ps_pic_buf->e_pic_type = ps_dec->e_pic_type;\n ps_dec->ps_cur_pic = ps_pic_buf;\n ps_dec->s_cur_frm_buf.pu1_y = ps_pic_buf->pu1_y;\n ps_dec->s_cur_frm_buf.pu1_u = ps_pic_buf->pu1_u;\n ps_dec->s_cur_frm_buf.pu1_v = ps_pic_buf->pu1_v;\n }",
" if(ps_dec->u2_picture_structure == TOP_FIELD)\n {\n ps_dec->u2_fld_parity = TOP;\n }\n else\n {\n ps_dec->u2_fld_parity = BOTTOM;\n }\n ps_dec->u2_field_dct = 0;\n ps_dec->u2_read_dct_type = 0;\n ps_dec->u2_read_motion_type = 1;\n ps_dec->u2_fld_pic = 1;\n ps_dec->u2_frm_pic = 0;\n ps_dec->ps_func_forw_or_back = gas_impeg2d_func_fld_fw_or_bk;\n ps_dec->ps_func_bi_direct = gas_impeg2d_func_fld_bi_direct;\n }\n /* Frame Picture */\n else\n {\n pic_buf_t *ps_pic_buf;",
"\n ps_dec->u2_num_vert_mb = (ps_dec->u2_vertical_size + 15) >> 4;\n u4_get_disp = 1;\n ps_pic_buf = impeg2_buf_mgr_get_next_free(ps_dec->pv_pic_buf_mg, &ps_dec->i4_cur_buf_id);",
" if (NULL == ps_pic_buf)\n {\n return IMPEG2D_NO_FREE_BUF_ERR;\n }\n impeg2_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_pic_buf_mg, ps_dec->i4_cur_buf_id, BUF_MGR_DISP);\n impeg2_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_pic_buf_mg, ps_dec->i4_cur_buf_id, BUF_MGR_REF);",
" ps_pic_buf->u4_ts = ps_dec->u4_inp_ts;\n ps_pic_buf->e_pic_type = ps_dec->e_pic_type;\n ps_dec->ps_cur_pic = ps_pic_buf;\n ps_dec->s_cur_frm_buf.pu1_y = ps_pic_buf->pu1_y;\n ps_dec->s_cur_frm_buf.pu1_u = ps_pic_buf->pu1_u;\n ps_dec->s_cur_frm_buf.pu1_v = ps_pic_buf->pu1_v;",
"\n if(ps_dec->u2_frame_pred_frame_dct == 0)\n {\n ps_dec->u2_read_dct_type = 1;\n ps_dec->u2_read_motion_type = 1;\n }\n else\n {\n ps_dec->u2_read_dct_type = 0;\n ps_dec->u2_read_motion_type = 0;\n ps_dec->u2_motion_type = 2;\n ps_dec->u2_field_dct = 0;\n }",
" ps_dec->u2_fld_parity = TOP;\n ps_dec->u2_fld_pic = 0;\n ps_dec->u2_frm_pic = 1;\n ps_dec->ps_func_forw_or_back = gas_impeg2d_func_frm_fw_or_bk;\n ps_dec->ps_func_bi_direct = gas_impeg2d_func_frm_bi_direct;\n }\n ps_dec->u2_def_dc_pred[Y_LUMA] = 128 << ps_dec->u2_intra_dc_precision;\n ps_dec->u2_def_dc_pred[U_CHROMA] = 128 << ps_dec->u2_intra_dc_precision;\n ps_dec->u2_def_dc_pred[V_CHROMA] = 128 << ps_dec->u2_intra_dc_precision;\n ps_dec->u2_num_mbs_left = ps_dec->u2_num_horiz_mb * ps_dec->u2_num_vert_mb;\n if(u4_get_disp)\n {\n if(ps_dec->u4_num_frames_decoded > 1)\n {\n ps_disp_pic = impeg2_disp_mgr_get(&ps_dec->s_disp_mgr, &ps_dec->i4_disp_buf_id);\n }\n ps_dec->ps_disp_pic = ps_disp_pic;\n if(ps_disp_pic)\n {\n if(1 == ps_dec->u4_share_disp_buf)\n {\n ps_dec->ps_disp_frm_buf->pv_y_buf = ps_disp_pic->pu1_y;\n if(IV_YUV_420P == ps_dec->i4_chromaFormat)\n {\n ps_dec->ps_disp_frm_buf->pv_u_buf = ps_disp_pic->pu1_u;\n ps_dec->ps_disp_frm_buf->pv_v_buf = ps_disp_pic->pu1_v;\n }\n else\n {\n UWORD8 *pu1_buf;",
" pu1_buf = ps_dec->as_disp_buffers[ps_disp_pic->i4_buf_id].pu1_bufs[1];\n ps_dec->ps_disp_frm_buf->pv_u_buf = pu1_buf;",
" pu1_buf = ps_dec->as_disp_buffers[ps_disp_pic->i4_buf_id].pu1_bufs[2];\n ps_dec->ps_disp_frm_buf->pv_v_buf = pu1_buf;\n }\n }\n }\n }",
"\n switch(ps_dec->e_pic_type)\n {\n case I_PIC:\n {\n ps_dec->pf_decode_slice = impeg2d_dec_i_slice;\n break;\n }\n case D_PIC:\n {\n ps_dec->pf_decode_slice = impeg2d_dec_d_slice;\n break;\n }\n case P_PIC:\n {\n ps_dec->pf_decode_slice = impeg2d_dec_p_b_slice;\n ps_dec->pu2_mb_type = gau2_impeg2d_p_mb_type;\n break;\n }\n case B_PIC:\n {\n ps_dec->pf_decode_slice = impeg2d_dec_p_b_slice;\n ps_dec->pu2_mb_type = gau2_impeg2d_b_mb_type;\n break;\n }\n default:\n return IMPEG2D_INVALID_PIC_TYPE;\n }",
" /*************************************************************************/\n /* Set the reference pictures */\n /*************************************************************************/",
" /* Error resilience: If forward and backward pictures are going to be NULL*/\n /* then assign both to the current */\n /* if one of them NULL then we will assign the non null to the NULL one */",
" if(ps_dec->e_pic_type == P_PIC)\n {\n if (NULL == ps_dec->as_recent_fld[1][0].pu1_y)\n {\n ps_dec->as_recent_fld[1][0] = ps_dec->s_cur_frm_buf;\n }\n if (NULL == ps_dec->as_recent_fld[1][1].pu1_y)\n {\n impeg2d_get_bottom_field_buf(&ps_dec->s_cur_frm_buf, &ps_dec->as_recent_fld[1][1],\n ps_dec->u2_frame_width);\n }",
" ps_dec->as_ref_buf[FORW][TOP] = ps_dec->as_recent_fld[1][0];\n ps_dec->as_ref_buf[FORW][BOTTOM] = ps_dec->as_recent_fld[1][1];",
"\n }\n else if(ps_dec->e_pic_type == B_PIC)\n {\n if((NULL == ps_dec->as_recent_fld[1][0].pu1_y) && (NULL == ps_dec->as_recent_fld[0][0].pu1_y))\n {\n ps_dec->as_recent_fld[1][0] = ps_dec->s_cur_frm_buf;\n impeg2d_get_bottom_field_buf(&ps_dec->s_cur_frm_buf, &ps_dec->as_recent_fld[1][1],\n ps_dec->u2_frame_width);\n ps_dec->as_recent_fld[0][0] = ps_dec->s_cur_frm_buf;\n ps_dec->as_recent_fld[0][1] = ps_dec->as_recent_fld[1][1];\n }\n else if ((NULL != ps_dec->as_recent_fld[1][0].pu1_y) && (NULL == ps_dec->as_recent_fld[0][0].pu1_y))\n {\n ps_dec->as_recent_fld[0][0] = ps_dec->as_recent_fld[1][0];\n ps_dec->as_recent_fld[0][1] = ps_dec->as_recent_fld[1][1];\n }\n else if ((NULL == ps_dec->as_recent_fld[1][0].pu1_y) && (NULL != ps_dec->as_recent_fld[0][0].pu1_y))\n {\n ps_dec->as_recent_fld[1][0] = ps_dec->as_recent_fld[0][0];\n ps_dec->as_recent_fld[1][1] = ps_dec->as_recent_fld[0][1];\n }",
" ps_dec->as_ref_buf[FORW][TOP] = ps_dec->as_recent_fld[0][0];\n ps_dec->as_ref_buf[FORW][BOTTOM] = ps_dec->as_recent_fld[0][1];\n ps_dec->as_ref_buf[BACK][TOP] = ps_dec->as_recent_fld[1][0];\n ps_dec->as_ref_buf[BACK][BOTTOM] = ps_dec->as_recent_fld[1][1];",
"\n }",
" return e_error;\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-0824",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-0824/",
"CWE ID": "CWE-254",
"codeLink": "https://android.googlesource.com/platform/external/libmpeg2/+/ffab15eb80630dc799eb410855c93525b75233c3",
"commit_id": "ffab15eb80630dc799eb410855c93525b75233c3",
"commit_message": "Fixed bit stream access to make sure that it is not read beyond the allocated size.\n\nBug: 25765591\n\nChange-Id: I98c23a3c3f84f6710f29bffe5ed73adcf51d47f6\n",
"lang": "C",
"project": "Android"
}
| 19
|
Determine whether the code is vulnerable or not.
|
[
"static void tg3_remove_one(struct pci_dev *pdev)\n{\n\tstruct net_device *dev = pci_get_drvdata(pdev);",
"\tif (dev) {\n\t\tstruct tg3 *tp = netdev_priv(dev);",
"\t\trelease_firmware(tp->fw);",
"\t\ttg3_reset_task_cancel(tp);",
"\t\tif (tg3_flag(tp, USE_PHYLIB)) {\n\t\t\ttg3_phy_fini(tp);\n\t\t\ttg3_mdio_fini(tp);\n\t\t}",
"\t\tunregister_netdev(dev);\n\t\tif (tp->aperegs) {\n\t\t\tiounmap(tp->aperegs);\n\t\t\ttp->aperegs = NULL;\n\t\t}\n\t\tif (tp->regs) {\n\t\t\tiounmap(tp->regs);\n\t\t\ttp->regs = NULL;\n\t\t}\n\t\tfree_netdev(dev);\n\t\tpci_release_regions(pdev);\n\t\tpci_disable_device(pdev);\n\t\tpci_set_drvdata(pdev, NULL);\n\t}\n}\n"
] |
[
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-1929",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-1929/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/torvalds/linux/commit/715230a44310a8cf66fbfb5a46f9a62a9b2de424",
"commit_id": "715230a44310a8cf66fbfb5a46f9a62a9b2de424",
"commit_message": "tg3: fix length overflow in VPD firmware parsing\n\nCommit 184b89044fb6e2a74611dafa69b1dce0d98612c6 (\"tg3: Use VPD fw version\nwhen present\") introduced VPD parsing that contained a potential length\noverflow.\n\nLimit the hardware's reported firmware string length (max 255 bytes) to\nstay inside the driver's firmware string length (32 bytes). On overflow,\ntruncate the formatted firmware string instead of potentially overwriting\nportions of the tg3 struct.\n\nhttp://cansecwest.com/slides/2013/PrivateCore%20CSW%202013.pdf\n\nSigned-off-by: Kees Cook <keescook@chromium.org>\nReported-by: Oded Horovitz <oded@privatecore.com>\nReported-by: Brad Spengler <spender@grsecurity.net>\nCc: stable@vger.kernel.org\nCc: Matt Carlson <mcarlson@broadcom.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
"lang": "C",
"project": "linux"
}
| 20
|
Determine whether the code is vulnerable or not.
|
[
"void *Type_LUT16_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)\n{\n cmsUInt8Number InputChannels, OutputChannels, CLUTpoints;\n cmsPipeline* NewLUT = NULL;\n cmsUInt32Number nTabSize;\n cmsFloat64Number Matrix[3*3];\n cmsUInt16Number InputEntries, OutputEntries;",
" *nItems = 0;",
" if (!_cmsReadUInt8Number(io, &InputChannels)) return NULL;\n if (!_cmsReadUInt8Number(io, &OutputChannels)) return NULL;\n if (!_cmsReadUInt8Number(io, &CLUTpoints)) return NULL; // 255 maximum",
" if (!_cmsReadUInt8Number(io, NULL)) return NULL;",
" if (InputChannels > cmsMAXCHANNELS) goto Error;\n if (OutputChannels > cmsMAXCHANNELS) goto Error;",
" NewLUT = cmsPipelineAlloc(self ->ContextID, InputChannels, OutputChannels);\n if (NewLUT == NULL) goto Error;",
" if (!_cmsRead15Fixed16Number(io, &Matrix[0])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[1])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[2])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[3])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[4])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[5])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[6])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[7])) goto Error;\n if (!_cmsRead15Fixed16Number(io, &Matrix[8])) goto Error;",
"\n if ((InputChannels == 3) && !_cmsMAT3isIdentity((cmsMAT3*) Matrix)) {",
" if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, cmsStageAllocMatrix(self ->ContextID, 3, 3, Matrix, NULL)))\n goto Error;\n }",
" if (!_cmsReadUInt16Number(io, &InputEntries)) goto Error;\n if (!_cmsReadUInt16Number(io, &OutputEntries)) goto Error;",
" if (InputEntries > 0x7FFF || OutputEntries > 0x7FFF) goto Error;\n if (CLUTpoints == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least",
" if (!Read16bitTables(self ->ContextID, io, NewLUT, InputChannels, InputEntries)) goto Error;",
" nTabSize = uipow(OutputChannels, CLUTpoints, InputChannels);\n if (nTabSize == (cmsUInt32Number) -1) goto Error;\n if (nTabSize > 0) {",
" cmsUInt16Number *T;",
" T = (cmsUInt16Number*) _cmsCalloc(self ->ContextID, nTabSize, sizeof(cmsUInt16Number));\n if (T == NULL) goto Error;",
" if (!_cmsReadUInt16Array(io, nTabSize, T)) {\n _cmsFree(self ->ContextID, T);\n goto Error;\n }",
" if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, cmsStageAllocCLut16bit(self ->ContextID, CLUTpoints, InputChannels, OutputChannels, T))) {\n _cmsFree(self ->ContextID, T);\n goto Error;\n }\n _cmsFree(self ->ContextID, T);\n }",
"\n if (!Read16bitTables(self ->ContextID, io, NewLUT, OutputChannels, OutputEntries)) goto Error;",
" *nItems = 1;\n return NewLUT;",
"Error:\n if (NewLUT != NULL) cmsPipelineFree(NewLUT);\n return NULL;",
" cmsUNUSED_PARAMETER(SizeOfTag);\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-10165",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-10165/",
"CWE ID": "CWE-125",
"codeLink": "https://github.com/mm2/Little-CMS/commit/5ca71a7bc18b6897ab21d815d15e218e204581e2",
"commit_id": "5ca71a7bc18b6897ab21d815d15e218e204581e2",
"commit_message": "Added an extra check to MLU bounds\n\nThanks to Ibrahim el-sayed for spotting the bug",
"lang": "C",
"project": "Little-CMS"
}
| 21
|
Determine whether the code is vulnerable or not.
|
[
"static int start_audio_datapath(struct a2dp_stream_common *common)\n{\n INFO(\"state %d\", common->state);",
" if (common->ctrl_fd == AUDIO_SKT_DISCONNECTED) {\n INFO(\"%s AUDIO_SKT_DISCONNECTED\", __func__);\n return -1;\n }",
" int oldstate = common->state;\n common->state = AUDIO_A2DP_STATE_STARTING;",
" int a2dp_status = a2dp_command(common, A2DP_CTRL_CMD_START);\n if (a2dp_status < 0)\n {\n ERROR(\"%s Audiopath start failed (status %d)\", __func__, a2dp_status);",
" common->state = oldstate;\n return -1;\n }\n else if (a2dp_status == A2DP_CTRL_ACK_INCALL_FAILURE)\n {\n ERROR(\"%s Audiopath start failed - in call, move to suspended\", __func__);\n common->state = oldstate;\n return -1;\n }",
" /* connect socket if not yet connected */\n if (common->audio_fd == AUDIO_SKT_DISCONNECTED)\n {\n common->audio_fd = skt_connect(A2DP_DATA_PATH, common->buffer_sz);\n if (common->audio_fd < 0)\n {\n common->state = oldstate;\n return -1;\n }",
" common->state = AUDIO_A2DP_STATE_STARTED;\n }",
" return 0;\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-3839",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-3839/",
"CWE ID": "CWE-284",
"codeLink": "https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c",
"commit_id": "472271b153c5dc53c28beac55480a8d8434b2d5c",
"commit_message": "DO NOT MERGE Fix potential DoS caused by delivering signal to BT process\n\nBug: 28885210\nChange-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360\n\n Conflicts:\n\tbtif/co/bta_hh_co.c\n\tbtif/src/btif_core.c\nMerge conflict resolution of ag/1161415 (referencing ag/1164670)\n- Directly into mnc-mr2-release\n",
"lang": "C",
"project": "Android"
}
| 22
|
Determine whether the code is vulnerable or not.
|
[
"UpdateTouchesForGrab(DeviceIntPtr mouse)\n{\n int i;",
" if (!mouse->touch || mouse->deviceGrab.fromPassiveGrab)\n return;",
" for (i = 0; i < mouse->touch->num_touches; i++) {\n TouchPointInfoPtr ti = mouse->touch->touches + i;\n TouchListener *listener = &ti->listeners[0];\n GrabPtr grab = mouse->deviceGrab.grab;",
" if (ti->active &&\n CLIENT_BITS(listener->listener) == grab->resource) {\n listener->listener = grab->resource;\n listener->level = grab->grabtype;\n listener->state = LISTENER_IS_OWNER;\n listener->window = grab->window;",
" if (grab->grabtype == CORE || grab->grabtype == XI ||\n !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin))\n listener->type = LISTENER_POINTER_GRAB;\n else\n listener->type = LISTENER_GRAB;\n if (listener->grab)\n FreeGrab(listener->grab);\n listener->grab = AllocGrab(grab);\n }\n }\n}\n"
] |
[
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-10971",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-10971/",
"CWE ID": "CWE-119",
"codeLink": "https://cgit.freedesktop.org/xorg/xserver/commit/?id=215f894965df5fb0bb45b107d84524e700d2073c",
"commit_id": "215f894965df5fb0bb45b107d84524e700d2073c",
"commit_message": null,
"lang": "C",
"project": "xserver"
}
| 23
|
Determine whether the code is vulnerable or not.
|
[
" virtual ResourceContext* GetResourceContext() {\n return context_;\n }\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0910",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0910/",
"CWE ID": "CWE-287",
"codeLink": "https://github.com/chromium/chromium/commit/ac8bd041b81e46e4e4fcd5021aaa5499703952e6",
"commit_id": "ac8bd041b81e46e4e4fcd5021aaa5499703952e6",
"commit_message": "Follow-on fixes and naming changes for https://codereview.chromium.org/12086077/\n\nBUG=172573\nReview URL: https://codereview.chromium.org/12177018\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@180600 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 24
|
Determine whether the code is vulnerable or not.
|
[
"static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,\n const ImageInfo *image_info,Image *image)\n{\n char\n s[2];",
" char\n im_vers[32],\n libpng_runv[32],\n libpng_vers[32],\n zlib_runv[32],\n zlib_vers[32];",
" const char\n *name,\n *property,\n *value;",
" const StringInfo\n *profile;",
" int\n num_passes,\n pass,\n ping_wrote_caNv;",
" png_byte\n ping_trans_alpha[256];",
" png_color\n palette[257];",
" png_color_16\n ping_background,\n ping_trans_color;",
" png_info\n *ping_info;",
" png_struct\n *ping;",
" png_uint_32\n ping_height,\n ping_width;",
" ssize_t\n y;",
" MagickBooleanType\n image_matte,\n logging,\n matte,",
" ping_have_blob,\n ping_have_cheap_transparency,\n ping_have_color,\n ping_have_non_bw,\n ping_have_PLTE,\n ping_have_bKGD,\n ping_have_eXIf,\n ping_have_iCCP,\n ping_have_pHYs,\n ping_have_sRGB,\n ping_have_tRNS,",
" ping_exclude_bKGD,\n ping_exclude_cHRM,\n ping_exclude_date,\n /* ping_exclude_EXIF, */\n ping_exclude_eXIf,\n ping_exclude_gAMA,\n ping_exclude_iCCP,\n /* ping_exclude_iTXt, */\n ping_exclude_oFFs,\n ping_exclude_pHYs,\n ping_exclude_sRGB,\n ping_exclude_tEXt,\n ping_exclude_tIME,\n /* ping_exclude_tRNS, */\n ping_exclude_caNv,\n ping_exclude_zCCP, /* hex-encoded iCCP */\n ping_exclude_zTXt,",
" ping_preserve_colormap,\n ping_preserve_iCCP,\n ping_need_colortype_warning,",
" status,\n tried_332,\n tried_333,\n tried_444;",
" MemoryInfo\n *volatile pixel_info;",
" QuantumInfo\n *quantum_info;",
" register ssize_t\n i,\n x;",
" unsigned char\n *ping_pixels;",
" volatile int\n image_colors,\n ping_bit_depth,\n ping_color_type,\n ping_interlace_method,\n ping_compression_method,\n ping_filter_method,\n ping_num_trans;",
" volatile size_t\n image_depth,\n old_bit_depth;",
" size_t\n quality,\n rowbytes,\n save_image_depth;",
" int\n j,\n number_colors,\n number_opaque,\n number_semitransparent,\n number_transparent,\n ping_pHYs_unit_type;",
" png_uint_32\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution;",
" logging=LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter WriteOnePNGImage()\");",
" /* Define these outside of the following \"if logging()\" block so they will\n * show in debuggers.\n */\n *im_vers='\\0';\n (void) ConcatenateMagickString(im_vers,\n MagickLibVersionText,MaxTextExtent);\n (void) ConcatenateMagickString(im_vers,\n MagickLibAddendum,MaxTextExtent);",
" *libpng_vers='\\0';\n (void) ConcatenateMagickString(libpng_vers,\n PNG_LIBPNG_VER_STRING,32);\n *libpng_runv='\\0';\n (void) ConcatenateMagickString(libpng_runv,\n png_get_libpng_ver(NULL),32);",
" *zlib_vers='\\0';\n (void) ConcatenateMagickString(zlib_vers,\n ZLIB_VERSION,32);\n *zlib_runv='\\0';\n (void) ConcatenateMagickString(zlib_runv,\n zlib_version,32);",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" IM version = %s\", im_vers);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Libpng version = %s\", libpng_vers);\n if (LocaleCompare(libpng_vers,libpng_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" running with %s\", libpng_runv);\n }\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Zlib version = %s\", zlib_vers);\n if (LocaleCompare(zlib_vers,zlib_runv) != 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" running with %s\", zlib_runv);\n }\n }",
" /* Initialize some stuff */\n ping_bit_depth=0,\n ping_color_type=0,\n ping_interlace_method=0,\n ping_compression_method=0,\n ping_filter_method=0,\n ping_num_trans = 0;",
" ping_background.red = 0;\n ping_background.green = 0;\n ping_background.blue = 0;\n ping_background.gray = 0;\n ping_background.index = 0;",
" ping_trans_color.red=0;\n ping_trans_color.green=0;\n ping_trans_color.blue=0;\n ping_trans_color.gray=0;",
" ping_pHYs_unit_type = 0;\n ping_pHYs_x_resolution = 0;\n ping_pHYs_y_resolution = 0;",
" ping_have_blob=MagickFalse;\n ping_have_cheap_transparency=MagickFalse;\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n ping_have_PLTE=MagickFalse;\n ping_have_bKGD=MagickFalse;\n ping_have_eXIf=MagickTrue;\n ping_have_iCCP=MagickFalse;\n ping_have_pHYs=MagickFalse;\n ping_have_sRGB=MagickFalse;\n ping_have_tRNS=MagickFalse;",
" ping_exclude_bKGD=mng_info->ping_exclude_bKGD;\n ping_exclude_caNv=mng_info->ping_exclude_caNv;\n ping_exclude_cHRM=mng_info->ping_exclude_cHRM;\n ping_exclude_date=mng_info->ping_exclude_date;\n /* ping_exclude_EXIF=mng_info->ping_exclude_EXIF; */\n ping_exclude_eXIf=mng_info->ping_exclude_eXIf;\n ping_exclude_gAMA=mng_info->ping_exclude_gAMA;\n ping_exclude_iCCP=mng_info->ping_exclude_iCCP;\n /* ping_exclude_iTXt=mng_info->ping_exclude_iTXt; */\n ping_exclude_oFFs=mng_info->ping_exclude_oFFs;\n ping_exclude_pHYs=mng_info->ping_exclude_pHYs;\n ping_exclude_sRGB=mng_info->ping_exclude_sRGB;\n ping_exclude_tEXt=mng_info->ping_exclude_tEXt;\n ping_exclude_tIME=mng_info->ping_exclude_tIME;\n /* ping_exclude_tRNS=mng_info->ping_exclude_tRNS; */\n ping_exclude_zCCP=mng_info->ping_exclude_zCCP; /* hex-encoded iCCP in zTXt */\n ping_exclude_zTXt=mng_info->ping_exclude_zTXt;",
" ping_preserve_colormap = mng_info->ping_preserve_colormap;\n ping_preserve_iCCP = mng_info->ping_preserve_iCCP;\n ping_need_colortype_warning = MagickFalse;",
" property=(const char *) NULL;",
" /* Recognize the ICC sRGB profile and convert it to the sRGB chunk,\n * i.e., eliminate the ICC profile and set image->rendering_intent.\n * Note that this will not involve any changes to the actual pixels\n * but merely passes information to applications that read the resulting\n * PNG image.\n *\n * To do: recognize other variants of the sRGB profile, using the CRC to\n * verify all recognized variants including the 7 already known.\n *\n * Work around libpng16+ rejecting some \"known invalid sRGB profiles\".\n *\n * Use something other than image->rendering_intent to record the fact\n * that the sRGB profile was found.\n *\n * Record the ICC version (currently v2 or v4) of the incoming sRGB ICC\n * profile. Record the Blackpoint Compensation, if any.\n */\n if (ping_exclude_sRGB == MagickFalse && ping_preserve_iCCP == MagickFalse)\n {\n char\n *name;",
" const StringInfo\n *profile;",
" ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);",
" if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))",
" {\n int\n icheck,\n got_crc=0;",
"\n png_uint_32\n length,\n profile_crc=0;",
" unsigned char\n *data;",
" length=(png_uint_32) GetStringInfoLength(profile);",
" for (icheck=0; sRGB_info[icheck].len > 0; icheck++)\n {\n if (length == sRGB_info[icheck].len)\n {\n if (got_crc == 0)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got a %lu-byte ICC profile (potentially sRGB)\",\n (unsigned long) length);",
" data=GetStringInfoDatum(profile);\n profile_crc=crc32(0,data,length);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" with crc=%8x\",(unsigned int) profile_crc);\n got_crc++;\n }",
" if (profile_crc == sRGB_info[icheck].crc)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" It is sRGB with rendering intent = %s\",\n Magick_RenderingIntentString_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent));\n if (image->rendering_intent==UndefinedIntent)\n {\n image->rendering_intent=\n Magick_RenderingIntent_from_PNG_RenderingIntent(\n sRGB_info[icheck].intent);\n }\n ping_exclude_iCCP = MagickTrue;\n ping_exclude_zCCP = MagickTrue;\n ping_have_sRGB = MagickTrue;\n break;\n }\n }\n }\n if (sRGB_info[icheck].len == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Got a %lu-byte ICC profile not recognized as sRGB\",\n (unsigned long) length);\n }\n }\n name=GetNextImageProfile(image);\n }\n }",
" number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;",
" if (logging != MagickFalse)\n {\n if (image->storage_class == UndefinedClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=UndefinedClass\");\n if (image->storage_class == DirectClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=DirectClass\");\n if (image->storage_class == PseudoClass)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->storage_class=PseudoClass\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_info->magick= %s\",image_info->magick);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(), image->taint ?\n \" image->taint=MagickTrue\":\n \" image->taint=MagickFalse\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->gamma=%g\", image->gamma);\n }",
" if (image->storage_class == PseudoClass &&\n (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (mng_info->write_png_colortype != 1 &&\n mng_info->write_png_colortype != 5)))\n {\n (void) SyncImage(image);\n image->storage_class = DirectClass;\n }",
" if (ping_preserve_colormap == MagickFalse)\n {\n if (image->storage_class != PseudoClass && image->colormap != NULL)\n {\n /* Free the bogus colormap; it can cause trouble later */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Freeing bogus colormap\");\n (void) RelinquishMagickMemory(image->colormap);\n image->colormap=NULL;\n }\n }",
" if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n (void) TransformImageColorspace(image,sRGBColorspace);",
" /*\n Sometimes we get PseudoClass images whose RGB values don't match\n the colors in the colormap. This code syncs the RGB values.\n */\n if (image->depth <= 8 && image->taint && image->storage_class == PseudoClass)\n (void) SyncImage(image);",
"#if (MAGICKCORE_QUANTUM_DEPTH == 8)\n if (image->depth > 8)\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reducing PNG bit depth to 8 since this is a Q8 build.\");",
" image->depth=8;\n }\n#endif",
" /* Respect the -depth option */\n if (image->depth < 4)\n {\n register PixelPacket\n *r;",
" ExceptionInfo\n *exception;",
" exception=(&image->exception);",
" if (image->depth > 2)\n {\n /* Scale to 4-bit */\n LBR04PacketRGBO(image->background_color);",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR04PixelRGBO(r);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }",
" if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR04PacketRGBO(image->colormap[i]);\n }\n }\n }\n else if (image->depth > 1)\n {\n /* Scale to 2-bit */\n LBR02PacketRGBO(image->background_color);",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR02PixelRGBO(r);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }",
" if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR02PacketRGBO(image->colormap[i]);\n }\n }\n }\n else\n {\n /* Scale to 1-bit */\n LBR01PacketRGBO(image->background_color);",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n LBR01PixelRGBO(r);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }",
" if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n LBR01PacketRGBO(image->colormap[i]);\n }\n }\n }\n }",
" /* To do: set to next higher multiple of 8 */\n if (image->depth < 8)\n image->depth=8;",
"#if (MAGICKCORE_QUANTUM_DEPTH > 16)\n /* PNG does not handle depths greater than 16 so reduce it even\n * if lossy\n */\n if (image->depth > 8)\n image->depth=16;\n#endif",
"#if (MAGICKCORE_QUANTUM_DEPTH > 8)\n if (image->depth > 8)\n {\n /* To do: fill low byte properly */\n image->depth=16;\n }",
" if (image->depth == 16 && mng_info->write_png_depth != 16)\n if (mng_info->write_png8 || LosslessReduceDepthOK(image) != MagickFalse)\n image->depth = 8;\n#endif",
" image_colors = (int) image->colors;",
" if (mng_info->write_png_colortype &&\n (mng_info->write_png_colortype > 4 || (mng_info->write_png_depth >= 8 &&\n mng_info->write_png_colortype < 4 && image->matte == MagickFalse)))\n {\n /* Avoid the expensive BUILD_PALETTE operation if we're sure that we\n * are not going to need the result.\n */\n number_opaque = (int) image->colors;\n if (mng_info->write_png_colortype == 1 ||\n mng_info->write_png_colortype == 5)\n ping_have_color=MagickFalse;\n else\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickFalse;",
" if (image->matte != MagickFalse)\n {\n number_transparent = 2;\n number_semitransparent = 1;\n }",
" else\n {\n number_transparent = 0;\n number_semitransparent = 0;\n }\n }",
" if (mng_info->write_png_colortype < 7)\n {\n /* BUILD_PALETTE\n *\n * Normally we run this just once, but in the case of writing PNG8\n * we reduce the transparency to binary and run again, then if there\n * are still too many colors we reduce to a simple 4-4-4-1, then 3-3-3-1\n * RGBA palette and run again, and then to a simple 3-3-2-1 RGBA\n * palette. Then (To do) we take care of a final reduction that is only\n * needed if there are still 256 colors present and one of them has both\n * transparent and opaque instances.\n */",
" tried_332 = MagickFalse;\n tried_333 = MagickFalse;\n tried_444 = MagickFalse;",
" for (j=0; j<6; j++)\n {\n /*\n * Sometimes we get DirectClass images that have 256 colors or fewer.\n * This code will build a colormap.\n *\n * Also, sometimes we get PseudoClass images with an out-of-date\n * colormap. This code will replace the colormap with a new one.\n * Sometimes we get PseudoClass images that have more than 256 colors.\n * This code will delete the colormap and change the image to\n * DirectClass.\n *\n * If image->matte is MagickFalse, we ignore the opacity channel\n * even though it sometimes contains left-over non-opaque values.\n *\n * Also we gather some information (number of opaque, transparent,\n * and semitransparent pixels, and whether the image has any non-gray\n * pixels or only black-and-white pixels) that we might need later.\n *\n * Even if the user wants to force GrayAlpha or RGBA (colortype 4 or 6)\n * we need to check for bogus non-opaque values, at least.\n */",
" ExceptionInfo\n *exception;",
" int\n n;",
" PixelPacket\n opaque[260],\n semitransparent[260],\n transparent[260];",
" register IndexPacket\n *indexes;",
" register const PixelPacket\n *s,\n *q;",
" register PixelPacket\n *r;",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Enter BUILD_PALETTE:\");",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->columns=%.20g\",(double) image->columns);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->rows=%.20g\",(double) image->rows);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->matte=%.20g\",(double) image->matte);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);",
" if (image->storage_class == PseudoClass && image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Original colormap:\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,opacity)\");",
" for (i=0; i < 256; i++)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].opacity);\n }",
" for (i=image->colors - 10; i < (ssize_t) image->colors; i++)\n {\n if (i > 255)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].opacity);\n }\n }\n }",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\",(int) image->colors);",
" if (image->colors == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" (zero means unknown)\");",
" if (ping_preserve_colormap == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Regenerate the colormap\");\n }",
" exception=(&image->exception);",
" image_colors=0;\n number_opaque = 0;\n number_semitransparent = 0;\n number_transparent = 0;",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);",
" if (q == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (image->matte == MagickFalse ||\n GetPixelOpacity(q) == OpaqueOpacity)\n {\n if (number_opaque < 259)\n {\n if (number_opaque == 0)\n {\n GetPixelRGB(q, opaque);\n opaque[0].opacity=OpaqueOpacity;\n number_opaque=1;\n }",
" for (i=0; i< (ssize_t) number_opaque; i++)\n {\n if (IsColorEqual(q, opaque+i))\n break;\n }",
" if (i == (ssize_t) number_opaque &&\n number_opaque < 259)\n {\n number_opaque++;\n GetPixelRGB(q, opaque+i);\n opaque[i].opacity=OpaqueOpacity;\n }\n }\n }\n else if (q->opacity == TransparentOpacity)\n {\n if (number_transparent < 259)\n {\n if (number_transparent == 0)\n {\n GetPixelRGBO(q, transparent);\n ping_trans_color.red=\n (unsigned short) GetPixelRed(q);\n ping_trans_color.green=\n (unsigned short) GetPixelGreen(q);\n ping_trans_color.blue=\n (unsigned short) GetPixelBlue(q);\n ping_trans_color.gray=\n (unsigned short) GetPixelRed(q);\n number_transparent = 1;\n }",
" for (i=0; i< (ssize_t) number_transparent; i++)\n {\n if (IsColorEqual(q, transparent+i))\n break;\n }",
" if (i == (ssize_t) number_transparent &&\n number_transparent < 259)\n {\n number_transparent++;\n GetPixelRGBO(q, transparent+i);\n }\n }\n }\n else\n {\n if (number_semitransparent < 259)\n {\n if (number_semitransparent == 0)\n {\n GetPixelRGBO(q, semitransparent);\n number_semitransparent = 1;\n }",
" for (i=0; i< (ssize_t) number_semitransparent; i++)\n {\n if (IsColorEqual(q, semitransparent+i)\n && GetPixelOpacity(q) ==\n semitransparent[i].opacity)\n break;\n }",
" if (i == (ssize_t) number_semitransparent &&\n number_semitransparent < 259)\n {\n number_semitransparent++;\n GetPixelRGBO(q, semitransparent+i);\n }\n }\n }\n q++;\n }\n }",
" if (mng_info->write_png8 == MagickFalse &&\n ping_exclude_bKGD == MagickFalse)\n {\n /* Add the background color to the palette, if it\n * isn't already there.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Check colormap for background (%d,%d,%d)\",\n (int) image->background_color.red,\n (int) image->background_color.green,\n (int) image->background_color.blue);\n }\n for (i=0; i<number_opaque; i++)\n {\n if (opaque[i].red == image->background_color.red &&\n opaque[i].green == image->background_color.green &&\n opaque[i].blue == image->background_color.blue)\n break;\n }\n if (number_opaque < 259 && i == number_opaque)\n {\n opaque[i] = image->background_color;\n ping_background.index = i;\n number_opaque++;\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",(int) i);\n }",
" }\n else if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in the colormap to add background color\");\n }",
" image_colors=number_opaque+number_transparent+number_semitransparent;",
" if (logging != MagickFalse)\n {\n if (image_colors > 256)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has more than 256 colors\");",
" else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image has %d colors\",image_colors);\n }",
" if (ping_preserve_colormap != MagickFalse)\n break;",
" if (mng_info->write_png_colortype != 7) /* We won't need this info */\n {\n ping_have_color=MagickFalse;\n ping_have_non_bw=MagickFalse;",
" if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"incompatible colorspace\");\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n }",
" if(image_colors > 256)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,exception);",
" if (q == (PixelPacket *) NULL)\n break;",
" s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(s) != GetPixelGreen(s) ||\n GetPixelRed(s) != GetPixelBlue(s))\n {\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n break;\n }\n s++;\n }",
" if (ping_have_color != MagickFalse)\n break;",
" /* Worst case is black-and-white; we are looking at every\n * pixel twice.\n */",
" if (ping_have_non_bw == MagickFalse)\n {\n s=q;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelRed(s) != 0 &&\n GetPixelRed(s) != QuantumRange)\n {\n ping_have_non_bw=MagickTrue;\n break;\n }\n s++;\n }\n }\n }\n }\n }",
" if (image_colors < 257)\n {\n PixelPacket\n colormap[260];",
" /*\n * Initialize image colormap.\n */",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Sort the new colormap\");",
" /* Sort palette, transparent first */;",
" n = 0;",
" for (i=0; i<number_transparent; i++)\n colormap[n++] = transparent[i];",
" for (i=0; i<number_semitransparent; i++)\n colormap[n++] = semitransparent[i];",
" for (i=0; i<number_opaque; i++)\n colormap[n++] = opaque[i];",
" ping_background.index +=\n (number_transparent + number_semitransparent);",
" /* image_colors < 257; search the colormap instead of the pixels\n * to get ping_have_color and ping_have_non_bw\n */\n for (i=0; i<n; i++)\n {\n if (ping_have_color == MagickFalse)\n {\n if (colormap[i].red != colormap[i].green ||\n colormap[i].red != colormap[i].blue)\n {\n ping_have_color=MagickTrue;\n ping_have_non_bw=MagickTrue;\n break;\n }\n }",
" if (ping_have_non_bw == MagickFalse)\n {\n if (colormap[i].red != 0 && colormap[i].red != QuantumRange)\n ping_have_non_bw=MagickTrue;\n }\n }",
" if ((mng_info->ping_exclude_tRNS == MagickFalse ||\n (number_transparent == 0 && number_semitransparent == 0)) &&\n (((mng_info->write_png_colortype-1) ==\n PNG_COLOR_TYPE_PALETTE) ||\n (mng_info->write_png_colortype == 0)))\n {\n if (logging != MagickFalse)\n {\n if (n != (ssize_t) image_colors)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_colors (%d) and n (%d) don't match\",\n image_colors, n);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" AcquireImageColormap\");\n }",
" image->colors = image_colors;",
" if (AcquireImageColormap(image,image_colors) == MagickFalse)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\n image->filename);\n break;\n }",
" for (i=0; i< (ssize_t) image_colors; i++)\n image->colormap[i] = colormap[i];",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d (%d)\",\n (int) image->colors, image_colors);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Update the pixel indexes\");\n }",
" /* Sync the pixel indices with the new colormap */",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (q == (PixelPacket *) NULL)\n break;",
" indexes=GetAuthenticIndexQueue(image);",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n for (i=0; i< (ssize_t) image_colors; i++)\n {\n if ((image->matte == MagickFalse ||\n image->colormap[i].opacity ==\n GetPixelOpacity(q)) &&\n image->colormap[i].red ==\n GetPixelRed(q) &&\n image->colormap[i].green ==\n GetPixelGreen(q) &&\n image->colormap[i].blue ==\n GetPixelBlue(q))\n {\n SetPixelIndex(indexes+x,i);\n break;\n }\n }\n q++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }\n }",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->colors=%d\", (int) image->colors);",
" if (image->colormap != NULL)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" i (red,green,blue,opacity)\");",
" for (i=0; i < (ssize_t) image->colors; i++)\n {\n if (i < 300 || i >= (ssize_t) image->colors - 10)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" %d (%d,%d,%d,%d)\",\n (int) i,\n (int) image->colormap[i].red,\n (int) image->colormap[i].green,\n (int) image->colormap[i].blue,\n (int) image->colormap[i].opacity);\n }\n }\n }",
" if (number_transparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent = %d\",\n number_transparent);\n else",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_transparent > 256\");",
" if (number_opaque < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque = %d\",\n number_opaque);",
" else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_opaque > 256\");",
" if (number_semitransparent < 257)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent = %d\",\n number_semitransparent);",
" else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" number_semitransparent > 256\");",
" if (ping_have_non_bw == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are black or white\");",
" else if (ping_have_color == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" All pixels and the background are gray\");",
" else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" At least one pixel or the background is non-gray\");",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Exit BUILD_PALETTE:\");\n }",
" if (mng_info->write_png8 == MagickFalse)\n break;",
" /* Make any reductions necessary for the PNG8 format */\n if (image_colors <= 256 &&\n image_colors != 0 && image->colormap != NULL &&\n number_semitransparent == 0 &&\n number_transparent <= 1)\n break;",
" /* PNG8 can't have semitransparent colors so we threshold the\n * opacity to 0 or OpaqueOpacity, and PNG8 can only have one\n * transparent color so if more than one is transparent we merge\n * them into image->background_color.\n */\n if (number_semitransparent != 0 || number_transparent > 1)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Thresholding the alpha channel to binary\");",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelOpacity(r) > TransparentOpacity/2)\n {\n SetPixelOpacity(r,TransparentOpacity);\n SetPixelRgb(r,&image->background_color);\n }\n else\n SetPixelOpacity(r,OpaqueOpacity);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;",
" if (image_colors != 0 && image_colors <= 256 &&\n image->colormap != NULL)\n for (i=0; i<image_colors; i++)\n image->colormap[i].opacity =\n (image->colormap[i].opacity > TransparentOpacity/2 ?\n TransparentOpacity : OpaqueOpacity);\n }\n continue;\n }",
" /* PNG8 can't have more than 256 colors so we quantize the pixels and\n * background color to the 4-4-4-1, 3-3-3-1 or 3-3-2-1 palette. If the\n * image is mostly gray, the 4-4-4-1 palette is likely to end up with 256\n * colors or less.\n */\n if (tried_444 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 4-4-4\");",
" tried_444 = MagickTrue;",
" LBR04PacketRGB(image->background_color);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 4-4-4\");",
" if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelOpacity(r) == OpaqueOpacity)\n LBR04PixelRGB(r);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }",
" else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 4-4-4\");",
" for (i=0; i<image_colors; i++)\n {\n LBR04PacketRGB(image->colormap[i]);\n }\n }\n continue;\n }",
" if (tried_333 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-3\");",
" tried_333 = MagickTrue;",
" LBR03PacketRGB(image->background_color);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-3-1\");",
" if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelOpacity(r) == OpaqueOpacity)\n LBR03PixelRGB(r);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }",
" else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-3-1\");\n for (i=0; i<image_colors; i++)\n {\n LBR03PacketRGB(image->colormap[i]);\n }\n }\n continue;\n }",
" if (tried_332 == MagickFalse && (image_colors == 0 || image_colors > 256))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the background color to 3-3-2\");",
" tried_332 = MagickTrue;",
" /* Red and green were already done so we only quantize the blue\n * channel\n */",
" LBR02PacketBlue(image->background_color);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the pixel colors to 3-3-2-1\");",
" if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (GetPixelOpacity(r) == OpaqueOpacity)\n LBR02PixelBlue(r);\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n }\n }",
" else /* Should not reach this; colormap already exists and\n must be <= 256 */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Quantizing the colormap to 3-3-2-1\");\n for (i=0; i<image_colors; i++)\n {\n LBR02PacketBlue(image->colormap[i]);\n }\n }\n continue;\n }",
" if (image_colors == 0 || image_colors > 256)\n {\n /* Take care of special case with 256 opaque colors + 1 transparent\n * color. We don't need to quantize to 2-3-2-1; we only need to\n * eliminate one color, so we'll merge the two darkest red\n * colors (0x49, 0, 0) -> (0x24, 0, 0).\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red background colors to 3-3-2-1\");",
" if (ScaleQuantumToChar(image->background_color.red) == 0x49 &&\n ScaleQuantumToChar(image->background_color.green) == 0x00 &&\n ScaleQuantumToChar(image->background_color.blue) == 0x00)\n {\n image->background_color.red=ScaleCharToQuantum(0x24);\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Merging two dark red pixel colors to 3-3-2-1\");",
" if (image->colormap == NULL)\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n r=GetAuthenticPixels(image,0,y,image->columns,1,\n exception);",
" if (r == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (ScaleQuantumToChar(GetPixelRed(r)) == 0x49 &&\n ScaleQuantumToChar(GetPixelGreen(r)) == 0x00 &&\n ScaleQuantumToChar(GetPixelBlue(r)) == 0x00 &&\n GetPixelOpacity(r) == OpaqueOpacity)\n {\n SetPixelRed(r,ScaleCharToQuantum(0x24));\n }\n r++;\n }",
" if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;",
" }\n }",
" else\n {\n for (i=0; i<image_colors; i++)\n {\n if (ScaleQuantumToChar(image->colormap[i].red) == 0x49 &&\n ScaleQuantumToChar(image->colormap[i].green) == 0x00 &&\n ScaleQuantumToChar(image->colormap[i].blue) == 0x00)\n {\n image->colormap[i].red=ScaleCharToQuantum(0x24);\n }\n }\n }\n }\n }\n }\n /* END OF BUILD_PALETTE */",
" /* If we are excluding the tRNS chunk and there is transparency,\n * then we must write a Gray-Alpha (color-type 4) or RGBA (color-type 6)\n * PNG.\n */\n if (mng_info->ping_exclude_tRNS != MagickFalse &&\n (number_transparent != 0 || number_semitransparent != 0))\n {\n unsigned int colortype=mng_info->write_png_colortype;",
" if (ping_have_color == MagickFalse)\n mng_info->write_png_colortype = 5;",
" else\n mng_info->write_png_colortype = 7;",
" if (colortype != 0 &&\n mng_info->write_png_colortype != colortype)\n ping_need_colortype_warning=MagickTrue;",
" }",
" /* See if cheap transparency is possible. It is only possible\n * when there is a single transparent color, no semitransparent\n * color, and no opaque color that has the same RGB components\n * as the transparent color. We only need this information if\n * we are writing a PNG with colortype 0 or 2, and we have not\n * excluded the tRNS chunk.\n */\n if (number_transparent == 1 &&\n mng_info->write_png_colortype < 4)\n {\n ping_have_cheap_transparency = MagickTrue;",
" if (number_semitransparent != 0)\n ping_have_cheap_transparency = MagickFalse;",
" else if (image_colors == 0 || image_colors > 256 ||\n image->colormap == NULL)\n {\n ExceptionInfo\n *exception;",
" register const PixelPacket\n *q;",
" exception=(&image->exception);",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=GetVirtualPixels(image,0,y,image->columns,1, exception);",
" if (q == (PixelPacket *) NULL)\n break;",
" for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (q->opacity != TransparentOpacity &&\n (unsigned short) GetPixelRed(q) ==\n ping_trans_color.red &&\n (unsigned short) GetPixelGreen(q) ==\n ping_trans_color.green &&\n (unsigned short) GetPixelBlue(q) ==\n ping_trans_color.blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }",
" q++;\n }",
" if (ping_have_cheap_transparency == MagickFalse)\n break;\n }\n }\n else\n {\n /* Assuming that image->colormap[0] is the one transparent color\n * and that all others are opaque.\n */\n if (image_colors > 1)\n for (i=1; i<image_colors; i++)\n if (image->colormap[i].red == image->colormap[0].red &&\n image->colormap[i].green == image->colormap[0].green &&\n image->colormap[i].blue == image->colormap[0].blue)\n {\n ping_have_cheap_transparency = MagickFalse;\n break;\n }\n }",
" if (logging != MagickFalse)\n {\n if (ping_have_cheap_transparency == MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is not possible.\");",
" else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Cheap transparency is possible.\");\n }\n }\n else\n ping_have_cheap_transparency = MagickFalse;",
" image_depth=image->depth;",
" quantum_info = (QuantumInfo *) NULL;\n number_colors=0;\n image_colors=(int) image->colors;\n image_matte=image->matte;",
" if (mng_info->write_png_colortype < 5)\n mng_info->IsPalette=image->storage_class == PseudoClass &&\n image_colors <= 256 && image->colormap != NULL;\n else\n mng_info->IsPalette = MagickFalse;",
" if ((mng_info->write_png_colortype == 4 || mng_info->write_png8) &&\n (image->colors == 0 || image->colormap == NULL))\n {\n (void) ThrowMagickException(&image->exception,\n GetMagickModule(),CoderError,\n \"Cannot write PNG8 or color-type 3; colormap is NULL\",\n \"`%s'\",image->filename);",
" return(MagickFalse);\n }",
" /*\n Allocate the PNG structures\n */\n#ifdef PNG_USER_MEM_SUPPORTED\n ping=png_create_write_struct_2(PNG_LIBPNG_VER_STRING,image,\n MagickPNGErrorHandler,MagickPNGWarningHandler,(void *) NULL,\n (png_malloc_ptr) Magick_png_malloc,(png_free_ptr) Magick_png_free);",
"#else\n ping=png_create_write_struct(PNG_LIBPNG_VER_STRING,image,\n MagickPNGErrorHandler,MagickPNGWarningHandler);",
"#endif\n if (ping == (png_struct *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");",
" ping_info=png_create_info_struct(ping);",
" if (ping_info == (png_info *) NULL)\n {\n png_destroy_write_struct(&ping,(png_info **) NULL);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }",
" png_set_write_fn(ping,image,png_put_data,png_flush_data);\n pixel_info=(MemoryInfo *) NULL;",
" if (setjmp(png_jmpbuf(ping)))\n {\n /*\n PNG write failed.\n */\n#ifdef PNG_DEBUG\n if (image_info->verbose)\n (void) printf(\"PNG write has failed.\\n\");\n#endif\n png_destroy_write_struct(&ping,&ping_info);",
"#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif",
" if (pixel_info != (MemoryInfo *) NULL)\n pixel_info=RelinquishVirtualMemory(pixel_info);",
" if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);",
" return(MagickFalse);\n }",
" /* { For navigation to end of SETJMP-protected block. Within this\n * block, use png_error() instead of Throwing an Exception, to ensure\n * that libpng is able to clean up, and that the semaphore is unlocked.\n */",
"#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n LockSemaphoreInfo(ping_semaphore);\n#endif",
"#ifdef PNG_BENIGN_ERRORS_SUPPORTED\n /* Allow benign errors */\n png_set_benign_errors(ping, 1);\n#endif",
"#ifdef PNG_SET_USER_LIMITS_SUPPORTED\n /* Reject images with too many rows or columns */\n png_set_user_limits(ping,\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(WidthResource)),\n (png_uint_32) MagickMin(0x7fffffffL,\n GetMagickResourceLimit(HeightResource)));\n#endif /* PNG_SET_USER_LIMITS_SUPPORTED */",
" /*\n Prepare PNG for writing.\n */",
"#if defined(PNG_MNG_FEATURES_SUPPORTED)\n if (mng_info->write_mng)\n {\n (void) png_permit_mng_features(ping,PNG_ALL_MNG_FEATURES);\n# ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED\n /* Disable new libpng-1.5.10 feature when writing a MNG because\n * zero-length PLTE is OK\n */\n png_set_check_for_invalid_index (ping, 0);\n# endif\n }",
"#else\n# ifdef PNG_WRITE_EMPTY_PLTE_SUPPORTED\n if (mng_info->write_mng)\n png_permit_empty_plte(ping,MagickTrue);",
"# endif\n#endif",
" x=0;",
" ping_width=(png_uint_32) image->columns;\n ping_height=(png_uint_32) image->rows;",
" if (mng_info->write_png8 || mng_info->write_png24 || mng_info->write_png32)\n image_depth=8;",
" if (mng_info->write_png48 || mng_info->write_png64)\n image_depth=16;",
" if (mng_info->write_png_depth != 0)\n image_depth=mng_info->write_png_depth;",
" /* Adjust requested depth to next higher valid depth if necessary */\n if (image_depth > 8)\n image_depth=16;",
" if ((image_depth > 4) && (image_depth < 8))\n image_depth=8;",
" if (image_depth == 3)\n image_depth=4;",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" width=%.20g\",(double) ping_width);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" height=%.20g\",(double) ping_height);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_matte=%.20g\",(double) image->matte);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image->depth=%.20g\",(double) image->depth);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative ping_bit_depth=%.20g\",(double) image_depth);\n }",
" save_image_depth=image_depth;\n ping_bit_depth=(png_byte) save_image_depth;",
"\n#if defined(PNG_pHYs_SUPPORTED)\n if (ping_exclude_pHYs == MagickFalse)\n {\n if ((image->x_resolution != 0) && (image->y_resolution != 0) &&\n (!mng_info->write_mng || !mng_info->equal_physs))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");",
" if (image->units == PixelsPerInchResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=\n (png_uint_32) ((100.0*image->x_resolution+0.5)/2.54);\n ping_pHYs_y_resolution=\n (png_uint_32) ((100.0*image->y_resolution+0.5)/2.54);\n }",
" else if (image->units == PixelsPerCentimeterResolution)\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_METER;\n ping_pHYs_x_resolution=(png_uint_32) (100.0*image->x_resolution+0.5);\n ping_pHYs_y_resolution=(png_uint_32) (100.0*image->y_resolution+0.5);\n }",
" else\n {\n ping_pHYs_unit_type=PNG_RESOLUTION_UNKNOWN;\n ping_pHYs_x_resolution=(png_uint_32) image->x_resolution;\n ping_pHYs_y_resolution=(png_uint_32) image->y_resolution;\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Set up PNG pHYs chunk: xres: %.20g, yres: %.20g, units: %d.\",\n (double) ping_pHYs_x_resolution,(double) ping_pHYs_y_resolution,\n (int) ping_pHYs_unit_type);\n ping_have_pHYs = MagickTrue;\n }\n }\n#endif",
" if (ping_exclude_bKGD == MagickFalse)\n {\n if ((!mng_info->adjoin || !mng_info->equal_backgrounds))\n {\n unsigned int\n mask;",
" mask=0xffff;\n if (ping_bit_depth == 8)\n mask=0x00ff;",
" if (ping_bit_depth == 4)\n mask=0x000f;",
" if (ping_bit_depth == 2)\n mask=0x0003;",
" if (ping_bit_depth == 1)\n mask=0x0001;",
" ping_background.red=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.red) & mask);",
" ping_background.green=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.green) & mask);",
" ping_background.blue=(png_uint_16)\n (ScaleQuantumToShort(image->background_color.blue) & mask);",
" ping_background.gray=(png_uint_16) ping_background.green;\n }",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (1)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth=%d\",ping_bit_depth);\n }",
" ping_have_bKGD = MagickTrue;\n }",
" /*\n Select the color type.\n */\n matte=image_matte;\n old_bit_depth=0;",
" if (mng_info->IsPalette && mng_info->write_png8)\n {\n /* To do: make this a function cause it's used twice, except\n for reducing the sample depth from 8. */",
" number_colors=image_colors;",
" ping_have_tRNS=MagickFalse;",
" /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors (%d)\",\n number_colors, image_colors);",
" for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n#if MAGICKCORE_QUANTUM_DEPTH == 8\n \" %3ld (%3d,%3d,%3d)\",\n#else\n \" %5ld (%5d,%5d,%5d)\",\n#endif\n (long) i,palette[i].red,palette[i].green,palette[i].blue);",
" }",
" ping_have_PLTE=MagickTrue;\n image_depth=ping_bit_depth;\n ping_num_trans=0;",
" if (matte != MagickFalse)\n {\n /*\n Identify which colormap entry is transparent.\n */\n assert(number_colors <= 256);\n assert(image->colormap != NULL);",
" for (i=0; i < (ssize_t) number_transparent; i++)\n ping_trans_alpha[i]=0;",
"\n ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);",
" if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;",
" else\n ping_have_tRNS=MagickTrue;\n }",
" if (ping_exclude_bKGD == MagickFalse)\n {\n /*\n * Identify which colormap entry is the background color.\n */",
" for (i=0; i < (ssize_t) MagickMax(1L*number_colors-1L,1L); i++)\n if (IsPNGColorEqual(ping_background,image->colormap[i]))\n break;",
" ping_background.index=(png_byte) i;",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background_color index is %d\",\n (int) ping_background.index);\n }\n }\n } /* end of write_png8 */",
" else if (mng_info->write_png_colortype == 1)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n }",
" else if (mng_info->write_png24 || mng_info->write_png48 ||\n mng_info->write_png_colortype == 3)\n {\n image_matte=MagickFalse;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n }",
" else if (mng_info->write_png32 || mng_info->write_png64 ||\n mng_info->write_png_colortype == 7)\n {\n image_matte=MagickTrue;\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n }",
" else /* mng_info->write_pngNN not specified */\n {\n image_depth=ping_bit_depth;",
" if (mng_info->write_png_colortype != 0)\n {\n ping_color_type=(png_byte) mng_info->write_png_colortype-1;",
" if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n image_matte=MagickTrue;",
" else\n image_matte=MagickFalse;",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG colortype %d was specified:\",(int) ping_color_type);\n }",
" else /* write_png_colortype not specified */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selecting PNG colortype:\");",
" ping_color_type=(png_byte) ((matte != MagickFalse)?\n PNG_COLOR_TYPE_RGB_ALPHA:PNG_COLOR_TYPE_RGB);",
" if (image_info->type == TrueColorType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }",
" if (image_info->type == TrueColorMatteType)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB_ALPHA;\n image_matte=MagickTrue;\n }",
" if (image_info->type == PaletteType ||\n image_info->type == PaletteMatteType)\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;",
" if (mng_info->write_png_colortype == 0 &&\n image_info->type == UndefinedType)\n {\n if (ping_have_color == MagickFalse)\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;\n image_matte=MagickFalse;\n }",
" else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;\n image_matte=MagickTrue;\n }\n }\n else\n {\n if (image_matte == MagickFalse)\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;\n image_matte=MagickFalse;\n }",
" else\n {\n ping_color_type=(png_byte) PNG_COLOR_TYPE_RGBA;\n image_matte=MagickTrue;\n }\n }\n }",
" }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Selected PNG colortype=%d\",ping_color_type);",
" if (ping_bit_depth < 8)\n {\n if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||\n ping_color_type == PNG_COLOR_TYPE_RGB ||\n ping_color_type == PNG_COLOR_TYPE_RGB_ALPHA)\n ping_bit_depth=8;\n }",
" old_bit_depth=ping_bit_depth;",
" if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->matte == MagickFalse && ping_have_non_bw == MagickFalse)\n ping_bit_depth=1;\n }",
" if (ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n size_t one = 1;\n ping_bit_depth=1;",
" if (image->colors == 0)\n {\n /* DO SOMETHING */\n png_error(ping,\"image has 0 colors\");\n }",
" while ((int) (one << ping_bit_depth) < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Number of colors: %.20g\",(double) image_colors);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG bit depth: %d\",ping_bit_depth);\n }",
" if (ping_bit_depth < (int) mng_info->write_png_depth)\n ping_bit_depth = mng_info->write_png_depth;\n }",
" image_depth=ping_bit_depth;",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Tentative PNG color type: %s (%.20g)\",\n PngColorTypeToString(ping_color_type),\n (double) ping_color_type);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_info->type: %.20g\",(double) image_info->type);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" image_depth: %.20g\",(double) image_depth);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),",
" \" image->depth: %.20g\",(double) image->depth);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_bit_depth: %.20g\",(double) ping_bit_depth);\n }",
" if (matte != MagickFalse)\n {\n if (mng_info->IsPalette)\n {\n if (mng_info->write_png_colortype == 0)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;",
" if (ping_have_color != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_RGBA;\n }",
" /*\n * Determine if there is any transparent color.\n */\n if (number_transparent + number_semitransparent == 0)\n {\n /*\n No transparent pixels are present. Change 4 or 6 to 0 or 2.\n */",
" image_matte=MagickFalse;",
" if (mng_info->write_png_colortype == 0)\n ping_color_type&=0x03;\n }",
" else\n {\n unsigned int\n mask;",
" mask=0xffff;",
" if (ping_bit_depth == 8)\n mask=0x00ff;",
" if (ping_bit_depth == 4)\n mask=0x000f;",
" if (ping_bit_depth == 2)\n mask=0x0003;",
" if (ping_bit_depth == 1)\n mask=0x0001;",
" ping_trans_color.red=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].red) & mask);",
" ping_trans_color.green=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].green) & mask);",
" ping_trans_color.blue=(png_uint_16)\n (ScaleQuantumToShort(image->colormap[0].blue) & mask);",
" ping_trans_color.gray=(png_uint_16)\n (ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image,\n image->colormap))) & mask);",
" ping_trans_color.index=(png_byte) 0;",
" ping_have_tRNS=MagickTrue;\n }",
" if (ping_have_tRNS != MagickFalse)\n {\n /*\n * Determine if there is one and only one transparent color\n * and if so if it is fully transparent.\n */\n if (ping_have_cheap_transparency == MagickFalse)\n ping_have_tRNS=MagickFalse;\n }",
" if (ping_have_tRNS != MagickFalse)\n {\n if (mng_info->write_png_colortype == 0)\n ping_color_type &= 0x03; /* changes 4 or 6 to 0 or 2 */",
" if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }\n else\n {\n if (image_depth == 8)\n {\n ping_trans_color.red&=0xff;\n ping_trans_color.green&=0xff;\n ping_trans_color.blue&=0xff;\n ping_trans_color.gray&=0xff;\n }\n }\n }",
" matte=image_matte;",
" if (ping_have_tRNS != MagickFalse)\n image_matte=MagickFalse;",
" if ((mng_info->IsPalette) &&\n mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE &&\n ping_have_color == MagickFalse &&\n (image_matte == MagickFalse || image_depth >= 8))\n {\n size_t one=1;",
" if (image_matte != MagickFalse)\n ping_color_type=PNG_COLOR_TYPE_GRAY_ALPHA;",
" else if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n ping_color_type=PNG_COLOR_TYPE_GRAY;",
" if (save_image_depth == 16 && image_depth == 8)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (0)\");\n }\n ping_trans_color.gray*=0x0101;\n }\n }",
" if (image_depth > MAGICKCORE_QUANTUM_DEPTH)\n image_depth=MAGICKCORE_QUANTUM_DEPTH;",
" if ((image_colors == 0) ||\n ((ssize_t) (image_colors-1) > (ssize_t) MaxColormapSize))\n image_colors=(int) (one << image_depth);",
" if (image_depth > 8)\n ping_bit_depth=16;",
" else\n {\n ping_bit_depth=8;\n if ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n if(!mng_info->write_png_depth)\n {\n ping_bit_depth=1;",
" while ((int) (one << ping_bit_depth)\n < (ssize_t) image_colors)\n ping_bit_depth <<= 1;\n }\n }",
" else if (ping_color_type ==\n PNG_COLOR_TYPE_GRAY && image_colors < 17 &&\n mng_info->IsPalette)\n {\n /* Check if grayscale is reducible */",
" int\n depth_4_ok=MagickTrue,\n depth_2_ok=MagickTrue,\n depth_1_ok=MagickTrue;",
" for (i=0; i < (ssize_t) image_colors; i++)\n {\n unsigned char\n intensity;",
" intensity=ScaleQuantumToChar(image->colormap[i].red);",
" if ((intensity & 0x0f) != ((intensity & 0xf0) >> 4))\n depth_4_ok=depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x03) != ((intensity & 0x0c) >> 2))\n depth_2_ok=depth_1_ok=MagickFalse;\n else if ((intensity & 0x01) != ((intensity & 0x02) >> 1))\n depth_1_ok=MagickFalse;\n }",
" if (depth_1_ok && mng_info->write_png_depth <= 1)\n ping_bit_depth=1;",
" else if (depth_2_ok && mng_info->write_png_depth <= 2)\n ping_bit_depth=2;",
" else if (depth_4_ok && mng_info->write_png_depth <= 4)\n ping_bit_depth=4;\n }\n }",
" image_depth=ping_bit_depth;\n }",
" else",
" if (mng_info->IsPalette)\n {\n number_colors=image_colors;",
" if (image_depth <= 8)\n {\n /*\n Set image palette.\n */\n ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;",
" if (!(mng_info->have_write_global_plte && matte == MagickFalse))\n {\n for (i=0; i < (ssize_t) number_colors; i++)\n {\n palette[i].red=ScaleQuantumToChar(image->colormap[i].red);\n palette[i].green=ScaleQuantumToChar(image->colormap[i].green);\n palette[i].blue=ScaleQuantumToChar(image->colormap[i].blue);\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up PLTE chunk with %d colors\",\n number_colors);",
" ping_have_PLTE=MagickTrue;\n }",
" /* color_type is PNG_COLOR_TYPE_PALETTE */\n if (mng_info->write_png_depth == 0)\n {\n size_t\n one;",
" ping_bit_depth=1;\n one=1;",
" while ((one << ping_bit_depth) < (size_t) number_colors)\n ping_bit_depth <<= 1;\n }",
" ping_num_trans=0;",
" if (matte != MagickFalse)\n {\n /*\n * Set up trans_colors array.\n */\n assert(number_colors <= 256);",
" ping_num_trans=(unsigned short) (number_transparent +\n number_semitransparent);",
" if (ping_num_trans == 0)\n ping_have_tRNS=MagickFalse;",
" else\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color (1)\");\n }\n ping_have_tRNS=MagickTrue;",
" for (i=0; i < ping_num_trans; i++)\n {\n ping_trans_alpha[i]= (png_byte) (255-\n ScaleQuantumToChar(image->colormap[i].opacity));\n }\n }\n }\n }\n }",
" else\n {",
" if (image_depth < 8)\n image_depth=8;",
" if ((save_image_depth == 16) && (image_depth == 8))\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color from (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }",
" ping_trans_color.red*=0x0101;\n ping_trans_color.green*=0x0101;\n ping_trans_color.blue*=0x0101;\n ping_trans_color.gray*=0x0101;",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to (%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }",
" if (ping_bit_depth < (ssize_t) mng_info->write_png_depth)\n ping_bit_depth = (ssize_t) mng_info->write_png_depth;",
" /*\n Adjust background and transparency samples in sub-8-bit grayscale files.\n */\n if (ping_bit_depth < 8 && ping_color_type ==\n PNG_COLOR_TYPE_GRAY)\n {\n png_uint_16\n maxval;",
" size_t\n one=1;",
" maxval=(png_uint_16) ((one << ping_bit_depth)-1);",
" if (ping_exclude_bKGD == MagickFalse)\n {",
" ping_background.gray=(png_uint_16)\n ((maxval/65535.)*(ScaleQuantumToShort((Quantum)\n GetPixelLuma(image,&image->background_color)))+.5);\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk (2)\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_background.index is %d\",\n (int) ping_background.index);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_background.gray is %d\",\n (int) ping_background.gray);\n }",
" ping_have_bKGD = MagickTrue;\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Scaling ping_trans_color.gray from %d\",\n (int)ping_trans_color.gray);",
" ping_trans_color.gray=(png_uint_16) ((maxval/255.)*(\n ping_trans_color.gray)+.5);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" to %d\", (int)ping_trans_color.gray);\n }",
" if (ping_exclude_bKGD == MagickFalse)\n {\n if (mng_info->IsPalette && (int) ping_color_type == PNG_COLOR_TYPE_PALETTE)\n {\n /*\n Identify which colormap entry is the background color.\n */",
" number_colors=image_colors;",
" for (i=0; i < (ssize_t) MagickMax(1L*number_colors,1L); i++)\n if (IsPNGColorEqual(image->background_color,image->colormap[i]))\n break;",
" ping_background.index=(png_byte) i;",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk with index=%d\",(int) i);\n }",
" if (i < (ssize_t) number_colors)\n {\n ping_have_bKGD = MagickTrue;",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background =(%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n }\n }",
" else /* Can't happen */\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" No room in PLTE to add bKGD color\");\n ping_have_bKGD = MagickFalse;\n }\n }\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color type: %s (%d)\", PngColorTypeToString(ping_color_type),\n ping_color_type);\n /*\n Initialize compression level and filtering.\n */\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up deflate compression\");",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression buffer size: 32768\");\n }",
" png_set_compression_buffer_size(ping,32768L);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression mem level: 9\");",
" png_set_compression_mem_level(ping, 9);",
" /* Untangle the \"-quality\" setting:",
" Undefined is 0; the default is used.\n Default is 75",
" 10's digit:",
" 0 or omitted: Use Z_HUFFMAN_ONLY strategy with the\n zlib default compression level",
" 1-9: the zlib compression level",
" 1's digit:",
" 0-4: the PNG filter method",
" 5: libpng adaptive filtering if compression level > 5\n libpng filter type \"none\" if compression level <= 5\n or if image is grayscale or palette",
" 6: libpng adaptive filtering",
" 7: \"LOCO\" filtering (intrapixel differing) if writing\n a MNG, otherwise \"none\". Did not work in IM-6.7.0-9\n and earlier because of a missing \"else\".",
" 8: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), adaptive\n filtering. Unused prior to IM-6.7.0-10, was same as 6",
" 9: Z_RLE strategy (or Z_HUFFMAN_ONLY if quality < 10), no PNG filters\n Unused prior to IM-6.7.0-10, was same as 6",
" Note that using the -quality option, not all combinations of\n PNG filter type, zlib compression level, and zlib compression\n strategy are possible. This is addressed by using\n \"-define png:compression-strategy\", etc., which takes precedence\n over -quality.",
" */",
" quality=image_info->quality == UndefinedCompressionQuality ? 75UL :\n image_info->quality;",
" if (quality <= 9)\n {\n if (mng_info->write_png_compression_strategy == 0)\n mng_info->write_png_compression_strategy = Z_HUFFMAN_ONLY+1;\n }",
" else if (mng_info->write_png_compression_level == 0)\n {\n int\n level;",
" level=(int) MagickMin((ssize_t) quality/10,9);",
" mng_info->write_png_compression_level = level+1;\n }",
" if (mng_info->write_png_compression_strategy == 0)\n {\n if ((quality %10) == 8 || (quality %10) == 9)\n#ifdef Z_RLE /* Z_RLE was added to zlib-1.2.0 */\n mng_info->write_png_compression_strategy=Z_RLE+1;\n#else\n mng_info->write_png_compression_strategy = Z_DEFAULT_STRATEGY+1;\n#endif\n }",
" if (mng_info->write_png_compression_filter == 0)\n mng_info->write_png_compression_filter=((int) quality % 10) + 1;",
" if (logging != MagickFalse)\n {\n if (mng_info->write_png_compression_level)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression level: %d\",\n (int) mng_info->write_png_compression_level-1);",
" if (mng_info->write_png_compression_strategy)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Compression strategy: %d\",\n (int) mng_info->write_png_compression_strategy-1);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up filtering\");",
" if (mng_info->write_png_compression_filter == 6)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: ADAPTIVE\");\n else if (mng_info->write_png_compression_filter == 0 ||\n mng_info->write_png_compression_filter == 1)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: NONE\");\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Base filter method: %d\",\n (int) mng_info->write_png_compression_filter-1);\n }",
" if (mng_info->write_png_compression_level != 0)\n png_set_compression_level(ping,mng_info->write_png_compression_level-1);",
" if (mng_info->write_png_compression_filter == 6)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) ||\n (quality < 50))\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n else\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);\n }",
" else if (mng_info->write_png_compression_filter == 7 ||\n mng_info->write_png_compression_filter == 10)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_ALL_FILTERS);",
" else if (mng_info->write_png_compression_filter == 8)\n {\n#if defined(PNG_MNG_FEATURES_SUPPORTED) && defined(PNG_INTRAPIXEL_DIFFERENCING)\n if (mng_info->write_mng)\n {\n if (((int) ping_color_type == PNG_COLOR_TYPE_RGB) ||\n ((int) ping_color_type == PNG_COLOR_TYPE_RGBA))\n ping_filter_method=PNG_INTRAPIXEL_DIFFERENCING;\n }\n#endif\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);\n }",
" else if (mng_info->write_png_compression_filter == 9)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);",
" else if (mng_info->write_png_compression_filter != 0)\n png_set_filter(ping,PNG_FILTER_TYPE_BASE,\n mng_info->write_png_compression_filter-1);",
" if (mng_info->write_png_compression_strategy != 0)\n png_set_compression_strategy(ping,\n mng_info->write_png_compression_strategy-1);",
" ping_interlace_method=image_info->interlace != NoInterlace;",
" if (mng_info->write_mng)\n png_set_sig_bytes(ping,8);",
" /* Bail out if cannot meet defined png:bit-depth or png:color-type */",
" if (mng_info->write_png_colortype != 0)\n {\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY)\n if (ping_have_color != MagickFalse)\n {\n ping_color_type = PNG_COLOR_TYPE_RGB;",
" if (ping_bit_depth < 8)\n ping_bit_depth=8;\n }",
" if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_GRAY_ALPHA)\n if (ping_have_color != MagickFalse)\n ping_color_type = PNG_COLOR_TYPE_RGB_ALPHA;\n }",
" if (ping_need_colortype_warning != MagickFalse ||\n ((mng_info->write_png_depth &&\n (int) mng_info->write_png_depth != ping_bit_depth) ||\n (mng_info->write_png_colortype &&\n ((int) mng_info->write_png_colortype-1 != ping_color_type &&\n mng_info->write_png_colortype != 7 &&\n !(mng_info->write_png_colortype == 5 && ping_color_type == 0)))))\n {\n if (logging != MagickFalse)\n {\n if (ping_need_colortype_warning != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Image has transparency but tRNS chunk was excluded\");\n }",
" if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth=%u, Computed depth=%u\",\n mng_info->write_png_depth,\n ping_bit_depth);\n }",
" if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type=%u, Computed color type=%u\",\n mng_info->write_png_colortype-1,\n ping_color_type);\n }\n }",
" png_warning(ping,\n \"Cannot write image with defined png:bit-depth or png:color-type.\");\n }",
" if (image_matte != MagickFalse && image->matte == MagickFalse)\n {\n /* Add an opaque matte channel */\n image->matte = MagickTrue;\n (void) SetImageOpacity(image,0);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Added an opaque matte channel\");\n }",
" if (number_transparent != 0 || number_semitransparent != 0)\n {\n if (ping_color_type < 4)\n {\n ping_have_tRNS=MagickTrue;\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting ping_have_tRNS=MagickTrue.\");\n }\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG header chunks\");",
" png_set_IHDR(ping,ping_info,ping_width,ping_height,\n ping_bit_depth,ping_color_type,\n ping_interlace_method,ping_compression_method,\n ping_filter_method);",
" if (ping_color_type == 3 && ping_have_PLTE != MagickFalse)\n {\n if (mng_info->have_write_global_plte && matte == MagickFalse)\n {\n png_set_PLTE(ping,ping_info,NULL,0);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up empty PLTE chunk\");\n }",
" else\n png_set_PLTE(ping,ping_info,palette,number_colors);",
" if (logging != MagickFalse)\n {\n for (i=0; i< (ssize_t) number_colors; i++)\n {\n if (i < ping_num_trans)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d), tRNS[%d] = (%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue,\n (int) i,\n (int) ping_trans_alpha[i]);\n else\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PLTE[%d] = (%d,%d,%d)\",\n (int) i,\n (int) palette[i].red,\n (int) palette[i].green,\n (int) palette[i].blue);\n }\n }\n }",
" /* Only write the iCCP chunk if we are not writing the sRGB chunk. */\n if (ping_exclude_sRGB != MagickFalse ||\n (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if ((ping_exclude_tEXt == MagickFalse ||\n ping_exclude_zTXt == MagickFalse) &&\n (ping_exclude_iCCP == MagickFalse || ping_exclude_zCCP == MagickFalse))\n {\n ResetImageProfileIterator(image);\n for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n profile=GetImageProfile(image,name);",
" if (profile != (StringInfo *) NULL)\n {\n#ifdef PNG_WRITE_iCCP_SUPPORTED\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {",
" if (ping_exclude_iCCP == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up iCCP chunk\");",
" png_set_iCCP(ping,ping_info,(const png_charp) name,0,\n#if (PNG_LIBPNG_VER < 10500)\n (png_charp) GetStringInfoDatum(profile),\n#else\n (const png_byte *) GetStringInfoDatum(profile),\n#endif\n (png_uint_32) GetStringInfoLength(profile));\n ping_have_iCCP = MagickTrue;\n }\n }",
" else\n#endif\n {\n if (LocaleCompare(name,\"exif\") == 0)\n {\n /* Do not write hex-encoded ICC chunk; we will\n write it later as an eXIf chunk */\n name=GetNextImageProfile(image);\n continue;\n }\n if (ping_exclude_zCCP == MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up zTXT chunk with uuencoded ICC\");\n Magick_png_write_raw_profile(image_info,ping,ping_info,\n (unsigned char *) name,(unsigned char *) name,\n GetStringInfoDatum(profile),\n (png_uint_32) GetStringInfoLength(profile));\n ping_have_iCCP = MagickTrue;\n }\n }\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up text chunk with %s profile\",name);",
" name=GetNextImageProfile(image);\n }\n }\n }",
"#if defined(PNG_WRITE_sRGB_SUPPORTED)\n if ((mng_info->have_write_global_srgb == 0) &&\n ping_have_iCCP != MagickTrue &&\n (ping_have_sRGB != MagickFalse ||\n png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n {\n if (ping_exclude_sRGB == MagickFalse)\n {\n /*\n Note image rendering intent.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up sRGB chunk\");",
" (void) png_set_sRGB(ping,ping_info,(\n Magick_RenderingIntent_to_PNG_RenderingIntent(\n image->rendering_intent)));",
" ping_have_sRGB = MagickTrue;\n }\n }",
" if ((!mng_info->write_mng) || (!png_get_valid(ping,ping_info,PNG_INFO_sRGB)))\n#endif\n {\n if (ping_exclude_gAMA == MagickFalse &&\n ping_have_iCCP == MagickFalse &&\n ping_have_sRGB == MagickFalse &&\n (ping_exclude_sRGB == MagickFalse ||\n (image->gamma < .45 || image->gamma > .46)))\n {\n if ((mng_info->have_write_global_gama == 0) && (image->gamma != 0.0))\n {\n /*\n Note image gamma.\n To do: check for cHRM+gAMA == sRGB, and write sRGB instead.\n */\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up gAMA chunk\");",
" png_set_gAMA(ping,ping_info,image->gamma);\n }\n }",
" if (ping_exclude_cHRM == MagickFalse && ping_have_sRGB == MagickFalse)\n {\n if ((mng_info->have_write_global_chrm == 0) &&\n (image->chromaticity.red_primary.x != 0.0))\n {\n /*\n Note image chromaticity.\n Note: if cHRM+gAMA == sRGB write sRGB instead.\n */\n PrimaryInfo\n bp,\n gp,\n rp,\n wp;",
" wp=image->chromaticity.white_point;\n rp=image->chromaticity.red_primary;\n gp=image->chromaticity.green_primary;\n bp=image->chromaticity.blue_primary;",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up cHRM chunk\");",
" png_set_cHRM(ping,ping_info,wp.x,wp.y,rp.x,rp.y,gp.x,gp.y,\n bp.x,bp.y);\n }\n }\n }",
"\n if (ping_exclude_bKGD == MagickFalse)\n {\n if (ping_have_bKGD != MagickFalse)\n {\n png_set_bKGD(ping,ping_info,&ping_background);\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up bKGD chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" background color = (%d,%d,%d)\",\n (int) ping_background.red,\n (int) ping_background.green,\n (int) ping_background.blue);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" index = %d, gray=%d\",\n (int) ping_background.index,\n (int) ping_background.gray);\n }\n }\n }",
" if (ping_exclude_pHYs == MagickFalse)\n {\n if (ping_have_pHYs != MagickFalse)\n {\n png_set_pHYs(ping,ping_info,\n ping_pHYs_x_resolution,\n ping_pHYs_y_resolution,\n ping_pHYs_unit_type);",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up pHYs chunk\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" x_resolution=%lu\",\n (unsigned long) ping_pHYs_x_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" y_resolution=%lu\",\n (unsigned long) ping_pHYs_y_resolution);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" unit_type=%lu\",\n (unsigned long) ping_pHYs_unit_type);\n }\n }\n }",
"#if defined(PNG_tIME_SUPPORTED)\n if (ping_exclude_tIME == MagickFalse)\n {\n const char\n *timestamp;",
" if (image->taint == MagickFalse)\n {\n timestamp=GetImageOption(image_info,\"png:tIME\");",
" if (timestamp == (const char *) NULL)\n timestamp=GetImageProperty(image,\"png:tIME\");\n }",
" else\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reset tIME in tainted image\");\n timestamp=GetImageProperty(image,\"date:modify\");\n }",
" if (timestamp != (const char *) NULL)\n write_tIME_chunk(image,ping,ping_info,timestamp);\n }\n#endif",
" if (mng_info->need_blob != MagickFalse)\n {\n if (OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception) ==\n MagickFalse)\n png_error(ping,\"WriteBlob Failed\");",
" ping_have_blob=MagickTrue;\n (void) ping_have_blob;\n }",
" png_write_info_before_PLTE(ping, ping_info);",
" if (ping_have_tRNS != MagickFalse && ping_color_type < 4)\n {\n if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Calling png_set_tRNS with num_trans=%d\",ping_num_trans);\n }",
" if (ping_color_type == 3)\n (void) png_set_tRNS(ping, ping_info,\n ping_trans_alpha,\n ping_num_trans,\n NULL);",
" else\n {\n (void) png_set_tRNS(ping, ping_info,\n NULL,\n 0,\n &ping_trans_color);",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" tRNS color =(%d,%d,%d)\",\n (int) ping_trans_color.red,\n (int) ping_trans_color.green,\n (int) ping_trans_color.blue);\n }\n }\n }",
" png_write_info(ping,ping_info);",
" ping_wrote_caNv = MagickFalse;",
" /* write caNv chunk */\n if (ping_exclude_caNv == MagickFalse)\n {\n if ((image->page.width != 0 && image->page.width != image->columns) ||\n (image->page.height != 0 && image->page.height != image->rows) ||\n image->page.x != 0 || image->page.y != 0)\n {\n unsigned char\n chunk[20];",
" (void) WriteBlobMSBULong(image,16L); /* data length=8 */\n PNGType(chunk,mng_caNv);\n LogPNGChunk(logging,mng_caNv,16L);\n PNGLong(chunk+4,(png_uint_32) image->page.width);\n PNGLong(chunk+8,(png_uint_32) image->page.height);\n PNGsLong(chunk+12,(png_int_32) image->page.x);\n PNGsLong(chunk+16,(png_int_32) image->page.y);\n (void) WriteBlob(image,20,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,20));\n ping_wrote_caNv = MagickTrue;\n }\n }",
"#if defined(PNG_oFFs_SUPPORTED)\n if (ping_exclude_oFFs == MagickFalse && ping_wrote_caNv == MagickFalse)\n {\n if (image->page.x || image->page.y)\n {\n png_set_oFFs(ping,ping_info,(png_int_32) image->page.x,\n (png_int_32) image->page.y, 0);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up oFFs chunk with x=%d, y=%d, units=0\",\n (int) image->page.x, (int) image->page.y);\n }\n }\n#endif",
"#if (PNG_LIBPNG_VER == 10206)\n /* avoid libpng-1.2.6 bug by setting PNG_HAVE_IDAT flag */\n#define PNG_HAVE_IDAT 0x04\n ping->mode |= PNG_HAVE_IDAT;\n#undef PNG_HAVE_IDAT\n#endif",
" png_set_packing(ping);\n /*\n Allocate memory.\n */\n rowbytes=image->columns;\n if (image_depth > 8)\n rowbytes*=2;\n switch (ping_color_type)\n {\n case PNG_COLOR_TYPE_RGB:\n rowbytes*=3;\n break;",
" case PNG_COLOR_TYPE_GRAY_ALPHA:\n rowbytes*=2;\n break;",
" case PNG_COLOR_TYPE_RGBA:\n rowbytes*=4;\n break;",
" default:\n break;\n }",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG image data\");",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Allocating %.20g bytes of memory for pixels\",(double) rowbytes);\n }\n pixel_info=AcquireVirtualMemory(rowbytes,sizeof(*ping_pixels));\n if (pixel_info == (MemoryInfo *) NULL)\n png_error(ping,\"Allocation of memory for pixels failed\");\n ping_pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n /*\n Initialize image scanlines.\n */\n quantum_info=AcquireQuantumInfo(image_info,image);\n if (quantum_info == (QuantumInfo *) NULL)\n png_error(ping,\"Memory allocation for quantum_info failed\");\n quantum_info->format=UndefinedQuantumFormat;\n SetQuantumDepth(image,quantum_info,image_depth);\n (void) SetQuantumEndian(image,quantum_info,MSBEndian);\n num_passes=png_set_interlace_handling(ping);",
" if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) &&\n (mng_info->IsPalette ||\n (image_info->type == BilevelType)) &&\n image_matte == MagickFalse &&\n ping_have_non_bw == MagickFalse)\n {\n /* Palette, Bilevel, or Opaque Monochrome */\n register const PixelPacket\n *p;",
" SetQuantumDepth(image,quantum_info,8);\n for (pass=0; pass < num_passes; pass++)\n {\n /*\n Convert PseudoClass image to a PNG monochrome image.\n */\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (0)\");",
" p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);",
" if (p == (const PixelPacket *) NULL)\n break;",
" if (mng_info->IsPalette)\n {\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,&image->exception);\n if (mng_info->write_png_colortype-1 == PNG_COLOR_TYPE_PALETTE &&\n mng_info->write_png_depth &&\n mng_info->write_png_depth != old_bit_depth)\n {\n /* Undo pixel scaling */\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) (*(ping_pixels+i)\n >> (8-old_bit_depth));\n }\n }",
" else\n {\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,&image->exception);\n }",
" if (mng_info->write_png_colortype-1 != PNG_COLOR_TYPE_PALETTE)\n for (i=0; i < (ssize_t) image->columns; i++)\n *(ping_pixels+i)=(unsigned char) ((*(ping_pixels+i) > 127) ?\n 255 : 0);",
" if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (1)\");",
" png_write_row(ping,ping_pixels);",
" status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }",
" else /* Not Palette, Bilevel, or Opaque Monochrome */\n {\n if ((!mng_info->write_png8 && !mng_info->write_png24 &&\n !mng_info->write_png48 && !mng_info->write_png64 &&\n !mng_info->write_png32) && (image_matte != MagickFalse ||\n (ping_bit_depth >= MAGICKCORE_QUANTUM_DEPTH)) &&\n (mng_info->IsPalette) && ping_have_color == MagickFalse)\n {\n register const PixelPacket\n *p;",
" for (pass=0; pass < num_passes; pass++)\n {",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);",
" if (p == (const PixelPacket *) NULL)\n break;",
" if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (mng_info->IsPalette)\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,&image->exception);",
" else\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,&image->exception);",
" if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY PNG pixels (2)\");\n }",
" else /* PNG_COLOR_TYPE_GRAY_ALPHA */\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (2)\");",
" (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,&image->exception);\n }",
" if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (2)\");",
" png_write_row(ping,ping_pixels);",
" status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }",
" else\n {\n register const PixelPacket\n *p;",
" for (pass=0; pass < num_passes; pass++)\n {\n if ((image_depth > 8) ||\n mng_info->write_png24 ||\n mng_info->write_png32 ||\n mng_info->write_png48 ||\n mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n {\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,\n &image->exception);",
" if (p == (const PixelPacket *) NULL)\n break;",
" if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n if (image->storage_class == DirectClass)\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RedQuantum,ping_pixels,&image->exception);",
" else\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,&image->exception);\n }",
" else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n &image->exception);",
" if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (3)\");\n }",
" else if (image_matte != MagickFalse)\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RGBAQuantum,ping_pixels,&image->exception);",
" else\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,RGBQuantum,ping_pixels,&image->exception);",
" if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of pixels (3)\");",
" png_write_row(ping,ping_pixels);",
" status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n if (status == MagickFalse)\n break;\n }\n }",
" else\n /* not ((image_depth > 8) ||\n mng_info->write_png24 || mng_info->write_png32 ||\n mng_info->write_png48 || mng_info->write_png64 ||\n (!mng_info->write_png8 && !mng_info->IsPalette))\n */\n {\n if ((ping_color_type != PNG_COLOR_TYPE_GRAY) &&\n (ping_color_type != PNG_COLOR_TYPE_GRAY_ALPHA))\n {\n if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is not GRAY or GRAY_ALPHA\",pass);",
" SetQuantumDepth(image,quantum_info,8);\n image_depth=8;\n }",
" for (y=0; y < (ssize_t) image->rows; y++)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" pass %d, Image Is RGB, 16-bit GRAY, or GRAY_ALPHA\",pass);",
" p=GetVirtualPixels(image,0,y,image->columns,1,\n &image->exception);",
" if (p == (const PixelPacket *) NULL)\n break;",
" if (ping_color_type == PNG_COLOR_TYPE_GRAY)\n {\n SetQuantumDepth(image,quantum_info,image->depth);",
" (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayQuantum,ping_pixels,&image->exception);\n }",
" else if (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)\n {\n if (logging != MagickFalse && y == 0)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GRAY_ALPHA PNG pixels (4)\");",
" (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,GrayAlphaQuantum,ping_pixels,\n &image->exception);\n }",
" else\n {\n (void) ExportQuantumPixels(image,(const CacheView *) NULL,\n quantum_info,IndexQuantum,ping_pixels,&image->exception);",
" if (logging != MagickFalse && y <= 2)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing row of non-gray pixels (4)\");",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" ping_pixels[0]=%d,ping_pixels[1]=%d\",\n (int)ping_pixels[0],(int)ping_pixels[1]);\n }\n }\n png_write_row(ping,ping_pixels);",
" status=SetImageProgress(image,SaveImageTag,\n (MagickOffsetType) (pass * image->rows + y),\n num_passes * image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n }\n }\n }",
" if (quantum_info != (QuantumInfo *) NULL)\n quantum_info=DestroyQuantumInfo(quantum_info);",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Wrote PNG image data\");",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Width: %.20g\",(double) ping_width);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Height: %.20g\",(double) ping_height);",
" if (mng_info->write_png_depth)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:bit-depth: %d\",mng_info->write_png_depth);\n }",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG bit-depth written: %d\",ping_bit_depth);",
" if (mng_info->write_png_colortype)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Defined png:color-type: %d\",mng_info->write_png_colortype-1);\n }",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG color-type written: %d\",ping_color_type);",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" PNG Interlace method: %d\",ping_interlace_method);\n }\n /*\n Generate text chunks after IDAT.\n */\n if (ping_exclude_tEXt == MagickFalse || ping_exclude_zTXt == MagickFalse)\n {\n ResetImagePropertyIterator(image);\n property=GetNextImageProperty(image);\n while (property != (const char *) NULL)\n {\n png_textp\n text;",
" value=GetImageProperty(image,property);",
" /* Don't write any \"png:\" or \"jpeg:\" properties; those are just for\n * \"identify\" or for passing through to another JPEG\n */\n if ((LocaleNCompare(property,\"png:\",4) != 0 &&\n LocaleNCompare(property,\"jpeg:\",5) != 0) &&",
" /* Suppress density and units if we wrote a pHYs chunk */\n (ping_exclude_pHYs != MagickFalse ||\n LocaleCompare(property,\"density\") != 0 ||\n LocaleCompare(property,\"units\") != 0) &&",
" /* Suppress the IM-generated Date:create and Date:modify */\n (ping_exclude_date == MagickFalse ||\n LocaleNCompare(property, \"Date:\",5) != 0))\n {\n if (value != (const char *) NULL)\n {",
"#if PNG_LIBPNG_VER >= 10400\n text=(png_textp) png_malloc(ping,\n (png_alloc_size_t) sizeof(png_text));\n#else\n text=(png_textp) png_malloc(ping,(png_size_t) sizeof(png_text));\n#endif\n text[0].key=(char *) property;\n text[0].text=(char *) value;\n text[0].text_length=strlen(value);",
" if (ping_exclude_tEXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_zTXt;",
" else if (ping_exclude_zTXt != MagickFalse)\n text[0].compression=PNG_TEXT_COMPRESSION_NONE;",
" else\n {\n text[0].compression=image_info->compression == NoCompression ||\n (image_info->compression == UndefinedCompression &&\n text[0].text_length < 128) ? PNG_TEXT_COMPRESSION_NONE :\n PNG_TEXT_COMPRESSION_zTXt ;\n }",
" if (logging != MagickFalse)\n {\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Setting up text chunk\");",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" keyword: '%s'\",text[0].key);\n }",
" png_set_text(ping,ping_info,text,1);\n png_free(ping,text);\n }\n }\n property=GetNextImageProperty(image);\n }\n }",
" /* write eXIf profile */\n if (ping_have_eXIf != MagickFalse && ping_exclude_eXIf == MagickFalse)\n {\n char\n *name;",
" ResetImageProfileIterator(image);",
" for (name=GetNextImageProfile(image); name != (const char *) NULL; )\n {\n if (LocaleCompare(name,\"exif\") == 0)\n {\n const StringInfo\n *profile;",
" profile=GetImageProfile(image,name);",
" if (profile != (StringInfo *) NULL)\n {\n png_uint_32\n length;\n unsigned char\n chunk[4],\n *data;",
" StringInfo\n *ping_profile;",
" (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Have eXIf profile\");",
" ping_profile=CloneStringInfo(profile);\n data=GetStringInfoDatum(ping_profile),",
" length=(png_uint_32) GetStringInfoLength(ping_profile);",
" PNGType(chunk,mng_eXIf);\n if (length < 7)\n {\n ping_profile=DestroyStringInfo(ping_profile);\n break; /* otherwise crashes */\n }",
" if (*data == 'E' && *(data+1) == 'x' && *(data+2) == 'i' &&\n *(data+3) == 'f' && *(data+4) == '\\0' && *(data+5) == '\\0')\n {\n /* skip the \"Exif\\0\\0\" JFIF Exif Header ID */\n length -= 6;\n data += 6;\n }",
" LogPNGChunk(logging,chunk,length);\n (void) WriteBlobMSBULong(image,length);\n (void) WriteBlob(image,4,chunk);\n (void) WriteBlob(image,length,data);\n (void) WriteBlobMSBULong(image,crc32(crc32(0,chunk,4), data,\n (uInt) length));\n ping_profile=DestroyStringInfo(ping_profile);\n break;\n }\n }\n name=GetNextImageProfile(image);\n }\n }",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing PNG end info\");",
" png_write_end(ping,ping_info);",
" if (mng_info->need_fram && (int) image->dispose == BackgroundDispose)\n {\n if (mng_info->page.x || mng_info->page.y ||\n (ping_width != mng_info->page.width) ||\n (ping_height != mng_info->page.height))\n {\n unsigned char\n chunk[32];",
" /*\n Write FRAM 4 with clipping boundaries followed by FRAM 1.\n */\n (void) WriteBlobMSBULong(image,27L); /* data length=27 */\n PNGType(chunk,mng_FRAM);\n LogPNGChunk(logging,mng_FRAM,27L);\n chunk[4]=4;\n chunk[5]=0; /* frame name separator (no name) */\n chunk[6]=1; /* flag for changing delay, for next frame only */\n chunk[7]=0; /* flag for changing frame timeout */\n chunk[8]=1; /* flag for changing frame clipping for next frame */\n chunk[9]=0; /* flag for changing frame sync_id */\n PNGLong(chunk+10,(png_uint_32) (0L)); /* temporary 0 delay */\n chunk[14]=0; /* clipping boundaries delta type */\n PNGLong(chunk+15,(png_uint_32) (mng_info->page.x)); /* left cb */\n PNGLong(chunk+19,\n (png_uint_32) (mng_info->page.x + ping_width));\n PNGLong(chunk+23,(png_uint_32) (mng_info->page.y)); /* top cb */\n PNGLong(chunk+27,\n (png_uint_32) (mng_info->page.y + ping_height));\n (void) WriteBlob(image,31,chunk);\n (void) WriteBlobMSBULong(image,crc32(0,chunk,31));\n mng_info->old_framing_mode=4;\n mng_info->framing_mode=1;\n }",
" else\n mng_info->framing_mode=3;\n }\n if (mng_info->write_mng && !mng_info->need_fram &&\n ((int) image->dispose == 3))\n png_error(ping, \"Cannot convert GIF with disposal method 3 to MNG-LC\");",
" /*\n Free PNG resources.\n */",
" png_destroy_write_struct(&ping,&ping_info);",
" pixel_info=RelinquishVirtualMemory(pixel_info);",
" /* Store bit depth actually written */\n s[0]=(char) ping_bit_depth;\n s[1]='\\0';",
" (void) SetImageProperty(image,\"png:bit-depth-written\",s);",
" if (logging != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" exit WriteOnePNGImage()\");",
"#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE\n UnlockSemaphoreInfo(ping_semaphore);\n#endif",
" /* } for navigation to beginning of SETJMP-protected block. Revert to\n * Throwing an Exception when an error occurs.\n */",
" return(MagickTrue);\n/* End write one PNG image */",
"}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-16749",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-16749/",
"CWE ID": "CWE-617",
"codeLink": "https://github.com/ImageMagick/ImageMagick6/commit/1007b98f8795ad4bea6bc5f68a32d83e982fdae4",
"commit_id": "1007b98f8795ad4bea6bc5f68a32d83e982fdae4",
"commit_message": "https://github.com/ImageMagick/ImageMagick/issues/1119",
"lang": "C",
"project": "ImageMagick6"
}
| 25
|
Determine whether the code is vulnerable or not.
|
[
"v8::Handle<v8::Value> V8WebGLRenderingContext::uniformMatrix2fvCallback(const v8::Arguments& args)\n{\n INC_STATS(\"DOM.WebGLRenderingContext.uniformMatrix2fv()\");\n return uniformMatrixHelper(args, 2);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-3055",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-3055/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/e9372a1bfd3588a80fcf49aa07321f0971dd6091",
"commit_id": "e9372a1bfd3588a80fcf49aa07321f0971dd6091",
"commit_message": "[V8] Pass Isolate to throwNotEnoughArgumentsError()\nhttps://bugs.webkit.org/show_bug.cgi?id=86983\n\nReviewed by Adam Barth.\n\nThe objective is to pass Isolate around in V8 bindings.\nThis patch passes Isolate to throwNotEnoughArgumentsError().\n\nNo tests. No change in behavior.\n\n* bindings/scripts/CodeGeneratorV8.pm:\n(GenerateArgumentsCountCheck):\n(GenerateEventConstructorCallback):\n* bindings/scripts/test/V8/V8Float64Array.cpp:\n(WebCore::Float64ArrayV8Internal::fooCallback):\n* bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:\n(WebCore::TestActiveDOMObjectV8Internal::excitingFunctionCallback):\n(WebCore::TestActiveDOMObjectV8Internal::postMessageCallback):\n* bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:\n(WebCore::TestCustomNamedGetterV8Internal::anotherFunctionCallback):\n* bindings/scripts/test/V8/V8TestEventConstructor.cpp:\n(WebCore::V8TestEventConstructor::constructorCallback):\n* bindings/scripts/test/V8/V8TestEventTarget.cpp:\n(WebCore::TestEventTargetV8Internal::itemCallback):\n(WebCore::TestEventTargetV8Internal::dispatchEventCallback):\n* bindings/scripts/test/V8/V8TestInterface.cpp:\n(WebCore::TestInterfaceV8Internal::supplementalMethod2Callback):\n(WebCore::V8TestInterface::constructorCallback):\n* bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:\n(WebCore::TestMediaQueryListListenerV8Internal::methodCallback):\n* bindings/scripts/test/V8/V8TestNamedConstructor.cpp:\n(WebCore::V8TestNamedConstructorConstructorCallback):\n* bindings/scripts/test/V8/V8TestObj.cpp:\n(WebCore::TestObjV8Internal::voidMethodWithArgsCallback):\n(WebCore::TestObjV8Internal::intMethodWithArgsCallback):\n(WebCore::TestObjV8Internal::objMethodWithArgsCallback):\n(WebCore::TestObjV8Internal::methodWithSequenceArgCallback):\n(WebCore::TestObjV8Internal::methodReturningSequenceCallback):\n(WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback):\n(WebCore::TestObjV8Internal::serializedValueCallback):\n(WebCore::TestObjV8Internal::idbKeyCallback):\n(WebCore::TestObjV8Internal::optionsObjectCallback):\n(WebCore::TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgCallback):\n(WebCore::TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsCallback):\n(WebCore::TestObjV8Internal::methodWithCallbackArgCallback):\n(WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback):\n(WebCore::TestObjV8Internal::overloadedMethod1Callback):\n(WebCore::TestObjV8Internal::overloadedMethod2Callback):\n(WebCore::TestObjV8Internal::overloadedMethod3Callback):\n(WebCore::TestObjV8Internal::overloadedMethod4Callback):\n(WebCore::TestObjV8Internal::overloadedMethod5Callback):\n(WebCore::TestObjV8Internal::overloadedMethod6Callback):\n(WebCore::TestObjV8Internal::overloadedMethod7Callback):\n(WebCore::TestObjV8Internal::overloadedMethod11Callback):\n(WebCore::TestObjV8Internal::overloadedMethod12Callback):\n(WebCore::TestObjV8Internal::enabledAtRuntimeMethod1Callback):\n(WebCore::TestObjV8Internal::enabledAtRuntimeMethod2Callback):\n(WebCore::TestObjV8Internal::convert1Callback):\n(WebCore::TestObjV8Internal::convert2Callback):\n(WebCore::TestObjV8Internal::convert3Callback):\n(WebCore::TestObjV8Internal::convert4Callback):\n(WebCore::TestObjV8Internal::convert5Callback):\n(WebCore::TestObjV8Internal::strictFunctionCallback):\n(WebCore::V8TestObj::constructorCallback):\n* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:\n(WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback):\n(WebCore::V8TestSerializedScriptValueInterface::constructorCallback):\n* bindings/v8/ScriptController.cpp:\n(WebCore::setValueAndClosePopupCallback):\n* bindings/v8/V8Proxy.cpp:\n(WebCore::V8Proxy::throwNotEnoughArgumentsError):\n* bindings/v8/V8Proxy.h:\n(V8Proxy):\n* bindings/v8/custom/V8AudioContextCustom.cpp:\n(WebCore::V8AudioContext::constructorCallback):\n* bindings/v8/custom/V8DataViewCustom.cpp:\n(WebCore::V8DataView::getInt8Callback):\n(WebCore::V8DataView::getUint8Callback):\n(WebCore::V8DataView::setInt8Callback):\n(WebCore::V8DataView::setUint8Callback):\n* bindings/v8/custom/V8DirectoryEntryCustom.cpp:\n(WebCore::V8DirectoryEntry::getDirectoryCallback):\n(WebCore::V8DirectoryEntry::getFileCallback):\n* bindings/v8/custom/V8IntentConstructor.cpp:\n(WebCore::V8Intent::constructorCallback):\n* bindings/v8/custom/V8SVGLengthCustom.cpp:\n(WebCore::V8SVGLength::convertToSpecifiedUnitsCallback):\n* bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:\n(WebCore::getObjectParameter):\n(WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):\n(WebCore::V8WebGLRenderingContext::getExtensionCallback):\n(WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):\n(WebCore::V8WebGLRenderingContext::getParameterCallback):\n(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):\n(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):\n(WebCore::V8WebGLRenderingContext::getUniformCallback):\n(WebCore::vertexAttribAndUniformHelperf):\n(WebCore::uniformHelperi):\n(WebCore::uniformMatrixHelper):\n* bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:\n(WebCore::V8WebKitMutationObserver::constructorCallback):\n(WebCore::V8WebKitMutationObserver::observeCallback):\n* bindings/v8/custom/V8WebSocketCustom.cpp:\n(WebCore::V8WebSocket::constructorCallback):\n(WebCore::V8WebSocket::sendCallback):\n* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:\n(WebCore::V8XMLHttpRequest::openCallback):\n\n\ngit-svn-id: svn://svn.chromium.org/blink/trunk@117736 bbb929c8-8fbe-4397-9dbb-9b2b20218538",
"lang": "C",
"project": "Chrome"
}
| 26
|
Determine whether the code is vulnerable or not.
|
[
"static int decode_putfh(struct xdr_stream *xdr)\n{\n\treturn decode_op_hdr(xdr, OP_PUTFH);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-4324",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-4324/",
"CWE ID": null,
"codeLink": "https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9",
"commit_id": "dc0b027dfadfcb8a5504f7d8052754bf8d501ab9",
"commit_message": "NFSv4: Convert the open and close ops to use fmode\n\nSigned-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>",
"lang": "C",
"project": "linux"
}
| 27
|
Determine whether the code is vulnerable or not.
|
[
"xsltCheckExtURI(xsltStylesheetPtr style, const xmlChar * URI)\n{\n xsltExtDefPtr cur;",
" if ((style == NULL) || (style->nsDefs == NULL))\n return (0);\n if (URI == NULL)\n return (0);\n cur = (xsltExtDefPtr) style->nsDefs;\n while (cur != NULL) {\n if (xmlStrEqual(URI, cur->URI))\n return (1);\n cur = cur->next;\n }\n return (0);\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-1683",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-1683/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab",
"commit_id": "96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab",
"commit_message": "Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7\n\nBUG=583156,583171\n\nReview URL: https://codereview.chromium.org/1853083002\n\nCr-Commit-Position: refs/heads/master@{#385338}",
"lang": "C",
"project": "Chrome"
}
| 28
|
Determine whether the code is vulnerable or not.
|
[
"static int bpf_obj_get(const union bpf_attr *attr)\n{\n\tif (CHECK_ATTR(BPF_OBJ) || attr->bpf_fd != 0)\n\t\treturn -EINVAL;",
"\treturn bpf_obj_get_user(u64_to_ptr(attr->pathname));\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-4558",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-4558/",
"CWE ID": null,
"codeLink": "https://github.com/torvalds/linux/commit/92117d8443bc5afacc8d5ba82e541946310f106e",
"commit_id": "92117d8443bc5afacc8d5ba82e541946310f106e",
"commit_message": "bpf: fix refcnt overflow\n\nOn a system with >32Gbyte of phyiscal memory and infinite RLIMIT_MEMLOCK,\nthe malicious application may overflow 32-bit bpf program refcnt.\nIt's also possible to overflow map refcnt on 1Tb system.\nImpose 32k hard limit which means that the same bpf program or\nmap cannot be shared by more than 32k processes.\n\nFixes: 1be7f75d1668 (\"bpf: enable non-root eBPF programs\")\nReported-by: Jann Horn <jannh@google.com>\nSigned-off-by: Alexei Starovoitov <ast@kernel.org>\nAcked-by: Daniel Borkmann <daniel@iogearbox.net>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
"lang": "C",
"project": "linux"
}
| 29
|
Determine whether the code is vulnerable or not.
|
[
"bool IsLoaderInterceptionEnabled() {\n return base::FeatureList::IsEnabled(network::features::kNetworkService) ||\n blink::ServiceWorkerUtils::IsServicificationEnabled() ||\n signed_exchange_utils::IsSignedExchangeHandlingEnabled();\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-20068",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-20068/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/chromium/chromium/commit/4f8104c528f0147c7527718d5aa7c9c38c8220d0",
"commit_id": "4f8104c528f0147c7527718d5aa7c9c38c8220d0",
"commit_message": "Abort navigations on 304 responses.\n\nA recent change (https://chromium-review.googlesource.com/1161479)\naccidentally resulted in treating 304 responses as downloads. This CL\ntreats them as ERR_ABORTED instead. This doesn't exactly match old\nbehavior, which passed them on to the renderer, which then aborted them.\n\nThe new code results in correctly restoring the original URL in the\nomnibox, and has a shiny new test to prevent future regressions.\n\nBug: 882270\nChange-Id: Ic73dcce9e9596d43327b13acde03b4ed9bd0c82e\nReviewed-on: https://chromium-review.googlesource.com/1252684\nCommit-Queue: Matt Menke <mmenke@chromium.org>\nReviewed-by: Camille Lamy <clamy@chromium.org>\nCr-Commit-Position: refs/heads/master@{#595641}",
"lang": "C",
"project": "Chrome"
}
| 30
|
Determine whether the code is vulnerable or not.
|
[
"check_switch(int firstcode)\n{\n\treturn (firstcode == SWFACTION_PUSH || firstcode == SWFACTION_JUMP);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2019-12982",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2019-12982/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/libming/libming/pull/179/commits/2be22fcf56a223dafe8de0e8a20fe20e8bbdb0b9",
"commit_id": "2be22fcf56a223dafe8de0e8a20fe20e8bbdb0b9",
"commit_message": "decompileAction: Prevent heap buffer overflow and underflow with using OpCode",
"lang": "C",
"project": "libming"
}
| 31
|
Determine whether the code is vulnerable or not.
|
[
"xmlParse3986URI(xmlURIPtr uri, const char *str) {\n int ret;",
" ret = xmlParse3986Scheme(uri, &str);\n if (ret != 0) return(ret);\n if (*str != ':') {\n return(1);\n }\n str++;\n ret = xmlParse3986HierPart(uri, &str);\n if (ret != 0) return(ret);\n if (*str == '?') {\n\tstr++;\n\tret = xmlParse3986Query(uri, &str);\n if (ret != 0) return(ret);\n }\n if (*str == '#') {\n\tstr++;\n\tret = xmlParse3986Fragment(uri, &str);\n if (ret != 0) return(ret);\n }\n if (*str != 0) {\n\txmlCleanURI(uri);\n return(1);\n }\n return(0);\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-7376",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-7376/",
"CWE ID": "CWE-119",
"codeLink": "https://android.googlesource.com/platform/external/libxml2/+/51e0cb2e5ec18eaf6fb331bc573ff27b743898f4",
"commit_id": "51e0cb2e5ec18eaf6fb331bc573ff27b743898f4",
"commit_message": "DO NOT MERGE: Use correct limit for port values\n\nno upstream report yet, add it here when we have it\nissue found & patch by nmehta@\n\nBug: 36555370\nChange-Id: Ibf1efea554b95f514e23e939363d608021de4614\n(cherry picked from commit b62884fb49fe92081e414966d9b5fe58250ae53c)\n",
"lang": "C",
"project": "Android"
}
| 32
|
Determine whether the code is vulnerable or not.
|
[
"static inline void assign_proto_idx(struct proto *prot)\n{\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-2136",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-2136/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/torvalds/linux/commit/cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc",
"commit_id": "cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc",
"commit_message": "net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()\n\nWe need to validate the number of pages consumed by data_len, otherwise frags\narray could be overflowed by userspace. So this patch validate data_len and\nreturn -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.\n\nSigned-off-by: Jason Wang <jasowang@redhat.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
"lang": "C",
"project": "linux"
}
| 33
|
Determine whether the code is vulnerable or not.
|
[
"static void intr_callback(struct urb *urb)\n{\n\tpegasus_t *pegasus = urb->context;\n\tstruct net_device *net;\n\tint res, status = urb->status;",
"\tif (!pegasus)\n\t\treturn;\n\tnet = pegasus->net;",
"\tswitch (status) {\n\tcase 0:\n\t\tbreak;\n\tcase -ECONNRESET:\t/* unlink */\n\tcase -ENOENT:\n\tcase -ESHUTDOWN:\n\t\treturn;\n\tdefault:\n\t\t/* some Pegasus-I products report LOTS of data\n\t\t * toggle errors... avoid log spamming\n\t\t */\n\t\tnetif_dbg(pegasus, timer, net, \"intr status %d\\n\", status);\n\t}",
"\tif (urb->actual_length >= 6) {\n\t\tu8 *d = urb->transfer_buffer;",
"\t\t/* byte 0 == tx_status1, reg 2B */\n\t\tif (d[0] & (TX_UNDERRUN|EXCESSIVE_COL\n\t\t\t\t\t|LATE_COL|JABBER_TIMEOUT)) {\n\t\t\tpegasus->stats.tx_errors++;\n\t\t\tif (d[0] & TX_UNDERRUN)\n\t\t\t\tpegasus->stats.tx_fifo_errors++;\n\t\t\tif (d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT))\n\t\t\t\tpegasus->stats.tx_aborted_errors++;\n\t\t\tif (d[0] & LATE_COL)\n\t\t\t\tpegasus->stats.tx_window_errors++;\n\t\t}",
"\t\t/* d[5].LINK_STATUS lies on some adapters.\n\t\t * d[0].NO_CARRIER kicks in only with failed TX.\n\t\t * ... so monitoring with MII may be safest.\n\t\t */",
"\t\t/* bytes 3-4 == rx_lostpkt, reg 2E/2F */\n\t\tpegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];\n\t}",
"\tres = usb_submit_urb(urb, GFP_ATOMIC);\n\tif (res == -ENODEV)\n\t\tnetif_device_detach(pegasus->net);\n\tif (res)\n\t\tnetif_err(pegasus, timer, net,\n\t\t\t \"can't resubmit interrupt urb, %d\\n\", res);\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-8068",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-8068/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/torvalds/linux/commit/5593523f968bc86d42a035c6df47d5e0979b5ace",
"commit_id": "5593523f968bc86d42a035c6df47d5e0979b5ace",
"commit_message": "pegasus: Use heap buffers for all register access\n\nAllocating USB buffers on the stack is not portable, and no longer\nworks on x86_64 (with VMAP_STACK enabled as per default).\n\nFixes: 1da177e4c3f4 (\"Linux-2.6.12-rc2\")\nReferences: https://bugs.debian.org/852556\nReported-by: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>\nTested-by: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>\nSigned-off-by: Ben Hutchings <ben@decadent.org.uk>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
"lang": "C",
"project": "linux"
}
| 34
|
Determine whether the code is vulnerable or not.
|
[
"ProcXvPutImage(ClientPtr client)\n{\n DrawablePtr pDraw;\n XvPortPtr pPort;\n XvImagePtr pImage = NULL;\n GCPtr pGC;\n int status, i, size;\n CARD16 width, height;",
" REQUEST(xvPutImageReq);\n REQUEST_AT_LEAST_SIZE(xvPutImageReq);",
" VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);\n VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);",
" if (!(pPort->pAdaptor->type & XvImageMask) ||\n !(pPort->pAdaptor->type & XvInputMask)) {\n client->errorValue = stuff->port;\n return BadMatch;\n }",
" status = XvdiMatchPort(pPort, pDraw);\n if (status != Success) {\n return status;\n }",
" for (i = 0; i < pPort->pAdaptor->nImages; i++) {\n if (pPort->pAdaptor->pImages[i].id == stuff->id) {\n pImage = &(pPort->pAdaptor->pImages[i]);\n break;\n }\n }",
" if (!pImage)\n return BadMatch;",
" width = stuff->width;\n height = stuff->height;\n size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width,\n &height, NULL, NULL);\n size += sizeof(xvPutImageReq);\n size = bytes_to_int32(size);",
" if ((width < stuff->width) || (height < stuff->height))\n return BadValue;",
" if (client->req_len < size)\n return BadLength;",
" return XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,\n stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y,\n stuff->drw_w, stuff->drw_h, pImage,\n (unsigned char *) (&stuff[1]), FALSE,\n stuff->width, stuff->height);\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-12187",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-12187/",
"CWE ID": "CWE-20",
"codeLink": "https://cgit.freedesktop.org/xorg/xserver/commit/?id=cad5a1050b7184d828aef9c1dd151c3ab649d37e",
"commit_id": "cad5a1050b7184d828aef9c1dd151c3ab649d37e",
"commit_message": null,
"lang": "C",
"project": "xserver"
}
| 35
|
Determine whether the code is vulnerable or not.
|
[
"void bitmap_writer_finish(struct pack_idx_entry **index,\n\t\t\t uint32_t index_nr,\n\t\t\t const char *filename,\n\t\t\t uint16_t options)\n{\n\tstatic char tmp_file[PATH_MAX];\n\tstatic uint16_t default_version = 1;\n\tstatic uint16_t flags = BITMAP_OPT_FULL_DAG;\n\tstruct sha1file *f;",
"\tstruct bitmap_disk_header header;",
"\tint fd = odb_mkstemp(tmp_file, sizeof(tmp_file), \"pack/tmp_bitmap_XXXXXX\");",
"\tif (fd < 0)\n\t\tdie_errno(\"unable to create '%s'\", tmp_file);\n\tf = sha1fd(fd, tmp_file);",
"\tmemcpy(header.magic, BITMAP_IDX_SIGNATURE, sizeof(BITMAP_IDX_SIGNATURE));\n\theader.version = htons(default_version);\n\theader.options = htons(flags | options);\n\theader.entry_count = htonl(writer.selected_nr);\n\thashcpy(header.checksum, writer.pack_checksum);",
"\tsha1write(f, &header, sizeof(header));\n\tdump_bitmap(f, writer.commits);\n\tdump_bitmap(f, writer.trees);\n\tdump_bitmap(f, writer.blobs);\n\tdump_bitmap(f, writer.tags);\n\twrite_selected_commits_v1(f, index, index_nr);",
"\tif (options & BITMAP_OPT_HASH_CACHE)\n\t\twrite_hash_cache(f, index, index_nr);",
"\tsha1close(f, NULL, CSUM_FSYNC);",
"\tif (adjust_shared_perm(tmp_file))\n\t\tdie_errno(\"unable to make temporary bitmap file readable\");",
"\tif (rename(tmp_file, filename))\n\t\tdie_errno(\"unable to rename temporary bitmap file to '%s'\", filename);\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-2324",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-2324/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/git/git/commit/de1e67d0703894cb6ea782e36abb63976ab07e60",
"commit_id": "de1e67d0703894cb6ea782e36abb63976ab07e60",
"commit_message": "list-objects: pass full pathname to callbacks\n\nWhen we find a blob at \"a/b/c\", we currently pass this to\nour show_object_fn callbacks as two components: \"a/b/\" and\n\"c\". Callbacks which want the full value then call\npath_name(), which concatenates the two. But this is an\ninefficient interface; the path is a strbuf, and we could\nsimply append \"c\" to it temporarily, then roll back the\nlength, without creating a new copy.\n\nSo we could improve this by teaching the callsites of\npath_name() this trick (and there are only 3). But we can\nalso notice that no callback actually cares about the\nbroken-down representation, and simply pass each callback\nthe full path \"a/b/c\" as a string. The callback code becomes\neven simpler, then, as we do not have to worry about freeing\nan allocated buffer, nor rolling back our modification to\nthe strbuf.\n\nThis is theoretically less efficient, as some callbacks\nwould not bother to format the final path component. But in\npractice this is not measurable. Since we use the same\nstrbuf over and over, our work to grow it is amortized, and\nwe really only pay to memcpy a few bytes.\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>",
"lang": "C",
"project": "git"
}
| 36
|
Determine whether the code is vulnerable or not.
|
[
"frag6_print(netdissect_options *ndo, register const u_char *bp, register const u_char *bp2)\n{\n\tregister const struct ip6_frag *dp;\n\tregister const struct ip6_hdr *ip6;",
" \tdp = (const struct ip6_frag *)bp;\n \tip6 = (const struct ip6_hdr *)bp2;\n ",
"\tND_TCHECK(dp->ip6f_offlg);",
" \n \tif (ndo->ndo_vflag) {\n \t\tND_PRINT((ndo, \"frag (0x%08x:%d|%ld)\",\n\t\t EXTRACT_32BITS(&dp->ip6f_ident),\n\t\t EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,\n\t\t sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -\n\t\t\t (long)(bp - bp2) - sizeof(struct ip6_frag)));\n\t} else {\n\t\tND_PRINT((ndo, \"frag (%d|%ld)\",\n\t\t EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,\n\t\t sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -\n\t\t\t (long)(bp - bp2) - sizeof(struct ip6_frag)));\n\t}",
"\t/* it is meaningless to decode non-first fragment */\n\tif ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)\n\t\treturn -1;\n\telse\n\t{\n\t\tND_PRINT((ndo, \" \"));\n\t\treturn sizeof(struct ip6_frag);\n\t}\ntrunc:\n\tND_PRINT((ndo, \"[|frag]\"));\n\treturn -1;\n}"
] |
[
1,
1,
0,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-13031",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-13031/",
"CWE ID": "CWE-125",
"codeLink": "https://github.com/the-tcpdump-group/tcpdump/commit/2d669862df7cd17f539129049f6fb70d17174125",
"commit_id": "2d669862df7cd17f539129049f6fb70d17174125",
"commit_message": "CVE-2017-13031/Check for the presence of the entire IPv6 fragment header.\n\nThis fixes a buffer over-read discovered by Bhargava Shastry,\nSecT/TU Berlin.\n\nAdd a test using the capture file supplied by the reporter(s), modified\nso the capture file won't be rejected as an invalid capture.\n\nClean up some whitespace in tests/TESTLIST while we're at it.",
"lang": "C",
"project": "tcpdump"
}
| 37
|
Determine whether the code is vulnerable or not.
|
[
"frag6_print(netdissect_options *ndo, register const u_char *bp, register const u_char *bp2)\n{\n\tregister const struct ip6_frag *dp;\n\tregister const struct ip6_hdr *ip6;",
" \tdp = (const struct ip6_frag *)bp;\n \tip6 = (const struct ip6_hdr *)bp2;\n ",
"\tND_TCHECK(*dp);",
" \n \tif (ndo->ndo_vflag) {\n \t\tND_PRINT((ndo, \"frag (0x%08x:%d|%ld)\",\n\t\t EXTRACT_32BITS(&dp->ip6f_ident),\n\t\t EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,\n\t\t sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -\n\t\t\t (long)(bp - bp2) - sizeof(struct ip6_frag)));\n\t} else {\n\t\tND_PRINT((ndo, \"frag (%d|%ld)\",\n\t\t EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,\n\t\t sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -\n\t\t\t (long)(bp - bp2) - sizeof(struct ip6_frag)));\n\t}",
"\t/* it is meaningless to decode non-first fragment */\n\tif ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)\n\t\treturn -1;\n\telse\n\t{\n\t\tND_PRINT((ndo, \" \"));\n\t\treturn sizeof(struct ip6_frag);\n\t}\ntrunc:\n\tND_PRINT((ndo, \"[|frag]\"));\n\treturn -1;\n}"
] |
[
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-13031",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-13031/",
"CWE ID": "CWE-125",
"codeLink": "https://github.com/the-tcpdump-group/tcpdump/commit/2d669862df7cd17f539129049f6fb70d17174125",
"commit_id": "2d669862df7cd17f539129049f6fb70d17174125",
"commit_message": "CVE-2017-13031/Check for the presence of the entire IPv6 fragment header.\n\nThis fixes a buffer over-read discovered by Bhargava Shastry,\nSecT/TU Berlin.\n\nAdd a test using the capture file supplied by the reporter(s), modified\nso the capture file won't be rejected as an invalid capture.\n\nClean up some whitespace in tests/TESTLIST while we're at it.",
"lang": "C",
"project": "tcpdump"
}
| 37
|
Determine whether the code is vulnerable or not.
|
[
"const char* dump_uipc_event(tUIPC_EVENT event)\n{\n switch(event)\n {\n CASE_RETURN_STR(UIPC_OPEN_EVT)\n CASE_RETURN_STR(UIPC_CLOSE_EVT)\n CASE_RETURN_STR(UIPC_RX_DATA_EVT)\n CASE_RETURN_STR(UIPC_RX_DATA_READY_EVT)\n CASE_RETURN_STR(UIPC_TX_DATA_READY_EVT)\n default:\n return \"UNKNOWN MSG ID\";\n }\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-3839",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-3839/",
"CWE ID": "CWE-284",
"codeLink": "https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c",
"commit_id": "472271b153c5dc53c28beac55480a8d8434b2d5c",
"commit_message": "DO NOT MERGE Fix potential DoS caused by delivering signal to BT process\n\nBug: 28885210\nChange-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360\n\n Conflicts:\n\tbtif/co/bta_hh_co.c\n\tbtif/src/btif_core.c\nMerge conflict resolution of ag/1161415 (referencing ag/1164670)\n- Directly into mnc-mr2-release\n",
"lang": "C",
"project": "Android"
}
| 38
|
Determine whether the code is vulnerable or not.
|
[
"static int new_socket_unix(void) {\n int sfd;\n int flags;",
" if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {\n perror(\"socket()\");\n return -1;\n }",
" if ((flags = fcntl(sfd, F_GETFL, 0)) < 0 ||\n fcntl(sfd, F_SETFL, flags | O_NONBLOCK) < 0) {\n perror(\"setting O_NONBLOCK\");\n close(sfd);\n return -1;\n }\n return sfd;\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2010-1152",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2010-1152/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/memcached/memcached/commit/d9cd01ede97f4145af9781d448c62a3318952719",
"commit_id": "d9cd01ede97f4145af9781d448c62a3318952719",
"commit_message": "Use strncmp when checking for large ascii multigets.",
"lang": "C",
"project": "memcached"
}
| 39
|
Determine whether the code is vulnerable or not.
|
[
"Vp9Parser::~Vp9Parser() {}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": null,
"CVE Page": null,
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/27c68f543e5eba779902447445dfb05ec3f5bf75",
"commit_id": "27c68f543e5eba779902447445dfb05ec3f5bf75",
"commit_message": "Revert of Add accelerated VP9 decode infrastructure and an implementation for VA-API. (patchset #7 id:260001 of https://codereview.chromium.org/1318863003/ )\n\nReason for revert:\nI think this patch broke compile step for Chromium Linux ChromeOS MSan Builder.\n\nFirst failing build:\nhttp://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder/builds/8310\n\nAll recent builds:\nhttp://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder?numbuilds=200\n\nSorry for the revert. I'll re-revert if I'm wrong.\n\nCheers,\n\nTommy\n\nOriginal issue's description:\n> Add accelerated VP9 decode infrastructure and an implementation for VA-API.\n>\n> - Add a hardware/platform-independent VP9Decoder class and related\n> infrastructure, implementing AcceleratedVideoDecoder interface. VP9Decoder\n> performs the initial stages of the decode process, which are to be done\n> on host/in software, such as stream parsing and reference frame management.\n>\n> - Add a VP9Accelerator interface, used by the VP9Decoder to offload the\n> remaining stages of the decode process to hardware. VP9Accelerator\n> implementations are platform-specific.\n>\n> - Add the first implementation of VP9Accelerator - VaapiVP9Accelerator - and\n> integrate it with VaapiVideoDecodeAccelerator, for devices which provide\n> hardware VP9 acceleration through VA-API. Hook it up to the new\n> infrastructure and VP9Decoder.\n>\n> - Extend Vp9Parser to provide functionality required by VP9Decoder and\n> VP9Accelerator, including superframe parsing, handling of loop filter\n> and segmentation initialization, state persistence across frames and\n> resetting when needed. Also add code calculating segmentation dequants\n> and loop filter levels.\n>\n> - Update vp9_parser_unittest to the new Vp9Parser interface and flow.\n>\n> TEST=vp9_parser_unittest,vda_unittest,Chrome VP9 playback\n> BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331\n> TBR=dpranke@chromium.org\n>\n> Committed: https://crrev.com/e3cc0a661b8abfdc74f569940949bc1f336ece40\n> Cr-Commit-Position: refs/heads/master@{#349312}\n\nTBR=wuchengli@chromium.org,kcwu@chromium.org,sandersd@chromium.org,jorgelo@chromium.org,posciak@chromium.org\nNOPRESUBMIT=true\nNOTREECHECKS=true\nNOTRY=true\nBUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331\n\nReview URL: https://codereview.chromium.org/1357513002\n\nCr-Commit-Position: refs/heads/master@{#349443}",
"lang": "C",
"project": "Chrome"
}
| 40
|
Determine whether the code is vulnerable or not.
|
[
"static inline bool is_no_device(u32 intr_info)\n{\n\treturn is_exception_n(intr_info, NM_VECTOR);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-9588",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-9588/",
"CWE ID": "CWE-388",
"codeLink": "https://github.com/torvalds/linux/commit/ef85b67385436ddc1998f45f1d6a210f935b3388",
"commit_id": "ef85b67385436ddc1998f45f1d6a210f935b3388",
"commit_message": "kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF)\n\nWhen L2 exits to L0 due to \"exception or NMI\", software exceptions\n(#BP and #OF) for which L1 has requested an intercept should be\nhandled by L1 rather than L0. Previously, only hardware exceptions\nwere forwarded to L1.\n\nSigned-off-by: Jim Mattson <jmattson@google.com>\nCc: stable@vger.kernel.org\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
"lang": "C",
"project": "linux"
}
| 41
|
Determine whether the code is vulnerable or not.
|
[
"int fz_colorspace_is_rgb(fz_context *ctx, const fz_colorspace *cs)\n{\n\treturn cs && cs->type == FZ_COLORSPACE_RGB;\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-1000040",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-1000040/",
"CWE ID": "CWE-20",
"codeLink": "http://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=83d4dae44c71816c084a635550acc1a51529b881;hp=f597300439e62f5e921f0d7b1e880b5c1a1f1607",
"commit_id": "83d4dae44c71816c084a635550acc1a51529b881",
"commit_message": null,
"lang": "C",
"project": "ghostscript"
}
| 42
|
Determine whether the code is vulnerable or not.
|
[
"_add_starting_step(uint16_t type, void *req)\n{\n\tstarting_step_t *starting_step;\n\tint rc = SLURM_SUCCESS;",
"\t/* Add the step info to a list of starting processes that\n\t cannot reliably be contacted. */\n\tslurm_mutex_lock(&conf->starting_steps_lock);\n\tstarting_step = xmalloc(sizeof(starting_step_t));\n\tif (!starting_step) {\n\t\terror(\"%s failed to allocate memory\", __func__);\n\t\trc = SLURM_FAILURE;\n\t\tgoto fail;\n\t}\n\tswitch (type) {\n\tcase LAUNCH_BATCH_JOB:\n\t\tstarting_step->job_id =\n\t\t\t((batch_job_launch_msg_t *)req)->job_id;\n\t\tstarting_step->step_id =\n\t\t\t((batch_job_launch_msg_t *)req)->step_id;\n\t\tbreak;\n\tcase LAUNCH_TASKS:\n\t\tstarting_step->job_id =\n\t\t\t((launch_tasks_request_msg_t *)req)->job_id;\n\t\tstarting_step->step_id =\n\t\t\t((launch_tasks_request_msg_t *)req)->job_step_id;\n\t\tbreak;\n\tcase REQUEST_LAUNCH_PROLOG:\n\t\tstarting_step->job_id = ((prolog_launch_msg_t *)req)->job_id;\n\t\tstarting_step->step_id = SLURM_EXTERN_CONT;\n\t\tbreak;\n\tdefault:\n\t\terror(\"%s called with an invalid type: %u\", __func__, type);\n\t\trc = SLURM_FAILURE;\n\t\txfree(starting_step);\n\t\tgoto fail;\n\t}",
"\tif (!list_append(conf->starting_steps, starting_step)) {\n\t\terror(\"%s failed to allocate memory for list\", __func__);\n\t\trc = SLURM_FAILURE;\n\t\txfree(starting_step);\n\t\tgoto fail;\n\t}",
"fail:\n\tslurm_mutex_unlock(&conf->starting_steps_lock);\n\treturn rc;\n}\n"
] |
[
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-10030",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-10030/",
"CWE ID": "CWE-284",
"codeLink": "https://github.com/SchedMD/slurm/commit/92362a92fffe60187df61f99ab11c249d44120ee",
"commit_id": "92362a92fffe60187df61f99ab11c249d44120ee",
"commit_message": "Fix security issue in _prolog_error().\n\nFix security issue caused by insecure file path handling triggered by\nthe failure of a Prolog script. To exploit this a user needs to\nanticipate or cause the Prolog to fail for their job.\n\n(This commit is slightly different from the fix to the 15.08 branch.)\n\nCVE-2016-10030.",
"lang": "C",
"project": "slurm"
}
| 43
|
Determine whether the code is vulnerable or not.
|
[
"int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,\n\t\t\t\t struct futex_q *q, union futex_key *key2,\n\t\t\t\t struct hrtimer_sleeper *timeout)\n{\n\tint ret = 0;",
"\t/*\n\t * With the hb lock held, we avoid races while we process the wakeup.\n\t * We only need to hold hb (and not hb2) to ensure atomicity as the\n\t * wakeup code can't change q.key from uaddr to uaddr2 if we hold hb.\n\t * It can't be requeued from uaddr2 to something else since we don't\n\t * support a PI aware source futex for requeue.\n\t */\n\tif (!match_futex(&q->key, key2)) {\n\t\tWARN_ON(q->lock_ptr && (&hb->lock != q->lock_ptr));\n\t\t/*\n\t\t * We were woken prior to requeue by a timeout or a signal.\n\t\t * Unqueue the futex_q and determine which it was.\n\t\t */\n\t\tplist_del(&q->list, &hb->chain);\n\t\thb_waiters_dec(hb);",
"\t\t/* Handle spurious wakeups gracefully */\n\t\tret = -EWOULDBLOCK;\n\t\tif (timeout && !timeout->task)\n\t\t\tret = -ETIMEDOUT;\n\t\telse if (signal_pending(current))\n\t\t\tret = -ERESTARTNOINTR;\n\t}\n\treturn ret;\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2014-3153",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2014-3153/",
"CWE ID": "CWE-264",
"codeLink": "https://github.com/torvalds/linux/commit/e9c243a5a6de0be8e584c604d353412584b592f8",
"commit_id": "e9c243a5a6de0be8e584c604d353412584b592f8",
"commit_message": "futex-prevent-requeue-pi-on-same-futex.patch futex: Forbid uaddr == uaddr2 in futex_requeue(..., requeue_pi=1)\n\nIf uaddr == uaddr2, then we have broken the rule of only requeueing from\na non-pi futex to a pi futex with this call. If we attempt this, then\ndangling pointers may be left for rt_waiter resulting in an exploitable\ncondition.\n\nThis change brings futex_requeue() in line with futex_wait_requeue_pi()\nwhich performs the same check as per commit 6f7b0a2a5c0f (\"futex: Forbid\nuaddr == uaddr2 in futex_wait_requeue_pi()\")\n\n[ tglx: Compare the resulting keys as well, as uaddrs might be\n \tdifferent depending on the mapping ]\n\nFixes CVE-2014-3153.\n\nReported-by: Pinkie Pie\nSigned-off-by: Will Drewry <wad@chromium.org>\nSigned-off-by: Kees Cook <keescook@chromium.org>\nCc: stable@vger.kernel.org\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nReviewed-by: Darren Hart <dvhart@linux.intel.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
"lang": "C",
"project": "linux"
}
| 44
|
Determine whether the code is vulnerable or not.
|
[
"STDMETHODIMP UrlmonUrlRequest::BeginningTransaction(const wchar_t* url,\n const wchar_t* current_headers, DWORD reserved,\n wchar_t** additional_headers) {\n DCHECK_EQ(thread_, base::PlatformThread::CurrentId());\n if (!additional_headers) {\n NOTREACHED();\n return E_POINTER;\n }",
" DVLOG(1) << __FUNCTION__ << me() << \"headers: \\n\" << current_headers;",
" if (status_.get_state() == Status::ABORTING) {\n DLOG(WARNING) << __FUNCTION__ << me()\n << \": Aborting connection to URL:\"\n << url\n << \" as the binding has been aborted\";\n return E_ABORT;\n }",
" HRESULT hr = S_OK;",
" std::string new_headers;\n if (post_data_len() > 0) {\n if (is_chunked_upload()) {\n new_headers = base::StringPrintf(\"Transfer-Encoding: chunked\\r\\n\");\n }\n }",
" if (!extra_headers().empty()) {\n new_headers += extra_headers();\n }",
" if (!referrer().empty()) {\n new_headers += base::StringPrintf(\"Referer: %s\\r\\n\", referrer().c_str());\n }",
" std::string user_agent = http_utils::AddChromeFrameToUserAgentValue(\n http_utils::GetChromeUserAgent());\n new_headers += ReplaceOrAddUserAgent(current_headers, user_agent);",
" if (!new_headers.empty()) {\n *additional_headers = reinterpret_cast<wchar_t*>(\n CoTaskMemAlloc((new_headers.size() + 1) * sizeof(wchar_t)));",
" if (*additional_headers == NULL) {\n NOTREACHED();\n hr = E_OUTOFMEMORY;\n } else {\n lstrcpynW(*additional_headers, ASCIIToWide(new_headers).c_str(),\n new_headers.size());\n }\n }\n request_headers_ = new_headers;\n return hr;\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-2347",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-2347/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/60cc89e8d2e761dea28bb9e4cf9ebbad516bff09",
"commit_id": "60cc89e8d2e761dea28bb9e4cf9ebbad516bff09",
"commit_message": "iwyu: Include callback_old.h where appropriate, final.\n\nBUG=82098\nTEST=none\n\nReview URL: http://codereview.chromium.org/7003003\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@85003 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 45
|
Determine whether the code is vulnerable or not.
|
[
"rad_server_secret(struct rad_handle *h)\n{\n\tif (h->srv >= h->num_servers) {\n\t\tgenerr(h, \"No RADIUS servers specified\");\n\t\treturn NULL;\n\t}",
"\treturn (h->servers[h->srv].secret);\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-2220",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-2220/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/LawnGnome/php-radius/commit/13c149b051f82b709e8d7cc32111e84b49d57234",
"commit_id": "13c149b051f82b709e8d7cc32111e84b49d57234",
"commit_message": "Fix a security issue in radius_get_vendor_attr().\n\nThe underlying rad_get_vendor_attr() function assumed that it would always be\ngiven valid VSA data. Indeed, the buffer length wasn't even passed in; the\nassumption was that the length field within the VSA structure would be valid.\n\nThis could result in denial of service by providing a length that would be\nbeyond the memory limit, or potential arbitrary memory access by providing a\nlength greater than the actual data given.\n\nrad_get_vendor_attr() has been changed to require the raw data length be\nprovided, and this is then used to check that the VSA is valid.\n\nConflicts:\n\tradlib_vs.h",
"lang": "C",
"project": "php-radius"
}
| 46
|
Determine whether the code is vulnerable or not.
|
[
"void PaintLayerScrollableArea::DidChangeGlobalRootScroller() {\n if (GetLayoutBox()->GetNode()->IsElementNode()) {\n ToElement(GetLayoutBox()->GetNode())->SetNeedsCompositingUpdate();\n GetLayoutBox()->SetNeedsPaintPropertyUpdate();\n }",
" if (GetLayoutBox()->GetFrame()->GetSettings() &&\n GetLayoutBox()->GetFrame()->GetSettings()->GetViewportEnabled()) {\n bool needs_horizontal_scrollbar;\n bool needs_vertical_scrollbar;\n ComputeScrollbarExistence(needs_horizontal_scrollbar,\n needs_vertical_scrollbar);\n SetHasHorizontalScrollbar(needs_horizontal_scrollbar);\n SetHasVerticalScrollbar(needs_vertical_scrollbar);\n }\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-5147",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-5147/",
"CWE ID": "CWE-79",
"codeLink": "https://github.com/chromium/chromium/commit/5472db1c7eca35822219d03be5c817d9a9258c11",
"commit_id": "5472db1c7eca35822219d03be5c817d9a9258c11",
"commit_message": "Always call UpdateCompositedScrollOffset, not just for the root layer\n\nBug: 927560\nChange-Id: I1d5522aae4f11dd3f5b8947bb089bac1bf19bdb4\nReviewed-on: https://chromium-review.googlesource.com/c/1452701\nReviewed-by: Chris Harrelson <chrishtr@chromium.org>\nCommit-Queue: Mason Freed <masonfreed@chromium.org>\nCr-Commit-Position: refs/heads/master@{#628942}",
"lang": "C",
"project": "Chrome"
}
| 47
|
Determine whether the code is vulnerable or not.
|
[
"int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,\n\t\t\tconst void *val, int bytes)\n{\n\tint ret;",
"\tret = kvm_vcpu_write_guest(vcpu, gpa, val, bytes);\n\tif (ret < 0)\n\t\treturn 0;\n\tkvm_mmu_pte_write(vcpu, gpa, val, bytes);\n\treturn 1;\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2015-7513",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2015-7513/",
"CWE ID": null,
"codeLink": "https://github.com/torvalds/linux/commit/0185604c2d82c560dab2f2933a18f797e74ab5a8",
"commit_id": "0185604c2d82c560dab2f2933a18f797e74ab5a8",
"commit_message": "KVM: x86: Reload pit counters for all channels when restoring state\n\nCurrently if userspace restores the pit counters with a count of 0\non channels 1 or 2 and the guest attempts to read the count on those\nchannels, then KVM will perform a mod of 0 and crash. This will ensure\nthat 0 values are converted to 65536 as per the spec.\n\nThis is CVE-2015-7513.\n\nSigned-off-by: Andy Honig <ahonig@google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
"lang": "C",
"project": "linux"
}
| 48
|
Determine whether the code is vulnerable or not.
|
[
"static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)\n{\n\tstruct nfs4_opendata *data = calldata;",
"\tdata->rpc_status = task->tk_status;\n\tif (data->rpc_status == 0) {\n\t\tnfs4_stateid_copy(&data->o_res.stateid, &data->c_res.stateid);\n\t\tnfs_confirm_seqid(&data->owner->so_seqid, 0);\n\t\trenew_lease(data->o_res.server, data->timestamp);\n\t\tdata->rpc_done = 1;\n\t}\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-2375",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-2375/",
"CWE ID": "CWE-189",
"codeLink": "https://github.com/torvalds/linux/commit/20e0fa98b751facf9a1101edaefbc19c82616a68",
"commit_id": "20e0fa98b751facf9a1101edaefbc19c82616a68",
"commit_message": "Fix length of buffer copied in __nfs4_get_acl_uncached\n\n_copy_from_pages() used to copy data from the temporary buffer to the\nuser passed buffer is passed the wrong size parameter when copying\ndata. res.acl_len contains both the bitmap and acl lenghts while\nacl_len contains the acl length after adjusting for the bitmap size.\n\nSigned-off-by: Sachin Prabhu <sprabhu@redhat.com>\nSigned-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>",
"lang": "C",
"project": "linux"
}
| 49
|
Determine whether the code is vulnerable or not.
|
[
"static vpx_image_t *vp8_get_frame(vpx_codec_alg_priv_t *ctx,\n vpx_codec_iter_t *iter)\n{\n vpx_image_t *img = NULL;",
" /* iter acts as a flip flop, so an image is only returned on the first\n * call to get_frame.\n */\n if (!(*iter) && ctx->yv12_frame_buffers.pbi[0])\n {\n YV12_BUFFER_CONFIG sd;\n int64_t time_stamp = 0, time_end_stamp = 0;\n vp8_ppflags_t flags = {0};",
" if (ctx->base.init_flags & VPX_CODEC_USE_POSTPROC)\n {\n flags.post_proc_flag= ctx->postproc_cfg.post_proc_flag\n#if CONFIG_POSTPROC_VISUALIZER",
" | ((ctx->dbg_color_ref_frame_flag != 0) ? VP8D_DEBUG_CLR_FRM_REF_BLKS : 0)\n | ((ctx->dbg_color_mb_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0)\n | ((ctx->dbg_color_b_modes_flag != 0) ? VP8D_DEBUG_CLR_BLK_MODES : 0)\n | ((ctx->dbg_display_mv_flag != 0) ? VP8D_DEBUG_DRAW_MV : 0)\n#endif\n ;\n flags.deblocking_level = ctx->postproc_cfg.deblocking_level;\n flags.noise_level = ctx->postproc_cfg.noise_level;\n#if CONFIG_POSTPROC_VISUALIZER\n flags.display_ref_frame_flag= ctx->dbg_color_ref_frame_flag;\n flags.display_mb_modes_flag = ctx->dbg_color_mb_modes_flag;\n flags.display_b_modes_flag = ctx->dbg_color_b_modes_flag;\n flags.display_mv_flag = ctx->dbg_display_mv_flag;\n#endif\n }",
" if (0 == vp8dx_get_raw_frame(ctx->yv12_frame_buffers.pbi[0], &sd,\n &time_stamp, &time_end_stamp, &flags))\n {\n yuvconfig2image(&ctx->img, &sd, ctx->user_priv);",
" img = &ctx->img;\n *iter = img;\n }\n }",
" return img;\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-6711",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-6711/",
"CWE ID": "CWE-20",
"codeLink": "https://android.googlesource.com/platform/external/libvpx/+/063be1485e0099bc81ace3a08b0ec9186dcad693",
"commit_id": "063be1485e0099bc81ace3a08b0ec9186dcad693",
"commit_message": "DO NOT MERGE | libvpx: Cherry-pick 0f42d1f from upstream\n\nDescription from upstream:\nvp8: fix decoder crash with invalid leading keyframes\n\ndecoding the same invalid keyframe twice would result in a crash as the\nsecond time through the decoder would be assumed to have been\ninitialized as there was no resolution change. in this case the\nresolution was itself invalid (0x6), but vp8_peek_si() was only failing\nin the case of 0x0.\ninvalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf tests this case by\nduplicating the first keyframe and additionally adds a valid one to\nensure decoding can resume without error.\n\nBug: 30593765\nChange-Id: I0de85f5a5eb5c0a5605230faf20c042b69aea507\n(cherry picked from commit fc0466b695dce03e10390101844caa374848d903)\n(cherry picked from commit 1114575245cb9d2f108749f916c76549524f5136)\n",
"lang": "C",
"project": "Android"
}
| 50
|
Determine whether the code is vulnerable or not.
|
[
"WebUIController* NewWebUI(content::WebUI* web_ui, const GURL& url) {\n return new T(web_ui);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-3084",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-3084/",
"CWE ID": "CWE-264",
"codeLink": "https://github.com/chromium/chromium/commit/744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0",
"commit_id": "744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0",
"commit_message": "Allow browser to handle all WebUI navigations.\n\nBUG=113496\nTEST=\"Google Dashboard\" link in Sync settings loads in new process.\n\n\nReview URL: http://codereview.chromium.org/9663045\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@126949 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 51
|
Determine whether the code is vulnerable or not.
|
[
"void FindInPageNotificationObserver::Observe(\n int type, const content::NotificationSource& source,\n const content::NotificationDetails& details) {\n content::Details<FindNotificationDetails> find_details(details);\n if (!(find_details->final_update() && reply_message_ != NULL)) {\n DVLOG(1) << \"Ignoring, since we only care about the final message\";\n return;\n }",
" if (!automation_) {\n delete this;\n return;\n }",
" if (find_details->request_id() == kFindInPageRequestId) {\n if (reply_with_json_) {\n scoped_ptr<DictionaryValue> return_value(new DictionaryValue);\n return_value->SetInteger(\"match_count\",\n find_details->number_of_matches());\n gfx::Rect rect = find_details->selection_rect();\n if (!rect.IsEmpty()) {\n return_value->SetInteger(\"match_left\", rect.x());\n return_value->SetInteger(\"match_top\", rect.y());\n return_value->SetInteger(\"match_right\", rect.right());\n return_value->SetInteger(\"match_bottom\", rect.bottom());\n }\n AutomationJSONReply(automation_, reply_message_.release())\n .SendSuccess(return_value.get());\n delete this;\n } else {\n if (find_details->active_match_ordinal() > -1) {\n active_match_ordinal_ = find_details->active_match_ordinal();\n AutomationMsg_Find::WriteReplyParams(reply_message_.get(),\n active_match_ordinal_, find_details->number_of_matches());\n automation_->Send(reply_message_.release());\n }\n }\n }\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-5148",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-5148/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599",
"commit_id": "e89cfcb9090e8c98129ae9160c513f504db74599",
"commit_message": "Remove TabContents from TabStripModelObserver::TabDetachedAt.\n\nBUG=107201\nTEST=no visible change\n\n\nReview URL: https://chromiumcodereview.appspot.com/11293205\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 52
|
Determine whether the code is vulnerable or not.
|
[
"void RenderWidgetHostImpl::Blur() {\n if (IsMouseLocked())\n view_->UnlockMouse();",
" Send(new ViewMsg_SetFocus(routing_id_, false));\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0886",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0886/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76",
"commit_id": "18d67244984a574ba2dd8779faabc0e3e34f4b76",
"commit_message": "Implement TextureImageTransportSurface using texture mailbox\n\nThis has a couple of advantages:\n- allow tearing down and recreating the UI parent context without\nlosing the renderer contexts\n- do not require a context to be able to generate textures when\ncreating the GLSurfaceHandle\n- clearer ownership semantics that potentially allows for more\nrobust and easier lost context handling/thumbnailing/etc., since a texture is at\nany given time owned by either: UI parent, mailbox, or\nTextureImageTransportSurface\n- simplify frontbuffer protection logic;\nthe frontbuffer textures are now owned by RWHV where they are refcounted\n\nThe TextureImageTransportSurface informs RenderWidgetHostView of the\nmailbox names for the front- and backbuffer textures by\nassociating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message.\nDuring SwapBuffers() or PostSubBuffer() cycles, it then uses \nproduceTextureCHROMIUM() and consumeTextureCHROMIUM()\nto transfer ownership between renderer and browser compositor.\n\nRWHV sends back the surface_handle of the buffer being returned with the Swap ACK\n(or 0 if no buffer is being returned in which case TextureImageTransportSurface will\nallocate a new texture - note that this could be used to \nsimply keep textures for thumbnailing).\n\nBUG=154815,139616\nTBR=sky@chromium.org\n\nReview URL: https://chromiumcodereview.appspot.com/11194042\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 53
|
Determine whether the code is vulnerable or not.
|
[
"static int list_files(void)\n{\n\tsc_path_t path;\n\tint r;",
"\tsc_format_path(\"3F00\", &path);\n\tr = enum_dir(path, 0);\n\treturn r;\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-16427",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-16427/",
"CWE ID": "CWE-125",
"codeLink": "https://github.com/OpenSC/OpenSC/pull/1447/commits/8fe377e93b4b56060e5bbfb6f3142ceaeca744fa",
"commit_id": "8fe377e93b4b56060e5bbfb6f3142ceaeca744fa",
"commit_message": "fixed out of bounds reads\n\nThanks to Eric Sesterhenn from X41 D-SEC GmbH\nfor reporting and suggesting security fixes.",
"lang": "C",
"project": "OpenSC"
}
| 54
|
Determine whether the code is vulnerable or not.
|
[
"status_t MediaPlayer::setSyncSettings(const AVSyncSettings& sync, float videoFpsHint)\n{\n ALOGV(\"setSyncSettings: %u %u %f %f\",\n sync.mSource, sync.mAudioAdjustMode, sync.mTolerance, videoFpsHint);\n Mutex::Autolock _l(mLock);\n if (mPlayer == 0) return INVALID_OPERATION;\n return mPlayer->setSyncSettings(sync, videoFpsHint);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-3821",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-3821/",
"CWE ID": "CWE-476",
"codeLink": "https://android.googlesource.com/platform/frameworks/av/+/42a25c46b844518ff0d0b920c20c519e1417be69",
"commit_id": "42a25c46b844518ff0d0b920c20c519e1417be69",
"commit_message": "Don't use sp<>&\n\nbecause they may end up pointing to NULL after a NULL check was performed.\n\nBug: 28166152\nChange-Id: Iab2ea30395b620628cc6f3d067dd4f6fcda824fe\n",
"lang": "C",
"project": "Android"
}
| 55
|
Determine whether the code is vulnerable or not.
|
[
"status_t AMRSource::stop() {\n CHECK(mStarted);",
" delete mGroup;\n mGroup = NULL;",
" mStarted = false;\n return OK;\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-0603",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-0603/",
"CWE ID": "CWE-190",
"codeLink": "https://android.googlesource.com/platform/frameworks/av/+/36b04932bb93cc3269279282686b439a17a89920",
"commit_id": "36b04932bb93cc3269279282686b439a17a89920",
"commit_message": "Fix integer overflow and divide-by-zero\n\nBug: 35763994\nTest: ran CTS with and without fix\nChange-Id: If835e97ce578d4fa567e33e349e48fb7b2559e0e\n(cherry picked from commit 8538a603ef992e75f29336499cb783f3ec19f18c)\n",
"lang": "C",
"project": "Android"
}
| 56
|
Determine whether the code is vulnerable or not.
|
[
"inline void comps_rtree_pair_destroy(COMPS_RTreePair * pair) {\n free(pair->key);\n free(pair);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2019-3817",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2019-3817/",
"CWE ID": "CWE-416",
"codeLink": "https://github.com/rpm-software-management/libcomps/commit/e3a5d056633677959ad924a51758876d415e7046",
"commit_id": "e3a5d056633677959ad924a51758876d415e7046",
"commit_message": "Fix UAF in comps_objmrtree_unite function\n\nThe added field is not used at all in many places and it is probably the\nleft-over of some copy-paste.",
"lang": "C",
"project": "libcomps"
}
| 57
|
Determine whether the code is vulnerable or not.
|
[
"GF_Err gf_sm_load_string(GF_SceneLoader *load, const char *str, Bool do_clean)\n{\n\tGF_Err e;\n\tif (!load->type) e = GF_BAD_PARAM;\n\telse if (load->parse_string) e = load->parse_string(load, str);\n\telse e = GF_NOT_SUPPORTED;",
"\treturn e;\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-20762",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-20762/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/gpac/gpac/commit/35ab4475a7df9b2a4bcab235e379c0c3ec543658",
"commit_id": "35ab4475a7df9b2a4bcab235e379c0c3ec543658",
"commit_message": "fix some overflows due to strcpy\n\nfixes #1184, #1186, #1187 among other things",
"lang": "C",
"project": "gpac"
}
| 58
|
Determine whether the code is vulnerable or not.
|
[
"static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)\n{\n\tint idx;\n\tint s_idx = cb->family;",
"\tif (s_idx == 0)\n\t\ts_idx = 1;\n\tfor (idx = 1; idx <= RTNL_FAMILY_MAX; idx++) {\n\t\tint type = cb->nlh->nlmsg_type-RTM_BASE;\n\t\tif (idx < s_idx || idx == PF_PACKET)\n\t\t\tcontinue;\n\t\tif (rtnl_msg_handlers[idx] == NULL ||\n\t\t rtnl_msg_handlers[idx][type].dumpit == NULL)\n\t\t\tcontinue;\n\t\tif (idx > s_idx)\n\t\t\tmemset(&cb->args[0], 0, sizeof(cb->args));\n\t\tif (rtnl_msg_handlers[idx][type].dumpit(skb, cb))\n\t\t\tbreak;\n\t}\n\tcb->family = idx;",
"\treturn skb->len;\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-2635",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-2635/",
"CWE ID": "CWE-399",
"codeLink": "https://github.com/torvalds/linux/commit/84d73cd3fb142bf1298a8c13fd4ca50fd2432372",
"commit_id": "84d73cd3fb142bf1298a8c13fd4ca50fd2432372",
"commit_message": "rtnl: fix info leak on RTM_GETLINK request for VF devices\n\nInitialize the mac address buffer with 0 as the driver specific function\nwill probably not fill the whole buffer. In fact, all in-kernel drivers\nfill only ETH_ALEN of the MAX_ADDR_LEN bytes, i.e. 6 of the 32 possible\nbytes. Therefore we currently leak 26 bytes of stack memory to userland\nvia the netlink interface.\n\nSigned-off-by: Mathias Krause <minipli@googlemail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
"lang": "C",
"project": "linux"
}
| 59
|
Determine whether the code is vulnerable or not.
|
[
"flx_colorspace_convert (FlxColorSpaceConverter * flxpal, guchar * src,\n guchar * dest)\n{\n guint size, col;",
" g_return_if_fail (flxpal != NULL);\n g_return_if_fail (src != dest);",
"\n size = flxpal->width * flxpal->height;",
" while (size--) {\n col = (*src++ * 3);",
"#if G_BYTE_ORDER == G_BIG_ENDIAN\n *dest++ = 0;\n *dest++ = flxpal->palvec[col];\n *dest++ = flxpal->palvec[col + 1];\n *dest++ = flxpal->palvec[col + 2];\n#else\n *dest++ = flxpal->palvec[col + 2];\n *dest++ = flxpal->palvec[col + 1];\n *dest++ = flxpal->palvec[col];\n *dest++ = 0;\n#endif\n }",
"}\n"
] |
[
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-9807",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-9807/",
"CWE ID": "CWE-125",
"codeLink": "https://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=153a8ae752c90d07190ef45803422a4f71ea8bff",
"commit_id": "153a8ae752c90d07190ef45803422a4f71ea8bff",
"commit_message": null,
"lang": "C",
"project": "gstreamer"
}
| 60
|
Determine whether the code is vulnerable or not.
|
[
"int put_compat_itimerspec64(const struct itimerspec64 *its,\n\t\t\tstruct compat_itimerspec __user *uits)\n{\n\tif (__compat_put_timespec64(&its->it_interval, &uits->it_interval) ||\n\t __compat_put_timespec64(&its->it_value, &uits->it_value))\n\t\treturn -EFAULT;\n\treturn 0;\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-11508",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-11508/",
"CWE ID": "CWE-200",
"codeLink": "https://github.com/torvalds/linux/commit/0a0b98734479aa5b3c671d5190e86273372cab95",
"commit_id": "0a0b98734479aa5b3c671d5190e86273372cab95",
"commit_message": "compat: fix 4-byte infoleak via uninitialized struct field\n\nCommit 3a4d44b61625 (\"ntp: Move adjtimex related compat syscalls to\nnative counterparts\") removed the memset() in compat_get_timex(). Since\nthen, the compat adjtimex syscall can invoke do_adjtimex() with an\nuninitialized ->tai.\n\nIf do_adjtimex() doesn't write to ->tai (e.g. because the arguments are\ninvalid), compat_put_timex() then copies the uninitialized ->tai field\nto userspace.\n\nFix it by adding the memset() back.\n\nFixes: 3a4d44b61625 (\"ntp: Move adjtimex related compat syscalls to native counterparts\")\nSigned-off-by: Jann Horn <jannh@google.com>\nAcked-by: Kees Cook <keescook@chromium.org>\nAcked-by: Al Viro <viro@zeniv.linux.org.uk>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
"lang": "C",
"project": "linux"
}
| 61
|
Determine whether the code is vulnerable or not.
|
[
"static void windows_destroy_device(struct libusb_device *dev)\n{\n\twindows_device_priv_release(dev);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-6125",
"CVE Page": null,
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/ac149a8d4371c0e01e0934fdd57b09e86f96b5b9",
"commit_id": "ac149a8d4371c0e01e0934fdd57b09e86f96b5b9",
"commit_message": "Remove libusb-Windows support for HID devices\n\nThis patch removes the Windows-specific support in libusb that provided\na translation between the WinUSB API and the HID API. Applications\ncurrently depending on this using the chrome.usb API should switch to\nusing the chrome.hid API.\n\nBug: 818592\nChange-Id: I82ee6ccdcbccc21d2910dc62845c7785e78b64f6\nReviewed-on: https://chromium-review.googlesource.com/951635\nReviewed-by: Ken Rockot <rockot@chromium.org>\nCommit-Queue: Reilly Grant <reillyg@chromium.org>\nCr-Commit-Position: refs/heads/master@{#541265}",
"lang": "C",
"project": "Chrome"
}
| 62
|
Determine whether the code is vulnerable or not.
|
[
"void Document::ViewportDefiningElementDidChange() {\n HTMLBodyElement* body = FirstBodyElement();\n if (!body)\n return;\n LayoutObject* layout_object = body->GetLayoutObject();\n if (layout_object && layout_object->IsLayoutBlock()) {\n layout_object->SetStyle(ComputedStyle::Clone(*layout_object->Style()));\n if (layout_object->HasLayer()) {\n ToLayoutBoxModelObject(layout_object)\n ->Layer()\n ->SetNeeedsCompositingReasonsUpdate();\n }\n }\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-18350",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-18350/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/d683fb12566eaec180ee0e0506288f46cc7a43e7",
"commit_id": "d683fb12566eaec180ee0e0506288f46cc7a43e7",
"commit_message": "Inherit CSP when self-navigating to local-scheme URL\n\nAs the linked bug example shows, we should inherit CSP when we navigate\nto a local-scheme URL (even if we are in a main browsing context).\n\nBug: 799747\nChange-Id: I8413aa8e8049461ebcf0ffbf7b04c41d1340af02\nReviewed-on: https://chromium-review.googlesource.com/c/1234337\nReviewed-by: Mike West <mkwst@chromium.org>\nCommit-Queue: Andy Paicu <andypaicu@chromium.org>\nCr-Commit-Position: refs/heads/master@{#597889}",
"lang": "C",
"project": "Chrome"
}
| 63
|
Determine whether the code is vulnerable or not.
|
[
"static void __ip_vs_unlink_dest(struct ip_vs_service *svc,\n\t\t\t\tstruct ip_vs_dest *dest,\n\t\t\t\tint svcupd)\n{\n\tdest->flags &= ~IP_VS_DEST_F_AVAILABLE;",
"\t/*\n\t * Remove it from the d-linked destination list.\n\t */\n\tlist_del(&dest->n_list);\n\tsvc->num_dests--;",
"\t/*\n\t * Call the update_service function of its scheduler\n\t */\n\tif (svcupd && svc->scheduler->update_service)\n\t\t\tsvc->scheduler->update_service(svc);\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-4588",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-4588/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/torvalds/linux/commit/04bcef2a83f40c6db24222b27a52892cba39dffb",
"commit_id": "04bcef2a83f40c6db24222b27a52892cba39dffb",
"commit_message": "ipvs: Add boundary check on ioctl arguments\n\nThe ipvs code has a nifty system for doing the size of ioctl command\ncopies; it defines an array with values into which it indexes the cmd\nto find the right length.\n\nUnfortunately, the ipvs code forgot to check if the cmd was in the\nrange that the array provides, allowing for an index outside of the\narray, which then gives a \"garbage\" result into the length, which\nthen gets used for copying into a stack buffer.\n\nFix this by adding sanity checks on these as well as the copy size.\n\n[ horms@verge.net.au: adjusted limit to IP_VS_SO_GET_MAX ]\nSigned-off-by: Arjan van de Ven <arjan@linux.intel.com>\nAcked-by: Julian Anastasov <ja@ssi.bg>\nSigned-off-by: Simon Horman <horms@verge.net.au>\nSigned-off-by: Patrick McHardy <kaber@trash.net>",
"lang": "C",
"project": "linux"
}
| 64
|
Determine whether the code is vulnerable or not.
|
[
"static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd,\n\t\t struct ib_wq_init_attr *init_attr)\n{\n\tstruct mlx5_ib_dev *dev;\n\tint has_net_offloads;\n\t__be64 *rq_pas0;\n\tvoid *in;\n\tvoid *rqc;\n\tvoid *wq;\n\tint inlen;\n\tint err;",
"\tdev = to_mdev(pd->device);",
"\tinlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rwq->rq_num_pas;\n\tin = kvzalloc(inlen, GFP_KERNEL);\n\tif (!in)\n\t\treturn -ENOMEM;",
"\trqc = MLX5_ADDR_OF(create_rq_in, in, ctx);\n\tMLX5_SET(rqc, rqc, mem_rq_type,\n\t\t MLX5_RQC_MEM_RQ_TYPE_MEMORY_RQ_INLINE);\n\tMLX5_SET(rqc, rqc, user_index, rwq->user_index);\n\tMLX5_SET(rqc, rqc, cqn, to_mcq(init_attr->cq)->mcq.cqn);\n\tMLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST);\n\tMLX5_SET(rqc, rqc, flush_in_error_en, 1);\n\twq = MLX5_ADDR_OF(rqc, rqc, wq);\n\tMLX5_SET(wq, wq, wq_type,\n\t\t rwq->create_flags & MLX5_IB_WQ_FLAGS_STRIDING_RQ ?\n\t\t MLX5_WQ_TYPE_CYCLIC_STRIDING_RQ : MLX5_WQ_TYPE_CYCLIC);\n\tif (init_attr->create_flags & IB_WQ_FLAGS_PCI_WRITE_END_PADDING) {\n\t\tif (!MLX5_CAP_GEN(dev->mdev, end_pad)) {\n\t\t\tmlx5_ib_dbg(dev, \"Scatter end padding is not supported\\n\");\n\t\t\terr = -EOPNOTSUPP;\n\t\t\tgoto out;\n\t\t} else {\n\t\t\tMLX5_SET(wq, wq, end_padding_mode, MLX5_WQ_END_PAD_MODE_ALIGN);\n\t\t}\n\t}\n\tMLX5_SET(wq, wq, log_wq_stride, rwq->log_rq_stride);\n\tif (rwq->create_flags & MLX5_IB_WQ_FLAGS_STRIDING_RQ) {\n\t\tMLX5_SET(wq, wq, two_byte_shift_en, rwq->two_byte_shift_en);\n\t\tMLX5_SET(wq, wq, log_wqe_stride_size,\n\t\t\t rwq->single_stride_log_num_of_bytes -\n\t\t\t MLX5_MIN_SINGLE_STRIDE_LOG_NUM_BYTES);\n\t\tMLX5_SET(wq, wq, log_wqe_num_of_strides, rwq->log_num_strides -\n\t\t\t MLX5_MIN_SINGLE_WQE_LOG_NUM_STRIDES);\n\t}\n\tMLX5_SET(wq, wq, log_wq_sz, rwq->log_rq_size);\n\tMLX5_SET(wq, wq, pd, to_mpd(pd)->pdn);\n\tMLX5_SET(wq, wq, page_offset, rwq->rq_page_offset);\n\tMLX5_SET(wq, wq, log_wq_pg_sz, rwq->log_page_size);\n\tMLX5_SET(wq, wq, wq_signature, rwq->wq_sig);\n\tMLX5_SET64(wq, wq, dbr_addr, rwq->db.dma);\n\thas_net_offloads = MLX5_CAP_GEN(dev->mdev, eth_net_offloads);\n\tif (init_attr->create_flags & IB_WQ_FLAGS_CVLAN_STRIPPING) {\n\t\tif (!(has_net_offloads && MLX5_CAP_ETH(dev->mdev, vlan_cap))) {\n\t\t\tmlx5_ib_dbg(dev, \"VLAN offloads are not supported\\n\");\n\t\t\terr = -EOPNOTSUPP;\n\t\t\tgoto out;\n\t\t}\n\t} else {\n\t\tMLX5_SET(rqc, rqc, vsd, 1);\n\t}\n\tif (init_attr->create_flags & IB_WQ_FLAGS_SCATTER_FCS) {\n\t\tif (!(has_net_offloads && MLX5_CAP_ETH(dev->mdev, scatter_fcs))) {\n\t\t\tmlx5_ib_dbg(dev, \"Scatter FCS is not supported\\n\");\n\t\t\terr = -EOPNOTSUPP;\n\t\t\tgoto out;\n\t\t}\n\t\tMLX5_SET(rqc, rqc, scatter_fcs, 1);\n\t}\n\tif (init_attr->create_flags & IB_WQ_FLAGS_DELAY_DROP) {\n\t\tif (!(dev->ib_dev.attrs.raw_packet_caps &\n\t\t IB_RAW_PACKET_CAP_DELAY_DROP)) {\n\t\t\tmlx5_ib_dbg(dev, \"Delay drop is not supported\\n\");\n\t\t\terr = -EOPNOTSUPP;\n\t\t\tgoto out;\n\t\t}\n\t\tMLX5_SET(rqc, rqc, delay_drop_en, 1);\n\t}\n\trq_pas0 = (__be64 *)MLX5_ADDR_OF(wq, wq, pas);\n\tmlx5_ib_populate_pas(dev, rwq->umem, rwq->page_shift, rq_pas0, 0);\n\terr = mlx5_core_create_rq_tracked(dev->mdev, in, inlen, &rwq->core_qp);\n\tif (!err && init_attr->create_flags & IB_WQ_FLAGS_DELAY_DROP) {\n\t\terr = set_delay_drop(dev);\n\t\tif (err) {\n\t\t\tmlx5_ib_warn(dev, \"Failed to enable delay drop err=%d\\n\",\n\t\t\t\t err);\n\t\t\tmlx5_core_destroy_rq_tracked(dev->mdev, &rwq->core_qp);\n\t\t} else {\n\t\t\trwq->create_flags |= MLX5_IB_WQ_FLAGS_DELAY_DROP;\n\t\t}\n\t}\nout:\n\tkvfree(in);\n\treturn err;\n}\n"
] |
[
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-20855",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-20855/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/torvalds/linux/commit/0625b4ba1a5d4703c7fb01c497bd6c156908af00",
"commit_id": "0625b4ba1a5d4703c7fb01c497bd6c156908af00",
"commit_message": "IB/mlx5: Fix leaking stack memory to userspace\n\nmlx5_ib_create_qp_resp was never initialized and only the first 4 bytes\nwere written.\n\nFixes: 41d902cb7c32 (\"RDMA/mlx5: Fix definition of mlx5_ib_create_qp_resp\")\nCc: <stable@vger.kernel.org>\nAcked-by: Leon Romanovsky <leonro@mellanox.com>\nSigned-off-by: Jason Gunthorpe <jgg@mellanox.com>",
"lang": "C",
"project": "linux"
}
| 65
|
Determine whether the code is vulnerable or not.
|
[
"fbCombineSaturateC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)\n{\n int i;",
" for (i = 0; i < width; ++i) {\n CARD32 s, d;\n CARD16 sa, sr, sg, sb, da;\n CARD16 t, u, v;\n CARD32 m,n,o,p;",
" d = READ(dest + i);\n s = READ(src + i);\n\tm = READ(mask + i);",
"\tfbCombineMaskC (&s, &m);",
" sa = (m >> 24);\n sr = (m >> 16) & 0xff;\n sg = (m >> 8) & 0xff;\n sb = (m ) & 0xff;\n da = ~d >> 24;",
" if (sb <= da)\n m = FbAdd(s,d,0,t);\n else\n m = FbGen (s, d, 0, (da << 8) / sb, 0xff, t, u, v);",
" if (sg <= da)\n n = FbAdd(s,d,8,t);\n else\n n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v);",
" if (sr <= da)\n o = FbAdd(s,d,16,t);\n else\n o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v);",
" if (sa <= da)\n p = FbAdd(s,d,24,t);\n else\n p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t, u, v);",
" WRITE(dest + i, m|n|o|p);\n }\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2010-1166",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2010-1166/",
"CWE ID": "CWE-189",
"codeLink": "https://cgit.freedesktop.org/xorg/xserver/commit/?id=d2f813f7db",
"commit_id": "d2f813f7db157fc83abc4b3726821c36ee7e40b1",
"commit_message": null,
"lang": "C",
"project": "xserver"
}
| 66
|
Determine whether the code is vulnerable or not.
|
[
"bool MediaStreamImpl::EnsurePeerConnectionFactory() {\n DCHECK(CalledOnValidThread());\n if (!signaling_thread_) {\n jingle_glue::JingleThreadWrapper::EnsureForCurrentThread();\n jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true);\n signaling_thread_ = jingle_glue::JingleThreadWrapper::current();\n }",
" if (!worker_thread_) {\n if (!chrome_worker_thread_.IsRunning()) {\n if (!chrome_worker_thread_.Start()) {\n LOG(ERROR) << \"Could not start worker thread\";\n signaling_thread_ = NULL;\n return false;\n }\n }\n base::WaitableEvent event(true, false);\n chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(\n &MediaStreamImpl::InitializeWorkerThread,\n this,\n &worker_thread_,\n &event));\n event.Wait();\n DCHECK(worker_thread_);\n }",
" if (!network_manager_)\n network_manager_ = new content::IpcNetworkManager(p2p_socket_dispatcher_);",
" if (!socket_factory_.get()) {\n socket_factory_.reset(\n new content::IpcPacketSocketFactory(p2p_socket_dispatcher_));\n }",
" if (!dependency_factory_->PeerConnectionFactoryCreated()) {\n if (!dependency_factory_->CreatePeerConnectionFactory(\n worker_thread_,\n signaling_thread_,\n p2p_socket_dispatcher_,\n network_manager_,\n socket_factory_.get())) {\n LOG(ERROR) << \"Could not initialize PeerConnection factory\";\n return false;\n }\n }",
" return true;\n}\n"
] |
[
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-2817",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-2817/",
"CWE ID": "CWE-399",
"codeLink": "https://github.com/chromium/chromium/commit/9b9a9f33f0a26f40d083be85a539dd7963adfc9b",
"commit_id": "9b9a9f33f0a26f40d083be85a539dd7963adfc9b",
"commit_message": "Explicitly stopping thread in MediaStreamImpl dtor to avoid any racing issues.\n\nThis may solve the below bugs.\n\nBUG=112408,111202\nTEST=content_unittests\n\nReview URL: https://chromiumcodereview.appspot.com/9307058\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@120222 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 67
|
Determine whether the code is vulnerable or not.
|
[
"static int vmx_restore_fixed0_msr(struct vcpu_vmx *vmx, u32 msr_index, u64 data)\n{\n\tu64 *msr;",
"\tswitch (msr_index) {\n\tcase MSR_IA32_VMX_CR0_FIXED0:\n\t\tmsr = &vmx->nested.msrs.cr0_fixed0;\n\t\tbreak;\n\tcase MSR_IA32_VMX_CR4_FIXED0:\n\t\tmsr = &vmx->nested.msrs.cr4_fixed0;\n\t\tbreak;\n\tdefault:\n\t\tBUG();\n\t}",
"\t/*\n\t * 1 bits (which indicates bits which \"must-be-1\" during VMX operation)\n\t * must be 1 in the restored value.\n\t */\n\tif (!is_bitwise_subset(data, *msr, -1ULL))\n\t\treturn -EINVAL;",
"\t*msr = data;\n\treturn 0;\n}\n"
] |
[
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-12904",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-12904/",
"CWE ID": null,
"codeLink": "https://github.com/torvalds/linux/commit/727ba748e110b4de50d142edca9d6a9b7e6111d8",
"commit_id": "727ba748e110b4de50d142edca9d6a9b7e6111d8",
"commit_message": "kvm: nVMX: Enforce cpl=0 for VMX instructions\n\nVMX instructions executed inside a L1 VM will always trigger a VM exit\neven when executed with cpl 3. This means we must perform the\nprivilege check in software.\n\nFixes: 70f3aac964ae(\"kvm: nVMX: Remove superfluous VMX instruction fault checks\")\nCc: stable@vger.kernel.org\nSigned-off-by: Felix Wilhelm <fwilhelm@google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
"lang": "C",
"project": "linux"
}
| 68
|
Determine whether the code is vulnerable or not.
|
[
"EntrySync* EntrySync::copyTo(DirectoryEntrySync* parent, const String& name, ExceptionState& exceptionState) const\n {",
" RefPtr<EntrySyncCallbackHelper> helper = EntrySyncCallbackHelper::create();",
" m_fileSystem->copy(this, parent, name, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);\n return helper->getResult(exceptionState);\n }"
] |
[
1,
0,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0917",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0917/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/02c8303512ebed345011f7b545e2f418799be2f0",
"commit_id": "02c8303512ebed345011f7b545e2f418799be2f0",
"commit_message": "Oilpan: Ship Oilpan for SyncCallbackHelper, CreateFileResult and CallbackWrapper in filesystem/\n\nThese are leftovers when we shipped Oilpan for filesystem/ once.\n\nBUG=340522\n\nReview URL: https://codereview.chromium.org/501263003\n\ngit-svn-id: svn://svn.chromium.org/blink/trunk@180909 bbb929c8-8fbe-4397-9dbb-9b2b20218538",
"lang": "C",
"project": "Chrome"
}
| 69
|
Determine whether the code is vulnerable or not.
|
[
"EntrySync* EntrySync::copyTo(DirectoryEntrySync* parent, const String& name, ExceptionState& exceptionState) const\n {",
" EntrySyncCallbackHelper* helper = EntrySyncCallbackHelper::create();",
" m_fileSystem->copy(this, parent, name, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);\n return helper->getResult(exceptionState);\n }"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0917",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0917/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/02c8303512ebed345011f7b545e2f418799be2f0",
"commit_id": "02c8303512ebed345011f7b545e2f418799be2f0",
"commit_message": "Oilpan: Ship Oilpan for SyncCallbackHelper, CreateFileResult and CallbackWrapper in filesystem/\n\nThese are leftovers when we shipped Oilpan for filesystem/ once.\n\nBUG=340522\n\nReview URL: https://codereview.chromium.org/501263003\n\ngit-svn-id: svn://svn.chromium.org/blink/trunk@180909 bbb929c8-8fbe-4397-9dbb-9b2b20218538",
"lang": "C",
"project": "Chrome"
}
| 69
|
Determine whether the code is vulnerable or not.
|
[
"ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl(\n ScriptState* scriptState,\n mojom::blink::WebBluetoothGATTQueryQuantity quantity,\n String servicesUUID) {\n if (!connected()) {\n return ScriptPromise::rejectWithDOMException(\n scriptState,\n DOMException::create(NetworkError, kGATTServerNotConnected));\n }",
" ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);\n ScriptPromise promise = resolver->promise();\n AddToActiveAlgorithms(resolver);\n \n mojom::blink::WebBluetoothService* service = m_device->bluetooth()->service();",
" WTF::Optional<String> uuid = WTF::nullopt;\n if (!servicesUUID.isEmpty())\n uuid = servicesUUID;",
" service->RemoteServerGetPrimaryServices(",
" device()->id(), quantity, uuid,",
" convertToBaseCallback(\n WTF::bind(&BluetoothRemoteGATTServer::GetPrimaryServicesCallback,\n wrapPersistent(this), quantity, wrapPersistent(resolver))));\n return promise;\n}"
] |
[
1,
1,
0,
1,
0,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2015-1215",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2015-1215/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/2bceda4948deeaed0a5a99305d0d488eb952f64f",
"commit_id": "2bceda4948deeaed0a5a99305d0d488eb952f64f",
"commit_message": "Allow serialization of empty bluetooth uuids.\n\nThis change allows the passing WTF::Optional<String> types as\nbluetooth.mojom.UUID optional parameter without needing to ensure the passed\nobject isn't empty.\n\nBUG=None\n\nR=juncai, dcheng\n\nReview-Url: https://codereview.chromium.org/2646613003\nCr-Commit-Position: refs/heads/master@{#445809}",
"lang": "C",
"project": "Chrome"
}
| 70
|
Determine whether the code is vulnerable or not.
|
[
"ScriptPromise BluetoothRemoteGATTServer::getPrimaryServicesImpl(\n ScriptState* scriptState,\n mojom::blink::WebBluetoothGATTQueryQuantity quantity,\n String servicesUUID) {\n if (!connected()) {\n return ScriptPromise::rejectWithDOMException(\n scriptState,\n DOMException::create(NetworkError, kGATTServerNotConnected));\n }",
" ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);\n ScriptPromise promise = resolver->promise();\n AddToActiveAlgorithms(resolver);\n \n mojom::blink::WebBluetoothService* service = m_device->bluetooth()->service();",
"",
" service->RemoteServerGetPrimaryServices(",
" device()->id(), quantity, servicesUUID,",
" convertToBaseCallback(\n WTF::bind(&BluetoothRemoteGATTServer::GetPrimaryServicesCallback,\n wrapPersistent(this), quantity, wrapPersistent(resolver))));\n return promise;\n}"
] |
[
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2015-1215",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2015-1215/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/chromium/chromium/commit/2bceda4948deeaed0a5a99305d0d488eb952f64f",
"commit_id": "2bceda4948deeaed0a5a99305d0d488eb952f64f",
"commit_message": "Allow serialization of empty bluetooth uuids.\n\nThis change allows the passing WTF::Optional<String> types as\nbluetooth.mojom.UUID optional parameter without needing to ensure the passed\nobject isn't empty.\n\nBUG=None\n\nR=juncai, dcheng\n\nReview-Url: https://codereview.chromium.org/2646613003\nCr-Commit-Position: refs/heads/master@{#445809}",
"lang": "C",
"project": "Chrome"
}
| 70
|
Determine whether the code is vulnerable or not.
|
[
"static void _sx_sasl_features(sx_t s, sx_plugin_t p, nad_t nad) {\n _sx_sasl_t ctx = (_sx_sasl_t) p->private;\n Gsasl_session *sd = (Gsasl_session *) s->plugin_data[p->index];\n int nmechs, ret;\n char *mechs, *mech, *c;",
" if(s->type != type_SERVER)\n return;",
" if(sd != NULL) {\n _sx_debug(ZONE, \"already auth'd, not offering sasl mechanisms\");\n return;\n }",
" if(!(s->flags & SX_SASL_OFFER)) {\n _sx_debug(ZONE, \"application didn't ask us to offer sasl, so we won't\");\n return;\n }",
"#ifdef HAVE_SSL\n if((s->flags & SX_SSL_STARTTLS_REQUIRE) && s->ssf == 0) {\n _sx_debug(ZONE, \"ssl not established yet but the app requires it, not offering mechanisms\");\n return;\n }\n#endif",
" _sx_debug(ZONE, \"offering sasl mechanisms\");",
" ret = gsasl_server_mechlist(ctx->gsasl_ctx, &mechs);\n if(ret != GSASL_OK) {\n _sx_debug(ZONE, \"gsasl_server_mechlist failed (%d): %s, not offering sasl for this conn\", ret, gsasl_strerror (ret));\n return;\n }",
" mech = mechs;\n nmechs = 0;\n while(mech != NULL) {\n c = strchr(mech, ' ');\n if(c != NULL)\n *c = '\\0';",
" if ((ctx->cb)(sx_sasl_cb_CHECK_MECH, mech, NULL, s, ctx->cbarg)==sx_sasl_ret_OK) {\n if (nmechs == 0) {\n int ns = nad_add_namespace(nad, uri_SASL, NULL);\n nad_append_elem(nad, ns, \"mechanisms\", 1);\n }\n _sx_debug(ZONE, \"offering mechanism: %s\", mech);",
" nad_append_elem(nad, -1 /*ns*/, \"mechanism\", 2);\n nad_append_cdata(nad, mech, strlen(mech), 3);\n nmechs++;\n }",
" if(c == NULL)\n mech = NULL;\n else\n mech = ++c;\n }",
" free(mechs);\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-10807",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-10807/",
"CWE ID": "CWE-287",
"codeLink": "https://github.com/jabberd2/jabberd2/commit/8416ae54ecefa670534f27a31db71d048b9c7f16",
"commit_id": "8416ae54ecefa670534f27a31db71d048b9c7f16",
"commit_message": "Fixed offered SASL mechanism check",
"lang": "C",
"project": "jabberd2"
}
| 71
|
Determine whether the code is vulnerable or not.
|
[
"void WebRuntimeFeatures::enablePeerConnection(bool enable)\n{\n RuntimeEnabledFeatures::setPeerConnectionEnabled(enable);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0912",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0912/",
"CWE ID": "CWE-94",
"codeLink": "https://github.com/chromium/chromium/commit/faceb51d5058e1159835a4b0cd65081bb0a9de1e",
"commit_id": "faceb51d5058e1159835a4b0cd65081bb0a9de1e",
"commit_message": "Remove SpeechSynthesis runtime flag (status=stable)\n\nBUG=402536\n\nReview URL: https://codereview.chromium.org/482273005\n\ngit-svn-id: svn://svn.chromium.org/blink/trunk@180763 bbb929c8-8fbe-4397-9dbb-9b2b20218538",
"lang": "C",
"project": "Chrome"
}
| 72
|
Determine whether the code is vulnerable or not.
|
[
"void drm_mode_config_cleanup(struct drm_device *dev)\n{\n\tstruct drm_connector *connector, *ot;\n\tstruct drm_crtc *crtc, *ct;\n\tstruct drm_encoder *encoder, *enct;\n\tstruct drm_framebuffer *fb, *fbt;\n\tstruct drm_property *property, *pt;",
"\tlist_for_each_entry_safe(encoder, enct, &dev->mode_config.encoder_list,\n\t\t\t\t head) {\n\t\tencoder->funcs->destroy(encoder);\n\t}",
"\tlist_for_each_entry_safe(connector, ot,\n\t\t\t\t &dev->mode_config.connector_list, head) {\n\t\tconnector->funcs->destroy(connector);\n\t}",
"\tlist_for_each_entry_safe(property, pt, &dev->mode_config.property_list,\n\t\t\t\t head) {\n\t\tdrm_property_destroy(dev, property);\n\t}",
"\tlist_for_each_entry_safe(fb, fbt, &dev->mode_config.fb_list, head) {\n\t\tfb->funcs->destroy(fb);\n\t}",
"\tlist_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) {\n\t\tcrtc->funcs->destroy(crtc);\n\t}",
"}\n"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-0044",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-0044/",
"CWE ID": "CWE-189",
"codeLink": "https://github.com/torvalds/linux/commit/a5cd335165e31db9dbab636fd29895d41da55dd2",
"commit_id": "a5cd335165e31db9dbab636fd29895d41da55dd2",
"commit_message": "drm: integer overflow in drm_mode_dirtyfb_ioctl()\n\nThere is a potential integer overflow in drm_mode_dirtyfb_ioctl()\nif userspace passes in a large num_clips. The call to kmalloc would\nallocate a small buffer, and the call to fb->funcs->dirty may result\nin a memory corruption.\n\nReported-by: Haogang Chen <haogangchen@gmail.com>\nSigned-off-by: Xi Wang <xi.wang@gmail.com>\nCc: stable@kernel.org\nSigned-off-by: Dave Airlie <airlied@redhat.com>",
"lang": "C",
"project": "linux"
}
| 73
|
Determine whether the code is vulnerable or not.
|
[
"gfx::Size RenderWidgetHostViewAura::GetMaximumSize() const {\n return gfx::Size();\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0886",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0886/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76",
"commit_id": "18d67244984a574ba2dd8779faabc0e3e34f4b76",
"commit_message": "Implement TextureImageTransportSurface using texture mailbox\n\nThis has a couple of advantages:\n- allow tearing down and recreating the UI parent context without\nlosing the renderer contexts\n- do not require a context to be able to generate textures when\ncreating the GLSurfaceHandle\n- clearer ownership semantics that potentially allows for more\nrobust and easier lost context handling/thumbnailing/etc., since a texture is at\nany given time owned by either: UI parent, mailbox, or\nTextureImageTransportSurface\n- simplify frontbuffer protection logic;\nthe frontbuffer textures are now owned by RWHV where they are refcounted\n\nThe TextureImageTransportSurface informs RenderWidgetHostView of the\nmailbox names for the front- and backbuffer textures by\nassociating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message.\nDuring SwapBuffers() or PostSubBuffer() cycles, it then uses \nproduceTextureCHROMIUM() and consumeTextureCHROMIUM()\nto transfer ownership between renderer and browser compositor.\n\nRWHV sends back the surface_handle of the buffer being returned with the Swap ACK\n(or 0 if no buffer is being returned in which case TextureImageTransportSurface will\nallocate a new texture - note that this could be used to \nsimply keep textures for thumbnailing).\n\nBUG=154815,139616\nTBR=sky@chromium.org\n\nReview URL: https://chromiumcodereview.appspot.com/11194042\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 74
|
Determine whether the code is vulnerable or not.
|
[
" bool HasHostBeenLookedUp(const std::string& host) {\n return base::Contains(successful_dns_lookups_, host) ||\n base::Contains(unsuccessful_dns_lookups_, host);\n }\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2017-5077",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2017-5077/",
"CWE ID": "CWE-125",
"codeLink": "https://github.com/chromium/chromium/commit/fec26ff33bf372476a70326f3669a35f34a9d474",
"commit_id": "fec26ff33bf372476a70326f3669a35f34a9d474",
"commit_message": "Origins should be represented as url::Origin (not as GURL).\n\nAs pointed out in //docs/security/origin-vs-url.md, origins should be\nrepresented as url::Origin (not as GURL). This CL applies this\nguideline to predictor-related code and changes the type of the\nfollowing fields from GURL to url::Origin:\n- OriginRequestSummary::origin\n- PreconnectedRequestStats::origin\n- PreconnectRequest::origin\n\nThe old code did not depend on any non-origin parts of GURL\n(like path and/or query). Therefore, this CL has no intended\nbehavior change.\n\nBug: 973885\nChange-Id: Idd14590b4834cb9d50c74ed747b595fe1a4ba357\nReviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895167\nCommit-Queue: Łukasz Anforowicz <lukasza@chromium.org>\nReviewed-by: Alex Ilin <alexilin@chromium.org>\nCr-Commit-Position: refs/heads/master@{#716311}",
"lang": "C",
"project": "Chrome"
}
| 75
|
Determine whether the code is vulnerable or not.
|
[
"ProcRenderQueryFilters (ClientPtr client)\n{\n REQUEST (xRenderQueryFiltersReq);\n DrawablePtr\t\t\tpDrawable;\n xRenderQueryFiltersReply\t*reply;\n int\t\t\t\tnbytesName;\n int\t\t\t\tnnames;\n ScreenPtr\t\t\tpScreen;\n PictureScreenPtr\t\tps;\n int\t\t\t\ti, j, len, total_bytes, rc;\n INT16\t\t\t*aliases;\n char\t\t\t*names;",
" REQUEST_SIZE_MATCH(xRenderQueryFiltersReq);\n rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,\n\t\t\t DixGetAttrAccess);\n if (rc != Success)\n\treturn rc;\n \n pScreen = pDrawable->pScreen;\n nbytesName = 0;\n nnames = 0;\n ps = GetPictureScreenIfSet(pScreen);\n if (ps)\n {\n\tfor (i = 0; i < ps->nfilters; i++)\n\t nbytesName += 1 + strlen (ps->filters[i].name);\n\tfor (i = 0; i < ps->nfilterAliases; i++)\n\t nbytesName += 1 + strlen (ps->filterAliases[i].alias);\n\tnnames = ps->nfilters + ps->nfilterAliases;\n }\n len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);\n total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2);\n reply = (xRenderQueryFiltersReply *) malloc(total_bytes);\n if (!reply)\n\treturn BadAlloc;\n aliases = (INT16 *) (reply + 1);\n names = (char *) (aliases + ((nnames + 1) & ~1));\n \n reply->type = X_Reply;\n reply->sequenceNumber = client->sequence;\n reply->length = len;\n reply->numAliases = nnames;\n reply->numFilters = nnames;\n if (ps)\n {",
"\t/* fill in alias values */\n\tfor (i = 0; i < ps->nfilters; i++)\n\t aliases[i] = FilterAliasNone;\n\tfor (i = 0; i < ps->nfilterAliases; i++)\n\t{\n\t for (j = 0; j < ps->nfilters; j++)\n\t\tif (ps->filterAliases[i].filter_id == ps->filters[j].id)\n\t\t break;\n\t if (j == ps->nfilters)\n\t {\n\t\tfor (j = 0; j < ps->nfilterAliases; j++)\n\t\t if (ps->filterAliases[i].filter_id == \n\t\t\tps->filterAliases[j].alias_id)\n\t\t {\n\t\t\tbreak;\n\t\t }\n\t\tif (j == ps->nfilterAliases)\n\t\t j = FilterAliasNone;\n\t\telse\n\t\t j = j + ps->nfilters;\n\t }\n\t aliases[i + ps->nfilters] = j;\n\t}",
"\t/* fill in filter names */\n\tfor (i = 0; i < ps->nfilters; i++)\n\t{\n\t j = strlen (ps->filters[i].name);\n\t *names++ = j;\n\t strncpy (names, ps->filters[i].name, j);\n\t names += j;\n\t}\n\t\n\t/* fill in filter alias names */\n\tfor (i = 0; i < ps->nfilterAliases; i++)\n\t{\n\t j = strlen (ps->filterAliases[i].alias);\n\t *names++ = j;\n\t strncpy (names, ps->filterAliases[i].alias, j);\n\t names += j;\n\t}\n }",
" if (client->swapped)\n {\n\tregister int n;",
"\tfor (i = 0; i < reply->numAliases; i++)\n\t{\n\t swaps (&aliases[i], n);\n\t}\n \tswaps(&reply->sequenceNumber, n);\n \tswapl(&reply->length, n);\n\tswapl(&reply->numAliases, n);\n\tswapl(&reply->numFilters, n);\n }\n WriteToClient(client, total_bytes, (char *) reply);\n free(reply);\n \n return Success;\n}\n"
] |
[
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2010-4819",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2010-4819/",
"CWE ID": "CWE-20",
"codeLink": "https://cgit.freedesktop.org/xorg/xserver/commit/render/render.c?id=5725849a1b427cd4a72b84e57f211edb35838718",
"commit_id": "5725849a1b427cd4a72b84e57f211edb35838718",
"commit_message": null,
"lang": "C",
"project": "xserver"
}
| 76
|
Determine whether the code is vulnerable or not.
|
[
" LRUCanvasResourceProviderCache(int capacity)\n : resource_providers_(\n std::make_unique<std::unique_ptr<CanvasResourceProvider>[]>(\n capacity)),\n capacity_(capacity) {}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-6047",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-6047/",
"CWE ID": "CWE-20",
"codeLink": "https://github.com/chromium/chromium/commit/fae4d7b7d7e5c8a04a8b7a3258c0fc8362afa24c",
"commit_id": "fae4d7b7d7e5c8a04a8b7a3258c0fc8362afa24c",
"commit_message": "Simplify WebGL error message\n\nThe WebGL exception message text contains the full URL of a blocked\ncross-origin resource. It should instead contain only a generic notice.\n\nBug: 799847\nCq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel\nChange-Id: I3a7f00462a4643c41882f2ee7e7767e6d631557e\nReviewed-on: https://chromium-review.googlesource.com/854986\nReviewed-by: Brandon Jones <bajones@chromium.org>\nReviewed-by: Kenneth Russell <kbr@chromium.org>\nCommit-Queue: Eric Lawrence <elawrence@chromium.org>\nCr-Commit-Position: refs/heads/master@{#528458}",
"lang": "C",
"project": "Chrome"
}
| 77
|
Determine whether the code is vulnerable or not.
|
[
"bool IsNonClientLocation(Window* target, const gfx::Point& location) {\n if (!target->delegate())\n return false;\n int hit_test_code = target->delegate()->GetNonClientComponent(location);\n return hit_test_code != HTCLIENT && hit_test_code != HTNOWHERE;\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-2875",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-2875/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/1266ba494530a267ec8a21442ea1b5cae94da4fb",
"commit_id": "1266ba494530a267ec8a21442ea1b5cae94da4fb",
"commit_message": "Introduce XGetImage() for GrabWindowSnapshot() in ChromeOS.\n\nBUG=119492\nTEST=manually done\n\nReview URL: https://chromiumcodereview.appspot.com/10386124\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@137556 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 78
|
Determine whether the code is vulnerable or not.
|
[
"void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) {\n ClearPowerSaveBlockers(rvh);\n render_manager_.RenderViewDeleted(rvh);\n FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh));\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-6626",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-6626/",
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/90fb08ed0146c9beacfd4dde98a20fc45419fff3",
"commit_id": "90fb08ed0146c9beacfd4dde98a20fc45419fff3",
"commit_message": "Cancel JavaScript dialogs when an interstitial appears.\n\nBUG=295695\nTEST=See bug for repro steps.\n\nReview URL: https://chromiumcodereview.appspot.com/24360011\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@225026 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 79
|
Determine whether the code is vulnerable or not.
|
[
"static int __init setup_print_fatal_signals(char *str)\n{\n\tget_option (&str, &print_fatal_signals);",
"\treturn 1;\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-2141",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-2141/",
"CWE ID": "CWE-399",
"codeLink": "https://github.com/torvalds/linux/commit/b9e146d8eb3b9ecae5086d373b50fa0c1f3e7f0f",
"commit_id": "b9e146d8eb3b9ecae5086d373b50fa0c1f3e7f0f",
"commit_message": "kernel/signal.c: stop info leak via the tkill and the tgkill syscalls\n\nThis fixes a kernel memory contents leak via the tkill and tgkill syscalls\nfor compat processes.\n\nThis is visible in the siginfo_t->_sifields._rt.si_sigval.sival_ptr field\nwhen handling signals delivered from tkill.\n\nThe place of the infoleak:\n\nint copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)\n{\n ...\n put_user_ex(ptr_to_compat(from->si_ptr), &to->si_ptr);\n ...\n}\n\nSigned-off-by: Emese Revfy <re.emese@gmail.com>\nReviewed-by: PaX Team <pageexec@freemail.hu>\nSigned-off-by: Kees Cook <keescook@chromium.org>\nCc: Al Viro <viro@zeniv.linux.org.uk>\nCc: Oleg Nesterov <oleg@redhat.com>\nCc: \"Eric W. Biederman\" <ebiederm@xmission.com>\nCc: Serge Hallyn <serge.hallyn@canonical.com>\nCc: <stable@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
"lang": "C",
"project": "linux"
}
| 80
|
Determine whether the code is vulnerable or not.
|
[
"static struct transit *transit_intern(struct transit *transit)\n{\n\tstruct transit *find;",
"\tfind = hash_get(transit_hash, transit, transit_hash_alloc);\n\tif (find != transit)\n\t\ttransit_free(transit);\n\tfind->refcnt++;",
"\treturn find;\n}\n"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2019-5892",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2019-5892/",
"CWE ID": null,
"codeLink": "https://github.com/FRRouting/frr/commit/943d595a018e69b550db08cccba1d0778a86705a",
"commit_id": "943d595a018e69b550db08cccba1d0778a86705a",
"commit_message": "bgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined\n\nSigned-off-by: Lou Berger <lberger@labn.net>",
"lang": "C",
"project": "frr"
}
| 81
|
Determine whether the code is vulnerable or not.
|
[
" explicit CloseDialogCallbackWrapper(CloseCallback callback)\n : callback_(std::move(callback)) {}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-20067",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-20067/",
"CWE ID": "CWE-254",
"codeLink": "https://github.com/chromium/chromium/commit/a7d715ae5b654d1f98669fd979a00282a7229044",
"commit_id": "a7d715ae5b654d1f98669fd979a00282a7229044",
"commit_message": "Prevent renderer initiated back navigation to cancel a browser one.\n\nRenderer initiated back/forward navigations must not be able to cancel ongoing\nbrowser initiated navigation if they are not user initiated.\n\nNote: 'normal' renderer initiated navigation uses the\nFrameHost::BeginNavigation() path. A code similar to this patch is done\nin NavigatorImpl::OnBeginNavigation().\n\nTest:\n-----\n\nAdded: NavigationBrowserTest.\n * HistoryBackInBeforeUnload\n * HistoryBackInBeforeUnloadAfterSetTimeout\n * HistoryBackCancelPendingNavigationNoUserGesture\n * HistoryBackCancelPendingNavigationUserGesture\n\nFixed:\n * (WPT) .../the-history-interface/traverse_the_history_2.html\n * (WPT) .../the-history-interface/traverse_the_history_3.html\n * (WPT) .../the-history-interface/traverse_the_history_4.html\n * (WPT) .../the-history-interface/traverse_the_history_5.html\n\nBug: 879965\nChange-Id: I1a9bfaaea1ffc219e6c32f6e676b660e746c578c\nReviewed-on: https://chromium-review.googlesource.com/1209744\nCommit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>\nReviewed-by: Daniel Cheng <dcheng@chromium.org>\nReviewed-by: Mustaq Ahmed <mustaq@chromium.org>\nReviewed-by: Camille Lamy <clamy@chromium.org>\nReviewed-by: Charlie Reis <creis@chromium.org>\nCr-Commit-Position: refs/heads/master@{#592823}",
"lang": "C",
"project": "Chrome"
}
| 82
|
Determine whether the code is vulnerable or not.
|
[
"struct ndp_msgra *ndp_msgra(struct ndp_msg *msg)\n{\n\tif (ndp_msg_type(msg) != NDP_MSG_RA)\n\t\treturn NULL;\n\treturn &msg->nd_msg.ra;\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-3698",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-3698/",
"CWE ID": "CWE-284",
"codeLink": "https://github.com/jpirko/libndp/commit/a4892df306e0532487f1634ba6d4c6d4bb381c7f",
"commit_id": "a4892df306e0532487f1634ba6d4c6d4bb381c7f",
"commit_message": "libndp: validate the IPv6 hop limit\n\nNone of the NDP messages should ever come from a non-local network; as\nstated in RFC4861's 6.1.1 (RS), 6.1.2 (RA), 7.1.1 (NS), 7.1.2 (NA),\nand 8.1. (redirect):\n\n - The IP Hop Limit field has a value of 255, i.e., the packet\n could not possibly have been forwarded by a router.\n\nThis fixes CVE-2016-3698.\n\nReported by: Julien BERNARD <julien.bernard@viagenie.ca>\nSigned-off-by: Lubomir Rintel <lkundrak@v3.sk>\nSigned-off-by: Jiri Pirko <jiri@mellanox.com>",
"lang": "C",
"project": "libndp"
}
| 83
|
Determine whether the code is vulnerable or not.
|
[
"void __init proc_root_init(void)\n{\n\tint err;",
"\tproc_init_inodecache();\n\terr = register_filesystem(&proc_fs_type);\n\tif (err)\n\t\treturn;",
"\tproc_self_init();\n\tproc_thread_self_init();\n\tproc_symlink(\"mounts\", NULL, \"self/mounts\");",
"\tproc_net_init();",
"#ifdef CONFIG_SYSVIPC\n\tproc_mkdir(\"sysvipc\", NULL);\n#endif\n\tproc_mkdir(\"fs\", NULL);\n\tproc_mkdir(\"driver\", NULL);\n\tproc_create_mount_point(\"fs/nfsd\"); /* somewhere for the nfsd filesystem to be mounted */\n#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)\n\t/* just give it a mountpoint */\n\tproc_create_mount_point(\"openprom\");\n#endif\n\tproc_tty_init();\n\tproc_mkdir(\"bus\", NULL);\n\tproc_sys_init();\n}\n"
] |
[
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2016-1583",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2016-1583/",
"CWE ID": "CWE-119",
"codeLink": "https://github.com/torvalds/linux/commit/f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d",
"commit_id": "f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d",
"commit_message": "Merge branch 'stacking-fixes' (vfs stacking fixes from Jann)\n\nMerge filesystem stacking fixes from Jann Horn.\n\n* emailed patches from Jann Horn <jannh@google.com>:\n sched: panic on corrupted stack end\n ecryptfs: forbid opening files without mmap handler\n proc: prevent stacking filesystems on top",
"lang": "C",
"project": "linux"
}
| 84
|
Determine whether the code is vulnerable or not.
|
[
"static inline int ep_op_has_event(int op)\n{\n\treturn op != EPOLL_CTL_DEL;\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2012-3375",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2012-3375/",
"CWE ID": null,
"codeLink": "https://github.com/torvalds/linux/commit/13d518074a952d33d47c428419693f63389547e9",
"commit_id": "13d518074a952d33d47c428419693f63389547e9",
"commit_message": "epoll: clear the tfile_check_list on -ELOOP\n\nAn epoll_ctl(,EPOLL_CTL_ADD,,) operation can return '-ELOOP' to prevent\ncircular epoll dependencies from being created. However, in that case we\ndo not properly clear the 'tfile_check_list'. Thus, add a call to\nclear_tfile_check_list() for the -ELOOP case.\n\nSigned-off-by: Jason Baron <jbaron@redhat.com>\nReported-by: Yurij M. Plotnikov <Yurij.Plotnikov@oktetlabs.ru>\nCc: Nelson Elhage <nelhage@nelhage.com>\nCc: Davide Libenzi <davidel@xmailserver.org>\nTested-by: Alexandra N. Kossovsky <Alexandra.Kossovsky@oktetlabs.ru>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
"lang": "C",
"project": "linux"
}
| 85
|
Determine whether the code is vulnerable or not.
|
[
"void inode_set_flags(struct inode *inode, unsigned int flags,\n\t\t unsigned int mask)\n{\n\tunsigned int old_flags, new_flags;",
"\tWARN_ON_ONCE(flags & ~mask);\n\tdo {\n\t\told_flags = ACCESS_ONCE(inode->i_flags);\n\t\tnew_flags = (old_flags & ~mask) | flags;\n\t} while (unlikely(cmpxchg(&inode->i_flags, old_flags,\n\t\t\t\t new_flags) != old_flags));\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2014-4014",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2014-4014/",
"CWE ID": "CWE-264",
"codeLink": "https://github.com/torvalds/linux/commit/23adbe12ef7d3d4195e80800ab36b37bee28cd03",
"commit_id": "23adbe12ef7d3d4195e80800ab36b37bee28cd03",
"commit_message": "fs,userns: Change inode_capable to capable_wrt_inode_uidgid\n\nThe kernel has no concept of capabilities with respect to inodes; inodes\nexist independently of namespaces. For example, inode_capable(inode,\nCAP_LINUX_IMMUTABLE) would be nonsense.\n\nThis patch changes inode_capable to check for uid and gid mappings and\nrenames it to capable_wrt_inode_uidgid, which should make it more\nobvious what it does.\n\nFixes CVE-2014-4014.\n\nCc: Theodore Ts'o <tytso@mit.edu>\nCc: Serge Hallyn <serge.hallyn@ubuntu.com>\nCc: \"Eric W. Biederman\" <ebiederm@xmission.com>\nCc: Dave Chinner <david@fromorbit.com>\nCc: stable@vger.kernel.org\nSigned-off-by: Andy Lutomirski <luto@amacapital.net>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
"lang": "C",
"project": "linux"
}
| 86
|
Determine whether the code is vulnerable or not.
|
[
"VideoCodec StringToVideoCodec(const std::string& codec_id) {\n std::vector<std::string> elem = base::SplitString(\n codec_id, \".\", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);\n if (elem.empty())\n return kUnknownVideoCodec;\n \n VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;\n uint8_t level = 0;",
" gfx::ColorSpace::TransferID eotf = gfx::ColorSpace::TransferID::INVALID;",
" \n if (codec_id == \"vp8\" || codec_id == \"vp8.0\")\n return kCodecVP8;",
" if (ParseNewStyleVp9CodecID(codec_id, &profile, &level, &eotf) ||",
" ParseLegacyVp9CodecID(codec_id, &profile, &level)) {\n return kCodecVP9;\n }\n if (codec_id == \"theora\")\n return kCodecTheora;\n if (ParseAVCCodecId(codec_id, &profile, &level))\n return kCodecH264;\n#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)\n if (ParseAVCCodecId(TranslateLegacyAvc1CodecIds(codec_id), &profile, &level))\n return kCodecH264;\n#endif\n#if BUILDFLAG(ENABLE_HEVC_DEMUXING)\n if (ParseHEVCCodecId(codec_id, &profile, &level))\n return kCodecHEVC;\n#endif\n#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)\n if (ParseDolbyVisionCodecId(codec_id, &profile, &level))\n return kCodecDolbyVision;\n#endif\n return kUnknownVideoCodec;\n}"
] |
[
1,
0,
1,
0,
1
] |
BIGVUL
|
{
"CVE ID": null,
"CVE Page": null,
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/2fb4f2c9c461551d43fdfa28ef4c960da81a47dd",
"commit_id": "2fb4f2c9c461551d43fdfa28ef4c960da81a47dd",
"commit_message": "Gate support for certain EOTFs/primaries/matrices on color management / hdr flags\n\nCreates a new class VideoColorSpace specifically for encoding color spaces\naccording to ISO/IEC 23001-8.\n\nPlumb this color space through from parsing to validation.\n\nBUG=687627\n\nReview-Url: https://codereview.chromium.org/2742113002\nCr-Commit-Position: refs/heads/master@{#456518}",
"lang": "C",
"project": "Chrome"
}
| 87
|
Determine whether the code is vulnerable or not.
|
[
"VideoCodec StringToVideoCodec(const std::string& codec_id) {\n std::vector<std::string> elem = base::SplitString(\n codec_id, \".\", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);\n if (elem.empty())\n return kUnknownVideoCodec;\n \n VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;\n uint8_t level = 0;",
" VideoColorSpace color_space;",
" \n if (codec_id == \"vp8\" || codec_id == \"vp8.0\")\n return kCodecVP8;",
" if (ParseNewStyleVp9CodecID(codec_id, &profile, &level, &color_space) ||",
" ParseLegacyVp9CodecID(codec_id, &profile, &level)) {\n return kCodecVP9;\n }\n if (codec_id == \"theora\")\n return kCodecTheora;\n if (ParseAVCCodecId(codec_id, &profile, &level))\n return kCodecH264;\n#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)\n if (ParseAVCCodecId(TranslateLegacyAvc1CodecIds(codec_id), &profile, &level))\n return kCodecH264;\n#endif\n#if BUILDFLAG(ENABLE_HEVC_DEMUXING)\n if (ParseHEVCCodecId(codec_id, &profile, &level))\n return kCodecHEVC;\n#endif\n#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)\n if (ParseDolbyVisionCodecId(codec_id, &profile, &level))\n return kCodecDolbyVision;\n#endif\n return kUnknownVideoCodec;\n}"
] |
[
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": null,
"CVE Page": null,
"CWE ID": null,
"codeLink": "https://github.com/chromium/chromium/commit/2fb4f2c9c461551d43fdfa28ef4c960da81a47dd",
"commit_id": "2fb4f2c9c461551d43fdfa28ef4c960da81a47dd",
"commit_message": "Gate support for certain EOTFs/primaries/matrices on color management / hdr flags\n\nCreates a new class VideoColorSpace specifically for encoding color spaces\naccording to ISO/IEC 23001-8.\n\nPlumb this color space through from parsing to validation.\n\nBUG=687627\n\nReview-Url: https://codereview.chromium.org/2742113002\nCr-Commit-Position: refs/heads/master@{#456518}",
"lang": "C",
"project": "Chrome"
}
| 87
|
Determine whether the code is vulnerable or not.
|
[
"php_apache_sapi_flush(void *server_context)\n{\n\tphp_struct *ctx;\n\trequest_rec *r;\n\tTSRMLS_FETCH();",
"\tctx = server_context;",
"\t/* If we haven't registered a server_context yet,\n\t * then don't bother flushing. */\n\tif (!server_context) {\n\t\treturn;\n\t}",
"\tr = ctx->r;",
"\tsapi_send_headers(TSRMLS_C);",
"\tr->status = SG(sapi_headers).http_response_code;\n\tSG(headers_sent) = 1;",
"\tif (ap_rflush(r) < 0 || r->connection->aborted) {\n\t\tphp_handle_aborted_connection();\n\t}\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2015-3330",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2015-3330/",
"CWE ID": "CWE-20",
"codeLink": "https://git.php.net/?p=php-src.git;a=commit;h=809610f5ea38a83b284e1125d1fff129bdd615e7",
"commit_id": "809610f5ea38a83b284e1125d1fff129bdd615e7",
"commit_message": null,
"lang": "C",
"project": "php"
}
| 88
|
Determine whether the code is vulnerable or not.
|
[
"void FileAPIMessageFilter::OnAppendBlobDataItem(\n const GURL& url, const BlobData::Item& item) {\n DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));\n if (item.type() == BlobData::Item::TYPE_FILE &&\n !ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(\n process_id_, item.path())) {\n OnRemoveBlob(url);\n return;\n }\n if (item.length() == 0) {\n BadMessageReceived();\n return;\n }\n blob_storage_context_->controller()->AppendBlobDataItem(url, item);\n}\n"
] |
[
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2013-0829",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2013-0829/",
"CWE ID": "CWE-264",
"codeLink": "https://github.com/chromium/chromium/commit/d123966ec156cd2f92fdada36be39694641b479e",
"commit_id": "d123966ec156cd2f92fdada36be39694641b479e",
"commit_message": "File permission fix: now we selectively grant read permission for Sandboxed files\n\nWe also need to check the read permission and call GrantReadFile() for\nsandboxed files for CreateSnapshotFile().\n\nBUG=162114\nTEST=manual\n\nReview URL: https://codereview.chromium.org/11280231\n\ngit-svn-id: svn://svn.chromium.org/chrome/trunk/src@170181 0039d316-1c4b-4281-b951-d872f2087c98",
"lang": "C",
"project": "Chrome"
}
| 89
|
Determine whether the code is vulnerable or not.
|
[
"static int _nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct rpc_cred *cred)\n{\n\tstruct nfs_fsinfo fsinfo;\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETCLIENTID_CONFIRM],\n\t\t.rpc_argp = clp,\n\t\t.rpc_resp = &fsinfo,\n\t\t.rpc_cred = cred,\n\t};\n\tunsigned long now;\n\tint status;",
"\tnow = jiffies;\n\tstatus = rpc_call_sync(clp->cl_rpcclient, &msg, 0);\n\tif (status == 0) {\n\t\tspin_lock(&clp->cl_lock);\n\t\tclp->cl_lease_time = fsinfo.lease_time * HZ;\n\t\tclp->cl_last_renewal = now;\n\t\tspin_unlock(&clp->cl_lock);\n\t}\n\treturn status;\n}\n"
] |
[
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2011-4324",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2011-4324/",
"CWE ID": null,
"codeLink": "https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9",
"commit_id": "dc0b027dfadfcb8a5504f7d8052754bf8d501ab9",
"commit_message": "NFSv4: Convert the open and close ops to use fmode\n\nSigned-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>",
"lang": "C",
"project": "linux"
}
| 90
|
Determine whether the code is vulnerable or not.
|
[
"static void common_hrtimer_rearm(struct k_itimer *timr)\n {\n \tstruct hrtimer *timer = &timr->it.real.timer;\n \n \tif (!timr->it_interval)\n \t\treturn;\n ",
"\ttimr->it_overrun += (unsigned int) hrtimer_forward(timer,\n\t\t\t\t\t\ttimer->base->get_time(),\n\t\t\t\t\t\ttimr->it_interval);",
" \thrtimer_restart(timer);\n }"
] |
[
1,
0,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-12896",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-12896/",
"CWE ID": "CWE-190",
"codeLink": "https://github.com/torvalds/linux/commit/78c9c4dfbf8c04883941445a195276bb4bb92c76",
"commit_id": "78c9c4dfbf8c04883941445a195276bb4bb92c76",
"commit_message": "posix-timers: Sanitize overrun handling\n\nThe posix timer overrun handling is broken because the forwarding functions\ncan return a huge number of overruns which does not fit in an int. As a\nconsequence timer_getoverrun(2) and siginfo::si_overrun can turn into\nrandom number generators.\n\nThe k_clock::timer_forward() callbacks return a 64 bit value now. Make\nk_itimer::ti_overrun[_last] 64bit as well, so the kernel internal\naccounting is correct. 3Remove the temporary (int) casts.\n\nAdd a helper function which clamps the overrun value returned to user space\nvia timer_getoverrun(2) or siginfo::si_overrun limited to a positive value\nbetween 0 and INT_MAX. INT_MAX is an indicator for user space that the\noverrun value has been clamped.\n\nReported-by: Team OWL337 <icytxw@gmail.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nAcked-by: John Stultz <john.stultz@linaro.org>\nCc: Peter Zijlstra <peterz@infradead.org>\nCc: Michael Kerrisk <mtk.manpages@gmail.com>\nLink: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de",
"lang": "C",
"project": "linux"
}
| 91
|
Determine whether the code is vulnerable or not.
|
[
"static void common_hrtimer_rearm(struct k_itimer *timr)\n {\n \tstruct hrtimer *timer = &timr->it.real.timer;\n \n \tif (!timr->it_interval)\n \t\treturn;\n ",
"\ttimr->it_overrun += hrtimer_forward(timer, timer->base->get_time(),\n\t\t\t\t\t timr->it_interval);",
" \thrtimer_restart(timer);\n }"
] |
[
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-12896",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-12896/",
"CWE ID": "CWE-190",
"codeLink": "https://github.com/torvalds/linux/commit/78c9c4dfbf8c04883941445a195276bb4bb92c76",
"commit_id": "78c9c4dfbf8c04883941445a195276bb4bb92c76",
"commit_message": "posix-timers: Sanitize overrun handling\n\nThe posix timer overrun handling is broken because the forwarding functions\ncan return a huge number of overruns which does not fit in an int. As a\nconsequence timer_getoverrun(2) and siginfo::si_overrun can turn into\nrandom number generators.\n\nThe k_clock::timer_forward() callbacks return a 64 bit value now. Make\nk_itimer::ti_overrun[_last] 64bit as well, so the kernel internal\naccounting is correct. 3Remove the temporary (int) casts.\n\nAdd a helper function which clamps the overrun value returned to user space\nvia timer_getoverrun(2) or siginfo::si_overrun limited to a positive value\nbetween 0 and INT_MAX. INT_MAX is an indicator for user space that the\noverrun value has been clamped.\n\nReported-by: Team OWL337 <icytxw@gmail.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nAcked-by: John Stultz <john.stultz@linaro.org>\nCc: Peter Zijlstra <peterz@infradead.org>\nCc: Michael Kerrisk <mtk.manpages@gmail.com>\nLink: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de",
"lang": "C",
"project": "linux"
}
| 91
|
Determine whether the code is vulnerable or not.
|
[
"static int StreamTcpTest23(void)\n{\n StreamTcpThread stt;\n TcpSession ssn;\n Flow f;\n TCPHdr tcph;\n uint8_t packet[1460] = \"\";\n ThreadVars tv;\n PacketQueue pq;",
" Packet *p = SCMalloc(SIZE_OF_PACKET);\n FAIL_IF(p == NULL);",
" memset(&pq,0,sizeof(PacketQueue));\n memset(p, 0, SIZE_OF_PACKET);\n memset(&f, 0, sizeof (Flow));\n memset(&tcph, 0, sizeof (TCPHdr));\n memset(&tv, 0, sizeof (ThreadVars));",
" StreamTcpUTInit(&stt.ra_ctx);\n StreamTcpUTSetupSession(&ssn);\n FLOW_INITIALIZE(&f);\n ssn.client.os_policy = OS_POLICY_BSD;\n f.protoctx = &ssn;\n p->src.family = AF_INET;\n p->dst.family = AF_INET;\n p->proto = IPPROTO_TCP;\n p->flow = &f;\n tcph.th_win = 5480;\n tcph.th_flags = TH_PUSH | TH_ACK;\n p->tcph = &tcph;\n p->flowflags = FLOW_PKT_TOSERVER;\n p->payload = packet;\n SET_ISN(&ssn.client, 3184324452UL);",
" p->tcph->th_seq = htonl(3184324453UL);\n p->tcph->th_ack = htonl(3373419609UL);\n p->payload_len = 2;",
" FAIL_IF(StreamTcpReassembleHandleSegment(&tv, stt.ra_ctx, &ssn, &ssn.client, p, &pq) == -1);",
" p->tcph->th_seq = htonl(3184324455UL);\n p->tcph->th_ack = htonl(3373419621UL);\n p->payload_len = 2;",
" FAIL_IF(StreamTcpReassembleHandleSegment(&tv, stt.ra_ctx, &ssn, &ssn.client, p, &pq) == -1);",
" p->tcph->th_seq = htonl(3184324453UL);\n p->tcph->th_ack = htonl(3373419621UL);\n p->payload_len = 6;",
" FAIL_IF(StreamTcpReassembleHandleSegment(&tv, stt.ra_ctx, &ssn, &ssn.client, p, &pq) == -1);",
" FAIL_IF(ssn.client.seg_list_tail == NULL);\n FAIL_IF(TCP_SEG_LEN(ssn.client.seg_list_tail) != 2);",
" StreamTcpUTClearSession(&ssn);\n SCFree(p);\n FLOW_DESTROY(&f);\n StreamTcpUTDeinit(stt.ra_ctx);\n FAIL_IF(SC_ATOMIC_GET(st_memuse) > 0);\n PASS;\n}\n"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
BIGVUL
|
{
"CVE ID": "CVE-2018-14568",
"CVE Page": "https://www.cvedetails.com/cve/CVE-2018-14568/",
"CWE ID": null,
"codeLink": "https://github.com/OISF/suricata/pull/3428/commits/843d0b7a10bb45627f94764a6c5d468a24143345",
"commit_id": "843d0b7a10bb45627f94764a6c5d468a24143345",
"commit_message": "stream: support RST getting lost/ignored\n\nIn case of a valid RST on a SYN, the state is switched to 'TCP_CLOSED'.\nHowever, the target of the RST may not have received it, or may not\nhave accepted it. Also, the RST may have been injected, so the supposed\nsender may not actually be aware of the RST that was sent in it's name.\n\nIn this case the previous behavior was to switch the state to CLOSED and\naccept no further TCP updates or stream reassembly.\n\nThis patch changes this. It still switches the state to CLOSED, as this\nis by far the most likely to be correct. However, it will reconsider\nthe state if the receiver continues to talk.\n\nTo do this on each state change the previous state will be recorded in\nTcpSession::pstate. If a non-RST packet is received after a RST, this\nTcpSession::pstate is used to try to continue the conversation.\n\nIf the (supposed) sender of the RST is also continueing the conversation\nas normal, it's highly likely it didn't send the RST. In this case\na stream event is generated.\n\nTicket: #2501\n\nReported-By: Kirill Shipulin",
"lang": "C",
"project": "suricata"
}
| 92
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.