CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2017-9330
https://www.cvedetails.com/cve/CVE-2017-9330/
CWE-835
https://git.qemu.org/?p=qemu.git;a=commit;h=26f670a244982335cc08943fb1ec099a2c81e42d
26f670a244982335cc08943fb1ec099a2c81e42d
null
static void ohci_realize_pxa(DeviceState *dev, Error **errp) { OHCISysBusState *s = SYSBUS_OHCI(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); /* Cannot fail as we pass NULL for masterbus */ usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, NULL, 0, &address_space_memory, &error_abort); sysbus_init_irq(sbd, &s->ohci.irq); sysbus_init_mmio(sbd, &s->ohci.mem); }
static void ohci_realize_pxa(DeviceState *dev, Error **errp) { OHCISysBusState *s = SYSBUS_OHCI(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); /* Cannot fail as we pass NULL for masterbus */ usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, NULL, 0, &address_space_memory, &error_abort); sysbus_init_irq(sbd, &s->ohci.irq); sysbus_init_mmio(sbd, &s->ohci.mem); }
C
qemu
0
CVE-2016-3746
https://www.cvedetails.com/cve/CVE-2016-3746/
null
https://android.googlesource.com/platform/hardware/qcom/media/+/5b82f4f90c3d531313714df4b936f92fb0ff15cf
5b82f4f90c3d531313714df4b936f92fb0ff15cf
DO NOT MERGE mm-video-v4l2: vdec: Avoid processing ETBs/FTBs in invalid states (per the spec) ETB/FTB should not be handled in states other than Executing, Paused and Idle. This avoids accessing invalid buffers. Also add a lock to protect the private-buffers from being deleted while accessing from another thread. Bug: 27890802 Security Vulnerability - Heap Use-After-Free and Possible LPE in MediaServer (libOmxVdec problem #6) CRs-Fixed: 1008882 Change-Id: Iaac2e383cd53cf9cf8042c9ed93ddc76dba3907e
bool omx_vdec::allocate_done(void) { bool bRet = false; bool bRet_In = false; bool bRet_Out = false; bRet_In = allocate_input_done(); bRet_Out = allocate_output_done(); if (bRet_In && bRet_Out) { bRet = true; } return bRet; }
bool omx_vdec::allocate_done(void) { bool bRet = false; bool bRet_In = false; bool bRet_Out = false; bRet_In = allocate_input_done(); bRet_Out = allocate_output_done(); if (bRet_In && bRet_Out) { bRet = true; } return bRet; }
C
Android
0
CVE-2018-6117
https://www.cvedetails.com/cve/CVE-2018-6117/
CWE-200
https://github.com/chromium/chromium/commit/52f6eb4221430b6248fd5a59bec53bfef9fdd9a7
52f6eb4221430b6248fd5a59bec53bfef9fdd9a7
[md-settings] Clarify Password Saving and Autofill Toggles This change clarifies the wording around the password saving and autofill toggles. Bug: 822465 Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation Change-Id: I91b31fe61cd0754239f7908e8c04c7e69b72f670 Reviewed-on: https://chromium-review.googlesource.com/970541 Commit-Queue: Jan Wilken Dörrie <[email protected]> Reviewed-by: Vaclav Brozek <[email protected]> Reviewed-by: Jochen Eisinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#544661}
void AddSearchEnginesStrings(content::WebUIDataSource* html_source) { LocalizedString localized_strings[] = { {"searchEnginesPageTitle", IDS_SETTINGS_SEARCH_ENGINES}, {"searchEnginesAddSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_ADD_SEARCH_ENGINE}, {"searchEnginesEditSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_EDIT_SEARCH_ENGINE}, {"searchEngines", IDS_SETTINGS_SEARCH_ENGINES}, {"searchEnginesDefault", IDS_SETTINGS_SEARCH_ENGINES_DEFAULT_ENGINES}, {"searchEnginesOther", IDS_SETTINGS_SEARCH_ENGINES_OTHER_ENGINES}, {"searchEnginesNoOtherEngines", IDS_SETTINGS_SEARCH_ENGINES_NO_OTHER_ENGINES}, {"searchEnginesExtension", IDS_SETTINGS_SEARCH_ENGINES_EXTENSION_ENGINES}, {"searchEnginesSearch", IDS_SETTINGS_SEARCH_ENGINES_SEARCH}, {"searchEnginesSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_SEARCH_ENGINE}, {"searchEnginesKeyword", IDS_SETTINGS_SEARCH_ENGINES_KEYWORD}, {"searchEnginesQueryURL", IDS_SETTINGS_SEARCH_ENGINES_QUERY_URL}, {"searchEnginesQueryURLExplanation", IDS_SETTINGS_SEARCH_ENGINES_QUERY_URL_EXPLANATION}, {"searchEnginesMakeDefault", IDS_SETTINGS_SEARCH_ENGINES_MAKE_DEFAULT}, {"searchEnginesRemoveFromList", IDS_SETTINGS_SEARCH_ENGINES_REMOVE_FROM_LIST}, {"searchEnginesManageExtension", IDS_SETTINGS_SEARCH_ENGINES_MANAGE_EXTENSION}, }; AddLocalizedStringsBulk(html_source, localized_strings, arraysize(localized_strings)); }
void AddSearchEnginesStrings(content::WebUIDataSource* html_source) { LocalizedString localized_strings[] = { {"searchEnginesPageTitle", IDS_SETTINGS_SEARCH_ENGINES}, {"searchEnginesAddSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_ADD_SEARCH_ENGINE}, {"searchEnginesEditSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_EDIT_SEARCH_ENGINE}, {"searchEngines", IDS_SETTINGS_SEARCH_ENGINES}, {"searchEnginesDefault", IDS_SETTINGS_SEARCH_ENGINES_DEFAULT_ENGINES}, {"searchEnginesOther", IDS_SETTINGS_SEARCH_ENGINES_OTHER_ENGINES}, {"searchEnginesNoOtherEngines", IDS_SETTINGS_SEARCH_ENGINES_NO_OTHER_ENGINES}, {"searchEnginesExtension", IDS_SETTINGS_SEARCH_ENGINES_EXTENSION_ENGINES}, {"searchEnginesSearch", IDS_SETTINGS_SEARCH_ENGINES_SEARCH}, {"searchEnginesSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_SEARCH_ENGINE}, {"searchEnginesKeyword", IDS_SETTINGS_SEARCH_ENGINES_KEYWORD}, {"searchEnginesQueryURL", IDS_SETTINGS_SEARCH_ENGINES_QUERY_URL}, {"searchEnginesQueryURLExplanation", IDS_SETTINGS_SEARCH_ENGINES_QUERY_URL_EXPLANATION}, {"searchEnginesMakeDefault", IDS_SETTINGS_SEARCH_ENGINES_MAKE_DEFAULT}, {"searchEnginesRemoveFromList", IDS_SETTINGS_SEARCH_ENGINES_REMOVE_FROM_LIST}, {"searchEnginesManageExtension", IDS_SETTINGS_SEARCH_ENGINES_MANAGE_EXTENSION}, }; AddLocalizedStringsBulk(html_source, localized_strings, arraysize(localized_strings)); }
C
Chrome
0
CVE-2018-16427
https://www.cvedetails.com/cve/CVE-2018-16427/
CWE-125
https://github.com/OpenSC/OpenSC/pull/1447/commits/8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
fixed out of bounds reads Thanks to Eric Sesterhenn from X41 D-SEC GmbH for reporting and suggesting security fixes.
iasecc_qsign_data_sha256(struct sc_context *ctx, const unsigned char *in, size_t in_len, struct iasecc_qsign_data *out) { SHA256_CTX sha256; SHA_LONG pre_hash_Nl; int jj, ii; int hh_size = sizeof(SHA_LONG), hh_num = SHA256_DIGEST_LENGTH / sizeof(SHA_LONG); LOG_FUNC_CALLED(ctx); if (!in || !in_len || !out) LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); sc_log(ctx, "sc_pkcs15_get_qsign_data() input data length %"SC_FORMAT_LEN_SIZE_T"u", in_len); memset(out, 0, sizeof(struct iasecc_qsign_data)); SHA256_Init(&sha256); SHA256_Update(&sha256, in, in_len); for (jj=0; jj<hh_num; jj++) for(ii=0; ii<hh_size; ii++) out->pre_hash[jj*hh_size + ii] = ((sha256.h[jj] >> 8*(hh_size-1-ii)) & 0xFF); out->pre_hash_size = SHA256_DIGEST_LENGTH; sc_log(ctx, "Pre hash:%s", sc_dump_hex(out->pre_hash, out->pre_hash_size)); pre_hash_Nl = sha256.Nl - (sha256.Nl % (sizeof(sha256.data) * 8)); for (ii=0; ii<hh_size; ii++) { out->counter[ii] = (sha256.Nh >> 8*(hh_size-1-ii)) &0xFF; out->counter[hh_size+ii] = (pre_hash_Nl >> 8*(hh_size-1-ii)) &0xFF; } for (ii=0, out->counter_long=0; ii<(int)sizeof(out->counter); ii++) out->counter_long = out->counter_long*0x100 + out->counter[ii]; sc_log(ctx, "Pre counter(%li):%s", out->counter_long, sc_dump_hex(out->counter, sizeof(out->counter))); if (sha256.num) { memcpy(out->last_block, in + in_len - sha256.num, sha256.num); out->last_block_size = sha256.num; sc_log(ctx, "Last block(%"SC_FORMAT_LEN_SIZE_T"u):%s", out->last_block_size, sc_dump_hex(out->last_block, out->last_block_size)); } SHA256_Final(out->hash, &sha256); out->hash_size = SHA256_DIGEST_LENGTH; sc_log(ctx, "Expected digest %s\n", sc_dump_hex(out->hash, out->hash_size)); LOG_FUNC_RETURN(ctx, SC_SUCCESS); }
iasecc_qsign_data_sha256(struct sc_context *ctx, const unsigned char *in, size_t in_len, struct iasecc_qsign_data *out) { SHA256_CTX sha256; SHA_LONG pre_hash_Nl; int jj, ii; int hh_size = sizeof(SHA_LONG), hh_num = SHA256_DIGEST_LENGTH / sizeof(SHA_LONG); LOG_FUNC_CALLED(ctx); if (!in || !in_len || !out) LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); sc_log(ctx, "sc_pkcs15_get_qsign_data() input data length %"SC_FORMAT_LEN_SIZE_T"u", in_len); memset(out, 0, sizeof(struct iasecc_qsign_data)); SHA256_Init(&sha256); SHA256_Update(&sha256, in, in_len); for (jj=0; jj<hh_num; jj++) for(ii=0; ii<hh_size; ii++) out->pre_hash[jj*hh_size + ii] = ((sha256.h[jj] >> 8*(hh_size-1-ii)) & 0xFF); out->pre_hash_size = SHA256_DIGEST_LENGTH; sc_log(ctx, "Pre hash:%s", sc_dump_hex(out->pre_hash, out->pre_hash_size)); pre_hash_Nl = sha256.Nl - (sha256.Nl % (sizeof(sha256.data) * 8)); for (ii=0; ii<hh_size; ii++) { out->counter[ii] = (sha256.Nh >> 8*(hh_size-1-ii)) &0xFF; out->counter[hh_size+ii] = (pre_hash_Nl >> 8*(hh_size-1-ii)) &0xFF; } for (ii=0, out->counter_long=0; ii<(int)sizeof(out->counter); ii++) out->counter_long = out->counter_long*0x100 + out->counter[ii]; sc_log(ctx, "Pre counter(%li):%s", out->counter_long, sc_dump_hex(out->counter, sizeof(out->counter))); if (sha256.num) { memcpy(out->last_block, in + in_len - sha256.num, sha256.num); out->last_block_size = sha256.num; sc_log(ctx, "Last block(%"SC_FORMAT_LEN_SIZE_T"u):%s", out->last_block_size, sc_dump_hex(out->last_block, out->last_block_size)); } SHA256_Final(out->hash, &sha256); out->hash_size = SHA256_DIGEST_LENGTH; sc_log(ctx, "Expected digest %s\n", sc_dump_hex(out->hash, out->hash_size)); LOG_FUNC_RETURN(ctx, SC_SUCCESS); }
C
OpenSC
0
CVE-2016-9934
https://www.cvedetails.com/cve/CVE-2016-9934/
CWE-476
https://github.com/php/php-src/commit/6045de69c7dedcba3eadf7c4bba424b19c81d00d
6045de69c7dedcba3eadf7c4bba424b19c81d00d
Fix bug #73331 - do not try to serialize/unserialize objects wddx can not handle Proper soltion would be to call serialize/unserialize and deal with the result, but this requires more work that should be done by wddx maintainer (not me).
static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */ { struct pdo_bound_param_data param = {0}; long param_type = PDO_PARAM_STR; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|llz!", &param.paramno, &param.parameter, &param_type, &param.max_value_len, &param.driver_params)) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|llz!", &param.name, &param.namelen, &param.parameter, &param_type, &param.max_value_len, &param.driver_params)) { return 0; } } param.param_type = (int) param_type; if (param.paramno > 0) { --param.paramno; /* make it zero-based internally */ } else if (!param.name) { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based" TSRMLS_CC); return 0; } Z_ADDREF_P(param.parameter); if (!really_register_bound_param(&param, stmt, is_param TSRMLS_CC)) { if (param.parameter) { zval_ptr_dtor(&(param.parameter)); param.parameter = NULL; } return 0; } return 1; } /* }}} */
static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */ { struct pdo_bound_param_data param = {0}; long param_type = PDO_PARAM_STR; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|llz!", &param.paramno, &param.parameter, &param_type, &param.max_value_len, &param.driver_params)) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|llz!", &param.name, &param.namelen, &param.parameter, &param_type, &param.max_value_len, &param.driver_params)) { return 0; } } param.param_type = (int) param_type; if (param.paramno > 0) { --param.paramno; /* make it zero-based internally */ } else if (!param.name) { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based" TSRMLS_CC); return 0; } Z_ADDREF_P(param.parameter); if (!really_register_bound_param(&param, stmt, is_param TSRMLS_CC)) { if (param.parameter) { zval_ptr_dtor(&(param.parameter)); param.parameter = NULL; } return 0; } return 1; } /* }}} */
C
php-src
0
CVE-2019-13307
https://www.cvedetails.com/cve/CVE-2019-13307/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/025e77fcb2f45b21689931ba3bf74eac153afa48
025e77fcb2f45b21689931ba3bf74eac153afa48
https://github.com/ImageMagick/ImageMagick/issues/1615
static inline double MagickLog10(const double x) { #define Log10Epsilon (1.0e-11) if (fabs(x) < Log10Epsilon) return(log10(Log10Epsilon)); return(log10(fabs(x))); }
static inline double MagickLog10(const double x) { #define Log10Epsilon (1.0e-11) if (fabs(x) < Log10Epsilon) return(log10(Log10Epsilon)); return(log10(fabs(x))); }
C
ImageMagick6
0
CVE-2016-2384
https://www.cvedetails.com/cve/CVE-2016-2384/
null
https://github.com/torvalds/linux/commit/07d86ca93db7e5cdf4743564d98292042ec21af7
07d86ca93db7e5cdf4743564d98292042ec21af7
ALSA: usb-audio: avoid freeing umidi object twice The 'umidi' object will be free'd on the error path by snd_usbmidi_free() when tearing down the rawmidi interface. So we shouldn't try to free it in snd_usbmidi_create() after having registered the rawmidi interface. Found by KASAN. Signed-off-by: Andrey Konovalov <[email protected]> Acked-by: Clemens Ladisch <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep) { unsigned int urb_index; struct urb *urb; unsigned long flags; spin_lock_irqsave(&ep->buffer_lock, flags); if (ep->umidi->disconnected) { spin_unlock_irqrestore(&ep->buffer_lock, flags); return; } urb_index = ep->next_urb; for (;;) { if (!(ep->active_urbs & (1 << urb_index))) { urb = ep->urbs[urb_index].urb; urb->transfer_buffer_length = 0; ep->umidi->usb_protocol_ops->output(ep, urb); if (urb->transfer_buffer_length == 0) break; dump_urb("sending", urb->transfer_buffer, urb->transfer_buffer_length); urb->dev = ep->umidi->dev; if (snd_usbmidi_submit_urb(urb, GFP_ATOMIC) < 0) break; ep->active_urbs |= 1 << urb_index; } if (++urb_index >= OUTPUT_URBS) urb_index = 0; if (urb_index == ep->next_urb) break; } ep->next_urb = urb_index; spin_unlock_irqrestore(&ep->buffer_lock, flags); }
static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep) { unsigned int urb_index; struct urb *urb; unsigned long flags; spin_lock_irqsave(&ep->buffer_lock, flags); if (ep->umidi->disconnected) { spin_unlock_irqrestore(&ep->buffer_lock, flags); return; } urb_index = ep->next_urb; for (;;) { if (!(ep->active_urbs & (1 << urb_index))) { urb = ep->urbs[urb_index].urb; urb->transfer_buffer_length = 0; ep->umidi->usb_protocol_ops->output(ep, urb); if (urb->transfer_buffer_length == 0) break; dump_urb("sending", urb->transfer_buffer, urb->transfer_buffer_length); urb->dev = ep->umidi->dev; if (snd_usbmidi_submit_urb(urb, GFP_ATOMIC) < 0) break; ep->active_urbs |= 1 << urb_index; } if (++urb_index >= OUTPUT_URBS) urb_index = 0; if (urb_index == ep->next_urb) break; } ep->next_urb = urb_index; spin_unlock_irqrestore(&ep->buffer_lock, flags); }
C
linux
0
CVE-2016-2315
https://www.cvedetails.com/cve/CVE-2016-2315/
CWE-119
https://github.com/git/git/commit/34fa79a6cde56d6d428ab0d3160cb094ebad3305
34fa79a6cde56d6d428ab0d3160cb094ebad3305
prefer memcpy to strcpy When we already know the length of a string (e.g., because we just malloc'd to fit it), it's nicer to use memcpy than strcpy, as it makes it more obvious that we are not going to overflow the buffer (because the size we pass matches the size in the allocation). This also eliminates calls to strcpy, which make auditing the code base harder. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
static void dump_tags(void) { static const char *msg = "fast-import"; struct tag *t; struct strbuf ref_name = STRBUF_INIT; struct strbuf err = STRBUF_INIT; struct ref_transaction *transaction; transaction = ref_transaction_begin(&err); if (!transaction) { failure |= error("%s", err.buf); goto cleanup; } for (t = first_tag; t; t = t->next_tag) { strbuf_reset(&ref_name); strbuf_addf(&ref_name, "refs/tags/%s", t->name); if (ref_transaction_update(transaction, ref_name.buf, t->sha1, NULL, 0, msg, &err)) { failure |= error("%s", err.buf); goto cleanup; } } if (ref_transaction_commit(transaction, &err)) failure |= error("%s", err.buf); cleanup: ref_transaction_free(transaction); strbuf_release(&ref_name); strbuf_release(&err); }
static void dump_tags(void) { static const char *msg = "fast-import"; struct tag *t; struct strbuf ref_name = STRBUF_INIT; struct strbuf err = STRBUF_INIT; struct ref_transaction *transaction; transaction = ref_transaction_begin(&err); if (!transaction) { failure |= error("%s", err.buf); goto cleanup; } for (t = first_tag; t; t = t->next_tag) { strbuf_reset(&ref_name); strbuf_addf(&ref_name, "refs/tags/%s", t->name); if (ref_transaction_update(transaction, ref_name.buf, t->sha1, NULL, 0, msg, &err)) { failure |= error("%s", err.buf); goto cleanup; } } if (ref_transaction_commit(transaction, &err)) failure |= error("%s", err.buf); cleanup: ref_transaction_free(transaction); strbuf_release(&ref_name); strbuf_release(&err); }
C
git
0
CVE-2015-1271
https://www.cvedetails.com/cve/CVE-2015-1271/
CWE-119
https://github.com/chromium/chromium/commit/74fce5949bdf05a92c2bc0bd98e6e3e977c55376
74fce5949bdf05a92c2bc0bd98e6e3e977c55376
Fixed volume slider element event handling MediaControlVolumeSliderElement::defaultEventHandler has making redundant calls to setVolume() & setMuted() on mouse activity. E.g. if a mouse click changed the slider position, the above calls were made 4 times, once for each of these events: mousedown, input, mouseup, DOMActive, click. This crack got exposed when PointerEvents are enabled by default on M55, adding pointermove, pointerdown & pointerup to the list. This CL fixes the code to trigger the calls to setVolume() & setMuted() only when the slider position is changed. Also added pointer events to certain lists of mouse events in the code. BUG=677900 Review-Url: https://codereview.chromium.org/2622273003 Cr-Commit-Position: refs/heads/master@{#446032}
MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTimeDisplayElement(mediaControls); element->setShadowPseudoId( AtomicString("-webkit-media-controls-current-time-display")); return element; }
MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTimeDisplayElement(mediaControls); element->setShadowPseudoId( AtomicString("-webkit-media-controls-current-time-display")); return element; }
C
Chrome
0
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
LayerTreeHostTestTreeActivationCallback() : num_commits_(0), callback_count_(0) {}
LayerTreeHostTestTreeActivationCallback() : num_commits_(0), callback_count_(0) {}
C
Chrome
0
CVE-2011-1078
https://www.cvedetails.com/cve/CVE-2011-1078/
CWE-200
https://github.com/torvalds/linux/commit/c4c896e1471aec3b004a693c689f60be3b17ac86
c4c896e1471aec3b004a693c689f60be3b17ac86
Bluetooth: sco: fix information leak to userspace struct sco_conninfo has one padding byte in the end. Local variable cinfo of type sco_conninfo is copied to userspace with this uninizialized one byte, leading to old stack contents leak. Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Gustavo F. Padovan <[email protected]>
static inline int sco_chan_add(struct sco_conn *conn, struct sock *sk, struct sock *parent) { int err = 0; sco_conn_lock(conn); if (conn->sk) err = -EBUSY; else __sco_chan_add(conn, sk, parent); sco_conn_unlock(conn); return err; }
static inline int sco_chan_add(struct sco_conn *conn, struct sock *sk, struct sock *parent) { int err = 0; sco_conn_lock(conn); if (conn->sk) err = -EBUSY; else __sco_chan_add(conn, sk, parent); sco_conn_unlock(conn); return err; }
C
linux
0
CVE-2015-3331
https://www.cvedetails.com/cve/CVE-2015-3331/
CWE-119
https://github.com/torvalds/linux/commit/ccfe8c3f7e52ae83155cb038753f4c75b774ca8a
ccfe8c3f7e52ae83155cb038753f4c75b774ca8a
crypto: aesni - fix memory usage in GCM decryption The kernel crypto API logic requires the caller to provide the length of (ciphertext || authentication tag) as cryptlen for the AEAD decryption operation. Thus, the cipher implementation must calculate the size of the plaintext output itself and cannot simply use cryptlen. The RFC4106 GCM decryption operation tries to overwrite cryptlen memory in req->dst. As the destination buffer for decryption only needs to hold the plaintext memory but cryptlen references the input buffer holding (ciphertext || authentication tag), the assumption of the destination buffer length in RFC4106 GCM operation leads to a too large size. This patch simply uses the already calculated plaintext size. In addition, this patch fixes the offset calculation of the AAD buffer pointer: as mentioned before, cryptlen already includes the size of the tag. Thus, the tag does not need to be added. With the addition, the AAD will be written beyond the already allocated buffer. Note, this fixes a kernel crash that can be triggered from user space via AF_ALG(aead) -- simply use the libkcapi test application from [1] and update it to use rfc4106-gcm-aes. Using [1], the changes were tested using CAVS vectors to demonstrate that the crypto operation still delivers the right results. [1] http://www.chronox.de/libkcapi.html CC: Tadeusz Struk <[email protected]> Cc: [email protected] Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int rfc4106_encrypt(struct aead_request *req) { int ret; struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm); if (!irq_fpu_usable()) { struct aead_request *cryptd_req = (struct aead_request *) aead_request_ctx(req); memcpy(cryptd_req, req, sizeof(*req)); aead_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base); return crypto_aead_encrypt(cryptd_req); } else { struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm); kernel_fpu_begin(); ret = cryptd_child->base.crt_aead.encrypt(req); kernel_fpu_end(); return ret; } }
static int rfc4106_encrypt(struct aead_request *req) { int ret; struct crypto_aead *tfm = crypto_aead_reqtfm(req); struct aesni_rfc4106_gcm_ctx *ctx = aesni_rfc4106_gcm_ctx_get(tfm); if (!irq_fpu_usable()) { struct aead_request *cryptd_req = (struct aead_request *) aead_request_ctx(req); memcpy(cryptd_req, req, sizeof(*req)); aead_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base); return crypto_aead_encrypt(cryptd_req); } else { struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm); kernel_fpu_begin(); ret = cryptd_child->base.crt_aead.encrypt(req); kernel_fpu_end(); return ret; } }
C
linux
0
CVE-2017-8063
https://www.cvedetails.com/cve/CVE-2017-8063/
CWE-119
https://github.com/torvalds/linux/commit/3f190e3aec212fc8c61e202c51400afa7384d4bc
3f190e3aec212fc8c61e202c51400afa7384d4bc
[media] cxusb: Use a dma capable buffer also for reading Commit 17ce039b4e54 ("[media] cxusb: don't do DMA on stack") added a kmalloc'ed bounce buffer for writes, but missed to do the same for reads. As the read only happens after the write is finished, we can reuse the same buffer. As dvb_usb_generic_rw handles a read length of 0 by itself, avoid calling it using the dvb_usb_generic_read wrapper function. Signed-off-by: Stefan Brüns <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) { dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201); return 0; }
static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) { dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201); return 0; }
C
linux
0
CVE-2016-3839
https://www.cvedetails.com/cve/CVE-2016-3839/
CWE-284
https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c
472271b153c5dc53c28beac55480a8d8434b2d5c
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release
static int create_server_sdp_record(rfc_slot_t *slot) { if(slot->scn == 0) { return false; } slot->sdp_handle = add_rfc_sdp_rec(slot->service_name, slot->service_uuid, slot->scn); return (slot->sdp_handle > 0); }
static int create_server_sdp_record(rfc_slot_t *slot) { if(slot->scn == 0) { return false; } slot->sdp_handle = add_rfc_sdp_rec(slot->service_name, slot->service_uuid, slot->scn); return (slot->sdp_handle > 0); }
C
Android
0
CVE-2012-1179
https://www.cvedetails.com/cve/CVE-2012-1179/
CWE-264
https://github.com/torvalds/linux/commit/4a1d704194a441bf83c636004a479e01360ec850
4a1d704194a441bf83c636004a479e01360ec850
mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream. In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans huge. It's not khugepaged causing the problem, khugepaged holds the mmap_sem in write mode (and all those sites must hold the mmap_sem in read mode to prevent pagetables to go away from under them, during code review it seems vm86 mode on 32bit kernels requires that too unless it's restricted to 1 thread per process or UP builds). The race is only with the huge pagefaults that can convert a pmd_none() into a pmd_trans_huge(). Effectively all these pmd_none_or_clear_bad() sites running with mmap_sem in read mode are somewhat speculative with the page faults, and the result is always undefined when they run simultaneously. This is probably why it wasn't common to run into this. For example if the madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page fault, the hugepage will not be zapped, if the page fault runs first it will be zapped. Altering pmd_bad() not to error out if it finds hugepmds won't be enough to fix this, because zap_pmd_range would then proceed to call zap_pte_range (which would be incorrect if the pmd become a pmd_trans_huge()). The simplest way to fix this is to read the pmd in the local stack (regardless of what we read, no need of actual CPU barriers, only compiler barrier needed), and be sure it is not changing under the code that computes its value. Even if the real pmd is changing under the value we hold on the stack, we don't care. If we actually end up in zap_pte_range it means the pmd was not none already and it was not huge, and it can't become huge from under us (khugepaged locking explained above). All we need is to enforce that there is no way anymore that in a code path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad can run into a hugepmd. The overhead of a barrier() is just a compiler tweak and should not be measurable (I only added it for THP builds). I don't exclude different compiler versions may have prevented the race too by caching the value of *pmd on the stack (that hasn't been verified, but it wouldn't be impossible considering pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines and there's no external function called in between pmd_trans_huge and pmd_none_or_clear_bad). if (pmd_trans_huge(*pmd)) { if (next-addr != HPAGE_PMD_SIZE) { VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); split_huge_page_pmd(vma->vm_mm, pmd); } else if (zap_huge_pmd(tlb, vma, pmd, addr)) continue; /* fall through */ } if (pmd_none_or_clear_bad(pmd)) Because this race condition could be exercised without special privileges this was reported in CVE-2012-1179. The race was identified and fully explained by Ulrich who debugged it. I'm quoting his accurate explanation below, for reference. ====== start quote ======= mapcount 0 page_mapcount 1 kernel BUG at mm/huge_memory.c:1384! At some point prior to the panic, a "bad pmd ..." message similar to the following is logged on the console: mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7). The "bad pmd ..." message is logged by pmd_clear_bad() before it clears the page's PMD table entry. 143 void pmd_clear_bad(pmd_t *pmd) 144 { -> 145 pmd_ERROR(*pmd); 146 pmd_clear(pmd); 147 } After the PMD table entry has been cleared, there is an inconsistency between the actual number of PMD table entries that are mapping the page and the page's map count (_mapcount field in struct page). When the page is subsequently reclaimed, __split_huge_page() detects this inconsistency. 1381 if (mapcount != page_mapcount(page)) 1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n", 1383 mapcount, page_mapcount(page)); -> 1384 BUG_ON(mapcount != page_mapcount(page)); The root cause of the problem is a race of two threads in a multithreaded process. Thread B incurs a page fault on a virtual address that has never been accessed (PMD entry is zero) while Thread A is executing an madvise() system call on a virtual address within the same 2 MB (huge page) range. virtual address space .---------------------. | | | | .-|---------------------| | | | | | |<-- B(fault) | | | 2 MB | |/////////////////////|-. huge < |/////////////////////| > A(range) page | |/////////////////////|-' | | | | | | '-|---------------------| | | | | '---------------------' - Thread A is executing an madvise(..., MADV_DONTNEED) system call on the virtual address range "A(range)" shown in the picture. sys_madvise // Acquire the semaphore in shared mode. down_read(&current->mm->mmap_sem) ... madvise_vma switch (behavior) case MADV_DONTNEED: madvise_dontneed zap_page_range unmap_vmas unmap_page_range zap_pud_range zap_pmd_range // // Assume that this huge page has never been accessed. // I.e. content of the PMD entry is zero (not mapped). // if (pmd_trans_huge(*pmd)) { // We don't get here due to the above assumption. } // // Assume that Thread B incurred a page fault and .---------> // sneaks in here as shown below. | // | if (pmd_none_or_clear_bad(pmd)) | { | if (unlikely(pmd_bad(*pmd))) | pmd_clear_bad | { | pmd_ERROR | // Log "bad pmd ..." message here. | pmd_clear | // Clear the page's PMD entry. | // Thread B incremented the map count | // in page_add_new_anon_rmap(), but | // now the page is no longer mapped | // by a PMD entry (-> inconsistency). | } | } | v - Thread B is handling a page fault on virtual address "B(fault)" shown in the picture. ... do_page_fault __do_page_fault // Acquire the semaphore in shared mode. down_read_trylock(&mm->mmap_sem) ... handle_mm_fault if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) // We get here due to the above assumption (PMD entry is zero). do_huge_pmd_anonymous_page alloc_hugepage_vma // Allocate a new transparent huge page here. ... __do_huge_pmd_anonymous_page ... spin_lock(&mm->page_table_lock) ... page_add_new_anon_rmap // Here we increment the page's map count (starts at -1). atomic_set(&page->_mapcount, 0) set_pmd_at // Here we set the page's PMD entry which will be cleared // when Thread A calls pmd_clear_bad(). ... spin_unlock(&mm->page_table_lock) The mmap_sem does not prevent the race because both threads are acquiring it in shared mode (down_read). Thread B holds the page_table_lock while the page's map count and PMD table entry are updated. However, Thread A does not synchronize on that lock. ====== end quote ======= [[email protected]: checkpatch fixes] Reported-by: Ulrich Obergfell <[email protected]> Signed-off-by: Andrea Arcangeli <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Dave Jones <[email protected]> Acked-by: Larry Woodman <[email protected]> Acked-by: Rik van Riel <[email protected]> Cc: Mark Salter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static inline unsigned long get_vflags(struct kernel_vm86_regs *regs) { unsigned long flags = regs->pt.flags & RETURN_MASK; if (VEFLAGS & X86_EFLAGS_VIF) flags |= X86_EFLAGS_IF; flags |= X86_EFLAGS_IOPL; return flags | (VEFLAGS & current->thread.v86mask); }
static inline unsigned long get_vflags(struct kernel_vm86_regs *regs) { unsigned long flags = regs->pt.flags & RETURN_MASK; if (VEFLAGS & X86_EFLAGS_VIF) flags |= X86_EFLAGS_IF; flags |= X86_EFLAGS_IOPL; return flags | (VEFLAGS & current->thread.v86mask); }
C
linux
0
CVE-2016-3834
https://www.cvedetails.com/cve/CVE-2016-3834/
CWE-200
https://android.googlesource.com/platform/frameworks/av/+/1f24c730ab6ca5aff1e3137b340b8aeaeda4bdbc
1f24c730ab6ca5aff1e3137b340b8aeaeda4bdbc
DO NOT MERGE: Camera: Adjust pointers to ANW buffers to avoid infoleak Subtract address of a random static object from pointers being routed through app process. Bug: 28466701 Change-Id: Idcbfe81e9507433769672f3dc6d67db5eeed4e04
status_t CameraSource::init( const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy, int32_t cameraId, const String16& clientName, uid_t clientUid, Size videoSize, int32_t frameRate, bool storeMetaDataInVideoBuffers) { ALOGV("init"); status_t err = OK; int64_t token = IPCThreadState::self()->clearCallingIdentity(); err = initWithCameraAccess(camera, proxy, cameraId, clientName, clientUid, videoSize, frameRate, storeMetaDataInVideoBuffers); IPCThreadState::self()->restoreCallingIdentity(token); return err; }
status_t CameraSource::init( const sp<ICamera>& camera, const sp<ICameraRecordingProxy>& proxy, int32_t cameraId, const String16& clientName, uid_t clientUid, Size videoSize, int32_t frameRate, bool storeMetaDataInVideoBuffers) { ALOGV("init"); status_t err = OK; int64_t token = IPCThreadState::self()->clearCallingIdentity(); err = initWithCameraAccess(camera, proxy, cameraId, clientName, clientUid, videoSize, frameRate, storeMetaDataInVideoBuffers); IPCThreadState::self()->restoreCallingIdentity(token); return err; }
C
Android
0
CVE-2017-7541
https://www.cvedetails.com/cve/CVE-2017-7541/
CWE-119
https://github.com/torvalds/linux/commit/8f44c9a41386729fea410e688959ddaa9d51be7c
8f44c9a41386729fea410e688959ddaa9d51be7c
brcmfmac: fix possible buffer overflow in brcmf_cfg80211_mgmt_tx() The lower level nl80211 code in cfg80211 ensures that "len" is between 25 and NL80211_ATTR_FRAME (2304). We subtract DOT11_MGMT_HDR_LEN (24) from "len" so thats's max of 2280. However, the action_frame->data[] buffer is only BRCMF_FIL_ACTION_FRAME_SIZE (1800) bytes long so this memcpy() can overflow. memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN], le16_to_cpu(action_frame->len)); Cc: [email protected] # 3.9.x Fixes: 18e2f61db3b70 ("brcmfmac: P2P action frame tx.") Reported-by: "freenerguo(郭大兴)" <[email protected]> Signed-off-by: Arend van Spriel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct net_device *ndev = cfg_to_ndev(cfg); struct brcmf_if *ifp = netdev_priv(ndev); brcmf_dbg(TRACE, "Enter\n"); if (cfg->wowl.active) { brcmf_report_wowl_wakeind(wiphy, ifp); brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0); brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0); if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND)) brcmf_configure_arp_nd_offload(ifp, true); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, cfg->wowl.pre_pmmode); cfg->wowl.active = false; if (cfg->wowl.nd_enabled) { brcmf_cfg80211_sched_scan_stop(cfg->wiphy, ifp->ndev, 0); brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, brcmf_notify_sched_scan_results); cfg->wowl.nd_enabled = false; } } return 0; }
static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct net_device *ndev = cfg_to_ndev(cfg); struct brcmf_if *ifp = netdev_priv(ndev); brcmf_dbg(TRACE, "Enter\n"); if (cfg->wowl.active) { brcmf_report_wowl_wakeind(wiphy, ifp); brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0); brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0); if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_ARP_ND)) brcmf_configure_arp_nd_offload(ifp, true); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, cfg->wowl.pre_pmmode); cfg->wowl.active = false; if (cfg->wowl.nd_enabled) { brcmf_cfg80211_sched_scan_stop(cfg->wiphy, ifp->ndev, 0); brcmf_fweh_unregister(cfg->pub, BRCMF_E_PFN_NET_FOUND); brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, brcmf_notify_sched_scan_results); cfg->wowl.nd_enabled = false; } } return 0; }
C
linux
0
CVE-2011-1767
https://www.cvedetails.com/cve/CVE-2011-1767/
null
https://github.com/torvalds/linux/commit/c2892f02712e9516d72841d5c019ed6916329794
c2892f02712e9516d72841d5c019ed6916329794
gre: fix netns vs proto registration ordering GRE protocol receive hook can be called right after protocol addition is done. If netns stuff is not yet initialized, we're going to oops in net_generic(). This is remotely oopsable if ip_gre is compiled as module and packet comes at unfortunate moment of module loading. Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void ipgre_netlink_parms(struct nlattr *data[], struct ip_tunnel_parm *parms) { memset(parms, 0, sizeof(*parms)); parms->iph.protocol = IPPROTO_GRE; if (!data) return; if (data[IFLA_GRE_LINK]) parms->link = nla_get_u32(data[IFLA_GRE_LINK]); if (data[IFLA_GRE_IFLAGS]) parms->i_flags = nla_get_be16(data[IFLA_GRE_IFLAGS]); if (data[IFLA_GRE_OFLAGS]) parms->o_flags = nla_get_be16(data[IFLA_GRE_OFLAGS]); if (data[IFLA_GRE_IKEY]) parms->i_key = nla_get_be32(data[IFLA_GRE_IKEY]); if (data[IFLA_GRE_OKEY]) parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]); if (data[IFLA_GRE_LOCAL]) parms->iph.saddr = nla_get_be32(data[IFLA_GRE_LOCAL]); if (data[IFLA_GRE_REMOTE]) parms->iph.daddr = nla_get_be32(data[IFLA_GRE_REMOTE]); if (data[IFLA_GRE_TTL]) parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]); if (data[IFLA_GRE_TOS]) parms->iph.tos = nla_get_u8(data[IFLA_GRE_TOS]); if (!data[IFLA_GRE_PMTUDISC] || nla_get_u8(data[IFLA_GRE_PMTUDISC])) parms->iph.frag_off = htons(IP_DF); }
static void ipgre_netlink_parms(struct nlattr *data[], struct ip_tunnel_parm *parms) { memset(parms, 0, sizeof(*parms)); parms->iph.protocol = IPPROTO_GRE; if (!data) return; if (data[IFLA_GRE_LINK]) parms->link = nla_get_u32(data[IFLA_GRE_LINK]); if (data[IFLA_GRE_IFLAGS]) parms->i_flags = nla_get_be16(data[IFLA_GRE_IFLAGS]); if (data[IFLA_GRE_OFLAGS]) parms->o_flags = nla_get_be16(data[IFLA_GRE_OFLAGS]); if (data[IFLA_GRE_IKEY]) parms->i_key = nla_get_be32(data[IFLA_GRE_IKEY]); if (data[IFLA_GRE_OKEY]) parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]); if (data[IFLA_GRE_LOCAL]) parms->iph.saddr = nla_get_be32(data[IFLA_GRE_LOCAL]); if (data[IFLA_GRE_REMOTE]) parms->iph.daddr = nla_get_be32(data[IFLA_GRE_REMOTE]); if (data[IFLA_GRE_TTL]) parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]); if (data[IFLA_GRE_TOS]) parms->iph.tos = nla_get_u8(data[IFLA_GRE_TOS]); if (!data[IFLA_GRE_PMTUDISC] || nla_get_u8(data[IFLA_GRE_PMTUDISC])) parms->iph.frag_off = htons(IP_DF); }
C
linux
0
CVE-2011-2350
https://www.cvedetails.com/cve/CVE-2011-2350/
CWE-20
https://github.com/chromium/chromium/commit/b944f670bb7a8a919daac497a4ea0536c954c201
b944f670bb7a8a919daac497a4ea0536c954c201
[JSC] Implement a helper method createNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=85102 Reviewed by Geoffrey Garen. In bug 84787, kbr@ requested to avoid hard-coding createTypeError(exec, "Not enough arguments") here and there. This patch implements createNotEnoughArgumentsError(exec) and uses it in JSC bindings. c.f. a corresponding bug for V8 bindings is bug 85097. Source/JavaScriptCore: * runtime/Error.cpp: (JSC::createNotEnoughArgumentsError): (JSC): * runtime/Error.h: (JSC): Source/WebCore: Test: bindings/scripts/test/TestObj.idl * bindings/scripts/CodeGeneratorJS.pm: Modified as described above. (GenerateArgumentsCountCheck): * bindings/js/JSDataViewCustom.cpp: Ditto. (WebCore::getDataViewMember): (WebCore::setDataViewMember): * bindings/js/JSDeprecatedPeerConnectionCustom.cpp: (WebCore::JSDeprecatedPeerConnectionConstructor::constructJSDeprecatedPeerConnection): * bindings/js/JSDirectoryEntryCustom.cpp: (WebCore::JSDirectoryEntry::getFile): (WebCore::JSDirectoryEntry::getDirectory): * bindings/js/JSSharedWorkerCustom.cpp: (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): * bindings/js/JSWebKitMutationObserverCustom.cpp: (WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver): (WebCore::JSWebKitMutationObserver::observe): * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorkerConstructor::constructJSWorker): * bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests. (WebCore::jsFloat64ArrayPrototypeFunctionFoo): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::jsTestEventTargetPrototypeFunctionItem): (WebCore::jsTestEventTargetPrototypeFunctionAddEventListener): (WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener): (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::constructJSTestInterface): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::constructJSTestObj): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg): (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence): (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): (WebCore::jsTestObjPrototypeFunctionSerializedValue): (WebCore::jsTestObjPrototypeFunctionIdbKey): (WebCore::jsTestObjPrototypeFunctionOptionsObject): (WebCore::jsTestObjPrototypeFunctionAddEventListener): (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): (WebCore::jsTestObjConstructorFunctionClassMethod2): (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongArray): (WebCore::jsTestObjPrototypeFunctionConvert1): (WebCore::jsTestObjPrototypeFunctionConvert2): (WebCore::jsTestObjPrototypeFunctionConvert3): (WebCore::jsTestObjPrototypeFunctionConvert4): (WebCore::jsTestObjPrototypeFunctionConvert5): (WebCore::jsTestObjPrototypeFunctionStrictFunction): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList): git-svn-id: svn://svn.chromium.org/blink/trunk@115536 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void setJSTestObjUnsignedShortAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->setUnsignedShortAttr(value.toUInt32(exec)); }
void setJSTestObjUnsignedShortAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->setUnsignedShortAttr(value.toUInt32(exec)); }
C
Chrome
0
CVE-2013-6634
https://www.cvedetails.com/cve/CVE-2013-6634/
CWE-287
https://github.com/chromium/chromium/commit/50370b3c98047bdc80184ff87a502edc5c597d3a
50370b3c98047bdc80184ff87a502edc5c597d3a
During redirects in the one click sign in flow, check the current URL instead of original URL to validate gaia http headers. BUG=307159 Review URL: https://codereview.chromium.org/77343002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236563 0039d316-1c4b-4281-b951-d872f2087c98
bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents, CanOfferFor can_offer_for, const std::string& email, std::string* error_message) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); VLOG(1) << "OneClickSigninHelper::CanOffer"; if (error_message) error_message->clear(); if (!web_contents) return false; if (web_contents->GetBrowserContext()->IsOffTheRecord()) return false; Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); if (!profile) return false; SigninManager* manager = SigninManagerFactory::GetForProfile(profile); if (manager && !manager->IsSigninAllowed()) return false; if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) return false; if (!ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(profile)) return false; if (!email.empty()) { if (!manager) return false; std::string current_email = manager->GetAuthenticatedUsername(); const bool same_email = gaia::AreEmailsSame(current_email, email); if (!current_email.empty() && !same_email) { UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", signin::HISTOGRAM_ACCOUNT_MISSMATCH, signin::HISTOGRAM_MAX); if (error_message) { error_message->assign( l10n_util::GetStringFUTF8(IDS_SYNC_WRONG_EMAIL, UTF8ToUTF16(current_email))); } return false; } if (!manager->IsAllowedUsername(email)) { if (error_message) { error_message->assign( l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED)); } return false; } if (g_browser_process && !same_email) { ProfileManager* manager = g_browser_process->profile_manager(); if (manager) { string16 email16 = UTF8ToUTF16(email); ProfileInfoCache& cache = manager->GetProfileInfoCache(); for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { if (email16 == cache.GetUserNameOfProfileAtIndex(i)) { if (error_message) { error_message->assign( l10n_util::GetStringUTF8(IDS_SYNC_USER_NAME_IN_USE_ERROR)); } return false; } } } } if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY) { const ListValue* rejected_emails = profile->GetPrefs()->GetList( prefs::kReverseAutologinRejectedEmailList); if (!rejected_emails->empty()) { base::ListValue::const_iterator iter = rejected_emails->Find( base::StringValue(email)); if (iter != rejected_emails->end()) return false; } } } VLOG(1) << "OneClickSigninHelper::CanOffer: yes we can"; return true; }
bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents, CanOfferFor can_offer_for, const std::string& email, std::string* error_message) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); VLOG(1) << "OneClickSigninHelper::CanOffer"; if (error_message) error_message->clear(); if (!web_contents) return false; if (web_contents->GetBrowserContext()->IsOffTheRecord()) return false; Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); if (!profile) return false; SigninManager* manager = SigninManagerFactory::GetForProfile(profile); if (manager && !manager->IsSigninAllowed()) return false; if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY && !profile->GetPrefs()->GetBoolean(prefs::kReverseAutologinEnabled)) return false; if (!ChromeSigninManagerDelegate::ProfileAllowsSigninCookies(profile)) return false; if (!email.empty()) { if (!manager) return false; std::string current_email = manager->GetAuthenticatedUsername(); const bool same_email = gaia::AreEmailsSame(current_email, email); if (!current_email.empty() && !same_email) { UMA_HISTOGRAM_ENUMERATION("Signin.Reauth", signin::HISTOGRAM_ACCOUNT_MISSMATCH, signin::HISTOGRAM_MAX); if (error_message) { error_message->assign( l10n_util::GetStringFUTF8(IDS_SYNC_WRONG_EMAIL, UTF8ToUTF16(current_email))); } return false; } if (!manager->IsAllowedUsername(email)) { if (error_message) { error_message->assign( l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED)); } return false; } if (g_browser_process && !same_email) { ProfileManager* manager = g_browser_process->profile_manager(); if (manager) { string16 email16 = UTF8ToUTF16(email); ProfileInfoCache& cache = manager->GetProfileInfoCache(); for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { if (email16 == cache.GetUserNameOfProfileAtIndex(i)) { if (error_message) { error_message->assign( l10n_util::GetStringUTF8(IDS_SYNC_USER_NAME_IN_USE_ERROR)); } return false; } } } } if (can_offer_for == CAN_OFFER_FOR_INTERSTITAL_ONLY) { const ListValue* rejected_emails = profile->GetPrefs()->GetList( prefs::kReverseAutologinRejectedEmailList); if (!rejected_emails->empty()) { base::ListValue::const_iterator iter = rejected_emails->Find( base::StringValue(email)); if (iter != rejected_emails->end()) return false; } } } VLOG(1) << "OneClickSigninHelper::CanOffer: yes we can"; return true; }
C
Chrome
0
CVE-2017-5130
https://www.cvedetails.com/cve/CVE-2017-5130/
CWE-787
https://github.com/chromium/chromium/commit/ce1446c00f0fd8f5a3b00727421be2124cb7370f
ce1446c00f0fd8f5a3b00727421be2124cb7370f
Roll libxml to 3939178e4cb797417ff033b1e04ab4b038e224d9 Removes a few patches fixed upstream: https://git.gnome.org/browse/libxml2/commit/?id=e26630548e7d138d2c560844c43820b6767251e3 https://git.gnome.org/browse/libxml2/commit/?id=94691dc884d1a8ada39f073408b4bb92fe7fe882 Stops using the NOXXE flag which was reverted upstream: https://git.gnome.org/browse/libxml2/commit/?id=030b1f7a27c22f9237eddca49ec5e620b6258d7d Changes the patch to uri.c to not add limits.h, which is included upstream. Bug: 722079 Change-Id: I4b8449ed33f95de23c54c2cde99970c2df2781ac Reviewed-on: https://chromium-review.googlesource.com/535233 Reviewed-by: Scott Graham <[email protected]> Commit-Queue: Dominic Cooney <[email protected]> Cr-Commit-Position: refs/heads/master@{#480755}
htmlHandleOmittedElem(int val) { int old = htmlOmittedDefaultValue; htmlOmittedDefaultValue = val; return(old); }
htmlHandleOmittedElem(int val) { int old = htmlOmittedDefaultValue; htmlOmittedDefaultValue = val; return(old); }
C
Chrome
0
CVE-2013-4220
https://www.cvedetails.com/cve/CVE-2013-4220/
null
https://github.com/torvalds/linux/commit/9955ac47f4ba1c95ecb6092aeaefb40a22e99268
9955ac47f4ba1c95ecb6092aeaefb40a22e99268
arm64: don't kill the kernel on a bad esr from el0 Rather than completely killing the kernel if we receive an esr value we can't deal with in the el0 handlers, send the process a SIGILL and log the esr value in the hope that we can debug it. If we receive a bad esr from el1, we'll die() as before. Signed-off-by: Mark Rutland <[email protected]> Signed-off-by: Catalin Marinas <[email protected]> Cc: [email protected]
void __pmd_error(const char *file, int line, unsigned long val) { printk("%s:%d: bad pmd %016lx.\n", file, line, val); }
void __pmd_error(const char *file, int line, unsigned long val) { printk("%s:%d: bad pmd %016lx.\n", file, line, val); }
C
linux
0
CVE-2015-6252
https://www.cvedetails.com/cve/CVE-2015-6252/
CWE-399
https://github.com/torvalds/linux/commit/7932c0bd7740f4cd2aa168d3ce0199e7af7d72d5
7932c0bd7740f4cd2aa168d3ce0199e7af7d72d5
vhost: actually track log eventfd file While reviewing vhost log code, I found out that log_file is never set. Note: I haven't tested the change (QEMU doesn't use LOG_FD yet). Cc: [email protected] Signed-off-by: Marc-André Lureau <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) { struct file *eventfp, *filep = NULL; bool pollstart = false, pollstop = false; struct eventfd_ctx *ctx = NULL; u32 __user *idxp = argp; struct vhost_virtqueue *vq; struct vhost_vring_state s; struct vhost_vring_file f; struct vhost_vring_addr a; u32 idx; long r; r = get_user(idx, idxp); if (r < 0) return r; if (idx >= d->nvqs) return -ENOBUFS; vq = d->vqs[idx]; mutex_lock(&vq->mutex); switch (ioctl) { case VHOST_SET_VRING_NUM: /* Resizing ring with an active backend? * You don't want to do that. */ if (vq->private_data) { r = -EBUSY; break; } if (copy_from_user(&s, argp, sizeof s)) { r = -EFAULT; break; } if (!s.num || s.num > 0xffff || (s.num & (s.num - 1))) { r = -EINVAL; break; } vq->num = s.num; break; case VHOST_SET_VRING_BASE: /* Moving base with an active backend? * You don't want to do that. */ if (vq->private_data) { r = -EBUSY; break; } if (copy_from_user(&s, argp, sizeof s)) { r = -EFAULT; break; } if (s.num > 0xffff) { r = -EINVAL; break; } vq->last_avail_idx = s.num; /* Forget the cached index value. */ vq->avail_idx = vq->last_avail_idx; break; case VHOST_GET_VRING_BASE: s.index = idx; s.num = vq->last_avail_idx; if (copy_to_user(argp, &s, sizeof s)) r = -EFAULT; break; case VHOST_SET_VRING_ADDR: if (copy_from_user(&a, argp, sizeof a)) { r = -EFAULT; break; } if (a.flags & ~(0x1 << VHOST_VRING_F_LOG)) { r = -EOPNOTSUPP; break; } /* For 32bit, verify that the top 32bits of the user data are set to zero. */ if ((u64)(unsigned long)a.desc_user_addr != a.desc_user_addr || (u64)(unsigned long)a.used_user_addr != a.used_user_addr || (u64)(unsigned long)a.avail_user_addr != a.avail_user_addr) { r = -EFAULT; break; } /* Make sure it's safe to cast pointers to vring types. */ BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || (a.log_guest_addr & (sizeof(u64) - 1))) { r = -EINVAL; break; } /* We only verify access here if backend is configured. * If it is not, we don't as size might not have been setup. * We will verify when backend is configured. */ if (vq->private_data) { if (!vq_access_ok(vq, vq->num, (void __user *)(unsigned long)a.desc_user_addr, (void __user *)(unsigned long)a.avail_user_addr, (void __user *)(unsigned long)a.used_user_addr)) { r = -EINVAL; break; } /* Also validate log access for used ring if enabled. */ if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) && !log_access_ok(vq->log_base, a.log_guest_addr, sizeof *vq->used + vq->num * sizeof *vq->used->ring)) { r = -EINVAL; break; } } vq->log_used = !!(a.flags & (0x1 << VHOST_VRING_F_LOG)); vq->desc = (void __user *)(unsigned long)a.desc_user_addr; vq->avail = (void __user *)(unsigned long)a.avail_user_addr; vq->log_addr = a.log_guest_addr; vq->used = (void __user *)(unsigned long)a.used_user_addr; break; case VHOST_SET_VRING_KICK: if (copy_from_user(&f, argp, sizeof f)) { r = -EFAULT; break; } eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); if (IS_ERR(eventfp)) { r = PTR_ERR(eventfp); break; } if (eventfp != vq->kick) { pollstop = (filep = vq->kick) != NULL; pollstart = (vq->kick = eventfp) != NULL; } else filep = eventfp; break; case VHOST_SET_VRING_CALL: if (copy_from_user(&f, argp, sizeof f)) { r = -EFAULT; break; } eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); if (IS_ERR(eventfp)) { r = PTR_ERR(eventfp); break; } if (eventfp != vq->call) { filep = vq->call; ctx = vq->call_ctx; vq->call = eventfp; vq->call_ctx = eventfp ? eventfd_ctx_fileget(eventfp) : NULL; } else filep = eventfp; break; case VHOST_SET_VRING_ERR: if (copy_from_user(&f, argp, sizeof f)) { r = -EFAULT; break; } eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); if (IS_ERR(eventfp)) { r = PTR_ERR(eventfp); break; } if (eventfp != vq->error) { filep = vq->error; vq->error = eventfp; ctx = vq->error_ctx; vq->error_ctx = eventfp ? eventfd_ctx_fileget(eventfp) : NULL; } else filep = eventfp; break; case VHOST_SET_VRING_ENDIAN: r = vhost_set_vring_endian(vq, argp); break; case VHOST_GET_VRING_ENDIAN: r = vhost_get_vring_endian(vq, idx, argp); break; default: r = -ENOIOCTLCMD; } if (pollstop && vq->handle_kick) vhost_poll_stop(&vq->poll); if (ctx) eventfd_ctx_put(ctx); if (filep) fput(filep); if (pollstart && vq->handle_kick) r = vhost_poll_start(&vq->poll, vq->kick); mutex_unlock(&vq->mutex); if (pollstop && vq->handle_kick) vhost_poll_flush(&vq->poll); return r; }
long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) { struct file *eventfp, *filep = NULL; bool pollstart = false, pollstop = false; struct eventfd_ctx *ctx = NULL; u32 __user *idxp = argp; struct vhost_virtqueue *vq; struct vhost_vring_state s; struct vhost_vring_file f; struct vhost_vring_addr a; u32 idx; long r; r = get_user(idx, idxp); if (r < 0) return r; if (idx >= d->nvqs) return -ENOBUFS; vq = d->vqs[idx]; mutex_lock(&vq->mutex); switch (ioctl) { case VHOST_SET_VRING_NUM: /* Resizing ring with an active backend? * You don't want to do that. */ if (vq->private_data) { r = -EBUSY; break; } if (copy_from_user(&s, argp, sizeof s)) { r = -EFAULT; break; } if (!s.num || s.num > 0xffff || (s.num & (s.num - 1))) { r = -EINVAL; break; } vq->num = s.num; break; case VHOST_SET_VRING_BASE: /* Moving base with an active backend? * You don't want to do that. */ if (vq->private_data) { r = -EBUSY; break; } if (copy_from_user(&s, argp, sizeof s)) { r = -EFAULT; break; } if (s.num > 0xffff) { r = -EINVAL; break; } vq->last_avail_idx = s.num; /* Forget the cached index value. */ vq->avail_idx = vq->last_avail_idx; break; case VHOST_GET_VRING_BASE: s.index = idx; s.num = vq->last_avail_idx; if (copy_to_user(argp, &s, sizeof s)) r = -EFAULT; break; case VHOST_SET_VRING_ADDR: if (copy_from_user(&a, argp, sizeof a)) { r = -EFAULT; break; } if (a.flags & ~(0x1 << VHOST_VRING_F_LOG)) { r = -EOPNOTSUPP; break; } /* For 32bit, verify that the top 32bits of the user data are set to zero. */ if ((u64)(unsigned long)a.desc_user_addr != a.desc_user_addr || (u64)(unsigned long)a.used_user_addr != a.used_user_addr || (u64)(unsigned long)a.avail_user_addr != a.avail_user_addr) { r = -EFAULT; break; } /* Make sure it's safe to cast pointers to vring types. */ BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || (a.log_guest_addr & (sizeof(u64) - 1))) { r = -EINVAL; break; } /* We only verify access here if backend is configured. * If it is not, we don't as size might not have been setup. * We will verify when backend is configured. */ if (vq->private_data) { if (!vq_access_ok(vq, vq->num, (void __user *)(unsigned long)a.desc_user_addr, (void __user *)(unsigned long)a.avail_user_addr, (void __user *)(unsigned long)a.used_user_addr)) { r = -EINVAL; break; } /* Also validate log access for used ring if enabled. */ if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) && !log_access_ok(vq->log_base, a.log_guest_addr, sizeof *vq->used + vq->num * sizeof *vq->used->ring)) { r = -EINVAL; break; } } vq->log_used = !!(a.flags & (0x1 << VHOST_VRING_F_LOG)); vq->desc = (void __user *)(unsigned long)a.desc_user_addr; vq->avail = (void __user *)(unsigned long)a.avail_user_addr; vq->log_addr = a.log_guest_addr; vq->used = (void __user *)(unsigned long)a.used_user_addr; break; case VHOST_SET_VRING_KICK: if (copy_from_user(&f, argp, sizeof f)) { r = -EFAULT; break; } eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); if (IS_ERR(eventfp)) { r = PTR_ERR(eventfp); break; } if (eventfp != vq->kick) { pollstop = (filep = vq->kick) != NULL; pollstart = (vq->kick = eventfp) != NULL; } else filep = eventfp; break; case VHOST_SET_VRING_CALL: if (copy_from_user(&f, argp, sizeof f)) { r = -EFAULT; break; } eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); if (IS_ERR(eventfp)) { r = PTR_ERR(eventfp); break; } if (eventfp != vq->call) { filep = vq->call; ctx = vq->call_ctx; vq->call = eventfp; vq->call_ctx = eventfp ? eventfd_ctx_fileget(eventfp) : NULL; } else filep = eventfp; break; case VHOST_SET_VRING_ERR: if (copy_from_user(&f, argp, sizeof f)) { r = -EFAULT; break; } eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); if (IS_ERR(eventfp)) { r = PTR_ERR(eventfp); break; } if (eventfp != vq->error) { filep = vq->error; vq->error = eventfp; ctx = vq->error_ctx; vq->error_ctx = eventfp ? eventfd_ctx_fileget(eventfp) : NULL; } else filep = eventfp; break; case VHOST_SET_VRING_ENDIAN: r = vhost_set_vring_endian(vq, argp); break; case VHOST_GET_VRING_ENDIAN: r = vhost_get_vring_endian(vq, idx, argp); break; default: r = -ENOIOCTLCMD; } if (pollstop && vq->handle_kick) vhost_poll_stop(&vq->poll); if (ctx) eventfd_ctx_put(ctx); if (filep) fput(filep); if (pollstart && vq->handle_kick) r = vhost_poll_start(&vq->poll, vq->kick); mutex_unlock(&vq->mutex); if (pollstop && vq->handle_kick) vhost_poll_flush(&vq->poll); return r; }
C
linux
0
CVE-2010-2498
https://www.cvedetails.com/cve/CVE-2010-2498/
CWE-399
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=8d22746c9e5af80ff4304aef440986403a5072e2
8d22746c9e5af80ff4304aef440986403a5072e2
null
psh_glyph_find_strong_points( PSH_Glyph glyph, FT_Int dimension ) { /* a point is `strong' if it is located on a stem edge and */ /* has an `in' or `out' tangent parallel to the hint's direction */ PSH_Hint_Table table = &glyph->hint_tables[dimension]; PS_Mask mask = table->hint_masks->masks; FT_UInt num_masks = table->hint_masks->num_masks; FT_UInt first = 0; FT_Int major_dir = dimension == 0 ? PSH_DIR_VERTICAL : PSH_DIR_HORIZONTAL; PSH_Dimension dim = &glyph->globals->dimension[dimension]; FT_Fixed scale = dim->scale_mult; FT_Int threshold; threshold = (FT_Int)FT_DivFix( PSH_STRONG_THRESHOLD, scale ); if ( threshold > PSH_STRONG_THRESHOLD_MAXIMUM ) threshold = PSH_STRONG_THRESHOLD_MAXIMUM; /* process secondary hints to `selected' points */ /* process secondary hints to `selected' points */ if ( num_masks > 1 && glyph->num_points > 0 ) { /* the `endchar' op can reduce the number of points */ first = mask->end_point > glyph->num_points ? glyph->num_points : mask->end_point; mask++; for ( ; num_masks > 1; num_masks--, mask++ ) { next = mask->end_point; FT_Int count; next = mask->end_point > glyph->num_points ? glyph->num_points : mask->end_point; count = next - first; if ( count > 0 ) { threshold, major_dir ); } first = next; } } /* process primary hints for all points */ if ( num_masks == 1 ) { FT_UInt count = glyph->num_points; PSH_Point point = glyph->points; psh_hint_table_activate_mask( table, table->hint_masks->masks ); psh_hint_table_find_strong_points( table, point, count, threshold, major_dir ); } /* now, certain points may have been attached to a hint and */ /* not marked as strong; update their flags then */ { FT_UInt count = glyph->num_points; PSH_Point point = glyph->points; for ( ; count > 0; count--, point++ ) if ( point->hint && !psh_point_is_strong( point ) ) psh_point_set_strong( point ); } }
psh_glyph_find_strong_points( PSH_Glyph glyph, FT_Int dimension ) { /* a point is `strong' if it is located on a stem edge and */ /* has an `in' or `out' tangent parallel to the hint's direction */ PSH_Hint_Table table = &glyph->hint_tables[dimension]; PS_Mask mask = table->hint_masks->masks; FT_UInt num_masks = table->hint_masks->num_masks; FT_UInt first = 0; FT_Int major_dir = dimension == 0 ? PSH_DIR_VERTICAL : PSH_DIR_HORIZONTAL; PSH_Dimension dim = &glyph->globals->dimension[dimension]; FT_Fixed scale = dim->scale_mult; FT_Int threshold; threshold = (FT_Int)FT_DivFix( PSH_STRONG_THRESHOLD, scale ); if ( threshold > PSH_STRONG_THRESHOLD_MAXIMUM ) threshold = PSH_STRONG_THRESHOLD_MAXIMUM; /* process secondary hints to `selected' points */ /* process secondary hints to `selected' points */ if ( num_masks > 1 && glyph->num_points > 0 ) { first = mask->end_point; mask++; for ( ; num_masks > 1; num_masks--, mask++ ) { next = mask->end_point; FT_Int count; next = mask->end_point; count = next - first; if ( count > 0 ) { threshold, major_dir ); } first = next; } } /* process primary hints for all points */ if ( num_masks == 1 ) { FT_UInt count = glyph->num_points; PSH_Point point = glyph->points; psh_hint_table_activate_mask( table, table->hint_masks->masks ); psh_hint_table_find_strong_points( table, point, count, threshold, major_dir ); } /* now, certain points may have been attached to a hint and */ /* not marked as strong; update their flags then */ { FT_UInt count = glyph->num_points; PSH_Point point = glyph->points; for ( ; count > 0; count--, point++ ) if ( point->hint && !psh_point_is_strong( point ) ) psh_point_set_strong( point ); } }
C
savannah
1
CVE-2016-1691
https://www.cvedetails.com/cve/CVE-2016-1691/
CWE-119
https://github.com/chromium/chromium/commit/e3aa8a56706c4abe208934d5c294f7b594b8b693
e3aa8a56706c4abe208934d5c294f7b594b8b693
Enforce the WebUsbAllowDevicesForUrls policy This change modifies UsbChooserContext to use the UsbAllowDevicesForUrls class to consider devices allowed by the WebUsbAllowDevicesForUrls policy. The WebUsbAllowDevicesForUrls policy overrides the other WebUSB policies. Unit tests are also added to ensure that the policy is being enforced correctly. The design document for this feature is found at: https://docs.google.com/document/d/1MPvsrWiVD_jAC8ELyk8njFpy6j1thfVU5aWT3TCWE8w Bug: 854329 Change-Id: I5f82e662ca9dc544da5918eae766b5535a31296b Reviewed-on: https://chromium-review.googlesource.com/c/1259289 Commit-Queue: Ovidio Henriquez <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Reviewed-by: Julian Pastarmov <[email protected]> Cr-Commit-Position: refs/heads/master@{#597926}
static void CheckAllowedDomainsHeader( const std::string& allowed_domain, const std::map<GURL, net::HttpRequestHeaders>& urls_requested, const GURL& url) { auto iter = urls_requested.find(url); ASSERT_TRUE(iter != urls_requested.end()); if (allowed_domain.empty()) { EXPECT_TRUE( !iter->second.HasHeader(safe_search_util::kGoogleAppsAllowedDomains)); return; } std::string header; iter->second.GetHeader(safe_search_util::kGoogleAppsAllowedDomains, &header); EXPECT_EQ(header, allowed_domain); }
static void CheckAllowedDomainsHeader( const std::string& allowed_domain, const std::map<GURL, net::HttpRequestHeaders>& urls_requested, const GURL& url) { auto iter = urls_requested.find(url); ASSERT_TRUE(iter != urls_requested.end()); if (allowed_domain.empty()) { EXPECT_TRUE( !iter->second.HasHeader(safe_search_util::kGoogleAppsAllowedDomains)); return; } std::string header; iter->second.GetHeader(safe_search_util::kGoogleAppsAllowedDomains, &header); EXPECT_EQ(header, allowed_domain); }
C
Chrome
0
CVE-2013-2909
https://www.cvedetails.com/cve/CVE-2013-2909/
CWE-399
https://github.com/chromium/chromium/commit/248a92c21c20c14b5983680c50e1d8b73fc79a2f
248a92c21c20c14b5983680c50e1d8b73fc79a2f
Update containtingIsolate to go back all the way to top isolate from current root, rather than stopping at the first isolate it finds. This works because the current root is always updated with each isolate run. BUG=279277 Review URL: https://chromiumcodereview.appspot.com/23972003 git-svn-id: svn://svn.chromium.org/blink/trunk@157268 bbb929c8-8fbe-4397-9dbb-9b2b20218538
RenderBlock::RenderTextInfo::~RenderTextInfo() { }
RenderBlock::RenderTextInfo::~RenderTextInfo() { }
C
Chrome
0
CVE-2015-1278
https://www.cvedetails.com/cve/CVE-2015-1278/
CWE-254
https://github.com/chromium/chromium/commit/784f56a9c97a838448dd23f9bdc7c05fe8e639b3
784f56a9c97a838448dd23f9bdc7c05fe8e639b3
Correctly reset FP in RFHI whenever origin changes Bug: 713364 Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f Reviewed-on: https://chromium-review.googlesource.com/482380 Commit-Queue: Ian Clelland <[email protected]> Reviewed-by: Charles Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#466778}
void RenderFrameHostImpl::AccessibilityFatalError() { browser_accessibility_manager_.reset(NULL); if (accessibility_reset_token_) return; accessibility_reset_count_++; if (accessibility_reset_count_ >= kMaxAccessibilityResets) { Send(new AccessibilityMsg_FatalError(routing_id_)); } else { accessibility_reset_token_ = g_next_accessibility_reset_token++; Send(new AccessibilityMsg_Reset(routing_id_, accessibility_reset_token_)); } }
void RenderFrameHostImpl::AccessibilityFatalError() { browser_accessibility_manager_.reset(NULL); if (accessibility_reset_token_) return; accessibility_reset_count_++; if (accessibility_reset_count_ >= kMaxAccessibilityResets) { Send(new AccessibilityMsg_FatalError(routing_id_)); } else { accessibility_reset_token_ = g_next_accessibility_reset_token++; Send(new AccessibilityMsg_Reset(routing_id_, accessibility_reset_token_)); } }
C
Chrome
0
CVE-2017-7277
https://www.cvedetails.com/cve/CVE-2017-7277/
CWE-125
https://github.com/torvalds/linux/commit/8605330aac5a5785630aec8f64378a54891937cc
8605330aac5a5785630aec8f64378a54891937cc
tcp: fix SCM_TIMESTAMPING_OPT_STATS for normal skbs __sock_recv_timestamp can be called for both normal skbs (for receive timestamps) and for skbs on the error queue (for transmit timestamps). Commit 1c885808e456 (tcp: SOF_TIMESTAMPING_OPT_STATS option for SO_TIMESTAMPING) assumes any skb passed to __sock_recv_timestamp are from the error queue, containing OPT_STATS in the content of the skb. This results in accessing invalid memory or generating junk data. To fix this, set skb->pkt_type to PACKET_OUTGOING for packets on the error queue. This is safe because on the receive path on local sockets skb->pkt_type is never set to PACKET_OUTGOING. With that, copy OPT_STATS from a packet, only if its pkt_type is PACKET_OUTGOING. Fixes: 1c885808e456 ("tcp: SOF_TIMESTAMPING_OPT_STATS option for SO_TIMESTAMPING") Reported-by: JongHwan Kim <[email protected]> Signed-off-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
struct sk_buff *__build_skb(void *data, unsigned int frag_size) { struct skb_shared_info *shinfo; struct sk_buff *skb; unsigned int size = frag_size ? : ksize(data); skb = kmem_cache_alloc(skbuff_head_cache, GFP_ATOMIC); if (!skb) return NULL; size -= SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); memset(skb, 0, offsetof(struct sk_buff, tail)); skb->truesize = SKB_TRUESIZE(size); atomic_set(&skb->users, 1); skb->head = data; skb->data = data; skb_reset_tail_pointer(skb); skb->end = skb->tail + size; skb->mac_header = (typeof(skb->mac_header))~0U; skb->transport_header = (typeof(skb->transport_header))~0U; /* make sure we initialize shinfo sequentially */ shinfo = skb_shinfo(skb); memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); atomic_set(&shinfo->dataref, 1); kmemcheck_annotate_variable(shinfo->destructor_arg); return skb; }
struct sk_buff *__build_skb(void *data, unsigned int frag_size) { struct skb_shared_info *shinfo; struct sk_buff *skb; unsigned int size = frag_size ? : ksize(data); skb = kmem_cache_alloc(skbuff_head_cache, GFP_ATOMIC); if (!skb) return NULL; size -= SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); memset(skb, 0, offsetof(struct sk_buff, tail)); skb->truesize = SKB_TRUESIZE(size); atomic_set(&skb->users, 1); skb->head = data; skb->data = data; skb_reset_tail_pointer(skb); skb->end = skb->tail + size; skb->mac_header = (typeof(skb->mac_header))~0U; skb->transport_header = (typeof(skb->transport_header))~0U; /* make sure we initialize shinfo sequentially */ shinfo = skb_shinfo(skb); memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); atomic_set(&shinfo->dataref, 1); kmemcheck_annotate_variable(shinfo->destructor_arg); return skb; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/bfa69d49b17f33635c79f79819b90a8d2089c4b3
bfa69d49b17f33635c79f79819b90a8d2089c4b3
Change notification cmd line enabling to use the new RuntimeEnabledFeatures code. BUG=25318 TEST=none Review URL: http://codereview.chromium.org/339093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30660 0039d316-1c4b-4281-b951-d872f2087c98
void BrowserRenderProcessHost::SendUserScriptsUpdate( base::SharedMemory *shared_memory) { base::SharedMemoryHandle handle_for_process; if (!shared_memory->ShareToProcess(GetRendererProcessHandle(), &handle_for_process)) { return; } if (base::SharedMemory::IsHandleValid(handle_for_process)) { Send(new ViewMsg_UserScripts_UpdatedScripts(handle_for_process)); } }
void BrowserRenderProcessHost::SendUserScriptsUpdate( base::SharedMemory *shared_memory) { base::SharedMemoryHandle handle_for_process; if (!shared_memory->ShareToProcess(GetRendererProcessHandle(), &handle_for_process)) { return; } if (base::SharedMemory::IsHandleValid(handle_for_process)) { Send(new ViewMsg_UserScripts_UpdatedScripts(handle_for_process)); } }
C
Chrome
0
CVE-2015-5283
https://www.cvedetails.com/cve/CVE-2015-5283/
CWE-119
https://github.com/torvalds/linux/commit/8e2d61e0aed2b7c4ecb35844fe07e0b2b762dee4
8e2d61e0aed2b7c4ecb35844fe07e0b2b762dee4
sctp: fix race on protocol/netns initialization Consider sctp module is unloaded and is being requested because an user is creating a sctp socket. During initialization, sctp will add the new protocol type and then initialize pernet subsys: status = sctp_v4_protosw_init(); if (status) goto err_protosw_init; status = sctp_v6_protosw_init(); if (status) goto err_v6_protosw_init; status = register_pernet_subsys(&sctp_net_ops); The problem is that after those calls to sctp_v{4,6}_protosw_init(), it is possible for userspace to create SCTP sockets like if the module is already fully loaded. If that happens, one of the possible effects is that we will have readers for net->sctp.local_addr_list list earlier than expected and sctp_net_init() does not take precautions while dealing with that list, leading to a potential panic but not limited to that, as sctp_sock_init() will copy a bunch of blank/partially initialized values from net->sctp. The race happens like this: CPU 0 | CPU 1 socket() | __sock_create | socket() inet_create | __sock_create list_for_each_entry_rcu( | answer, &inetsw[sock->type], | list) { | inet_create /* no hits */ | if (unlikely(err)) { | ... | request_module() | /* socket creation is blocked | * the module is fully loaded | */ | sctp_init | sctp_v4_protosw_init | inet_register_protosw | list_add_rcu(&p->list, | last_perm); | | list_for_each_entry_rcu( | answer, &inetsw[sock->type], sctp_v6_protosw_init | list) { | /* hit, so assumes protocol | * is already loaded | */ | /* socket creation continues | * before netns is initialized | */ register_pernet_subsys | Simply inverting the initialization order between register_pernet_subsys() and sctp_v4_protosw_init() is not possible because register_pernet_subsys() will create a control sctp socket, so the protocol must be already visible by then. Deferring the socket creation to a work-queue is not good specially because we loose the ability to handle its errors. So, as suggested by Vlad, the fix is to split netns initialization in two moments: defaults and control socket, so that the defaults are already loaded by when we register the protocol, while control socket initialization is kept at the same moment it is today. Fixes: 4db67e808640 ("sctp: Make the address lists per network namespace") Signed-off-by: Vlad Yasevich <[email protected]> Signed-off-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int sctp_v4_add_protocol(void) { /* Register notifier for inet address additions/deletions. */ register_inetaddr_notifier(&sctp_inetaddr_notifier); /* Register SCTP with inet layer. */ if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0) return -EAGAIN; return 0; }
static int sctp_v4_add_protocol(void) { /* Register notifier for inet address additions/deletions. */ register_inetaddr_notifier(&sctp_inetaddr_notifier); /* Register SCTP with inet layer. */ if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0) return -EAGAIN; return 0; }
C
linux
0
CVE-2016-1622
https://www.cvedetails.com/cve/CVE-2016-1622/
CWE-264
https://github.com/chromium/chromium/commit/83a4b3aa72d98fe4176b4a54c8cea227ed966570
83a4b3aa72d98fe4176b4a54c8cea227ed966570
[Extensions] Don't allow built-in extensions code to be overridden BUG=546677 Review URL: https://codereview.chromium.org/1417513003 Cr-Commit-Position: refs/heads/master@{#356654}
v8::Local<v8::Value> ModuleSystem::RequireForJsInner( v8::Local<v8::String> module_name) { v8::EscapableHandleScope handle_scope(GetIsolate()); v8::Local<v8::Context> v8_context = context()->v8_context(); v8::Context::Scope context_scope(v8_context); v8::Local<v8::Object> global(context()->v8_context()->Global()); v8::Local<v8::Value> modules_value = global->GetHiddenValue( ToV8StringUnsafe(GetIsolate(), kModulesField)); if (modules_value.IsEmpty() || modules_value->IsUndefined()) { Warn(GetIsolate(), "Extension view no longer exists"); return v8::Undefined(GetIsolate()); } v8::Local<v8::Object> modules(v8::Local<v8::Object>::Cast(modules_value)); v8::Local<v8::Value> exports; if (!GetProperty(v8_context, modules, module_name, &exports) || !exports->IsUndefined()) return handle_scope.Escape(exports); exports = LoadModule(*v8::String::Utf8Value(module_name)); SetProperty(v8_context, modules, module_name, exports); return handle_scope.Escape(exports); }
v8::Local<v8::Value> ModuleSystem::RequireForJsInner( v8::Local<v8::String> module_name) { v8::EscapableHandleScope handle_scope(GetIsolate()); v8::Local<v8::Context> v8_context = context()->v8_context(); v8::Context::Scope context_scope(v8_context); v8::Local<v8::Object> global(context()->v8_context()->Global()); v8::Local<v8::Value> modules_value = global->GetHiddenValue( ToV8StringUnsafe(GetIsolate(), kModulesField)); if (modules_value.IsEmpty() || modules_value->IsUndefined()) { Warn(GetIsolate(), "Extension view no longer exists"); return v8::Undefined(GetIsolate()); } v8::Local<v8::Object> modules(v8::Local<v8::Object>::Cast(modules_value)); v8::Local<v8::Value> exports; if (!GetProperty(v8_context, modules, module_name, &exports) || !exports->IsUndefined()) return handle_scope.Escape(exports); exports = LoadModule(*v8::String::Utf8Value(module_name)); SetProperty(v8_context, modules, module_name, exports); return handle_scope.Escape(exports); }
C
Chrome
0
CVE-2016-3861
https://www.cvedetails.com/cve/CVE-2016-3861/
CWE-119
https://android.googlesource.com/platform/system/core/+/ecf5fd58a8f50362ce9e8d4245a33d56f29f142b
ecf5fd58a8f50362ce9e8d4245a33d56f29f142b
libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8 Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length is causing a heap overflow. Correcting the length computation and adding bound checks to the conversion functions. Test: ran libutils_tests Bug: 29250543 Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb (cherry picked from commit c4966a363e46d2e1074d1a365e232af0dcedd6a1)
String8::String8() : mString(getEmptyString()) { }
String8::String8() : mString(getEmptyString()) { }
C
Android
0
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <[email protected]> CC: Karsten Keil <[email protected]> CC: "David S. Miller" <[email protected]> CC: Jay Vosburgh <[email protected]> CC: Andy Gospodarek <[email protected]> CC: Patrick McHardy <[email protected]> CC: Krzysztof Halasa <[email protected]> CC: "John W. Linville" <[email protected]> CC: Greg Kroah-Hartman <[email protected]> CC: Marcel Holtmann <[email protected]> CC: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static u32 bond_fix_features(struct net_device *dev, u32 features) { struct slave *slave; struct bonding *bond = netdev_priv(dev); u32 mask; int i; read_lock(&bond->lock); if (!bond->first_slave) { /* Disable adding VLANs to empty bond. But why? --mq */ features |= NETIF_F_VLAN_CHALLENGED; goto out; } mask = features; features &= ~NETIF_F_ONE_FOR_ALL; features |= NETIF_F_ALL_FOR_ALL; bond_for_each_slave(bond, slave, i) { features = netdev_increment_features(features, slave->dev->features, mask); } out: read_unlock(&bond->lock); return features; }
static u32 bond_fix_features(struct net_device *dev, u32 features) { struct slave *slave; struct bonding *bond = netdev_priv(dev); u32 mask; int i; read_lock(&bond->lock); if (!bond->first_slave) { /* Disable adding VLANs to empty bond. But why? --mq */ features |= NETIF_F_VLAN_CHALLENGED; goto out; } mask = features; features &= ~NETIF_F_ONE_FOR_ALL; features |= NETIF_F_ALL_FOR_ALL; bond_for_each_slave(bond, slave, i) { features = netdev_increment_features(features, slave->dev->features, mask); } out: read_unlock(&bond->lock); return features; }
C
linux
0
CVE-2018-6121
https://www.cvedetails.com/cve/CVE-2018-6121/
CWE-20
https://github.com/chromium/chromium/commit/7614790c80996d32a28218f4d1605b0908e9ddf6
7614790c80996d32a28218f4d1605b0908e9ddf6
Apply ExtensionNavigationThrottle filesystem/blob checks to all frames. BUG=836858 Change-Id: I34333a72501129fd40b5a9aa6378c9f35f1e7fc2 Reviewed-on: https://chromium-review.googlesource.com/1028511 Reviewed-by: Devlin <[email protected]> Reviewed-by: Alex Moshchuk <[email protected]> Reviewed-by: Nick Carter <[email protected]> Commit-Queue: Charlie Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#553867}
bool TestChildOrGuestAutoresize(bool is_guest, RenderProcessHost* embedder_rph, RenderWidgetHost* guest_rwh) { RenderProcessHostImpl* embedder_rph_impl = static_cast<RenderProcessHostImpl*>(embedder_rph); RenderWidgetHostImpl* guest_rwh_impl = static_cast<RenderWidgetHostImpl*>(guest_rwh); scoped_refptr<SynchronizeVisualPropertiesMessageFilter> filter( new SynchronizeVisualPropertiesMessageFilter()); if (is_guest) { embedder_rph_impl->SetBrowserPluginMessageFilterSubFilterForTesting( filter.get()); } else { embedder_rph_impl->AddFilter(filter.get()); } viz::LocalSurfaceId current_id = guest_rwh_impl->GetView()->GetLocalSurfaceId(); if (!current_id.is_valid()) current_id = filter->WaitForSurfaceId(); gfx::Size min_size(10, 10); gfx::Size max_size(100, 100); guest_rwh_impl->SetAutoResize(true, min_size, max_size); guest_rwh_impl->GetView()->EnableAutoResize(min_size, max_size); current_id = filter->WaitForSurfaceId(); int routing_id = guest_rwh_impl->GetRoutingID(); ViewHostMsg_ResizeOrRepaint_ACK_Params params; params.view_size = gfx::Size(75, 75); params.flags = 0; params.child_allocated_local_surface_id = viz::LocalSurfaceId( current_id.parent_sequence_number(), current_id.child_sequence_number() + 1, current_id.embed_token()); guest_rwh_impl->OnMessageReceived( ViewHostMsg_ResizeOrRepaint_ACK(routing_id, params)); base::RunLoop().RunUntilIdle(); guest_rwh_impl->GetView()->DisableAutoResize(params.view_size); return filter->WaitForSurfaceId() == viz::LocalSurfaceId(current_id.parent_sequence_number() + 1, current_id.child_sequence_number() + 1, current_id.embed_token()); }
bool TestChildOrGuestAutoresize(bool is_guest, RenderProcessHost* embedder_rph, RenderWidgetHost* guest_rwh) { RenderProcessHostImpl* embedder_rph_impl = static_cast<RenderProcessHostImpl*>(embedder_rph); RenderWidgetHostImpl* guest_rwh_impl = static_cast<RenderWidgetHostImpl*>(guest_rwh); scoped_refptr<SynchronizeVisualPropertiesMessageFilter> filter( new SynchronizeVisualPropertiesMessageFilter()); if (is_guest) { embedder_rph_impl->SetBrowserPluginMessageFilterSubFilterForTesting( filter.get()); } else { embedder_rph_impl->AddFilter(filter.get()); } viz::LocalSurfaceId current_id = guest_rwh_impl->GetView()->GetLocalSurfaceId(); if (!current_id.is_valid()) current_id = filter->WaitForSurfaceId(); gfx::Size min_size(10, 10); gfx::Size max_size(100, 100); guest_rwh_impl->SetAutoResize(true, min_size, max_size); guest_rwh_impl->GetView()->EnableAutoResize(min_size, max_size); current_id = filter->WaitForSurfaceId(); int routing_id = guest_rwh_impl->GetRoutingID(); ViewHostMsg_ResizeOrRepaint_ACK_Params params; params.view_size = gfx::Size(75, 75); params.flags = 0; params.child_allocated_local_surface_id = viz::LocalSurfaceId( current_id.parent_sequence_number(), current_id.child_sequence_number() + 1, current_id.embed_token()); guest_rwh_impl->OnMessageReceived( ViewHostMsg_ResizeOrRepaint_ACK(routing_id, params)); base::RunLoop().RunUntilIdle(); guest_rwh_impl->GetView()->DisableAutoResize(params.view_size); return filter->WaitForSurfaceId() == viz::LocalSurfaceId(current_id.parent_sequence_number() + 1, current_id.child_sequence_number() + 1, current_id.embed_token()); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/de485eb849be99305925de2257da3b85325df2fd
de485eb849be99305925de2257da3b85325df2fd
Disable ash configuring display when running mash. When running ash inside of mash_shell on a device, DisplayConfigurator will request a NativeDisplayDelegate from Ozone. Ozone is initialized only in the mus process, not in the ash process, so ash crashes at this point. Add accessor for configure_display_ to avoid crashing. The default display size can be set via command line with --ash-host-window-bounds flag until a better solution exists. BUG=590096 Review URL: https://codereview.chromium.org/1782093003 Cr-Commit-Position: refs/heads/master@{#380663}
std::vector<aura::Window*> Shell::GetContainersFromAllRootWindows( int container_id, aura::Window* priority_root) { std::vector<aura::Window*> containers; aura::Window::Windows root_windows = GetAllRootWindows(); for (aura::Window::Windows::const_iterator it = root_windows.begin(); it != root_windows.end(); ++it) { aura::Window* container = (*it)->GetChildById(container_id); if (container) { if (priority_root && priority_root->Contains(container)) containers.insert(containers.begin(), container); else containers.push_back(container); } } return containers; }
std::vector<aura::Window*> Shell::GetContainersFromAllRootWindows( int container_id, aura::Window* priority_root) { std::vector<aura::Window*> containers; aura::Window::Windows root_windows = GetAllRootWindows(); for (aura::Window::Windows::const_iterator it = root_windows.begin(); it != root_windows.end(); ++it) { aura::Window* container = (*it)->GetChildById(container_id); if (container) { if (priority_root && priority_root->Contains(container)) containers.insert(containers.begin(), container); else containers.push_back(container); } } return containers; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/27c68f543e5eba779902447445dfb05ec3f5bf75
27c68f543e5eba779902447445dfb05ec3f5bf75
Revert of Add accelerated VP9 decode infrastructure and an implementation for VA-API. (patchset #7 id:260001 of https://codereview.chromium.org/1318863003/ ) Reason for revert: I think this patch broke compile step for Chromium Linux ChromeOS MSan Builder. First failing build: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder/builds/8310 All recent builds: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder?numbuilds=200 Sorry for the revert. I'll re-revert if I'm wrong. Cheers, Tommy Original issue's description: > Add accelerated VP9 decode infrastructure and an implementation for VA-API. > > - Add a hardware/platform-independent VP9Decoder class and related > infrastructure, implementing AcceleratedVideoDecoder interface. VP9Decoder > performs the initial stages of the decode process, which are to be done > on host/in software, such as stream parsing and reference frame management. > > - Add a VP9Accelerator interface, used by the VP9Decoder to offload the > remaining stages of the decode process to hardware. VP9Accelerator > implementations are platform-specific. > > - Add the first implementation of VP9Accelerator - VaapiVP9Accelerator - and > integrate it with VaapiVideoDecodeAccelerator, for devices which provide > hardware VP9 acceleration through VA-API. Hook it up to the new > infrastructure and VP9Decoder. > > - Extend Vp9Parser to provide functionality required by VP9Decoder and > VP9Accelerator, including superframe parsing, handling of loop filter > and segmentation initialization, state persistence across frames and > resetting when needed. Also add code calculating segmentation dequants > and loop filter levels. > > - Update vp9_parser_unittest to the new Vp9Parser interface and flow. > > TEST=vp9_parser_unittest,vda_unittest,Chrome VP9 playback > BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331 > [email protected] > > Committed: https://crrev.com/e3cc0a661b8abfdc74f569940949bc1f336ece40 > Cr-Commit-Position: refs/heads/master@{#349312} [email protected],[email protected],[email protected],[email protected],[email protected] NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331 Review URL: https://codereview.chromium.org/1357513002 Cr-Commit-Position: refs/heads/master@{#349443}
bool Vp9Parser::ParseSuperframe() { if (!ParseUncompressedHeader(fhdr)) return false; UpdateSlots(fhdr); return true; }
bool Vp9Parser::ParseSuperframe() { const uint8_t* stream = stream_; off_t bytes_left = bytes_left_; DCHECK(frames_.empty()); stream_ = nullptr; bytes_left_ = 0; if (bytes_left < 1) return false; uint8_t marker = *(stream + bytes_left - 1); if ((marker & 0xe0) != 0xc0) { frames_.push_back(FrameInfo(stream, bytes_left)); return true; } DVLOG(1) << "Parsing a superframe"; size_t num_frames = (marker & 0x7) + 1; size_t mag = ((marker >> 3) & 0x3) + 1; off_t index_size = 2 + mag * num_frames; if (bytes_left < index_size) return false; const uint8_t* index_ptr = stream + bytes_left - index_size; if (marker != *index_ptr) return false; ++index_ptr; bytes_left -= index_size; for (size_t i = 0; i < num_frames; ++i) { uint32_t size = 0; for (size_t j = 0; j < mag; ++j) { size |= *index_ptr << (j * 8); ++index_ptr; } if (base::checked_cast<off_t>(size) > bytes_left) { DVLOG(1) << "Not enough data in the buffer for frame " << i; return false; } frames_.push_back(FrameInfo(stream, size)); stream += size; bytes_left -= size; DVLOG(1) << "Frame " << i << ", size: " << size; } return true; }
C
Chrome
1
CVE-2016-7976
https://www.cvedetails.com/cve/CVE-2016-7976/
CWE-20
http://git.ghostscript.com/?p=user/chrisl/ghostpdl.git;a=commit;h=6d444c273da5499a4cd72f21cb6d4c9a5256807d
6d444c273da5499a4cd72f21cb6d4c9a5256807d
null
static void remove_ctx_pointers(gs_memory_t *mem) { mem->gs_lib_ctx = NULL; if (mem->stable_memory && mem->stable_memory != mem) remove_ctx_pointers(mem->stable_memory); if (mem->non_gc_memory && mem->non_gc_memory != mem) remove_ctx_pointers(mem->non_gc_memory); if (mem->thread_safe_memory && mem->thread_safe_memory != mem) remove_ctx_pointers(mem->thread_safe_memory); }
static void remove_ctx_pointers(gs_memory_t *mem) { mem->gs_lib_ctx = NULL; if (mem->stable_memory && mem->stable_memory != mem) remove_ctx_pointers(mem->stable_memory); if (mem->non_gc_memory && mem->non_gc_memory != mem) remove_ctx_pointers(mem->non_gc_memory); if (mem->thread_safe_memory && mem->thread_safe_memory != mem) remove_ctx_pointers(mem->thread_safe_memory); }
C
ghostscript
0
CVE-2015-3331
https://www.cvedetails.com/cve/CVE-2015-3331/
CWE-119
https://github.com/torvalds/linux/commit/ccfe8c3f7e52ae83155cb038753f4c75b774ca8a
ccfe8c3f7e52ae83155cb038753f4c75b774ca8a
crypto: aesni - fix memory usage in GCM decryption The kernel crypto API logic requires the caller to provide the length of (ciphertext || authentication tag) as cryptlen for the AEAD decryption operation. Thus, the cipher implementation must calculate the size of the plaintext output itself and cannot simply use cryptlen. The RFC4106 GCM decryption operation tries to overwrite cryptlen memory in req->dst. As the destination buffer for decryption only needs to hold the plaintext memory but cryptlen references the input buffer holding (ciphertext || authentication tag), the assumption of the destination buffer length in RFC4106 GCM operation leads to a too large size. This patch simply uses the already calculated plaintext size. In addition, this patch fixes the offset calculation of the AAD buffer pointer: as mentioned before, cryptlen already includes the size of the tag. Thus, the tag does not need to be added. With the addition, the AAD will be written beyond the already allocated buffer. Note, this fixes a kernel crash that can be triggered from user space via AF_ALG(aead) -- simply use the libkcapi test application from [1] and update it to use rfc4106-gcm-aes. Using [1], the changes were tested using CAVS vectors to demonstrate that the crypto operation still delivers the right results. [1] http://www.chronox.de/libkcapi.html CC: Tadeusz Struk <[email protected]> Cc: [email protected] Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int rfc4106_init(struct crypto_tfm *tfm) { struct cryptd_aead *cryptd_tfm; struct aesni_rfc4106_gcm_ctx *ctx = (struct aesni_rfc4106_gcm_ctx *) PTR_ALIGN((u8 *)crypto_tfm_ctx(tfm), AESNI_ALIGN); struct crypto_aead *cryptd_child; struct aesni_rfc4106_gcm_ctx *child_ctx; cryptd_tfm = cryptd_alloc_aead("__driver-gcm-aes-aesni", 0, 0); if (IS_ERR(cryptd_tfm)) return PTR_ERR(cryptd_tfm); cryptd_child = cryptd_aead_child(cryptd_tfm); child_ctx = aesni_rfc4106_gcm_ctx_get(cryptd_child); memcpy(child_ctx, ctx, sizeof(*ctx)); ctx->cryptd_tfm = cryptd_tfm; tfm->crt_aead.reqsize = sizeof(struct aead_request) + crypto_aead_reqsize(&cryptd_tfm->base); return 0; }
static int rfc4106_init(struct crypto_tfm *tfm) { struct cryptd_aead *cryptd_tfm; struct aesni_rfc4106_gcm_ctx *ctx = (struct aesni_rfc4106_gcm_ctx *) PTR_ALIGN((u8 *)crypto_tfm_ctx(tfm), AESNI_ALIGN); struct crypto_aead *cryptd_child; struct aesni_rfc4106_gcm_ctx *child_ctx; cryptd_tfm = cryptd_alloc_aead("__driver-gcm-aes-aesni", 0, 0); if (IS_ERR(cryptd_tfm)) return PTR_ERR(cryptd_tfm); cryptd_child = cryptd_aead_child(cryptd_tfm); child_ctx = aesni_rfc4106_gcm_ctx_get(cryptd_child); memcpy(child_ctx, ctx, sizeof(*ctx)); ctx->cryptd_tfm = cryptd_tfm; tfm->crt_aead.reqsize = sizeof(struct aead_request) + crypto_aead_reqsize(&cryptd_tfm->base); return 0; }
C
linux
0
CVE-2013-2168
https://www.cvedetails.com/cve/CVE-2013-2168/
CWE-20
https://cgit.freedesktop.org/dbus/dbus/commit/?id=954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
null
_dbus_windows_get_datadir (void) { return _dbus_replace_install_prefix(DBUS_DATADIR); }
_dbus_windows_get_datadir (void) { return _dbus_replace_install_prefix(DBUS_DATADIR); }
C
dbus
0
CVE-2018-6143
https://www.cvedetails.com/cve/CVE-2018-6143/
CWE-125
https://github.com/chromium/chromium/commit/1f35b6980f600ec93e167118c21959d5cbd7c5c4
1f35b6980f600ec93e167118c21959d5cbd7c5c4
Fix Credential Management API Store() for existing Credentials This changes fixes the Credential Management API to correctly handle storing of already existing credentials. In the previous version `preferred_match()` was updated, which is not necessarily the credential selected by the user. Bug: 795878 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: I269f465861f44cdd784f0ce077e755191d3bd7bd Reviewed-on: https://chromium-review.googlesource.com/843022 Commit-Queue: Jan Wilken Dörrie <[email protected]> Reviewed-by: Balazs Engedy <[email protected]> Reviewed-by: Jochen Eisinger <[email protected]> Reviewed-by: Maxim Kolosovskiy <[email protected]> Cr-Commit-Position: refs/heads/master@{#526313}
GURL CredentialManagerImpl::GetOrigin() const { return GetLastCommittedURL().GetOrigin(); }
GURL CredentialManagerImpl::GetOrigin() const { return GetLastCommittedURL().GetOrigin(); }
C
Chrome
0
CVE-2017-16534
https://www.cvedetails.com/cve/CVE-2017-16534/
CWE-119
https://github.com/torvalds/linux/commit/2e1c42391ff2556387b3cb6308b24f6f65619feb
2e1c42391ff2556387b3cb6308b24f6f65619feb
USB: core: harden cdc_parse_cdc_header Andrey Konovalov reported a possible out-of-bounds problem for the cdc_parse_cdc_header function. He writes: It looks like cdc_parse_cdc_header() doesn't validate buflen before accessing buffer[1], buffer[2] and so on. The only check present is while (buflen > 0). So fix this issue up by properly validating the buffer length matches what the descriptor says it is. Reported-by: Andrey Konovalov <[email protected]> Tested-by: Andrey Konovalov <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static int create_intf_ep_devs(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); struct usb_host_interface *alt = intf->cur_altsetting; int i; if (intf->ep_devs_created || intf->unregistering) return 0; for (i = 0; i < alt->desc.bNumEndpoints; ++i) (void) usb_create_ep_devs(&intf->dev, &alt->endpoint[i], udev); intf->ep_devs_created = 1; return 0; }
static int create_intf_ep_devs(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); struct usb_host_interface *alt = intf->cur_altsetting; int i; if (intf->ep_devs_created || intf->unregistering) return 0; for (i = 0; i < alt->desc.bNumEndpoints; ++i) (void) usb_create_ep_devs(&intf->dev, &alt->endpoint[i], udev); intf->ep_devs_created = 1; return 0; }
C
linux
0
CVE-2019-11487
https://www.cvedetails.com/cve/CVE-2019-11487/
CWE-416
https://github.com/torvalds/linux/commit/6b3a707736301c2128ca85ce85fb13f60b5e350a
6b3a707736301c2128ca85ce85fb13f60b5e350a
Merge branch 'page-refs' (page ref overflow) Merge page ref overflow branch. Jann Horn reported that he can overflow the page ref count with sufficient memory (and a filesystem that is intentionally extremely slow). Admittedly it's not exactly easy. To have more than four billion references to a page requires a minimum of 32GB of kernel memory just for the pointers to the pages, much less any metadata to keep track of those pointers. Jann needed a total of 140GB of memory and a specially crafted filesystem that leaves all reads pending (in order to not ever free the page references and just keep adding more). Still, we have a fairly straightforward way to limit the two obvious user-controllable sources of page references: direct-IO like page references gotten through get_user_pages(), and the splice pipe page duplication. So let's just do that. * branch page-refs: fs: prevent page refcount overflow in pipe_buf_get mm: prevent get_user_pages() from overflowing page refcount mm: add 'try_get_page()' helper function mm: make page ref count overflow check tighter and more explicit
int hugetlb_reserve_pages(struct inode *inode, long from, long to, struct vm_area_struct *vma, vm_flags_t vm_flags) { long ret, chg; struct hstate *h = hstate_inode(inode); struct hugepage_subpool *spool = subpool_inode(inode); struct resv_map *resv_map; long gbl_reserve; /* This should never happen */ if (from > to) { VM_WARN(1, "%s called with a negative range\n", __func__); return -EINVAL; } /* * Only apply hugepage reservation if asked. At fault time, an * attempt will be made for VM_NORESERVE to allocate a page * without using reserves */ if (vm_flags & VM_NORESERVE) return 0; /* * Shared mappings base their reservation on the number of pages that * are already allocated on behalf of the file. Private mappings need * to reserve the full area even if read-only as mprotect() may be * called to make the mapping read-write. Assume !vma is a shm mapping */ if (!vma || vma->vm_flags & VM_MAYSHARE) { resv_map = inode_resv_map(inode); chg = region_chg(resv_map, from, to); } else { resv_map = resv_map_alloc(); if (!resv_map) return -ENOMEM; chg = to - from; set_vma_resv_map(vma, resv_map); set_vma_resv_flags(vma, HPAGE_RESV_OWNER); } if (chg < 0) { ret = chg; goto out_err; } /* * There must be enough pages in the subpool for the mapping. If * the subpool has a minimum size, there may be some global * reservations already in place (gbl_reserve). */ gbl_reserve = hugepage_subpool_get_pages(spool, chg); if (gbl_reserve < 0) { ret = -ENOSPC; goto out_err; } /* * Check enough hugepages are available for the reservation. * Hand the pages back to the subpool if there are not */ ret = hugetlb_acct_memory(h, gbl_reserve); if (ret < 0) { /* put back original number of pages, chg */ (void)hugepage_subpool_put_pages(spool, chg); goto out_err; } /* * Account for the reservations made. Shared mappings record regions * that have reservations as they are shared by multiple VMAs. * When the last VMA disappears, the region map says how much * the reservation was and the page cache tells how much of * the reservation was consumed. Private mappings are per-VMA and * only the consumed reservations are tracked. When the VMA * disappears, the original reservation is the VMA size and the * consumed reservations are stored in the map. Hence, nothing * else has to be done for private mappings here */ if (!vma || vma->vm_flags & VM_MAYSHARE) { long add = region_add(resv_map, from, to); if (unlikely(chg > add)) { /* * pages in this range were added to the reserve * map between region_chg and region_add. This * indicates a race with alloc_huge_page. Adjust * the subpool and reserve counts modified above * based on the difference. */ long rsv_adjust; rsv_adjust = hugepage_subpool_put_pages(spool, chg - add); hugetlb_acct_memory(h, -rsv_adjust); } } return 0; out_err: if (!vma || vma->vm_flags & VM_MAYSHARE) /* Don't call region_abort if region_chg failed */ if (chg >= 0) region_abort(resv_map, from, to); if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) kref_put(&resv_map->refs, resv_map_release); return ret; }
int hugetlb_reserve_pages(struct inode *inode, long from, long to, struct vm_area_struct *vma, vm_flags_t vm_flags) { long ret, chg; struct hstate *h = hstate_inode(inode); struct hugepage_subpool *spool = subpool_inode(inode); struct resv_map *resv_map; long gbl_reserve; /* This should never happen */ if (from > to) { VM_WARN(1, "%s called with a negative range\n", __func__); return -EINVAL; } /* * Only apply hugepage reservation if asked. At fault time, an * attempt will be made for VM_NORESERVE to allocate a page * without using reserves */ if (vm_flags & VM_NORESERVE) return 0; /* * Shared mappings base their reservation on the number of pages that * are already allocated on behalf of the file. Private mappings need * to reserve the full area even if read-only as mprotect() may be * called to make the mapping read-write. Assume !vma is a shm mapping */ if (!vma || vma->vm_flags & VM_MAYSHARE) { resv_map = inode_resv_map(inode); chg = region_chg(resv_map, from, to); } else { resv_map = resv_map_alloc(); if (!resv_map) return -ENOMEM; chg = to - from; set_vma_resv_map(vma, resv_map); set_vma_resv_flags(vma, HPAGE_RESV_OWNER); } if (chg < 0) { ret = chg; goto out_err; } /* * There must be enough pages in the subpool for the mapping. If * the subpool has a minimum size, there may be some global * reservations already in place (gbl_reserve). */ gbl_reserve = hugepage_subpool_get_pages(spool, chg); if (gbl_reserve < 0) { ret = -ENOSPC; goto out_err; } /* * Check enough hugepages are available for the reservation. * Hand the pages back to the subpool if there are not */ ret = hugetlb_acct_memory(h, gbl_reserve); if (ret < 0) { /* put back original number of pages, chg */ (void)hugepage_subpool_put_pages(spool, chg); goto out_err; } /* * Account for the reservations made. Shared mappings record regions * that have reservations as they are shared by multiple VMAs. * When the last VMA disappears, the region map says how much * the reservation was and the page cache tells how much of * the reservation was consumed. Private mappings are per-VMA and * only the consumed reservations are tracked. When the VMA * disappears, the original reservation is the VMA size and the * consumed reservations are stored in the map. Hence, nothing * else has to be done for private mappings here */ if (!vma || vma->vm_flags & VM_MAYSHARE) { long add = region_add(resv_map, from, to); if (unlikely(chg > add)) { /* * pages in this range were added to the reserve * map between region_chg and region_add. This * indicates a race with alloc_huge_page. Adjust * the subpool and reserve counts modified above * based on the difference. */ long rsv_adjust; rsv_adjust = hugepage_subpool_put_pages(spool, chg - add); hugetlb_acct_memory(h, -rsv_adjust); } } return 0; out_err: if (!vma || vma->vm_flags & VM_MAYSHARE) /* Don't call region_abort if region_chg failed */ if (chg >= 0) region_abort(resv_map, from, to); if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) kref_put(&resv_map->refs, resv_map_release); return ret; }
C
linux
0
CVE-2013-1957
https://www.cvedetails.com/cve/CVE-2013-1957/
CWE-264
https://github.com/torvalds/linux/commit/132c94e31b8bca8ea921f9f96a57d684fa4ae0a9
132c94e31b8bca8ea921f9f96a57d684fa4ae0a9
vfs: Carefully propogate mounts across user namespaces As a matter of policy MNT_READONLY should not be changable if the original mounter had more privileges than creator of the mount namespace. Add the flag CL_UNPRIVILEGED to note when we are copying a mount from a mount namespace that requires more privileges to a mount namespace that requires fewer privileges. When the CL_UNPRIVILEGED flag is set cause clone_mnt to set MNT_NO_REMOUNT if any of the mnt flags that should never be changed are set. This protects both mount propagation and the initial creation of a less privileged mount namespace. Cc: [email protected] Acked-by: Serge Hallyn <[email protected]> Reported-by: Andy Lutomirski <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
int __mnt_want_write(struct vfsmount *m) { struct mount *mnt = real_mount(m); int ret = 0; preempt_disable(); mnt_inc_writers(mnt); /* * The store to mnt_inc_writers must be visible before we pass * MNT_WRITE_HOLD loop below, so that the slowpath can see our * incremented count after it has set MNT_WRITE_HOLD. */ smp_mb(); while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) cpu_relax(); /* * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will * be set to match its requirements. So we must not load that until * MNT_WRITE_HOLD is cleared. */ smp_rmb(); if (mnt_is_readonly(m)) { mnt_dec_writers(mnt); ret = -EROFS; } preempt_enable(); return ret; }
int __mnt_want_write(struct vfsmount *m) { struct mount *mnt = real_mount(m); int ret = 0; preempt_disable(); mnt_inc_writers(mnt); /* * The store to mnt_inc_writers must be visible before we pass * MNT_WRITE_HOLD loop below, so that the slowpath can see our * incremented count after it has set MNT_WRITE_HOLD. */ smp_mb(); while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) cpu_relax(); /* * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will * be set to match its requirements. So we must not load that until * MNT_WRITE_HOLD is cleared. */ smp_rmb(); if (mnt_is_readonly(m)) { mnt_dec_writers(mnt); ret = -EROFS; } preempt_enable(); return ret; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/d4cd2b2c0953ad7e9fa988c234eb9361be80fe81
d4cd2b2c0953ad7e9fa988c234eb9361be80fe81
DevTools: 'Overrides' UI overlay obstructs page and element inspector BUG=302862 [email protected] Review URL: https://codereview.chromium.org/40233006 git-svn-id: svn://svn.chromium.org/blink/trunk@160559 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static bool prepareResourceBuffer(Resource* cachedResource, bool* hasZeroSize) { *hasZeroSize = false; if (!cachedResource) return false; if (!cachedResource->encodedSize()) { *hasZeroSize = true; return true; } if (cachedResource->isPurgeable()) { if (!cachedResource->makePurgeable(false)) return false; } return true; }
static bool prepareResourceBuffer(Resource* cachedResource, bool* hasZeroSize) { *hasZeroSize = false; if (!cachedResource) return false; if (!cachedResource->encodedSize()) { *hasZeroSize = true; return true; } if (cachedResource->isPurgeable()) { if (!cachedResource->makePurgeable(false)) return false; } return true; }
C
Chrome
0
CVE-2018-1065
https://www.cvedetails.com/cve/CVE-2018-1065/
CWE-476
https://github.com/torvalds/linux/commit/57ebd808a97d7c5b1e1afb937c2db22beba3c1f8
57ebd808a97d7c5b1e1afb937c2db22beba3c1f8
netfilter: add back stackpointer size checks The rationale for removing the check is only correct for rulesets generated by ip(6)tables. In iptables, a jump can only occur to a user-defined chain, i.e. because we size the stack based on number of user-defined chains we cannot exceed stack size. However, the underlying binary format has no such restriction, and the validation step only ensures that the jump target is a valid rule start point. IOW, its possible to build a rule blob that has no user-defined chains but does contain a jump. If this happens, no jump stack gets allocated and crash occurs because no jumpstack was allocated. Fixes: 7814b6ec6d0d6 ("netfilter: xtables: don't save/restore jumpstack offset") Reported-by: [email protected] Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
ip6t_do_table(struct sk_buff *skb, const struct nf_hook_state *state, struct xt_table *table) { unsigned int hook = state->hook; static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))); /* Initializing verdict to NF_DROP keeps gcc happy. */ unsigned int verdict = NF_DROP; const char *indev, *outdev; const void *table_base; struct ip6t_entry *e, **jumpstack; unsigned int stackidx, cpu; const struct xt_table_info *private; struct xt_action_param acpar; unsigned int addend; /* Initialization */ stackidx = 0; indev = state->in ? state->in->name : nulldevname; outdev = state->out ? state->out->name : nulldevname; /* We handle fragments by dealing with the first fragment as * if it was a normal packet. All other fragments are treated * normally, except that they will NEVER match rules that ask * things we don't know, ie. tcp syn flag or ports). If the * rule is also a fragment-specific rule, non-fragments won't * match it. */ acpar.hotdrop = false; acpar.state = state; WARN_ON(!(table->valid_hooks & (1 << hook))); local_bh_disable(); addend = xt_write_recseq_begin(); private = READ_ONCE(table->private); /* Address dependency. */ cpu = smp_processor_id(); table_base = private->entries; jumpstack = (struct ip6t_entry **)private->jumpstack[cpu]; /* Switch to alternate jumpstack if we're being invoked via TEE. * TEE issues XT_CONTINUE verdict on original skb so we must not * clobber the jumpstack. * * For recursion via REJECT or SYNPROXY the stack will be clobbered * but it is no problem since absolute verdict is issued by these. */ if (static_key_false(&xt_tee_enabled)) jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated); e = get_entry(table_base, private->hook_entry[hook]); do { const struct xt_entry_target *t; const struct xt_entry_match *ematch; struct xt_counters *counter; WARN_ON(!e); acpar.thoff = 0; if (!ip6_packet_match(skb, indev, outdev, &e->ipv6, &acpar.thoff, &acpar.fragoff, &acpar.hotdrop)) { no_match: e = ip6t_next_entry(e); continue; } xt_ematch_foreach(ematch, e) { acpar.match = ematch->u.kernel.match; acpar.matchinfo = ematch->data; if (!acpar.match->match(skb, &acpar)) goto no_match; } counter = xt_get_this_cpu_counter(&e->counters); ADD_COUNTER(*counter, skb->len, 1); t = ip6t_get_target_c(e); WARN_ON(!t->u.kernel.target); #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) /* The packet is traced: log it */ if (unlikely(skb->nf_trace)) trace_packet(state->net, skb, hook, state->in, state->out, table->name, private, e); #endif /* Standard target? */ if (!t->u.kernel.target->target) { int v; v = ((struct xt_standard_target *)t)->verdict; if (v < 0) { /* Pop from stack? */ if (v != XT_RETURN) { verdict = (unsigned int)(-v) - 1; break; } if (stackidx == 0) e = get_entry(table_base, private->underflow[hook]); else e = ip6t_next_entry(jumpstack[--stackidx]); continue; } if (table_base + v != ip6t_next_entry(e) && !(e->ipv6.flags & IP6T_F_GOTO)) { if (unlikely(stackidx >= private->stacksize)) { verdict = NF_DROP; break; } jumpstack[stackidx++] = e; } e = get_entry(table_base, v); continue; } acpar.target = t->u.kernel.target; acpar.targinfo = t->data; verdict = t->u.kernel.target->target(skb, &acpar); if (verdict == XT_CONTINUE) e = ip6t_next_entry(e); else /* Verdict */ break; } while (!acpar.hotdrop); xt_write_recseq_end(addend); local_bh_enable(); if (acpar.hotdrop) return NF_DROP; else return verdict; }
ip6t_do_table(struct sk_buff *skb, const struct nf_hook_state *state, struct xt_table *table) { unsigned int hook = state->hook; static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))); /* Initializing verdict to NF_DROP keeps gcc happy. */ unsigned int verdict = NF_DROP; const char *indev, *outdev; const void *table_base; struct ip6t_entry *e, **jumpstack; unsigned int stackidx, cpu; const struct xt_table_info *private; struct xt_action_param acpar; unsigned int addend; /* Initialization */ stackidx = 0; indev = state->in ? state->in->name : nulldevname; outdev = state->out ? state->out->name : nulldevname; /* We handle fragments by dealing with the first fragment as * if it was a normal packet. All other fragments are treated * normally, except that they will NEVER match rules that ask * things we don't know, ie. tcp syn flag or ports). If the * rule is also a fragment-specific rule, non-fragments won't * match it. */ acpar.hotdrop = false; acpar.state = state; WARN_ON(!(table->valid_hooks & (1 << hook))); local_bh_disable(); addend = xt_write_recseq_begin(); private = READ_ONCE(table->private); /* Address dependency. */ cpu = smp_processor_id(); table_base = private->entries; jumpstack = (struct ip6t_entry **)private->jumpstack[cpu]; /* Switch to alternate jumpstack if we're being invoked via TEE. * TEE issues XT_CONTINUE verdict on original skb so we must not * clobber the jumpstack. * * For recursion via REJECT or SYNPROXY the stack will be clobbered * but it is no problem since absolute verdict is issued by these. */ if (static_key_false(&xt_tee_enabled)) jumpstack += private->stacksize * __this_cpu_read(nf_skb_duplicated); e = get_entry(table_base, private->hook_entry[hook]); do { const struct xt_entry_target *t; const struct xt_entry_match *ematch; struct xt_counters *counter; WARN_ON(!e); acpar.thoff = 0; if (!ip6_packet_match(skb, indev, outdev, &e->ipv6, &acpar.thoff, &acpar.fragoff, &acpar.hotdrop)) { no_match: e = ip6t_next_entry(e); continue; } xt_ematch_foreach(ematch, e) { acpar.match = ematch->u.kernel.match; acpar.matchinfo = ematch->data; if (!acpar.match->match(skb, &acpar)) goto no_match; } counter = xt_get_this_cpu_counter(&e->counters); ADD_COUNTER(*counter, skb->len, 1); t = ip6t_get_target_c(e); WARN_ON(!t->u.kernel.target); #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) /* The packet is traced: log it */ if (unlikely(skb->nf_trace)) trace_packet(state->net, skb, hook, state->in, state->out, table->name, private, e); #endif /* Standard target? */ if (!t->u.kernel.target->target) { int v; v = ((struct xt_standard_target *)t)->verdict; if (v < 0) { /* Pop from stack? */ if (v != XT_RETURN) { verdict = (unsigned int)(-v) - 1; break; } if (stackidx == 0) e = get_entry(table_base, private->underflow[hook]); else e = ip6t_next_entry(jumpstack[--stackidx]); continue; } if (table_base + v != ip6t_next_entry(e) && !(e->ipv6.flags & IP6T_F_GOTO)) { jumpstack[stackidx++] = e; } e = get_entry(table_base, v); continue; } acpar.target = t->u.kernel.target; acpar.targinfo = t->data; verdict = t->u.kernel.target->target(skb, &acpar); if (verdict == XT_CONTINUE) e = ip6t_next_entry(e); else /* Verdict */ break; } while (!acpar.hotdrop); xt_write_recseq_end(addend); local_bh_enable(); if (acpar.hotdrop) return NF_DROP; else return verdict; }
C
linux
1
CVE-2017-9990
https://www.cvedetails.com/cve/CVE-2017-9990/
CWE-119
https://github.com/FFmpeg/FFmpeg/commit/cb243972b121b1ae6b60a78ff55a0506c69f3879
cb243972b121b1ae6b60a78ff55a0506c69f3879
avcodec/xpmdec: Fix multiple pointer/memory issues Most of these were found through code review in response to fixing 1466/clusterfuzz-testcase-minimized-5961584419536896 There is thus no testcase for most of this. The initial issue was Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
static av_cold int xpm_decode_close(AVCodecContext *avctx) { XPMDecContext *x = avctx->priv_data; av_freep(&x->pixels); av_freep(&x->buf); x->buf_size = 0; return 0; }
static av_cold int xpm_decode_close(AVCodecContext *avctx) { XPMDecContext *x = avctx->priv_data; av_freep(&x->pixels); return 0; }
C
FFmpeg
1
null
null
null
https://github.com/chromium/chromium/commit/af05a799e3f47331fb27a24a8a56f1b1dd47a9c2
af05a799e3f47331fb27a24a8a56f1b1dd47a9c2
Clean up windows printing workflow. BUG=none TEST=printing works after code change. Review URL: http://codereview.chromium.org/6374004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71960 0039d316-1c4b-4281-b951-d872f2087c98
void PrintWebViewHelper::PrintNode(WebNode* node, bool script_initiated, bool is_preview) { Print(node->document().frame(), node, script_initiated, is_preview); }
void PrintWebViewHelper::PrintNode(WebNode* node, bool script_initiated, bool is_preview) { Print(node->document().frame(), node, script_initiated, is_preview); }
C
Chrome
0
CVE-2013-0904
https://www.cvedetails.com/cve/CVE-2013-0904/
CWE-119
https://github.com/chromium/chromium/commit/b2b21468c1f7f08b30a7c1755316f6026c50eb2a
b2b21468c1f7f08b30a7c1755316f6026c50eb2a
Separate repaint and layout requirements of StyleDifference (Step 1) Previously StyleDifference was an enum that proximately bigger values imply smaller values (e.g. StyleDifferenceLayout implies StyleDifferenceRepaint). This causes unnecessary repaints in some cases on layout change. Convert StyleDifference to a structure containing relatively independent flags. This change doesn't directly improve the result, but can make further repaint optimizations possible. Step 1 doesn't change any functionality. RenderStyle still generate the legacy StyleDifference enum when comparing styles and convert the result to the new StyleDifference. Implicit requirements are not handled during the conversion. Converted call sites to use the new StyleDifference according to the following conversion rules: - diff == StyleDifferenceEqual (&& !context) => diff.hasNoChange() - diff == StyleDifferenceRepaint => diff.needsRepaintObjectOnly() - diff == StyleDifferenceRepaintLayer => diff.needsRepaintLayer() - diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintLayer => diff.needsRepaintLayer() - diff >= StyleDifferenceRepaint => diff.needsRepaint() || diff.needsLayout() - diff >= StyleDifferenceRepaintLayer => diff.needsRepaintLayer() || diff.needsLayout() - diff > StyleDifferenceRepaintLayer => diff.needsLayout() - diff == StyleDifferencePositionedMovementLayoutOnly => diff.needsPositionedMovementLayoutOnly() - diff == StyleDifferenceLayout => diff.needsFullLayout() BUG=358460 TEST=All existing layout tests. [email protected], [email protected], [email protected] Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=171983 Review URL: https://codereview.chromium.org/236203020 git-svn-id: svn://svn.chromium.org/blink/trunk@172331 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void RenderBox::clearLayoutOverflow() { if (!m_overflow) return; if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { m_overflow.clear(); return; } m_overflow->setLayoutOverflow(noOverflowRect()); }
void RenderBox::clearLayoutOverflow() { if (!m_overflow) return; if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { m_overflow.clear(); return; } m_overflow->setLayoutOverflow(noOverflowRect()); }
C
Chrome
0
CVE-2018-1000040
https://www.cvedetails.com/cve/CVE-2018-1000040/
CWE-20
http://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=83d4dae44c71816c084a635550acc1a51529b881;hp=f597300439e62f5e921f0d7b1e880b5c1a1f1607
83d4dae44c71816c084a635550acc1a51529b881
null
int fz_colorspace_is_device_cmyk(fz_context *ctx, const fz_colorspace *cs) { return fz_colorspace_is_device(ctx, cs) && fz_colorspace_is_cmyk(ctx, cs); }
int fz_colorspace_is_device_cmyk(fz_context *ctx, const fz_colorspace *cs) { return fz_colorspace_is_device(ctx, cs) && fz_colorspace_is_cmyk(ctx, cs); }
C
ghostscript
0
CVE-2015-6784
https://www.cvedetails.com/cve/CVE-2015-6784/
CWE-20
https://github.com/chromium/chromium/commit/a81593e7f162428585832ac8f6e71f75592b53e7
a81593e7f162428585832ac8f6e71f75592b53e7
Escape "--" in the page URL at page serialization This patch makes page serializer to escape the page URL embed into a HTML comment of result HTML[1] to avoid inserting text as HTML from URL by introducing a static member function |PageSerialzier::markOfTheWebDeclaration()| for sharing it between |PageSerialzier| and |WebPageSerialzier| classes. [1] We use following format for serialized HTML: saved from url=(${lengthOfURL})${URL} BUG=503217 TEST=webkit_unit_tests --gtest_filter=PageSerializerTest.markOfTheWebDeclaration TEST=webkit_unit_tests --gtest_filter=WebPageSerializerTest.fromUrlWithMinusMinu Review URL: https://codereview.chromium.org/1371323003 Cr-Commit-Position: refs/heads/master@{#351736}
PageSerializer::PageSerializer(Vector<SerializedResource>* resources, PassOwnPtr<Delegate> delegate) : m_resources(resources) , m_blankFrameCounter(0) , m_delegate(delegate) { }
PageSerializer::PageSerializer(Vector<SerializedResource>* resources, PassOwnPtr<Delegate> delegate) : m_resources(resources) , m_blankFrameCounter(0) , m_delegate(delegate) { }
C
Chrome
0
CVE-2019-13106
https://www.cvedetails.com/cve/CVE-2019-13106/
CWE-787
https://github.com/u-boot/u-boot/commits/master
master
Merge branch '2020-01-22-master-imports' - Re-add U8500 platform support - Add bcm968360bg support - Assorted Keymile fixes - Other assorted bugfixes
int mvebu_board_spi_claim_bus(struct udevice *dev) { spi_mpp_backup[3] = 0; /* set new spi mpp config and save current one */ kirkwood_mpp_conf(spi_mpp_config, spi_mpp_backup); kw_gpio_set_value(KM_FLASH_GPIO_PIN, 0); return 0; }
int mvebu_board_spi_claim_bus(struct udevice *dev) { spi_mpp_backup[3] = 0; /* set new spi mpp config and save current one */ kirkwood_mpp_conf(spi_mpp_config, spi_mpp_backup); kw_gpio_set_value(KM_FLASH_GPIO_PIN, 0); return 0; }
C
u-boot
0
CVE-2012-2895
https://www.cvedetails.com/cve/CVE-2012-2895/
CWE-119
https://github.com/chromium/chromium/commit/16dcd30c215801941d9890859fd79a234128fc3e
16dcd30c215801941d9890859fd79a234128fc3e
Refactors to simplify rename pathway in DownloadFileManager. This is https://chromiumcodereview.appspot.com/10668004 / r144817 (reverted due to CrOS failure) with the completion logic moved to after the auto-opening. The tests that test the auto-opening (for web store install) were waiting for download completion to check install, and hence were failing when completion was moved earlier. Doing this right would probably require another state (OPENED). BUG=123998 BUG-134930 [email protected] Review URL: https://chromiumcodereview.appspot.com/10701040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145157 0039d316-1c4b-4281-b951-d872f2087c98
MockDownloadFile* MockDownloadFileFactory::GetExistingFile( const DownloadId& id) { DCHECK(files_.find(id) != files_.end()); return files_[id]; }
MockDownloadFile* MockDownloadFileFactory::GetExistingFile( const DownloadId& id) { DCHECK(files_.find(id) != files_.end()); return files_[id]; }
C
Chrome
0
CVE-2012-2875
https://www.cvedetails.com/cve/CVE-2012-2875/
null
https://github.com/chromium/chromium/commit/40ed2b7ae4f6f5adb1b0ce9acf9c4dece339c2a6
40ed2b7ae4f6f5adb1b0ce9acf9c4dece339c2a6
gdata: Define the resource ID for the root directory Per the spec, the resource ID for the root directory is defined as "folder:root". Add the resource ID to the root directory in our file system representation so we can look up the root directory by the resource ID. BUG=127697 TEST=add unit tests Review URL: https://chromiumcodereview.appspot.com/10332253 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137928 0039d316-1c4b-4281-b951-d872f2087c98
const GDataDirectory* GDataEntry::AsGDataDirectoryConst() const { return const_cast<GDataEntry*>(this)->AsGDataDirectory(); }
const GDataDirectory* GDataEntry::AsGDataDirectoryConst() const { return const_cast<GDataEntry*>(this)->AsGDataDirectory(); }
C
Chrome
0
CVE-2014-3173
https://www.cvedetails.com/cve/CVE-2014-3173/
CWE-119
https://github.com/chromium/chromium/commit/ee7579229ff7e9e5ae28bf53aea069251499d7da
ee7579229ff7e9e5ae28bf53aea069251499d7da
Framebuffer clear() needs to consider the situation some draw buffers are disabled. This is when we expose DrawBuffers extension. BUG=376951 TEST=the attached test case, webgl conformance [email protected],[email protected] Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98
void GLES2DecoderImpl::DoGetIntegerv(GLenum pname, GLint* params) { DCHECK(params); GLsizei num_written; if (!state_.GetStateAsGLint(pname, params, &num_written) && !GetHelper(pname, params, &num_written)) { pname = AdjustGetPname(pname); glGetIntegerv(pname, params); } }
void GLES2DecoderImpl::DoGetIntegerv(GLenum pname, GLint* params) { DCHECK(params); GLsizei num_written; if (!state_.GetStateAsGLint(pname, params, &num_written) && !GetHelper(pname, params, &num_written)) { pname = AdjustGetPname(pname); glGetIntegerv(pname, params); } }
C
Chrome
0
CVE-2019-5796
https://www.cvedetails.com/cve/CVE-2019-5796/
CWE-362
https://github.com/chromium/chromium/commit/5bb223676defeba9c44a5ce42460c86e24561e73
5bb223676defeba9c44a5ce42460c86e24561e73
[GuestView] - Introduce MimeHandlerViewAttachHelper This CL is for the most part a mechanical change which extracts almost all the frame-based MimeHandlerView code out of ExtensionsGuestViewMessageFilter. This change both removes the current clutter form EGVMF as well as fixesa race introduced when the frame-based logic was added to EGVMF. The reason for the race was that EGVMF is destroyed on IO thread but all the access to it (for frame-based MHV) are from UI. [email protected],[email protected] Bug: 659750, 896679, 911161, 918861 Change-Id: I6474b870e4d56daa68be03637bb633665d9f9dda Reviewed-on: https://chromium-review.googlesource.com/c/1401451 Commit-Queue: Ehsan Karamad <[email protected]> Reviewed-by: James MacLean <[email protected]> Reviewed-by: Ehsan Karamad <[email protected]> Cr-Commit-Position: refs/heads/master@{#621155}
void ChromeContentBrowserClient::RegisterIOThreadServiceHandlers( content::ServiceManagerConnection* connection) { connection->AddServiceRequestHandler( chrome::mojom::kServiceName, ChromeService::GetInstance()->CreateChromeServiceRequestHandler()); #if defined(OS_ANDROID) connection->AddServiceRequestHandler( proxy_resolver::mojom::kProxyResolverServiceName, base::BindRepeating([](service_manager::mojom::ServiceRequest request) { service_manager::Service::RunAsyncUntilTermination( std::make_unique<proxy_resolver::ProxyResolverService>( std::move(request))); })); connection->AddServiceRequestHandler( "download_manager", base::BindRepeating(&StartDownloadManager)); #endif }
void ChromeContentBrowserClient::RegisterIOThreadServiceHandlers( content::ServiceManagerConnection* connection) { connection->AddServiceRequestHandler( chrome::mojom::kServiceName, ChromeService::GetInstance()->CreateChromeServiceRequestHandler()); #if defined(OS_ANDROID) connection->AddServiceRequestHandler( proxy_resolver::mojom::kProxyResolverServiceName, base::BindRepeating([](service_manager::mojom::ServiceRequest request) { service_manager::Service::RunAsyncUntilTermination( std::make_unique<proxy_resolver::ProxyResolverService>( std::move(request))); })); connection->AddServiceRequestHandler( "download_manager", base::BindRepeating(&StartDownloadManager)); #endif }
C
Chrome
0
CVE-2014-3690
https://www.cvedetails.com/cve/CVE-2014-3690/
CWE-399
https://github.com/torvalds/linux/commit/d974baa398f34393db76be45f7d4d04fbdbb4a0a
d974baa398f34393db76be45f7d4d04fbdbb4a0a
x86,kvm,vmx: Preserve CR4 across VM entry CR4 isn't constant; at least the TSD and PCE bits can vary. TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks like it's correct. This adds a branch and a read from cr4 to each vm entry. Because it is extremely likely that consecutive entries into the same vcpu will have the same host cr4 value, this fixes up the vmcs instead of restoring cr4 after the fact. A subsequent patch will add a kernel-wide cr4 shadow, reducing the overhead in the common case to just two memory reads and a branch. Signed-off-by: Andy Lutomirski <[email protected]> Acked-by: Paolo Bonzini <[email protected]> Cc: [email protected] Cc: Petr Matousek <[email protected]> Cc: Gleb Natapov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
vmcs12_guest_cr4(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { return /*1*/ (vmcs_readl(GUEST_CR4) & vcpu->arch.cr4_guest_owned_bits) | /*2*/ (vmcs12->guest_cr4 & vmcs12->cr4_guest_host_mask) | /*3*/ (vmcs_readl(CR4_READ_SHADOW) & ~(vmcs12->cr4_guest_host_mask | vcpu->arch.cr4_guest_owned_bits)); }
vmcs12_guest_cr4(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { return /*1*/ (vmcs_readl(GUEST_CR4) & vcpu->arch.cr4_guest_owned_bits) | /*2*/ (vmcs12->guest_cr4 & vmcs12->cr4_guest_host_mask) | /*3*/ (vmcs_readl(CR4_READ_SHADOW) & ~(vmcs12->cr4_guest_host_mask | vcpu->arch.cr4_guest_owned_bits)); }
C
linux
0
CVE-2010-2527
https://www.cvedetails.com/cve/CVE-2010-2527/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2-demos.git/commit/?id=b995299b73ba4cd259f221f500d4e63095508bec
b995299b73ba4cd259f221f500d4e63095508bec
null
usage( void ) { fprintf( stderr, "ftdiff: a simple program to proof several text hinting modes\n" "-----------------------------------------------------------\n" "\n" "Usage: ftdiff [options] fontfile [fontfile2 ...]\n" "\n" " -r R use resolution R dpi (default: 72 dpi)\n" " -s S set character size to S points (default: 16 pt)\n" " -f TEXTFILE change displayed text, using text in TEXTFILE\n" "\n" ); exit( 1 ); }
usage( void ) { fprintf( stderr, "ftdiff: a simple program to proof several text hinting modes\n" "-----------------------------------------------------------\n" "\n" "Usage: ftdiff [options] fontfile [fontfile2 ...]\n" "\n" " -r R use resolution R dpi (default: 72 dpi)\n" " -s S set character size to S points (default: 16 pt)\n" " -f TEXTFILE change displayed text, using text in TEXTFILE\n" "\n" ); exit( 1 ); }
C
savannah
0
CVE-2011-4086
https://www.cvedetails.com/cve/CVE-2011-4086/
CWE-119
https://github.com/torvalds/linux/commit/15291164b22a357cb211b618adfef4fa82fc0de3
15291164b22a357cb211b618adfef4fa82fc0de3
jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head state ala discard_buffer(), but does not touch _Delay or _Unwritten as discard_buffer() does. This can be problematic in some areas of the ext4 code which assume that if they have found a buffer marked unwritten or delay, then it's a live one. Perhaps those spots should check whether it is mapped as well, but if jbd2 is going to tear down a buffer, let's really tear it down completely. Without this I get some fsx failures on sub-page-block filesystems up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go away, because buried within that large change is some more flag clearing. I still think it's worth doing in jbd2, since ->invalidatepage leads here directly, and it's the right place to clear away these flags. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh) { struct buffer_head *bh = jh2bh(jh); /* Get reference so that buffer cannot be freed before we unlock it */ get_bh(bh); jbd_lock_bh_state(bh); spin_lock(&journal->j_list_lock); __jbd2_journal_unfile_buffer(jh); spin_unlock(&journal->j_list_lock); jbd_unlock_bh_state(bh); __brelse(bh); }
void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh) { struct buffer_head *bh = jh2bh(jh); /* Get reference so that buffer cannot be freed before we unlock it */ get_bh(bh); jbd_lock_bh_state(bh); spin_lock(&journal->j_list_lock); __jbd2_journal_unfile_buffer(jh); spin_unlock(&journal->j_list_lock); jbd_unlock_bh_state(bh); __brelse(bh); }
C
linux
0
CVE-2015-0291
https://www.cvedetails.com/cve/CVE-2015-0291/
null
https://git.openssl.org/?p=openssl.git;a=commit;h=76343947ada960b6269090638f5391068daee88d
76343947ada960b6269090638f5391068daee88d
null
static void tls1_get_formatlist(SSL *s, const unsigned char **pformats, size_t *num_formats) { /* * If we have a custom point format list use it otherwise use default */ if (s->tlsext_ecpointformatlist) { *pformats = s->tlsext_ecpointformatlist; *num_formats = s->tlsext_ecpointformatlist_length; } else { *pformats = ecformats_default; /* For Suite B we don't support char2 fields */ if (tls1_suiteb(s)) *num_formats = sizeof(ecformats_default) - 1; else *num_formats = sizeof(ecformats_default); } }
static void tls1_get_formatlist(SSL *s, const unsigned char **pformats, size_t *num_formats) { /* * If we have a custom point format list use it otherwise use default */ if (s->tlsext_ecpointformatlist) { *pformats = s->tlsext_ecpointformatlist; *num_formats = s->tlsext_ecpointformatlist_length; } else { *pformats = ecformats_default; /* For Suite B we don't support char2 fields */ if (tls1_suiteb(s)) *num_formats = sizeof(ecformats_default) - 1; else *num_formats = sizeof(ecformats_default); } }
C
openssl
0
null
null
null
https://github.com/chromium/chromium/commit/d1a59e4e845a01d7d7b80ef184b672752a9eae4d
d1a59e4e845a01d7d7b80ef184b672752a9eae4d
Fixing cross-process postMessage replies on more than two iterations. When two frames are replying to each other using event.source across processes, after the first two replies, things break down. The root cause is that in RenderViewImpl::GetFrameByMappedID, the lookup was incorrect. It is now properly searching for the remote frame id and returning the local one. BUG=153445 Review URL: https://chromiumcodereview.appspot.com/11040015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159924 0039d316-1c4b-4281-b951-d872f2087c98
void RenderViewImpl::didChangeIcon(WebFrame* frame, WebIconURL::Type type) { FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcon(frame, type)); }
void RenderViewImpl::didChangeIcon(WebFrame* frame, WebIconURL::Type type) { FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcon(frame, type)); }
C
Chrome
0
CVE-2012-5148
https://www.cvedetails.com/cve/CVE-2012-5148/
CWE-20
https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599
e89cfcb9090e8c98129ae9160c513f504db74599
Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98
int BrowserTabStripController::GetActiveIndex() const { return model_->active_index(); }
int BrowserTabStripController::GetActiveIndex() const { return model_->active_index(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/3e5dae3b38fdb566fb2b7183e810b82eb3ce6f21
3e5dae3b38fdb566fb2b7183e810b82eb3ce6f21
Use a new field trial group to enable the SWReporter BUG=533484 Review URL: https://codereview.chromium.org/1376803002 Cr-Commit-Position: refs/heads/master@{#351788}
static std::string ID() { update_client::CrxComponent component; component.version = Version("0.0.0.0"); GetPkHash(&component.pk_hash); return update_client::GetCrxComponentID(component); }
static std::string ID() { update_client::CrxComponent component; component.version = Version("0.0.0.0"); GetPkHash(&component.pk_hash); return update_client::GetCrxComponentID(component); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/294474c162b13937a6474955c6594b3657379c1e
294474c162b13937a6474955c6594b3657379c1e
Some Scrollbar functions assume an attached ScrollableArea but can be called without one https://bugs.webkit.org/show_bug.cgi?id=54262 Reviewed by Dan Bernstein. Make sure that all calls to the scrollable area are null checked. * platform/Scrollbar.cpp: (WebCore::Scrollbar::autoscrollPressedPart): (WebCore::Scrollbar::moveThumb): (WebCore::Scrollbar::mouseMoved): git-svn-id: svn://svn.chromium.org/blink/trunk@78431 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static bool thumbUnderMouse(Scrollbar* scrollbar) { int thumbPos = scrollbar->theme()->trackPosition(scrollbar) + scrollbar->theme()->thumbPosition(scrollbar); int thumbLength = scrollbar->theme()->thumbLength(scrollbar); return scrollbar->pressedPos() >= thumbPos && scrollbar->pressedPos() < thumbPos + thumbLength; }
static bool thumbUnderMouse(Scrollbar* scrollbar) { int thumbPos = scrollbar->theme()->trackPosition(scrollbar) + scrollbar->theme()->thumbPosition(scrollbar); int thumbLength = scrollbar->theme()->thumbLength(scrollbar); return scrollbar->pressedPos() >= thumbPos && scrollbar->pressedPos() < thumbPos + thumbLength; }
C
Chrome
0
CVE-2011-0530
https://www.cvedetails.com/cve/CVE-2011-0530/
CWE-119
https://github.com/yoe/nbd/commit/3ef52043861ab16352d49af89e048ba6339d6df8
3ef52043861ab16352d49af89e048ba6339d6df8
Fix buffer size checking Yes, this means we've re-introduced CVE-2005-3534. Sigh.
int authorized_client(CLIENT *opts) { const char *ERRMSG="Invalid entry '%s' in authfile '%s', so, refusing all connections."; FILE *f ; char line[LINELEN]; char *tmp; struct in_addr addr; struct in_addr client; struct in_addr cltemp; int len; if ((f=fopen(opts->server->authname,"r"))==NULL) { msg4(LOG_INFO,"Can't open authorization file %s (%s).", opts->server->authname,strerror(errno)) ; return 1 ; } inet_aton(opts->clientname, &client); while (fgets(line,LINELEN,f)!=NULL) { if((tmp=index(line, '/'))) { if(strlen(line)<=tmp-line) { msg4(LOG_CRIT, ERRMSG, line, opts->server->authname); return 0; } *(tmp++)=0; if(!inet_aton(line,&addr)) { msg4(LOG_CRIT, ERRMSG, line, opts->server->authname); return 0; } len=strtol(tmp, NULL, 0); addr.s_addr>>=32-len; addr.s_addr<<=32-len; memcpy(&cltemp,&client,sizeof(client)); cltemp.s_addr>>=32-len; cltemp.s_addr<<=32-len; if(addr.s_addr == cltemp.s_addr) { return 1; } } if (strncmp(line,opts->clientname,strlen(opts->clientname))==0) { fclose(f); return 1; } } fclose(f); return 0; }
int authorized_client(CLIENT *opts) { const char *ERRMSG="Invalid entry '%s' in authfile '%s', so, refusing all connections."; FILE *f ; char line[LINELEN]; char *tmp; struct in_addr addr; struct in_addr client; struct in_addr cltemp; int len; if ((f=fopen(opts->server->authname,"r"))==NULL) { msg4(LOG_INFO,"Can't open authorization file %s (%s).", opts->server->authname,strerror(errno)) ; return 1 ; } inet_aton(opts->clientname, &client); while (fgets(line,LINELEN,f)!=NULL) { if((tmp=index(line, '/'))) { if(strlen(line)<=tmp-line) { msg4(LOG_CRIT, ERRMSG, line, opts->server->authname); return 0; } *(tmp++)=0; if(!inet_aton(line,&addr)) { msg4(LOG_CRIT, ERRMSG, line, opts->server->authname); return 0; } len=strtol(tmp, NULL, 0); addr.s_addr>>=32-len; addr.s_addr<<=32-len; memcpy(&cltemp,&client,sizeof(client)); cltemp.s_addr>>=32-len; cltemp.s_addr<<=32-len; if(addr.s_addr == cltemp.s_addr) { return 1; } } if (strncmp(line,opts->clientname,strlen(opts->clientname))==0) { fclose(f); return 1; } } fclose(f); return 0; }
C
nbd
0
CVE-2016-10208
https://www.cvedetails.com/cve/CVE-2016-10208/
CWE-125
https://github.com/torvalds/linux/commit/3a4b77cd47bb837b8557595ec7425f281f2ca1fe
3a4b77cd47bb837b8557595ec7425f281f2ca1fe
ext4: validate s_first_meta_bg at mount time Ralf Spenneberg reported that he hit a kernel crash when mounting a modified ext4 image. And it turns out that kernel crashed when calculating fs overhead (ext4_calculate_overhead()), this is because the image has very large s_first_meta_bg (debug code shows it's 842150400), and ext4 overruns the memory in count_overhead() when setting bitmap buffer, which is PAGE_SIZE. ext4_calculate_overhead(): buf = get_zeroed_page(GFP_NOFS); <=== PAGE_SIZE buffer blks = count_overhead(sb, i, buf); count_overhead(): for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) { <=== j = 842150400 ext4_set_bit(EXT4_B2C(sbi, s++), buf); <=== buffer overrun count++; } This can be reproduced easily for me by this script: #!/bin/bash rm -f fs.img mkdir -p /mnt/ext4 fallocate -l 16M fs.img mke2fs -t ext4 -O bigalloc,meta_bg,^resize_inode -F fs.img debugfs -w -R "ssv first_meta_bg 842150400" fs.img mount -o loop fs.img /mnt/ext4 Fix it by validating s_first_meta_bg first at mount time, and refusing to mount if its value exceeds the largest possible meta_bg number. Reported-by: Ralf Spenneberg <[email protected]> Signed-off-by: Eryu Guan <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]> Reviewed-by: Andreas Dilger <[email protected]>
void ext4_clear_inode(struct inode *inode) { invalidate_inode_buffers(inode); clear_inode(inode); dquot_drop(inode); ext4_discard_preallocations(inode); ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS); if (EXT4_I(inode)->jinode) { jbd2_journal_release_jbd_inode(EXT4_JOURNAL(inode), EXT4_I(inode)->jinode); jbd2_free_inode(EXT4_I(inode)->jinode); EXT4_I(inode)->jinode = NULL; } #ifdef CONFIG_EXT4_FS_ENCRYPTION fscrypt_put_encryption_info(inode, NULL); #endif }
void ext4_clear_inode(struct inode *inode) { invalidate_inode_buffers(inode); clear_inode(inode); dquot_drop(inode); ext4_discard_preallocations(inode); ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS); if (EXT4_I(inode)->jinode) { jbd2_journal_release_jbd_inode(EXT4_JOURNAL(inode), EXT4_I(inode)->jinode); jbd2_free_inode(EXT4_I(inode)->jinode); EXT4_I(inode)->jinode = NULL; } #ifdef CONFIG_EXT4_FS_ENCRYPTION fscrypt_put_encryption_info(inode, NULL); #endif }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/2bcaf4649c1d495072967ea454e8c16dce044705
2bcaf4649c1d495072967ea454e8c16dce044705
Don't interpret embeded NULLs in a response header line as a line terminator. BUG=95992 Review URL: http://codereview.chromium.org/7796025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100863 0039d316-1c4b-4281-b951-d872f2087c98
HttpUtil::NameValuePairsIterator::NameValuePairsIterator( string::const_iterator begin, string::const_iterator end, char delimiter) : props_(begin, end, delimiter), valid_(true), begin_(begin), end_(end), name_begin_(end), name_end_(end), value_begin_(end), value_end_(end), value_is_quoted_(false) { }
HttpUtil::NameValuePairsIterator::NameValuePairsIterator( string::const_iterator begin, string::const_iterator end, char delimiter) : props_(begin, end, delimiter), valid_(true), begin_(begin), end_(end), name_begin_(end), name_end_(end), value_begin_(end), value_end_(end), value_is_quoted_(false) { }
C
Chrome
0
CVE-2018-16077
https://www.cvedetails.com/cve/CVE-2018-16077/
CWE-285
https://github.com/chromium/chromium/commit/90f878780cce9c4b0475fcea14d91b8f510cce11
90f878780cce9c4b0475fcea14d91b8f510cce11
Prevent sandboxed documents from reusing the default window Bug: 377995 Change-Id: Iff66c6d214dfd0cb7ea9c80f83afeedfff703541 Reviewed-on: https://chromium-review.googlesource.com/983558 Commit-Queue: Andy Paicu <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/master@{#567663}
bool LocalFrame::CanNavigate(const Frame& target_frame, const KURL& destination_url) { String error_reason; const bool is_allowed_navigation = CanNavigateWithoutFramebusting(target_frame, error_reason); const bool sandboxed = GetSecurityContext()->GetSandboxFlags() != kSandboxNone; const bool has_user_gesture = HasBeenActivated(); if (target_frame != this && sandboxed && target_frame == Tree().Top()) { UseCounter::Count(this, WebFeature::kTopNavInSandbox); if (!has_user_gesture) { UseCounter::Count(this, WebFeature::kTopNavInSandboxWithoutGesture); } } if (target_frame != this && !GetSecurityContext()->IsSandboxed(kSandboxTopNavigation) && target_frame == Tree().Top()) { DEFINE_STATIC_LOCAL(EnumerationHistogram, framebust_histogram, ("WebCore.Framebust", 4)); const unsigned kUserGestureBit = 0x1; const unsigned kAllowedBit = 0x2; unsigned framebust_params = 0; if (has_user_gesture) framebust_params |= kUserGestureBit; UseCounter::Count(this, WebFeature::kTopNavigationFromSubFrame); if (sandboxed) { // Sandboxed with 'allow-top-navigation'. UseCounter::Count(this, WebFeature::kTopNavInSandboxWithPerm); if (!has_user_gesture) { UseCounter::Count(this, WebFeature::kTopNavInSandboxWithPermButNoGesture); } } if (is_allowed_navigation) framebust_params |= kAllowedBit; framebust_histogram.Count(framebust_params); if (has_user_gesture || is_allowed_navigation || target_frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess( SecurityOrigin::Create(destination_url).get())) { return true; } if (!RuntimeEnabledFeatures:: FramebustingNeedsSameOriginOrUserGestureEnabled() || Client()->GetContentSettingsClient().AllowPopupsAndRedirects( false /* default_value */)) { String target_frame_description = target_frame.IsLocalFrame() ? "with URL '" + ToLocalFrame(target_frame) .GetDocument() ->Url() .GetString() + "'" : "with origin '" + target_frame.GetSecurityContext() ->GetSecurityOrigin() ->ToString() + "'"; String message = "Frame with URL '" + GetDocument()->Url().GetString() + "' attempted to navigate its top-level window " + target_frame_description + ". Navigating the top-level window from a cross-origin " "iframe will soon require that the iframe has received " "a user gesture. See " "https://www.chromestatus.com/features/" "5851021045661696."; PrintNavigationWarning(message); return true; } error_reason = "The frame attempting navigation is targeting its top-level window, " "but is neither same-origin with its target nor has it received a " "user gesture. See " "https://www.chromestatus.com/features/5851021045661696."; PrintNavigationErrorMessage(target_frame, error_reason.Latin1().data()); Client()->DidBlockFramebust(destination_url); return false; } if (Client()->Opener() == target_frame && !HasTransientUserActivation(this, false /* checkIfMainThread */) && !target_frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess( SecurityOrigin::Create(destination_url).get())) { UseCounter::Count(this, WebFeature::kOpenerNavigationWithoutGesture); } if (!is_allowed_navigation && !error_reason.IsNull()) PrintNavigationErrorMessage(target_frame, error_reason.Latin1().data()); return is_allowed_navigation; }
bool LocalFrame::CanNavigate(const Frame& target_frame, const KURL& destination_url) { String error_reason; const bool is_allowed_navigation = CanNavigateWithoutFramebusting(target_frame, error_reason); const bool sandboxed = GetSecurityContext()->GetSandboxFlags() != kSandboxNone; const bool has_user_gesture = HasBeenActivated(); if (target_frame != this && sandboxed && target_frame == Tree().Top()) { UseCounter::Count(this, WebFeature::kTopNavInSandbox); if (!has_user_gesture) { UseCounter::Count(this, WebFeature::kTopNavInSandboxWithoutGesture); } } if (target_frame != this && !GetSecurityContext()->IsSandboxed(kSandboxTopNavigation) && target_frame == Tree().Top()) { DEFINE_STATIC_LOCAL(EnumerationHistogram, framebust_histogram, ("WebCore.Framebust", 4)); const unsigned kUserGestureBit = 0x1; const unsigned kAllowedBit = 0x2; unsigned framebust_params = 0; if (has_user_gesture) framebust_params |= kUserGestureBit; UseCounter::Count(this, WebFeature::kTopNavigationFromSubFrame); if (sandboxed) { // Sandboxed with 'allow-top-navigation'. UseCounter::Count(this, WebFeature::kTopNavInSandboxWithPerm); if (!has_user_gesture) { UseCounter::Count(this, WebFeature::kTopNavInSandboxWithPermButNoGesture); } } if (is_allowed_navigation) framebust_params |= kAllowedBit; framebust_histogram.Count(framebust_params); if (has_user_gesture || is_allowed_navigation || target_frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess( SecurityOrigin::Create(destination_url).get())) { return true; } if (!RuntimeEnabledFeatures:: FramebustingNeedsSameOriginOrUserGestureEnabled() || Client()->GetContentSettingsClient().AllowPopupsAndRedirects( false /* default_value */)) { String target_frame_description = target_frame.IsLocalFrame() ? "with URL '" + ToLocalFrame(target_frame) .GetDocument() ->Url() .GetString() + "'" : "with origin '" + target_frame.GetSecurityContext() ->GetSecurityOrigin() ->ToString() + "'"; String message = "Frame with URL '" + GetDocument()->Url().GetString() + "' attempted to navigate its top-level window " + target_frame_description + ". Navigating the top-level window from a cross-origin " "iframe will soon require that the iframe has received " "a user gesture. See " "https://www.chromestatus.com/features/" "5851021045661696."; PrintNavigationWarning(message); return true; } error_reason = "The frame attempting navigation is targeting its top-level window, " "but is neither same-origin with its target nor has it received a " "user gesture. See " "https://www.chromestatus.com/features/5851021045661696."; PrintNavigationErrorMessage(target_frame, error_reason.Latin1().data()); Client()->DidBlockFramebust(destination_url); return false; } if (Client()->Opener() == target_frame && !HasTransientUserActivation(this, false /* checkIfMainThread */) && !target_frame.GetSecurityContext()->GetSecurityOrigin()->CanAccess( SecurityOrigin::Create(destination_url).get())) { UseCounter::Count(this, WebFeature::kOpenerNavigationWithoutGesture); } if (!is_allowed_navigation && !error_reason.IsNull()) PrintNavigationErrorMessage(target_frame, error_reason.Latin1().data()); return is_allowed_navigation; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/be655fd4fb9ab3291a855a939496111674037a2f
be655fd4fb9ab3291a855a939496111674037a2f
Always use FrameNavigationDisabler during DocumentLoader detach. BUG=617495 Review-Url: https://codereview.chromium.org/2079473002 Cr-Commit-Position: refs/heads/master@{#400558}
void FrameLoader::setOpener(LocalFrame* opener) { if (client()) client()->setOpener(opener); }
void FrameLoader::setOpener(LocalFrame* opener) { if (client()) client()->setOpener(opener); }
C
Chrome
0
CVE-2017-6903
https://www.cvedetails.com/cve/CVE-2017-6903/
CWE-269
https://github.com/ioquake/ioq3/commit/376267d534476a875d8b9228149c4ee18b74a4fd
376267d534476a875d8b9228149c4ee18b74a4fd
Don't load .pk3s as .dlls, and don't load user config files from .pk3s.
void FS_ForceFlush( fileHandle_t f ) { FILE *file; file = FS_FileForHandle(f); setvbuf( file, NULL, _IONBF, 0 ); }
void FS_ForceFlush( fileHandle_t f ) { FILE *file; file = FS_FileForHandle(f); setvbuf( file, NULL, _IONBF, 0 ); }
C
OpenJK
0
CVE-2018-7998
https://www.cvedetails.com/cve/CVE-2018-7998/
CWE-362
https://github.com/jcupitt/libvips/commit/20d840e6da15c1574b3ed998bc92f91d1e36c2a5
20d840e6da15c1574b3ed998bc92f91d1e36c2a5
fix a crash with delayed load If a delayed load failed, it could leave the pipeline only half-set up. Sebsequent threads could then segv. Set a load-has-failed flag and test before generate. See https://github.com/jcupitt/libvips/issues/893
vips_foreign_save_dispose( GObject *gobject ) { VipsForeignSave *save = VIPS_FOREIGN_SAVE( gobject ); VIPS_UNREF( save->ready ); G_OBJECT_CLASS( vips_foreign_save_parent_class )->dispose( gobject ); }
vips_foreign_save_dispose( GObject *gobject ) { VipsForeignSave *save = VIPS_FOREIGN_SAVE( gobject ); VIPS_UNREF( save->ready ); G_OBJECT_CLASS( vips_foreign_save_parent_class )->dispose( gobject ); }
C
libvips
0
CVE-2011-2918
https://www.cvedetails.com/cve/CVE-2011-2918/
CWE-399
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <[email protected]> Cc: Michael Cree <[email protected]> Cc: Will Deacon <[email protected]> Cc: Deng-Cheng Zhu <[email protected]> Cc: Anton Blanchard <[email protected]> Cc: Eric B Munson <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mundt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jason Wessel <[email protected]> Cc: Don Zickus <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx) { }
static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx) { }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/d4cd2b2c0953ad7e9fa988c234eb9361be80fe81
d4cd2b2c0953ad7e9fa988c234eb9361be80fe81
DevTools: 'Overrides' UI overlay obstructs page and element inspector BUG=302862 [email protected] Review URL: https://codereview.chromium.org/40233006 git-svn-id: svn://svn.chromium.org/blink/trunk@160559 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void InspectorPageAgent::clearFrontend() { ErrorString error; disable(&error); updateTouchEventEmulationInPage(false); m_frontend = 0; }
void InspectorPageAgent::clearFrontend() { ErrorString error; disable(&error); updateTouchEventEmulationInPage(false); m_frontend = 0; }
C
Chrome
0
CVE-2016-1705
https://www.cvedetails.com/cve/CVE-2016-1705/
null
https://github.com/chromium/chromium/commit/4afb628e068367d5b73440537555902cd12416f8
4afb628e068367d5b73440537555902cd12416f8
gpu/android : Add support for partial swap with surface control. Add support for PostSubBuffer to GLSurfaceEGLSurfaceControl. This should allow the display compositor to draw the minimum sub-rect necessary from the damage tracking in BufferQueue on the client-side, and also to pass this damage rect to the framework. [email protected] Bug: 926020 Change-Id: I73d3320cab68250d4c6865bf21c5531682d8bf61 Reviewed-on: https://chromium-review.googlesource.com/c/1457467 Commit-Queue: Khushal <[email protected]> Commit-Queue: Antoine Labour <[email protected]> Reviewed-by: Antoine Labour <[email protected]> Auto-Submit: Khushal <[email protected]> Cr-Commit-Position: refs/heads/master@{#629852}
ui::ResourceManager& CompositorImpl::GetResourceManager() { return resource_manager_; }
ui::ResourceManager& CompositorImpl::GetResourceManager() { return resource_manager_; }
C
Chrome
0
CVE-2014-0203
https://www.cvedetails.com/cve/CVE-2014-0203/
CWE-20
https://github.com/torvalds/linux/commit/86acdca1b63e6890540fa19495cfc708beff3d8b
86acdca1b63e6890540fa19495cfc708beff3d8b
fix autofs/afs/etc. magic mountpoint breakage We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT) if /mnt/tmp is an autofs direct mount. The reason is that nd.last_type is bogus here; we want LAST_BIND for everything of that kind and we get LAST_NORM left over from finding parent directory. So make sure that it *is* set properly; set to LAST_BIND before doing ->follow_link() - for normal symlinks it will be changed by __vfs_follow_link() and everything else needs it set that way. Signed-off-by: Al Viro <[email protected]>
static int mounts_open_common(struct inode *inode, struct file *file, const struct seq_operations *op) { struct task_struct *task = get_proc_task(inode); struct nsproxy *nsp; struct mnt_namespace *ns = NULL; struct path root; struct proc_mounts *p; int ret = -EINVAL; if (task) { rcu_read_lock(); nsp = task_nsproxy(task); if (nsp) { ns = nsp->mnt_ns; if (ns) get_mnt_ns(ns); } rcu_read_unlock(); if (ns && get_fs_path(task, &root, 1) == 0) ret = 0; put_task_struct(task); } if (!ns) goto err; if (ret) goto err_put_ns; ret = -ENOMEM; p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL); if (!p) goto err_put_path; file->private_data = &p->m; ret = seq_open(file, op); if (ret) goto err_free; p->m.private = p; p->ns = ns; p->root = root; p->event = ns->event; return 0; err_free: kfree(p); err_put_path: path_put(&root); err_put_ns: put_mnt_ns(ns); err: return ret; }
static int mounts_open_common(struct inode *inode, struct file *file, const struct seq_operations *op) { struct task_struct *task = get_proc_task(inode); struct nsproxy *nsp; struct mnt_namespace *ns = NULL; struct path root; struct proc_mounts *p; int ret = -EINVAL; if (task) { rcu_read_lock(); nsp = task_nsproxy(task); if (nsp) { ns = nsp->mnt_ns; if (ns) get_mnt_ns(ns); } rcu_read_unlock(); if (ns && get_fs_path(task, &root, 1) == 0) ret = 0; put_task_struct(task); } if (!ns) goto err; if (ret) goto err_put_ns; ret = -ENOMEM; p = kmalloc(sizeof(struct proc_mounts), GFP_KERNEL); if (!p) goto err_put_path; file->private_data = &p->m; ret = seq_open(file, op); if (ret) goto err_free; p->m.private = p; p->ns = ns; p->root = root; p->event = ns->event; return 0; err_free: kfree(p); err_put_path: path_put(&root); err_put_ns: put_mnt_ns(ns); err: return ret; }
C
linux
0
CVE-2015-1281
https://www.cvedetails.com/cve/CVE-2015-1281/
CWE-254
https://github.com/chromium/chromium/commit/dff368031150a1033a1a3c913f8857679a0279be
dff368031150a1033a1a3c913f8857679a0279be
Correctly keep track of isolates for microtask execution BUG=487155 [email protected] Review URL: https://codereview.chromium.org/1161823002 git-svn-id: svn://svn.chromium.org/blink/trunk@195985 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static WeakDocumentSet& liveDocumentSet() { DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrWillBeNoop(new WeakDocumentSet()))); return *set; }
static WeakDocumentSet& liveDocumentSet() { DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WeakDocumentSet>, set, (adoptPtrWillBeNoop(new WeakDocumentSet()))); return *set; }
C
Chrome
0
CVE-2012-1179
https://www.cvedetails.com/cve/CVE-2012-1179/
CWE-264
https://github.com/torvalds/linux/commit/4a1d704194a441bf83c636004a479e01360ec850
4a1d704194a441bf83c636004a479e01360ec850
mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream. In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans huge. It's not khugepaged causing the problem, khugepaged holds the mmap_sem in write mode (and all those sites must hold the mmap_sem in read mode to prevent pagetables to go away from under them, during code review it seems vm86 mode on 32bit kernels requires that too unless it's restricted to 1 thread per process or UP builds). The race is only with the huge pagefaults that can convert a pmd_none() into a pmd_trans_huge(). Effectively all these pmd_none_or_clear_bad() sites running with mmap_sem in read mode are somewhat speculative with the page faults, and the result is always undefined when they run simultaneously. This is probably why it wasn't common to run into this. For example if the madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page fault, the hugepage will not be zapped, if the page fault runs first it will be zapped. Altering pmd_bad() not to error out if it finds hugepmds won't be enough to fix this, because zap_pmd_range would then proceed to call zap_pte_range (which would be incorrect if the pmd become a pmd_trans_huge()). The simplest way to fix this is to read the pmd in the local stack (regardless of what we read, no need of actual CPU barriers, only compiler barrier needed), and be sure it is not changing under the code that computes its value. Even if the real pmd is changing under the value we hold on the stack, we don't care. If we actually end up in zap_pte_range it means the pmd was not none already and it was not huge, and it can't become huge from under us (khugepaged locking explained above). All we need is to enforce that there is no way anymore that in a code path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad can run into a hugepmd. The overhead of a barrier() is just a compiler tweak and should not be measurable (I only added it for THP builds). I don't exclude different compiler versions may have prevented the race too by caching the value of *pmd on the stack (that hasn't been verified, but it wouldn't be impossible considering pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines and there's no external function called in between pmd_trans_huge and pmd_none_or_clear_bad). if (pmd_trans_huge(*pmd)) { if (next-addr != HPAGE_PMD_SIZE) { VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); split_huge_page_pmd(vma->vm_mm, pmd); } else if (zap_huge_pmd(tlb, vma, pmd, addr)) continue; /* fall through */ } if (pmd_none_or_clear_bad(pmd)) Because this race condition could be exercised without special privileges this was reported in CVE-2012-1179. The race was identified and fully explained by Ulrich who debugged it. I'm quoting his accurate explanation below, for reference. ====== start quote ======= mapcount 0 page_mapcount 1 kernel BUG at mm/huge_memory.c:1384! At some point prior to the panic, a "bad pmd ..." message similar to the following is logged on the console: mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7). The "bad pmd ..." message is logged by pmd_clear_bad() before it clears the page's PMD table entry. 143 void pmd_clear_bad(pmd_t *pmd) 144 { -> 145 pmd_ERROR(*pmd); 146 pmd_clear(pmd); 147 } After the PMD table entry has been cleared, there is an inconsistency between the actual number of PMD table entries that are mapping the page and the page's map count (_mapcount field in struct page). When the page is subsequently reclaimed, __split_huge_page() detects this inconsistency. 1381 if (mapcount != page_mapcount(page)) 1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n", 1383 mapcount, page_mapcount(page)); -> 1384 BUG_ON(mapcount != page_mapcount(page)); The root cause of the problem is a race of two threads in a multithreaded process. Thread B incurs a page fault on a virtual address that has never been accessed (PMD entry is zero) while Thread A is executing an madvise() system call on a virtual address within the same 2 MB (huge page) range. virtual address space .---------------------. | | | | .-|---------------------| | | | | | |<-- B(fault) | | | 2 MB | |/////////////////////|-. huge < |/////////////////////| > A(range) page | |/////////////////////|-' | | | | | | '-|---------------------| | | | | '---------------------' - Thread A is executing an madvise(..., MADV_DONTNEED) system call on the virtual address range "A(range)" shown in the picture. sys_madvise // Acquire the semaphore in shared mode. down_read(&current->mm->mmap_sem) ... madvise_vma switch (behavior) case MADV_DONTNEED: madvise_dontneed zap_page_range unmap_vmas unmap_page_range zap_pud_range zap_pmd_range // // Assume that this huge page has never been accessed. // I.e. content of the PMD entry is zero (not mapped). // if (pmd_trans_huge(*pmd)) { // We don't get here due to the above assumption. } // // Assume that Thread B incurred a page fault and .---------> // sneaks in here as shown below. | // | if (pmd_none_or_clear_bad(pmd)) | { | if (unlikely(pmd_bad(*pmd))) | pmd_clear_bad | { | pmd_ERROR | // Log "bad pmd ..." message here. | pmd_clear | // Clear the page's PMD entry. | // Thread B incremented the map count | // in page_add_new_anon_rmap(), but | // now the page is no longer mapped | // by a PMD entry (-> inconsistency). | } | } | v - Thread B is handling a page fault on virtual address "B(fault)" shown in the picture. ... do_page_fault __do_page_fault // Acquire the semaphore in shared mode. down_read_trylock(&mm->mmap_sem) ... handle_mm_fault if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) // We get here due to the above assumption (PMD entry is zero). do_huge_pmd_anonymous_page alloc_hugepage_vma // Allocate a new transparent huge page here. ... __do_huge_pmd_anonymous_page ... spin_lock(&mm->page_table_lock) ... page_add_new_anon_rmap // Here we increment the page's map count (starts at -1). atomic_set(&page->_mapcount, 0) set_pmd_at // Here we set the page's PMD entry which will be cleared // when Thread A calls pmd_clear_bad(). ... spin_unlock(&mm->page_table_lock) The mmap_sem does not prevent the race because both threads are acquiring it in shared mode (down_read). Thread B holds the page_table_lock while the page's map count and PMD table entry are updated. However, Thread A does not synchronize on that lock. ====== end quote ======= [[email protected]: checkpatch fixes] Reported-by: Ulrich Obergfell <[email protected]> Signed-off-by: Andrea Arcangeli <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Dave Jones <[email protected]> Acked-by: Larry Woodman <[email protected]> Acked-by: Rik van Riel <[email protected]> Cc: Mark Salter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
bool mem_cgroup_reclaimable(struct mem_cgroup *memcg, bool noswap) { return test_mem_cgroup_node_reclaimable(memcg, 0, noswap); }
bool mem_cgroup_reclaimable(struct mem_cgroup *memcg, bool noswap) { return test_mem_cgroup_node_reclaimable(memcg, 0, noswap); }
C
linux
0
CVE-2015-7515
https://www.cvedetails.com/cve/CVE-2015-7515/
null
https://github.com/torvalds/linux/commit/8e20cf2bce122ce9262d6034ee5d5b76fbb92f96
8e20cf2bce122ce9262d6034ee5d5b76fbb92f96
Input: aiptek - fix crash on detecting device without endpoints The aiptek driver crashes in aiptek_probe() when a specially crafted USB device without endpoints is detected. This fix adds a check that the device has proper configuration expected by the driver. Also an error return value is changed to more matching one in one of the error paths. Reported-by: Ralf Spenneberg <[email protected]> Signed-off-by: Vladis Dronov <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
store_tabletPointerMode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aiptek *aiptek = dev_get_drvdata(dev); int new_mode = map_str_to_val(pointer_mode_map, buf, count); if (new_mode == AIPTEK_INVALID_VALUE) return -EINVAL; aiptek->newSetting.pointerMode = new_mode; return count; }
store_tabletPointerMode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aiptek *aiptek = dev_get_drvdata(dev); int new_mode = map_str_to_val(pointer_mode_map, buf, count); if (new_mode == AIPTEK_INVALID_VALUE) return -EINVAL; aiptek->newSetting.pointerMode = new_mode; return count; }
C
linux
0
CVE-2014-9888
https://www.cvedetails.com/cve/CVE-2014-9888/
CWE-264
https://github.com/torvalds/linux/commit/0ea1ec713f04bdfac343c9702b21cd3a7c711826
0ea1ec713f04bdfac343c9702b21cd3a7c711826
ARM: dma-mapping: don't allow DMA mappings to be marked executable DMA mapping permissions were being derived from pgprot_kernel directly without using PAGE_KERNEL. This causes them to be marked with executable permission, which is not what we want. Fix this. Signed-off-by: Russell King <[email protected]>
static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, size_t size) { unsigned int order = get_order(size); unsigned int align = 0; unsigned int count, start; unsigned long flags; if (order > CONFIG_ARM_DMA_IOMMU_ALIGNMENT) order = CONFIG_ARM_DMA_IOMMU_ALIGNMENT; count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order; if (order > mapping->order) align = (1 << (order - mapping->order)) - 1; spin_lock_irqsave(&mapping->lock, flags); start = bitmap_find_next_zero_area(mapping->bitmap, mapping->bits, 0, count, align); if (start > mapping->bits) { spin_unlock_irqrestore(&mapping->lock, flags); return DMA_ERROR_CODE; } bitmap_set(mapping->bitmap, start, count); spin_unlock_irqrestore(&mapping->lock, flags); return mapping->base + (start << (mapping->order + PAGE_SHIFT)); }
static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, size_t size) { unsigned int order = get_order(size); unsigned int align = 0; unsigned int count, start; unsigned long flags; if (order > CONFIG_ARM_DMA_IOMMU_ALIGNMENT) order = CONFIG_ARM_DMA_IOMMU_ALIGNMENT; count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order; if (order > mapping->order) align = (1 << (order - mapping->order)) - 1; spin_lock_irqsave(&mapping->lock, flags); start = bitmap_find_next_zero_area(mapping->bitmap, mapping->bits, 0, count, align); if (start > mapping->bits) { spin_unlock_irqrestore(&mapping->lock, flags); return DMA_ERROR_CODE; } bitmap_set(mapping->bitmap, start, count); spin_unlock_irqrestore(&mapping->lock, flags); return mapping->base + (start << (mapping->order + PAGE_SHIFT)); }
C
linux
0
CVE-2018-9498
https://www.cvedetails.com/cve/CVE-2018-9498/
CWE-787
https://android.googlesource.com/platform/external/skia/+/77c955200ddd1761d6ed7a6c1578349fedbb55e4
77c955200ddd1761d6ed7a6c1578349fedbb55e4
RESTRICT AUTOMERGE: Cherry-pick "begin cleanup of malloc porting layer" Bug: 78354855 Test: Not feasible Original description: ======================================================================== 1. Merge some of the allocators into sk_malloc_flags by redefining a flag to mean zero-init 2. Add more private helpers to simplify our call-sites (and handle some overflow mul checks) 3. The 2-param helpers rely on the saturating SkSafeMath::Mul to pass max_size_t as the request, which should always fail. chromium: 508641 Reviewed-on: https://skia-review.googlesource.com/90940 Commit-Queue: Mike Reed <[email protected]> Reviewed-by: Robert Phillips <[email protected]> Reviewed-by: Stephan Altmueller <[email protected]> ======================================================================== Conflicts: - include/private/SkMalloc.h Simply removed the old definitions of SK_MALLOC_TEMP and SK_MALLOC_THROW. - public.bzl Copied SK_SUPPORT_LEGACY_MALLOC_PORTING_LAYER into the old defines. - src/codec/SkIcoCodec.cpp Drop a change where we were not using malloc yet. - src/codec/SkBmpBaseCodec.cpp - src/core/SkBitmapCache.cpp These files weren't yet using malloc (and SkBmpBaseCodec hadn't been factored out). - src/core/SkMallocPixelRef.cpp These were still using New rather than Make (return raw pointer). Leave them unchanged, as sk_malloc_flags is still valid. - src/lazy/SkDiscardableMemoryPool.cpp Leave this unchanged; sk_malloc_flags is still valid In addition, pull in SkSafeMath.h, which was originally introduced in https://skia-review.googlesource.com/c/skia/+/33721. This is required for the new sk_malloc calls. Also pull in SkSafeMath::Add and SkSafeMath::Mul, introduced in https://skia-review.googlesource.com/88581 Also add SK_MaxSizeT, which the above depends on, introduced in https://skia-review.googlesource.com/57084 Also, modify NewFromStream to use sk_malloc_canfail, matching pi and avoiding a build break Change-Id: Ib320484673a865460fc1efb900f611209e088edb (cherry picked from commit a12cc3e14ea6734c7efe76aa6a19239909830b28)
int SkIcoCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { SkASSERT(fCurrScanlineCodec); return fCurrScanlineCodec->getScanlines(dst, count, rowBytes); }
int SkIcoCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { SkASSERT(fCurrScanlineCodec); return fCurrScanlineCodec->getScanlines(dst, count, rowBytes); }
C
Android
0
CVE-2017-6903
https://www.cvedetails.com/cve/CVE-2017-6903/
CWE-269
https://github.com/ioquake/ioq3/commit/376267d534476a875d8b9228149c4ee18b74a4fd
376267d534476a875d8b9228149c4ee18b74a4fd
Don't load .pk3s as .dlls, and don't load user config files from .pk3s.
void CL_ReferencedPK3List_f( void ) { Com_Printf("Referenced PK3 Names: %s\n", FS_ReferencedPakNames()); }
void CL_ReferencedPK3List_f( void ) { Com_Printf("Referenced PK3 Names: %s\n", FS_ReferencedPakNames()); }
C
OpenJK
0
CVE-2016-6187
https://www.cvedetails.com/cve/CVE-2016-6187/
CWE-119
https://github.com/torvalds/linux/commit/30a46a4647fd1df9cf52e43bf467f0d9265096ca
30a46a4647fd1df9cf52e43bf467f0d9265096ca
apparmor: fix oops, validate buffer size in apparmor_setprocattr() When proc_pid_attr_write() was changed to use memdup_user apparmor's (interface violating) assumption that the setprocattr buffer was always a single page was violated. The size test is not strictly speaking needed as proc_pid_attr_write() will reject anything larger, but for the sake of robustness we can keep it in. SMACK and SELinux look safe to me, but somebody else should probably have a look just in case. Based on original patch from Vegard Nossum <[email protected]> modified for the case that apparmor provides null termination. Fixes: bb646cdb12e75d82258c2f2e7746d5952d3e321a Reported-by: Vegard Nossum <[email protected]> Cc: Al Viro <[email protected]> Cc: John Johansen <[email protected]> Cc: Paul Moore <[email protected]> Cc: Stephen Smalley <[email protected]> Cc: Eric Paris <[email protected]> Cc: Casey Schaufler <[email protected]> Cc: [email protected] Signed-off-by: John Johansen <[email protected]> Reviewed-by: Tyler Hicks <[email protected]> Signed-off-by: James Morris <[email protected]>
static int apparmor_setprocattr(struct task_struct *task, char *name, void *value, size_t size) { struct common_audit_data sa; struct apparmor_audit_data aad = {0,}; char *command, *largs = NULL, *args = value; size_t arg_size; int error; if (size == 0) return -EINVAL; /* task can only write its own attributes */ if (current != task) return -EACCES; /* AppArmor requires that the buffer must be null terminated atm */ if (args[size - 1] != '\0') { /* null terminate */ largs = args = kmalloc(size + 1, GFP_KERNEL); if (!args) return -ENOMEM; memcpy(args, value, size); args[size] = '\0'; } error = -EINVAL; args = strim(args); command = strsep(&args, " "); if (!args) goto out; args = skip_spaces(args); if (!*args) goto out; arg_size = size - (args - (char *) value); if (strcmp(name, "current") == 0) { if (strcmp(command, "changehat") == 0) { error = aa_setprocattr_changehat(args, arg_size, !AA_DO_TEST); } else if (strcmp(command, "permhat") == 0) { error = aa_setprocattr_changehat(args, arg_size, AA_DO_TEST); } else if (strcmp(command, "changeprofile") == 0) { error = aa_setprocattr_changeprofile(args, !AA_ONEXEC, !AA_DO_TEST); } else if (strcmp(command, "permprofile") == 0) { error = aa_setprocattr_changeprofile(args, !AA_ONEXEC, AA_DO_TEST); } else goto fail; } else if (strcmp(name, "exec") == 0) { if (strcmp(command, "exec") == 0) error = aa_setprocattr_changeprofile(args, AA_ONEXEC, !AA_DO_TEST); else goto fail; } else /* only support the "current" and "exec" process attributes */ goto fail; if (!error) error = size; out: kfree(largs); return error; fail: sa.type = LSM_AUDIT_DATA_NONE; sa.aad = &aad; aad.profile = aa_current_profile(); aad.op = OP_SETPROCATTR; aad.info = name; aad.error = error = -EINVAL; aa_audit_msg(AUDIT_APPARMOR_DENIED, &sa, NULL); goto out; }
static int apparmor_setprocattr(struct task_struct *task, char *name, void *value, size_t size) { struct common_audit_data sa; struct apparmor_audit_data aad = {0,}; char *command, *args = value; size_t arg_size; int error; if (size == 0) return -EINVAL; /* args points to a PAGE_SIZE buffer, AppArmor requires that * the buffer must be null terminated or have size <= PAGE_SIZE -1 * so that AppArmor can null terminate them */ if (args[size - 1] != '\0') { if (size == PAGE_SIZE) return -EINVAL; args[size] = '\0'; } /* task can only write its own attributes */ if (current != task) return -EACCES; args = value; args = strim(args); command = strsep(&args, " "); if (!args) return -EINVAL; args = skip_spaces(args); if (!*args) return -EINVAL; arg_size = size - (args - (char *) value); if (strcmp(name, "current") == 0) { if (strcmp(command, "changehat") == 0) { error = aa_setprocattr_changehat(args, arg_size, !AA_DO_TEST); } else if (strcmp(command, "permhat") == 0) { error = aa_setprocattr_changehat(args, arg_size, AA_DO_TEST); } else if (strcmp(command, "changeprofile") == 0) { error = aa_setprocattr_changeprofile(args, !AA_ONEXEC, !AA_DO_TEST); } else if (strcmp(command, "permprofile") == 0) { error = aa_setprocattr_changeprofile(args, !AA_ONEXEC, AA_DO_TEST); } else goto fail; } else if (strcmp(name, "exec") == 0) { if (strcmp(command, "exec") == 0) error = aa_setprocattr_changeprofile(args, AA_ONEXEC, !AA_DO_TEST); else goto fail; } else /* only support the "current" and "exec" process attributes */ return -EINVAL; if (!error) error = size; return error; fail: sa.type = LSM_AUDIT_DATA_NONE; sa.aad = &aad; aad.profile = aa_current_profile(); aad.op = OP_SETPROCATTR; aad.info = name; aad.error = -EINVAL; aa_audit_msg(AUDIT_APPARMOR_DENIED, &sa, NULL); return -EINVAL; }
C
linux
1
CVE-2016-2494
https://www.cvedetails.com/cve/CVE-2016-2494/
CWE-264
https://android.googlesource.com/platform/system/core/+/864e2e22fcd0cba3f5e67680ccabd0302dfda45d
864e2e22fcd0cba3f5e67680ccabd0302dfda45d
Fix overflow in path building An incorrect size was causing an unsigned value to wrap, causing it to write past the end of the buffer. Bug: 28085658 Change-Id: Ie9625c729cca024d514ba2880ff97209d435a165
static int handle_init(struct fuse* fuse, struct fuse_handler* handler, const struct fuse_in_header* hdr, const struct fuse_init_in* req) { struct fuse_init_out out; size_t fuse_struct_size; TRACE("[%d] INIT ver=%d.%d maxread=%d flags=%x\n", handler->token, req->major, req->minor, req->max_readahead, req->flags); /* Kernel 2.6.16 is the first stable kernel with struct fuse_init_out * defined (fuse version 7.6). The structure is the same from 7.6 through * 7.22. Beginning with 7.23, the structure increased in size and added * new parameters. */ if (req->major != FUSE_KERNEL_VERSION || req->minor < 6) { ERROR("Fuse kernel version mismatch: Kernel version %d.%d, Expected at least %d.6", req->major, req->minor, FUSE_KERNEL_VERSION); return -1; } /* We limit ourselves to 15 because we don't handle BATCH_FORGET yet */ out.minor = MIN(req->minor, 15); fuse_struct_size = sizeof(out); #if defined(FUSE_COMPAT_22_INIT_OUT_SIZE) /* FUSE_KERNEL_VERSION >= 23. */ /* If the kernel only works on minor revs older than or equal to 22, * then use the older structure size since this code only uses the 7.22 * version of the structure. */ if (req->minor <= 22) { fuse_struct_size = FUSE_COMPAT_22_INIT_OUT_SIZE; } #endif out.major = FUSE_KERNEL_VERSION; out.max_readahead = req->max_readahead; out.flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES; out.max_background = 32; out.congestion_threshold = 32; out.max_write = MAX_WRITE; fuse_reply(fuse, hdr->unique, &out, fuse_struct_size); return NO_STATUS; }
static int handle_init(struct fuse* fuse, struct fuse_handler* handler, const struct fuse_in_header* hdr, const struct fuse_init_in* req) { struct fuse_init_out out; size_t fuse_struct_size; TRACE("[%d] INIT ver=%d.%d maxread=%d flags=%x\n", handler->token, req->major, req->minor, req->max_readahead, req->flags); /* Kernel 2.6.16 is the first stable kernel with struct fuse_init_out * defined (fuse version 7.6). The structure is the same from 7.6 through * 7.22. Beginning with 7.23, the structure increased in size and added * new parameters. */ if (req->major != FUSE_KERNEL_VERSION || req->minor < 6) { ERROR("Fuse kernel version mismatch: Kernel version %d.%d, Expected at least %d.6", req->major, req->minor, FUSE_KERNEL_VERSION); return -1; } /* We limit ourselves to 15 because we don't handle BATCH_FORGET yet */ out.minor = MIN(req->minor, 15); fuse_struct_size = sizeof(out); #if defined(FUSE_COMPAT_22_INIT_OUT_SIZE) /* FUSE_KERNEL_VERSION >= 23. */ /* If the kernel only works on minor revs older than or equal to 22, * then use the older structure size since this code only uses the 7.22 * version of the structure. */ if (req->minor <= 22) { fuse_struct_size = FUSE_COMPAT_22_INIT_OUT_SIZE; } #endif out.major = FUSE_KERNEL_VERSION; out.max_readahead = req->max_readahead; out.flags = FUSE_ATOMIC_O_TRUNC | FUSE_BIG_WRITES; out.max_background = 32; out.congestion_threshold = 32; out.max_write = MAX_WRITE; fuse_reply(fuse, hdr->unique, &out, fuse_struct_size); return NO_STATUS; }
C
Android
0
CVE-2015-1285
https://www.cvedetails.com/cve/CVE-2015-1285/
CWE-200
https://github.com/chromium/chromium/commit/39595f8d4dffcb644d438106dcb64a30c139ff0e
39595f8d4dffcb644d438106dcb64a30c139ff0e
[reland] Do not set default wallpaper unless it should do so. [email protected], [email protected] Bug: 751382 Change-Id: Id0793dfe467f737526a95b1e66ed01fbb8860bda Reviewed-on: https://chromium-review.googlesource.com/619754 Commit-Queue: Xiaoqian Dai <[email protected]> Reviewed-by: Alexander Alekseev <[email protected]> Reviewed-by: Biao She <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#498325} Reviewed-on: https://chromium-review.googlesource.com/646430 Cr-Commit-Position: refs/heads/master@{#498982}
void WallpaperManagerBase::TestApi::SetWallpaperCache( const AccountId& account_id, const base::FilePath& path, const gfx::ImageSkia& image) { DCHECK(!image.isNull()); wallpaper_manager_->wallpaper_cache_[account_id] = CustomWallpaperElement(path, image); }
void WallpaperManagerBase::TestApi::SetWallpaperCache( const AccountId& account_id, const base::FilePath& path, const gfx::ImageSkia& image) { DCHECK(!image.isNull()); wallpaper_manager_->wallpaper_cache_[account_id] = CustomWallpaperElement(path, image); }
C
Chrome
0
CVE-2015-1867
https://www.cvedetails.com/cve/CVE-2015-1867/
CWE-264
https://github.com/ClusterLabs/pacemaker/commit/84ac07c
84ac07c
Fix: acl: Do not delay evaluation of added nodes in some situations It is not appropriate when the node has no children as it is not a placeholder
save_xml_to_file(xmlNode * xml, const char *desc, const char *filename) { char *f = NULL; if (filename == NULL) { char *uuid = crm_generate_uuid(); f = crm_strdup_printf("/tmp/%s", uuid); filename = f; free(uuid); } crm_info("Saving %s to %s", desc, filename); write_xml_file(xml, filename, FALSE); free(f); }
save_xml_to_file(xmlNode * xml, const char *desc, const char *filename) { char *f = NULL; if (filename == NULL) { char *uuid = crm_generate_uuid(); f = crm_strdup_printf("/tmp/%s", uuid); filename = f; free(uuid); } crm_info("Saving %s to %s", desc, filename); write_xml_file(xml, filename, FALSE); free(f); }
C
pacemaker
0
null
null
null
https://github.com/chromium/chromium/commit/dc3857aac17be72c96f28d860d875235b3be349a
dc3857aac17be72c96f28d860d875235b3be349a
Unreviewed, rolling out r142736. http://trac.webkit.org/changeset/142736 https://bugs.webkit.org/show_bug.cgi?id=109716 Broke ABI, nightly builds crash on launch (Requested by ap on #webkit). Patch by Sheriff Bot <[email protected]> on 2013-02-13 Source/WebKit2: * Shared/APIClientTraits.cpp: (WebKit): * Shared/APIClientTraits.h: * UIProcess/API/C/WKPage.h: * UIProcess/API/gtk/WebKitLoaderClient.cpp: (attachLoaderClientToView): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/qt/QtBuiltinBundlePage.cpp: (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage): Tools: * MiniBrowser/mac/WK2BrowserWindowController.m: (-[WK2BrowserWindowController awakeFromNib]): * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::InjectedBundlePage): * WebKitTestRunner/TestController.cpp: (WTR::TestController::createWebViewWithOptions): git-svn-id: svn://svn.chromium.org/blink/trunk@142762 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool InjectedBundlePage::shouldEndEditing(WKBundleRangeHandleRef range) { if (!InjectedBundle::shared().isTestRunning()) return true; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { StringBuilder stringBuilder; stringBuilder.appendLiteral("EDITING DELEGATE: shouldEndEditingInDOMRange:"); stringBuilder.append(rangeToStr(m_page, m_world.get(), range)); stringBuilder.append('\n'); InjectedBundle::shared().outputText(stringBuilder.toString()); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); }
bool InjectedBundlePage::shouldEndEditing(WKBundleRangeHandleRef range) { if (!InjectedBundle::shared().isTestRunning()) return true; if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) { StringBuilder stringBuilder; stringBuilder.appendLiteral("EDITING DELEGATE: shouldEndEditingInDOMRange:"); stringBuilder.append(rangeToStr(m_page, m_world.get(), range)); stringBuilder.append('\n'); InjectedBundle::shared().outputText(stringBuilder.toString()); } return InjectedBundle::shared().testRunner()->shouldAllowEditing(); }
C
Chrome
0
CVE-2010-1149
https://www.cvedetails.com/cve/CVE-2010-1149/
CWE-200
https://cgit.freedesktop.org/udisks/commit/?id=0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4
0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4
null
device_luks_unlock (Device *device, const char *secret, char **options, DBusGMethodInvocation *context) { if (device->priv->id_usage == NULL || strcmp (device->priv->id_usage, "crypto") != 0) { throw_error (context, ERROR_FAILED, "Not a LUKS device"); goto out; } daemon_local_check_auth (device->priv->daemon, device, "org.freedesktop.udisks.luks-unlock", "LuksUnlock", TRUE, device_luks_unlock_authorized_cb, context, 2, g_strdup (secret), g_free, g_strdupv (options), g_strfreev); out: return TRUE; }
device_luks_unlock (Device *device, const char *secret, char **options, DBusGMethodInvocation *context) { if (device->priv->id_usage == NULL || strcmp (device->priv->id_usage, "crypto") != 0) { throw_error (context, ERROR_FAILED, "Not a LUKS device"); goto out; } daemon_local_check_auth (device->priv->daemon, device, "org.freedesktop.udisks.luks-unlock", "LuksUnlock", TRUE, device_luks_unlock_authorized_cb, context, 2, g_strdup (secret), g_free, g_strdupv (options), g_strfreev); out: return TRUE; }
C
udisks
0
CVE-2012-2896
https://www.cvedetails.com/cve/CVE-2012-2896/
CWE-189
https://github.com/chromium/chromium/commit/3aad1a37affb1ab70d1897f2b03eb8c077264984
3aad1a37affb1ab70d1897f2b03eb8c077264984
Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98
static inline GLenum GetTexInternalFormat(GLenum internal_format) { if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { if (internal_format == GL_BGRA_EXT || internal_format == GL_BGRA8_EXT) return GL_RGBA8; } return internal_format; }
static inline GLenum GetTexInternalFormat(GLenum internal_format) { if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { if (internal_format == GL_BGRA_EXT || internal_format == GL_BGRA8_EXT) return GL_RGBA8; } return internal_format; }
C
Chrome
0
CVE-2013-7281
https://www.cvedetails.com/cve/CVE-2013-7281/
CWE-200
https://github.com/torvalds/linux/commit/bceaa90240b6019ed73b49965eac7d167610be69
bceaa90240b6019ed73b49965eac7d167610be69
inet: prevent leakage of uninitialized memory to user in recv syscalls Only update *addr_len when we actually fill in sockaddr, otherwise we can return uninitialized memory from the stack to the caller in the recvfrom, recvmmsg and recvmsg syscalls. Drop the the (addr_len == NULL) checks because we only get called with a valid addr_len pointer either from sock_common_recvmsg or inet_recvmsg. If a blocking read waits on a socket which is concurrently shut down we now return zero and set msg_msgnamelen to 0. Reported-by: mpb <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static unsigned int udp_ehashfn(struct net *net, const __be32 laddr, const __u16 lport, const __be32 faddr, const __be16 fport) { static u32 udp_ehash_secret __read_mostly; net_get_random_once(&udp_ehash_secret, sizeof(udp_ehash_secret)); return __inet_ehashfn(laddr, lport, faddr, fport, udp_ehash_secret + net_hash_mix(net)); }
static unsigned int udp_ehashfn(struct net *net, const __be32 laddr, const __u16 lport, const __be32 faddr, const __be16 fport) { static u32 udp_ehash_secret __read_mostly; net_get_random_once(&udp_ehash_secret, sizeof(udp_ehash_secret)); return __inet_ehashfn(laddr, lport, faddr, fport, udp_ehash_secret + net_hash_mix(net)); }
C
linux
0
CVE-2017-9374
https://www.cvedetails.com/cve/CVE-2017-9374/
CWE-772
https://git.qemu.org/?p=qemu.git;a=commit;h=d710e1e7bd3d5bfc26b631f02ae87901ebe646b0
d710e1e7bd3d5bfc26b631f02ae87901ebe646b0
null
static int ehci_cancel_queue(EHCIQueue *q) { EHCIPacket *p; int packets = 0; p = QTAILQ_FIRST(&q->packets); if (p == NULL) { goto leave; } trace_usb_ehci_queue_action(q, "cancel"); do { ehci_free_packet(p); packets++; } while ((p = QTAILQ_FIRST(&q->packets)) != NULL); leave: ehci_queue_stopped(q); return packets; }
static int ehci_cancel_queue(EHCIQueue *q) { EHCIPacket *p; int packets = 0; p = QTAILQ_FIRST(&q->packets); if (p == NULL) { goto leave; } trace_usb_ehci_queue_action(q, "cancel"); do { ehci_free_packet(p); packets++; } while ((p = QTAILQ_FIRST(&q->packets)) != NULL); leave: ehci_queue_stopped(q); return packets; }
C
qemu
0
CVE-2016-7798
https://www.cvedetails.com/cve/CVE-2016-7798/
CWE-310
https://github.com/ruby/openssl/commit/8108e0a6db133f3375608303fdd2083eb5115062
8108e0a6db133f3375608303fdd2083eb5115062
cipher: don't set dummy encryption key in Cipher#initialize Remove the encryption key initialization from Cipher#initialize. This is effectively a revert of r32723 ("Avoid possible SEGV from AES encryption/decryption", 2011-07-28). r32723, which added the key initialization, was a workaround for Ruby Bug #2768. For some certain ciphers, calling EVP_CipherUpdate() before setting an encryption key caused segfault. It was not a problem until OpenSSL implemented GCM mode - the encryption key could be overridden by repeated calls of EVP_CipherInit_ex(). But, it is not the case for AES-GCM ciphers. Setting a key, an IV, a key, in this order causes the IV to be reset to an all-zero IV. The problem of Bug #2768 persists on the current versions of OpenSSL. So, make Cipher#update raise an exception if a key is not yet set by the user. Since encrypting or decrypting without key does not make any sense, this should not break existing applications. Users can still call Cipher#key= and Cipher#iv= multiple times with their own responsibility. Reference: https://bugs.ruby-lang.org/issues/2768 Reference: https://bugs.ruby-lang.org/issues/8221 Reference: https://github.com/ruby/openssl/issues/49
ossl_cipher_final(VALUE self) { EVP_CIPHER_CTX *ctx; int out_len; VALUE str; GetCipher(self, ctx); str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx)); if (!EVP_CipherFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), &out_len)) ossl_raise(eCipherError, NULL); assert(out_len <= RSTRING_LEN(str)); rb_str_set_len(str, out_len); return str; }
ossl_cipher_final(VALUE self) { EVP_CIPHER_CTX *ctx; int out_len; VALUE str; GetCipher(self, ctx); str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx)); if (!EVP_CipherFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), &out_len)) ossl_raise(eCipherError, NULL); assert(out_len <= RSTRING_LEN(str)); rb_str_set_len(str, out_len); return str; }
C
openssl
0
CVE-2013-7449
https://www.cvedetails.com/cve/CVE-2013-7449/
CWE-310
https://github.com/hexchat/hexchat/commit/c9b63f7f9be01692b03fa15275135a4910a7e02d
c9b63f7f9be01692b03fa15275135a4910a7e02d
ssl: Validate hostnames Closes #524
ASN1_TIME_snprintf (char *buf, int buf_len, ASN1_TIME * tm) { char *expires = NULL; BIO *inMem = BIO_new (BIO_s_mem ()); ASN1_TIME_print (inMem, tm); BIO_get_mem_data (inMem, &expires); buf[0] = 0; if (expires != NULL) { /* expires is not \0 terminated */ safe_strcpy (buf, expires, MIN(24, buf_len)); } BIO_free (inMem); }
ASN1_TIME_snprintf (char *buf, int buf_len, ASN1_TIME * tm) { char *expires = NULL; BIO *inMem = BIO_new (BIO_s_mem ()); ASN1_TIME_print (inMem, tm); BIO_get_mem_data (inMem, &expires); buf[0] = 0; if (expires != NULL) { /* expires is not \0 terminated */ safe_strcpy (buf, expires, MIN(24, buf_len)); } BIO_free (inMem); }
C
hexchat
0
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior event_behavior, TextControlSetValueSelection selection) { input_type_->WarnIfValueIsInvalidAndElementIsVisible(value); if (!input_type_->CanSetValue(value)) return; TextControlElement::SetSuggestedValue(String()); EventQueueScope scope; String sanitized_value = SanitizeValue(value); bool value_changed = sanitized_value != this->value(); SetLastChangeWasNotUserEdit(); needs_to_update_view_value_ = true; input_type_->SetValue(sanitized_value, value_changed, event_behavior, selection); input_type_view_->DidSetValue(sanitized_value, value_changed); if (value_changed) NotifyFormStateChanged(); }
void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior event_behavior, TextControlSetValueSelection selection) { input_type_->WarnIfValueIsInvalidAndElementIsVisible(value); if (!input_type_->CanSetValue(value)) return; TextControlElement::SetSuggestedValue(String()); EventQueueScope scope; String sanitized_value = SanitizeValue(value); bool value_changed = sanitized_value != this->value(); SetLastChangeWasNotUserEdit(); needs_to_update_view_value_ = true; input_type_->SetValue(sanitized_value, value_changed, event_behavior, selection); input_type_view_->DidSetValue(sanitized_value, value_changed); if (value_changed) NotifyFormStateChanged(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/04cca6c05e4923f1b91e0dddf053e088456d8645
04cca6c05e4923f1b91e0dddf053e088456d8645
https://bugs.webkit.org/show_bug.cgi?id=45164 Reviewed by Dan Bernstein. REGRESSION: <a><img align=top></a> Clickable area too large Make sure to clamp hit testing of quirky inline flow boxes the same way we already clamped painting. Source/WebCore: * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::nodeAtPoint): LayoutTests: * fast/inline/inline-position-top-align-expected.txt: Added. * fast/inline/inline-position-top-align.html: Added. git-svn-id: svn://svn.chromium.org/blink/trunk@81055 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void InlineFlowBox::placeBoxesInBlockDirection(int top, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop, int& lineTopIncludingMargins, int& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType) { if (isRootInlineBox()) setLogicalTop(top + maxAscent - baselinePosition(baselineType)); // Place our root box. for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { if (curr->renderer()->isPositioned()) continue; // Positioned placeholders don't affect calculations. bool isInlineFlow = curr->isInlineFlowBox(); if (isInlineFlow) static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(top, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop, lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType); bool childAffectsTopBottomPos = true; if (curr->verticalAlign() == TOP) curr->setLogicalTop(top); else if (curr->verticalAlign() == BOTTOM) curr->setLogicalTop(top + maxHeight - curr->lineHeight()); else { if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() && !strictMode) childAffectsTopBottomPos = false; int posAdjust = maxAscent - curr->baselinePosition(baselineType); curr->setLogicalTop(curr->logicalTop() + top + posAdjust); } int newLogicalTop = curr->logicalTop(); int newLogicalTopIncludingMargins = newLogicalTop; int boxHeight = curr->logicalHeight(); int boxHeightIncludingMargins = boxHeight; if (curr->isText() || curr->isInlineFlowBox()) { const FontMetrics& fontMetrics = curr->renderer()->style(m_firstLine)->fontMetrics(); newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.ascent(baselineType); if (curr->isInlineFlowBox()) { RenderBoxModelObject* boxObject = toRenderBoxModelObject(curr->renderer()); newLogicalTop -= boxObject->style(m_firstLine)->isHorizontalWritingMode() ? boxObject->borderTop() + boxObject->paddingTop() : boxObject->borderRight() + boxObject->paddingRight(); } newLogicalTopIncludingMargins = newLogicalTop; } else if (!curr->renderer()->isBR()) { RenderBox* box = toRenderBox(curr->renderer()); newLogicalTopIncludingMargins = newLogicalTop; int overSideMargin = curr->isHorizontal() ? box->marginTop() : box->marginRight(); int underSideMargin = curr->isHorizontal() ? box->marginBottom() : box->marginLeft(); newLogicalTop += overSideMargin; boxHeightIncludingMargins += overSideMargin + underSideMargin; } curr->setLogicalTop(newLogicalTop); if (childAffectsTopBottomPos) { if (curr->renderer()->isRubyRun()) { if (!renderer()->style()->isFlippedLinesWritingMode()) hasAnnotationsBefore = true; else hasAnnotationsAfter = true; RenderRubyRun* rubyRun = static_cast<RenderRubyRun*>(curr->renderer()); if (RenderRubyBase* rubyBase = rubyRun->rubyBase()) { int bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : 0); int topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : 0); newLogicalTop += !renderer()->style()->isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); } } if (curr->isInlineTextBox()) { TextEmphasisPosition emphasisMarkPosition; if (static_cast<InlineTextBox*>(curr)->getEmphasisMarkPosition(curr->renderer()->style(m_firstLine), emphasisMarkPosition)) { bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphasisPositionOver; if (emphasisMarkIsOver != curr->renderer()->style(m_firstLine)->isFlippedLinesWritingMode()) hasAnnotationsBefore = true; else hasAnnotationsAfter = true; } } if (!setLineTop) { setLineTop = true; lineTop = newLogicalTop; lineTopIncludingMargins = min(lineTop, newLogicalTopIncludingMargins); } else { lineTop = min(lineTop, newLogicalTop); lineTopIncludingMargins = min(lineTop, min(lineTopIncludingMargins, newLogicalTopIncludingMargins)); } lineBottom = max(lineBottom, newLogicalTop + boxHeight); lineBottomIncludingMargins = max(lineBottom, max(lineBottomIncludingMargins, newLogicalTopIncludingMargins + boxHeightIncludingMargins)); } } if (isRootInlineBox()) { const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics(); setLogicalTop(logicalTop() + baselinePosition(baselineType) - fontMetrics.ascent(baselineType)); if (hasTextChildren() || strictMode) { if (!setLineTop) { setLineTop = true; lineTop = logicalTop(); lineTopIncludingMargins = lineTop; } else { lineTop = min(lineTop, logicalTop()); lineTopIncludingMargins = min(lineTop, lineTopIncludingMargins); } lineBottom = max(lineBottom, logicalTop() + logicalHeight()); lineBottomIncludingMargins = max(lineBottom, lineBottomIncludingMargins); } if (renderer()->style()->isFlippedLinesWritingMode()) flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludingMargins); } }
void InlineFlowBox::placeBoxesInBlockDirection(int top, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom, bool& setLineTop, int& lineTopIncludingMargins, int& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType) { if (isRootInlineBox()) setLogicalTop(top + maxAscent - baselinePosition(baselineType)); // Place our root box. for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { if (curr->renderer()->isPositioned()) continue; // Positioned placeholders don't affect calculations. bool isInlineFlow = curr->isInlineFlowBox(); if (isInlineFlow) static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(top, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop, lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType); bool childAffectsTopBottomPos = true; if (curr->verticalAlign() == TOP) curr->setLogicalTop(top); else if (curr->verticalAlign() == BOTTOM) curr->setLogicalTop(top + maxHeight - curr->lineHeight()); else { if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() && !strictMode) childAffectsTopBottomPos = false; int posAdjust = maxAscent - curr->baselinePosition(baselineType); curr->setLogicalTop(curr->logicalTop() + top + posAdjust); } int newLogicalTop = curr->logicalTop(); int newLogicalTopIncludingMargins = newLogicalTop; int boxHeight = curr->logicalHeight(); int boxHeightIncludingMargins = boxHeight; if (curr->isText() || curr->isInlineFlowBox()) { const FontMetrics& fontMetrics = curr->renderer()->style(m_firstLine)->fontMetrics(); newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.ascent(baselineType); if (curr->isInlineFlowBox()) { RenderBoxModelObject* boxObject = toRenderBoxModelObject(curr->renderer()); newLogicalTop -= boxObject->style(m_firstLine)->isHorizontalWritingMode() ? boxObject->borderTop() + boxObject->paddingTop() : boxObject->borderRight() + boxObject->paddingRight(); } newLogicalTopIncludingMargins = newLogicalTop; } else if (!curr->renderer()->isBR()) { RenderBox* box = toRenderBox(curr->renderer()); newLogicalTopIncludingMargins = newLogicalTop; int overSideMargin = curr->isHorizontal() ? box->marginTop() : box->marginRight(); int underSideMargin = curr->isHorizontal() ? box->marginBottom() : box->marginLeft(); newLogicalTop += overSideMargin; boxHeightIncludingMargins += overSideMargin + underSideMargin; } curr->setLogicalTop(newLogicalTop); if (childAffectsTopBottomPos) { if (curr->renderer()->isRubyRun()) { if (!renderer()->style()->isFlippedLinesWritingMode()) hasAnnotationsBefore = true; else hasAnnotationsAfter = true; RenderRubyRun* rubyRun = static_cast<RenderRubyRun*>(curr->renderer()); if (RenderRubyBase* rubyBase = rubyRun->rubyBase()) { int bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : 0); int topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : 0); newLogicalTop += !renderer()->style()->isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); } } if (curr->isInlineTextBox()) { TextEmphasisPosition emphasisMarkPosition; if (static_cast<InlineTextBox*>(curr)->getEmphasisMarkPosition(curr->renderer()->style(m_firstLine), emphasisMarkPosition)) { bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphasisPositionOver; if (emphasisMarkIsOver != curr->renderer()->style(m_firstLine)->isFlippedLinesWritingMode()) hasAnnotationsBefore = true; else hasAnnotationsAfter = true; } } if (!setLineTop) { setLineTop = true; lineTop = newLogicalTop; lineTopIncludingMargins = min(lineTop, newLogicalTopIncludingMargins); } else { lineTop = min(lineTop, newLogicalTop); lineTopIncludingMargins = min(lineTop, min(lineTopIncludingMargins, newLogicalTopIncludingMargins)); } lineBottom = max(lineBottom, newLogicalTop + boxHeight); lineBottomIncludingMargins = max(lineBottom, max(lineBottomIncludingMargins, newLogicalTopIncludingMargins + boxHeightIncludingMargins)); } } if (isRootInlineBox()) { const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics(); setLogicalTop(logicalTop() + baselinePosition(baselineType) - fontMetrics.ascent(baselineType)); if (hasTextChildren() || strictMode) { if (!setLineTop) { setLineTop = true; lineTop = logicalTop(); lineTopIncludingMargins = lineTop; } else { lineTop = min(lineTop, logicalTop()); lineTopIncludingMargins = min(lineTop, lineTopIncludingMargins); } lineBottom = max(lineBottom, logicalTop() + logicalHeight()); lineBottomIncludingMargins = max(lineBottom, lineBottomIncludingMargins); } if (renderer()->style()->isFlippedLinesWritingMode()) flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludingMargins); } }
C
Chrome
0
CVE-2013-0840
https://www.cvedetails.com/cve/CVE-2013-0840/
null
https://github.com/chromium/chromium/commit/7f48b71cb22bb2fc9fcec2013e9eaff55381a43d
7f48b71cb22bb2fc9fcec2013e9eaff55381a43d
Filter more incoming URLs in the CreateWindow path. BUG=170532 Review URL: https://chromiumcodereview.appspot.com/12036002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178728 0039d316-1c4b-4281-b951-d872f2087c98
RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) : RenderWidget(WebKit::WebPopupTypeNone, params->screen_info, params->swapped_out), webkit_preferences_(params->webkit_prefs), send_content_state_immediately_(false), enabled_bindings_(0), send_preferred_size_changes_(false), is_loading_(false), navigation_gesture_(NavigationGestureUnknown), opened_by_user_gesture_(true), opener_suppressed_(false), page_id_(-1), last_page_id_sent_to_browser_(-1), next_page_id_(params->next_page_id), history_list_offset_(-1), history_list_length_(0), target_url_status_(TARGET_NONE), selection_text_offset_(0), cached_is_main_frame_pinned_to_left_(false), cached_is_main_frame_pinned_to_right_(false), cached_has_main_frame_horizontal_scrollbar_(false), cached_has_main_frame_vertical_scrollbar_(false), ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), geolocation_dispatcher_(NULL), input_tag_speech_dispatcher_(NULL), speech_recognition_dispatcher_(NULL), device_orientation_dispatcher_(NULL), media_stream_dispatcher_(NULL), browser_plugin_manager_(NULL), media_stream_impl_(NULL), devtools_agent_(NULL), accessibility_mode_(AccessibilityModeOff), renderer_accessibility_(NULL), java_bridge_dispatcher_(NULL), mouse_lock_dispatcher_(NULL), favicon_helper_(NULL), #if defined(OS_ANDROID) body_background_color_(SK_ColorWHITE), update_frame_info_scheduled_(false), expected_content_intent_id_(0), media_player_proxy_(NULL), synchronous_find_active_match_ordinal_(-1), ALLOW_THIS_IN_INITIALIZER_LIST( load_progress_tracker_(new LoadProgressTracker(this))), #endif session_storage_namespace_id_(params->session_storage_namespace_id), handling_select_range_(false), next_snapshot_id_(0), #if defined(OS_WIN) focused_plugin_id_(-1), #endif updating_frame_tree_(false), pending_frame_tree_update_(false), target_process_id_(0), target_routing_id_(0) { #if defined(ENABLE_PLUGINS) pepper_helper_.reset(new PepperPluginDelegateImpl(this)); #else pepper_helper_.reset(new RenderViewPepperHelper()); #endif set_throttle_input_events(params->renderer_prefs.throttle_input_events); routing_id_ = params->routing_id; surface_id_ = params->surface_id; if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) opener_id_ = params->opener_id; DCHECK_GE(next_page_id_, 0); #if defined(ENABLE_NOTIFICATIONS) notification_provider_ = new NotificationProvider(this); #else notification_provider_ = NULL; #endif webwidget_ = WebView::create(this); webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); #if defined(OS_ANDROID) content::DeviceTelephonyInfo device_info; const std::string region_code = command_line.HasSwitch(switches::kNetworkCountryIso) ? command_line.GetSwitchValueASCII(switches::kNetworkCountryIso) : device_info.GetNetworkCountryIso(); content_detectors_.push_back(linked_ptr<ContentDetector>( new AddressDetector())); content_detectors_.push_back(linked_ptr<ContentDetector>( new PhoneNumberDetector(region_code))); content_detectors_.push_back(linked_ptr<ContentDetector>( new EmailDetector())); #endif if (params->counter) { shared_popup_counter_ = params->counter; if (!params->swapped_out) shared_popup_counter_->data++; decrement_shared_popup_at_destruction_ = true; } else { shared_popup_counter_ = new SharedRenderViewCounter(0); decrement_shared_popup_at_destruction_ = false; } RenderThread::Get()->AddRoute(routing_id_, this); AddRef(); if (opener_id_ == MSG_ROUTING_NONE) { did_show_ = true; CompleteInit(); } g_view_map.Get().insert(std::make_pair(webview(), this)); g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); webview()->setDeviceScaleFactor(device_scale_factor_); webkit_preferences_.Apply(webview()); webview()->initializeMainFrame(this); if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) webview()->settings()->setTouchDragDropEnabled(true); if (!params->frame_name.empty()) webview()->mainFrame()->setName(params->frame_name); webview()->settings()->setMinimumTimerInterval( is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : webkit_glue::kForegroundTabTimerInterval); OnSetRendererPrefs(params->renderer_prefs); #if defined(ENABLE_WEBRTC) if (!media_stream_dispatcher_) media_stream_dispatcher_ = new MediaStreamDispatcher(this); #endif new MHTMLGenerator(this); #if defined(OS_MACOSX) new TextInputClientObserver(this); #endif // defined(OS_MACOSX) #if defined(OS_ANDROID) media_player_manager_.reset( new webkit_media::WebMediaPlayerManagerAndroid()); #endif devtools_agent_ = new DevToolsAgent(this); mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); intents_host_ = new WebIntentsHost(this); favicon_helper_ = new FaviconHelper(this); OnSetAccessibilityMode(params->accessibility_mode); new IdleUserDetector(this); if (command_line.HasSwitch(switches::kDomAutomationController)) enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; ProcessViewLayoutFlags(command_line); GetContentClient()->renderer()->RenderViewCreated(this); if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { RenderViewImpl* opener_view = FromRoutingID(params->opener_id); if (opener_view) webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); } if (is_swapped_out_) NavigateToSwappedOutURL(webview()->mainFrame()); }
RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) : RenderWidget(WebKit::WebPopupTypeNone, params->screen_info, params->swapped_out), webkit_preferences_(params->webkit_prefs), send_content_state_immediately_(false), enabled_bindings_(0), send_preferred_size_changes_(false), is_loading_(false), navigation_gesture_(NavigationGestureUnknown), opened_by_user_gesture_(true), opener_suppressed_(false), page_id_(-1), last_page_id_sent_to_browser_(-1), next_page_id_(params->next_page_id), history_list_offset_(-1), history_list_length_(0), target_url_status_(TARGET_NONE), selection_text_offset_(0), cached_is_main_frame_pinned_to_left_(false), cached_is_main_frame_pinned_to_right_(false), cached_has_main_frame_horizontal_scrollbar_(false), cached_has_main_frame_vertical_scrollbar_(false), ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), geolocation_dispatcher_(NULL), input_tag_speech_dispatcher_(NULL), speech_recognition_dispatcher_(NULL), device_orientation_dispatcher_(NULL), media_stream_dispatcher_(NULL), browser_plugin_manager_(NULL), media_stream_impl_(NULL), devtools_agent_(NULL), accessibility_mode_(AccessibilityModeOff), renderer_accessibility_(NULL), java_bridge_dispatcher_(NULL), mouse_lock_dispatcher_(NULL), favicon_helper_(NULL), #if defined(OS_ANDROID) body_background_color_(SK_ColorWHITE), update_frame_info_scheduled_(false), expected_content_intent_id_(0), media_player_proxy_(NULL), synchronous_find_active_match_ordinal_(-1), ALLOW_THIS_IN_INITIALIZER_LIST( load_progress_tracker_(new LoadProgressTracker(this))), #endif session_storage_namespace_id_(params->session_storage_namespace_id), handling_select_range_(false), next_snapshot_id_(0), #if defined(OS_WIN) focused_plugin_id_(-1), #endif updating_frame_tree_(false), pending_frame_tree_update_(false), target_process_id_(0), target_routing_id_(0) { #if defined(ENABLE_PLUGINS) pepper_helper_.reset(new PepperPluginDelegateImpl(this)); #else pepper_helper_.reset(new RenderViewPepperHelper()); #endif set_throttle_input_events(params->renderer_prefs.throttle_input_events); routing_id_ = params->routing_id; surface_id_ = params->surface_id; if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) opener_id_ = params->opener_id; DCHECK_GE(next_page_id_, 0); #if defined(ENABLE_NOTIFICATIONS) notification_provider_ = new NotificationProvider(this); #else notification_provider_ = NULL; #endif webwidget_ = WebView::create(this); webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); #if defined(OS_ANDROID) content::DeviceTelephonyInfo device_info; const std::string region_code = command_line.HasSwitch(switches::kNetworkCountryIso) ? command_line.GetSwitchValueASCII(switches::kNetworkCountryIso) : device_info.GetNetworkCountryIso(); content_detectors_.push_back(linked_ptr<ContentDetector>( new AddressDetector())); content_detectors_.push_back(linked_ptr<ContentDetector>( new PhoneNumberDetector(region_code))); content_detectors_.push_back(linked_ptr<ContentDetector>( new EmailDetector())); #endif if (params->counter) { shared_popup_counter_ = params->counter; if (!params->swapped_out) shared_popup_counter_->data++; decrement_shared_popup_at_destruction_ = true; } else { shared_popup_counter_ = new SharedRenderViewCounter(0); decrement_shared_popup_at_destruction_ = false; } RenderThread::Get()->AddRoute(routing_id_, this); AddRef(); if (opener_id_ == MSG_ROUTING_NONE) { did_show_ = true; CompleteInit(); } g_view_map.Get().insert(std::make_pair(webview(), this)); g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); webview()->setDeviceScaleFactor(device_scale_factor_); webkit_preferences_.Apply(webview()); webview()->initializeMainFrame(this); if (command_line.HasSwitch(switches::kEnableTouchDragDrop)) webview()->settings()->setTouchDragDropEnabled(true); if (!params->frame_name.empty()) webview()->mainFrame()->setName(params->frame_name); webview()->settings()->setMinimumTimerInterval( is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : webkit_glue::kForegroundTabTimerInterval); OnSetRendererPrefs(params->renderer_prefs); #if defined(ENABLE_WEBRTC) if (!media_stream_dispatcher_) media_stream_dispatcher_ = new MediaStreamDispatcher(this); #endif new MHTMLGenerator(this); #if defined(OS_MACOSX) new TextInputClientObserver(this); #endif // defined(OS_MACOSX) #if defined(OS_ANDROID) media_player_manager_.reset( new webkit_media::WebMediaPlayerManagerAndroid()); #endif devtools_agent_ = new DevToolsAgent(this); mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); intents_host_ = new WebIntentsHost(this); favicon_helper_ = new FaviconHelper(this); OnSetAccessibilityMode(params->accessibility_mode); new IdleUserDetector(this); if (command_line.HasSwitch(switches::kDomAutomationController)) enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; ProcessViewLayoutFlags(command_line); GetContentClient()->renderer()->RenderViewCreated(this); if (params->opener_id != MSG_ROUTING_NONE && !params->is_renderer_created) { RenderViewImpl* opener_view = FromRoutingID(params->opener_id); if (opener_view) webview()->mainFrame()->setOpener(opener_view->webview()->mainFrame()); } if (is_swapped_out_) NavigateToSwappedOutURL(webview()->mainFrame()); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/19190765882e272a6a2162c89acdb29110f7e3cf
19190765882e272a6a2162c89acdb29110f7e3cf
Revert 102184 - [Sync] use base::Time in sync Make EntryKernel/Entry/BaseNode use base::Time instead of int64s. Add sync/util/time.h, with utility functions to manage the sync proto time format. Store times on disk in proto format instead of the local system. This requires a database version bump (to 77). Update SessionChangeProcessor/SessionModelAssociator to use base::Time, too. Remove hackish Now() function. Remove ZeroFields() function, and instead zero-initialize in EntryKernel::EntryKernel() directly. BUG= TEST= Review URL: http://codereview.chromium.org/7981006 [email protected] Review URL: http://codereview.chromium.org/7977034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102186 0039d316-1c4b-4281-b951-d872f2087c98
SyncerPositionTiebreakingTest() : low_id_(Id::CreateFromServerId("A")), mid_id_(Id::CreateFromServerId("M")), high_id_(Id::CreateFromServerId("Z")), next_revision_(1) { DCHECK(low_id_ < mid_id_); DCHECK(mid_id_ < high_id_); DCHECK(low_id_ < high_id_); }
SyncerPositionTiebreakingTest() : low_id_(Id::CreateFromServerId("A")), mid_id_(Id::CreateFromServerId("M")), high_id_(Id::CreateFromServerId("Z")), next_revision_(1) { DCHECK(low_id_ < mid_id_); DCHECK(mid_id_ < high_id_); DCHECK(low_id_ < high_id_); }
C
Chrome
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGL2RenderingContextBase::uniform4uiv( const WebGLUniformLocation* location, Vector<GLuint>& value, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformParameters("uniform4uiv", location, value.data(), value.size(), 4, src_offset, src_length)) return; ContextGL()->Uniform4uiv( location->Location(), (src_length ? src_length : (value.size() - src_offset)) >> 2, value.data() + src_offset); }
void WebGL2RenderingContextBase::uniform4uiv( const WebGLUniformLocation* location, Vector<GLuint>& value, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformParameters("uniform4uiv", location, value.data(), value.size(), 4, src_offset, src_length)) return; ContextGL()->Uniform4uiv( location->Location(), (src_length ? src_length : (value.size() - src_offset)) >> 2, value.data() + src_offset); }
C
Chrome
0
CVE-2015-8952
https://www.cvedetails.com/cve/CVE-2015-8952/
CWE-19
https://github.com/torvalds/linux/commit/82939d7999dfc1f1998c4b1c12e2f19edbdff272
82939d7999dfc1f1998c4b1c12e2f19edbdff272
ext4: convert to mbcache2 The conversion is generally straightforward. The only tricky part is that xattr block corresponding to found mbcache entry can get freed before we get buffer lock for that block. So we have to check whether the entry is still valid after getting buffer lock. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) { struct buffer_head *bh = NULL; if (!EXT4_I(inode)->i_file_acl) goto cleanup; bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); if (!bh) { EXT4_ERROR_INODE(inode, "block %llu read error", EXT4_I(inode)->i_file_acl); goto cleanup; } if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || BHDR(bh)->h_blocks != cpu_to_le32(1)) { EXT4_ERROR_INODE(inode, "bad block %llu", EXT4_I(inode)->i_file_acl); goto cleanup; } ext4_xattr_release_block(handle, inode, bh); EXT4_I(inode)->i_file_acl = 0; cleanup: brelse(bh); }
ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) { struct buffer_head *bh = NULL; if (!EXT4_I(inode)->i_file_acl) goto cleanup; bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); if (!bh) { EXT4_ERROR_INODE(inode, "block %llu read error", EXT4_I(inode)->i_file_acl); goto cleanup; } if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || BHDR(bh)->h_blocks != cpu_to_le32(1)) { EXT4_ERROR_INODE(inode, "bad block %llu", EXT4_I(inode)->i_file_acl); goto cleanup; } ext4_xattr_release_block(handle, inode, bh); EXT4_I(inode)->i_file_acl = 0; cleanup: brelse(bh); }
C
linux
0
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
bool LayerTreeHostImpl::IsElementInList(ElementId element_id, ElementListType list_type) const { if (list_type == ElementListType::ACTIVE) { return active_tree() ? active_tree()->LayerByElementId(element_id) != nullptr : false; } else { if (pending_tree() && pending_tree()->LayerByElementId(element_id)) return true; if (recycle_tree() && recycle_tree()->LayerByElementId(element_id)) return true; return false; } }
bool LayerTreeHostImpl::IsElementInList(ElementId element_id, ElementListType list_type) const { if (list_type == ElementListType::ACTIVE) { return active_tree() ? active_tree()->LayerByElementId(element_id) != nullptr : false; } else { if (pending_tree() && pending_tree()->LayerByElementId(element_id)) return true; if (recycle_tree() && recycle_tree()->LayerByElementId(element_id)) return true; return false; } }
C
Chrome
0
CVE-2016-10506
https://www.cvedetails.com/cve/CVE-2016-10506/
CWE-369
https://github.com/uclouvain/openjpeg/commit/d27ccf01c68a31ad62b33d2dc1ba2bb1eeaafe7b
d27ccf01c68a31ad62b33d2dc1ba2bb1eeaafe7b
Avoid division by zero in opj_pi_next_rpcl, opj_pi_next_pcrl and opj_pi_next_cprl (#938) Fixes issues with id:000026,sig:08,src:002419,op:int32,pos:60,val:+32 and id:000019,sig:08,src:001098,op:flip1,pos:49
static void opj_pi_update_decode_not_poc(opj_pi_iterator_t * p_pi, opj_tcp_t * p_tcp, OPJ_UINT32 p_max_precision, OPJ_UINT32 p_max_res) { /* loop*/ OPJ_UINT32 pino; /* encoding prameters to set*/ OPJ_UINT32 l_bound; opj_pi_iterator_t * l_current_pi = 00; /* preconditions in debug*/ assert(p_tcp != 00); assert(p_pi != 00); /* initializations*/ l_bound = p_tcp->numpocs + 1; l_current_pi = p_pi; for (pino = 0; pino < l_bound; ++pino) { l_current_pi->poc.prg = p_tcp->prg; l_current_pi->first = 1; l_current_pi->poc.resno0 = 0; l_current_pi->poc.compno0 = 0; l_current_pi->poc.layno0 = 0; l_current_pi->poc.precno0 = 0; l_current_pi->poc.resno1 = p_max_res; l_current_pi->poc.compno1 = l_current_pi->numcomps; l_current_pi->poc.layno1 = p_tcp->numlayers; l_current_pi->poc.precno1 = p_max_precision; ++l_current_pi; } }
static void opj_pi_update_decode_not_poc(opj_pi_iterator_t * p_pi, opj_tcp_t * p_tcp, OPJ_UINT32 p_max_precision, OPJ_UINT32 p_max_res) { /* loop*/ OPJ_UINT32 pino; /* encoding prameters to set*/ OPJ_UINT32 l_bound; opj_pi_iterator_t * l_current_pi = 00; /* preconditions in debug*/ assert(p_tcp != 00); assert(p_pi != 00); /* initializations*/ l_bound = p_tcp->numpocs + 1; l_current_pi = p_pi; for (pino = 0; pino < l_bound; ++pino) { l_current_pi->poc.prg = p_tcp->prg; l_current_pi->first = 1; l_current_pi->poc.resno0 = 0; l_current_pi->poc.compno0 = 0; l_current_pi->poc.layno0 = 0; l_current_pi->poc.precno0 = 0; l_current_pi->poc.resno1 = p_max_res; l_current_pi->poc.compno1 = l_current_pi->numcomps; l_current_pi->poc.layno1 = p_tcp->numlayers; l_current_pi->poc.precno1 = p_max_precision; ++l_current_pi; } }
C
openjpeg
0
CVE-2016-5357
https://www.cvedetails.com/cve/CVE-2016-5357/
CWE-20
https://github.com/wireshark/wireshark/commit/11edc83b98a61e890d7bb01855389d40e984ea82
11edc83b98a61e890d7bb01855389d40e984ea82
Don't treat the packet length as unsigned. The scanf family of functions are as annoyingly bad at handling unsigned numbers as strtoul() is - both of them are perfectly willing to accept a value beginning with a negative sign as an unsigned value. When using strtoul(), you can compensate for this by explicitly checking for a '-' as the first character of the string, but you can't do that with sscanf(). So revert to having pkt_len be signed, and scanning it with %d, but check for a negative value and fail if we see a negative value. Bug: 12396 Change-Id: I54fe8f61f42c32b5ef33da633ece51bbcda8c95f Reviewed-on: https://code.wireshark.org/review/15220 Reviewed-by: Guy Harris <[email protected]>
static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; char line[NETSCREEN_LINE_LENGTH]; /* Find the next packet */ offset = netscreen_seek_next_packet(wth, err, err_info, line); if (offset < 0) return FALSE; /* Parse the header and convert the ASCII hex dump to binary data */ if (!parse_netscreen_packet(wth->fh, &wth->phdr, wth->frame_buffer, line, err, err_info)) return FALSE; /* * If the per-file encapsulation isn't known, set it to this * packet's encapsulation. * * If it *is* known, and it isn't this packet's encapsulation, * set it to WTAP_ENCAP_PER_PACKET, as this file doesn't * have a single encapsulation for all packets in the file. */ if (wth->file_encap == WTAP_ENCAP_UNKNOWN) wth->file_encap = wth->phdr.pkt_encap; else { if (wth->file_encap != wth->phdr.pkt_encap) wth->file_encap = WTAP_ENCAP_PER_PACKET; } *data_offset = offset; return TRUE; }
static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; char line[NETSCREEN_LINE_LENGTH]; /* Find the next packet */ offset = netscreen_seek_next_packet(wth, err, err_info, line); if (offset < 0) return FALSE; /* Parse the header and convert the ASCII hex dump to binary data */ if (!parse_netscreen_packet(wth->fh, &wth->phdr, wth->frame_buffer, line, err, err_info)) return FALSE; /* * If the per-file encapsulation isn't known, set it to this * packet's encapsulation. * * If it *is* known, and it isn't this packet's encapsulation, * set it to WTAP_ENCAP_PER_PACKET, as this file doesn't * have a single encapsulation for all packets in the file. */ if (wth->file_encap == WTAP_ENCAP_UNKNOWN) wth->file_encap = wth->phdr.pkt_encap; else { if (wth->file_encap != wth->phdr.pkt_encap) wth->file_encap = WTAP_ENCAP_PER_PACKET; } *data_offset = offset; return TRUE; }
C
wireshark
0