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: static jas_image_t *jpg_mkimage(j_decompress_ptr cinfo) { jas_image_t *image; int cmptno; jas_image_cmptparm_t cmptparm; int numcmpts; JAS_DBGLOG(10, ("jpg_mkimage(%p)\n", cinfo)); image = 0; numcmpts = cinfo->output_components; if (!(image = jas_image_create0())) { goto error; } for (cmptno = 0; cmptno < numcmpts; ++cmptno) { if (cinfo->image_width > JAS_IMAGE_COORD_MAX || cinfo->image_height > JAS_IMAGE_COORD_MAX) { goto error; } cmptparm.tlx = 0; cmptparm.tly = 0; cmptparm.hstep = 1; cmptparm.vstep = 1; cmptparm.width = cinfo->image_width; cmptparm.height = cinfo->image_height; cmptparm.prec = 8; cmptparm.sgnd = false; if (jas_image_addcmpt(image, cmptno, &cmptparm)) { goto error; } } if (numcmpts == 3) { jas_image_setclrspc(image, JAS_CLRSPC_SRGB); jas_image_setcmpttype(image, 0, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R)); jas_image_setcmpttype(image, 1, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G)); jas_image_setcmpttype(image, 2, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B)); } else { jas_image_setclrspc(image, JAS_CLRSPC_SGRAY); jas_image_setcmpttype(image, 0, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y)); } return image; error: if (image) { jas_image_destroy(image); } return 0; } Commit Message: The generation of the configuration file jas_config.h has been completely reworked in order to avoid pollution of the global namespace. Some problematic types like uchar, ulong, and friends have been replaced with names with a jas_ prefix. An option max_samples has been added to the BMP and JPEG decoders to restrict the maximum size of image that they can decode. This change was made as a (possibly temporary) fix to address security concerns. A max_samples command-line option has also been added to imginfo. Whether an image component (for jas_image_t) is stored in memory or on disk is now based on the component size (rather than the image size). Some debug log message were added. Some new integer overflow checks were added. Some new safe integer add/multiply functions were added. More pre-C99 cruft was removed. JasPer has numerous "hacks" to handle pre-C99 compilers. JasPer now assumes C99 support. So, this pre-C99 cruft is unnecessary and can be removed. The regression jasper-doublefree-mem_close.jpg has been re-enabled. Theoretically, it should work more predictably now. CWE ID: CWE-190
0
72,936
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: ext2_init_acl(struct inode *inode, struct inode *dir) { struct posix_acl *default_acl, *acl; int error; error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); if (error) return error; if (default_acl) { error = ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); posix_acl_release(default_acl); } if (acl) { if (!error) error = ext2_set_acl(inode, acl, ACL_TYPE_ACCESS); posix_acl_release(acl); } return error; } Commit Message: posix_acl: Clear SGID bit when setting file permissions When file permissions are modified via chmod(2) and the user is not in the owning group or capable of CAP_FSETID, the setgid bit is cleared in inode_change_ok(). Setting a POSIX ACL via setxattr(2) sets the file permissions as well as the new ACL, but doesn't clear the setgid bit in a similar way; this allows to bypass the check in chmod(2). Fix that. References: CVE-2016-7097 Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> CWE ID: CWE-285
0
50,325
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::DoVertexAttrib1f(GLuint index, GLfloat v0) { GLfloat v[4] = { v0, 0.0f, 0.0f, 1.0f, }; if (SetVertexAttribValue("glVertexAttrib1f", index, v)) { state_.SetGenericVertexAttribBaseType( index, SHADER_VARIABLE_FLOAT); api()->glVertexAttrib1fFn(index, v0); } } 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,408
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 *extract_html(char *buffer, size_t size_buffer) { char *end = buffer + size_buffer; char *cur; for (cur = buffer; cur + 3 < end; cur++) if (*cur == '\r' && *(cur+1) == '\n' && *(cur+2) == '\r' && *(cur+3) == '\n') return cur + 4; return NULL; } Commit Message: Fix buffer overflow in extract_status_code() Issue #960 identified that the buffer allocated for copying the HTTP status code could overflow if the http response was corrupted. This commit changes the way the status code is read, avoids copying data, and also ensures that the status code is three digits long, is non-negative and occurs on the first line of the response. Signed-off-by: Quentin Armitage <quentin@armitage.org.uk> CWE ID: CWE-119
0
75,789
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: status_t CameraClient::startRecordingMode() { LOG1("startRecordingMode"); status_t result = NO_ERROR; if (mHardware->recordingEnabled()) { return NO_ERROR; } if (!mHardware->previewEnabled()) { result = startPreviewMode(); if (result != NO_ERROR) { return result; } } enableMsgType(CAMERA_MSG_VIDEO_FRAME); mCameraService->playSound(CameraService::SOUND_RECORDING); result = mHardware->startRecording(); if (result != NO_ERROR) { ALOGE("mHardware->startRecording() failed with status %d", result); } return result; } 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,801
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 SVGElement::IsPresentationAttributeWithSVGDOM( const QualifiedName& name) const { const SVGAnimatedPropertyBase* property = PropertyFromAttribute(name); return property && property->HasPresentationAttributeMapping(); } Commit Message: Fix SVG crash for v0 distribution into foreignObject. We require a parent element to be an SVG element for non-svg-root elements in order to create a LayoutObject for them. However, we checked the light tree parent element, not the flat tree one which is the parent for the layout tree construction. Note that this is just an issue in Shadow DOM v0 since v1 does not allow shadow roots on SVG elements. Bug: 915469 Change-Id: Id81843abad08814fae747b5bc81c09666583f130 Reviewed-on: https://chromium-review.googlesource.com/c/1382494 Reviewed-by: Fredrik Söderquist <fs@opera.com> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/master@{#617487} CWE ID: CWE-704
0
152,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: void ImageLoader::updateFromElement() { Document* document = m_element->document(); if (!document->renderer()) return; AtomicString attr = m_element->imageSourceURL(); if (attr == m_failedLoadURL) return; CachedResourceHandle<CachedImage> newImage = 0; if (!attr.isNull() && !stripLeadingAndTrailingHTMLSpaces(attr).isEmpty()) { CachedResourceRequest request(ResourceRequest(document->completeURL(sourceURI(attr)))); request.setInitiator(element()); String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr); if (!crossOriginMode.isNull()) { StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; updateRequestForAccessControl(request.mutableResourceRequest(), document->securityOrigin(), allowCredentials); } if (m_loadManually) { bool autoLoadOtherImages = document->cachedResourceLoader()->autoLoadImages(); document->cachedResourceLoader()->setAutoLoadImages(false); newImage = new CachedImage(request.resourceRequest()); newImage->setLoading(true); newImage->setOwningCachedResourceLoader(document->cachedResourceLoader()); document->cachedResourceLoader()->m_documentResources.set(newImage->url(), newImage.get()); document->cachedResourceLoader()->setAutoLoadImages(autoLoadOtherImages); } else newImage = document->cachedResourceLoader()->requestImage(request); if (!newImage && !pageIsBeingDismissed(document)) { m_failedLoadURL = attr; m_hasPendingErrorEvent = true; errorEventSender().dispatchEventSoon(this); } else clearFailedLoadURL(); } else if (!attr.isNull()) { m_element->dispatchEvent(Event::create(eventNames().errorEvent, false, false)); } CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { if (m_hasPendingBeforeLoadEvent) { beforeLoadEventSender().cancelEvent(this); m_hasPendingBeforeLoadEvent = false; } if (m_hasPendingLoadEvent) { loadEventSender().cancelEvent(this); m_hasPendingLoadEvent = false; } if (m_hasPendingErrorEvent && newImage) { errorEventSender().cancelEvent(this); m_hasPendingErrorEvent = false; } m_image = newImage; m_hasPendingBeforeLoadEvent = !m_element->document()->isImageDocument() && newImage; m_hasPendingLoadEvent = newImage; m_imageComplete = !newImage; if (newImage) { if (!m_element->document()->isImageDocument()) { if (!m_element->document()->hasListenerType(Document::BEFORELOAD_LISTENER)) dispatchPendingBeforeLoadEvent(); else beforeLoadEventSender().dispatchEventSoon(this); } else updateRenderer(); newImage->addClient(this); } if (oldImage) oldImage->removeClient(this); } if (RenderImageResource* imageResource = renderImageResource()) imageResource->resetAnimation(); updatedHasPendingEvent(); } Commit Message: Error event was fired synchronously blowing away the input element from underneath. Remove the FIXME and fire it asynchronously using errorEventSender(). BUG=240124 Review URL: https://chromiumcodereview.appspot.com/14741011 git-svn-id: svn://svn.chromium.org/blink/trunk@150232 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-416
1
171,319
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: SPL_METHOD(DirectoryIterator, current) { if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_ZVAL(getThis(), 1, 0); } Commit Message: Fix bug #72262 - do not overflow int CWE ID: CWE-190
0
51,320
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 gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { long dst_w = MAX(1, new_width); long dst_h = MAX(1, new_height); float dx = (float)gdImageSX(im) / (float)dst_w; float dy = (float)gdImageSY(im) / (float)dst_h; gdFixed f_dx = gd_ftofx(dx); gdFixed f_dy = gd_ftofx(dy); gdFixed f_1 = gd_itofx(1); int dst_offset_h; int dst_offset_v = 0; long i; gdImagePtr new_img; new_img = gdImageCreateTrueColor(new_width, new_height); if (!new_img){ return NULL; } for (i=0; i < dst_h; i++) { long j; dst_offset_h = 0; for (j=0; j < dst_w; j++) { /* Update bitmap */ gdFixed f_i = gd_itofx(i); gdFixed f_j = gd_itofx(j); gdFixed f_a = gd_mulfx(f_i, f_dy); gdFixed f_b = gd_mulfx(f_j, f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); gdFixed f_f = f_a - gd_itofx(m); gdFixed f_g = f_b - gd_itofx(n); const gdFixed f_w1 = gd_mulfx(f_1-f_f, f_1-f_g); const gdFixed f_w2 = gd_mulfx(f_1-f_f, f_g); const gdFixed f_w3 = gd_mulfx(f_f, f_1-f_g); const gdFixed f_w4 = gd_mulfx(f_f, f_g); unsigned int pixel1; unsigned int pixel2; unsigned int pixel3; unsigned int pixel4; register gdFixed f_r1, f_r2, f_r3, f_r4, f_g1, f_g2, f_g3, f_g4, f_b1, f_b2, f_b3, f_b4, f_a1, f_a2, f_a3, f_a4; /* 0 for bgColor, nothing gets outside anyway */ pixel1 = getPixelOverflowTC(im, n, m, 0); pixel2 = getPixelOverflowTC(im, n + 1, m, 0); pixel3 = getPixelOverflowTC(im, n, m + 1, 0); pixel4 = getPixelOverflowTC(im, n + 1, m + 1, 0); f_r1 = gd_itofx(gdTrueColorGetRed(pixel1)); f_r2 = gd_itofx(gdTrueColorGetRed(pixel2)); f_r3 = gd_itofx(gdTrueColorGetRed(pixel3)); f_r4 = gd_itofx(gdTrueColorGetRed(pixel4)); f_g1 = gd_itofx(gdTrueColorGetGreen(pixel1)); f_g2 = gd_itofx(gdTrueColorGetGreen(pixel2)); f_g3 = gd_itofx(gdTrueColorGetGreen(pixel3)); f_g4 = gd_itofx(gdTrueColorGetGreen(pixel4)); f_b1 = gd_itofx(gdTrueColorGetBlue(pixel1)); f_b2 = gd_itofx(gdTrueColorGetBlue(pixel2)); f_b3 = gd_itofx(gdTrueColorGetBlue(pixel3)); f_b4 = gd_itofx(gdTrueColorGetBlue(pixel4)); f_a1 = gd_itofx(gdTrueColorGetAlpha(pixel1)); f_a2 = gd_itofx(gdTrueColorGetAlpha(pixel2)); f_a3 = gd_itofx(gdTrueColorGetAlpha(pixel3)); f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4)); { const char red = (char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4)); const char green = (char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4)); const char blue = (char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4)); const char alpha = (char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4)); new_img->tpixels[dst_offset_v][dst_offset_h] = gdTrueColorAlpha(red, green, blue, alpha); } dst_offset_h++; } dst_offset_v++; } return new_img; } Commit Message: Fixed memory overrun bug in gdImageScaleTwoPass _gdContributionsCalc would compute a window size and then adjust the left and right positions of the window to make a window within that size. However, it was storing the values in the struct *before* it made the adjustment. This change fixes that. CWE ID: CWE-125
0
58,413
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: print_ipcp_config_options(netdissect_options *ndo, const u_char *p, int length) { int len, opt; u_int compproto, ipcomp_subopttotallen, ipcomp_subopt, ipcomp_suboptlen; if (length < 2) return 0; ND_TCHECK2(*p, 2); len = p[1]; opt = p[0]; if (length < len) return 0; if (len < 2) { ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)", tok2str(ipcpopt_values,"unknown",opt), opt, len)); return 0; } ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u", tok2str(ipcpopt_values,"unknown",opt), opt, len)); switch (opt) { case IPCPOPT_2ADDR: /* deprecated */ if (len != 10) { ND_PRINT((ndo, " (length bogus, should be = 10)")); return len; } ND_TCHECK2(*(p + 6), 4); ND_PRINT((ndo, ": src %s, dst %s", ipaddr_string(ndo, p + 2), ipaddr_string(ndo, p + 6))); break; case IPCPOPT_IPCOMP: if (len < 4) { ND_PRINT((ndo, " (length bogus, should be >= 4)")); return 0; } ND_TCHECK2(*(p + 2), 2); compproto = EXTRACT_16BITS(p+2); ND_PRINT((ndo, ": %s (0x%02x):", tok2str(ipcpopt_compproto_values, "Unknown", compproto), compproto)); switch (compproto) { case PPP_VJC: /* XXX: VJ-Comp parameters should be decoded */ break; case IPCPOPT_IPCOMP_HDRCOMP: if (len < IPCPOPT_IPCOMP_MINLEN) { ND_PRINT((ndo, " (length bogus, should be >= %u)", IPCPOPT_IPCOMP_MINLEN)); return 0; } ND_TCHECK2(*(p + 2), IPCPOPT_IPCOMP_MINLEN); ND_PRINT((ndo, "\n\t TCP Space %u, non-TCP Space %u" \ ", maxPeriod %u, maxTime %u, maxHdr %u", EXTRACT_16BITS(p+4), EXTRACT_16BITS(p+6), EXTRACT_16BITS(p+8), EXTRACT_16BITS(p+10), EXTRACT_16BITS(p+12))); /* suboptions present ? */ if (len > IPCPOPT_IPCOMP_MINLEN) { ipcomp_subopttotallen = len - IPCPOPT_IPCOMP_MINLEN; p += IPCPOPT_IPCOMP_MINLEN; ND_PRINT((ndo, "\n\t Suboptions, length %u", ipcomp_subopttotallen)); while (ipcomp_subopttotallen >= 2) { ND_TCHECK2(*p, 2); ipcomp_subopt = *p; ipcomp_suboptlen = *(p+1); /* sanity check */ if (ipcomp_subopt == 0 || ipcomp_suboptlen == 0 ) break; /* XXX: just display the suboptions for now */ ND_PRINT((ndo, "\n\t\t%s Suboption #%u, length %u", tok2str(ipcpopt_compproto_subopt_values, "Unknown", ipcomp_subopt), ipcomp_subopt, ipcomp_suboptlen)); ipcomp_subopttotallen -= ipcomp_suboptlen; p += ipcomp_suboptlen; } } break; default: break; } break; case IPCPOPT_ADDR: /* those options share the same format - fall through */ case IPCPOPT_MOBILE4: case IPCPOPT_PRIDNS: case IPCPOPT_PRINBNS: case IPCPOPT_SECDNS: case IPCPOPT_SECNBNS: if (len != 6) { ND_PRINT((ndo, " (length bogus, should be = 6)")); return 0; } ND_TCHECK2(*(p + 2), 4); ND_PRINT((ndo, ": %s", ipaddr_string(ndo, p + 2))); break; default: /* * Unknown option; dump it as raw bytes now if we're * not going to do so below. */ if (ndo->ndo_vflag < 2) print_unknown_data(ndo, &p[2], "\n\t ", len - 2); break; } if (ndo->ndo_vflag > 1) print_unknown_data(ndo, &p[2], "\n\t ", len - 2); /* exclude TLV header */ return len; trunc: ND_PRINT((ndo, "[|ipcp]")); return 0; } Commit Message: Do bounds checking when unescaping PPP. Clean up a const issue while we're at it. CWE ID: CWE-119
0
35,442
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 UpdateSyncItemFromAppItem(const AppListItem* app_item, AppListSyncableService::SyncItem* sync_item) { DCHECK_EQ(sync_item->item_id, app_item->id()); bool changed = false; if (app_list::switches::IsFolderUIEnabled() && sync_item->parent_id != app_item->folder_id()) { sync_item->parent_id = app_item->folder_id(); changed = true; } if (sync_item->item_name != app_item->name()) { sync_item->item_name = app_item->name(); changed = true; } if (!sync_item->item_ordinal.IsValid() || !app_item->position().Equals(sync_item->item_ordinal)) { sync_item->item_ordinal = app_item->position(); changed = true; } return changed; } Commit Message: [Extensions] Add GetInstalledExtension() method to ExtensionRegistry This CL adds GetInstalledExtension() method to ExtensionRegistry and uses it instead of deprecated ExtensionService::GetInstalledExtension() in chrome/browser/ui/app_list/. Part of removing the deprecated GetInstalledExtension() call from the ExtensionService. BUG=489687 Review URL: https://codereview.chromium.org/1130353010 Cr-Commit-Position: refs/heads/master@{#333036} CWE ID:
0
123,936
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 FFmpegVideoDecodeEngine::TryToFinishPendingFlush() { DCHECK(flush_pending_); if (!pending_input_buffers_ && !pending_output_buffers_) { flush_pending_ = false; event_handler_->OnFlushComplete(); } } Commit Message: Don't forget the ffmpeg input buffer padding when allocating a codec's extradata buffer. BUG=82438 Review URL: http://codereview.chromium.org/7137002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88354 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
0
98,362
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: DictionaryValue* CommitMessageToValue( const sync_pb::CommitMessage& proto, bool include_specifics) { DictionaryValue* value = new DictionaryValue(); value->Set("entries", SyncEntitiesToValue(proto.entries(), include_specifics)); SET_STR(cache_guid); SET_REP(extensions_activity, ChromiumExtensionActivityToValue); return value; } Commit Message: [Sync] Cleanup all tab sync enabling logic now that its on by default. BUG=none TEST= Review URL: https://chromiumcodereview.appspot.com/10443046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139462 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-362
0
105,220
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 struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, gfn_t gfn, gva_t gaddr, unsigned level, int direct, unsigned access, u64 *parent_pte) { union kvm_mmu_page_role role; unsigned quadrant; struct kvm_mmu_page *sp; bool need_sync = false; role = vcpu->arch.mmu.base_role; role.level = level; role.direct = direct; if (role.direct) role.cr4_pae = 0; role.access = access; if (!vcpu->arch.mmu.direct_map && vcpu->arch.mmu.root_level <= PT32_ROOT_LEVEL) { quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level)); quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1; role.quadrant = quadrant; } for_each_gfn_sp(vcpu->kvm, sp, gfn) { if (is_obsolete_sp(vcpu->kvm, sp)) continue; if (!need_sync && sp->unsync) need_sync = true; if (sp->role.word != role.word) continue; if (sp->unsync && kvm_sync_page_transient(vcpu, sp)) break; mmu_page_add_parent_pte(vcpu, sp, parent_pte); if (sp->unsync_children) { kvm_make_request(KVM_REQ_MMU_SYNC, vcpu); kvm_mmu_mark_parents_unsync(sp); } else if (sp->unsync) kvm_mmu_mark_parents_unsync(sp); __clear_sp_write_flooding_count(sp); trace_kvm_mmu_get_page(sp, false); return sp; } ++vcpu->kvm->stat.mmu_cache_miss; sp = kvm_mmu_alloc_page(vcpu, parent_pte, direct); if (!sp) return sp; sp->gfn = gfn; sp->role = role; hlist_add_head(&sp->hash_link, &vcpu->kvm->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)]); if (!direct) { if (rmap_write_protect(vcpu->kvm, gfn)) kvm_flush_remote_tlbs(vcpu->kvm); if (level > PT_PAGE_TABLE_LEVEL && need_sync) kvm_sync_pages(vcpu, gfn); account_shadowed(vcpu->kvm, gfn); } sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen; init_shadow_page_table(sp); trace_kvm_mmu_get_page(sp, true); return sp; } Commit Message: nEPT: Nested INVEPT If we let L1 use EPT, we should probably also support the INVEPT instruction. In our current nested EPT implementation, when L1 changes its EPT table for L2 (i.e., EPT12), L0 modifies the shadow EPT table (EPT02), and in the course of this modification already calls INVEPT. But if last level of shadow page is unsync not all L1's changes to EPT12 are intercepted, which means roots need to be synced when L1 calls INVEPT. Global INVEPT should not be different since roots are synced by kvm_mmu_load() each time EPTP02 changes. Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Nadav Har'El <nyh@il.ibm.com> Signed-off-by: Jun Nakajima <jun.nakajima@intel.com> Signed-off-by: Xinhao Xu <xinhao.xu@intel.com> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID: CWE-20
0
37,468
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: size_t jsvGetStringLength(const JsVar *v) { size_t strLength = 0; const JsVar *var = v; JsVar *newVar = 0; if (!jsvHasCharacterData(v)) return 0; while (var) { JsVarRef ref = jsvGetLastChild(var); strLength += jsvGetCharactersInVar(var); jsvUnLock(newVar); // note use of if (ref), not var var = newVar = ref ? jsvLock(ref) : 0; } jsvUnLock(newVar); // note use of if (ref), not var return strLength; } Commit Message: fix jsvGetString regression CWE ID: CWE-119
0
82,443
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: ScreenOrientation& ScreenOrientation::from(Screen& screen) { ScreenOrientation* supplement = static_cast<ScreenOrientation*>(WillBeHeapSupplement<Screen>::from(screen, supplementName())); if (!supplement) { supplement = new ScreenOrientation(screen); provideTo(screen, supplementName(), adoptPtrWillBeNoop(supplement)); } return *supplement; } Commit Message: Screen Orientation: use OrientationLockType enum for lockOrientation(). BUG=162827 Review URL: https://codereview.chromium.org/204653002 git-svn-id: svn://svn.chromium.org/blink/trunk@169972 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-119
0
115,903
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 bool cpu_has_vmx_wbinvd_exit(void) { return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_WBINVD_EXITING; } 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,024
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 InputDispatcher::TouchState::isSlippery() const { bool haveSlipperyForegroundWindow = false; for (size_t i = 0; i < windows.size(); i++) { const TouchedWindow& window = windows.itemAt(i); if (window.targetFlags & InputTarget::FLAG_FOREGROUND) { if (haveSlipperyForegroundWindow || !(window.windowHandle->getInfo()->layoutParamsFlags & InputWindowInfo::FLAG_SLIPPERY)) { return false; } haveSlipperyForegroundWindow = true; } } return haveSlipperyForegroundWindow; } Commit Message: Add new MotionEvent flag for partially obscured windows. Due to more complex window layouts resulting in lots of overlapping windows, the policy around FLAG_WINDOW_IS_OBSCURED has changed to only be set when the point at which the window was touched is obscured. Unfortunately, this doesn't prevent tapjacking attacks that overlay the dialog's text, making a potentially dangerous operation seem innocuous. To avoid this on particularly sensitive dialogs, introduce a new flag that really does tell you when your window is being even partially overlapped. We aren't exposing this as API since we plan on making the original flag more robust. This is really a workaround for system dialogs since we generally know their layout and screen position, and that they're unlikely to be overlapped by other applications. Bug: 26677796 Change-Id: I9e336afe90f262ba22015876769a9c510048fd47 CWE ID: CWE-264
0
163,789
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 put_compat_mq_attr(const struct mq_attr *attr, struct compat_mq_attr __user *uattr) { struct compat_mq_attr v; memset(&v, 0, sizeof(v)); v.mq_flags = attr->mq_flags; v.mq_maxmsg = attr->mq_maxmsg; v.mq_msgsize = attr->mq_msgsize; v.mq_curmsgs = attr->mq_curmsgs; if (copy_to_user(uattr, &v, sizeof(*uattr))) return -EFAULT; return 0; } Commit Message: mqueue: fix a use-after-free in sys_mq_notify() The retry logic for netlink_attachskb() inside sys_mq_notify() is nasty and vulnerable: 1) The sock refcnt is already released when retry is needed 2) The fd is controllable by user-space because we already release the file refcnt so we when retry but the fd has been just closed by user-space during this small window, we end up calling netlink_detachskb() on the error path which releases the sock again, later when the user-space closes this socket a use-after-free could be triggered. Setting 'sock' to NULL here should be sufficient to fix it. Reported-by: GeneBlue <geneblue.mail@gmail.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-416
0
63,546
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: init_ipxsaparray(netdissect_options *ndo) { register int i; register struct hnamemem *table; for (i = 0; ipxsap_db[i].s != NULL; i++) { int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1); table = &ipxsaptable[j]; while (table->name) table = table->nxt; table->name = ipxsap_db[i].s; table->addr = htons(ipxsap_db[i].v); table->nxt = newhnamemem(ndo); } } Commit Message: CVE-2017-12894/In lookup_bytestring(), take the length of the byte string into account. Otherwise, if, in our search of the hash table, we come across a byte string that's shorter than the string we're looking for, we'll search past the end of the string in the hash table. This fixes a buffer over-read discovered by Forcepoint's security researchers Otto Airamo & Antti Levomäki. Add a test using the capture file supplied by the reporter(s). CWE ID: CWE-125
0
62,595
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 ff_clean_intra_table_entries(MpegEncContext *s) { int wrap = s->b8_stride; int xy = s->block_index[0]; s->dc_val[0][xy ] = s->dc_val[0][xy + 1 ] = s->dc_val[0][xy + wrap] = s->dc_val[0][xy + 1 + wrap] = 1024; /* ac pred */ memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t)); memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t)); if (s->msmpeg4_version>=3) { s->coded_block[xy ] = s->coded_block[xy + 1 ] = s->coded_block[xy + wrap] = s->coded_block[xy + 1 + wrap] = 0; } /* chroma */ wrap = s->mb_stride; xy = s->mb_x + s->mb_y * wrap; s->dc_val[1][xy] = s->dc_val[2][xy] = 1024; /* ac pred */ memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t)); memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t)); s->mbintra_table[xy]= 0; } Commit Message: avcodec/idctdsp: Transmit studio_profile to init instead of using AVCodecContext profile These 2 fields are not always the same, it is simpler to always use the same field for detecting studio profile Fixes: null pointer dereference Fixes: ffmpeg_crash_3.avi Found-by: Thuan Pham <thuanpv@comp.nus.edu.sg>, Marcel Böhme, Andrew Santosa and Alexandru RazvanCaciulescu with AFLSmart Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> CWE ID: CWE-476
0
81,726
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: FileTransfer::ExitDoUpload(filesize_t *total_bytes, ReliSock *s, priv_state saved_priv, bool socket_default_crypto, bool upload_success, bool do_upload_ack, bool do_download_ack, bool try_again, int hold_code, int hold_subcode, char const *upload_error_desc,int DoUpload_exit_line) { int rc = upload_success ? 0 : -1; bool download_success = false; MyString error_buf; MyString download_error_buf; char const *error_desc = NULL; dprintf(D_FULLDEBUG,"DoUpload: exiting at %d\n",DoUpload_exit_line); if( saved_priv != PRIV_UNKNOWN ) { _set_priv(saved_priv,__FILE__,DoUpload_exit_line,1); } #ifdef WIN32 bytesSent += (float)(signed __int64)*total_bytes; #else bytesSent += *total_bytes; #endif if(do_upload_ack) { if(!PeerDoesTransferAck && !upload_success) { } else { s->snd_int(0,TRUE); MyString error_desc_to_send; if(!upload_success) { error_desc_to_send.sprintf("%s at %s failed to send file(s) to %s", get_mySubSystem()->getName(), s->my_ip_str(), s->get_sinful_peer()); if(upload_error_desc) { error_desc_to_send.sprintf_cat(": %s",upload_error_desc); } } SendTransferAck(s,upload_success,try_again,hold_code,hold_subcode, error_desc_to_send.Value()); } } if(do_download_ack) { GetTransferAck(s,download_success,try_again,hold_code,hold_subcode, download_error_buf); if(!download_success) { rc = -1; } } if(rc != 0) { char const *receiver_ip_str = s->get_sinful_peer(); if(!receiver_ip_str) { receiver_ip_str = "disconnected socket"; } error_buf.sprintf("%s at %s failed to send file(s) to %s", get_mySubSystem()->getName(), s->my_ip_str(),receiver_ip_str); if(upload_error_desc) { error_buf.sprintf_cat(": %s",upload_error_desc); } if(!download_error_buf.IsEmpty()) { error_buf.sprintf_cat("; %s",download_error_buf.Value()); } error_desc = error_buf.Value(); if(!error_desc) { error_desc = ""; } if(try_again) { dprintf(D_ALWAYS,"DoUpload: %s\n",error_desc); } else { dprintf(D_ALWAYS,"DoUpload: (Condor error code %d, subcode %d) %s\n",hold_code,hold_subcode,error_desc); } } s->set_crypto_mode(socket_default_crypto); Info.success = rc == 0; Info.try_again = try_again; Info.hold_code = hold_code; Info.hold_subcode = hold_subcode; Info.error_desc = error_desc; return rc; } Commit Message: CWE ID: CWE-134
0
16,572
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 openpt_in_namespace(pid_t pid, int flags) { _cleanup_close_ int pidnsfd = -1, mntnsfd = -1, usernsfd = -1, rootfd = -1; _cleanup_close_pair_ int pair[2] = { -1, -1 }; pid_t child; int r; assert(pid > 0); r = namespace_open(pid, &pidnsfd, &mntnsfd, NULL, &usernsfd, &rootfd); if (r < 0) return r; if (socketpair(AF_UNIX, SOCK_DGRAM, 0, pair) < 0) return -errno; r = namespace_fork("(sd-openptns)", "(sd-openpt)", NULL, 0, FORK_RESET_SIGNALS|FORK_DEATHSIG, pidnsfd, mntnsfd, -1, usernsfd, rootfd, &child); if (r < 0) return r; if (r == 0) { int master; pair[0] = safe_close(pair[0]); master = posix_openpt(flags|O_NOCTTY|O_CLOEXEC); if (master < 0) _exit(EXIT_FAILURE); if (unlockpt(master) < 0) _exit(EXIT_FAILURE); if (send_one_fd(pair[1], master, 0) < 0) _exit(EXIT_FAILURE); _exit(EXIT_SUCCESS); } pair[1] = safe_close(pair[1]); r = wait_for_terminate_and_check("(sd-openptns)", child, 0); if (r < 0) return r; if (r != EXIT_SUCCESS) return -EIO; return receive_one_fd(pair[0], 0); } Commit Message: Merge pull request #12378 from rbalint/vt-kbd-reset-check VT kbd reset check CWE ID: CWE-255
0
92,401
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 PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style) { const FontFamily& firstFamily = style->fontDescription().family(); RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); for (const FontFamily* family = &firstFamily; family; family = family->next()) list->append(valueForFamily(family->family())); return list.release(); } Commit Message: Rename isPositioned to isOutOfFlowPositioned for clarity https://bugs.webkit.org/show_bug.cgi?id=89836 Reviewed by Antti Koivisto. RenderObject and RenderStyle had an isPositioned() method that was confusing, because it excluded relative positioning. Rename to isOutOfFlowPositioned(), which makes it clearer that it only applies to absolute and fixed positioning. Simple rename; no behavior change. Source/WebCore: * css/CSSComputedStyleDeclaration.cpp: (WebCore::getPositionOffsetValue): * css/StyleResolver.cpp: (WebCore::StyleResolver::collectMatchingRulesForList): * dom/Text.cpp: (WebCore::Text::rendererIsNeeded): * editing/DeleteButtonController.cpp: (WebCore::isDeletableElement): * editing/TextIterator.cpp: (WebCore::shouldEmitNewlinesBeforeAndAfterNode): * rendering/AutoTableLayout.cpp: (WebCore::shouldScaleColumns): * rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::addToLine): (WebCore::InlineFlowBox::placeBoxesInInlineDirection): (WebCore::InlineFlowBox::requiresIdeographicBaseline): (WebCore::InlineFlowBox::adjustMaxAscentAndDescent): (WebCore::InlineFlowBox::computeLogicalBoxHeights): (WebCore::InlineFlowBox::placeBoxesInBlockDirection): (WebCore::InlineFlowBox::flipLinesInBlockDirection): (WebCore::InlineFlowBox::computeOverflow): (WebCore::InlineFlowBox::computeOverAnnotationAdjustment): (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment): * rendering/InlineIterator.h: (WebCore::isIteratorTarget): * rendering/LayoutState.cpp: (WebCore::LayoutState::LayoutState): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::MarginInfo::MarginInfo): (WebCore::RenderBlock::styleWillChange): (WebCore::RenderBlock::styleDidChange): (WebCore::RenderBlock::addChildToContinuation): (WebCore::RenderBlock::addChildToAnonymousColumnBlocks): (WebCore::RenderBlock::containingColumnsBlock): (WebCore::RenderBlock::columnsBlockForSpanningElement): (WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks): (WebCore::getInlineRun): (WebCore::RenderBlock::isSelfCollapsingBlock): (WebCore::RenderBlock::layoutBlock): (WebCore::RenderBlock::addOverflowFromBlockChildren): (WebCore::RenderBlock::expandsToEncloseOverhangingFloats): (WebCore::RenderBlock::handlePositionedChild): (WebCore::RenderBlock::moveRunInUnderSiblingBlockIfNeeded): (WebCore::RenderBlock::collapseMargins): (WebCore::RenderBlock::clearFloatsIfNeeded): (WebCore::RenderBlock::simplifiedNormalFlowLayout): (WebCore::RenderBlock::isSelectionRoot): (WebCore::RenderBlock::blockSelectionGaps): (WebCore::RenderBlock::clearFloats): (WebCore::RenderBlock::markAllDescendantsWithFloatsForLayout): (WebCore::RenderBlock::markSiblingsWithFloatsForLayout): (WebCore::isChildHitTestCandidate): (WebCore::InlineMinMaxIterator::next): (WebCore::RenderBlock::computeBlockPreferredLogicalWidths): (WebCore::RenderBlock::firstLineBoxBaseline): (WebCore::RenderBlock::lastLineBoxBaseline): (WebCore::RenderBlock::updateFirstLetter): (WebCore::shouldCheckLines): (WebCore::getHeightForLineCount): (WebCore::RenderBlock::adjustForBorderFit): (WebCore::inNormalFlow): (WebCore::RenderBlock::adjustLinePositionForPagination): (WebCore::RenderBlock::adjustBlockChildForPagination): (WebCore::RenderBlock::renderName): * rendering/RenderBlock.h: (WebCore::RenderBlock::shouldSkipCreatingRunsForObject): * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::setMarginsForRubyRun): (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): (WebCore::RenderBlock::computeBlockDirectionPositionsForLine): (WebCore::RenderBlock::layoutInlineChildren): (WebCore::requiresLineBox): (WebCore::RenderBlock::LineBreaker::skipTrailingWhitespace): (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace): (WebCore::RenderBlock::LineBreaker::nextLineBreak): * rendering/RenderBox.cpp: (WebCore::RenderBox::removeFloatingOrPositionedChildFromBlockLists): (WebCore::RenderBox::styleWillChange): (WebCore::RenderBox::styleDidChange): (WebCore::RenderBox::updateBoxModelInfoFromStyle): (WebCore::RenderBox::offsetFromContainer): (WebCore::RenderBox::positionLineBox): (WebCore::RenderBox::computeRectForRepaint): (WebCore::RenderBox::computeLogicalWidthInRegion): (WebCore::RenderBox::renderBoxRegionInfo): (WebCore::RenderBox::computeLogicalHeight): (WebCore::RenderBox::computePercentageLogicalHeight): (WebCore::RenderBox::computeReplacedLogicalWidthUsing): (WebCore::RenderBox::computeReplacedLogicalHeightUsing): (WebCore::RenderBox::availableLogicalHeightUsing): (WebCore::percentageLogicalHeightIsResolvable): * rendering/RenderBox.h: (WebCore::RenderBox::stretchesToViewport): (WebCore::RenderBox::isDeprecatedFlexItem): * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent): (WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint): * rendering/RenderBoxModelObject.h: (WebCore::RenderBoxModelObject::requiresLayer): * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::childDoesNotAffectWidthOrFlexing): (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): (WebCore::RenderDeprecatedFlexibleBox::renderName): * rendering/RenderFieldset.cpp: (WebCore::RenderFieldset::findLegend): * rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computePreferredLogicalWidths): (WebCore::RenderFlexibleBox::autoMarginOffsetInMainAxis): (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild): (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): (WebCore::RenderFlexibleBox::computeNextFlexLine): (WebCore::RenderFlexibleBox::resolveFlexibleLengths): (WebCore::RenderFlexibleBox::prepareChildForPositionedLayout): (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): (WebCore::RenderFlexibleBox::layoutColumnReverse): (WebCore::RenderFlexibleBox::adjustAlignmentForChild): (WebCore::RenderFlexibleBox::flipForRightToLeftColumn): * rendering/RenderGrid.cpp: (WebCore::RenderGrid::renderName): * rendering/RenderImage.cpp: (WebCore::RenderImage::computeIntrinsicRatioInformation): * rendering/RenderInline.cpp: (WebCore::RenderInline::addChildIgnoringContinuation): (WebCore::RenderInline::addChildToContinuation): (WebCore::RenderInline::generateCulledLineBoxRects): (WebCore): (WebCore::RenderInline::culledInlineFirstLineBox): (WebCore::RenderInline::culledInlineLastLineBox): (WebCore::RenderInline::culledInlineVisualOverflowBoundingBox): (WebCore::RenderInline::computeRectForRepaint): (WebCore::RenderInline::dirtyLineBoxes): * rendering/RenderLayer.cpp: (WebCore::checkContainingBlockChainForPagination): (WebCore::RenderLayer::updateLayerPosition): (WebCore::isPositionedContainer): (WebCore::RenderLayer::calculateClipRects): (WebCore::RenderLayer::shouldBeNormalFlowOnly): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresCompositingForPosition): * rendering/RenderLineBoxList.cpp: (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild): * rendering/RenderListItem.cpp: (WebCore::getParentOfFirstLineBox): * rendering/RenderMultiColumnBlock.cpp: (WebCore::RenderMultiColumnBlock::renderName): * rendering/RenderObject.cpp: (WebCore::RenderObject::markContainingBlocksForLayout): (WebCore::RenderObject::setPreferredLogicalWidthsDirty): (WebCore::RenderObject::invalidateContainerPreferredLogicalWidths): (WebCore::RenderObject::styleWillChange): (WebCore::RenderObject::offsetParent): * rendering/RenderObject.h: (WebCore::RenderObject::isOutOfFlowPositioned): (WebCore::RenderObject::isInFlowPositioned): (WebCore::RenderObject::hasClip): (WebCore::RenderObject::isFloatingOrOutOfFlowPositioned): * rendering/RenderObjectChildList.cpp: (WebCore::RenderObjectChildList::removeChildNode): * rendering/RenderReplaced.cpp: (WebCore::hasAutoHeightOrContainingBlockWithAutoHeight): * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::rubyText): * rendering/RenderTable.cpp: (WebCore::RenderTable::addChild): (WebCore::RenderTable::computeLogicalWidth): (WebCore::RenderTable::layout): * rendering/style/RenderStyle.h: Source/WebKit/blackberry: * Api/WebPage.cpp: (BlackBerry::WebKit::isPositionedContainer): (BlackBerry::WebKit::isNonRenderViewFixedPositionedContainer): (BlackBerry::WebKit::isFixedPositionedContainer): Source/WebKit2: * WebProcess/WebPage/qt/LayerTreeHostQt.cpp: (WebKit::updateOffsetFromViewportForSelf): git-svn-id: svn://svn.chromium.org/blink/trunk@121123 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-119
0
99,465
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: FormController& Document::formController() { if (!m_formController) { m_formController = FormController::create(); if (m_frame && m_frame->loader().currentItem() && m_frame->loader().currentItem()->isCurrentDocument(this)) m_frame->loader().currentItem()->setDocumentState(m_formController->formElementsState()); } return *m_formController; } Commit Message: Change Document::detach() to RELEASE_ASSERT all subframes are gone. BUG=556724,577105 Review URL: https://codereview.chromium.org/1667573002 Cr-Commit-Position: refs/heads/master@{#373642} CWE ID: CWE-264
0
124,385
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: cached_extents(hb_font_t *font, void *font_data, hb_codepoint_t glyph, hb_glyph_extents_t *extents, void *user_data) { FT_Face face = font_data; struct ass_shaper_metrics_data *metrics_priv = user_data; GlyphMetricsHashValue *metrics = get_cached_metrics(metrics_priv, face, 0, glyph); if (!metrics) return false; extents->x_bearing = metrics->metrics.horiBearingX; extents->y_bearing = metrics->metrics.horiBearingY; extents->width = metrics->metrics.width; extents->height = -metrics->metrics.height; ass_cache_dec_ref(metrics); return true; } Commit Message: shaper: fix reallocation Update the variable that tracks the allocated size. This potentially improves performance and avoid some side effects, which lead to undefined behavior in some cases. Fixes fuzzer test case id:000051,sig:11,sync:fuzzer3,src:004221. CWE ID: CWE-399
0
73,287
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 PageInfoBubbleView::OnWidgetDestroying(views::Widget* widget) { g_shown_bubble_type = BUBBLE_NONE; g_page_info_bubble = nullptr; presenter_->OnUIClosing(); } Commit Message: Desktop Page Info/Harmony: Show close button for internal pages. The Harmony version of Page Info for internal Chrome pages (chrome://, chrome-extension:// and view-source:// pages) show a close button. Update the code to match this. This patch also adds TestBrowserDialog tests for the latter two cases described above (internal extension and view source pages). See screenshot - https://drive.google.com/file/d/18RZnMiHCu-rCX9N6DLUpu4mkFWguh1xm/view?usp=sharing Bug: 535074 Change-Id: I55e5f1aa682fd4ec85f7b65ac88f5a4f5906fe53 Reviewed-on: https://chromium-review.googlesource.com/759624 Commit-Queue: Patti <patricialor@chromium.org> Reviewed-by: Trent Apted <tapted@chromium.org> Cr-Commit-Position: refs/heads/master@{#516624} CWE ID: CWE-704
0
133,996
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: status_t Parcel::restartWrite(size_t desired) { if (mOwner) { freeData(); return continueWrite(desired); } uint8_t* data = (uint8_t*)realloc(mData, desired); if (!data && desired > mDataCapacity) { mError = NO_MEMORY; return NO_MEMORY; } releaseObjects(); if (data) { LOG_ALLOC("Parcel %p: restart from %zu to %zu capacity", this, mDataCapacity, desired); pthread_mutex_lock(&gParcelGlobalAllocSizeLock); gParcelGlobalAllocSize += desired; gParcelGlobalAllocSize -= mDataCapacity; pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); mData = data; mDataCapacity = desired; } mDataSize = mDataPos = 0; ALOGV("restartWrite Setting data size of %p to %zu", this, mDataSize); ALOGV("restartWrite Setting data pos of %p to %zu", this, mDataPos); free(mObjects); mObjects = NULL; mObjectsSize = mObjectsCapacity = 0; mNextObjectHint = 0; mHasFds = false; mFdsKnown = true; mAllowFds = true; return NO_ERROR; } Commit Message: Disregard alleged binder entities beyond parcel bounds When appending one parcel's contents to another, ignore binder objects within the source Parcel that appear to lie beyond the formal bounds of that Parcel's data buffer. Bug 17312693 Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514 (cherry picked from commit 27182be9f20f4f5b48316666429f09b9ecc1f22e) CWE ID: CWE-264
0
157,320
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: base::WaitableEvent* RenderThreadImpl::GetShutdownEvent() { return ChildProcess::current()->GetShutDownEvent(); } Commit Message: Suspend shared timers while blockingly closing databases BUG=388771 R=michaeln@chromium.org Review URL: https://codereview.chromium.org/409863002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284785 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-362
0
111,142
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 Downmix_foldFrom5Point1(int16_t *pSrc, int16_t*pDst, size_t numFrames, bool accumulate) { int32_t lt, rt, centerPlusLfeContrib; // samples in Q19.12 format if (accumulate) { while (numFrames) { centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_Q19_12) + (pSrc[3] * MINUS_3_DB_IN_Q19_12); lt = (pSrc[0] << 12) + centerPlusLfeContrib + (pSrc[4] << 12); rt = (pSrc[1] << 12) + centerPlusLfeContrib + (pSrc[5] << 12); pDst[0] = clamp16(pDst[0] + (lt >> 13)); pDst[1] = clamp16(pDst[1] + (rt >> 13)); pSrc += 6; pDst += 2; numFrames--; } } else { // same code as above but without adding and clamping pDst[i] to itself while (numFrames) { centerPlusLfeContrib = (pSrc[2] * MINUS_3_DB_IN_Q19_12) + (pSrc[3] * MINUS_3_DB_IN_Q19_12); lt = (pSrc[0] << 12) + centerPlusLfeContrib + (pSrc[4] << 12); rt = (pSrc[1] << 12) + centerPlusLfeContrib + (pSrc[5] << 12); pDst[0] = clamp16(lt >> 13); // differs from when accumulate is true above pDst[1] = clamp16(rt >> 13); // differs from when accumulate is true above pSrc += 6; pDst += 2; numFrames--; } } } Commit Message: audio effects: fix heap overflow Check consistency of effect command reply sizes before copying to reply address. Also add null pointer check on reply size. Also remove unused parameter warning. Bug: 21953516. Change-Id: I4cf00c12eaed696af28f3b7613f7e36f47a160c4 (cherry picked from commit 0f714a464d2425afe00d6450535e763131b40844) CWE ID: CWE-119
0
157,364
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 AudioInputRendererHost::SendErrorMessage(int stream_id) { Send(new AudioInputMsg_NotifyStreamStateChanged( stream_id, media::AudioInputIPCDelegate::kError)); } Commit Message: Improve validation when creating audio streams. BUG=166795 Review URL: https://codereview.chromium.org/11647012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173981 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-189
0
118,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: int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s, const unsigned char *sig, EVP_PKEY *pkey) { const unsigned char *sent_sigs; size_t sent_sigslen, i; int sigalg = tls12_get_sigid(pkey); /* Should never happen */ if (sigalg == -1) return -1; /* Check key type is consistent with signature */ if (sigalg != (int)sig[1]) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } #ifndef OPENSSL_NO_EC if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) { unsigned char curve_id[2], comp_id; /* Check compression and curve matches extensions */ if (!tls1_set_ec_id(curve_id, &comp_id, EVP_PKEY_get0_EC_KEY(pkey))) return 0; if (!s->server && !tls1_check_ec_key(s, curve_id, &comp_id)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_CURVE); return 0; } /* If Suite B only P-384+SHA384 or P-256+SHA-256 allowed */ if (tls1_suiteb(s)) { if (curve_id[0]) return 0; if (curve_id[1] == TLSEXT_curve_P_256) { if (sig[0] != TLSEXT_hash_sha256) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else if (curve_id[1] == TLSEXT_curve_P_384) { if (sig[0] != TLSEXT_hash_sha384) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else return 0; } } else if (tls1_suiteb(s)) return 0; #endif /* Check signature matches a type we sent */ sent_sigslen = tls12_get_psigalgs(s, 1, &sent_sigs); for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) { if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1]) break; } /* Allow fallback to SHA1 if not strict mode */ if (i == sent_sigslen && (sig[0] != TLSEXT_hash_sha1 || s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } *pmd = tls12_get_hash(sig[0]); if (*pmd == NULL) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_UNKNOWN_DIGEST); return 0; } /* Make sure security callback allows algorithm */ if (!ssl_security(s, SSL_SECOP_SIGALG_CHECK, EVP_MD_size(*pmd) * 4, EVP_MD_type(*pmd), (void *)sig)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } /* * Store the digest used so applications can retrieve it if they wish. */ s->s3->tmp.peer_md = *pmd; return 1; } Commit Message: Don't change the state of the ETM flags until CCS processing Changing the ciphersuite during a renegotiation can result in a crash leading to a DoS attack. ETM has not been implemented in 1.1.0 for DTLS so this is TLS only. The problem is caused by changing the flag indicating whether to use ETM or not immediately on negotiation of ETM, rather than at CCS. Therefore, during a renegotiation, if the ETM state is changing (usually due to a change of ciphersuite), then an error/crash will occur. Due to the fact that there are separate CCS messages for read and write we actually now need two flags to determine whether to use ETM or not. CVE-2017-3733 Reviewed-by: Richard Levitte <levitte@openssl.org> CWE ID: CWE-20
0
69,303
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 OnResult(blink::ServiceWorkerStatusCode) { DCHECK_CURRENTLY_ON(BrowserThread::IO); } 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,477
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 vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame ) { const MODE_INFO *mi = oci->mi; int mb_row, mb_col; for (mb_row = 0; mb_row < oci->mb_rows; mb_row++) { for (mb_col = 0; mb_col < oci->mb_cols; mb_col++,mi++) { if( mi->mbmi.ref_frame == ref_frame) return 1; } mi++; } return 0; } Commit Message: vp8:fix threading issues 1 - stops de allocating before threads are closed. 2 - limits threads to mb_rows when mb_rows < partitions BUG=webm:851 Bug: 30436808 Change-Id: Ie017818ed28103ca9d26d57087f31361b642e09b (cherry picked from commit 70cca742efa20617c70c3209aa614a70f282f90e) CWE ID:
0
162,662
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: MediaControlOverlayPlayButtonElement::create(MediaControls& mediaControls) { MediaControlOverlayPlayButtonElement* button = new MediaControlOverlayPlayButtonElement(mediaControls); button->ensureUserAgentShadowRoot(); button->setType(InputTypeNames::button); button->setShadowPseudoId( AtomicString("-webkit-media-controls-overlay-play-button")); return button; } Commit Message: Fixed volume slider element event handling MediaControlVolumeSliderElement::defaultEventHandler has making redundant calls to setVolume() & setMuted() on mouse activity. E.g. if a mouse click changed the slider position, the above calls were made 4 times, once for each of these events: mousedown, input, mouseup, DOMActive, click. This crack got exposed when PointerEvents are enabled by default on M55, adding pointermove, pointerdown & pointerup to the list. This CL fixes the code to trigger the calls to setVolume() & setMuted() only when the slider position is changed. Also added pointer events to certain lists of mouse events in the code. BUG=677900 Review-Url: https://codereview.chromium.org/2622273003 Cr-Commit-Position: refs/heads/master@{#446032} CWE ID: CWE-119
0
126,933
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: MODRET auth_user(cmd_rec *cmd) { int nopass = FALSE; config_rec *c; const char *denymsg = NULL, *user, *origuser; int failnopwprompt = 0, aclp, i; unsigned char *anon_require_passwd = NULL, *login_passwd_prompt = NULL; if (cmd->argc < 2) { return PR_ERROR_MSG(cmd, R_500, _("USER: command requires a parameter")); } if (logged_in) { /* If the client has already authenticated, BUT the given USER command * here is for the exact same user name, then allow the command to * succeed (Bug#4217). */ origuser = pr_table_get(session.notes, "mod_auth.orig-user", NULL); if (origuser != NULL && strcmp(origuser, cmd->arg) == 0) { pr_response_add(R_230, _("User %s logged in"), origuser); return PR_HANDLED(cmd); } pr_response_add_err(R_501, "%s", _("Reauthentication not supported")); return PR_ERROR(cmd); } user = cmd->arg; (void) pr_table_remove(session.notes, "mod_auth.orig-user", NULL); (void) pr_table_remove(session.notes, "mod_auth.anon-passwd", NULL); if (pr_table_add_dup(session.notes, "mod_auth.orig-user", user, 0) < 0) { pr_log_debug(DEBUG3, "error stashing 'mod_auth.orig-user' in " "session.notes: %s", strerror(errno)); } origuser = user; c = pr_auth_get_anon_config(cmd->tmp_pool, &user, NULL, NULL); /* Check for AccessDenyMsg */ denymsg = get_param_ptr((c ? c->subset : cmd->server->conf), "AccessDenyMsg", FALSE); if (denymsg != NULL) { if (strstr(denymsg, "%u") != NULL) { denymsg = sreplace(cmd->tmp_pool, denymsg, "%u", user, NULL); } } login_passwd_prompt = get_param_ptr( (c && c->config_type == CONF_ANON) ? c->subset : main_server->conf, "LoginPasswordPrompt", FALSE); if (login_passwd_prompt && *login_passwd_prompt == FALSE) { failnopwprompt = TRUE; } else { failnopwprompt = FALSE; } if (failnopwprompt) { if (!user) { (void) pr_table_remove(session.notes, "mod_auth.orig-user", NULL); (void) pr_table_remove(session.notes, "mod_auth.anon-passwd", NULL); pr_log_pri(PR_LOG_NOTICE, "USER %s (Login failed): Not a UserAlias", origuser); if (denymsg) { pr_response_send(R_530, "%s", denymsg); } else { pr_response_send(R_530, _("Login incorrect.")); } pr_session_end(0); } aclp = login_check_limits(main_server->conf, FALSE, TRUE, &i); if (c && c->config_type != CONF_ANON) { c = (config_rec *) pcalloc(session.pool, sizeof(config_rec)); c->config_type = CONF_ANON; c->name = ""; /* don't really need this yet */ c->subset = main_server->conf; } if (c) { if (!login_check_limits(c->subset, FALSE, TRUE, &i) || (!aclp && !i) ) { (void) pr_table_remove(session.notes, "mod_auth.orig-user", NULL); (void) pr_table_remove(session.notes, "mod_auth.anon-passwd", NULL); pr_log_auth(PR_LOG_NOTICE, "ANON %s: Limit access denies login", origuser); if (denymsg) { pr_response_send(R_530, "%s", denymsg); } else { pr_response_send(R_530, _("Login incorrect.")); } pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by <Limit LOGIN>"); } } if (c == NULL && aclp == 0) { (void) pr_table_remove(session.notes, "mod_auth.orig-user", NULL); (void) pr_table_remove(session.notes, "mod_auth.anon-passwd", NULL); pr_log_auth(PR_LOG_NOTICE, "USER %s: Limit access denies login", origuser); if (denymsg) { pr_response_send(R_530, "%s", denymsg); } else { pr_response_send(R_530, "%s", _("Login incorrect.")); } pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by <Limit LOGIN>"); } } if (c) anon_require_passwd = get_param_ptr(c->subset, "AnonRequirePassword", FALSE); if (c && user && (!anon_require_passwd || *anon_require_passwd == FALSE)) nopass = TRUE; session.gids = NULL; session.groups = NULL; session.user = NULL; session.group = NULL; if (nopass) { pr_response_add(R_331, _("Anonymous login ok, send your complete email " "address as your password")); } else if (pr_auth_requires_pass(cmd->tmp_pool, user) == FALSE) { /* Check to see if a password from the client is required. In the * vast majority of cases, a password will be required. */ /* Act as if we received a PASS command from the client. */ cmd_rec *fakecmd = pr_cmd_alloc(cmd->pool, 2, NULL); /* We use pstrdup() here, rather than assigning C_PASS directly, since * code elsewhere will attempt to modify this buffer, and C_PASS is * a string literal. */ fakecmd->argv[0] = pstrdup(fakecmd->pool, C_PASS); fakecmd->argv[1] = NULL; fakecmd->arg = NULL; c = add_config_param_set(&cmd->server->conf, "authenticated", 1, NULL); c->argv[0] = pcalloc(c->pool, sizeof(unsigned char)); *((unsigned char *) c->argv[0]) = TRUE; authenticated_without_pass = TRUE; pr_log_auth(PR_LOG_NOTICE, "USER %s: Authenticated without password", user); pr_cmd_dispatch(fakecmd); } else { pr_response_add(R_331, _("Password required for %s"), (char *) cmd->argv[1]); } return PR_HANDLED(cmd); } Commit Message: Walk the entire DefaultRoot path, checking for symlinks of any component, when AllowChrootSymlinks is disabled. CWE ID: CWE-59
0
67,584
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 __init set_osi_linux(unsigned int enable) { if (osi_linux.enable != enable) osi_linux.enable = enable; if (osi_linux.enable) acpi_osi_setup("Linux"); else acpi_osi_setup("!Linux"); return; } Commit Message: acpi: Disable ACPI table override if securelevel is set From the kernel documentation (initrd_table_override.txt): If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible to override nearly any ACPI table provided by the BIOS with an instrumented, modified one. When securelevel is set, the kernel should disallow any unauthenticated changes to kernel space. ACPI tables contain code invoked by the kernel, so do not allow ACPI tables to be overridden if securelevel is set. Signed-off-by: Linn Crosetto <linn@hpe.com> CWE ID: CWE-264
0
53,897
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: free_icc(fz_context *ctx, fz_colorspace *cs) { fz_iccprofile *profile = cs->data; fz_drop_buffer(ctx, profile->buffer); fz_cmm_fin_profile(ctx, profile); fz_free(ctx, profile); } Commit Message: CWE ID: CWE-20
0
317
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: SVGSVGElement* SVGDocumentExtensions::rootElement() const { ASSERT(m_document); return rootElement(*m_document); } Commit Message: SVG: Moving animating <svg> to other iframe should not crash. Moving SVGSVGElement with its SMILTimeContainer already started caused crash before this patch. |SVGDocumentExtentions::startAnimations()| calls begin() against all SMILTimeContainers in the document, but the SMILTimeContainer for <svg> moved from other document may be already started. BUG=369860 Review URL: https://codereview.chromium.org/290353002 git-svn-id: svn://svn.chromium.org/blink/trunk@174338 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID:
0
120,405
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 ftrace_update_code(struct module *mod) { struct ftrace_page *pg; struct dyn_ftrace *p; cycle_t start, stop; unsigned long ref = 0; int i; /* * When adding a module, we need to check if tracers are * currently enabled and if they are set to trace all functions. * If they are, we need to enable the module functions as well * as update the reference counts for those function records. */ if (mod) { struct ftrace_ops *ops; for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { if (ops->flags & FTRACE_OPS_FL_ENABLED && ops_traces_mod(ops)) ref++; } } start = ftrace_now(raw_smp_processor_id()); ftrace_update_cnt = 0; for (pg = ftrace_new_pgs; pg; pg = pg->next) { for (i = 0; i < pg->index; i++) { /* If something went wrong, bail without enabling anything */ if (unlikely(ftrace_disabled)) return -1; p = &pg->records[i]; p->flags = ref; /* * Do the initial record conversion from mcount jump * to the NOP instructions. */ if (!ftrace_code_disable(mod, p)) break; ftrace_update_cnt++; /* * If the tracing is enabled, go ahead and enable the record. * * The reason not to enable the record immediatelly is the * inherent check of ftrace_make_nop/ftrace_make_call for * correct previous instructions. Making first the NOP * conversion puts the module to the correct state, thus * passing the ftrace_make_call check. */ if (ftrace_start_up && ref) { int failed = __ftrace_replace_code(p, 1); if (failed) ftrace_bug(failed, p->ip); } } } ftrace_new_pgs = NULL; stop = ftrace_now(raw_smp_processor_id()); ftrace_update_time = stop - start; ftrace_update_tot_cnt += ftrace_update_cnt; return 0; } Commit Message: tracing: Fix possible NULL pointer dereferences Currently set_ftrace_pid and set_graph_function files use seq_lseek for their fops. However seq_open() is called only for FMODE_READ in the fops->open() so that if an user tries to seek one of those file when she open it for writing, it sees NULL seq_file and then panic. It can be easily reproduced with following command: $ cd /sys/kernel/debug/tracing $ echo 1234 | sudo tee -a set_ftrace_pid In this example, GNU coreutils' tee opens the file with fopen(, "a") and then the fopen() internally calls lseek(). Link: http://lkml.kernel.org/r/1365663302-2170-1-git-send-email-namhyung@kernel.org Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: stable@vger.kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> CWE ID:
0
30,238
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 blowfish_enc_blk_xor(struct bf_ctx *ctx, u8 *dst, const u8 *src) { __blowfish_enc_blk(ctx, dst, src, true); } 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
46,832
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 RenderFrameImpl::Send(IPC::Message* message) { return RenderThread::Get()->Send(message); } 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,836
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 seq_copy_to_input(unsigned char *event_rec, int len) { unsigned long flags; /* * Verify that the len is valid for the current mode. */ if (len != 4 && len != 8) return; if ((seq_mode == SEQ_1) != (len == 4)) return; if (iqlen >= (SEQ_MAX_QUEUE - 1)) return; /* Overflow */ spin_lock_irqsave(&lock,flags); memcpy(&iqueue[iqtail * IEV_SZ], event_rec, len); iqlen++; iqtail = (iqtail + 1) % SEQ_MAX_QUEUE; wake_up(&midi_sleeper); spin_unlock_irqrestore(&lock,flags); } Commit Message: sound/oss: remove offset from load_patch callbacks Was: [PATCH] sound/oss/midi_synth: prevent underflow, use of uninitialized value, and signedness issue The offset passed to midi_synth_load_patch() can be essentially arbitrary. If it's greater than the header length, this will result in a copy_from_user(dst, src, negative_val). While this will just return -EFAULT on x86, on other architectures this may cause memory corruption. Additionally, the length field of the sysex_info structure may not be initialized prior to its use. Finally, a signed comparison may result in an unintentionally large loop. On suggestion by Takashi Iwai, version two removes the offset argument from the load_patch callbacks entirely, which also resolves similar issues in opl3. Compile tested only. v3 adjusts comments and hopefully gets copy offsets right. Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> CWE ID: CWE-189
0
27,608
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: IHEVCD_ERROR_T ihevcd_parse_slice_data(codec_t *ps_codec) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; WORD32 end_of_slice_flag = 0; sps_t *ps_sps; pps_t *ps_pps; slice_header_t *ps_slice_hdr; WORD32 end_of_pic; tile_t *ps_tile, *ps_tile_prev; WORD32 i; WORD32 ctb_addr; WORD32 tile_idx; WORD32 cabac_init_idc; WORD32 ctb_size; WORD32 num_ctb_in_row; WORD32 num_min4x4_in_ctb; WORD32 slice_qp; WORD32 slice_start_ctb_idx; WORD32 tile_start_ctb_idx; ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr_base; ps_pps = ps_codec->s_parse.ps_pps_base; ps_sps = ps_codec->s_parse.ps_sps_base; /* Get current slice header, pps and sps */ ps_slice_hdr += (ps_codec->s_parse.i4_cur_slice_idx & (MAX_SLICE_HDR_CNT - 1)); ps_pps += ps_slice_hdr->i1_pps_id; ps_sps += ps_pps->i1_sps_id; if(0 != ps_codec->s_parse.i4_cur_slice_idx) { if(!ps_slice_hdr->i1_dependent_slice_flag) { ps_codec->s_parse.i4_cur_independent_slice_idx++; if(MAX_SLICE_HDR_CNT == ps_codec->s_parse.i4_cur_independent_slice_idx) ps_codec->s_parse.i4_cur_independent_slice_idx = 0; } } ctb_size = 1 << ps_sps->i1_log2_ctb_size; num_min4x4_in_ctb = (ctb_size / 4) * (ctb_size / 4); num_ctb_in_row = ps_sps->i2_pic_wd_in_ctb; /* Update the parse context */ if(0 == ps_codec->i4_slice_error) { ps_codec->s_parse.i4_ctb_x = ps_slice_hdr->i2_ctb_x; ps_codec->s_parse.i4_ctb_y = ps_slice_hdr->i2_ctb_y; } ps_codec->s_parse.ps_pps = ps_pps; ps_codec->s_parse.ps_sps = ps_sps; ps_codec->s_parse.ps_slice_hdr = ps_slice_hdr; /* Derive Tile positions for the current CTB */ /* Change this to lookup if required */ ihevcd_get_tile_pos(ps_pps, ps_sps, ps_codec->s_parse.i4_ctb_x, ps_codec->s_parse.i4_ctb_y, &ps_codec->s_parse.i4_ctb_tile_x, &ps_codec->s_parse.i4_ctb_tile_y, &tile_idx); ps_codec->s_parse.ps_tile = ps_pps->ps_tile + tile_idx; ps_codec->s_parse.i4_cur_tile_idx = tile_idx; ps_tile = ps_codec->s_parse.ps_tile; if(tile_idx) ps_tile_prev = ps_tile - 1; else ps_tile_prev = ps_tile; /* If the present slice is dependent, then store the previous * independent slices' ctb x and y values for decoding process */ if(0 == ps_codec->i4_slice_error) { if(1 == ps_slice_hdr->i1_dependent_slice_flag) { /*If slice is present at the start of a new tile*/ if((0 == ps_codec->s_parse.i4_ctb_tile_x) && (0 == ps_codec->s_parse.i4_ctb_tile_y)) { ps_codec->s_parse.i4_ctb_slice_x = 0; ps_codec->s_parse.i4_ctb_slice_y = 0; } } if(!ps_slice_hdr->i1_dependent_slice_flag) { ps_codec->s_parse.i4_ctb_slice_x = 0; ps_codec->s_parse.i4_ctb_slice_y = 0; } } /* Frame level initializations */ if((0 == ps_codec->s_parse.i4_ctb_y) && (0 == ps_codec->s_parse.i4_ctb_x)) { ret = ihevcd_parse_pic_init(ps_codec); RETURN_IF((ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS), ret); ps_codec->s_parse.pu4_pic_tu_idx[0] = 0; ps_codec->s_parse.pu4_pic_pu_idx[0] = 0; ps_codec->s_parse.i4_cur_independent_slice_idx = 0; ps_codec->s_parse.i4_ctb_tile_x = 0; ps_codec->s_parse.i4_ctb_tile_y = 0; } { /* Updating the poc list of current slice to ps_mv_buf */ mv_buf_t *ps_mv_buf = ps_codec->s_parse.ps_cur_mv_buf; if(ps_slice_hdr->i1_num_ref_idx_l1_active != 0) { for(i = 0; i < ps_slice_hdr->i1_num_ref_idx_l1_active; i++) { ps_mv_buf->l1_collocated_poc[(ps_codec->s_parse.i4_cur_slice_idx & (MAX_SLICE_HDR_CNT - 1))][i] = ((pic_buf_t *)ps_slice_hdr->as_ref_pic_list1[i].pv_pic_buf)->i4_abs_poc; ps_mv_buf->u1_l1_collocated_poc_lt[(ps_codec->s_parse.i4_cur_slice_idx & (MAX_SLICE_HDR_CNT - 1))][i] = ((pic_buf_t *)ps_slice_hdr->as_ref_pic_list1[i].pv_pic_buf)->u1_used_as_ref; } } if(ps_slice_hdr->i1_num_ref_idx_l0_active != 0) { for(i = 0; i < ps_slice_hdr->i1_num_ref_idx_l0_active; i++) { ps_mv_buf->l0_collocated_poc[(ps_codec->s_parse.i4_cur_slice_idx & (MAX_SLICE_HDR_CNT - 1))][i] = ((pic_buf_t *)ps_slice_hdr->as_ref_pic_list0[i].pv_pic_buf)->i4_abs_poc; ps_mv_buf->u1_l0_collocated_poc_lt[(ps_codec->s_parse.i4_cur_slice_idx & (MAX_SLICE_HDR_CNT - 1))][i] = ((pic_buf_t *)ps_slice_hdr->as_ref_pic_list0[i].pv_pic_buf)->u1_used_as_ref; } } } /*Initialize the low delay flag at the beginning of every slice*/ if((0 == ps_codec->s_parse.i4_ctb_slice_x) || (0 == ps_codec->s_parse.i4_ctb_slice_y)) { /* Lowdelay flag */ WORD32 cur_poc, ref_list_poc, flag = 1; cur_poc = ps_slice_hdr->i4_abs_pic_order_cnt; for(i = 0; i < ps_slice_hdr->i1_num_ref_idx_l0_active; i++) { ref_list_poc = ((mv_buf_t *)ps_slice_hdr->as_ref_pic_list0[i].pv_mv_buf)->i4_abs_poc; if(ref_list_poc > cur_poc) { flag = 0; break; } } if(flag && (ps_slice_hdr->i1_slice_type == BSLICE)) { for(i = 0; i < ps_slice_hdr->i1_num_ref_idx_l1_active; i++) { ref_list_poc = ((mv_buf_t *)ps_slice_hdr->as_ref_pic_list1[i].pv_mv_buf)->i4_abs_poc; if(ref_list_poc > cur_poc) { flag = 0; break; } } } ps_slice_hdr->i1_low_delay_flag = flag; } /* initialize the cabac init idc based on slice type */ if(ps_slice_hdr->i1_slice_type == ISLICE) { cabac_init_idc = 0; } else if(ps_slice_hdr->i1_slice_type == PSLICE) { cabac_init_idc = ps_slice_hdr->i1_cabac_init_flag ? 2 : 1; } else { cabac_init_idc = ps_slice_hdr->i1_cabac_init_flag ? 1 : 2; } slice_qp = ps_slice_hdr->i1_slice_qp_delta + ps_pps->i1_pic_init_qp; slice_qp = CLIP3(slice_qp, 0, 51); /*Update QP value for every indepndent slice or for every dependent slice that begins at the start of a new tile*/ if((0 == ps_slice_hdr->i1_dependent_slice_flag) || ((1 == ps_slice_hdr->i1_dependent_slice_flag) && ((0 == ps_codec->s_parse.i4_ctb_tile_x) && (0 == ps_codec->s_parse.i4_ctb_tile_y)))) { ps_codec->s_parse.u4_qp = slice_qp; } /*Cabac init at the beginning of a slice*/ if((1 == ps_slice_hdr->i1_dependent_slice_flag) && (!((ps_codec->s_parse.i4_ctb_tile_x == 0) && (ps_codec->s_parse.i4_ctb_tile_y == 0)))) { if((0 == ps_pps->i1_entropy_coding_sync_enabled_flag) || (ps_pps->i1_entropy_coding_sync_enabled_flag && (0 != ps_codec->s_parse.i4_ctb_x))) { ihevcd_cabac_reset(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm); } } else if((0 == ps_pps->i1_entropy_coding_sync_enabled_flag) || (ps_pps->i1_entropy_coding_sync_enabled_flag && (0 != ps_codec->s_parse.i4_ctb_x))) { ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm, slice_qp, cabac_init_idc, &gau1_ihevc_cab_ctxts[cabac_init_idc][slice_qp][0]); if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS) { ps_codec->i4_slice_error = 1; end_of_slice_flag = 1; ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } } do { { WORD32 cur_ctb_idx = ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * (ps_sps->i2_pic_wd_in_ctb); if(1 == ps_codec->i4_num_cores && 0 == cur_ctb_idx % RESET_TU_BUF_NCTB) { ps_codec->s_parse.ps_tu = ps_codec->s_parse.ps_pic_tu; ps_codec->s_parse.i4_pic_tu_idx = 0; } } end_of_pic = 0; /* Section:7.3.7 Coding tree unit syntax */ /* coding_tree_unit() inlined here */ /* If number of cores is greater than 1, then add job to the queue */ /* At the start of ctb row parsing in a tile, queue a job for processing the current tile row */ ps_codec->s_parse.i4_ctb_num_pcm_blks = 0; /*At the beginning of each tile-which is not the beginning of a slice, cabac context must be initialized. * Hence, check for the tile beginning here */ if(((0 == ps_codec->s_parse.i4_ctb_tile_x) && (0 == ps_codec->s_parse.i4_ctb_tile_y)) && (!((ps_tile->u1_pos_x == 0) && (ps_tile->u1_pos_y == 0))) && (!((0 == ps_codec->s_parse.i4_ctb_slice_x) && (0 == ps_codec->s_parse.i4_ctb_slice_y)))) { slice_qp = ps_slice_hdr->i1_slice_qp_delta + ps_pps->i1_pic_init_qp; slice_qp = CLIP3(slice_qp, 0, 51); ps_codec->s_parse.u4_qp = slice_qp; ihevcd_get_tile_pos(ps_pps, ps_sps, ps_codec->s_parse.i4_ctb_x, ps_codec->s_parse.i4_ctb_y, &ps_codec->s_parse.i4_ctb_tile_x, &ps_codec->s_parse.i4_ctb_tile_y, &tile_idx); ps_codec->s_parse.ps_tile = ps_pps->ps_tile + tile_idx; ps_codec->s_parse.i4_cur_tile_idx = tile_idx; ps_tile_prev = ps_tile - 1; tile_start_ctb_idx = ps_tile->u1_pos_x + ps_tile->u1_pos_y * (ps_sps->i2_pic_wd_in_ctb); slice_start_ctb_idx = ps_slice_hdr->i2_ctb_x + ps_slice_hdr->i2_ctb_y * (ps_sps->i2_pic_wd_in_ctb); /*For slices that span across multiple tiles*/ if(slice_start_ctb_idx < tile_start_ctb_idx) { /* 2 Cases * 1 - slice spans across frame-width- but does not start from 1st column * 2 - Slice spans across multiple tiles anywhere is a frame */ ps_codec->s_parse.i4_ctb_slice_y = ps_tile->u1_pos_y - ps_slice_hdr->i2_ctb_y; if(!(((ps_slice_hdr->i2_ctb_x + ps_tile_prev->u2_wd) % ps_sps->i2_pic_wd_in_ctb) == ps_tile->u1_pos_x)) //Case 2 { if(ps_slice_hdr->i2_ctb_y <= ps_tile->u1_pos_y) { if(ps_slice_hdr->i2_ctb_x > ps_tile->u1_pos_x) { ps_codec->s_parse.i4_ctb_slice_y -= 1; } } } /*ps_codec->s_parse.i4_ctb_slice_y = ps_tile->u1_pos_y - ps_slice_hdr->i2_ctb_y; if (ps_slice_hdr->i2_ctb_y <= ps_tile->u1_pos_y) { if (ps_slice_hdr->i2_ctb_x > ps_tile->u1_pos_x ) { ps_codec->s_parse.i4_ctb_slice_y -= 1 ; } }*/ } if(!ps_slice_hdr->i1_dependent_slice_flag) { ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm, slice_qp, cabac_init_idc, &gau1_ihevc_cab_ctxts[cabac_init_idc][slice_qp][0]); if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS) { ps_codec->i4_slice_error = 1; end_of_slice_flag = 1; ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } } } /* If number of cores is greater than 1, then add job to the queue */ /* At the start of ctb row parsing in a tile, queue a job for processing the current tile row */ if(0 == ps_codec->s_parse.i4_ctb_tile_x) { if(1 < ps_codec->i4_num_cores) { proc_job_t s_job; IHEVCD_ERROR_T ret; s_job.i4_cmd = CMD_PROCESS; s_job.i2_ctb_cnt = (WORD16)ps_tile->u2_wd; s_job.i2_ctb_x = (WORD16)ps_codec->s_parse.i4_ctb_x; s_job.i2_ctb_y = (WORD16)ps_codec->s_parse.i4_ctb_y; s_job.i2_slice_idx = (WORD16)ps_codec->s_parse.i4_cur_slice_idx; s_job.i4_tu_coeff_data_ofst = (UWORD8 *)ps_codec->s_parse.pv_tu_coeff_data - (UWORD8 *)ps_codec->s_parse.pv_pic_tu_coeff_data; ret = ihevcd_jobq_queue((jobq_t *)ps_codec->s_parse.pv_proc_jobq, &s_job, sizeof(proc_job_t), 1); if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS) return ret; } else { process_ctxt_t *ps_proc = &ps_codec->as_process[0]; WORD32 tu_coeff_data_ofst = (UWORD8 *)ps_codec->s_parse.pv_tu_coeff_data - (UWORD8 *)ps_codec->s_parse.pv_pic_tu_coeff_data; /* If the codec is running in single core mode, * initialize zeroth process context * TODO: Dual core mode might need a different implementation instead of jobq */ ps_proc->i4_ctb_cnt = ps_tile->u2_wd; ps_proc->i4_ctb_x = ps_codec->s_parse.i4_ctb_x; ps_proc->i4_ctb_y = ps_codec->s_parse.i4_ctb_y; ps_proc->i4_cur_slice_idx = ps_codec->s_parse.i4_cur_slice_idx; ihevcd_init_proc_ctxt(ps_proc, tu_coeff_data_ofst); } } /* Restore cabac context model from top right CTB if entropy sync is enabled */ if(ps_pps->i1_entropy_coding_sync_enabled_flag) { /*TODO Handle single CTB and top-right belonging to a different slice */ if(0 == ps_codec->s_parse.i4_ctb_x) { WORD32 default_ctxt = 0; if((0 == ps_codec->s_parse.i4_ctb_slice_y) && (!ps_slice_hdr->i1_dependent_slice_flag)) default_ctxt = 1; if(1 == ps_sps->i2_pic_wd_in_ctb) default_ctxt = 1; ps_codec->s_parse.u4_qp = slice_qp; if(default_ctxt) { ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm, slice_qp, cabac_init_idc, &gau1_ihevc_cab_ctxts[cabac_init_idc][slice_qp][0]); if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS) { ps_codec->i4_slice_error = 1; end_of_slice_flag = 1; ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } } else { ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm, slice_qp, cabac_init_idc, (const UWORD8 *)&ps_codec->s_parse.s_cabac.au1_ctxt_models_sync); if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS) { ps_codec->i4_slice_error = 1; end_of_slice_flag = 1; ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } } } } if(0 == ps_codec->i4_slice_error) { if(ps_slice_hdr->i1_slice_sao_luma_flag || ps_slice_hdr->i1_slice_sao_chroma_flag) ihevcd_parse_sao(ps_codec); } else { sao_t *ps_sao = ps_codec->s_parse.ps_pic_sao + ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * ps_sps->i2_pic_wd_in_ctb; /* Default values */ ps_sao->b3_y_type_idx = 0; ps_sao->b3_cb_type_idx = 0; ps_sao->b3_cr_type_idx = 0; } { WORD32 ctb_indx; ctb_indx = ps_codec->s_parse.i4_ctb_x + ps_sps->i2_pic_wd_in_ctb * ps_codec->s_parse.i4_ctb_y; ps_codec->s_parse.s_bs_ctxt.pu1_pic_qp_const_in_ctb[ctb_indx >> 3] |= (1 << (ctb_indx & 7)); { UWORD16 *pu1_slice_idx = ps_codec->s_parse.pu1_slice_idx; pu1_slice_idx[ctb_indx] = ps_codec->s_parse.i4_cur_independent_slice_idx; } } if(0 == ps_codec->i4_slice_error) { tu_t *ps_tu = ps_codec->s_parse.ps_tu; WORD32 i4_tu_cnt = ps_codec->s_parse.s_cu.i4_tu_cnt; WORD32 i4_pic_tu_idx = ps_codec->s_parse.i4_pic_tu_idx; pu_t *ps_pu = ps_codec->s_parse.ps_pu; WORD32 i4_pic_pu_idx = ps_codec->s_parse.i4_pic_pu_idx; UWORD8 *pu1_tu_coeff_data = (UWORD8 *)ps_codec->s_parse.pv_tu_coeff_data; ret = ihevcd_parse_coding_quadtree(ps_codec, (ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size), (ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size), ps_sps->i1_log2_ctb_size, 0); /* Check for error */ if (ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS) { /* Reset tu and pu parameters, and signal current ctb as skip */ WORD32 pu_skip_wd, pu_skip_ht; WORD32 rows_remaining, cols_remaining; WORD32 tu_coeff_data_reset_size; /* Set pu wd and ht based on whether the ctb is complete or not */ rows_remaining = ps_sps->i2_pic_height_in_luma_samples - (ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size); pu_skip_ht = MIN(ctb_size, rows_remaining); cols_remaining = ps_sps->i2_pic_width_in_luma_samples - (ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size); pu_skip_wd = MIN(ctb_size, cols_remaining); ps_codec->s_parse.ps_tu = ps_tu; ps_codec->s_parse.s_cu.i4_tu_cnt = i4_tu_cnt; ps_codec->s_parse.i4_pic_tu_idx = i4_pic_tu_idx; ps_codec->s_parse.ps_pu = ps_pu; ps_codec->s_parse.i4_pic_pu_idx = i4_pic_pu_idx; ps_tu->b1_cb_cbf = 0; ps_tu->b1_cr_cbf = 0; ps_tu->b1_y_cbf = 0; ps_tu->b4_pos_x = 0; ps_tu->b4_pos_y = 0; ps_tu->b1_transquant_bypass = 0; ps_tu->b3_size = (ps_sps->i1_log2_ctb_size - 2); ps_tu->b7_qp = ps_codec->s_parse.u4_qp; ps_tu->b3_chroma_intra_mode_idx = INTRA_PRED_CHROMA_IDX_NONE; ps_tu->b6_luma_intra_mode = INTRA_PRED_NONE; ps_tu->b1_first_tu_in_cu = 1; tu_coeff_data_reset_size = (UWORD8 *)ps_codec->s_parse.pv_tu_coeff_data - pu1_tu_coeff_data; memset(pu1_tu_coeff_data, 0, tu_coeff_data_reset_size); ps_codec->s_parse.pv_tu_coeff_data = (void *)pu1_tu_coeff_data; ps_codec->s_parse.ps_tu++; ps_codec->s_parse.s_cu.i4_tu_cnt++; ps_codec->s_parse.i4_pic_tu_idx++; ps_codec->s_parse.s_cu.i4_pred_mode = PRED_MODE_SKIP; ps_codec->s_parse.s_cu.i4_part_mode = PART_2Nx2N; ps_pu->b2_part_idx = 0; ps_pu->b4_pos_x = 0; ps_pu->b4_pos_y = 0; ps_pu->b4_wd = (pu_skip_wd >> 2) - 1; ps_pu->b4_ht = (pu_skip_ht >> 2) - 1; ps_pu->b1_intra_flag = 0; ps_pu->b3_part_mode = ps_codec->s_parse.s_cu.i4_part_mode; ps_pu->b1_merge_flag = 1; ps_pu->b3_merge_idx = 0; ps_codec->s_parse.ps_pu++; ps_codec->s_parse.i4_pic_pu_idx++; /* Set slice error to suppress further parsing and * signal end of slice. */ ps_codec->i4_slice_error = 1; end_of_slice_flag = 1; ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } } else { tu_t *ps_tu = ps_codec->s_parse.ps_tu; pu_t *ps_pu = ps_codec->s_parse.ps_pu; WORD32 pu_skip_wd, pu_skip_ht; WORD32 rows_remaining, cols_remaining; /* Set pu wd and ht based on whether the ctb is complete or not */ rows_remaining = ps_sps->i2_pic_height_in_luma_samples - (ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size); pu_skip_ht = MIN(ctb_size, rows_remaining); cols_remaining = ps_sps->i2_pic_width_in_luma_samples - (ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size); pu_skip_wd = MIN(ctb_size, cols_remaining); ps_tu->b1_cb_cbf = 0; ps_tu->b1_cr_cbf = 0; ps_tu->b1_y_cbf = 0; ps_tu->b4_pos_x = 0; ps_tu->b4_pos_y = 0; ps_tu->b1_transquant_bypass = 0; ps_tu->b3_size = (ps_sps->i1_log2_ctb_size - 2); ps_tu->b7_qp = ps_codec->s_parse.u4_qp; ps_tu->b3_chroma_intra_mode_idx = INTRA_PRED_CHROMA_IDX_NONE; ps_tu->b6_luma_intra_mode = INTRA_PRED_NONE; ps_tu->b1_first_tu_in_cu = 1; ps_codec->s_parse.ps_tu++; ps_codec->s_parse.s_cu.i4_tu_cnt++; ps_codec->s_parse.i4_pic_tu_idx++; ps_codec->s_parse.s_cu.i4_pred_mode = PRED_MODE_SKIP; ps_codec->s_parse.s_cu.i4_part_mode = PART_2Nx2N; ps_pu->b2_part_idx = 0; ps_pu->b4_pos_x = 0; ps_pu->b4_pos_y = 0; ps_pu->b4_wd = (pu_skip_wd >> 2) - 1; ps_pu->b4_ht = (pu_skip_ht >> 2) - 1; ps_pu->b1_intra_flag = 0; ps_pu->b3_part_mode = ps_codec->s_parse.s_cu.i4_part_mode; ps_pu->b1_merge_flag = 1; ps_pu->b3_merge_idx = 0; ps_codec->s_parse.ps_pu++; ps_codec->s_parse.i4_pic_pu_idx++; } if(0 == ps_codec->i4_slice_error) end_of_slice_flag = ihevcd_cabac_decode_terminate(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm); AEV_TRACE("end_of_slice_flag", end_of_slice_flag, ps_codec->s_parse.s_cabac.u4_range); /* In case of tiles or entropy sync, terminate cabac and copy cabac context backed up at the end of top-right CTB */ if(ps_pps->i1_tiles_enabled_flag || ps_pps->i1_entropy_coding_sync_enabled_flag) { WORD32 end_of_tile = 0; WORD32 end_of_tile_row = 0; /* Take a back up of cabac context models if entropy sync is enabled */ if(ps_pps->i1_entropy_coding_sync_enabled_flag || ps_pps->i1_tiles_enabled_flag) { if(1 == ps_codec->s_parse.i4_ctb_x) { WORD32 size = sizeof(ps_codec->s_parse.s_cabac.au1_ctxt_models); memcpy(&ps_codec->s_parse.s_cabac.au1_ctxt_models_sync, &ps_codec->s_parse.s_cabac.au1_ctxt_models, size); } } /* Since tiles and entropy sync are not enabled simultaneously, the following will not result in any problems */ if((ps_codec->s_parse.i4_ctb_tile_x + 1) == (ps_tile->u2_wd)) { end_of_tile_row = 1; if((ps_codec->s_parse.i4_ctb_tile_y + 1) == ps_tile->u2_ht) end_of_tile = 1; } if((0 == end_of_slice_flag) && ((ps_pps->i1_tiles_enabled_flag && end_of_tile) || (ps_pps->i1_entropy_coding_sync_enabled_flag && end_of_tile_row))) { WORD32 end_of_sub_stream_one_bit; end_of_sub_stream_one_bit = ihevcd_cabac_decode_terminate(&ps_codec->s_parse.s_cabac, &ps_codec->s_parse.s_bitstrm); AEV_TRACE("end_of_sub_stream_one_bit", end_of_sub_stream_one_bit, ps_codec->s_parse.s_cabac.u4_range); /* TODO: Remove the check for offset when HM is updated to include a byte unconditionally even for aligned location */ /* For Ittiam streams this check should not be there, for HM9.1 streams this should be there */ if(ps_codec->s_parse.s_bitstrm.u4_bit_ofst % 8) ihevcd_bits_flush_to_byte_boundary(&ps_codec->s_parse.s_bitstrm); UNUSED(end_of_sub_stream_one_bit); } } { WORD32 ctb_indx; ctb_addr = ps_codec->s_parse.i4_ctb_y * num_ctb_in_row + ps_codec->s_parse.i4_ctb_x; ctb_indx = ++ctb_addr; /* Store pu_idx for next CTB in frame level pu_idx array */ if((ps_tile->u2_wd == (ps_codec->s_parse.i4_ctb_tile_x + 1)) && (ps_tile->u2_wd != ps_sps->i2_pic_wd_in_ctb)) { ctb_indx = (ps_sps->i2_pic_wd_in_ctb * (ps_codec->s_parse.i4_ctb_tile_y + 1 + ps_tile->u1_pos_y)) + ps_tile->u1_pos_x; //idx is the beginning of next row in current tile. if(ps_tile->u2_ht == (ps_codec->s_parse.i4_ctb_tile_y + 1)) { if((ps_tile->u2_wd + ps_tile->u1_pos_x == ps_sps->i2_pic_wd_in_ctb) && ((ps_tile->u2_ht + ps_tile->u1_pos_y == ps_sps->i2_pic_ht_in_ctb))) { ctb_indx = ctb_addr; //Next continuous ctb address } else //Not last tile's end , but a tile end { tile_t *ps_next_tile = ps_codec->s_parse.ps_tile + 1; ctb_indx = ps_next_tile->u1_pos_x + (ps_next_tile->u1_pos_y * ps_sps->i2_pic_wd_in_ctb); //idx is the beginning of first row in next tile. } } } ps_codec->s_parse.pu4_pic_pu_idx[ctb_indx] = ps_codec->s_parse.i4_pic_pu_idx; ps_codec->s_parse.i4_next_pu_ctb_cnt = ctb_indx; ps_codec->s_parse.pu1_pu_map += num_min4x4_in_ctb; /* Store tu_idx for next CTB in frame level tu_idx array */ if(1 == ps_codec->i4_num_cores) { ctb_indx = (0 == ctb_addr % RESET_TU_BUF_NCTB) ? RESET_TU_BUF_NCTB : ctb_addr % RESET_TU_BUF_NCTB; if((ps_tile->u2_wd == (ps_codec->s_parse.i4_ctb_tile_x + 1)) && (ps_tile->u2_wd != ps_sps->i2_pic_wd_in_ctb)) { ctb_indx = (ps_sps->i2_pic_wd_in_ctb * (ps_codec->s_parse.i4_ctb_tile_y + 1 + ps_tile->u1_pos_y)) + ps_tile->u1_pos_x; //idx is the beginning of next row in current tile. if(ps_tile->u2_ht == (ps_codec->s_parse.i4_ctb_tile_y + 1)) { if((ps_tile->u2_wd + ps_tile->u1_pos_x == ps_sps->i2_pic_wd_in_ctb) && ((ps_tile->u2_ht + ps_tile->u1_pos_y == ps_sps->i2_pic_ht_in_ctb))) { ctb_indx = (0 == ctb_addr % RESET_TU_BUF_NCTB) ? RESET_TU_BUF_NCTB : ctb_addr % RESET_TU_BUF_NCTB; } else //Not last tile's end , but a tile end { tile_t *ps_next_tile = ps_codec->s_parse.ps_tile + 1; ctb_indx = ps_next_tile->u1_pos_x + (ps_next_tile->u1_pos_y * ps_sps->i2_pic_wd_in_ctb); //idx is the beginning of first row in next tile. } } } ps_codec->s_parse.i4_next_tu_ctb_cnt = ctb_indx; ps_codec->s_parse.pu4_pic_tu_idx[ctb_indx] = ps_codec->s_parse.i4_pic_tu_idx; } else { ctb_indx = ctb_addr; if((ps_tile->u2_wd == (ps_codec->s_parse.i4_ctb_tile_x + 1)) && (ps_tile->u2_wd != ps_sps->i2_pic_wd_in_ctb)) { ctb_indx = (ps_sps->i2_pic_wd_in_ctb * (ps_codec->s_parse.i4_ctb_tile_y + 1 + ps_tile->u1_pos_y)) + ps_tile->u1_pos_x; //idx is the beginning of next row in current tile. if(ps_tile->u2_ht == (ps_codec->s_parse.i4_ctb_tile_y + 1)) { if((ps_tile->u2_wd + ps_tile->u1_pos_x == ps_sps->i2_pic_wd_in_ctb) && ((ps_tile->u2_ht + ps_tile->u1_pos_y == ps_sps->i2_pic_ht_in_ctb))) { ctb_indx = ctb_addr; } else //Not last tile's end , but a tile end { tile_t *ps_next_tile = ps_codec->s_parse.ps_tile + 1; ctb_indx = ps_next_tile->u1_pos_x + (ps_next_tile->u1_pos_y * ps_sps->i2_pic_wd_in_ctb); //idx is the beginning of first row in next tile. } } } ps_codec->s_parse.i4_next_tu_ctb_cnt = ctb_indx; ps_codec->s_parse.pu4_pic_tu_idx[ctb_indx] = ps_codec->s_parse.i4_pic_tu_idx; } ps_codec->s_parse.pu1_tu_map += num_min4x4_in_ctb; } if(ps_codec->i4_num_cores <= MV_PRED_NUM_CORES_THRESHOLD) { /*************************************************/ /**************** MV pred **********************/ /*************************************************/ WORD8 u1_top_ctb_avail = 1; WORD8 u1_left_ctb_avail = 1; WORD8 u1_top_lt_ctb_avail = 1; WORD8 u1_top_rt_ctb_avail = 1; WORD16 i2_wd_in_ctb; tile_start_ctb_idx = ps_tile->u1_pos_x + ps_tile->u1_pos_y * (ps_sps->i2_pic_wd_in_ctb); slice_start_ctb_idx = ps_slice_hdr->i2_ctb_x + ps_slice_hdr->i2_ctb_y * (ps_sps->i2_pic_wd_in_ctb); if((slice_start_ctb_idx < tile_start_ctb_idx)) { i2_wd_in_ctb = ps_sps->i2_pic_wd_in_ctb; } else { i2_wd_in_ctb = ps_tile->u2_wd; } /* slice and tile boundaries */ if((0 == ps_codec->s_parse.i4_ctb_y) || (0 == ps_codec->s_parse.i4_ctb_tile_y)) { u1_top_ctb_avail = 0; u1_top_lt_ctb_avail = 0; u1_top_rt_ctb_avail = 0; } if((0 == ps_codec->s_parse.i4_ctb_x) || (0 == ps_codec->s_parse.i4_ctb_tile_x)) { u1_left_ctb_avail = 0; u1_top_lt_ctb_avail = 0; if((0 == ps_codec->s_parse.i4_ctb_slice_y) || (0 == ps_codec->s_parse.i4_ctb_tile_y)) { u1_top_ctb_avail = 0; if((i2_wd_in_ctb - 1) != ps_codec->s_parse.i4_ctb_slice_x) //TODO: For tile, not implemented { u1_top_rt_ctb_avail = 0; } } } /*For slices not beginning at start of a ctb row*/ else if(ps_codec->s_parse.i4_ctb_x > 0) { if((0 == ps_codec->s_parse.i4_ctb_slice_y) || (0 == ps_codec->s_parse.i4_ctb_tile_y)) { u1_top_ctb_avail = 0; u1_top_lt_ctb_avail = 0; if(0 == ps_codec->s_parse.i4_ctb_slice_x) { u1_left_ctb_avail = 0; } if((i2_wd_in_ctb - 1) != ps_codec->s_parse.i4_ctb_slice_x) { u1_top_rt_ctb_avail = 0; } } else if((1 == ps_codec->s_parse.i4_ctb_slice_y) && (0 == ps_codec->s_parse.i4_ctb_slice_x)) { u1_top_lt_ctb_avail = 0; } } if(((ps_sps->i2_pic_wd_in_ctb - 1) == ps_codec->s_parse.i4_ctb_x) || ((ps_tile->u2_wd - 1) == ps_codec->s_parse.i4_ctb_tile_x)) { u1_top_rt_ctb_avail = 0; } if(PSLICE == ps_slice_hdr->i1_slice_type || BSLICE == ps_slice_hdr->i1_slice_type) { mv_ctxt_t s_mv_ctxt; process_ctxt_t *ps_proc; UWORD32 *pu4_ctb_top_pu_idx; UWORD32 *pu4_ctb_left_pu_idx; UWORD32 *pu4_ctb_top_left_pu_idx; WORD32 i4_ctb_pu_cnt; WORD32 cur_ctb_idx; WORD32 next_ctb_idx; WORD32 cur_pu_idx; ps_proc = &ps_codec->as_process[(ps_codec->i4_num_cores == 1) ? 1 : (ps_codec->i4_num_cores - 1)]; cur_ctb_idx = ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * (ps_sps->i2_pic_wd_in_ctb); next_ctb_idx = ps_codec->s_parse.i4_next_pu_ctb_cnt; i4_ctb_pu_cnt = ps_codec->s_parse.pu4_pic_pu_idx[next_ctb_idx] - ps_codec->s_parse.pu4_pic_pu_idx[cur_ctb_idx]; cur_pu_idx = ps_codec->s_parse.pu4_pic_pu_idx[cur_ctb_idx]; pu4_ctb_top_pu_idx = ps_proc->pu4_pic_pu_idx_top + (ps_codec->s_parse.i4_ctb_x * ctb_size / MIN_PU_SIZE); pu4_ctb_left_pu_idx = ps_proc->pu4_pic_pu_idx_left; pu4_ctb_top_left_pu_idx = &ps_proc->u4_ctb_top_left_pu_idx; /* Initializing s_mv_ctxt */ { s_mv_ctxt.ps_pps = ps_pps; s_mv_ctxt.ps_sps = ps_sps; s_mv_ctxt.ps_slice_hdr = ps_slice_hdr; s_mv_ctxt.i4_ctb_x = ps_codec->s_parse.i4_ctb_x; s_mv_ctxt.i4_ctb_y = ps_codec->s_parse.i4_ctb_y; s_mv_ctxt.ps_pu = &ps_codec->s_parse.ps_pic_pu[cur_pu_idx]; s_mv_ctxt.ps_pic_pu = ps_codec->s_parse.ps_pic_pu; s_mv_ctxt.ps_tile = ps_tile; s_mv_ctxt.pu4_pic_pu_idx_map = ps_proc->pu4_pic_pu_idx_map; s_mv_ctxt.pu4_pic_pu_idx = ps_codec->s_parse.pu4_pic_pu_idx; s_mv_ctxt.pu1_pic_pu_map = ps_codec->s_parse.pu1_pic_pu_map; s_mv_ctxt.i4_ctb_pu_cnt = i4_ctb_pu_cnt; s_mv_ctxt.i4_ctb_start_pu_idx = cur_pu_idx; s_mv_ctxt.u1_top_ctb_avail = u1_top_ctb_avail; s_mv_ctxt.u1_top_rt_ctb_avail = u1_top_rt_ctb_avail; s_mv_ctxt.u1_top_lt_ctb_avail = u1_top_lt_ctb_avail; s_mv_ctxt.u1_left_ctb_avail = u1_left_ctb_avail; } ihevcd_get_mv_ctb(&s_mv_ctxt, pu4_ctb_top_pu_idx, pu4_ctb_left_pu_idx, pu4_ctb_top_left_pu_idx); } else { WORD32 num_minpu_in_ctb = (ctb_size / MIN_PU_SIZE) * (ctb_size / MIN_PU_SIZE); UWORD8 *pu1_pic_pu_map_ctb = ps_codec->s_parse.pu1_pic_pu_map + (ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * ps_sps->i2_pic_wd_in_ctb) * num_minpu_in_ctb; process_ctxt_t *ps_proc = &ps_codec->as_process[(ps_codec->i4_num_cores == 1) ? 1 : (ps_codec->i4_num_cores - 1)]; WORD32 row, col; WORD32 pu_cnt; WORD32 num_pu_per_ctb; WORD32 cur_ctb_idx; WORD32 next_ctb_idx; WORD32 ctb_start_pu_idx; UWORD32 *pu4_nbr_pu_idx = ps_proc->pu4_pic_pu_idx_map; WORD32 nbr_pu_idx_strd = MAX_CTB_SIZE / MIN_PU_SIZE + 2; pu_t *ps_pu; for(row = 0; row < ctb_size / MIN_PU_SIZE; row++) { for(col = 0; col < ctb_size / MIN_PU_SIZE; col++) { pu1_pic_pu_map_ctb[row * ctb_size / MIN_PU_SIZE + col] = 0; } } /* Neighbor PU idx update inside CTB */ /* 1byte per 4x4. Indicates the PU idx that 4x4 block belongs to */ cur_ctb_idx = ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * (ps_sps->i2_pic_wd_in_ctb); next_ctb_idx = ps_codec->s_parse.i4_next_pu_ctb_cnt; num_pu_per_ctb = ps_codec->s_parse.pu4_pic_pu_idx[next_ctb_idx] - ps_codec->s_parse.pu4_pic_pu_idx[cur_ctb_idx]; ctb_start_pu_idx = ps_codec->s_parse.pu4_pic_pu_idx[cur_ctb_idx]; ps_pu = &ps_codec->s_parse.ps_pic_pu[ctb_start_pu_idx]; for(pu_cnt = 0; pu_cnt < num_pu_per_ctb; pu_cnt++, ps_pu++) { UWORD32 cur_pu_idx; WORD32 pu_ht = (ps_pu->b4_ht + 1) << 2; WORD32 pu_wd = (ps_pu->b4_wd + 1) << 2; cur_pu_idx = ctb_start_pu_idx + pu_cnt; for(row = 0; row < pu_ht / MIN_PU_SIZE; row++) for(col = 0; col < pu_wd / MIN_PU_SIZE; col++) pu4_nbr_pu_idx[(1 + ps_pu->b4_pos_x + col) + (1 + ps_pu->b4_pos_y + row) * nbr_pu_idx_strd] = cur_pu_idx; } /* Updating Top and Left pointers */ { WORD32 rows_remaining = ps_sps->i2_pic_height_in_luma_samples - (ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size); WORD32 ctb_size_left = MIN(ctb_size, rows_remaining); /* Top Left */ /* saving top left before updating top ptr, as updating top ptr will overwrite the top left for the next ctb */ ps_proc->u4_ctb_top_left_pu_idx = ps_proc->pu4_pic_pu_idx_top[(ps_codec->s_parse.i4_ctb_x * ctb_size / MIN_PU_SIZE) + ctb_size / MIN_PU_SIZE - 1]; for(i = 0; i < ctb_size / MIN_PU_SIZE; i++) { /* Left */ /* Last column of au4_nbr_pu_idx */ ps_proc->pu4_pic_pu_idx_left[i] = pu4_nbr_pu_idx[(ctb_size / MIN_PU_SIZE) + (i + 1) * nbr_pu_idx_strd]; /* Top */ /* Last row of au4_nbr_pu_idx */ ps_proc->pu4_pic_pu_idx_top[(ps_codec->s_parse.i4_ctb_x * ctb_size / MIN_PU_SIZE) + i] = pu4_nbr_pu_idx[(ctb_size_left / MIN_PU_SIZE) * nbr_pu_idx_strd + i + 1]; } } } /*************************************************/ /****************** BS, QP *********************/ /*************************************************/ /* Check if deblock is disabled for the current slice or if it is disabled for the current picture * because of disable deblock api */ if(0 == ps_codec->i4_disable_deblk_pic) { if((0 == ps_slice_hdr->i1_slice_disable_deblocking_filter_flag) && (0 == ps_codec->i4_slice_error)) { WORD32 i4_ctb_tu_cnt; WORD32 cur_ctb_idx, next_ctb_idx; WORD32 cur_pu_idx; WORD32 cur_tu_idx; process_ctxt_t *ps_proc; ps_proc = &ps_codec->as_process[(ps_codec->i4_num_cores == 1) ? 1 : (ps_codec->i4_num_cores - 1)]; cur_ctb_idx = ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * (ps_sps->i2_pic_wd_in_ctb); cur_pu_idx = ps_codec->s_parse.pu4_pic_pu_idx[cur_ctb_idx]; next_ctb_idx = ps_codec->s_parse.i4_next_tu_ctb_cnt; if(1 == ps_codec->i4_num_cores) { i4_ctb_tu_cnt = ps_codec->s_parse.pu4_pic_tu_idx[next_ctb_idx] - ps_codec->s_parse.pu4_pic_tu_idx[cur_ctb_idx % RESET_TU_BUF_NCTB]; cur_tu_idx = ps_codec->s_parse.pu4_pic_tu_idx[cur_ctb_idx % RESET_TU_BUF_NCTB]; } else { i4_ctb_tu_cnt = ps_codec->s_parse.pu4_pic_tu_idx[next_ctb_idx] - ps_codec->s_parse.pu4_pic_tu_idx[cur_ctb_idx]; cur_tu_idx = ps_codec->s_parse.pu4_pic_tu_idx[cur_ctb_idx]; } ps_codec->s_parse.s_bs_ctxt.ps_pps = ps_codec->s_parse.ps_pps; ps_codec->s_parse.s_bs_ctxt.ps_sps = ps_codec->s_parse.ps_sps; ps_codec->s_parse.s_bs_ctxt.ps_codec = ps_codec; ps_codec->s_parse.s_bs_ctxt.i4_ctb_tu_cnt = i4_ctb_tu_cnt; ps_codec->s_parse.s_bs_ctxt.i4_ctb_x = ps_codec->s_parse.i4_ctb_x; ps_codec->s_parse.s_bs_ctxt.i4_ctb_y = ps_codec->s_parse.i4_ctb_y; ps_codec->s_parse.s_bs_ctxt.i4_ctb_tile_x = ps_codec->s_parse.i4_ctb_tile_x; ps_codec->s_parse.s_bs_ctxt.i4_ctb_tile_y = ps_codec->s_parse.i4_ctb_tile_y; ps_codec->s_parse.s_bs_ctxt.i4_ctb_slice_x = ps_codec->s_parse.i4_ctb_slice_x; ps_codec->s_parse.s_bs_ctxt.i4_ctb_slice_y = ps_codec->s_parse.i4_ctb_slice_y; ps_codec->s_parse.s_bs_ctxt.ps_tu = &ps_codec->s_parse.ps_pic_tu[cur_tu_idx]; ps_codec->s_parse.s_bs_ctxt.ps_pu = &ps_codec->s_parse.ps_pic_pu[cur_pu_idx]; ps_codec->s_parse.s_bs_ctxt.pu4_pic_pu_idx_map = ps_proc->pu4_pic_pu_idx_map; ps_codec->s_parse.s_bs_ctxt.i4_next_pu_ctb_cnt = ps_codec->s_parse.i4_next_pu_ctb_cnt; ps_codec->s_parse.s_bs_ctxt.i4_next_tu_ctb_cnt = ps_codec->s_parse.i4_next_tu_ctb_cnt; ps_codec->s_parse.s_bs_ctxt.pu1_slice_idx = ps_codec->s_parse.pu1_slice_idx; ps_codec->s_parse.s_bs_ctxt.ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr; ps_codec->s_parse.s_bs_ctxt.ps_tile = ps_codec->s_parse.ps_tile; if(ISLICE == ps_slice_hdr->i1_slice_type) { ihevcd_ctb_boundary_strength_islice(&ps_codec->s_parse.s_bs_ctxt); } else { ihevcd_ctb_boundary_strength_pbslice(&ps_codec->s_parse.s_bs_ctxt); } } else { WORD32 bs_strd = (ps_sps->i2_pic_wd_in_ctb + 1) * (ctb_size * ctb_size / 8 / 16); UWORD32 *pu4_vert_bs = (UWORD32 *)((UWORD8 *)ps_codec->s_parse.s_bs_ctxt.pu4_pic_vert_bs + ps_codec->s_parse.i4_ctb_x * (ctb_size * ctb_size / 8 / 16) + ps_codec->s_parse.i4_ctb_y * bs_strd); UWORD32 *pu4_horz_bs = (UWORD32 *)((UWORD8 *)ps_codec->s_parse.s_bs_ctxt.pu4_pic_horz_bs + ps_codec->s_parse.i4_ctb_x * (ctb_size * ctb_size / 8 / 16) + ps_codec->s_parse.i4_ctb_y * bs_strd); memset(pu4_vert_bs, 0, (ctb_size / 8 + 1) * (ctb_size / 4) / 8 * 2); memset(pu4_horz_bs, 0, (ctb_size / 8) * (ctb_size / 4) / 8 * 2); } } } /* Update the parse status map */ { sps_t *ps_sps = ps_codec->s_parse.ps_sps; UWORD8 *pu1_buf; WORD32 idx; idx = (ps_codec->s_parse.i4_ctb_x); idx += ((ps_codec->s_parse.i4_ctb_y) * ps_sps->i2_pic_wd_in_ctb); pu1_buf = (ps_codec->pu1_parse_map + idx); *pu1_buf = 1; } /* Increment CTB x and y positions */ ps_codec->s_parse.i4_ctb_tile_x++; ps_codec->s_parse.i4_ctb_x++; ps_codec->s_parse.i4_ctb_slice_x++; /*If tiles are enabled, handle the slice counters differently*/ if(ps_pps->i1_tiles_enabled_flag) { tile_start_ctb_idx = ps_tile->u1_pos_x + ps_tile->u1_pos_y * (ps_sps->i2_pic_wd_in_ctb); slice_start_ctb_idx = ps_slice_hdr->i2_ctb_x + ps_slice_hdr->i2_ctb_y * (ps_sps->i2_pic_wd_in_ctb); if((slice_start_ctb_idx < tile_start_ctb_idx)) { if(ps_codec->s_parse.i4_ctb_slice_x == (ps_tile->u1_pos_x + ps_tile->u2_wd)) { /* Reached end of slice row within a tile /frame */ ps_codec->s_parse.i4_ctb_slice_y++; ps_codec->s_parse.i4_ctb_slice_x = ps_tile->u1_pos_x; //todo:Check } } else if(ps_codec->s_parse.i4_ctb_slice_x == (ps_tile->u2_wd)) { ps_codec->s_parse.i4_ctb_slice_y++; ps_codec->s_parse.i4_ctb_slice_x = 0; } } else { if(ps_codec->s_parse.i4_ctb_slice_x == ps_tile->u2_wd) { /* Reached end of slice row within a tile /frame */ ps_codec->s_parse.i4_ctb_slice_y++; ps_codec->s_parse.i4_ctb_slice_x = 0; } } if(ps_codec->s_parse.i4_ctb_tile_x == (ps_tile->u2_wd)) { /* Reached end of tile row */ ps_codec->s_parse.i4_ctb_tile_x = 0; ps_codec->s_parse.i4_ctb_x = ps_tile->u1_pos_x; ps_codec->s_parse.i4_ctb_tile_y++; ps_codec->s_parse.i4_ctb_y++; if(ps_codec->s_parse.i4_ctb_tile_y == (ps_tile->u2_ht)) { /* Reached End of Tile */ ps_codec->s_parse.i4_ctb_tile_y = 0; ps_codec->s_parse.i4_ctb_tile_x = 0; ps_codec->s_parse.ps_tile++; if((ps_tile->u2_ht + ps_tile->u1_pos_y == ps_sps->i2_pic_ht_in_ctb) && (ps_tile->u2_wd + ps_tile->u1_pos_x == ps_sps->i2_pic_wd_in_ctb)) { /* Reached end of frame */ end_of_pic = 1; ps_codec->s_parse.i4_ctb_x = 0; ps_codec->s_parse.i4_ctb_y = ps_sps->i2_pic_ht_in_ctb; } else { /* Initialize ctb_x and ctb_y to start of next tile */ ps_tile = ps_codec->s_parse.ps_tile; ps_codec->s_parse.i4_ctb_x = ps_tile->u1_pos_x; ps_codec->s_parse.i4_ctb_y = ps_tile->u1_pos_y; ps_codec->s_parse.i4_ctb_tile_y = 0; ps_codec->s_parse.i4_ctb_tile_x = 0; ps_codec->s_parse.i4_ctb_slice_x = ps_tile->u1_pos_x; ps_codec->s_parse.i4_ctb_slice_y = ps_tile->u1_pos_y; } } } ps_codec->s_parse.i4_next_ctb_indx = ps_codec->s_parse.i4_ctb_x + ps_codec->s_parse.i4_ctb_y * ps_sps->i2_pic_wd_in_ctb; /* If the current slice is in error, check if the next slice's address * is reached and mark the end_of_slice flag */ if(ps_codec->i4_slice_error) { slice_header_t *ps_slice_hdr_next = ps_slice_hdr + 1; WORD32 next_slice_addr = ps_slice_hdr_next->i2_ctb_x + ps_slice_hdr_next->i2_ctb_y * ps_sps->i2_pic_wd_in_ctb; if(ps_codec->s_parse.i4_next_ctb_indx == next_slice_addr) end_of_slice_flag = 1; } /* If the codec is running in single core mode * then call process function for current CTB */ if((1 == ps_codec->i4_num_cores) && (ps_codec->s_parse.i4_ctb_tile_x == 0)) { process_ctxt_t *ps_proc = &ps_codec->as_process[0]; ps_proc->i4_ctb_cnt = ps_proc->ps_tile->u2_wd; ihevcd_process(ps_proc); } /* If the bytes for the current slice are exhausted * set end_of_slice flag to 1 * This slice will be treated as incomplete */ if((UWORD8 *)ps_codec->s_parse.s_bitstrm.pu1_buf_max + BITSTRM_OFF_THRS < ((UWORD8 *)ps_codec->s_parse.s_bitstrm.pu4_buf + (ps_codec->s_parse.s_bitstrm.u4_bit_ofst / 8))) { if(0 == ps_codec->i4_slice_error) end_of_slice_flag = 1; } if(end_of_pic) break; } while(!end_of_slice_flag); /* Reset slice error */ ps_codec->i4_slice_error = 0; /* Increment the slice index for parsing next slice */ if(0 == end_of_pic) { while(1) { WORD32 parse_slice_idx; parse_slice_idx = ps_codec->s_parse.i4_cur_slice_idx; parse_slice_idx++; { /* If the next slice header is not initialized, update cur_slice_idx and break */ if((1 == ps_codec->i4_num_cores) || (0 != (parse_slice_idx & (MAX_SLICE_HDR_CNT - 1)))) { ps_codec->s_parse.i4_cur_slice_idx = parse_slice_idx; break; } /* If the next slice header is initialised, wait for the parsed slices to be processed */ else { WORD32 ctb_indx = 0; while(ctb_indx != ps_sps->i4_pic_size_in_ctb) { WORD32 parse_status = *(ps_codec->pu1_parse_map + ctb_indx); volatile WORD32 proc_status = *(ps_codec->pu1_proc_map + ctb_indx) & 1; if(parse_status == proc_status) ctb_indx++; } ps_codec->s_parse.i4_cur_slice_idx = parse_slice_idx; break; } } } } else { #if FRAME_ILF_PAD if(FRAME_ILF_PAD && 1 == ps_codec->i4_num_cores) { if(ps_slice_hdr->i4_abs_pic_order_cnt == 0) { DUMP_PRE_ILF(ps_codec->as_process[0].pu1_cur_pic_luma, ps_codec->as_process[0].pu1_cur_pic_chroma, ps_sps->i2_pic_width_in_luma_samples, ps_sps->i2_pic_height_in_luma_samples, ps_codec->i4_strd); DUMP_BS(ps_codec->as_process[0].s_bs_ctxt.pu4_pic_vert_bs, ps_codec->as_process[0].s_bs_ctxt.pu4_pic_horz_bs, ps_sps->i2_pic_wd_in_ctb * (ctb_size * ctb_size / 8 / 16) * ps_sps->i2_pic_ht_in_ctb, (ps_sps->i2_pic_wd_in_ctb + 1) * (ctb_size * ctb_size / 8 / 16) * ps_sps->i2_pic_ht_in_ctb); DUMP_QP(ps_codec->as_process[0].s_bs_ctxt.pu1_pic_qp, (ps_sps->i2_pic_height_in_luma_samples * ps_sps->i2_pic_width_in_luma_samples) / (MIN_CU_SIZE * MIN_CU_SIZE)); DUMP_QP_CONST_IN_CTB(ps_codec->as_process[0].s_bs_ctxt.pu1_pic_qp_const_in_ctb, (ps_sps->i2_pic_height_in_luma_samples * ps_sps->i2_pic_width_in_luma_samples) / (MIN_CTB_SIZE * MIN_CTB_SIZE) / 8); DUMP_NO_LOOP_FILTER(ps_codec->as_process[0].pu1_pic_no_loop_filter_flag, (ps_sps->i2_pic_width_in_luma_samples / MIN_CU_SIZE) * (ps_sps->i2_pic_height_in_luma_samples / MIN_CU_SIZE) / 8); DUMP_OFFSETS(ps_slice_hdr->i1_beta_offset_div2, ps_slice_hdr->i1_tc_offset_div2, ps_pps->i1_pic_cb_qp_offset, ps_pps->i1_pic_cr_qp_offset); } ps_codec->s_parse.s_deblk_ctxt.ps_pps = ps_codec->s_parse.ps_pps; ps_codec->s_parse.s_deblk_ctxt.ps_sps = ps_codec->s_parse.ps_sps; ps_codec->s_parse.s_deblk_ctxt.ps_codec = ps_codec; ps_codec->s_parse.s_deblk_ctxt.ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr; ps_codec->s_parse.s_deblk_ctxt.is_chroma_yuv420sp_vu = (ps_codec->e_ref_chroma_fmt == IV_YUV_420SP_VU); ps_codec->s_parse.s_sao_ctxt.ps_pps = ps_codec->s_parse.ps_pps; ps_codec->s_parse.s_sao_ctxt.ps_sps = ps_codec->s_parse.ps_sps; ps_codec->s_parse.s_sao_ctxt.ps_codec = ps_codec; ps_codec->s_parse.s_sao_ctxt.ps_slice_hdr = ps_codec->s_parse.ps_slice_hdr; ihevcd_ilf_pad_frame(&ps_codec->s_parse.s_deblk_ctxt, &ps_codec->s_parse.s_sao_ctxt); } #endif ps_codec->s_parse.i4_end_of_frame = 1; } return ret; } Commit Message: Set error skip ctbs as multiple 8x8 pus Bug: 65123471 This is required for incomplete ctbs at the frame boundaries Change-Id: I7e41a3ac2f6e35a929ba4ff3ca4cfcc859a7b867 CWE ID: CWE-200
1
174,118
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 adev_set_voice_volume(struct audio_hw_device *dev, float volume) { UNUSED(dev); UNUSED(volume); FNLOG(); return -ENOSYS; } Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release CWE ID: CWE-284
0
158,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: bool AXLayoutObject::isSVGImage() const { return remoteSVGRootElement(); } 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,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: AccessibilityRole AXObject::ariaRoleToWebCoreRole(const String& value) { ASSERT(!value.isEmpty()); static const ARIARoleMap* roleMap = createARIARoleMap(); Vector<String> roleVector; value.split(' ', roleVector); AccessibilityRole role = UnknownRole; for (const auto& child : roleVector) { role = roleMap->at(child); if (role) return role; } return role; } 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,229
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: xar_bid(struct archive_read *a, int best_bid) { const unsigned char *b; int bid; (void)best_bid; /* UNUSED */ b = __archive_read_ahead(a, HEADER_SIZE, NULL); if (b == NULL) return (-1); bid = 0; /* * Verify magic code */ if (archive_be32dec(b) != HEADER_MAGIC) return (0); bid += 32; /* * Verify header size */ if (archive_be16dec(b+4) != HEADER_SIZE) return (0); bid += 16; /* * Verify header version */ if (archive_be16dec(b+6) != HEADER_VERSION) return (0); bid += 16; /* * Verify type of checksum */ switch (archive_be32dec(b+24)) { case CKSUM_NONE: case CKSUM_SHA1: case CKSUM_MD5: bid += 32; break; default: return (0); } return (bid); } Commit Message: Do something sensible for empty strings to make fuzzers happy. CWE ID: CWE-125
0
61,662
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: ALWAYS_INLINE void jsvFreePtr(JsVar *var) { /* To be here, we're not supposed to be part of anything else. If * we were, we'd have been freed by jsvGarbageCollect */ assert((!jsvGetNextSibling(var) && !jsvGetPrevSibling(var)) || // check that next/prevSibling are not set jsvIsRefUsedForData(var) || // UNLESS we're part of a string and nextSibling/prevSibling are used for string data (jsvIsName(var) && (jsvGetNextSibling(var)==jsvGetPrevSibling(var)))); // UNLESS we're signalling that we're jsvIsNewChild if (jsvIsNameWithValue(var)) { #ifdef CLEAR_MEMORY_ON_FREE jsvSetFirstChild(var, 0); // it just contained random data - zero it #endif // CLEAR_MEMORY_ON_FREE } else if (jsvHasSingleChild(var)) { if (jsvGetFirstChild(var)) { JsVar *child = jsvLock(jsvGetFirstChild(var)); jsvUnRef(child); #ifdef CLEAR_MEMORY_ON_FREE jsvSetFirstChild(var, 0); // unlink the child #endif // CLEAR_MEMORY_ON_FREE jsvUnLock(child); // unlock should trigger a free } } /* No else, because a String Name may have a single child, but * also StringExts */ /* Now, free children - see jsvar.h comments for how! */ if (jsvHasStringExt(var)) { JsVarRef stringDataRef = jsvGetLastChild(var); #ifdef CLEAR_MEMORY_ON_FREE jsvSetLastChild(var, 0); #endif // CLEAR_MEMORY_ON_FREE while (stringDataRef) { JsVar *child = jsvGetAddressOf(stringDataRef); assert(jsvIsStringExt(child)); stringDataRef = jsvGetLastChild(child); jsvFreePtrInternal(child); } if (jsvIsFlatString(var)) { size_t count = jsvGetFlatStringBlocks(var); JsVarRef i = (JsVarRef)(jsvGetRef(var)+count); while (count--) { JsVar *p = jsvGetAddressOf(i--); p->flags = JSV_UNUSED; // set locks to 0 so the assert in jsvFreePtrInternal doesn't get fed up jsvFreePtrInternal(p); } } else if (jsvIsBasicString(var)) { #ifdef CLEAR_MEMORY_ON_FREE jsvSetFirstChild(var, 0); // firstchild could have had string data in #endif // CLEAR_MEMORY_ON_FREE } } /* NO ELSE HERE - because jsvIsNewChild stuff can be for Names, which can be ints or strings */ if (jsvHasChildren(var)) { JsVarRef childref = jsvGetFirstChild(var); #ifdef CLEAR_MEMORY_ON_FREE jsvSetFirstChild(var, 0); jsvSetLastChild(var, 0); #endif // CLEAR_MEMORY_ON_FREE while (childref) { JsVar *child = jsvLock(childref); assert(jsvIsName(child)); childref = jsvGetNextSibling(child); jsvSetPrevSibling(child, 0); jsvSetNextSibling(child, 0); jsvUnRef(child); jsvUnLock(child); } } else { #ifdef CLEAR_MEMORY_ON_FREE #if JSVARREF_SIZE==1 assert(jsvIsFloat(var) || !jsvGetFirstChild(var)); assert(jsvIsFloat(var) || !jsvGetLastChild(var)); #else assert(!jsvGetFirstChild(var)); // strings use firstchild now as well assert(!jsvGetLastChild(var)); #endif #endif // CLEAR_MEMORY_ON_FREE if (jsvIsName(var)) { assert(jsvGetNextSibling(var)==jsvGetPrevSibling(var)); // the case for jsvIsNewChild if (jsvGetNextSibling(var)) { jsvUnRefRef(jsvGetNextSibling(var)); jsvUnRefRef(jsvGetPrevSibling(var)); } } } jsvFreePtrInternal(var); } Commit Message: fix jsvGetString regression CWE ID: CWE-119
0
82,392
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_pgsql_fd_close(php_stream *stream, int close_handle) /* {{{ */ { return EOF; } /* }}} */ Commit Message: CWE ID:
0
5,233
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 ahci_populate_sglist(AHCIDevice *ad, QEMUSGList *sglist, AHCICmdHdr *cmd, int64_t limit, uint64_t offset) { uint16_t opts = le16_to_cpu(cmd->opts); uint16_t prdtl = le16_to_cpu(cmd->prdtl); uint64_t cfis_addr = le64_to_cpu(cmd->tbl_addr); uint64_t prdt_addr = cfis_addr + 0x80; dma_addr_t prdt_len = (prdtl * sizeof(AHCI_SG)); dma_addr_t real_prdt_len = prdt_len; uint8_t *prdt; int i; int r = 0; uint64_t sum = 0; int off_idx = -1; int64_t off_pos = -1; int tbl_entry_size; IDEBus *bus = &ad->port; BusState *qbus = BUS(bus); if (!prdtl) { DPRINTF(ad->port_no, "no sg list given by guest: 0x%08x\n", opts); return -1; } /* map PRDT */ if (!(prdt = dma_memory_map(ad->hba->as, prdt_addr, &prdt_len, DMA_DIRECTION_TO_DEVICE))){ DPRINTF(ad->port_no, "map failed\n"); return -1; } if (prdt_len < real_prdt_len) { DPRINTF(ad->port_no, "mapped less than expected\n"); r = -1; goto out; } /* Get entries in the PRDT, init a qemu sglist accordingly */ if (prdtl > 0) { AHCI_SG *tbl = (AHCI_SG *)prdt; sum = 0; for (i = 0; i < prdtl; i++) { tbl_entry_size = prdt_tbl_entry_size(&tbl[i]); if (offset < (sum + tbl_entry_size)) { off_idx = i; off_pos = offset - sum; break; } sum += tbl_entry_size; } if ((off_idx == -1) || (off_pos < 0) || (off_pos > tbl_entry_size)) { DPRINTF(ad->port_no, "%s: Incorrect offset! " "off_idx: %d, off_pos: %"PRId64"\n", __func__, off_idx, off_pos); r = -1; goto out; } qemu_sglist_init(sglist, qbus->parent, (prdtl - off_idx), ad->hba->as); qemu_sglist_add(sglist, le64_to_cpu(tbl[off_idx].addr) + off_pos, MIN(prdt_tbl_entry_size(&tbl[off_idx]) - off_pos, limit)); for (i = off_idx + 1; i < prdtl && sglist->size < limit; i++) { qemu_sglist_add(sglist, le64_to_cpu(tbl[i].addr), MIN(prdt_tbl_entry_size(&tbl[i]), limit - sglist->size)); } } out: dma_memory_unmap(ad->hba->as, prdt, prdt_len, DMA_DIRECTION_TO_DEVICE, prdt_len); return r; } Commit Message: CWE ID: CWE-772
0
5,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: static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, struct ib_grh *grh, struct cm_av *av) { av->port = port; av->pkey_index = wc->pkey_index; ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, grh, &av->ah_attr); } Commit Message: IB/core: Don't resolve passive side RoCE L2 address in CMA REQ handler The code that resolves the passive side source MAC within the rdma_cm connection request handler was both redundant and buggy, so remove it. It was redundant since later, when an RC QP is modified to RTR state, the resolution will take place in the ib_core module. It was buggy because this callback also deals with UD SIDR exchange, for which we incorrectly looked at the REQ member of the CM event and dereferenced a random value. Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures") Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> CWE ID: CWE-20
0
38,392
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 virtio_config_readb(VirtIODevice *vdev, uint32_t addr) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint8_t val; if (addr + sizeof(val) > vdev->config_len) { return (uint32_t)-1; } k->get_config(vdev, vdev->config); val = ldub_p(vdev->config + addr); return val; } Commit Message: CWE ID: CWE-20
0
9,187
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: wkbConvPolygonToShape(wkbObj *w, shapeObj *shape) { int type; int i, nrings; lineObj line; /*endian = */wkbReadChar(w); type = wkbTypeMap(w,wkbReadInt(w)); if( type != WKB_POLYGON ) return MS_FAILURE; /* How many rings? */ nrings = wkbReadInt(w); /* Add each ring to the shape */ for( i = 0; i < nrings; i++ ) { wkbReadLine(w,&line); msAddLineDirectly(shape, &line); } return MS_SUCCESS; } Commit Message: Fix potential SQL Injection with postgis TIME filters (#4834) CWE ID: CWE-89
0
40,850
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 mp_startup(struct sb_uart_state *state, int init_hw) { struct sb_uart_info *info = state->info; struct sb_uart_port *port = state->port; unsigned long page; int retval = 0; if (info->flags & UIF_INITIALIZED) return 0; if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags); if (port->type == PORT_UNKNOWN) return 0; if (!info->xmit.buf) { page = get_zeroed_page(GFP_KERNEL); if (!page) return -ENOMEM; info->xmit.buf = (unsigned char *) page; uart_circ_clear(&info->xmit); } retval = port->ops->startup(port); if (retval == 0) { if (init_hw) { mp_change_speed(state, NULL); if (info->tty->termios.c_cflag & CBAUD) uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); } info->flags |= UIF_INITIALIZED; clear_bit(TTY_IO_ERROR, &info->tty->flags); } if (retval && capable(CAP_SYS_ADMIN)) retval = 0; return retval; } Commit Message: Staging: sb105x: info leak in mp_get_count() The icount.reserved[] array isn't initialized so it leaks stack information to userspace. Reported-by: Nico Golde <nico@ngolde.de> Reported-by: Fabian Yamaguchi <fabs@goesec.de> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-200
0
29,402
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 nfs_do_write(struct nfs_write_data *data, const struct rpc_call_ops *call_ops, int how) { struct inode *inode = data->header->inode; return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0); } Commit Message: nfs: always make sure page is up-to-date before extending a write to cover the entire page We should always make sure the cached page is up-to-date when we're determining whether we can extend a write to cover the full page -- even if we've received a write delegation from the server. Commit c7559663 added logic to skip this check if we have a write delegation, which can lead to data corruption such as the following scenario if client B receives a write delegation from the NFS server: Client A: # echo 123456789 > /mnt/file Client B: # echo abcdefghi >> /mnt/file # cat /mnt/file 0�D0�abcdefghi Just because we hold a write delegation doesn't mean that we've read in the entire page contents. Cc: <stable@vger.kernel.org> # v3.11+ Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> CWE ID: CWE-20
0
39,153
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 OnQueryDownloadsComplete( std::unique_ptr<std::vector<history::DownloadRow>> entries) { result_valid_ = true; results_ = std::move(entries); base::RunLoop::QuitCurrentWhenIdleDeprecated(); } Commit Message: When turning a download into a navigation, navigate the right frame Code changes from Nate Chapin <japhet@chromium.org> Bug: 926105 Change-Id: I098599394e6ebe7d2fce5af838014297a337d294 Reviewed-on: https://chromium-review.googlesource.com/c/1454962 Reviewed-by: Camille Lamy <clamy@chromium.org> Commit-Queue: Jochen Eisinger <jochen@chromium.org> Cr-Commit-Position: refs/heads/master@{#629547} CWE ID: CWE-284
0
151,934
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 CL_CDDialog( void ) { cls.cddialog = qtrue; // start it next frame } Commit Message: Don't load .pk3s as .dlls, and don't load user config files from .pk3s. CWE ID: CWE-269
0
95,941
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 jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, umode_t *i_mode) { struct posix_acl *default_acl, *acl; int rc; cache_no_acl(inode); rc = posix_acl_create(dir_i, i_mode, &default_acl, &acl); if (rc) return rc; if (default_acl) { set_cached_acl(inode, ACL_TYPE_DEFAULT, default_acl); posix_acl_release(default_acl); } if (acl) { set_cached_acl(inode, ACL_TYPE_ACCESS, acl); posix_acl_release(acl); } return 0; } Commit Message: posix_acl: Clear SGID bit when setting file permissions When file permissions are modified via chmod(2) and the user is not in the owning group or capable of CAP_FSETID, the setgid bit is cleared in inode_change_ok(). Setting a POSIX ACL via setxattr(2) sets the file permissions as well as the new ACL, but doesn't clear the setgid bit in a similar way; this allows to bypass the check in chmod(2). Fix that. References: CVE-2016-7097 Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> CWE ID: CWE-285
0
50,353
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 AppLauncherHandler::RegisterMessages() { registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, content::Source<WebContents>(web_ui()->GetWebContents())); #if defined(ENABLE_APP_LIST) if (g_browser_process->local_state()) { local_state_pref_change_registrar_.Init(g_browser_process->local_state()); local_state_pref_change_registrar_.Add( prefs::kShowAppLauncherPromo, base::Bind(&AppLauncherHandler::OnLocalStatePreferenceChanged, base::Unretained(this))); } #endif web_ui()->RegisterMessageCallback("getApps", base::Bind(&AppLauncherHandler::HandleGetApps, base::Unretained(this))); web_ui()->RegisterMessageCallback("launchApp", base::Bind(&AppLauncherHandler::HandleLaunchApp, base::Unretained(this))); web_ui()->RegisterMessageCallback("setLaunchType", base::Bind(&AppLauncherHandler::HandleSetLaunchType, base::Unretained(this))); web_ui()->RegisterMessageCallback("uninstallApp", base::Bind(&AppLauncherHandler::HandleUninstallApp, base::Unretained(this))); web_ui()->RegisterMessageCallback("createAppShortcut", base::Bind(&AppLauncherHandler::HandleCreateAppShortcut, base::Unretained(this))); web_ui()->RegisterMessageCallback("reorderApps", base::Bind(&AppLauncherHandler::HandleReorderApps, base::Unretained(this))); web_ui()->RegisterMessageCallback("setPageIndex", base::Bind(&AppLauncherHandler::HandleSetPageIndex, base::Unretained(this))); web_ui()->RegisterMessageCallback("saveAppPageName", base::Bind(&AppLauncherHandler::HandleSaveAppPageName, base::Unretained(this))); web_ui()->RegisterMessageCallback("generateAppForLink", base::Bind(&AppLauncherHandler::HandleGenerateAppForLink, base::Unretained(this))); web_ui()->RegisterMessageCallback("stopShowingAppLauncherPromo", base::Bind(&AppLauncherHandler::StopShowingAppLauncherPromo, base::Unretained(this))); web_ui()->RegisterMessageCallback("onLearnMore", base::Bind(&AppLauncherHandler::OnLearnMore, base::Unretained(this))); web_ui()->RegisterMessageCallback("pageSelected", base::Bind(&NoOpCallback)); } Commit Message: Remove --disable-app-shims. App shims have been enabled by default for 3 milestones (since r242711). BUG=350161 Review URL: https://codereview.chromium.org/298953002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272786 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-399
0
110,349
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 regulator_check_consumers(struct regulator_dev *rdev, int *min_uV, int *max_uV) { struct regulator *regulator; list_for_each_entry(regulator, &rdev->consumer_list, list) { /* * Assume consumers that didn't say anything are OK * with anything in the constraint range. */ if (!regulator->min_uV && !regulator->max_uV) continue; if (*max_uV > regulator->max_uV) *max_uV = regulator->max_uV; if (*min_uV < regulator->min_uV) *min_uV = regulator->min_uV; } if (*min_uV > *max_uV) { rdev_err(rdev, "Restricting voltage, %u-%uuV\n", *min_uV, *max_uV); return -EINVAL; } return 0; } Commit Message: regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixes not to access pin after freeing. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org> CWE ID: CWE-416
0
74,488
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 PopulateDataInBuilder(BlobDataBuilder* builder, size_t index, base::TaskRunner* file_runner) { if (index % 2 != 0) { builder->PopulateFutureData(0, "abcde", 0, 5); if (index % 3 == 0) { builder->PopulateFutureData(1, "z", 0, 1); } } else if (index % 3 == 0) { scoped_refptr<ShareableFileReference> file_ref = ShareableFileReference::GetOrCreate( base::FilePath::FromUTF8Unsafe( base::SizeTToString(index + kTotalRawBlobs)), ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE, file_runner); builder->PopulateFutureFile(0, file_ref, base::Time::Max()); } } Commit Message: [BlobStorage] Fixing potential overflow Bug: 779314 Change-Id: I74612639d20544e4c12230569c7b88fbe669ec03 Reviewed-on: https://chromium-review.googlesource.com/747725 Reviewed-by: Victor Costan <pwnall@chromium.org> Commit-Queue: Daniel Murphy <dmurph@chromium.org> Cr-Commit-Position: refs/heads/master@{#512977} CWE ID: CWE-119
0
150,314
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 GLES2Implementation::ReadPixels(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { const char* func_name = "glReadPixels"; GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadPixels(" << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << GLES2Util::GetStringReadPixelFormat(format) << ", " << GLES2Util::GetStringPixelType(type) << ", " << static_cast<const void*>(pixels) << ")"); if (width < 0 || height < 0) { SetGLError(GL_INVALID_VALUE, func_name, "dimensions < 0"); return; } if (pack_skip_pixels_ + width > (pack_row_length_ ? pack_row_length_ : width)) { SetGLError(GL_INVALID_OPERATION, func_name, "invalid pack params combination"); return; } TRACE_EVENT0("gpu", "GLES2::ReadPixels"); typedef cmds::ReadPixels::Result Result; uint32_t size; uint32_t unpadded_row_size; uint32_t padded_row_size; uint32_t skip_size; PixelStoreParams params; params.alignment = pack_alignment_; params.row_length = pack_row_length_; params.skip_pixels = pack_skip_pixels_; params.skip_rows = pack_skip_rows_; if (!GLES2Util::ComputeImageDataSizesES3( width, height, 1, format, type, params, &size, &unpadded_row_size, &padded_row_size, &skip_size, nullptr)) { SetGLError(GL_INVALID_VALUE, func_name, "size too large."); return; } if (bound_pixel_pack_buffer_) { base::CheckedNumeric<GLuint> offset = ToGLuint(pixels); offset += skip_size; if (!offset.IsValid()) { SetGLError(GL_INVALID_VALUE, func_name, "skip size too large."); return; } helper_->ReadPixels(xoffset, yoffset, width, height, format, type, 0, offset.ValueOrDefault(0), 0, 0, false); InvalidateReadbackBufferShadowDataCHROMIUM(bound_pixel_pack_buffer_); CheckGLError(); return; } uint32_t service_padded_row_size = 0; if (pack_row_length_ > 0 && pack_row_length_ != width) { if (!GLES2Util::ComputeImagePaddedRowSize( width, format, type, pack_alignment_, &service_padded_row_size)) { SetGLError(GL_INVALID_VALUE, func_name, "size too large."); return; } } else { service_padded_row_size = padded_row_size; } if (bound_pixel_pack_transfer_buffer_id_) { if (pack_row_length_ > 0 || pack_skip_pixels_ > 0 || pack_skip_rows_ > 0) { SetGLError(GL_INVALID_OPERATION, func_name, "No ES3 pack parameters with pixel pack transfer buffer."); return; } DCHECK_EQ(0u, skip_size); GLuint offset = ToGLuint(pixels); BufferTracker::Buffer* buffer = GetBoundPixelTransferBufferIfValid( bound_pixel_pack_transfer_buffer_id_, func_name, offset, size); if (buffer && buffer->shm_id() != -1) { helper_->ReadPixels(xoffset, yoffset, width, height, format, type, buffer->shm_id(), buffer->shm_offset() + offset, 0, 0, true); CheckGLError(); } return; } if (!pixels) { SetGLError(GL_INVALID_OPERATION, func_name, "pixels = NULL"); return; } int8_t* dest = reinterpret_cast<int8_t*>(pixels); dest += skip_size; GLsizei remaining_rows = height; GLint y_index = yoffset; uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type); uint32_t skip_row_bytes = 0; if (xoffset < 0) { skip_row_bytes = static_cast<uint32_t>(-xoffset) * group_size; } do { GLsizei desired_size = remaining_rows == 0 ? 0 : service_padded_row_size * (remaining_rows - 1) + unpadded_row_size; ScopedTransferBufferPtr buffer(desired_size, helper_, transfer_buffer_); if (!buffer.valid()) { break; } GLint num_rows = ComputeNumRowsThatFitInBuffer( service_padded_row_size, unpadded_row_size, buffer.size(), remaining_rows); auto result = GetResultAs<Result>(); if (!result) { break; } result->success = 0; // mark as failed. result->row_length = 0; result->num_rows = 0; helper_->ReadPixels(xoffset, y_index, width, num_rows, format, type, buffer.shm_id(), buffer.offset(), GetResultShmId(), result.offset(), false); WaitForCmd(); if (!result->success) { break; } if (remaining_rows == 0) { break; } const uint8_t* src = static_cast<const uint8_t*>(buffer.address()); if (padded_row_size == unpadded_row_size && (pack_row_length_ == 0 || pack_row_length_ == width) && result->row_length == width && result->num_rows == num_rows) { uint32_t copy_size = unpadded_row_size * num_rows; memcpy(dest, src, copy_size); dest += copy_size; } else if (result->row_length > 0 && result->num_rows > 0) { uint32_t copy_row_size = result->row_length * group_size; uint32_t copy_last_row_size = copy_row_size; if (copy_row_size + skip_row_bytes > padded_row_size) { copy_row_size = padded_row_size - skip_row_bytes; } GLint copied_rows = 0; for (GLint yy = 0; yy < num_rows; ++yy) { if (y_index + yy >= 0 && copied_rows < result->num_rows) { if (yy + 1 == num_rows && remaining_rows == num_rows) { memcpy(dest + skip_row_bytes, src + skip_row_bytes, copy_last_row_size); } else { memcpy(dest + skip_row_bytes, src + skip_row_bytes, copy_row_size); } ++copied_rows; } dest += padded_row_size; src += service_padded_row_size; } DCHECK_EQ(result->num_rows, copied_rows); } y_index += num_rows; remaining_rows -= num_rows; } while (remaining_rows); CheckGLError(); } 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,104
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 rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, struct sockaddr *dst_addr, int timeout_ms) { struct rdma_id_private *id_priv; int ret; id_priv = container_of(id, struct rdma_id_private, id); if (id_priv->state == RDMA_CM_IDLE) { ret = cma_bind_addr(id, src_addr, dst_addr); if (ret) return ret; } if (cma_family(id_priv) != dst_addr->sa_family) return -EINVAL; if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) return -EINVAL; atomic_inc(&id_priv->refcount); memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr)); if (cma_any_addr(dst_addr)) { ret = cma_resolve_loopback(id_priv); } else { if (dst_addr->sa_family == AF_IB) { ret = cma_resolve_ib_addr(id_priv); } else { ret = rdma_resolve_ip(&addr_client, cma_src_addr(id_priv), dst_addr, &id->route.addr.dev_addr, timeout_ms, addr_handler, id_priv); } } if (ret) goto err; return 0; err: cma_comp_exch(id_priv, RDMA_CM_ADDR_QUERY, RDMA_CM_ADDR_BOUND); cma_deref_id(id_priv); return ret; } Commit Message: IB/core: Don't resolve passive side RoCE L2 address in CMA REQ handler The code that resolves the passive side source MAC within the rdma_cm connection request handler was both redundant and buggy, so remove it. It was redundant since later, when an RC QP is modified to RTR state, the resolution will take place in the ib_core module. It was buggy because this callback also deals with UD SIDR exchange, for which we incorrectly looked at the REQ member of the CM event and dereferenced a random value. Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures") Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com> CWE ID: CWE-20
0
38,556
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_recent_object(const unsigned char *sha1, unsigned long mtime, struct recent_data *data) { struct object *obj; enum object_type type; if (mtime <= data->timestamp) return; /* * We do not want to call parse_object here, because * inflating blobs and trees could be very expensive. * However, we do need to know the correct type for * later processing, and the revision machinery expects * commits and tags to have been parsed. */ type = sha1_object_info(sha1, NULL); if (type < 0) die("unable to get object info for %s", sha1_to_hex(sha1)); switch (type) { case OBJ_TAG: case OBJ_COMMIT: obj = parse_object_or_die(sha1, NULL); break; case OBJ_TREE: obj = (struct object *)lookup_tree(sha1); break; case OBJ_BLOB: obj = (struct object *)lookup_blob(sha1); break; default: die("unknown object type for %s: %s", sha1_to_hex(sha1), typename(type)); } if (!obj) die("unable to lookup %s", sha1_to_hex(sha1)); add_pending_object(data->revs, obj, ""); } 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,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: bool Extension::IsElevatedHostList( const URLPatternList& old_list, const URLPatternList& new_list) { std::vector<std::string> new_hosts = GetDistinctHosts(new_list, false); std::vector<std::string> old_hosts = GetDistinctHosts(old_list, false); std::set<std::string> old_hosts_set(old_hosts.begin(), old_hosts.end()); std::set<std::string> new_hosts_set(new_hosts.begin(), new_hosts.end()); std::set<std::string> new_hosts_only; std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), old_hosts_set.begin(), old_hosts_set.end(), std::inserter(new_hosts_only, new_hosts_only.begin())); return !new_hosts_only.empty(); } Commit Message: Prevent extensions from defining homepages with schemes other than valid web extents. BUG=84402 TEST=ExtensionManifestTest.ParseHomepageURLs Review URL: http://codereview.chromium.org/7089014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87722 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-20
0
99,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: static void read_conf(FILE *conffile) { char *buffer, *line, *val; buffer = loadfile(conffile); for (line = strtok(buffer, "\r\n"); line; line = strtok(NULL, "\r\n")) { if (!strncmp(line, "export ", 7)) continue; val = strchr(line, '='); if (!val) { printf("invalid configuration line\n"); break; } *val++ = '\0'; if (!strcmp(line, "JSON_INDENT")) conf.indent = atoi(val); if (!strcmp(line, "JSON_COMPACT")) conf.compact = atoi(val); if (!strcmp(line, "JSON_ENSURE_ASCII")) conf.ensure_ascii = atoi(val); if (!strcmp(line, "JSON_PRESERVE_ORDER")) conf.preserve_order = atoi(val); if (!strcmp(line, "JSON_SORT_KEYS")) conf.sort_keys = atoi(val); if (!strcmp(line, "STRIP")) conf.strip = atoi(val); } free(buffer); } Commit Message: CVE-2013-6401: Change hash function, randomize hashes Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing and testing. CWE ID: CWE-310
1
166,536
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: __releases(RCU) { rcu_read_unlock(); } Commit Message: af_packet: prevent information leak In 2.6.27, commit 393e52e33c6c2 (packet: deliver VLAN TCI to userspace) added a small information leak. Add padding field and make sure its zeroed before copy to user. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID: CWE-264
0
26,538
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: virtual ~PixelBufferWorkerPoolTaskImpl() {} Commit Message: cc: Simplify raster task completion notification logic (Relanding after missing activation bug fixed in https://codereview.chromium.org/131763003/) Previously the pixel buffer raster worker pool used a combination of polling and explicit notifications from the raster worker pool to decide when to tell the client about the completion of 1) all tasks or 2) the subset of tasks required for activation. This patch simplifies the logic by only triggering the notification based on the OnRasterTasksFinished and OnRasterTasksRequiredForActivationFinished calls from the worker pool. BUG=307841,331534 Review URL: https://codereview.chromium.org/99873007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243991 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-20
0
112,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: int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { struct termios old_termios, new_termios; char c; char line[LINE_MAX]; assert(f); assert(ret); if (tcgetattr(fileno(f), &old_termios) >= 0) { new_termios = old_termios; new_termios.c_lflag &= ~ICANON; new_termios.c_cc[VMIN] = 1; new_termios.c_cc[VTIME] = 0; if (tcsetattr(fileno(f), TCSADRAIN, &new_termios) >= 0) { size_t k; if (t != (usec_t) -1) { if (fd_wait_for_event(fileno(f), POLLIN, t) <= 0) { tcsetattr(fileno(f), TCSADRAIN, &old_termios); return -ETIMEDOUT; } } k = fread(&c, 1, 1, f); tcsetattr(fileno(f), TCSADRAIN, &old_termios); if (k <= 0) return -EIO; if (need_nl) *need_nl = c != '\n'; *ret = c; return 0; } } if (t != (usec_t) -1) if (fd_wait_for_event(fileno(f), POLLIN, t) <= 0) return -ETIMEDOUT; if (!fgets(line, sizeof(line), f)) return -EIO; truncate_nl(line); if (strlen(line) != 1) return -EBADMSG; if (need_nl) *need_nl = false; *ret = line[0]; return 0; } Commit Message: CWE ID: CWE-362
0
11,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: SMB2_auth_kerberos(struct SMB2_sess_data *sess_data) { int rc; struct cifs_ses *ses = sess_data->ses; struct cifs_spnego_msg *msg; struct key *spnego_key = NULL; struct smb2_sess_setup_rsp *rsp = NULL; rc = SMB2_sess_alloc_buffer(sess_data); if (rc) goto out; spnego_key = cifs_get_spnego_key(ses); if (IS_ERR(spnego_key)) { rc = PTR_ERR(spnego_key); spnego_key = NULL; goto out; } msg = spnego_key->payload.data[0]; /* * check version field to make sure that cifs.upcall is * sending us a response in an expected form */ if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { cifs_dbg(VFS, "bad cifs.upcall version. Expected %d got %d", CIFS_SPNEGO_UPCALL_VERSION, msg->version); rc = -EKEYREJECTED; goto out_put_spnego_key; } ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len, GFP_KERNEL); if (!ses->auth_key.response) { cifs_dbg(VFS, "Kerberos can't allocate (%u bytes) memory", msg->sesskey_len); rc = -ENOMEM; goto out_put_spnego_key; } ses->auth_key.len = msg->sesskey_len; sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; sess_data->iov[1].iov_len = msg->secblob_len; rc = SMB2_sess_sendreceive(sess_data); if (rc) goto out_put_spnego_key; rsp = (struct smb2_sess_setup_rsp *)sess_data->iov[0].iov_base; ses->Suid = rsp->sync_hdr.SessionId; ses->session_flags = le16_to_cpu(rsp->SessionFlags); rc = SMB2_sess_establish_session(sess_data); out_put_spnego_key: key_invalidate(spnego_key); key_put(spnego_key); out: sess_data->result = rc; sess_data->func = NULL; SMB2_sess_free_buffer(sess_data); } Commit Message: cifs: Fix use-after-free in SMB2_read There is a KASAN use-after-free: BUG: KASAN: use-after-free in SMB2_read+0x1136/0x1190 Read of size 8 at addr ffff8880b4e45e50 by task ln/1009 Should not release the 'req' because it will use in the trace. Fixes: eccb4422cf97 ("smb3: Add ftrace tracepoints for improved SMB3 debugging") Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com> Signed-off-by: Steve French <stfrench@microsoft.com> CC: Stable <stable@vger.kernel.org> 4.18+ Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com> CWE ID: CWE-416
0
88,066
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: conv_ext0be32(const UChar* s, const UChar* end, UChar* conv) { while (s < end) { *conv++ = '\0'; *conv++ = '\0'; *conv++ = '\0'; *conv++ = *s++; } } Commit Message: Fix CVE-2019-13224: don't allow different encodings for onig_new_deluxe() CWE ID: CWE-416
0
89,248
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 *cgroup_to_absolute_path(struct cgroup_mount_point *mp, const char *path, const char *suffix) { /* first we have to make sure we subtract the mount point's prefix */ char *prefix = mp->mount_prefix; char *buf; ssize_t len, rv; /* we want to make sure only absolute paths to cgroups are passed to us */ if (path[0] != '/') { errno = EINVAL; return NULL; } if (prefix && !strcmp(prefix, "/")) prefix = NULL; /* prefix doesn't match */ if (prefix && strncmp(prefix, path, strlen(prefix)) != 0) { errno = EINVAL; return NULL; } /* if prefix is /foo and path is /foobar */ if (prefix && path[strlen(prefix)] != '/' && path[strlen(prefix)] != '\0') { errno = EINVAL; return NULL; } /* remove prefix from path */ path += prefix ? strlen(prefix) : 0; len = strlen(mp->mount_point) + strlen(path) + (suffix ? strlen(suffix) : 0); buf = calloc(len + 1, 1); if (!buf) return NULL; rv = snprintf(buf, len + 1, "%s%s%s", mp->mount_point, path, suffix ? suffix : ""); if (rv > len) { free(buf); errno = ENOMEM; return NULL; } return buf; } 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,469
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 ChromeRenderMessageFilter::OnExtensionAddListener( const std::string& extension_id, const std::string& event_name) { content::RenderProcessHost* process = content::RenderProcessHost::FromID(render_process_id_); if (!process || !profile_->GetExtensionEventRouter()) return; profile_->GetExtensionEventRouter()->AddEventListener( event_name, process, extension_id); } Commit Message: Disable tcmalloc profile files. BUG=154983 TBR=darin@chromium.org NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11087041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161048 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-399
0
102,103
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 csnmp_config_add_data_values(data_definition_t *dd, oconfig_item_t *ci) { if (ci->values_num < 1) { WARNING("snmp plugin: `Values' needs at least one argument."); return (-1); } for (int i = 0; i < ci->values_num; i++) if (ci->values[i].type != OCONFIG_TYPE_STRING) { WARNING("snmp plugin: `Values' needs only string argument."); return (-1); } sfree(dd->values); dd->values_len = 0; dd->values = malloc(sizeof(*dd->values) * ci->values_num); if (dd->values == NULL) return (-1); dd->values_len = (size_t)ci->values_num; for (int i = 0; i < ci->values_num; i++) { dd->values[i].oid_len = MAX_OID_LEN; if (NULL == snmp_parse_oid(ci->values[i].value.string, dd->values[i].oid, &dd->values[i].oid_len)) { ERROR("snmp plugin: snmp_parse_oid (%s) failed.", ci->values[i].value.string); free(dd->values); dd->values = NULL; dd->values_len = 0; return (-1); } } return (0); } /* int csnmp_config_add_data_instance */ Commit Message: snmp plugin: Fix double free of request PDU snmp_sess_synch_response() always frees request PDU, in both case of request error and success. If error condition occurs inside of `while (status == 0)` loop, double free of `req` happens. Issue: #2291 Signed-off-by: Florian Forster <octo@collectd.org> CWE ID: CWE-415
0
59,664
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: const KURL& Document::firstPartyForCookies() const { OriginAccessEntry accessEntry(topDocument().url().protocol(), topDocument().url().host(), OriginAccessEntry::AllowSubdomains); const Document* currentDocument = this; while (currentDocument) { while (currentDocument->isSrcdocDocument()) currentDocument = currentDocument->parentDocument(); ASSERT(currentDocument); if (accessEntry.matchesOrigin(*currentDocument->securityOrigin()) == OriginAccessEntry::DoesNotMatchOrigin) return SecurityOrigin::urlWithUniqueSecurityOrigin(); currentDocument = currentDocument->parentDocument(); } return topDocument().url(); } Commit Message: Correctly keep track of isolates for microtask execution BUG=487155 R=haraken@chromium.org Review URL: https://codereview.chromium.org/1161823002 git-svn-id: svn://svn.chromium.org/blink/trunk@195985 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-254
0
127,521
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 GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted( const FileOperationCallback& callback, const FilePath& file_path, const FilePath& dir_path, GDataErrorCode status, const GURL& document_url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); GDataFileError error = util::GDataToGDataFileError(status); if (error == GDATA_FILE_OK) { GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); if (entry) { DCHECK_EQ(directory_service_->root(), entry->parent()); directory_service_->MoveEntryToDirectory(dir_path, entry, base::Bind( &GDataFileSystem::OnMoveEntryToDirectoryWithFileOperationCallback, ui_weak_ptr_, callback)); return; } else { error = GDATA_FILE_ERROR_NOT_FOUND; } } callback.Run(error); } Commit Message: Remove parent* arg from GDataEntry ctor. * Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry. * Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry. * Add GDataDirectoryService::FromDocumentEntry and use this everywhere. * Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and CreateGDataDirectory. Make GDataEntry ctor protected. BUG=141494 TEST=unit tests. Review URL: https://chromiumcodereview.appspot.com/10854083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-399
0
117,004
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: BaseShadow::evalPeriodicUserPolicy( void ) { shadow_user_policy.checkPeriodic(); } Commit Message: CWE ID: CWE-134
0
16,326
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 __init snb_gfx_workaround_needed(void) { #ifdef CONFIG_PCI int i; u16 vendor, devid; static const __initconst u16 snb_ids[] = { 0x0102, 0x0112, 0x0122, 0x0106, 0x0116, 0x0126, 0x010a, }; /* Assume no if something weird is going on with PCI */ if (!early_pci_allowed()) return false; vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID); if (vendor != 0x8086) return false; devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID); for (i = 0; i < ARRAY_SIZE(snb_ids); i++) if (devid == snb_ids[i]) return true; #endif return false; } Commit Message: acpi: Disable ACPI table override if securelevel is set From the kernel documentation (initrd_table_override.txt): If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible to override nearly any ACPI table provided by the BIOS with an instrumented, modified one. When securelevel is set, the kernel should disallow any unauthenticated changes to kernel space. ACPI tables contain code invoked by the kernel, so do not allow ACPI tables to be overridden if securelevel is set. Signed-off-by: Linn Crosetto <linn@hpe.com> CWE ID: CWE-264
0
53,806
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 postSetNeedsCommitThenRedrawToMainThread() { callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsCommitThenRedraw, this); } Commit Message: [chromium] Fix shutdown race when posting main thread task to CCThreadProxy and enable tests https://bugs.webkit.org/show_bug.cgi?id=70161 Reviewed by David Levin. Source/WebCore: Adds a weak pointer mechanism to cancel main thread tasks posted to CCThreadProxy instances from the compositor thread. Previously there was a race condition where main thread tasks could run even after the CCThreadProxy was destroyed. This race does not exist in the other direction because when tearing down a CCThreadProxy we first post a quit task to the compositor thread and then suspend execution of the main thread until all compositor tasks for the CCThreadProxy have been drained. Covered by the now-enabled CCLayerTreeHostTest* unit tests. * WebCore.gypi: * platform/graphics/chromium/cc/CCScopedMainThreadProxy.h: Added. (WebCore::CCScopedMainThreadProxy::create): (WebCore::CCScopedMainThreadProxy::postTask): (WebCore::CCScopedMainThreadProxy::shutdown): (WebCore::CCScopedMainThreadProxy::CCScopedMainThreadProxy): (WebCore::CCScopedMainThreadProxy::runTaskIfNotShutdown): * platform/graphics/chromium/cc/CCThreadProxy.cpp: (WebCore::CCThreadProxy::CCThreadProxy): (WebCore::CCThreadProxy::~CCThreadProxy): (WebCore::CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread): * platform/graphics/chromium/cc/CCThreadProxy.h: Source/WebKit/chromium: Enables the CCLayerTreeHostTest* tests by default. Most tests are run twice in a single thread and multiple thread configuration. Some tests run only in the multiple thread configuration if they depend on the compositor thread scheduling draws by itself. * tests/CCLayerTreeHostTest.cpp: (::CCLayerTreeHostTest::timeout): (::CCLayerTreeHostTest::clearTimeout): (::CCLayerTreeHostTest::CCLayerTreeHostTest): (::CCLayerTreeHostTest::onEndTest): (::CCLayerTreeHostTest::TimeoutTask::TimeoutTask): (::CCLayerTreeHostTest::TimeoutTask::clearTest): (::CCLayerTreeHostTest::TimeoutTask::~TimeoutTask): (::CCLayerTreeHostTest::TimeoutTask::Run): (::CCLayerTreeHostTest::runTest): (::CCLayerTreeHostTest::doBeginTest): (::CCLayerTreeHostTestThreadOnly::runTest): (::CCLayerTreeHostTestSetNeedsRedraw::commitCompleteOnCCThread): git-svn-id: svn://svn.chromium.org/blink/trunk@97784 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-119
0
97,917
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: webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint( const gfx::Rect& paint_bounds, TransportDIB** dib, gfx::Rect* location, gfx::Rect* clip, float* scale_factor) { return pepper_helper_->GetBitmapForOptimizedPluginPaint( paint_bounds, dib, location, clip, scale_factor); } Commit Message: Let the browser handle external navigations from DevTools. BUG=180555 Review URL: https://chromiumcodereview.appspot.com/12531004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186793 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-264
0
115,510
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 smhd_del(GF_Box *s) { GF_SoundMediaHeaderBox *ptr = (GF_SoundMediaHeaderBox *)s; if (ptr == NULL ) return; gf_free(ptr); } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,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: ReadUserLogFileState::isValid( void ) const { if ( !isInitialized() ) { return false; } if ( 0 == strlen(m_ro_state->internal.m_base_path) ) { return false; } return true; } Commit Message: CWE ID: CWE-134
0
16,671
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: pkinit_alg_values(krb5_context context, const krb5_data *alg_id, size_t *hash_bytes, const EVP_MD *(**func)(void)) { *hash_bytes = 0; *func = NULL; if ((alg_id->length == krb5_pkinit_sha1_oid_len) && (0 == memcmp(alg_id->data, &krb5_pkinit_sha1_oid, krb5_pkinit_sha1_oid_len))) { *hash_bytes = 20; *func = &EVP_sha1; return 0; } else if ((alg_id->length == krb5_pkinit_sha256_oid_len) && (0 == memcmp(alg_id->data, krb5_pkinit_sha256_oid, krb5_pkinit_sha256_oid_len))) { *hash_bytes = 32; *func = &EVP_sha256; return 0; } else if ((alg_id->length == krb5_pkinit_sha512_oid_len) && (0 == memcmp(alg_id->data, krb5_pkinit_sha512_oid, krb5_pkinit_sha512_oid_len))) { *hash_bytes = 64; *func = &EVP_sha512; return 0; } else { krb5_set_error_message(context, KRB5_ERR_BAD_S2K_PARAMS, "Bad algorithm ID passed to PK-INIT KDF."); return KRB5_ERR_BAD_S2K_PARAMS; } } /* pkinit_alg_values() */ Commit Message: PKINIT null pointer deref [CVE-2013-1415] Don't dereference a null pointer when cleaning up. The KDC plugin for PKINIT can dereference a null pointer when a malformed packet causes processing to terminate early, leading to a crash of the KDC process. An attacker would need to have a valid PKINIT certificate or have observed a successful PKINIT authentication, or an unauthenticated attacker could execute the attack if anonymous PKINIT is enabled. CVSSv2 vector: AV:N/AC:M/Au:N/C:N/I:N/A:C/E:P/RL:O/RC:C This is a minimal commit for pullup; style fixes in a followup. [kaduk@mit.edu: reformat and edit commit message] (cherry picked from commit c773d3c775e9b2d88bcdff5f8a8ba88d7ec4e8ed) ticket: 7570 version_fixed: 1.11.1 status: resolved CWE ID:
0
33,651
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: rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer, unsigned long tail, struct rb_event_info *info) { struct buffer_page *tail_page = info->tail_page; struct ring_buffer_event *event; unsigned long length = info->length; /* * Only the event that crossed the page boundary * must fill the old tail_page with padding. */ if (tail >= BUF_PAGE_SIZE) { /* * If the page was filled, then we still need * to update the real_end. Reset it to zero * and the reader will ignore it. */ if (tail == BUF_PAGE_SIZE) tail_page->real_end = 0; local_sub(length, &tail_page->write); return; } event = __rb_page_index(tail_page, tail); kmemcheck_annotate_bitfield(event, bitfield); /* account for padding bytes */ local_add(BUF_PAGE_SIZE - tail, &cpu_buffer->entries_bytes); /* * Save the original length to the meta data. * This will be used by the reader to add lost event * counter. */ tail_page->real_end = tail; /* * If this event is bigger than the minimum size, then * we need to be careful that we don't subtract the * write counter enough to allow another writer to slip * in on this page. * We put in a discarded commit instead, to make sure * that this space is not used again. * * If we are less than the minimum size, we don't need to * worry about it. */ if (tail > (BUF_PAGE_SIZE - RB_EVNT_MIN_SIZE)) { /* No room for any events */ /* Mark the rest of the page with padding */ rb_event_set_padding(event); /* Set the write back to the previous setting */ local_sub(length, &tail_page->write); return; } /* Put in a discarded event */ event->array[0] = (BUF_PAGE_SIZE - tail) - RB_EVNT_HDR_SIZE; event->type_len = RINGBUF_TYPE_PADDING; /* time delta must be non zero */ event->time_delta = 1; /* Set write to end of buffer */ length = (tail + length) - BUF_PAGE_SIZE; local_sub(length, &tail_page->write); } Commit Message: ring-buffer: Prevent overflow of size in ring_buffer_resize() If the size passed to ring_buffer_resize() is greater than MAX_LONG - BUF_PAGE_SIZE then the DIV_ROUND_UP() will return zero. Here's the details: # echo 18014398509481980 > /sys/kernel/debug/tracing/buffer_size_kb tracing_entries_write() processes this and converts kb to bytes. 18014398509481980 << 10 = 18446744073709547520 and this is passed to ring_buffer_resize() as unsigned long size. size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); Where DIV_ROUND_UP(a, b) is (a + b - 1)/b BUF_PAGE_SIZE is 4080 and here 18446744073709547520 + 4080 - 1 = 18446744073709551599 where 18446744073709551599 is still smaller than 2^64 2^64 - 18446744073709551599 = 17 But now 18446744073709551599 / 4080 = 4521260802379792 and size = size * 4080 = 18446744073709551360 This is checked to make sure its still greater than 2 * 4080, which it is. Then we convert to the number of buffer pages needed. nr_page = DIV_ROUND_UP(size, BUF_PAGE_SIZE) but this time size is 18446744073709551360 and 2^64 - (18446744073709551360 + 4080 - 1) = -3823 Thus it overflows and the resulting number is less than 4080, which makes 3823 / 4080 = 0 an nr_pages is set to this. As we already checked against the minimum that nr_pages may be, this causes the logic to fail as well, and we crash the kernel. There's no reason to have the two DIV_ROUND_UP() (that's just result of historical code changes), clean up the code and fix this bug. Cc: stable@vger.kernel.org # 3.5+ Fixes: 83f40318dab00 ("ring-buffer: Make removal of ring buffer pages atomic") Signed-off-by: Steven Rostedt <rostedt@goodmis.org> CWE ID: CWE-190
0
72,575
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_cgroup_destroy(struct cgroup_subsys *ss, struct cgroup *cont) { struct perf_cgroup *jc; jc = container_of(cgroup_subsys_state(cont, perf_subsys_id), struct perf_cgroup, css); free_percpu(jc->info); kfree(jc); } 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
26,029
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 em_sysenter(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; u16 cs_sel, ss_sel; u64 efer = 0; ops->get_msr(ctxt, MSR_EFER, &efer); /* inject #GP if in real mode */ if (ctxt->mode == X86EMUL_MODE_REAL) return emulate_gp(ctxt, 0); /* * Not recognized on AMD in compat mode (but is recognized in legacy * mode). */ if ((ctxt->mode == X86EMUL_MODE_PROT32) && (efer & EFER_LMA) && !vendor_intel(ctxt)) return emulate_ud(ctxt); /* sysenter/sysexit have not been tested in 64bit mode. */ if (ctxt->mode == X86EMUL_MODE_PROT64) return X86EMUL_UNHANDLEABLE; setup_syscalls_segments(ctxt, &cs, &ss); ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); switch (ctxt->mode) { case X86EMUL_MODE_PROT32: if ((msr_data & 0xfffc) == 0x0) return emulate_gp(ctxt, 0); break; case X86EMUL_MODE_PROT64: if (msr_data == 0x0) return emulate_gp(ctxt, 0); break; default: break; } ctxt->eflags &= ~(EFLG_VM | EFLG_IF); cs_sel = (u16)msr_data; cs_sel &= ~SELECTOR_RPL_MASK; ss_sel = cs_sel + 8; ss_sel &= ~SELECTOR_RPL_MASK; if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) { cs.d = 0; cs.l = 1; } ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data); ctxt->_eip = msr_data; ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); *reg_write(ctxt, VCPU_REGS_RSP) = msr_data; return X86EMUL_CONTINUE; } Commit Message: KVM: x86: SYSENTER emulation is broken SYSENTER emulation is broken in several ways: 1. It misses the case of 16-bit code segments completely (CVE-2015-0239). 2. MSR_IA32_SYSENTER_CS is checked in 64-bit mode incorrectly (bits 0 and 1 can still be set without causing #GP). 3. MSR_IA32_SYSENTER_EIP and MSR_IA32_SYSENTER_ESP are not masked in legacy-mode. 4. There is some unneeded code. Fix it. Cc: stable@vger.linux.org Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> CWE ID: CWE-362
1
166,742
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 int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk; struct sctp_sock *sp = sctp_sk(sk); unsigned int mask; poll_wait(file, sk->sk_sleep, wait); /* A TCP-style listening socket becomes readable when the accept queue * is not empty. */ if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) return (!list_empty(&sp->ep->asocs)) ? (POLLIN | POLLRDNORM) : 0; mask = 0; /* Is there any exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR; if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; /* Is it readable? Reconsider this code with TCP-style support. */ if (!skb_queue_empty(&sk->sk_receive_queue) || (sk->sk_shutdown & RCV_SHUTDOWN)) mask |= POLLIN | POLLRDNORM; /* The association is either gone or not ready. */ if (!sctp_style(sk, UDP) && sctp_sstate(sk, CLOSED)) return mask; /* Is it writable? */ if (sctp_writeable(sk)) { mask |= POLLOUT | POLLWRNORM; } else { set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); /* * Since the socket is not locked, the buffer * might be made available after the writeable check and * before the bit is set. This could cause a lost I/O * signal. tcp_poll() has a race breaker for this race * condition. Based on their implementation, we put * in the following code to cover it as well. */ if (sctp_writeable(sk)) mask |= POLLOUT | POLLWRNORM; } return mask; } Commit Message: [SCTP]: Fix assertion (!atomic_read(&sk->sk_rmem_alloc)) failed message In current implementation, LKSCTP does receive buffer accounting for data in sctp_receive_queue and pd_lobby. However, LKSCTP don't do accounting for data in frag_list when data is fragmented. In addition, LKSCTP doesn't do accounting for data in reasm and lobby queue in structure sctp_ulpq. When there are date in these queue, assertion failed message is printed in inet_sock_destruct because sk_rmem_alloc of oldsk does not become 0 when socket is destroyed. Signed-off-by: Tsutomu Fujii <t-fujii@nb.jp.nec.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net> CWE ID:
0
35,030
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: PSIR_FileWriter::~PSIR_FileWriter() { XMP_Assert ( ! (this->memParsed && this->fileParsed) ); if ( this->ownedContent ) { XMP_Assert ( this->memContent != 0 ); free ( this->memContent ); } } // PSIR_FileWriter::~PSIR_FileWriter Commit Message: CWE ID: CWE-125
0
9,964
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 on_l2cap_write_done(void* req_id, uint32_t id) { l2cap_socket *sock; if (req_id != NULL) { osi_free(req_id); //free the buffer } pthread_mutex_lock(&state_lock); sock = btsock_l2cap_find_by_id_l(id); if (sock && !sock->outgoing_congest) { APPL_TRACE_DEBUG("on_l2cap_write_done: adding fd to btsock_thread..."); btsock_thread_add_fd(pth, sock->our_fd, BTSOCK_L2CAP, SOCK_THREAD_FD_RD, sock->id); } pthread_mutex_unlock(&state_lock); } Commit Message: DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release CWE ID: CWE-284
0
158,860
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: PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) { RefPtr<FrameView> view = adoptRef(new FrameView(frame)); view->show(); return view.release(); } Commit Message: Defer call to updateWidgetPositions() outside of RenderLayerScrollableArea. updateWidgetPositions() can destroy the render tree, so it should never be called from inside RenderLayerScrollableArea. Leaving it there allows for the potential of use-after-free bugs. BUG=402407 R=vollick@chromium.org Review URL: https://codereview.chromium.org/490473003 git-svn-id: svn://svn.chromium.org/blink/trunk@180681 bbb929c8-8fbe-4397-9dbb-9b2b20218538 CWE ID: CWE-416
0
119,823
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 QueryManager::StopTracking(QueryManager::Query* /* query */) { --query_count_; } Commit Message: Add bounds validation to AsyncPixelTransfersCompletedQuery::End BUG=351852 R=jbauman@chromium.org, jorgelo@chromium.org Review URL: https://codereview.chromium.org/198253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256723 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-119
0
121,469
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 NTAPI KeRestoreExtendedProcessorState ( PXSTATE_SAVE XStateSave ) { if (KeRestoreExtendedProcessorStatePtr) { (KeRestoreExtendedProcessorStatePtr) (XStateSave); } } Commit Message: Windows: fix low severity vulnerability in driver that allowed reading 3 bytes of kernel stack memory (with a rare possibility of 25 additional bytes). Reported by Tim Harrison. CWE ID: CWE-119
0
87,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: static zend_bool php_auto_globals_create_post(zend_string *name) { if (PG(variables_order) && (strchr(PG(variables_order),'P') || strchr(PG(variables_order),'p')) && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) { sapi_module.treat_data(PARSE_POST, NULL, NULL); } else { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]); array_init(&PG(http_globals)[TRACK_VARS_POST]); } zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_POST]); Z_ADDREF(PG(http_globals)[TRACK_VARS_POST]); return 0; /* don't rearm */ } Commit Message: Fix bug #73807 CWE ID: CWE-400
0
95,306
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 __set_nat_cache_dirty(struct f2fs_nm_info *nm_i, struct nat_entry *ne) { nid_t set = NAT_BLOCK_OFFSET(ne->ni.nid); struct nat_entry_set *head; if (get_nat_flag(ne, IS_DIRTY)) return; head = radix_tree_lookup(&nm_i->nat_set_root, set); if (!head) { head = f2fs_kmem_cache_alloc(nat_entry_set_slab, GFP_NOFS); INIT_LIST_HEAD(&head->entry_list); INIT_LIST_HEAD(&head->set_list); head->set = set; head->entry_cnt = 0; f2fs_radix_tree_insert(&nm_i->nat_set_root, set, head); } list_move_tail(&ne->list, &head->entry_list); nm_i->dirty_nat_cnt++; head->entry_cnt++; set_nat_flag(ne, IS_DIRTY, true); } Commit Message: f2fs: fix race condition in between free nid allocator/initializer In below concurrent case, allocated nid can be loaded into free nid cache and be allocated again. Thread A Thread B - f2fs_create - f2fs_new_inode - alloc_nid - __insert_nid_to_list(ALLOC_NID_LIST) - f2fs_balance_fs_bg - build_free_nids - __build_free_nids - scan_nat_page - add_free_nid - __lookup_nat_cache - f2fs_add_link - init_inode_metadata - new_inode_page - new_node_page - set_node_addr - alloc_nid_done - __remove_nid_from_list(ALLOC_NID_LIST) - __insert_nid_to_list(FREE_NID_LIST) This patch makes nat cache lookup and free nid list operation being atomical to avoid this race condition. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> CWE ID: CWE-362
0
85,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: DownloadController::DownloadController() : java_object_(NULL) { } Commit Message: Clean up Android DownloadManager code as most download now go through Chrome Network stack The only exception is OMA DRM download. And it only applies to context menu download interception. Clean up the remaining unused code now. BUG=647755 Review-Url: https://codereview.chromium.org/2371773003 Cr-Commit-Position: refs/heads/master@{#421332} CWE ID: CWE-254
0
126,711
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: BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n) { BN_ULONG t1,t2; int c=0; if (n <= 0) return((BN_ULONG)0); for (;;) { t1=a[0]; t2=b[0]; r[0]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); if (--n <= 0) break; t1=a[1]; t2=b[1]; r[1]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); if (--n <= 0) break; t1=a[2]; t2=b[2]; r[2]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); if (--n <= 0) break; t1=a[3]; t2=b[3]; r[3]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); if (--n <= 0) break; a+=4; b+=4; r+=4; } return(c); } Commit Message: Fix for CVE-2014-3570 (with minor bn_asm.c revamp). Reviewed-by: Emilia Kasper <emilia@openssl.org> CWE ID: CWE-310
0
46,489
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 signal_delivered(struct ksignal *ksig, int stepping) { sigset_t blocked; /* A signal was successfully delivered, and the saved sigmask was stored on the signal frame, and will be restored by sigreturn. So we can simply clear the restore sigmask flag. */ clear_restore_sigmask(); sigorsets(&blocked, &current->blocked, &ksig->ka.sa.sa_mask); if (!(ksig->ka.sa.sa_flags & SA_NODEFER)) sigaddset(&blocked, ksig->sig); set_current_blocked(&blocked); tracehook_signal_handler(stepping); } Commit Message: kernel/signal.c: avoid undefined behaviour in kill_something_info When running kill(72057458746458112, 0) in userspace I hit the following issue. UBSAN: Undefined behaviour in kernel/signal.c:1462:11 negation of -2147483648 cannot be represented in type 'int': CPU: 226 PID: 9849 Comm: test Tainted: G B ---- ------- 3.10.0-327.53.58.70.x86_64_ubsan+ #116 Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014 Call Trace: dump_stack+0x19/0x1b ubsan_epilogue+0xd/0x50 __ubsan_handle_negate_overflow+0x109/0x14e SYSC_kill+0x43e/0x4d0 SyS_kill+0xe/0x10 system_call_fastpath+0x16/0x1b Add code to avoid the UBSAN detection. [akpm@linux-foundation.org: tweak comment] Link: http://lkml.kernel.org/r/1496670008-59084-1-git-send-email-zhongjiang@huawei.com Signed-off-by: zhongjiang <zhongjiang@huawei.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Xishi Qiu <qiuxishi@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> CWE ID: CWE-119
0
83,239
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: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } Commit Message: [Bug 1593] ntpd abort in free() with logconfig syntax error. CWE ID: CWE-20
0
74,239
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 OfflinePageModelImpl::DeletePages( const DeletePageCallback& callback, const MultipleOfflinePageItemResult& pages) { DCHECK(is_loaded_); std::vector<int64_t> offline_ids; for (auto& page : pages) offline_ids.emplace_back(page.offline_id); DoDeletePagesByOfflineId(offline_ids, callback); } Commit Message: Add the method to check if offline archive is in internal dir Bug: 758690 Change-Id: I8bb4283fc40a87fa7a87df2c7e513e2e16903290 Reviewed-on: https://chromium-review.googlesource.com/828049 Reviewed-by: Filip Gorski <fgorski@chromium.org> Commit-Queue: Jian Li <jianli@chromium.org> Cr-Commit-Position: refs/heads/master@{#524232} CWE ID: CWE-787
0
155,868