instruction
stringclasses
1 value
input
stringlengths
56
241k
output
int64
0
1
__index_level_0__
int64
0
175k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void BrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { if (!window_) return; bool is_active = gtk_widget_get_window(GTK_WIDGET(window_)) == active_window; bool changed = (is_active != is_active_); if (is_active && changed) { if (AppModalDialogQueue::GetInstance()->HasActiveDialog()) { AppModalDialogQueue::GetInstance()->ActivateModalDialog(); return; } } is_active_ = is_active; if (changed) { SetBackgroundColor(); InvalidateWindow(); UpdateWindowShape(bounds_.width(), bounds_.height()); } } Commit Message: 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 CWE ID: CWE-20
0
117,894
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ResourceRequest FrameLoader::ResourceRequestForReload( WebFrameLoadType frame_load_type, ClientRedirectPolicy client_redirect_policy) { DCHECK(IsReloadLoadType(frame_load_type)); const auto cache_mode = frame_load_type == WebFrameLoadType::kReloadBypassingCache ? mojom::FetchCacheMode::kBypassCache : mojom::FetchCacheMode::kValidateCache; if (!document_loader_ || !document_loader_->GetHistoryItem()) return ResourceRequest(); ResourceRequest request = document_loader_->GetHistoryItem()->GenerateResourceRequest(cache_mode); request.SetRequestorOrigin(SecurityOrigin::Create(request.Url())); if (client_redirect_policy == ClientRedirectPolicy::kClientRedirect) { request.SetHTTPReferrer(SecurityPolicy::GenerateReferrer( frame_->GetDocument()->GetReferrerPolicy(), frame_->GetDocument()->Url(), frame_->GetDocument()->OutgoingReferrer())); } request.SetSkipServiceWorker(frame_load_type == WebFrameLoadType::kReloadBypassingCache); return request; } Commit Message: Inherit the navigation initiator when navigating instead of the parent/opener Spec PR: https://github.com/w3c/webappsec-csp/pull/358 Bug: 905301, 894228, 836148 Change-Id: I43ada2266d42d1cd56dbe3c6dd89d115e878a83a Reviewed-on: https://chromium-review.googlesource.com/c/1314633 Commit-Queue: Andy Paicu <andypaicu@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#610850} CWE ID: CWE-20
0
152,570
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static u32 __init armv7_read_num_pmnc_events(void) { u32 nb_cnt; /* Read the nb of CNTx counters supported from PMNC */ nb_cnt = (armv7_pmnc_read() >> ARMV7_PMNC_N_SHIFT) & ARMV7_PMNC_N_MASK; /* Add the CPU cycles counter and return */ return nb_cnt + 1; } Commit Message: 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 <a.p.zijlstra@chello.nl> Cc: Michael Cree <mcree@orcon.net.nz> Cc: Will Deacon <will.deacon@arm.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Eric B Munson <emunson@mgebm.net> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Don Zickus <dzickus@redhat.com> Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu> CWE ID: CWE-399
0
25,271
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void NavigatorImpl::DiscardPendingEntryIfNeeded(NavigationHandleImpl* handle) { NavigationEntry* pending_entry = controller_->GetPendingEntry(); bool pending_matches_fail_msg = handle && pending_entry && handle->pending_nav_entry_id() == pending_entry->GetUniqueID(); if (!pending_matches_fail_msg) return; bool should_preserve_entry = controller_->IsUnmodifiedBlankTab() || delegate_->ShouldPreserveAbortedURLs(); if (pending_entry != controller_->GetVisibleEntry() || !should_preserve_entry) { controller_->DiscardPendingEntry(true); controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); } } Commit Message: 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 <iclelland@chromium.org> Reviewed-by: Charles Reis <creis@chromium.org> Cr-Commit-Position: refs/heads/master@{#466778} CWE ID: CWE-254
0
127,696
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: iperf_set_test_num_streams(struct iperf_test *ipt, int num_streams) { ipt->num_streams = num_streams; } Commit Message: Fix a buffer overflow / heap corruption issue that could occur if a malformed JSON string was passed on the control channel. This issue, present in the cJSON library, was already fixed upstream, so was addressed here in iperf3 by importing a newer version of cJSON (plus local ESnet modifications). Discovered and reported by Dave McDaniel, Cisco Talos. Based on a patch by @dopheide-esnet, with input from @DaveGamble. Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001, CVE-2016-4303 (cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40) Signed-off-by: Bruce A. Mah <bmah@es.net> CWE ID: CWE-119
0
53,425
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2DecoderPassthroughImpl::ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) { TextureBase* texture = mailbox_manager_->ConsumeTexture(mailbox); mailbox_manager_->TextureDeleted(texture); if (offscreen_single_buffer_) { return; } auto it = in_use_color_textures_.begin(); while (it != in_use_color_textures_.end()) { if ((*it)->texture == texture) { break; } it++; } if (it == in_use_color_textures_.end()) { DLOG(ERROR) << "Attempting to return a frontbuffer that was not saved."; return; } if (is_lost) { (*it)->texture->MarkContextLost(); (*it)->Destroy(false); } else if ((*it)->size != emulated_back_buffer_->size) { (*it)->Destroy(true); } else { available_color_textures_.push_back(std::move(*it)); } in_use_color_textures_.erase(it); } Commit Message: Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#657568} CWE ID: CWE-416
0
141,827
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void r_bin_dwarf_free_die(RBinDwarfDIE *die) { size_t i; if (!die) { return; } for (i = 0; i < die->length; i++) { r_bin_dwarf_free_attr_value (&die->attr_values[i]); } R_FREE (die->attr_values); } Commit Message: Fix #8813 - segfault in dwarf parser CWE ID: CWE-125
0
59,700
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: }static inline void WriteResourceLong(unsigned char *p, const unsigned int quantum) { Commit Message: Improve checking of EXIF profile to prevent integer overflow (bug report from Ibrahim el-sayed) CWE ID: CWE-125
1
169,950
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int opstmxcsr(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY && op->operands[0].type & OT_DWORD ) { data[l++] = 0x0f; data[l++] = 0xae; data[l++] = 0x18 | op->operands[0].regs[0]; } else { return -1; } break; default: return -1; } return l; } Commit Message: Fix #12372 and #12373 - Crash in x86 assembler (#12380) 0 ,0,[bP-bL-bP-bL-bL-r-bL-bP-bL-bL- mov ,0,[ax+Bx-ax+Bx-ax+ax+Bx-ax+Bx-- leA ,0,[bP-bL-bL-bP-bL-bP-bL-60@bL- leA ,0,[bP-bL-r-bP-bL-bP-bL-60@bL- mov ,0,[ax+Bx-ax+Bx-ax+ax+Bx-ax+Bx-- CWE ID: CWE-125
0
75,454
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void LockContentsView::UpdateAuthForAuthUser(LoginAuthUserView* opt_to_update, LoginAuthUserView* opt_to_hide, bool animate) { if (animate) { if (opt_to_update) opt_to_update->CaptureStateForAnimationPreLayout(); if (opt_to_hide) opt_to_hide->CaptureStateForAnimationPreLayout(); } if (opt_to_update) { UserState* state = FindStateForUser( opt_to_update->current_user()->basic_user_info->account_id); uint32_t to_update_auth; if (state->force_online_sign_in) { to_update_auth = LoginAuthUserView::AUTH_ONLINE_SIGN_IN; } else if (state->disable_auth) { to_update_auth = LoginAuthUserView::AUTH_DISABLED; } else { to_update_auth = LoginAuthUserView::AUTH_PASSWORD; keyboard::KeyboardController* keyboard_controller = GetKeyboardController(); const bool keyboard_visible = keyboard_controller ? keyboard_controller->keyboard_visible() : false; if (state->show_pin && !keyboard_visible && state->fingerprint_state == mojom::FingerprintUnlockState::UNAVAILABLE) { to_update_auth |= LoginAuthUserView::AUTH_PIN; } if (state->enable_tap_auth) to_update_auth |= LoginAuthUserView::AUTH_TAP; if (state->fingerprint_state != mojom::FingerprintUnlockState::UNAVAILABLE) { to_update_auth |= LoginAuthUserView::AUTH_FINGERPRINT; } } opt_to_update->SetAuthMethods(to_update_auth); } if (opt_to_hide) opt_to_hide->SetAuthMethods(LoginAuthUserView::AUTH_NONE); Layout(); if (animate) { if (opt_to_update) opt_to_update->ApplyAnimationPostLayout(); if (opt_to_hide) opt_to_hide->ApplyAnimationPostLayout(); } } Commit Message: cros: Check initial auth type when showing views login. Bug: 859611 Change-Id: I0298db9bbf4aed6bd40600aef2e1c5794e8cd058 Reviewed-on: https://chromium-review.googlesource.com/1123056 Reviewed-by: Xiaoyin Hu <xiaoyinh@chromium.org> Commit-Queue: Jacob Dufault <jdufault@chromium.org> Cr-Commit-Position: refs/heads/master@{#572224} CWE ID:
0
131,548
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MagickExport double InterpretLocaleValue(const char *magick_restrict string, char **magick_restrict sentinal) { char *q; double value; if ((*string == '0') && ((string[1] | 0x20)=='x')) value=(double) strtoul(string,&q,16); else { #if defined(MAGICKCORE_LOCALE_SUPPORT) && defined(MAGICKCORE_HAVE_STRTOD_L) locale_t locale; locale=AcquireCLocale(); if (locale == (locale_t) NULL) value=strtod(string,&q); else value=strtod_l(string,&q,locale); #else value=strtod(string,&q); #endif } if (sentinal != (char **) NULL) *sentinal=q; return(value); } Commit Message: ... CWE ID: CWE-125
0
90,892
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void vmx_set_rvi(int vector) { u16 status; u8 old; if (vector == -1) vector = 0; status = vmcs_read16(GUEST_INTR_STATUS); old = (u8)status & 0xff; if ((u8)vector != old) { status &= ~0xff; status |= (u8)vector; vmcs_write16(GUEST_INTR_STATUS, status); } } Commit Message: KVM: x86: work around infinite loop in microcode when #AC is delivered It was found that a guest can DoS a host by triggering an infinite stream of "alignment check" (#AC) exceptions. This causes the microcode to enter an infinite loop where the core never receives another interrupt. The host kernel panics pretty quickly due to the effects (CVE-2015-5307). Signed-off-by: Eric Northup <digitaleric@google.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID: CWE-399
0
42,767
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ImageLoader::SetImageForTest(ImageResourceContent* new_image) { DCHECK(new_image); SetImageWithoutConsideringPendingLoadEvent(new_image); } Commit Message: service worker: Disable interception when OBJECT/EMBED uses ImageLoader. Per the specification, service worker should not intercept requests for OBJECT/EMBED elements. R=kinuko Bug: 771933 Change-Id: Ia6da6107dc5c68aa2c2efffde14bd2c51251fbd4 Reviewed-on: https://chromium-review.googlesource.com/927303 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#538027} CWE ID:
0
147,506
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool HTMLFormElement::shouldAutocomplete() const { return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); } Commit Message: Enforce form-action CSP even when form.target is present. BUG=630332 Review-Url: https://codereview.chromium.org/2464123004 Cr-Commit-Position: refs/heads/master@{#429922} CWE ID: CWE-19
0
142,554
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: RenderFrameImpl* RenderFrameImpl::Create( RenderViewImpl* render_view, int32_t routing_id, service_manager::mojom::InterfaceProviderPtr interface_provider, const base::UnguessableToken& devtools_frame_token) { DCHECK(routing_id != MSG_ROUTING_NONE); CreateParams params(render_view, routing_id, std::move(interface_provider), devtools_frame_token); if (g_create_render_frame_impl) return g_create_render_frame_impl(std::move(params)); else return new RenderFrameImpl(std::move(params)); } Commit Message: If a page calls |window.focus()|, kick it out of fullscreen. BUG=776418, 800056 Change-Id: I1880fe600e4814c073f247c43b1c1ac80c8fc017 Reviewed-on: https://chromium-review.googlesource.com/852378 Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/master@{#533790} CWE ID:
0
147,743
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void unlist_netdevice(struct net_device *dev) { ASSERT_RTNL(); /* Unlink dev from the device chain */ write_lock_bh(&dev_base_lock); list_del_rcu(&dev->dev_list); hlist_del_rcu(&dev->name_hlist); hlist_del_rcu(&dev->index_hlist); write_unlock_bh(&dev_base_lock); dev_base_seq_inc(dev_net(dev)); } Commit Message: tunnels: Don't apply GRO to multiple layers of encapsulation. When drivers express support for TSO of encapsulated packets, they only mean that they can do it for one layer of encapsulation. Supporting additional levels would mean updating, at a minimum, more IP length fields and they are unaware of this. No encapsulation device expresses support for handling offloaded encapsulated packets, so we won't generate these types of frames in the transmit path. However, GRO doesn't have a check for multiple levels of encapsulation and will attempt to build them. UDP tunnel GRO actually does prevent this situation but it only handles multiple UDP tunnels stacked on top of each other. This generalizes that solution to prevent any kind of tunnel stacking that would cause problems. Fixes: bf5a755f ("net-gre-gro: Add GRE support to the GRO stack") Signed-off-by: Jesse Gross <jesse@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID: CWE-400
0
48,953
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rx_ack_print(netdissect_options *ndo, register const u_char *bp, int length) { const struct rx_ackPacket *rxa; int i, start, last; uint32_t firstPacket; if (length < (int)sizeof(struct rx_header)) return; bp += sizeof(struct rx_header); /* * This may seem a little odd .... the rx_ackPacket structure * contains an array of individual packet acknowledgements * (used for selective ack/nack), but since it's variable in size, * we don't want to truncate based on the size of the whole * rx_ackPacket structure. */ ND_TCHECK2(bp[0], sizeof(struct rx_ackPacket) - RX_MAXACKS); rxa = (const struct rx_ackPacket *) bp; bp += (sizeof(struct rx_ackPacket) - RX_MAXACKS); /* * Print out a few useful things from the ack packet structure */ if (ndo->ndo_vflag > 2) ND_PRINT((ndo, " bufspace %d maxskew %d", (int) EXTRACT_16BITS(&rxa->bufferSpace), (int) EXTRACT_16BITS(&rxa->maxSkew))); firstPacket = EXTRACT_32BITS(&rxa->firstPacket); ND_PRINT((ndo, " first %d serial %d reason %s", firstPacket, EXTRACT_32BITS(&rxa->serial), tok2str(rx_ack_reasons, "#%d", (int) rxa->reason))); /* * Okay, now we print out the ack array. The way _this_ works * is that we start at "first", and step through the ack array. * If we have a contiguous range of acks/nacks, try to * collapse them into a range. * * If you're really clever, you might have noticed that this * doesn't seem quite correct. Specifically, due to structure * padding, sizeof(struct rx_ackPacket) - RX_MAXACKS won't actually * yield the start of the ack array (because RX_MAXACKS is 255 * and the structure will likely get padded to a 2 or 4 byte * boundary). However, this is the way it's implemented inside * of AFS - the start of the extra fields are at * sizeof(struct rx_ackPacket) - RX_MAXACKS + nAcks, which _isn't_ * the exact start of the ack array. Sigh. That's why we aren't * using bp, but instead use rxa->acks[]. But nAcks gets added * to bp after this, so bp ends up at the right spot. Go figure. */ if (rxa->nAcks != 0) { ND_TCHECK2(bp[0], rxa->nAcks); /* * Sigh, this is gross, but it seems to work to collapse * ranges correctly. */ for (i = 0, start = last = -2; i < rxa->nAcks; i++) if (rxa->acks[i] == RX_ACK_TYPE_ACK) { /* * I figured this deserved _some_ explanation. * First, print "acked" and the packet seq * number if this is the first time we've * seen an acked packet. */ if (last == -2) { ND_PRINT((ndo, " acked %d", firstPacket + i)); start = i; } /* * Otherwise, if there is a skip in * the range (such as an nacked packet in * the middle of some acked packets), * then print the current packet number * seperated from the last number by * a comma. */ else if (last != i - 1) { ND_PRINT((ndo, ",%d", firstPacket + i)); start = i; } /* * We always set last to the value of * the last ack we saw. Conversely, start * is set to the value of the first ack * we saw in a range. */ last = i; /* * Okay, this bit a code gets executed when * we hit a nack ... in _this_ case we * want to print out the range of packets * that were acked, so we need to print * the _previous_ packet number seperated * from the first by a dash (-). Since we * already printed the first packet above, * just print the final packet. Don't * do this if there will be a single-length * range. */ } else if (last == i - 1 && start != last) ND_PRINT((ndo, "-%d", firstPacket + i - 1)); /* * So, what's going on here? We ran off the end of the * ack list, and if we got a range we need to finish it up. * So we need to determine if the last packet in the list * was an ack (if so, then last will be set to it) and * we need to see if the last range didn't start with the * last packet (because if it _did_, then that would mean * that the packet number has already been printed and * we don't need to print it again). */ if (last == i - 1 && start != last) ND_PRINT((ndo, "-%d", firstPacket + i - 1)); /* * Same as above, just without comments */ for (i = 0, start = last = -2; i < rxa->nAcks; i++) if (rxa->acks[i] == RX_ACK_TYPE_NACK) { if (last == -2) { ND_PRINT((ndo, " nacked %d", firstPacket + i)); start = i; } else if (last != i - 1) { ND_PRINT((ndo, ",%d", firstPacket + i)); start = i; } last = i; } else if (last == i - 1 && start != last) ND_PRINT((ndo, "-%d", firstPacket + i - 1)); if (last == i - 1 && start != last) ND_PRINT((ndo, "-%d", firstPacket + i - 1)); bp += rxa->nAcks; } /* * These are optional fields; depending on your version of AFS, * you may or may not see them */ #define TRUNCRET(n) if (ndo->ndo_snapend - bp + 1 <= n) return; if (ndo->ndo_vflag > 1) { TRUNCRET(4); ND_PRINT((ndo, " ifmtu")); INTOUT(); TRUNCRET(4); ND_PRINT((ndo, " maxmtu")); INTOUT(); TRUNCRET(4); ND_PRINT((ndo, " rwind")); INTOUT(); TRUNCRET(4); ND_PRINT((ndo, " maxpackets")); INTOUT(); } return; trunc: ND_PRINT((ndo, " [|ack]")); } Commit Message: CVE-2017-13049/Rx: add a missing bounds check for Ubik One of the case blocks in ubik_print() didn't check bounds before fetching 32 bits of packet data and could overread past the captured packet data by that amount. This fixes a buffer over-read discovered by Henri Salo from Nixu Corporation. Add a test using the capture file supplied by the reporter(s). CWE ID: CWE-125
0
62,279
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void AffineTransform::setMatrix(double a, double b, double c, double d, double e, double f) { m_transform[0] = a; m_transform[1] = b; m_transform[2] = c; m_transform[3] = d; m_transform[4] = e; m_transform[5] = f; } Commit Message: Avoid using forced layout to trigger paint invalidation for SVG containers Currently, SVG containers in the LayoutObject hierarchy force layout of their children if the transform changes. The main reason for this is to trigger paint invalidation of the subtree. In some cases - changes to the scale factor - there are other reasons to trigger layout, like computing a new scale factor for <text> or re-layout nodes with non-scaling stroke. Compute a "scale-factor change" in addition to the "transform change" already computed, then use this new signal to determine if layout should be forced for the subtree. Trigger paint invalidation using the LayoutObject flags instead. The downside to this is that paint invalidation will walk into "hidden" containers which rarely require repaint (since they are not technically visible). This will hopefully be rectified in a follow-up CL. For the testcase from 603850, this essentially eliminates the cost of layout (from ~350ms to ~0ms on authors machine; layout cost is related to text metrics recalculation), bumping frame rate significantly. BUG=603956,603850 Review-Url: https://codereview.chromium.org/1996543002 Cr-Commit-Position: refs/heads/master@{#400950} CWE ID:
0
121,204
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CameraService::BasicClient* CameraService::getClientByIdUnsafe(int cameraId) { if (cameraId < 0 || cameraId >= mNumberOfCameras) return NULL; return mClient[cameraId].unsafe_get(); } Commit Message: Camera: Disallow dumping clients directly Camera service dumps should only be initiated through ICameraService::dump. Bug: 26265403 Change-Id: If3ca4718ed74bf33ad8a416192689203029e2803 CWE ID: CWE-264
0
161,678
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool GpuProcessHost::HostIsValid(GpuProcessHost* host) { if (!host) return false; if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) || (host->valid_ && (host->software_rendering() || !GpuDataManagerImpl::GetInstance()->ShouldUseSoftwareRendering()))) { return true; } host->ForceShutdown(); return false; } Commit Message: Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not require a context to be able to generate textures when creating the GLSurfaceHandle - clearer ownership semantics that potentially allows for more robust and easier lost context handling/thumbnailing/etc., since a texture is at any given time owned by either: UI parent, mailbox, or TextureImageTransportSurface - simplify frontbuffer protection logic; the frontbuffer textures are now owned by RWHV where they are refcounted The TextureImageTransportSurface informs RenderWidgetHostView of the mailbox names for the front- and backbuffer textures by associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message. During SwapBuffers() or PostSubBuffer() cycles, it then uses produceTextureCHROMIUM() and consumeTextureCHROMIUM() to transfer ownership between renderer and browser compositor. RWHV sends back the surface_handle of the buffer being returned with the Swap ACK (or 0 if no buffer is being returned in which case TextureImageTransportSurface will allocate a new texture - note that this could be used to simply keep textures for thumbnailing). BUG=154815,139616 TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/11194042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
114,444
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void CLASS parse_cine() { unsigned off_head, off_setup, off_image, i; order = 0x4949; fseek (ifp, 4, SEEK_SET); is_raw = get2() == 2; fseek (ifp, 14, SEEK_CUR); is_raw *= get4(); off_head = get4(); off_setup = get4(); off_image = get4(); timestamp = get4(); if ((i = get4())) timestamp = i; fseek (ifp, off_head+4, SEEK_SET); raw_width = get4(); raw_height = get4(); switch (get2(),get2()) { case 8: load_raw = &CLASS eight_bit_load_raw; break; case 16: load_raw = &CLASS unpacked_load_raw; } fseek (ifp, off_setup+792, SEEK_SET); strcpy (make, "CINE"); sprintf (model, "%d", get4()); fseek (ifp, 12, SEEK_CUR); switch ((i=get4()) & 0xffffff) { case 3: filters = 0x94949494; break; case 4: filters = 0x49494949; break; default: is_raw = 0; } fseek (ifp, 72, SEEK_CUR); switch ((get4()+3600) % 360) { case 270: flip = 4; break; case 180: flip = 1; break; case 90: flip = 7; break; case 0: flip = 2; } cam_mul[0] = getreal(11); cam_mul[2] = getreal(11); maximum = ~(-1 << get4()); fseek (ifp, 668, SEEK_CUR); shutter = get4()/1000000000.0; fseek (ifp, off_image, SEEK_SET); if (shot_select < is_raw) fseek (ifp, shot_select*8, SEEK_CUR); data_offset = (INT64) get4() + 8; data_offset += (INT64) get4() << 32; } Commit Message: Avoid overflow in ljpeg_start(). CWE ID: CWE-189
0
43,335
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void xenvif_get(struct xenvif *vif) { atomic_inc(&vif->refcnt); } Commit Message: xen/netback: shutdown the ring if it contains garbage. A buggy or malicious frontend should not be able to confuse netback. If we spot anything which is not as it should be then shutdown the device and don't try to continue with the ring in a potentially hostile state. Well behaved and non-hostile frontends will not be penalised. As well as making the existing checks for such errors fatal also add a new check that ensures that there isn't an insane number of requests on the ring (i.e. more than would fit in the ring). If the ring contains garbage then previously is was possible to loop over this insane number, getting an error each time and therefore not generating any more pending requests and therefore not exiting the loop in xen_netbk_tx_build_gops for an externded period. Also turn various netdev_dbg calls which no precipitate a fatal error into netdev_err, they are rate limited because the device is shutdown afterwards. This fixes at least one known DoS/softlockup of the backend domain. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Jan Beulich <JBeulich@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID: CWE-20
0
34,026
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void add_pbase_object(struct tree_desc *tree, const char *name, int cmplen, const char *fullname) { struct name_entry entry; int cmp; while (tree_entry(tree,&entry)) { if (S_ISGITLINK(entry.mode)) continue; cmp = tree_entry_len(&entry) != cmplen ? 1 : memcmp(name, entry.path, cmplen); if (cmp > 0) continue; if (cmp < 0) return; if (name[cmplen] != '/') { add_object_entry(entry.sha1, object_type(entry.mode), fullname, 1); return; } if (S_ISDIR(entry.mode)) { struct tree_desc sub; struct pbase_tree_cache *tree; const char *down = name+cmplen+1; int downlen = name_cmp_len(down); tree = pbase_tree_get(entry.sha1); if (!tree) return; init_tree_desc(&sub, tree->tree_data, tree->tree_size); add_pbase_object(&sub, down, downlen, fullname); pbase_tree_put(tree); } } } Commit Message: list-objects: pass full pathname to callbacks When we find a blob at "a/b/c", we currently pass this to our show_object_fn callbacks as two components: "a/b/" and "c". Callbacks which want the full value then call path_name(), which concatenates the two. But this is an inefficient interface; the path is a strbuf, and we could simply append "c" to it temporarily, then roll back the length, without creating a new copy. So we could improve this by teaching the callsites of path_name() this trick (and there are only 3). But we can also notice that no callback actually cares about the broken-down representation, and simply pass each callback the full path "a/b/c" as a string. The callback code becomes even simpler, then, as we do not have to worry about freeing an allocated buffer, nor rolling back our modification to the strbuf. This is theoretically less efficient, as some callbacks would not bother to format the final path component. But in practice this is not measurable. Since we use the same strbuf over and over, our work to grow it is amortized, and we really only pay to memcpy a few bytes. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> CWE ID: CWE-119
0
54,826
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool PlatformSensorAmbientLightMac::StartSensor( const PlatformSensorConfiguration& configuration) { light_sensor_service_.reset(IOServiceGetMatchingService( kIOMasterPortDefault, IOServiceMatching("AppleLMUController"))); if (!light_sensor_service_) return false; light_sensor_port_.reset(IONotificationPortCreate(kIOMasterPortDefault)); if (!light_sensor_port_.is_valid()) return false; IONotificationPortSetDispatchQueue( light_sensor_port_.get(), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)); kern_return_t kr = IOServiceAddInterestNotification( light_sensor_port_.get(), light_sensor_service_, kIOGeneralInterest, IOServiceCallback, this, light_sensor_notification_.InitializeInto()); if (kr != KERN_SUCCESS) return false; kr = IOServiceAddInterestNotification( light_sensor_port_.get(), light_sensor_service_, kIOBusyInterest, IOServiceCallback, this, light_sensor_busy_notification_.InitializeInto()); if (kr != KERN_SUCCESS) return false; kr = IOServiceOpen(light_sensor_service_, mach_task_self(), 0, light_sensor_object_.InitializeInto()); if (kr != KERN_SUCCESS) return false; bool success = ReadAndUpdate(); if (!success) StopSensor(); return success; } Commit Message: android: Fix sensors in device service. This patch fixes a bug that prevented more than one sensor data to be available at once when using the device motion/orientation API. The issue was introduced by this other patch [1] which fixed some security-related issues in the way shared memory region handles are managed throughout Chromium (more details at https://crbug.com/789959). The device service´s sensor implementation doesn´t work correctly because it assumes it is possible to create a writable mapping of a given shared memory region at any time. This assumption is not correct on Android, once an Ashmem region has been turned read-only, such mappings are no longer possible. To fix the implementation, this CL changes the following: - PlatformSensor used to require moving a mojo::ScopedSharedBufferMapping into the newly-created instance. Said mapping being owned by and destroyed with the PlatformSensor instance. With this patch, the constructor instead takes a single pointer to the corresponding SensorReadingSharedBuffer, i.e. the area in memory where the sensor-specific reading data is located, and can be either updated or read-from. Note that the PlatformSensor does not own the mapping anymore. - PlatformSensorProviderBase holds the *single* writable mapping that is used to store all SensorReadingSharedBuffer buffers. It is created just after the region itself, and thus can be used even after the region's access mode has been changed to read-only. Addresses within the mapping will be passed to PlatformSensor constructors, computed from the mapping's base address plus a sensor-specific offset. The mapping is now owned by the PlatformSensorProviderBase instance. Note that, security-wise, nothing changes, because all mojo::ScopedSharedBufferMapping before the patch actually pointed to the same writable-page in memory anyway. Since unit or integration tests didn't catch the regression when [1] was submitted, this patch was tested manually by running a newly-built Chrome apk in the Android emulator and on a real device running Android O. [1] https://chromium-review.googlesource.com/c/chromium/src/+/805238 BUG=805146 R=mattcary@chromium.org,alexilin@chromium.org,juncai@chromium.org,reillyg@chromium.org Change-Id: I7d60a1cad278f48c361d2ece5a90de10eb082b44 Reviewed-on: https://chromium-review.googlesource.com/891180 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Reviewed-by: Matthew Cary <mattcary@chromium.org> Reviewed-by: Alexandr Ilin <alexilin@chromium.org> Cr-Commit-Position: refs/heads/master@{#532607} CWE ID: CWE-732
0
148,937
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: pdf_keep_material(fz_context *ctx, pdf_material *mat) { if (mat->colorspace) fz_keep_colorspace(ctx, mat->colorspace); if (mat->pattern) pdf_keep_pattern(ctx, mat->pattern); if (mat->shade) fz_keep_shade(ctx, mat->shade); return mat; } Commit Message: CWE ID: CWE-416
0
467
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct nfs4_setclientid_res *arg, struct rpc_cred *cred) { struct nfs_fsinfo fsinfo; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETCLIENTID_CONFIRM], .rpc_argp = arg, .rpc_resp = &fsinfo, .rpc_cred = cred, }; unsigned long now; int status; dprintk("NFS call setclientid_confirm auth=%s, (client ID %llx)\n", clp->cl_rpcclient->cl_auth->au_ops->au_name, clp->cl_clientid); now = jiffies; status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); if (status == 0) { spin_lock(&clp->cl_lock); clp->cl_lease_time = fsinfo.lease_time * HZ; clp->cl_last_renewal = now; spin_unlock(&clp->cl_lock); } dprintk("NFS reply setclientid_confirm: %d\n", status); return status; } Commit Message: NFSv4: Check for buffer length in __nfs4_get_acl_uncached Commit 1f1ea6c "NFSv4: Fix buffer overflow checking in __nfs4_get_acl_uncached" accidently dropped the checking for too small result buffer length. If someone uses getxattr on "system.nfs4_acl" on an NFSv4 mount supporting ACLs, the ACL has not been cached and the buffer suplied is too short, we still copy the complete ACL, resulting in kernel and user space memory corruption. Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Cc: stable@kernel.org Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> CWE ID: CWE-119
0
29,209
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: sec_update(uint8 * key, uint8 * update_key) { uint8 shasig[20]; RDSSL_SHA1 sha1; RDSSL_MD5 md5; RDSSL_RC4 update; rdssl_sha1_init(&sha1); rdssl_sha1_update(&sha1, update_key, g_rc4_key_len); rdssl_sha1_update(&sha1, pad_54, 40); rdssl_sha1_update(&sha1, key, g_rc4_key_len); rdssl_sha1_final(&sha1, shasig); rdssl_md5_init(&md5); rdssl_md5_update(&md5, update_key, g_rc4_key_len); rdssl_md5_update(&md5, pad_92, 48); rdssl_md5_update(&md5, shasig, 20); rdssl_md5_final(&md5, key); rdssl_rc4_set_key(&update, key, g_rc4_key_len); rdssl_rc4_crypt(&update, key, key, g_rc4_key_len); if (g_rc4_key_len == 8) sec_make_40bit(key); } Commit Message: Malicious RDP server security fixes This commit includes fixes for a set of 21 vulnerabilities in rdesktop when a malicious RDP server is used. All vulnerabilities was identified and reported by Eyal Itkin. * Add rdp_protocol_error function that is used in several fixes * Refactor of process_bitmap_updates * Fix possible integer overflow in s_check_rem() on 32bit arch * Fix memory corruption in process_bitmap_data - CVE-2018-8794 * Fix remote code execution in process_bitmap_data - CVE-2018-8795 * Fix remote code execution in process_plane - CVE-2018-8797 * Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175 * Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175 * Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176 * Fix Denial of Service in sec_recv - CVE-2018-20176 * Fix minor information leak in rdpdr_process - CVE-2018-8791 * Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792 * Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793 * Fix Denial of Service in process_bitmap_data - CVE-2018-8796 * Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798 * Fix Denial of Service in process_secondary_order - CVE-2018-8799 * Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800 * Fix major information leak in ui_clip_handle_data - CVE-2018-20174 * Fix memory corruption in rdp_in_unistr - CVE-2018-20177 * Fix Denial of Service in process_demand_active - CVE-2018-20178 * Fix remote code execution in lspci_process - CVE-2018-20179 * Fix remote code execution in rdpsnddbg_process - CVE-2018-20180 * Fix remote code execution in seamless_process - CVE-2018-20181 * Fix remote code execution in seamless_process_line - CVE-2018-20182 CWE ID: CWE-119
0
93,120
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: views::View* ProfileChooserView::CreateSyncErrorViewIfNeeded( const AvatarMenu::Item& avatar_item) { int content_string_id, button_string_id; SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(browser_->profile()); sync_ui_util::AvatarSyncErrorType error = sync_ui_util::GetMessagesForAvatarSyncError( browser_->profile(), *signin_manager, &content_string_id, &button_string_id); if (error == sync_ui_util::NO_SYNC_ERROR) return nullptr; ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); if (error != sync_ui_util::SUPERVISED_USER_AUTH_ERROR && dice_enabled_) return CreateDiceSyncErrorView(avatar_item, error, button_string_id); views::View* view = new views::View(); auto layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(kMenuEdgeMargin), provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL)); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); view->SetLayoutManager(std::move(layout)); views::ImageView* sync_problem_icon = new views::ImageView(); sync_problem_icon->SetImage( gfx::CreateVectorIcon(kSyncProblemIcon, kIconSize, gfx::kGoogleRed700)); view->AddChildView(sync_problem_icon); views::View* vertical_view = new views::View(); const int small_vertical_spacing = provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL); auto vertical_layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(), small_vertical_spacing); vertical_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); vertical_view->SetLayoutManager(std::move(vertical_layout)); views::Label* title_label = new views::Label( l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_TITLE)); title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); title_label->SetEnabledColor(gfx::kGoogleRed700); vertical_view->AddChildView(title_label); views::Label* content_label = new views::Label(l10n_util::GetStringUTF16(content_string_id)); content_label->SetMultiLine(true); content_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); vertical_view->AddChildView(content_label); if (button_string_id) { auto* padding = new views::View; padding->SetPreferredSize(gfx::Size( 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL))); vertical_view->AddChildView(padding); sync_error_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( this, l10n_util::GetStringUTF16(button_string_id)); sync_error_button_->set_id(error); vertical_view->AddChildView(sync_error_button_); view->SetBorder(views::CreateEmptyBorder(0, 0, small_vertical_spacing, 0)); } view->AddChildView(vertical_view); return view; } Commit Message: [signin] Add metrics to track the source for refresh token updated events This CL add a source for update and revoke credentials operations. It then surfaces the source in the chrome://signin-internals page. This CL also records the following histograms that track refresh token events: * Signin.RefreshTokenUpdated.ToValidToken.Source * Signin.RefreshTokenUpdated.ToInvalidToken.Source * Signin.RefreshTokenRevoked.Source These histograms are needed to validate the assumptions of how often tokens are revoked by the browser and the sources for the token revocations. Bug: 896182 Change-Id: I2fcab80ee8e5699708e695bc3289fa6d34859a90 Reviewed-on: https://chromium-review.googlesource.com/c/1286464 Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: David Roger <droger@chromium.org> Reviewed-by: Ilya Sherman <isherman@chromium.org> Commit-Queue: Mihai Sardarescu <msarda@chromium.org> Cr-Commit-Position: refs/heads/master@{#606181} CWE ID: CWE-20
0
143,149
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PDFiumEngine::FitContentsToPrintableAreaIfRequired( FPDF_DOCUMENT doc, const PP_PrintSettings_Dev& print_settings) { if (print_settings.print_scaling_option != PP_PRINTSCALINGOPTION_SOURCE_SIZE) { int num_pages = FPDF_GetPageCount(doc); for (int i = 0; i < num_pages; ++i) { FPDF_PAGE page = FPDF_LoadPage(doc, i); TransformPDFPageForPrinting(page, print_settings); FPDF_ClosePage(page); } } } Commit Message: [pdf] Use a temporary list when unloading pages When traversing the |deferred_page_unloads_| list and handling the unloads it's possible for new pages to get added to the list which will invalidate the iterator. This CL swaps the list with an empty list and does the iteration on the list copy. New items that are unloaded while handling the defers will be unloaded at a later point. Bug: 780450 Change-Id: Ic7ced1c82227109784fb536ce19a4dd51b9119ac Reviewed-on: https://chromium-review.googlesource.com/758916 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#515056} CWE ID: CWE-416
0
146,110
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: inline float square(float n) { return n * n; } Commit Message: [skia] not all convex paths are convex, so recompute convexity for the problematic ones https://bugs.webkit.org/show_bug.cgi?id=75960 Reviewed by Stephen White. No new tests. See related chrome issue http://code.google.com/p/chromium/issues/detail?id=108605 * platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::setPathFromConvexPoints): git-svn-id: svn://svn.chromium.org/blink/trunk@104609 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-19
0
107,611
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline int expires_gt(u64 expires, u64 new_exp) { return expires == 0 || expires > new_exp; } Commit Message: posix-timers: Sanitize overrun handling The posix timer overrun handling is broken because the forwarding functions can return a huge number of overruns which does not fit in an int. As a consequence timer_getoverrun(2) and siginfo::si_overrun can turn into random number generators. The k_clock::timer_forward() callbacks return a 64 bit value now. Make k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal accounting is correct. 3Remove the temporary (int) casts. Add a helper function which clamps the overrun value returned to user space via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value between 0 and INT_MAX. INT_MAX is an indicator for user space that the overrun value has been clamped. Reported-by: Team OWL337 <icytxw@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Link: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de CWE ID: CWE-190
0
81,106
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static char *get_next_cgroup_dir(const char *taskcg, const char *querycg) { char *start, *end; if (strlen(taskcg) <= strlen(querycg)) { fprintf(stderr, "%s: I was fed bad input\n", __func__); return NULL; } if (strcmp(querycg, "/") == 0) start = strdup(taskcg + 1); else start = strdup(taskcg + strlen(querycg) + 1); if (!start) return NULL; end = strchr(start, '/'); if (end) *end = '\0'; return start; } Commit Message: Fix checking of parent directories Taken from the justification in the launchpad bug: To a task in freezer cgroup /a/b/c/d, it should appear that there are no cgroups other than its descendents. Since this is a filesystem, we must have the parent directories, but each parent cgroup should only contain the child which the task can see. So, when this task looks at /a/b, it should see only directory 'c' and no files. Attempt to create /a/b/x should result in -EPERM, whether /a/b/x already exists or not. Attempts to query /a/b/x should result in -ENOENT whether /a/b/x exists or not. Opening /a/b/tasks should result in -ENOENT. The caller_may_see_dir checks specifically whether a task may see a cgroup directory - i.e. /a/b/x if opening /a/b/x/tasks, and /a/b/c/d if doing opendir('/a/b/c/d'). caller_is_in_ancestor() will return true if the caller in /a/b/c/d looks at /a/b/c/d/e. If the caller is in a child cgroup of the queried one - i.e. if the task in /a/b/c/d queries /a/b, then *nextcg will container the next (the only) directory which he can see in the path - 'c'. Beyond this, regular DAC permissions should apply, with the root-in-user-namespace privilege over its mapped uids being respected. The fc_may_access check does this check for both directories and files. This is CVE-2015-1342 (LP: #1508481) Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> CWE ID: CWE-264
0
44,452
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int StreamTcp3whsQueueSynAck(TcpSession *ssn, Packet *p) { /* first see if this is already in our list */ if (StreamTcp3whsFindSynAckBySynAck(ssn, p) != NULL) return 0; if (ssn->queue_len == stream_config.max_synack_queued) { SCLogDebug("ssn %p: =~ SYN/ACK queue limit reached", ssn); StreamTcpSetEvent(p, STREAM_3WHS_SYNACK_FLOOD); return -1; } if (StreamTcpCheckMemcap((uint32_t)sizeof(TcpStateQueue)) == 0) { SCLogDebug("ssn %p: =~ SYN/ACK queue failed: stream memcap reached", ssn); return -1; } TcpStateQueue *q = SCMalloc(sizeof(*q)); if (unlikely(q == NULL)) { SCLogDebug("ssn %p: =~ SYN/ACK queue failed: alloc failed", ssn); return -1; } memset(q, 0x00, sizeof(*q)); StreamTcpIncrMemuse((uint64_t)sizeof(TcpStateQueue)); StreamTcp3whsSynAckToStateQueue(p, q); /* put in list */ q->next = ssn->queue; ssn->queue = q; ssn->queue_len++; return 0; } Commit Message: stream: support RST getting lost/ignored In case of a valid RST on a SYN, the state is switched to 'TCP_CLOSED'. However, the target of the RST may not have received it, or may not have accepted it. Also, the RST may have been injected, so the supposed sender may not actually be aware of the RST that was sent in it's name. In this case the previous behavior was to switch the state to CLOSED and accept no further TCP updates or stream reassembly. This patch changes this. It still switches the state to CLOSED, as this is by far the most likely to be correct. However, it will reconsider the state if the receiver continues to talk. To do this on each state change the previous state will be recorded in TcpSession::pstate. If a non-RST packet is received after a RST, this TcpSession::pstate is used to try to continue the conversation. If the (supposed) sender of the RST is also continueing the conversation as normal, it's highly likely it didn't send the RST. In this case a stream event is generated. Ticket: #2501 Reported-By: Kirill Shipulin CWE ID:
0
79,175
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void QQuickWebViewPrivate::didChangeBackForwardList() { navigationHistory->d->reset(); } Commit Message: [Qt][WK2] Allow transparent WebViews https://bugs.webkit.org/show_bug.cgi?id=80608 Reviewed by Tor Arne Vestbø. Added support for transparentBackground in QQuickWebViewExperimental. This uses the existing drawsTransparentBackground property in WebKit2. Also, changed LayerTreeHostQt to set the contentsOpaque flag when the root layer changes, otherwise the change doesn't take effect. A new API test was added. * UIProcess/API/qt/qquickwebview.cpp: (QQuickWebViewPrivate::setTransparentBackground): (QQuickWebViewPrivate::transparentBackground): (QQuickWebViewExperimental::transparentBackground): (QQuickWebViewExperimental::setTransparentBackground): * UIProcess/API/qt/qquickwebview_p.h: * UIProcess/API/qt/qquickwebview_p_p.h: (QQuickWebViewPrivate): * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: (tst_QQuickWebView): (tst_QQuickWebView::transparentWebViews): * WebProcess/WebPage/qt/LayerTreeHostQt.cpp: (WebKit::LayerTreeHostQt::LayerTreeHostQt): (WebKit::LayerTreeHostQt::setRootCompositingLayer): git-svn-id: svn://svn.chromium.org/blink/trunk@110254 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-189
0
101,690
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: struct hid_device *hid_allocate_device(void) { struct hid_device *hdev; int ret = -ENOMEM; hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); if (hdev == NULL) return ERR_PTR(ret); device_initialize(&hdev->dev); hdev->dev.release = hid_device_release; hdev->dev.bus = &hid_bus_type; device_enable_async_suspend(&hdev->dev); hid_close_report(hdev); init_waitqueue_head(&hdev->debug_wait); INIT_LIST_HEAD(&hdev->debug_list); spin_lock_init(&hdev->debug_list_lock); sema_init(&hdev->driver_lock, 1); sema_init(&hdev->driver_input_lock, 1); return hdev; } Commit Message: HID: core: prevent out-of-bound readings Plugging a Logitech DJ receiver with KASAN activated raises a bunch of out-of-bound readings. The fields are allocated up to MAX_USAGE, meaning that potentially, we do not have enough fields to fit the incoming values. Add checks and silence KASAN. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> CWE ID: CWE-125
0
49,480
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebContentsImpl::GetCurrentlyPlayingVideoSizes() { return cached_video_sizes_; } Commit Message: If JavaScript shows a dialog, cause the page to lose fullscreen. BUG=670135, 550017, 726761, 728276 Review-Url: https://codereview.chromium.org/2906133004 Cr-Commit-Position: refs/heads/master@{#478884} CWE ID: CWE-20
0
135,707
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool AXLayoutObject::isLinked() const { if (!isLinkable(*this)) return false; Element* anchor = anchorElement(); if (!isHTMLAnchorElement(anchor)) return false; return !toHTMLAnchorElement(*anchor).href().isEmpty(); } Commit Message: Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858} CWE ID: CWE-254
0
127,056
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: cmsBool AddConversion(cmsPipeline* Result, cmsColorSpaceSignature InPCS, cmsColorSpaceSignature OutPCS, cmsMAT3* m, cmsVEC3* off) { cmsFloat64Number* m_as_dbl = (cmsFloat64Number*) m; cmsFloat64Number* off_as_dbl = (cmsFloat64Number*) off; switch (InPCS) { case cmsSigXYZData: // Input profile operates in XYZ switch (OutPCS) { case cmsSigXYZData: // XYZ -> XYZ if (!IsEmptyLayer(m, off) && !cmsPipelineInsertStage(Result, cmsAT_END, cmsStageAllocMatrix(Result ->ContextID, 3, 3, m_as_dbl, off_as_dbl))) return FALSE; break; case cmsSigLabData: // XYZ -> Lab if (!IsEmptyLayer(m, off) && !cmsPipelineInsertStage(Result, cmsAT_END, cmsStageAllocMatrix(Result ->ContextID, 3, 3, m_as_dbl, off_as_dbl))) return FALSE; if (!cmsPipelineInsertStage(Result, cmsAT_END, _cmsStageAllocXYZ2Lab(Result ->ContextID))) return FALSE; break; default: return FALSE; // Colorspace mismatch } break; case cmsSigLabData: // Input profile operates in Lab switch (OutPCS) { case cmsSigXYZData: // Lab -> XYZ if (!cmsPipelineInsertStage(Result, cmsAT_END, _cmsStageAllocLab2XYZ(Result ->ContextID))) return FALSE; if (!IsEmptyLayer(m, off) && !cmsPipelineInsertStage(Result, cmsAT_END, cmsStageAllocMatrix(Result ->ContextID, 3, 3, m_as_dbl, off_as_dbl))) return FALSE; break; case cmsSigLabData: // Lab -> Lab if (!IsEmptyLayer(m, off)) { if (!cmsPipelineInsertStage(Result, cmsAT_END, _cmsStageAllocLab2XYZ(Result ->ContextID)) || !cmsPipelineInsertStage(Result, cmsAT_END, cmsStageAllocMatrix(Result ->ContextID, 3, 3, m_as_dbl, off_as_dbl)) || !cmsPipelineInsertStage(Result, cmsAT_END, _cmsStageAllocXYZ2Lab(Result ->ContextID))) return FALSE; } break; default: return FALSE; // Mismatch } break; default: if (InPCS != OutPCS) return FALSE; break; } return TRUE; } Commit Message: Fix a double free on error recovering CWE ID:
0
58,417
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderViewHostImpl::JavaScriptDialogClosed(IPC::Message* reply_msg, bool success, const string16& user_input) { GetProcess()->SetIgnoreInputEvents(false); bool is_waiting = is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; if (is_waiting) { StartHangMonitorTimeout(TimeDelta::FromMilliseconds( success ? kUnloadTimeoutMS : hung_renderer_delay_ms_)); } ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, user_input); Send(reply_msg); if (is_waiting && are_javascript_messages_suppressed_) delegate_->RendererUnresponsive(this, is_waiting); } Commit Message: 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 CWE ID:
0
117,213
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void Direct_Move_Y( EXEC_OPS PGlyph_Zone zone, Int point, TT_F26Dot6 distance ) { (void)exc; zone->cur_y[point] += distance; zone->touch[point] |= TT_Flag_Touched_Y; } Commit Message: CWE ID: CWE-125
0
5,355
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void pdf_run_y(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x3, float y3) { pdf_run_processor *pr = (pdf_run_processor *)proc; fz_curvetoy(ctx, pr->path, x1, y1, x3, y3); } Commit Message: CWE ID: CWE-416
0
551
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static Value* LoadJSONFile(const std::string& filename) { FilePath path = GetTestFilePath(filename); std::string error; JSONFileValueSerializer serializer(path); Value* value = serializer.Deserialize(NULL, &error); EXPECT_TRUE(value) << "Parse error " << path.value() << ": " << error; return value; } Commit Message: 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 CWE ID:
0
104,638
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Browser::UpdateCommandsForBookmarkEditing() { bool enabled = profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled) && browser_defaults::bookmarks_enabled; command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, enabled && is_type_tabbed()); command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, enabled && CanBookmarkAllTabs()); } Commit Message: Implement a bubble that appears at the top of the screen when a tab enters fullscreen mode via webkitRequestFullScreen(), telling the user how to exit fullscreen. This is implemented as an NSView rather than an NSWindow because the floating chrome that appears in presentation mode should overlap the bubble. Content-initiated fullscreen mode makes use of 'presentation mode' on the Mac: the mode in which the UI is hidden, accessible by moving the cursor to the top of the screen. On Snow Leopard, this mode is synonymous with fullscreen mode. On Lion, however, fullscreen mode does not imply presentation mode: in non-presentation fullscreen mode, the chrome is permanently shown. It is possible to switch between presentation mode and fullscreen mode using the presentation mode UI control. When a tab initiates fullscreen mode on Lion, we enter presentation mode if not in presentation mode already. When the user exits fullscreen mode using Chrome UI (i.e. keyboard shortcuts, menu items, buttons, switching tabs, etc.) we return the user to the mode they were in before the tab entered fullscreen. BUG=14471 TEST=Enter fullscreen mode using webkitRequestFullScreen. You should see a bubble pop down from the top of the screen. Need to test the Lion logic somehow, with no Lion trybots. BUG=96883 Original review http://codereview.chromium.org/7890056/ TBR=thakis Review URL: http://codereview.chromium.org/7920024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101624 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
0
97,420
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Document::setXMLVersion(const String& version, ExceptionState& exception_state) { if (!XMLDocumentParser::SupportsXMLVersion(version)) { exception_state.ThrowDOMException( kNotSupportedError, "This document does not support the XML version '" + version + "'."); return; } xml_version_ = version; } Commit Message: Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the existing csp constraints such as the related bug Bug: 747847 Change-Id: I1e57b50da17f65d38088205b0a3c7c49ef2ae4d8 Reviewed-on: https://chromium-review.googlesource.com/592027 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Andy Paicu <andypaicu@chromium.org> Cr-Commit-Position: refs/heads/master@{#492333} CWE ID: CWE-732
0
134,237
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int net_read_exact(int s, void *arg, int len) { ssize_t rc; int rlen = 0; char *buf = (char*)arg; while (rlen < len) { rc = recv(s, buf, (len - rlen), 0); if (rc < 1) { if (rc == -1 && (errno == EAGAIN || errno == EINTR)) { usleep(100); continue; } return -1; } buf += rc; rlen += rc; } return 0; } Commit Message: OSdep: Fixed segmentation fault that happens with a malicious server sending a negative length (Closes #16 on GitHub). git-svn-id: http://svn.aircrack-ng.org/trunk@2419 28c6078b-6c39-48e3-add9-af49d547ecab CWE ID: CWE-20
0
74,658
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SetUpCacheWithVariousFiles() { CreateFile(persistent_directory_.AppendASCII("id_foo.md5foo")); CreateFile(persistent_directory_.AppendASCII("id_bar.local")); CreateFile(persistent_directory_.AppendASCII("id_baz.local")); CreateFile(persistent_directory_.AppendASCII("id_bad.md5bad")); CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), persistent_directory_.AppendASCII("id_symlink")); CreateFile(tmp_directory_.AppendASCII("id_qux.md5qux")); CreateFile(tmp_directory_.AppendASCII("id_quux.local")); CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), tmp_directory_.AppendASCII("id_symlink_tmp")); CreateSymbolicLink(persistent_directory_.AppendASCII("id_foo.md5foo"), pinned_directory_.AppendASCII("id_foo")); CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), pinned_directory_.AppendASCII("id_corge")); CreateSymbolicLink(persistent_directory_.AppendASCII("id_dangling.md5foo"), pinned_directory_.AppendASCII("id_dangling")); CreateSymbolicLink(tmp_directory_.AppendASCII("id_qux.md5qux"), pinned_directory_.AppendASCII("id_outside")); CreateFile(pinned_directory_.AppendASCII("id_not_symlink")); CreateSymbolicLink(persistent_directory_.AppendASCII("id_bar.local"), outgoing_directory_.AppendASCII("id_bar")); CreateSymbolicLink(persistent_directory_.AppendASCII("id_foo.md5foo"), outgoing_directory_.AppendASCII("id_foo")); } Commit Message: Revert 144993 - gdata: Remove invalid files in the cache directories Broke linux_chromeos_valgrind: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20%28valgrind%29%285%29/builds/8628/steps/memory%20test%3A%20unit/logs/stdio In theory, we shouldn't have any invalid files left in the cache directories, but things can go wrong and invalid files may be left if the device shuts down unexpectedly, for instance. Besides, it's good to be defensive. BUG=134862 TEST=added unit tests Review URL: https://chromiumcodereview.appspot.com/10693020 TBR=satorux@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145029 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
1
170,872
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool PDFiumEngine::SelectFindResult(bool forward) { if (find_results_.empty()) { NOTREACHED(); return false; } SelectionChangeInvalidator selection_invalidator(this); size_t new_index; const size_t last_index = find_results_.size() - 1; if (current_find_index_.valid()) { size_t current_index = current_find_index_.GetIndex(); if (forward) { new_index = (current_index >= last_index) ? 0 : current_index + 1; } else { new_index = (current_find_index_.GetIndex() == 0) ? last_index : current_index - 1; } } else { new_index = forward ? 0 : last_index; } current_find_index_.SetIndex(new_index); selection_.clear(); selection_.push_back(find_results_[current_find_index_.GetIndex()]); pp::Rect bounding_rect; pp::Rect visible_rect = GetVisibleRect(); std::vector<pp::Rect> rects; rects = find_results_[current_find_index_.GetIndex()].GetScreenRects( pp::Point(), 1.0, current_rotation_); for (const auto& rect : rects) bounding_rect = bounding_rect.Union(rect); if (!visible_rect.Contains(bounding_rect)) { pp::Point center = bounding_rect.CenterPoint(); int new_y = static_cast<int>(center.y() * current_zoom_) - static_cast<int>(visible_rect.height() * current_zoom_ / 2); if (new_y < 0) new_y = 0; client_->ScrollToY(new_y); if (center.x() < visible_rect.x() || center.x() > visible_rect.right()) { int new_x = static_cast<int>(center.x() * current_zoom_) - static_cast<int>(visible_rect.width() * current_zoom_ / 2); if (new_x < 0) new_x = 0; client_->ScrollToX(new_x); } } client_->NotifySelectedFindResultChanged(current_find_index_.GetIndex()); return true; } Commit Message: [pdf] Defer page unloading in JS callback. One of the callbacks from PDFium JavaScript into the embedder is to get the current page number. In Chromium, this will trigger a call to CalculateMostVisiblePage that method will determine the visible pages and unload any non-visible pages. But, if the originating JS is on a non-visible page we'll delete the page and annotations associated with that page. This will cause issues as we are currently working with those objects when the JavaScript returns. This Cl defers the page unloading triggered by getting the most visible page until the next event is handled by the Chromium embedder. BUG=chromium:653090 Review-Url: https://codereview.chromium.org/2418533002 Cr-Commit-Position: refs/heads/master@{#424781} CWE ID: CWE-416
0
140,420
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int cdrom_is_dvd_rw(struct cdrom_device_info *cdi) { switch (cdi->mmc3_profile) { case 0x12: /* DVD-RAM */ case 0x1A: /* DVD+RW */ case 0x43: /* BD-RE */ return 0; default: return 1; } } Commit Message: cdrom: fix improper type cast, which can leat to information leak. There is another cast from unsigned long to int which causes a bounds check to fail with specially crafted input. The value is then used as an index in the slot array in cdrom_slot_status(). This issue is similar to CVE-2018-16658 and CVE-2018-10940. Signed-off-by: Young_X <YangX92@hotmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> CWE ID: CWE-200
0
76,246
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, GLsizei height) { state_.viewport_x = x; state_.viewport_y = y; state_.viewport_width = std::min(width, viewport_max_width_); state_.viewport_height = std::min(height, viewport_max_height_); glViewport(x, y, width, height); } Commit Message: 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 R=kbr@chromium.org,bajones@chromium.org Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
0
120,879
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void license_generate_hwid(rdpLicense* license) { CryptoMd5 md5; BYTE* mac_address; ZeroMemory(license->HardwareId, HWID_LENGTH); mac_address = license->rdp->transport->TcpIn->mac_address; md5 = crypto_md5_init(); crypto_md5_update(md5, mac_address, 6); crypto_md5_final(md5, &license->HardwareId[HWID_PLATFORM_ID_LENGTH]); } Commit Message: Fix possible integer overflow in license_read_scope_list() CWE ID: CWE-189
0
39,552
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static BOOL update_send_surface_frame_marker(rdpContext* context, const SURFACE_FRAME_MARKER* surfaceFrameMarker) { wStream* s; rdpRdp* rdp = context->rdp; BOOL ret = FALSE; update_force_flush(context); s = fastpath_update_pdu_init(rdp->fastpath); if (!s) return FALSE; if (!update_write_surfcmd_frame_marker(s, surfaceFrameMarker->frameAction, surfaceFrameMarker->frameId) || !fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, FALSE)) goto out_fail; update_force_flush(context); ret = TRUE; out_fail: Stream_Release(s); return ret; } Commit Message: Fixed CVE-2018-8786 Thanks to Eyal Itkin from Check Point Software Technologies. CWE ID: CWE-119
0
83,613
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int mxf_compute_index_tables(MXFContext *mxf) { int i, j, k, ret, nb_sorted_segments; MXFIndexTableSegment **sorted_segments = NULL; AVStream *st = NULL; for (i = 0; i < mxf->fc->nb_streams; i++) { if (mxf->fc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_DATA) continue; st = mxf->fc->streams[i]; break; } if ((ret = mxf_get_sorted_table_segments(mxf, &nb_sorted_segments, &sorted_segments)) || nb_sorted_segments <= 0) { av_log(mxf->fc, AV_LOG_WARNING, "broken or empty index\n"); return 0; } /* sanity check and count unique BodySIDs/IndexSIDs */ for (i = 0; i < nb_sorted_segments; i++) { if (i == 0 || sorted_segments[i-1]->index_sid != sorted_segments[i]->index_sid) mxf->nb_index_tables++; else if (sorted_segments[i-1]->body_sid != sorted_segments[i]->body_sid) { av_log(mxf->fc, AV_LOG_ERROR, "found inconsistent BodySID\n"); ret = AVERROR_INVALIDDATA; goto finish_decoding_index; } } mxf->index_tables = av_mallocz_array(mxf->nb_index_tables, sizeof(*mxf->index_tables)); if (!mxf->index_tables) { av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n"); ret = AVERROR(ENOMEM); goto finish_decoding_index; } /* distribute sorted segments to index tables */ for (i = j = 0; i < nb_sorted_segments; i++) { if (i != 0 && sorted_segments[i-1]->index_sid != sorted_segments[i]->index_sid) { /* next IndexSID */ j++; } mxf->index_tables[j].nb_segments++; } for (i = j = 0; j < mxf->nb_index_tables; i += mxf->index_tables[j++].nb_segments) { MXFIndexTable *t = &mxf->index_tables[j]; t->segments = av_mallocz_array(t->nb_segments, sizeof(*t->segments)); if (!t->segments) { av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment" " pointer array\n"); ret = AVERROR(ENOMEM); goto finish_decoding_index; } if (sorted_segments[i]->index_start_position) av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i starts at EditUnit %"PRId64" - seeking may not work as expected\n", sorted_segments[i]->index_sid, sorted_segments[i]->index_start_position); memcpy(t->segments, &sorted_segments[i], t->nb_segments * sizeof(MXFIndexTableSegment*)); t->index_sid = sorted_segments[i]->index_sid; t->body_sid = sorted_segments[i]->body_sid; if ((ret = mxf_compute_ptses_fake_index(mxf, t)) < 0) goto finish_decoding_index; /* fix zero IndexDurations */ for (k = 0; k < t->nb_segments; k++) { if (t->segments[k]->index_duration) continue; if (t->nb_segments > 1) av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i segment %i has zero IndexDuration and there's more than one segment\n", t->index_sid, k); if (!st) { av_log(mxf->fc, AV_LOG_WARNING, "no streams?\n"); break; } /* assume the first stream's duration is reasonable * leave index_duration = 0 on further segments in case we have any (unlikely) */ t->segments[k]->index_duration = st->duration; break; } } ret = 0; finish_decoding_index: av_free(sorted_segments); return ret; } Commit Message: avformat/mxfdec: Fix DoS issues in mxf_read_index_entry_array() Fixes: 20170829A.mxf Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com> Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> CWE ID: CWE-834
0
61,567
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DocumentInit DocumentInit::CreateWithImportsController( HTMLImportsController* controller) { DCHECK(controller); Document* master = controller->Master(); return DocumentInit(controller) .WithContextDocument(master->ContextDocument()) .WithRegistrationContext(master->RegistrationContext()); } Commit Message: Inherit CSP when self-navigating to local-scheme URL As the linked bug example shows, we should inherit CSP when we navigate to a local-scheme URL (even if we are in a main browsing context). Bug: 799747 Change-Id: I8413aa8e8049461ebcf0ffbf7b04c41d1340af02 Reviewed-on: https://chromium-review.googlesource.com/c/1234337 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Andy Paicu <andypaicu@chromium.org> Cr-Commit-Position: refs/heads/master@{#597889} CWE ID:
0
144,064
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void DevToolsWindow::Show(const DevToolsToggleAction& action) { if (IsDocked()) { Browser* inspected_browser = NULL; int inspected_tab_index = -1; if (!IsInspectedBrowserPopup() && FindInspectedBrowserAndTabIndex(&inspected_browser, &inspected_tab_index)) { BrowserWindow* inspected_window = inspected_browser->window(); web_contents_->SetDelegate(this); inspected_window->UpdateDevTools(); web_contents_->GetView()->SetInitialFocus(); inspected_window->Show(); TabStripModel* tab_strip_model = inspected_browser->tab_strip_model(); tab_strip_model->ActivateTabAt(inspected_tab_index, true); PrefsTabHelper::CreateForWebContents(web_contents_); GetRenderViewHost()->SyncRendererPrefs(); ScheduleAction(action); return; } dock_side_ = DEVTOOLS_DOCK_SIDE_UNDOCKED; } bool should_show_window = !browser_ || (action.type() != DevToolsToggleAction::kInspect); if (!browser_) CreateDevToolsBrowser(); if (should_show_window) { browser_->window()->Show(); web_contents_->GetView()->SetInitialFocus(); } ScheduleAction(action); } Commit Message: DevTools: handle devtools renderer unresponsiveness during beforeunload event interception This patch fixes the crash which happenes under the following conditions: 1. DevTools window is in undocked state 2. DevTools renderer is unresponsive 3. User attempts to close inspected page BUG=322380 Review URL: https://codereview.chromium.org/84883002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237611 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-264
0
113,207
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_wowl_wakeind_le wake_ind_le; struct cfg80211_wowlan_wakeup wakeup_data; struct cfg80211_wowlan_wakeup *wakeup; u32 wakeind; s32 err; int timeout; err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le, sizeof(wake_ind_le)); if (err) { brcmf_err("Get wowl_wakeind failed, err = %d\n", err); return; } wakeind = le32_to_cpu(wake_ind_le.ucode_wakeind); if (wakeind & (BRCMF_WOWL_MAGIC | BRCMF_WOWL_DIS | BRCMF_WOWL_BCN | BRCMF_WOWL_RETR | BRCMF_WOWL_NET | BRCMF_WOWL_PFN_FOUND)) { wakeup = &wakeup_data; memset(&wakeup_data, 0, sizeof(wakeup_data)); wakeup_data.pattern_idx = -1; if (wakeind & BRCMF_WOWL_MAGIC) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_MAGIC\n"); wakeup_data.magic_pkt = true; } if (wakeind & BRCMF_WOWL_DIS) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_DIS\n"); wakeup_data.disconnect = true; } if (wakeind & BRCMF_WOWL_BCN) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_BCN\n"); wakeup_data.disconnect = true; } if (wakeind & BRCMF_WOWL_RETR) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_RETR\n"); wakeup_data.disconnect = true; } if (wakeind & BRCMF_WOWL_NET) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_NET\n"); /* For now always map to pattern 0, no API to get * correct information available at the moment. */ wakeup_data.pattern_idx = 0; } if (wakeind & BRCMF_WOWL_PFN_FOUND) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_PFN_FOUND\n"); timeout = wait_event_timeout(cfg->wowl.nd_data_wait, cfg->wowl.nd_data_completed, BRCMF_ND_INFO_TIMEOUT); if (!timeout) brcmf_err("No result for wowl net detect\n"); else wakeup_data.net_detect = cfg->wowl.nd_info; } if (wakeind & BRCMF_WOWL_GTK_FAILURE) { brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_GTK_FAILURE\n"); wakeup_data.gtk_rekey_failure = true; } } else { wakeup = NULL; } cfg80211_report_wowlan_wakeup(&ifp->vif->wdev, wakeup, GFP_KERNEL); } Commit Message: brcmfmac: avoid potential stack overflow in brcmf_cfg80211_start_ap() User-space can choose to omit NL80211_ATTR_SSID and only provide raw IE TLV data. When doing so it can provide SSID IE with length exceeding the allowed size. The driver further processes this IE copying it into a local variable without checking the length. Hence stack can be corrupted and used as exploit. Cc: stable@vger.kernel.org # v4.7 Reported-by: Daxing Guo <freener.gdx@gmail.com> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> Reviewed-by: Franky Lin <franky.lin@broadcom.com> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> CWE ID: CWE-119
0
49,105
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ResourceDispatcherHostImpl::OnCertificateRequested( net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { DCHECK(request); if (delegate_ && !delegate_->AcceptSSLClientCertificateRequest( request, cert_request_info)) { request->Cancel(); return; } if (cert_request_info->client_certs.empty()) { request->ContinueWithCertificate(NULL); return; } ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); DCHECK(!info->ssl_client_auth_handler()) << "OnCertificateRequested called with ssl_client_auth_handler pending"; info->set_ssl_client_auth_handler( new SSLClientAuthHandler(request, cert_request_info)); info->ssl_client_auth_handler()->SelectCertificate(); } Commit Message: Inherits SupportsWeakPtr<T> instead of having WeakPtrFactory<T> This change refines r137676. BUG=122654 TEST=browser_test Review URL: https://chromiumcodereview.appspot.com/10332233 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139771 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
0
107,890
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: TestOneShotGestureSequenceTimer() {} Commit Message: Pass ui::LatencyInfo correct with unified gesture detector on Aura. BUG=379812 TEST=GestureRecognizerTest.LatencyPassedFromTouchEvent Review URL: https://codereview.chromium.org/309823002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274602 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID:
0
112,090
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WebRuntimeFeatures::EnableSharedArrayBuffer(bool enable) { RuntimeEnabledFeatures::SetSharedArrayBufferEnabled(enable); } Commit Message: Remove RequireCSSExtensionForFile runtime enabled flag. The feature has long since been stable (since M64) and doesn't seem to be a need for this flag. BUG=788936 Change-Id: I666390b869289c328acb4a2daa5bf4154e1702c0 Reviewed-on: https://chromium-review.googlesource.com/c/1324143 Reviewed-by: Mike West <mkwst@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Cr-Commit-Position: refs/heads/master@{#607329} CWE ID: CWE-254
0
154,681
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static uint8_t *smbXcli_iov_concat(TALLOC_CTX *mem_ctx, const struct iovec *iov, int count) { ssize_t buflen; uint8_t *buf; buflen = iov_buflen(iov, count); if (buflen == -1) { return NULL; } buf = talloc_array(mem_ctx, uint8_t, buflen); if (buf == NULL) { return NULL; } iov_buf(iov, count, buf, buflen); return buf; } Commit Message: CWE ID: CWE-20
0
2,476
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; int64_t pos = avio_tell(pb); int has_h264 = 0, has_video = 0; int minor = 0x200; int i; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (is_cover_image(st)) continue; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) has_video = 1; if (st->codecpar->codec_id == AV_CODEC_ID_H264) has_h264 = 1; } avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "ftyp"); if (mov->major_brand && strlen(mov->major_brand) >= 4) ffio_wfourcc(pb, mov->major_brand); else if (mov->mode == MODE_3GP) { ffio_wfourcc(pb, has_h264 ? "3gp6" : "3gp4"); minor = has_h264 ? 0x100 : 0x200; } else if (mov->mode & MODE_3G2) { ffio_wfourcc(pb, has_h264 ? "3g2b" : "3g2a"); minor = has_h264 ? 0x20000 : 0x10000; } else if (mov->mode == MODE_PSP) ffio_wfourcc(pb, "MSNV"); else if (mov->mode == MODE_MP4 && mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) ffio_wfourcc(pb, "iso5"); // Required when using default-base-is-moof else if (mov->mode == MODE_MP4 && mov->flags & FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS) ffio_wfourcc(pb, "iso4"); else if (mov->mode == MODE_MP4) ffio_wfourcc(pb, "isom"); else if (mov->mode == MODE_IPOD) ffio_wfourcc(pb, has_video ? "M4V ":"M4A "); else if (mov->mode == MODE_ISM) ffio_wfourcc(pb, "isml"); else if (mov->mode == MODE_F4V) ffio_wfourcc(pb, "f4v "); else ffio_wfourcc(pb, "qt "); avio_wb32(pb, minor); if (mov->mode == MODE_MOV) ffio_wfourcc(pb, "qt "); else if (mov->mode == MODE_ISM) { ffio_wfourcc(pb, "piff"); } else if (!(mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF)) { ffio_wfourcc(pb, "isom"); ffio_wfourcc(pb, "iso2"); if (has_h264) ffio_wfourcc(pb, "avc1"); } if (mov->flags & FF_MOV_FLAG_FRAGMENT && mov->mode != MODE_ISM) ffio_wfourcc(pb, "iso6"); if (mov->mode == MODE_3GP) ffio_wfourcc(pb, has_h264 ? "3gp6":"3gp4"); else if (mov->mode & MODE_3G2) ffio_wfourcc(pb, has_h264 ? "3g2b":"3g2a"); else if (mov->mode == MODE_PSP) ffio_wfourcc(pb, "MSNV"); else if (mov->mode == MODE_MP4) ffio_wfourcc(pb, "mp41"); if (mov->flags & FF_MOV_FLAG_DASH && mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) ffio_wfourcc(pb, "dash"); return update_size(pb, pos); } Commit Message: avformat/movenc: Write version 2 of audio atom if channels is not known The version 1 needs the channel count and would divide by 0 Fixes: division by 0 Fixes: fpe_movenc.c_1108_1.ogg Fixes: fpe_movenc.c_1108_2.ogg Fixes: fpe_movenc.c_1108_3.wav Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> CWE ID: CWE-369
0
79,352
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: char* getlogname_malloc(void) { uid_t uid; long bufsize; char *buf, *name; struct passwd pwbuf, *pw = NULL; struct stat st; if (isatty(STDIN_FILENO) && fstat(STDIN_FILENO, &st) >= 0) uid = st.st_uid; else uid = getuid(); /* Shortcut things to avoid NSS lookups */ if (uid == 0) return strdup("root"); if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) <= 0) bufsize = 4096; if (!(buf = malloc(bufsize))) return NULL; if (getpwuid_r(uid, &pwbuf, buf, bufsize, &pw) == 0 && pw) { name = strdup(pw->pw_name); free(buf); return name; } free(buf); if (asprintf(&name, "%lu", (unsigned long) uid) < 0) return NULL; return name; } Commit Message: CWE ID: CWE-362
0
11,540
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: uint32_t GetCompressedFormatRowPitch(const CompressedFormatInfo& info, uint32_t width) { uint32_t num_blocks_wide = (width + info.block_size - 1) / info.block_size; return num_blocks_wide * info.bytes_per_block; } Commit Message: Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#657568} CWE ID: CWE-416
0
141,463
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ppmd_read(void *p) { struct archive_read *a = ((IByteIn*)p)->a; struct rar *rar = (struct rar *)(a->format->data); struct rar_br *br = &(rar->br); Byte b; if (!rar_br_read_ahead(a, br, 8)) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated RAR file data"); rar->valid = 0; return 0; } b = rar_br_bits(br, 8); rar_br_consume(br, 8); return b; } Commit Message: Issue 719: Fix for TALOS-CAN-154 A RAR file with an invalid zero dictionary size was not being rejected, leading to a zero-sized allocation for the dictionary storage which was then overwritten during the dictionary initialization. Thanks to the Open Source and Threat Intelligence project at Cisco for reporting this. CWE ID: CWE-119
0
53,487
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: process_palette(STREAM s) { COLOURENTRY *entry; COLOURMAP map; RD_HCOLOURMAP hmap; int i; in_uint8s(s, 2); /* pad */ in_uint16_le(s, map.ncolours); in_uint8s(s, 2); /* pad */ map.colours = (COLOURENTRY *) xmalloc(sizeof(COLOURENTRY) * map.ncolours); logger(Graphics, Debug, "process_palette(), colour count %d", map.ncolours); for (i = 0; i < map.ncolours; i++) { entry = &map.colours[i]; in_uint8(s, entry->red); in_uint8(s, entry->green); in_uint8(s, entry->blue); } hmap = ui_create_colourmap(&map); ui_set_colourmap(hmap); xfree(map.colours); } Commit Message: Malicious RDP server security fixes This commit includes fixes for a set of 21 vulnerabilities in rdesktop when a malicious RDP server is used. All vulnerabilities was identified and reported by Eyal Itkin. * Add rdp_protocol_error function that is used in several fixes * Refactor of process_bitmap_updates * Fix possible integer overflow in s_check_rem() on 32bit arch * Fix memory corruption in process_bitmap_data - CVE-2018-8794 * Fix remote code execution in process_bitmap_data - CVE-2018-8795 * Fix remote code execution in process_plane - CVE-2018-8797 * Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175 * Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175 * Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176 * Fix Denial of Service in sec_recv - CVE-2018-20176 * Fix minor information leak in rdpdr_process - CVE-2018-8791 * Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792 * Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793 * Fix Denial of Service in process_bitmap_data - CVE-2018-8796 * Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798 * Fix Denial of Service in process_secondary_order - CVE-2018-8799 * Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800 * Fix major information leak in ui_clip_handle_data - CVE-2018-20174 * Fix memory corruption in rdp_in_unistr - CVE-2018-20177 * Fix Denial of Service in process_demand_active - CVE-2018-20178 * Fix remote code execution in lspci_process - CVE-2018-20179 * Fix remote code execution in rdpsnddbg_process - CVE-2018-20180 * Fix remote code execution in seamless_process - CVE-2018-20181 * Fix remote code execution in seamless_process_line - CVE-2018-20182 CWE ID: CWE-119
0
92,992
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { DCHECK_CURRENTLY_ON(BrowserThread::UI); return is_worker_ref_count_disabled_; } Commit Message: Switching AudioOutputAuthorizationHandler from using AudioManager interface to AudioSystem one. BUG=672468 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Review-Url: https://codereview.chromium.org/2692203003 Cr-Commit-Position: refs/heads/master@{#450939} CWE ID:
0
128,278
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int release_vp9_frame_buffer(void *user_priv, vpx_codec_frame_buffer_t *fb) { ExternalFrameBufferList *const fb_list = reinterpret_cast<ExternalFrameBufferList*>(user_priv); return fb_list->ReturnFrameBuffer(fb); } Commit Message: Merge Conflict Fix CL to lmp-mr1-release for ag/849478 DO NOT MERGE - libvpx: Pull from upstream Current HEAD: 7105df53d7dc13d5e575bc8df714ec8d1da36b06 BUG=23452792 Change-Id: Ic78176fc369e0bacc71d423e0e2e6075d004aaec CWE ID: CWE-119
0
164,448
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void __init sched_init(void) { int i, j; unsigned long alloc_size = 0, ptr; #ifdef CONFIG_FAIR_GROUP_SCHED alloc_size += 2 * nr_cpu_ids * sizeof(void **); #endif #ifdef CONFIG_RT_GROUP_SCHED alloc_size += 2 * nr_cpu_ids * sizeof(void **); #endif if (alloc_size) { ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT); #ifdef CONFIG_FAIR_GROUP_SCHED root_task_group.se = (struct sched_entity **)ptr; ptr += nr_cpu_ids * sizeof(void **); root_task_group.cfs_rq = (struct cfs_rq **)ptr; ptr += nr_cpu_ids * sizeof(void **); #endif /* CONFIG_FAIR_GROUP_SCHED */ #ifdef CONFIG_RT_GROUP_SCHED root_task_group.rt_se = (struct sched_rt_entity **)ptr; ptr += nr_cpu_ids * sizeof(void **); root_task_group.rt_rq = (struct rt_rq **)ptr; ptr += nr_cpu_ids * sizeof(void **); #endif /* CONFIG_RT_GROUP_SCHED */ } #ifdef CONFIG_CPUMASK_OFFSTACK for_each_possible_cpu(i) { per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node( cpumask_size(), GFP_KERNEL, cpu_to_node(i)); } #endif /* CONFIG_CPUMASK_OFFSTACK */ init_rt_bandwidth(&def_rt_bandwidth, global_rt_period(), global_rt_runtime()); init_dl_bandwidth(&def_dl_bandwidth, global_rt_period(), global_rt_runtime()); #ifdef CONFIG_SMP init_defrootdomain(); #endif #ifdef CONFIG_RT_GROUP_SCHED init_rt_bandwidth(&root_task_group.rt_bandwidth, global_rt_period(), global_rt_runtime()); #endif /* CONFIG_RT_GROUP_SCHED */ #ifdef CONFIG_CGROUP_SCHED task_group_cache = KMEM_CACHE(task_group, 0); list_add(&root_task_group.list, &task_groups); INIT_LIST_HEAD(&root_task_group.children); INIT_LIST_HEAD(&root_task_group.siblings); autogroup_init(&init_task); #endif /* CONFIG_CGROUP_SCHED */ for_each_possible_cpu(i) { struct rq *rq; rq = cpu_rq(i); raw_spin_lock_init(&rq->lock); rq->nr_running = 0; rq->calc_load_active = 0; rq->calc_load_update = jiffies + LOAD_FREQ; init_cfs_rq(&rq->cfs); init_rt_rq(&rq->rt); init_dl_rq(&rq->dl); #ifdef CONFIG_FAIR_GROUP_SCHED root_task_group.shares = ROOT_TASK_GROUP_LOAD; INIT_LIST_HEAD(&rq->leaf_cfs_rq_list); /* * How much cpu bandwidth does root_task_group get? * * In case of task-groups formed thr' the cgroup filesystem, it * gets 100% of the cpu resources in the system. This overall * system cpu resource is divided among the tasks of * root_task_group and its child task-groups in a fair manner, * based on each entity's (task or task-group's) weight * (se->load.weight). * * In other words, if root_task_group has 10 tasks of weight * 1024) and two child groups A0 and A1 (of weight 1024 each), * then A0's share of the cpu resource is: * * A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33% * * We achieve this by letting root_task_group's tasks sit * directly in rq->cfs (i.e root_task_group->se[] = NULL). */ init_cfs_bandwidth(&root_task_group.cfs_bandwidth); init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL); #endif /* CONFIG_FAIR_GROUP_SCHED */ rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime; #ifdef CONFIG_RT_GROUP_SCHED init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, NULL); #endif for (j = 0; j < CPU_LOAD_IDX_MAX; j++) rq->cpu_load[j] = 0; #ifdef CONFIG_SMP rq->sd = NULL; rq->rd = NULL; rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE; rq->balance_callback = NULL; rq->active_balance = 0; rq->next_balance = jiffies; rq->push_cpu = 0; rq->cpu = i; rq->online = 0; rq->idle_stamp = 0; rq->avg_idle = 2*sysctl_sched_migration_cost; rq->max_idle_balance_cost = sysctl_sched_migration_cost; INIT_LIST_HEAD(&rq->cfs_tasks); rq_attach_root(rq, &def_root_domain); #ifdef CONFIG_NO_HZ_COMMON rq->last_load_update_tick = jiffies; rq->nohz_flags = 0; #endif #ifdef CONFIG_NO_HZ_FULL rq->last_sched_tick = 0; #endif #endif /* CONFIG_SMP */ init_rq_hrtick(rq); atomic_set(&rq->nr_iowait, 0); } set_load_weight(&init_task); #ifdef CONFIG_PREEMPT_NOTIFIERS INIT_HLIST_HEAD(&init_task.preempt_notifiers); #endif /* * The boot idle thread does lazy MMU switching as well: */ atomic_inc(&init_mm.mm_count); enter_lazy_tlb(&init_mm, current); /* * During early bootup we pretend to be a normal task: */ current->sched_class = &fair_sched_class; /* * Make us the idle thread. Technically, schedule() should not be * called from this thread, however somewhere below it might be, * but because we are the idle thread, we just pick up running again * when this runqueue becomes "idle". */ init_idle(current, smp_processor_id()); calc_load_update = jiffies + LOAD_FREQ; #ifdef CONFIG_SMP zalloc_cpumask_var(&sched_domains_tmpmask, GFP_NOWAIT); /* May be allocated at isolcpus cmdline parse time */ if (cpu_isolated_map == NULL) zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT); idle_thread_set_boot_cpu(); set_cpu_rq_start_time(smp_processor_id()); #endif init_sched_fair_class(); init_schedstats(); scheduler_running = 1; } Commit Message: Merge branch 'stacking-fixes' (vfs stacking fixes from Jann) Merge filesystem stacking fixes from Jann Horn. * emailed patches from Jann Horn <jannh@google.com>: sched: panic on corrupted stack end ecryptfs: forbid opening files without mmap handler proc: prevent stacking filesystems on top CWE ID: CWE-119
0
55,613
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void perf_callchain_user_32(struct perf_callchain_entry *entry, struct pt_regs *regs) { unsigned int sp, next_sp; unsigned int next_ip; unsigned int lr; long level = 0; unsigned int __user *fp, *uregs; next_ip = perf_instruction_pointer(regs); lr = regs->link; sp = regs->gpr[1]; perf_callchain_store(entry, next_ip); while (entry->nr < PERF_MAX_STACK_DEPTH) { fp = (unsigned int __user *) (unsigned long) sp; if (!valid_user_sp(sp, 0) || read_user_stack_32(fp, &next_sp)) return; if (level > 0 && read_user_stack_32(&fp[1], &next_ip)) return; uregs = signal_frame_32_regs(sp, next_sp, next_ip); if (!uregs && level <= 1) uregs = signal_frame_32_regs(sp, next_sp, lr); if (uregs) { /* * This looks like an signal frame, so restart * the stack trace with the values in it. */ if (read_user_stack_32(&uregs[PT_NIP], &next_ip) || read_user_stack_32(&uregs[PT_LNK], &lr) || read_user_stack_32(&uregs[PT_R1], &sp)) return; level = 0; perf_callchain_store(entry, PERF_CONTEXT_USER); perf_callchain_store(entry, next_ip); continue; } if (level == 0) next_ip = lr; perf_callchain_store(entry, next_ip); ++level; sp = next_sp; } } Commit Message: powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH We cap 32bit userspace backtraces to PERF_MAX_STACK_DEPTH (currently 127), but we forgot to do the same for 64bit backtraces. Cc: stable@vger.kernel.org Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> CWE ID: CWE-399
0
42,181
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Response EmulationHandler::ClearDeviceMetricsOverride() { if (!device_emulation_enabled_) return Response::OK(); if (GetWebContents()) GetWebContents()->ClearDeviceEmulationSize(); else return Response::Error("Can't find the associated web contents"); device_emulation_enabled_ = false; device_emulation_params_ = blink::WebDeviceEmulationParams(); UpdateDeviceEmulationState(); return Response::FallThrough(); } Commit Message: DevTools: speculative fix for crash in NetworkHandler::Disable This keeps BrowserContext* and StoragePartition* instead of RenderProcessHost* in an attemp to resolve UAF of RenderProcessHost upon closure of DevTools front-end. Bug: 801117, 783067, 780694 Change-Id: I6c2cca60cc0c29f0949d189cf918769059f80c1b Reviewed-on: https://chromium-review.googlesource.com/876657 Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#531157} CWE ID: CWE-20
0
148,437
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool FrameLoader::shouldClose(bool isReload) { Page* page = m_frame->page(); if (!page || !page->chromeClient().canOpenBeforeUnloadConfirmPanel()) return true; HeapVector<Member<LocalFrame>> targetFrames; targetFrames.append(m_frame); for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().traverseNext(m_frame)) { if (child->isLocalFrame()) targetFrames.append(toLocalFrame(child)); } bool shouldClose = false; { NavigationDisablerForBeforeUnload navigationDisabler; size_t i; bool didAllowNavigation = false; for (i = 0; i < targetFrames.size(); i++) { if (!targetFrames[i]->tree().isDescendantOf(m_frame)) continue; if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->chromeClient(), isReload, didAllowNavigation)) break; } if (i == targetFrames.size()) shouldClose = true; } return shouldClose; } Commit Message: Disable frame navigations during DocumentLoader detach in FrameLoader::startLoad BUG=613266 Review-Url: https://codereview.chromium.org/2006033002 Cr-Commit-Position: refs/heads/master@{#396241} CWE ID: CWE-284
0
132,682
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderFrameImpl::DidStopLoading() { TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", "id", routing_id_); history_subframe_unique_names_.clear(); SendUpdateFaviconURL(); Send(new FrameHostMsg_DidStopLoading(routing_id_)); } Commit Message: Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://crbug.com/666714 locally (the bug the test was added for), and reran the test to confirm that it still covers the bug. Bug: 786836 Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270 Commit-Queue: Lowell Manners <lowell@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Cr-Commit-Position: refs/heads/master@{#653137} CWE ID: CWE-416
0
139,617
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: long keyctl_revoke_key(key_serial_t id) { key_ref_t key_ref; long ret; key_ref = lookup_user_key(id, 0, KEY_NEED_WRITE); if (IS_ERR(key_ref)) { ret = PTR_ERR(key_ref); if (ret != -EACCES) goto error; key_ref = lookup_user_key(id, 0, KEY_NEED_SETATTR); if (IS_ERR(key_ref)) { ret = PTR_ERR(key_ref); goto error; } } key_revoke(key_ref_to_ptr(key_ref)); ret = 0; key_ref_put(key_ref); error: return ret; } Commit Message: KEYS: Fix race between read and revoke This fixes CVE-2015-7550. There's a race between keyctl_read() and keyctl_revoke(). If the revoke happens between keyctl_read() checking the validity of a key and the key's semaphore being taken, then the key type read method will see a revoked key. This causes a problem for the user-defined key type because it assumes in its read method that there will always be a payload in a non-revoked key and doesn't check for a NULL pointer. Fix this by making keyctl_read() check the validity of a key after taking semaphore instead of before. I think the bug was introduced with the original keyrings code. This was discovered by a multithreaded test program generated by syzkaller (http://github.com/google/syzkaller). Here's a cleaned up version: #include <sys/types.h> #include <keyutils.h> #include <pthread.h> void *thr0(void *arg) { key_serial_t key = (unsigned long)arg; keyctl_revoke(key); return 0; } void *thr1(void *arg) { key_serial_t key = (unsigned long)arg; char buffer[16]; keyctl_read(key, buffer, 16); return 0; } int main() { key_serial_t key = add_key("user", "%", "foo", 3, KEY_SPEC_USER_KEYRING); pthread_t th[5]; pthread_create(&th[0], 0, thr0, (void *)(unsigned long)key); pthread_create(&th[1], 0, thr1, (void *)(unsigned long)key); pthread_create(&th[2], 0, thr0, (void *)(unsigned long)key); pthread_create(&th[3], 0, thr1, (void *)(unsigned long)key); pthread_join(th[0], 0); pthread_join(th[1], 0); pthread_join(th[2], 0); pthread_join(th[3], 0); return 0; } Build as: cc -o keyctl-race keyctl-race.c -lkeyutils -lpthread Run as: while keyctl-race; do :; done as it may need several iterations to crash the kernel. The crash can be summarised as: BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 IP: [<ffffffff81279b08>] user_read+0x56/0xa3 ... Call Trace: [<ffffffff81276aa9>] keyctl_read_key+0xb6/0xd7 [<ffffffff81277815>] SyS_keyctl+0x83/0xe0 [<ffffffff815dbb97>] entry_SYSCALL_64_fastpath+0x12/0x6f Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Cc: stable@vger.kernel.org Signed-off-by: James Morris <james.l.morris@oracle.com> CWE ID: CWE-362
0
57,612
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: FragmentPaintPropertyTreeBuilder( const LayoutObject& object, PaintPropertyTreeBuilderContext& full_context, PaintPropertyTreeBuilderFragmentContext& context, FragmentData& fragment_data) : object_(object), full_context_(full_context), context_(context), fragment_data_(fragment_data), properties_(fragment_data.PaintProperties()) {} Commit Message: Reland "[CI] Make paint property nodes non-ref-counted" This reverts commit 887383b30842d9d9006e11bb6932660a3cb5b1b7. Reason for revert: Retry in M69. Original change's description: > Revert "[CI] Make paint property nodes non-ref-counted" > > This reverts commit 70fc0b018c9517558b7aa2be00edf2debb449123. > > Reason for revert: Caused bugs found by clusterfuzz > > Original change's description: > > [CI] Make paint property nodes non-ref-counted > > > > Now all paint property nodes are owned by ObjectPaintProperties > > (and LocalFrameView temporarily before removing non-RLS mode). > > Others just use raw pointers or references. > > > > Bug: 833496 > > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > > Change-Id: I2d544fe153bb94698623248748df63c8aa2081ae > > Reviewed-on: https://chromium-review.googlesource.com/1031101 > > Reviewed-by: Tien-Ren Chen <trchen@chromium.org> > > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#554626} > > TBR=wangxianzhu@chromium.org,trchen@chromium.org,chrishtr@chromium.org > > Change-Id: I02bb50d6744cb81a797246a0116b677e80a3c69f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 833496,837932,837943 > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > Reviewed-on: https://chromium-review.googlesource.com/1034292 > Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> > Cr-Commit-Position: refs/heads/master@{#554653} TBR=wangxianzhu@chromium.org,trchen@chromium.org,chrishtr@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 833496, 837932, 837943 Change-Id: I0b4ef70db1f1f211ba97c30d617225355c750992 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Reviewed-on: https://chromium-review.googlesource.com/1083491 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/master@{#563930} CWE ID:
0
125,423
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h) { int pw = w, ph = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; tt_size = tag_tree_size(w, h); t = res = av_mallocz_array(tt_size, sizeof(*t)); if (!res) return NULL; while (w > 1 || h > 1) { int i, j; pw = w; ph = h; w = (w + 1) >> 1; h = (h + 1) >> 1; t2 = t + pw * ph; for (i = 0; i < ph; i++) for (j = 0; j < pw; j++) t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)]; t = t2; } t[0].parent = NULL; return res; } Commit Message: jpeg2000: fix dereferencing invalid pointers Found-by: Laurent Butti <laurentb@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> CWE ID:
0
28,072
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int sock_no_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len, int flags) { return -EOPNOTSUPP; } Commit Message: net: sock: validate data_len before allocating skb in sock_alloc_send_pskb() We need to validate the number of pages consumed by data_len, otherwise frags array could be overflowed by userspace. So this patch validate data_len and return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID: CWE-20
0
20,185
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int GetDirFilesRecursive(const std::string &DirPath, std::map<std::string, int> &_Files) { DIR* dir; if ((dir = opendir(DirPath.c_str())) != NULL) { struct dirent *ent; while ((ent = readdir(dir)) != NULL) { if (dirent_is_directory(DirPath, ent)) { if ((strcmp(ent->d_name, ".") != 0) && (strcmp(ent->d_name, "..") != 0) && (strcmp(ent->d_name, ".svn") != 0)) { std::string nextdir = DirPath + ent->d_name + "/"; if (GetDirFilesRecursive(nextdir.c_str(), _Files)) { closedir(dir); return 1; } } } else { std::string fname = DirPath + ent->d_name; _Files[fname] = 1; } } } closedir(dir); return 0; } Commit Message: Do not allow enters/returns in arguments (thanks to Fabio Carretto) CWE ID: CWE-93
0
90,916
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool PrintViewManager::BasicPrint(content::RenderFrameHost* rfh) { PrintPreviewDialogController* dialog_controller = PrintPreviewDialogController::GetInstance(); if (!dialog_controller) return false; content::WebContents* print_preview_dialog = dialog_controller->GetPrintPreviewForContents(web_contents()); if (!print_preview_dialog) return PrintNow(rfh); if (!print_preview_dialog->GetWebUI()) return false; PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( print_preview_dialog->GetWebUI()->GetController()); print_preview_ui->OnShowSystemDialog(); return true; } Commit Message: Properly clean up in PrintViewManager::RenderFrameCreated(). BUG=694382,698622 Review-Url: https://codereview.chromium.org/2742853003 Cr-Commit-Position: refs/heads/master@{#457363} CWE ID: CWE-125
0
137,574
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void nntp_delete_group_cache(struct NntpData *nntp_data) { if (!nntp_data || !nntp_data->nserv || !nntp_data->nserv->cacheable) return; #ifdef USE_HCACHE char file[PATH_MAX]; nntp_hcache_namer(nntp_data->group, file, sizeof(file)); cache_expand(file, sizeof(file), &nntp_data->nserv->conn->account, file); unlink(file); nntp_data->last_cached = 0; mutt_debug(2, "%s\n", file); #endif if (!nntp_data->bcache) { nntp_data->bcache = mutt_bcache_open(&nntp_data->nserv->conn->account, nntp_data->group); } if (nntp_data->bcache) { mutt_debug(2, "%s/*\n", nntp_data->group); mutt_bcache_list(nntp_data->bcache, nntp_bcache_delete, NULL); mutt_bcache_close(&nntp_data->bcache); } } Commit Message: sanitise cache paths Co-authored-by: JerikoOne <jeriko.one@gmx.us> CWE ID: CWE-22
0
79,467
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int megasas_reset_target(struct scsi_cmnd *scmd) { int ret; struct megasas_instance *instance; instance = (struct megasas_instance *)scmd->device->host->hostdata; if (instance->adapter_type != MFI_SERIES) ret = megasas_reset_target_fusion(scmd); else { sdev_printk(KERN_NOTICE, scmd->device, "TARGET RESET not supported\n"); ret = FAILED; } return ret; } Commit Message: scsi: megaraid_sas: return error when create DMA pool failed when create DMA pool for cmd frames failed, we should return -ENOMEM, instead of 0. In some case in: megasas_init_adapter_fusion() -->megasas_alloc_cmds() -->megasas_create_frame_pool create DMA pool failed, --> megasas_free_cmds() [1] -->megasas_alloc_cmds_fusion() failed, then goto fail_alloc_cmds. -->megasas_free_cmds() [2] we will call megasas_free_cmds twice, [1] will kfree cmd_list, [2] will use cmd_list.it will cause a problem: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = ffffffc000f70000 [00000000] *pgd=0000001fbf893003, *pud=0000001fbf893003, *pmd=0000001fbf894003, *pte=006000006d000707 Internal error: Oops: 96000005 [#1] SMP Modules linked in: CPU: 18 PID: 1 Comm: swapper/0 Not tainted task: ffffffdfb9290000 ti: ffffffdfb923c000 task.ti: ffffffdfb923c000 PC is at megasas_free_cmds+0x30/0x70 LR is at megasas_free_cmds+0x24/0x70 ... Call trace: [<ffffffc0005b779c>] megasas_free_cmds+0x30/0x70 [<ffffffc0005bca74>] megasas_init_adapter_fusion+0x2f4/0x4d8 [<ffffffc0005b926c>] megasas_init_fw+0x2dc/0x760 [<ffffffc0005b9ab0>] megasas_probe_one+0x3c0/0xcd8 [<ffffffc0004a5abc>] local_pci_probe+0x4c/0xb4 [<ffffffc0004a5c40>] pci_device_probe+0x11c/0x14c [<ffffffc00053a5e4>] driver_probe_device+0x1ec/0x430 [<ffffffc00053a92c>] __driver_attach+0xa8/0xb0 [<ffffffc000538178>] bus_for_each_dev+0x74/0xc8 [<ffffffc000539e88>] driver_attach+0x28/0x34 [<ffffffc000539a18>] bus_add_driver+0x16c/0x248 [<ffffffc00053b234>] driver_register+0x6c/0x138 [<ffffffc0004a5350>] __pci_register_driver+0x5c/0x6c [<ffffffc000ce3868>] megasas_init+0xc0/0x1a8 [<ffffffc000082a58>] do_one_initcall+0xe8/0x1ec [<ffffffc000ca7be8>] kernel_init_freeable+0x1c8/0x284 [<ffffffc0008d90b8>] kernel_init+0x1c/0xe4 Signed-off-by: Jason Yan <yanaijie@huawei.com> Acked-by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> CWE ID: CWE-476
0
90,399
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void HTMLInputElement::ParseAttribute( const AttributeModificationParams& params) { DCHECK(input_type_); DCHECK(input_type_view_); const QualifiedName& name = params.name; const AtomicString& value = params.new_value; if (name == nameAttr) { RemoveFromRadioButtonGroup(); name_ = value; AddToRadioButtonGroup(); TextControlElement::ParseAttribute(params); } else if (name == autocompleteAttr) { if (DeprecatedEqualIgnoringCase(value, "off")) { autocomplete_ = kOff; } else { if (value.IsEmpty()) autocomplete_ = kUninitialized; else autocomplete_ = kOn; } } else if (name == typeAttr) { UpdateType(); } else if (name == valueAttr) { if (!HasDirtyValue()) { if (input_type_->GetValueMode() == ValueMode::kValue) non_attribute_value_ = SanitizeValue(value); UpdatePlaceholderVisibility(); SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::FromAttribute(valueAttr)); } needs_to_update_view_value_ = true; SetNeedsValidityCheck(); input_type_->WarnIfValueIsInvalidAndElementIsVisible(value); input_type_->InRangeChanged(); input_type_view_->ValueAttributeChanged(); } else if (name == checkedAttr) { if ((!parsing_in_progress_ || !GetDocument().GetFormController().HasFormStates()) && !dirty_checkedness_) { setChecked(!value.IsNull()); dirty_checkedness_ = false; } PseudoStateChanged(CSSSelector::kPseudoDefault); } else if (name == maxlengthAttr) { SetNeedsValidityCheck(); } else if (name == minlengthAttr) { SetNeedsValidityCheck(); } else if (name == sizeAttr) { unsigned size = 0; if (value.IsEmpty() || !ParseHTMLNonNegativeInteger(value, size) || size == 0 || size > 0x7fffffffu) size = kDefaultSize; if (size_ != size) { size_ = size; if (GetLayoutObject()) GetLayoutObject() ->SetNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( LayoutInvalidationReason::kAttributeChanged); } } else if (name == altAttr) { input_type_view_->AltAttributeChanged(); } else if (name == srcAttr) { input_type_view_->SrcAttributeChanged(); } else if (name == usemapAttr || name == accesskeyAttr) { } else if (name == onsearchAttr) { SetAttributeEventListener( EventTypeNames::search, CreateAttributeEventListener(this, name, value, EventParameterName())); } else if (name == incrementalAttr) { UseCounter::Count(GetDocument(), WebFeature::kIncrementalAttribute); } else if (name == minAttr) { input_type_view_->MinOrMaxAttributeChanged(); input_type_->SanitizeValueInResponseToMinOrMaxAttributeChange(); input_type_->InRangeChanged(); SetNeedsValidityCheck(); UseCounter::Count(GetDocument(), WebFeature::kMinAttribute); } else if (name == maxAttr) { input_type_view_->MinOrMaxAttributeChanged(); input_type_->SanitizeValueInResponseToMinOrMaxAttributeChange(); input_type_->InRangeChanged(); SetNeedsValidityCheck(); UseCounter::Count(GetDocument(), WebFeature::kMaxAttribute); } else if (name == multipleAttr) { input_type_view_->MultipleAttributeChanged(); SetNeedsValidityCheck(); } else if (name == stepAttr) { input_type_view_->StepAttributeChanged(); SetNeedsValidityCheck(); UseCounter::Count(GetDocument(), WebFeature::kStepAttribute); } else if (name == patternAttr) { SetNeedsValidityCheck(); UseCounter::Count(GetDocument(), WebFeature::kPatternAttribute); } else if (name == readonlyAttr) { TextControlElement::ParseAttribute(params); input_type_view_->ReadonlyAttributeChanged(); } else if (name == listAttr) { has_non_empty_list_ = !value.IsEmpty(); if (has_non_empty_list_) { ResetListAttributeTargetObserver(); ListAttributeTargetChanged(); } UseCounter::Count(GetDocument(), WebFeature::kListAttribute); } else if (name == webkitdirectoryAttr) { TextControlElement::ParseAttribute(params); UseCounter::Count(GetDocument(), WebFeature::kPrefixedDirectoryAttribute); } else { if (name == formactionAttr) LogUpdateAttributeIfIsolatedWorldAndInDocument("input", params); TextControlElement::ParseAttribute(params); } input_type_view_->AttributeChanged(); } Commit Message: 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 <mblsha@yandex-team.ru> Reviewed-by: Pavel Feldman <pfeldman@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#542517} CWE ID:
0
126,072
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: unsigned CSSStyleSheet::insertRule(const String& rule_string, unsigned index, ExceptionState& exception_state) { if (!CanAccessRules()) { exception_state.ThrowSecurityError( "Cannot access StyleSheet to insertRule"); return 0; } DCHECK(child_rule_cssom_wrappers_.IsEmpty() || child_rule_cssom_wrappers_.size() == contents_->RuleCount()); if (index > length()) { exception_state.ThrowDOMException( DOMExceptionCode::kIndexSizeError, "The index provided (" + String::Number(index) + ") is larger than the maximum index (" + String::Number(length()) + ")."); return 0; } const CSSParserContext* context = CSSParserContext::CreateWithStyleSheet(contents_->ParserContext(), this); StyleRuleBase* rule = CSSParser::ParseRule(context, contents_.Get(), rule_string); if (!rule) { exception_state.ThrowDOMException( DOMExceptionCode::kSyntaxError, "Failed to parse the rule '" + rule_string + "'."); return 0; } RuleMutationScope mutation_scope(this); bool success = contents_->WrapperInsertRule(rule, index); if (!success) { if (rule->IsNamespaceRule()) exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, "Failed to insert the rule"); else exception_state.ThrowDOMException( DOMExceptionCode::kHierarchyRequestError, "Failed to insert the rule."); return 0; } if (!child_rule_cssom_wrappers_.IsEmpty()) child_rule_cssom_wrappers_.insert(index, Member<CSSRule>(nullptr)); return index; } Commit Message: Disallow access to opaque CSS responses. Bug: 848786 Change-Id: Ie53fbf644afdd76d7c65649a05c939c63d89b4ec Reviewed-on: https://chromium-review.googlesource.com/1088335 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#565537} CWE ID: CWE-200
0
153,965
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; enum AVStereo3DType type; int mode; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; if (atom.size < 5) { av_log(c->fc, AV_LOG_ERROR, "Empty stereoscopic video box\n"); return AVERROR_INVALIDDATA; } avio_skip(pb, 4); /* version + flags */ mode = avio_r8(pb); switch (mode) { case 0: type = AV_STEREO3D_2D; break; case 1: type = AV_STEREO3D_TOPBOTTOM; break; case 2: type = AV_STEREO3D_SIDEBYSIDE; break; default: av_log(c->fc, AV_LOG_WARNING, "Unknown st3d mode value %d\n", mode); return 0; } sc->stereo3d = av_stereo3d_alloc(); if (!sc->stereo3d) return AVERROR(ENOMEM); sc->stereo3d->type = type; return 0; } Commit Message: avformat/mov: Fix DoS in read_tfra() Fixes: Missing EOF check in loop No testcase Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> CWE ID: CWE-834
0
61,459
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void hugetlb_vm_op_open(struct vm_area_struct *vma) { struct resv_map *reservations = vma_resv_map(vma); /* * This new VMA should share its siblings reservation map if present. * The VMA will only ever have a valid reservation map pointer where * it is being copied for another still existing VMA. As that VMA * has a reference to the reservation map it cannot disappear until * after this open call completes. It is therefore safe to take a * new reference here without additional locking. */ if (reservations) kref_get(&reservations->refs); } Commit Message: hugepages: fix use after free bug in "quota" handling hugetlbfs_{get,put}_quota() are badly named. They don't interact with the general quota handling code, and they don't much resemble its behaviour. Rather than being about maintaining limits on on-disk block usage by particular users, they are instead about maintaining limits on in-memory page usage (including anonymous MAP_PRIVATE copied-on-write pages) associated with a particular hugetlbfs filesystem instance. Worse, they work by having callbacks to the hugetlbfs filesystem code from the low-level page handling code, in particular from free_huge_page(). This is a layering violation of itself, but more importantly, if the kernel does a get_user_pages() on hugepages (which can happen from KVM amongst others), then the free_huge_page() can be delayed until after the associated inode has already been freed. If an unmount occurs at the wrong time, even the hugetlbfs superblock where the "quota" limits are stored may have been freed. Andrew Barry proposed a patch to fix this by having hugepages, instead of storing a pointer to their address_space and reaching the superblock from there, had the hugepages store pointers directly to the superblock, bumping the reference count as appropriate to avoid it being freed. Andrew Morton rejected that version, however, on the grounds that it made the existing layering violation worse. This is a reworked version of Andrew's patch, which removes the extra, and some of the existing, layering violation. It works by introducing the concept of a hugepage "subpool" at the lower hugepage mm layer - that is a finite logical pool of hugepages to allocate from. hugetlbfs now creates a subpool for each filesystem instance with a page limit set, and a pointer to the subpool gets added to each allocated hugepage, instead of the address_space pointer used now. The subpool has its own lifetime and is only freed once all pages in it _and_ all other references to it (i.e. superblocks) are gone. subpools are optional - a NULL subpool pointer is taken by the code to mean that no subpool limits are in effect. Previous discussion of this bug found in: "Fix refcounting in hugetlbfs quota handling.". See: https://lkml.org/lkml/2011/8/11/28 or http://marc.info/?l=linux-mm&m=126928970510627&w=1 v2: Fixed a bug spotted by Hillf Danton, and removed the extra parameter to alloc_huge_page() - since it already takes the vma, it is not necessary. Signed-off-by: Andrew Barry <abarry@cray.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Cc: Hugh Dickins <hughd@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Hillf Danton <dhillf@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-399
0
20,247
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_ctr_crypt_128bit(&twofish_ctr, desc, dst, src, nbytes); } Commit Message: crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> CWE ID: CWE-264
0
47,061
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SoundPool::setRate(int channelID, float rate) { ALOGV("setRate(%d, %f)", channelID, rate); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setRate(rate); } } Commit Message: DO NOT MERGE SoundPool: add lock for findSample access from SoundPoolThread Sample decoding still occurs in SoundPoolThread without holding the SoundPool lock. Bug: 25781119 Change-Id: I11fde005aa9cf5438e0390a0d2dfe0ec1dd282e8 CWE ID: CWE-264
0
161,920
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int git_index_snapshot_new(git_vector *snap, git_index *index) { int error; GIT_REFCOUNT_INC(index); git_atomic_inc(&index->readers); git_vector_sort(&index->entries); error = git_vector_dup(snap, &index->entries, index->entries._cmp); if (error < 0) git_index_free(index); return error; } Commit Message: index: convert `read_entry` to return entry size via an out-param The function `read_entry` does not conform to our usual coding style of returning stuff via the out parameter and to use the return value for reporting errors. Due to most of our code conforming to that pattern, it has become quite natural for us to actually return `-1` in case there is any error, which has also slipped in with commit 5625d86b9 (index: support index v4, 2016-05-17). As the function returns an `size_t` only, though, the return value is wrapped around, causing the caller of `read_tree` to continue with an invalid index entry. Ultimately, this can lead to a double-free. Improve code and fix the bug by converting the function to return the index entry size via an out parameter and only using the return value to indicate errors. Reported-by: Krishna Ram Prakash R <krp@gtux.in> Reported-by: Vivek Parikh <viv0411.parikh@gmail.com> CWE ID: CWE-415
0
83,706
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static uint8_t ics_info(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld, uint8_t common_window) { uint8_t retval = 0; uint8_t ics_reserved_bit; ics_reserved_bit = faad_get1bit(ld DEBUGVAR(1,43,"ics_info(): ics_reserved_bit")); if (ics_reserved_bit != 0) return 32; ics->window_sequence = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,44,"ics_info(): window_sequence")); ics->window_shape = faad_get1bit(ld DEBUGVAR(1,45,"ics_info(): window_shape")); #ifdef LD_DEC /* No block switching in LD */ if ((hDecoder->object_type == LD) && (ics->window_sequence != ONLY_LONG_SEQUENCE)) return 32; #endif if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { ics->max_sfb = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,46,"ics_info(): max_sfb (short)")); ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 DEBUGVAR(1,47,"ics_info(): scale_factor_grouping")); } else { ics->max_sfb = (uint8_t)faad_getbits(ld, 6 DEBUGVAR(1,48,"ics_info(): max_sfb (long)")); } /* get the grouping information */ if ((retval = window_grouping_info(hDecoder, ics)) > 0) return retval; /* should be an error */ /* check the range of max_sfb */ if (ics->max_sfb > ics->num_swb) return 16; if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) { if ((ics->predictor_data_present = faad_get1bit(ld DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1) { if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ { uint8_t sfb; uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index)); #ifdef MAIN_DEC ics->pred.limit = limit; #endif if (( #ifdef MAIN_DEC ics->pred.predictor_reset = #endif faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) { #ifdef MAIN_DEC ics->pred.predictor_reset_group_number = #endif (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number")); } for (sfb = 0; sfb < limit; sfb++) { #ifdef MAIN_DEC ics->pred.prediction_used[sfb] = #endif faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used")); } } #ifdef LTP_DEC else { /* Long Term Prediction */ if (hDecoder->object_type < ER_OBJECT_START) { if ((ics->ltp.data_present = faad_get1bit(ld DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) { if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) { return retval; } } if (common_window) { if ((ics->ltp2.data_present = faad_get1bit(ld DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1) { if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0) { return retval; } } } } #ifdef ERROR_RESILIENCE if (!common_window && (hDecoder->object_type >= ER_OBJECT_START)) { if ((ics->ltp.data_present = faad_get1bit(ld DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) { ltp_data(hDecoder, ics, &(ics->ltp), ld); } } #endif } #endif } } return retval; } Commit Message: Fix a couple buffer overflows https://hackerone.com/reports/502816 https://hackerone.com/reports/507858 https://github.com/videolan/vlc/blob/master/contrib/src/faad2/faad2-fix-overflows.patch CWE ID: CWE-119
0
88,383
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool WorkerProcessLauncherTest::LaunchProcessAndConnect( IPC::Listener* delegate, ScopedHandle* process_exit_event_out) { if (!LaunchProcess(delegate, process_exit_event_out)) return false; task_runner_->PostTask( FROM_HERE, base::Bind(&WorkerProcessLauncherTest::ConnectChannel, base::Unretained(this))); return true; } Commit Message: Validate and report peer's PID to WorkerProcessIpcDelegate so it will be able to duplicate handles to and from the worker process. As a side effect WorkerProcessLauncher::Delegate is now responsible for retrieving the client's PID and deciding whether a launch failed due to a permanent error condition. BUG=134694 Review URL: https://chromiumcodereview.appspot.com/11143025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162778 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-399
0
118,821
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int handle_vmoff(struct kvm_vcpu *vcpu) { if (!nested_vmx_check_permission(vcpu)) return 1; free_nested(to_vmx(vcpu)); skip_emulated_instruction(vcpu); nested_vmx_succeed(vcpu); return 1; } Commit Message: 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 <luto@amacapital.net> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Cc: stable@vger.kernel.org Cc: Petr Matousek <pmatouse@redhat.com> Cc: Gleb Natapov <gleb@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-399
0
37,093
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int log_service_states(int type, time_t *timestamp) { char *temp_buffer = NULL; service *temp_service = NULL; host *temp_host = NULL;; /* bail if we shouldn't be logging initial states */ if(type == INITIAL_STATES && log_initial_states == FALSE) return OK; for(temp_service = service_list; temp_service != NULL; temp_service = temp_service->next) { /* find the associated host */ if((temp_host = temp_service->host_ptr) == NULL) continue; asprintf(&temp_buffer, "%s SERVICE STATE: %s;%s;%s;%s;%d;%s\n", (type == INITIAL_STATES) ? "INITIAL" : "CURRENT", temp_service->host_name, temp_service->description, service_state_name(temp_service->current_state), state_type_name(temp_service->state_type), temp_service->current_attempt, temp_service->plugin_output); write_to_all_logs_with_timestamp(temp_buffer, NSLOG_INFO_MESSAGE, timestamp); my_free(temp_buffer); } return OK; } Commit Message: Merge branch 'maint' CWE ID: CWE-264
0
48,166
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static jobject android_net_wifi_getScanResults( JNIEnv *env, jclass cls, jint iface, jboolean flush) { JNIHelper helper(env); wifi_cached_scan_results scan_data[64]; int num_scan_data = 64; wifi_interface_handle handle = getIfaceHandle(helper, cls, iface); byte b = flush ? 0xFF : 0; int result = hal_fn.wifi_get_cached_gscan_results(handle, b, num_scan_data, scan_data, &num_scan_data); if (result == WIFI_SUCCESS) { JNIObject<jobjectArray> scanData = helper.createObjectArray( "android/net/wifi/WifiScanner$ScanData", num_scan_data); if (scanData == NULL) { ALOGE("Error in allocating array of scanData"); return NULL; } for (int i = 0; i < num_scan_data; i++) { JNIObject<jobject> data = helper.createObject("android/net/wifi/WifiScanner$ScanData"); if (data == NULL) { ALOGE("Error in allocating scanData"); return NULL; } helper.setIntField(data, "mId", scan_data[i].scan_id); helper.setIntField(data, "mFlags", scan_data[i].flags); /* sort all scan results by timestamp */ qsort(scan_data[i].results, scan_data[i].num_results, sizeof(wifi_scan_result), compare_scan_result_timestamp); JNIObject<jobjectArray> scanResults = helper.createObjectArray( "android/net/wifi/ScanResult", scan_data[i].num_results); if (scanResults == NULL) { ALOGE("Error in allocating scanResult array"); return NULL; } wifi_scan_result *results = scan_data[i].results; for (int j = 0; j < scan_data[i].num_results; j++) { JNIObject<jobject> scanResult = createScanResult(helper, &results[j]); if (scanResult == NULL) { ALOGE("Error in creating scan result"); return NULL; } helper.setObjectArrayElement(scanResults, j, scanResult); } helper.setObjectField(data, "mResults", "[Landroid/net/wifi/ScanResult;", scanResults); helper.setObjectArrayElement(scanData, i, data); } return scanData.detach(); } else { return NULL; } } Commit Message: Deal correctly with short strings The parseMacAddress function anticipates only properly formed MAC addresses (6 hexadecimal octets separated by ":"). This change properly deals with situations where the string is shorter than expected, making sure that the passed in char* reference in parseHexByte never exceeds the end of the string. BUG: 28164077 TEST: Added a main function: int main(int argc, char **argv) { unsigned char addr[6]; if (argc > 1) { memset(addr, 0, sizeof(addr)); parseMacAddress(argv[1], addr); printf("Result: %02x:%02x:%02x:%02x:%02x:%02x\n", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); } } Tested with "", "a" "ab" "ab:c" "abxc". Change-Id: I0db8d0037e48b62333d475296a45b22ab0efe386 CWE ID: CWE-200
0
159,076
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int setup_pts(int pts) { char target[PATH_MAX]; if (!pts) return 0; if (!access("/dev/pts/ptmx", F_OK) && umount("/dev/pts")) { SYSERROR("failed to umount 'dev/pts'"); return -1; } if (mkdir("/dev/pts", 0755)) { if ( errno != EEXIST ) { SYSERROR("failed to create '/dev/pts'"); return -1; } } if (mount("devpts", "/dev/pts", "devpts", MS_MGC_VAL, "newinstance,ptmxmode=0666,mode=0620,gid=5")) { SYSERROR("failed to mount a new instance of '/dev/pts'"); return -1; } if (access("/dev/ptmx", F_OK)) { if (!symlink("/dev/pts/ptmx", "/dev/ptmx")) goto out; SYSERROR("failed to symlink '/dev/pts/ptmx'->'/dev/ptmx'"); return -1; } if (realpath("/dev/ptmx", target) && !strcmp(target, "/dev/pts/ptmx")) goto out; /* fallback here, /dev/pts/ptmx exists just mount bind */ if (mount("/dev/pts/ptmx", "/dev/ptmx", "none", MS_BIND, 0)) { SYSERROR("mount failed '/dev/pts/ptmx'->'/dev/ptmx'"); return -1; } INFO("created new pts instance"); out: return 0; } Commit Message: CVE-2015-1335: Protect container mounts against symlinks When a container starts up, lxc sets up the container's inital fstree by doing a bunch of mounting, guided by the container configuration file. The container config is owned by the admin or user on the host, so we do not try to guard against bad entries. However, since the mount target is in the container, it's possible that the container admin could divert the mount with symbolic links. This could bypass proper container startup (i.e. confinement of a root-owned container by the restrictive apparmor policy, by diverting the required write to /proc/self/attr/current), or bypass the (path-based) apparmor policy by diverting, say, /proc to /mnt in the container. To prevent this, 1. do not allow mounts to paths containing symbolic links 2. do not allow bind mounts from relative paths containing symbolic links. Details: Define safe_mount which ensures that the container has not inserted any symbolic links into any mount targets for mounts to be done during container setup. The host's mount path may contain symbolic links. As it is under the control of the administrator, that's ok. So safe_mount begins the check for symbolic links after the rootfs->mount, by opening that directory. It opens each directory along the path using openat() relative to the parent directory using O_NOFOLLOW. When the target is reached, it mounts onto /proc/self/fd/<targetfd>. Use safe_mount() in mount_entry(), when mounting container proc, and when needed. In particular, safe_mount() need not be used in any case where: 1. the mount is done in the container's namespace 2. the mount is for the container's rootfs 3. the mount is relative to a tmpfs or proc/sysfs which we have just safe_mount()ed ourselves Since we were using proc/net as a temporary placeholder for /proc/sys/net during container startup, and proc/net is a symbolic link, use proc/tty instead. Update the lxc.container.conf manpage with details about the new restrictions. Finally, add a testcase to test some symbolic link possibilities. Reported-by: Roman Fiedler Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com> CWE ID: CWE-59
0
44,645
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static const char *ssl_authz_require_ssl_parse(cmd_parms *cmd, const char *require_line, const void **parsed) { if (require_line && require_line[0]) return "'Require ssl' does not take arguments"; return NULL; } Commit Message: modssl: reset client-verify state when renegotiation is aborted git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1750779 13f79535-47bb-0310-9956-ffa450edef68 CWE ID: CWE-284
0
52,460
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Document::Shutdown() { TRACE_EVENT0("blink", "Document::shutdown"); CHECK(!frame_ || frame_->Tree().ChildCount() == 0); if (!IsActive()) return; FrameNavigationDisabler navigation_disabler(*frame_); HTMLFrameOwnerElement::PluginDisposeSuspendScope suspend_plugin_dispose; ScriptForbiddenScope forbid_script; lifecycle_.AdvanceTo(DocumentLifecycle::kStopping); View()->Dispose(); CHECK(!View()->IsAttached()); HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner(); if (owner_element) owner_element->SetEmbeddedContentView(nullptr); markers_->PrepareForDestruction(); if (GetPage()) GetPage()->DocumentDetached(this); probe::documentDetached(this); if (frame_->Client()->GetSharedWorkerRepositoryClient()) frame_->Client()->GetSharedWorkerRepositoryClient()->DocumentDetached(this); if (scripted_animation_controller_) scripted_animation_controller_->ClearDocumentPointer(); scripted_animation_controller_.Clear(); scripted_idle_task_controller_.Clear(); if (SvgExtensions()) AccessSVGExtensions().PauseAnimations(); if (dom_window_) dom_window_->ClearEventQueue(); if (layout_view_) layout_view_->SetIsInWindow(false); if (RegistrationContext()) RegistrationContext()->DocumentWasDetached(); MutationObserver::CleanSlotChangeList(*this); hover_element_ = nullptr; active_element_ = nullptr; autofocus_element_ = nullptr; if (focused_element_.Get()) { Element* old_focused_element = focused_element_; focused_element_ = nullptr; if (GetPage()) GetPage()->GetChromeClient().FocusedNodeChanged(old_focused_element, nullptr); } sequential_focus_navigation_starting_point_ = nullptr; if (this == &AXObjectCacheOwner()) ClearAXObjectCache(); layout_view_ = nullptr; ContainerNode::DetachLayoutTree(); CHECK(!View()->IsAttached()); if (this != &AXObjectCacheOwner()) { if (AXObjectCache* cache = ExistingAXObjectCache()) { for (Node& node : NodeTraversal::DescendantsOf(*this)) { cache->Remove(&node); } } } GetStyleEngine().DidDetach(); GetPage()->GetEventHandlerRegistry().DocumentDetached(*this); DocumentShutdownNotifier::NotifyContextDestroyed(); SynchronousMutationNotifier::NotifyContextDestroyed(); if (!Loader()) fetcher_->ClearContext(); if (imports_controller_) { imports_controller_->Dispose(); ClearImportsController(); } timers_.SetTimerTaskRunner( Platform::Current()->CurrentThread()->Scheduler()->TimerTaskRunner()); if (media_query_matcher_) media_query_matcher_->DocumentDetached(); lifecycle_.AdvanceTo(DocumentLifecycle::kStopped); CHECK(!View()->IsAttached()); ExecutionContext::NotifyContextDestroyed(); CHECK(!View()->IsAttached()); frame_ = nullptr; document_outlive_time_reporter_ = WTF::WrapUnique(new DocumentOutliveTimeReporter(this)); } Commit Message: Fixed bug where PlzNavigate CSP in a iframe did not get the inherited CSP When inheriting the CSP from a parent document to a local-scheme CSP, it does not always get propagated to the PlzNavigate CSP. This means that PlzNavigate CSP checks (like `frame-src`) would be ran against a blank policy instead of the proper inherited policy. Bug: 778658 Change-Id: I61bb0d432e1cea52f199e855624cb7b3078f56a9 Reviewed-on: https://chromium-review.googlesource.com/765969 Commit-Queue: Andy Paicu <andypaicu@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#518245} CWE ID: CWE-732
0
146,776
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Settings* DocumentInit::GetSettings() const { DCHECK(MasterDocumentLoader()); return MasterDocumentLoader()->GetFrame()->GetSettings(); } Commit Message: Inherit CSP when self-navigating to local-scheme URL As the linked bug example shows, we should inherit CSP when we navigate to a local-scheme URL (even if we are in a main browsing context). Bug: 799747 Change-Id: I8413aa8e8049461ebcf0ffbf7b04c41d1340af02 Reviewed-on: https://chromium-review.googlesource.com/c/1234337 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Andy Paicu <andypaicu@chromium.org> Cr-Commit-Position: refs/heads/master@{#597889} CWE ID:
0
144,069
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Browser::Cut() { UserMetrics::RecordAction(UserMetricsAction("Cut"), profile_); window()->Cut(); } Commit Message: chromeos: fix bug where "aw snap" page replaces first tab if it was a NTP when closing window with > 1 tab. BUG=chromium-os:12088 TEST=verify bug per bug report. Review URL: http://codereview.chromium.org/6882058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83031 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-20
0
98,221
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int php_zip_status_sys(struct zip *za TSRMLS_DC) /* {{{ */ { int zep, syp; zip_error_get(za, &zep, &syp); return syp; } /* }}} */ Commit Message: Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize CWE ID: CWE-416
0
51,308
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void HandleInitialize(const base::ListValue* args) { LoadAuthExtension(); } Commit Message: Display confirmation dialog for untrusted signins BUG=252062 Review URL: https://chromiumcodereview.appspot.com/17482002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208520 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-200
0
112,629
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: InputHandlerProxy::RouteToTypeSpecificHandler( const WebInputEvent& event, const LatencyInfo& original_latency_info) { DCHECK(input_handler_); if (force_input_to_main_thread_) return DID_NOT_HANDLE; if (IsGestureScroll(event.GetType()) && (snap_fling_controller_->FilterEventForSnap( GestureScrollEventType(event.GetType())))) { return DROP_EVENT; } switch (event.GetType()) { case WebInputEvent::kMouseWheel: return HandleMouseWheel(static_cast<const WebMouseWheelEvent&>(event)); case WebInputEvent::kGestureScrollBegin: return HandleGestureScrollBegin( static_cast<const WebGestureEvent&>(event)); case WebInputEvent::kGestureScrollUpdate: return HandleGestureScrollUpdate( static_cast<const WebGestureEvent&>(event)); case WebInputEvent::kGestureScrollEnd: return HandleGestureScrollEnd(static_cast<const WebGestureEvent&>(event)); case WebInputEvent::kGesturePinchBegin: { DCHECK(!gesture_pinch_in_progress_); input_handler_->PinchGestureBegin(); gesture_pinch_in_progress_ = true; return DID_HANDLE; } case WebInputEvent::kGesturePinchEnd: { DCHECK(gesture_pinch_in_progress_); gesture_pinch_in_progress_ = false; const WebGestureEvent& gesture_event = static_cast<const WebGestureEvent&>(event); input_handler_->PinchGestureEnd( gfx::ToFlooredPoint(gesture_event.PositionInWidget()), gesture_event.SourceDevice() == blink::WebGestureDevice::kTouchpad); return DID_HANDLE; } case WebInputEvent::kGesturePinchUpdate: { DCHECK(gesture_pinch_in_progress_); const WebGestureEvent& gesture_event = static_cast<const WebGestureEvent&>(event); input_handler_->PinchGestureUpdate( gesture_event.data.pinch_update.scale, gfx::ToFlooredPoint(gesture_event.PositionInWidget())); return DID_HANDLE; } case WebInputEvent::kTouchStart: return HandleTouchStart(static_cast<const WebTouchEvent&>(event)); case WebInputEvent::kTouchMove: return HandleTouchMove(static_cast<const WebTouchEvent&>(event)); case WebInputEvent::kTouchEnd: return HandleTouchEnd(static_cast<const WebTouchEvent&>(event)); case WebInputEvent::kMouseDown: { const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); if (mouse_event.button == blink::WebMouseEvent::Button::kLeft) { CHECK(input_handler_); cc::InputHandlerPointerResult pointer_result = input_handler_->MouseDown( gfx::PointF(mouse_event.PositionInWidget())); if (pointer_result.type == cc::PointerResultType::kScrollbarScroll) { InjectScrollbarGestureScroll(WebInputEvent::Type::kGestureScrollBegin, mouse_event.PositionInWidget(), pointer_result, original_latency_info, mouse_event.TimeStamp()); InjectScrollbarGestureScroll( WebInputEvent::Type::kGestureScrollUpdate, mouse_event.PositionInWidget(), pointer_result, original_latency_info, mouse_event.TimeStamp()); return DROP_EVENT; } } return DID_NOT_HANDLE; } case WebInputEvent::kMouseUp: { const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); if (mouse_event.button == blink::WebMouseEvent::Button::kLeft) { CHECK(input_handler_); cc::InputHandlerPointerResult pointer_result = input_handler_->MouseUp( gfx::PointF(mouse_event.PositionInWidget())); if (pointer_result.type == cc::PointerResultType::kScrollbarScroll) { InjectScrollbarGestureScroll(WebInputEvent::Type::kGestureScrollEnd, mouse_event.PositionInWidget(), pointer_result, original_latency_info, mouse_event.TimeStamp()); return DROP_EVENT; } } return DID_NOT_HANDLE; } case WebInputEvent::kMouseMove: { const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); CHECK(input_handler_); cc::InputHandlerPointerResult pointer_result = input_handler_->MouseMoveAt( gfx::Point(mouse_event.PositionInWidget().x, mouse_event.PositionInWidget().y)); if (pointer_result.type == cc::PointerResultType::kScrollbarScroll) { InjectScrollbarGestureScroll(WebInputEvent::Type::kGestureScrollUpdate, mouse_event.PositionInWidget(), pointer_result, original_latency_info, mouse_event.TimeStamp()); return DROP_EVENT; } return DID_NOT_HANDLE; } case WebInputEvent::kMouseLeave: { CHECK(input_handler_); input_handler_->MouseLeave(); return DID_NOT_HANDLE; } case WebInputEvent::kGestureFlingStart: case WebInputEvent::kGestureFlingCancel: NOTREACHED(); break; default: break; } return DID_NOT_HANDLE; } Commit Message: Revert "Add explicit flag for compositor scrollbar injected gestures" This reverts commit d9a56afcbdf9850bc39bb3edb56d07d11a1eb2b2. Reason for revert: Findit (https://goo.gl/kROfz5) identified CL at revision 669086 as the culprit for flakes in the build cycles as shown on: https://analysis.chromium.org/p/chromium/flake-portal/analysis/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyQwsSDEZsYWtlQ3VscHJpdCIxY2hyb21pdW0vZDlhNTZhZmNiZGY5ODUwYmMzOWJiM2VkYjU2ZDA3ZDExYTFlYjJiMgw Sample Failed Build: https://ci.chromium.org/buildbot/chromium.chromiumos/linux-chromeos-rel/25818 Sample Failed Step: content_browsertests on Ubuntu-16.04 Sample Flaky Test: ScrollLatencyScrollbarBrowserTest.ScrollbarThumbDragLatency Original change's description: > Add explicit flag for compositor scrollbar injected gestures > > The original change to enable scrollbar latency for the composited > scrollbars incorrectly used an existing member to try and determine > whether a GestureScrollUpdate was the first one in an injected sequence > or not. is_first_gesture_scroll_update_ was incorrect because it is only > updated when input is actually dispatched to InputHandlerProxy, and the > flag is cleared for all GSUs before the location where it was being > read. > > This bug was missed because of incorrect tests. The > VerifyRecordedSamplesForHistogram method doesn't actually assert or > expect anything - the return value must be inspected. > > As part of fixing up the tests, I made a few other changes to get them > passing consistently across all platforms: > - turn on main thread scrollbar injection feature (in case it's ever > turned off we don't want the tests to start failing) > - enable mock scrollbars > - disable smooth scrolling > - don't run scrollbar tests on Android > > The composited scrollbar button test is disabled due to a bug in how > the mock theme reports its button sizes, which throws off the region > detection in ScrollbarLayerImplBase::IdentifyScrollbarPart (filed > crbug.com/974063 for this issue). > > Change-Id: Ie1a762a5f6ecc264d22f0256db68f141fc76b950 > > Bug: 954007 > Change-Id: Ib258e08e083e79da90ba2e4e4216e4879cf00cf7 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1652741 > Commit-Queue: Daniel Libby <dlibby@microsoft.com> > Reviewed-by: David Bokan <bokan@chromium.org> > Cr-Commit-Position: refs/heads/master@{#669086} Change-Id: Icc743e48fa740fe27f0cb0cfa21b209a696f518c No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 954007 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660114 Cr-Commit-Position: refs/heads/master@{#669150} CWE ID: CWE-281
0
137,982
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: _uiserver_decrypt (void *engine, int verify, gpgme_data_t ciph, gpgme_data_t plain) { engine_uiserver_t uiserver = engine; gpgme_error_t err; const char *protocol; char *cmd; if (!uiserver) return gpg_error (GPG_ERR_INV_VALUE); if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT) protocol = ""; else if (uiserver->protocol == GPGME_PROTOCOL_OpenPGP) protocol = " --protocol=OpenPGP"; else if (uiserver->protocol == GPGME_PROTOCOL_CMS) protocol = " --protocol=CMS"; else return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); if (asprintf (&cmd, "DECRYPT%s%s", protocol, verify ? "" : " --no-verify") < 0) return gpg_error_from_syserror (); uiserver->input_cb.data = ciph; err = uiserver_set_fd (uiserver, INPUT_FD, map_data_enc (uiserver->input_cb.data)); if (err) { free (cmd); return gpg_error (GPG_ERR_GENERAL); /* FIXME */ } uiserver->output_cb.data = plain; err = uiserver_set_fd (uiserver, OUTPUT_FD, 0); if (err) { free (cmd); return gpg_error (GPG_ERR_GENERAL); /* FIXME */ } uiserver->inline_data = NULL; err = start (engine, cmd); free (cmd); return err; } Commit Message: CWE ID: CWE-119
0
12,290