project
stringclasses
791 values
commit_id
stringlengths
6
81
CVE ID
stringlengths
13
16
CWE ID
stringclasses
127 values
func
stringlengths
5
484k
vul
int8
0
1
jsish
430ea27accd4d4ffddc946c9402e7c9064835a18
NOT_APPLICABLE
NOT_APPLICABLE
static Jsi_RC jsi_ValueAssignCheck(Jsi_Interp *interp, Jsi_Value *val, int lop) { if (lop == OP_FCALL || lop == OP_NEWFCALL) return JSI_OK; if (val->f.bits.lookupfailed && val->d.lookupFail) return Jsi_LogType("assign from undef var: %s", val->d.lookupFail); return JSI_OK; }
0
linux
9c09b214f30e3c11f9b0b03f89442df03643794d
NOT_APPLICABLE
NOT_APPLICABLE
static __poll_t hiddev_poll(struct file *file, poll_table *wait) { struct hiddev_list *list = file->private_data; poll_wait(file, &list->hiddev->wait, wait); if (list->head != list->tail) return EPOLLIN | EPOLLRDNORM; if (!list->hiddev->exist) return EPOLLERR | EPOLLHUP; return 0; }
0
openjpeg
e5285319229a5d77bf316bb0d3a6cbd3cb8666d9
NOT_APPLICABLE
NOT_APPLICABLE
static int are_comps_similar(opj_image_t * image) { unsigned int i; for (i = 1; i < image->numcomps; i++) { if (image->comps[0].dx != image->comps[i].dx || image->comps[0].dy != image->comps[i].dy || (i <= 2 && (image->comps[0].prec != image->comps[i].prec || image->comps[0].sgnd != image->comps[i].sgnd))) { return OPJ_FALSE; } } return OPJ_TRUE; }
0
linux
3b1c5a5307fb5277f395efdcf330c064d79df07d
NOT_APPLICABLE
NOT_APPLICABLE
void nl80211_send_remain_on_channel_cancel( struct cfg80211_registered_device *rdev, struct wireless_dev *wdev, u64 cookie, struct ieee80211_channel *chan, gfp_t gfp) { nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, rdev, wdev, cookie, chan, 0, gfp); }
0
linux
c278c253f3d992c6994d08aa0efb2b6806ca396f
NOT_APPLICABLE
NOT_APPLICABLE
static inline int arc_emac_tx_avail(struct arc_emac_priv *priv) { return (priv->txbd_dirty + TX_BD_NUM - priv->txbd_curr - 1) % TX_BD_NUM; }
0
Chrome
ce70785c73a2b7cf2b34de0d8439ca31929b4743
NOT_APPLICABLE
NOT_APPLICABLE
void LayoutBlockFlow::markAllDescendantsWithFloatsForLayout(LayoutBox* floatToRemove, bool inLayout) { if (!everHadLayout() && !containsFloats()) return; if (m_descendantsWithFloatsMarkedForLayout && !floatToRemove) return; m_descendantsWithFloatsMarkedForLayout |= !floatToRemove; MarkingBehavior markParents = inLayout ? MarkOnlyThis : MarkContainerChain; setChildNeedsLayout(markParents); if (floatToRemove) removeFloatingObject(floatToRemove); if (!childrenInline() || floatToRemove) { for (LayoutObject* child = firstChild(); child; child = child->nextSibling()) { if ((!floatToRemove && child->isFloatingOrOutOfFlowPositioned()) || !child->isLayoutBlock()) continue; if (!child->isLayoutBlockFlow()) { LayoutBlock* childBlock = toLayoutBlock(child); if (childBlock->shrinkToAvoidFloats() && childBlock->everHadLayout()) childBlock->setChildNeedsLayout(markParents); continue; } LayoutBlockFlow* childBlockFlow = toLayoutBlockFlow(child); if ((floatToRemove ? childBlockFlow->containsFloat(floatToRemove) : childBlockFlow->containsFloats()) || childBlockFlow->shrinkToAvoidFloats()) childBlockFlow->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout); } } }
0
linux
0625b4ba1a5d4703c7fb01c497bd6c156908af00
NOT_APPLICABLE
NOT_APPLICABLE
static int get_send_sge(struct ib_qp_init_attr *attr, int wqe_size) { int max_sge; if (attr->qp_type == IB_QPT_RC) max_sge = (min_t(int, wqe_size, 512) - sizeof(struct mlx5_wqe_ctrl_seg) - sizeof(struct mlx5_wqe_raddr_seg)) / sizeof(struct mlx5_wqe_data_seg); else if (attr->qp_type == IB_QPT_XRC_INI) max_sge = (min_t(int, wqe_size, 512) - sizeof(struct mlx5_wqe_ctrl_seg) - sizeof(struct mlx5_wqe_xrc_seg) - sizeof(struct mlx5_wqe_raddr_seg)) / sizeof(struct mlx5_wqe_data_seg); else max_sge = (wqe_size - sq_overhead(attr)) / sizeof(struct mlx5_wqe_data_seg); return min_t(int, max_sge, wqe_size - sq_overhead(attr) / sizeof(struct mlx5_wqe_data_seg)); }
0
Android
37c88107679d36c419572732b4af6e18bb2f7dce
NOT_APPLICABLE
NOT_APPLICABLE
const bt_interface_t* bluetooth__get_bluetooth_interface () { /* fixme -- add property to disable bt interface ? */ return &bluetoothInterface; }
0
wireless
9538cbaab6e8b8046039b4b2eb6c9d614dc782bd
NOT_APPLICABLE
NOT_APPLICABLE
static int b43_phy_versioning(struct b43_wldev *dev) { struct b43_phy *phy = &dev->phy; u32 tmp; u8 analog_type; u8 phy_type; u8 phy_rev; u16 radio_manuf; u16 radio_ver; u16 radio_rev; int unsupported = 0; /* Get PHY versioning */ tmp = b43_read16(dev, B43_MMIO_PHY_VER); analog_type = (tmp & B43_PHYVER_ANALOG) >> B43_PHYVER_ANALOG_SHIFT; phy_type = (tmp & B43_PHYVER_TYPE) >> B43_PHYVER_TYPE_SHIFT; phy_rev = (tmp & B43_PHYVER_VERSION); switch (phy_type) { case B43_PHYTYPE_A: if (phy_rev >= 4) unsupported = 1; break; case B43_PHYTYPE_B: if (phy_rev != 2 && phy_rev != 4 && phy_rev != 6 && phy_rev != 7) unsupported = 1; break; case B43_PHYTYPE_G: if (phy_rev > 9) unsupported = 1; break; #ifdef CONFIG_B43_PHY_N case B43_PHYTYPE_N: if (phy_rev > 9) unsupported = 1; break; #endif #ifdef CONFIG_B43_PHY_LP case B43_PHYTYPE_LP: if (phy_rev > 2) unsupported = 1; break; #endif #ifdef CONFIG_B43_PHY_HT case B43_PHYTYPE_HT: if (phy_rev > 1) unsupported = 1; break; #endif #ifdef CONFIG_B43_PHY_LCN case B43_PHYTYPE_LCN: if (phy_rev > 1) unsupported = 1; break; #endif default: unsupported = 1; } if (unsupported) { b43err(dev->wl, "FOUND UNSUPPORTED PHY (Analog %u, Type %d (%s), Revision %u)\n", analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev); return -EOPNOTSUPP; } b43info(dev->wl, "Found PHY: Analog %u, Type %d (%s), Revision %u\n", analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev); /* Get RADIO versioning */ if (dev->dev->core_rev >= 24) { u16 radio24[3]; for (tmp = 0; tmp < 3; tmp++) { b43_write16(dev, B43_MMIO_RADIO24_CONTROL, tmp); radio24[tmp] = b43_read16(dev, B43_MMIO_RADIO24_DATA); } /* Broadcom uses "id" for our "ver" and has separated "ver" */ /* radio_ver = (radio24[0] & 0xF0) >> 4; */ radio_manuf = 0x17F; radio_ver = (radio24[2] << 8) | radio24[1]; radio_rev = (radio24[0] & 0xF); } else { if (dev->dev->chip_id == 0x4317) { if (dev->dev->chip_rev == 0) tmp = 0x3205017F; else if (dev->dev->chip_rev == 1) tmp = 0x4205017F; else tmp = 0x5205017F; } else { b43_write16(dev, B43_MMIO_RADIO_CONTROL, B43_RADIOCTL_ID); tmp = b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); b43_write16(dev, B43_MMIO_RADIO_CONTROL, B43_RADIOCTL_ID); tmp |= (u32)b43_read16(dev, B43_MMIO_RADIO_DATA_HIGH) << 16; } radio_manuf = (tmp & 0x00000FFF); radio_ver = (tmp & 0x0FFFF000) >> 12; radio_rev = (tmp & 0xF0000000) >> 28; } if (radio_manuf != 0x17F /* Broadcom */) unsupported = 1; switch (phy_type) { case B43_PHYTYPE_A: if (radio_ver != 0x2060) unsupported = 1; if (radio_rev != 1) unsupported = 1; if (radio_manuf != 0x17F) unsupported = 1; break; case B43_PHYTYPE_B: if ((radio_ver & 0xFFF0) != 0x2050) unsupported = 1; break; case B43_PHYTYPE_G: if (radio_ver != 0x2050) unsupported = 1; break; case B43_PHYTYPE_N: if (radio_ver != 0x2055 && radio_ver != 0x2056) unsupported = 1; break; case B43_PHYTYPE_LP: if (radio_ver != 0x2062 && radio_ver != 0x2063) unsupported = 1; break; case B43_PHYTYPE_HT: if (radio_ver != 0x2059) unsupported = 1; break; case B43_PHYTYPE_LCN: if (radio_ver != 0x2064) unsupported = 1; break; default: B43_WARN_ON(1); } if (unsupported) { b43err(dev->wl, "FOUND UNSUPPORTED RADIO " "(Manuf 0x%X, Version 0x%X, Revision %u)\n", radio_manuf, radio_ver, radio_rev); return -EOPNOTSUPP; } b43dbg(dev->wl, "Found Radio: Manuf 0x%X, Version 0x%X, Revision %u\n", radio_manuf, radio_ver, radio_rev); phy->radio_manuf = radio_manuf; phy->radio_ver = radio_ver; phy->radio_rev = radio_rev; phy->analog = analog_type; phy->type = phy_type; phy->rev = phy_rev; return 0; }
0
Chrome
5788690fb1395dc672ff9b3385dbfb1180ed710a
NOT_APPLICABLE
NOT_APPLICABLE
void DelegatedFrameHost::DidNotProduceFrame(const viz::BeginFrameAck& ack) { DCHECK(!ack.has_damage); support_->DidNotProduceFrame(ack); }
0
php-src
abd159cce48f3e34f08e4751c568e09677d5ec9c?w=1
NOT_APPLICABLE
NOT_APPLICABLE
PHP_MSHUTDOWN_FUNCTION(file) /* {{{ */ { #ifndef ZTS file_globals_dtor(&file_globals TSRMLS_CC); #endif return SUCCESS; } /* }}} */
0
linux
d26c25a9d19b5976b319af528886f89cf455692d
NOT_APPLICABLE
NOT_APPLICABLE
static int copy_timer_indices(struct kvm_vcpu *vcpu, u64 __user *uindices) { if (put_user(KVM_REG_ARM_TIMER_CTL, uindices)) return -EFAULT; uindices++; if (put_user(KVM_REG_ARM_TIMER_CNT, uindices)) return -EFAULT; uindices++; if (put_user(KVM_REG_ARM_TIMER_CVAL, uindices)) return -EFAULT; return 0; }
0
libjpeg-turbo
1719d12e51641cce5c77e259516649ba5ef6303c
NOT_APPLICABLE
NOT_APPLICABLE
LZWReadByte(gif_source_ptr sinfo) /* Read an LZW-compressed byte */ { register int code; /* current working code */ int incode; /* saves actual input code */ /* If any codes are stacked from a previously read symbol, return them */ if (sinfo->sp > sinfo->symbol_stack) return (int)(*(--sinfo->sp)); /* Time to read a new symbol */ code = GetCode(sinfo); if (code == sinfo->clear_code) { /* Reinit state, swallow any extra Clear codes, and */ /* return next code, which is expected to be a raw byte. */ ReInitLZW(sinfo); do { code = GetCode(sinfo); } while (code == sinfo->clear_code); if (code > sinfo->clear_code) { /* make sure it is a raw byte */ WARNMS(sinfo->cinfo, JWRN_GIF_BADDATA); code = 0; /* use something valid */ } /* make firstcode, oldcode valid! */ sinfo->firstcode = sinfo->oldcode = code; return code; } if (code == sinfo->end_code) { /* Skip the rest of the image, unless GetCode already read terminator */ if (!sinfo->out_of_blocks) { SkipDataBlocks(sinfo); sinfo->out_of_blocks = TRUE; } /* Complain that there's not enough data */ WARNMS(sinfo->cinfo, JWRN_GIF_ENDCODE); /* Pad data with 0's */ return 0; /* fake something usable */ } /* Got normal raw byte or LZW symbol */ incode = code; /* save for a moment */ if (code >= sinfo->max_code) { /* special case for not-yet-defined symbol */ /* code == max_code is OK; anything bigger is bad data */ if (code > sinfo->max_code) { WARNMS(sinfo->cinfo, JWRN_GIF_BADDATA); incode = 0; /* prevent creation of loops in symbol table */ } /* this symbol will be defined as oldcode/firstcode */ *(sinfo->sp++) = (UINT8)sinfo->firstcode; code = sinfo->oldcode; } /* If it's a symbol, expand it into the stack */ while (code >= sinfo->clear_code) { *(sinfo->sp++) = sinfo->symbol_tail[code]; /* tail is a byte value */ code = sinfo->symbol_head[code]; /* head is another LZW symbol */ } /* At this point code just represents a raw byte */ sinfo->firstcode = code; /* save for possible future use */ /* If there's room in table... */ if ((code = sinfo->max_code) < LZW_TABLE_SIZE) { /* Define a new symbol = prev sym + head of this sym's expansion */ sinfo->symbol_head[code] = (UINT16)sinfo->oldcode; sinfo->symbol_tail[code] = (UINT8)sinfo->firstcode; sinfo->max_code++; /* Is it time to increase code_size? */ if (sinfo->max_code >= sinfo->limit_code && sinfo->code_size < MAX_LZW_BITS) { sinfo->code_size++; sinfo->limit_code <<= 1; /* keep equal to 2^code_size */ } } sinfo->oldcode = incode; /* save last input symbol for future use */ return sinfo->firstcode; /* return first byte of symbol's expansion */ }
0
tcpdump
83a412a5275cac973c5841eca3511c766bed778d
NOT_APPLICABLE
NOT_APPLICABLE
print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length) { int plenbytes; char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::/128")]; if (prefix[0] >= 96 && max_length >= IPV4_MAPPED_HEADING_LEN + 1 && is_ipv4_mapped_address(&prefix[1])) { struct in_addr addr; u_int plen; plen = prefix[0]-96; if (32 < plen) return -1; max_length -= 1; memset(&addr, 0, sizeof(addr)); plenbytes = (plen + 7) / 8; if (max_length < (u_int)plenbytes + IPV4_MAPPED_HEADING_LEN) return -3; memcpy(&addr, &prefix[1 + IPV4_MAPPED_HEADING_LEN], plenbytes); if (plen % 8) { ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } snprintf(buf, sizeof(buf), "%s/%d", ipaddr_string(ndo, &addr), plen); plenbytes += 1 + IPV4_MAPPED_HEADING_LEN; } else { plenbytes = decode_prefix6(ndo, prefix, max_length, buf, sizeof(buf)); if (plenbytes < 0) return plenbytes; } ND_PRINT((ndo, "%s", buf)); return plenbytes; }
0
cpp-peglib
0061f393de54cf0326621c079dc2988336d1ebb3
NOT_APPLICABLE
NOT_APPLICABLE
void visit(NotPredicate & /*ope*/) override { name = "NotPredicate"; }
0
Android
d07f5c14e811951ff9b411ceb84e7288e0d04aaf
NOT_APPLICABLE
NOT_APPLICABLE
status_t OggSource::read( MediaBuffer **out, const ReadOptions *options) { *out = NULL; int64_t seekTimeUs; ReadOptions::SeekMode mode; if (options && options->getSeekTo(&seekTimeUs, &mode)) { status_t err = mExtractor->mImpl->seekToTime(seekTimeUs); if (err != OK) { return err; } } MediaBuffer *packet; status_t err = mExtractor->mImpl->readNextPacket(&packet); if (err != OK) { return err; } #if 0 int64_t timeUs; if (packet->meta_data()->findInt64(kKeyTime, &timeUs)) { ALOGI("found time = %lld us", timeUs); } else { ALOGI("NO time"); } #endif packet->meta_data()->setInt32(kKeyIsSyncFrame, 1); *out = packet; return OK; }
0
acrn-hypervisor
25c0e3817eb332660dd63d1d4522e63dcc94e79a
NOT_APPLICABLE
NOT_APPLICABLE
static void dmar_enable_intr_remapping(struct dmar_drhd_rt *dmar_unit) { uint32_t status = 0; spinlock_obtain(&(dmar_unit->lock)); if ((dmar_unit->gcmd & DMA_GCMD_IRE) == 0U) { dmar_unit->gcmd |= DMA_GCMD_IRE; iommu_write32(dmar_unit, DMAR_GCMD_REG, dmar_unit->gcmd); /* 32-bit register */ dmar_wait_completion(dmar_unit, DMAR_GSTS_REG, DMA_GSTS_IRES, 0U, &status); #if DBG_IOMMU status = iommu_read32(dmar_unit, DMAR_GSTS_REG); #endif } spinlock_release(&(dmar_unit->lock)); dev_dbg(DBG_LEVEL_IOMMU, "%s: gsr:0x%x", __func__, status); }
0
media_tree
fa52bd506f274b7619955917abfde355e3d19ffe
NOT_APPLICABLE
NOT_APPLICABLE
static void usbvision_configure_video(struct usb_usbvision *usbvision) { int model; if (usbvision == NULL) return; model = usbvision->dev_model; usbvision->palette = usbvision_v4l2_format[2]; /* V4L2_PIX_FMT_RGB24; */ if (usbvision_device_data[usbvision->dev_model].vin_reg2_override) { usbvision->vin_reg2_preset = usbvision_device_data[usbvision->dev_model].vin_reg2; } else { usbvision->vin_reg2_preset = 0; } usbvision->tvnorm_id = usbvision_device_data[model].video_norm; usbvision->video_inputs = usbvision_device_data[model].video_channels; usbvision->ctl_input = 0; usbvision->radio_freq = 87.5 * 16000; usbvision->tv_freq = 400 * 16; /* This should be here to make i2c clients to be able to register */ /* first switch off audio */ if (usbvision_device_data[model].audio_channels > 0) usbvision_audio_off(usbvision); /* and then power up the tuner */ usbvision_power_on(usbvision); usbvision_i2c_register(usbvision); }
0
linux
3cf521f7dc87c031617fd47e4b7aa2593c2f3daf
NOT_APPLICABLE
NOT_APPLICABLE
static int pppol2tp_tunnel_setsockopt(struct sock *sk, struct l2tp_tunnel *tunnel, int optname, int val) { int err = 0; switch (optname) { case PPPOL2TP_SO_DEBUG: tunnel->debug = val; l2tp_info(tunnel, PPPOL2TP_MSG_CONTROL, "%s: set debug=%x\n", tunnel->name, tunnel->debug); break; default: err = -ENOPROTOOPT; break; } return err; }
0
Chrome
f85a87ec670ad0fce9d98d90c9a705b72a288154
NOT_APPLICABLE
NOT_APPLICABLE
static void limitedToOnlyOneAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectPythonV8Internal::limitedToOnlyOneAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
0
samba
b000da128b5fb519d2d3f2e7fd20e4a25b7dae7d
NOT_APPLICABLE
NOT_APPLICABLE
static int samldb_prim_group_tester(struct samldb_ctx *ac, uint32_t rid) { struct ldb_context *ldb = ldb_module_get_ctx(ac->module); struct dom_sid *sid; struct ldb_result *res; int ret; const char * const noattrs[] = { NULL }; sid = dom_sid_add_rid(ac, samdb_domain_sid(ldb), rid); if (sid == NULL) { return ldb_operr(ldb); } ret = dsdb_module_search(ac->module, ac, &res, ldb_get_default_basedn(ldb), LDB_SCOPE_SUBTREE, noattrs, DSDB_FLAG_NEXT_MODULE, ac->req, "(objectSid=%s)", ldap_encode_ndr_dom_sid(ac, sid)); if (ret != LDB_SUCCESS) { return ret; } if (res->count != 1) { talloc_free(res); ldb_asprintf_errstring(ldb, "Failed to find primary group with RID %u!", rid); return LDB_ERR_UNWILLING_TO_PERFORM; } talloc_free(res); return LDB_SUCCESS; }
0
linux
722d94847de29310e8aa03fcbdb41fc92c521756
NOT_APPLICABLE
NOT_APPLICABLE
int vfs_parse_fs_param_source(struct fs_context *fc, struct fs_parameter *param) { if (strcmp(param->key, "source") != 0) return -ENOPARAM; if (param->type != fs_value_is_string) return invalf(fc, "Non-string source"); if (fc->source) return invalf(fc, "Multiple sources"); fc->source = param->string; param->string = NULL; return 0; }
0
Chrome
b15c87071f906301bccc824ce013966ca93998c7
NOT_APPLICABLE
NOT_APPLICABLE
FakeDesktopSession::~FakeDesktopSession() { }
0
libdwarf-code
7ef09e1fc9ba07653dd078edb2408631c7969162
NOT_APPLICABLE
NOT_APPLICABLE
dwarf_formudata(Dwarf_Attribute attr, Dwarf_Unsigned * return_uval, Dwarf_Error * error) { Dwarf_Debug dbg = 0; Dwarf_CU_Context cu_context = 0; Dwarf_Byte_Ptr section_end = 0; Dwarf_Unsigned bytes_read = 0; Dwarf_Byte_Ptr data = attr->ar_debug_ptr; unsigned form = 0; int res = get_attr_dbg(&dbg,&cu_context,attr,error); if (res != DW_DLV_OK) { return res; } section_end = _dwarf_calculate_info_section_end_ptr(cu_context); form = attr->ar_attribute_form; res = _dwarf_formudata_internal(dbg, attr, form, data, section_end, return_uval, &bytes_read, error); return res; }
0
linux
f227e3ec3b5cad859ad15666874405e8c1bbc1d4
NOT_APPLICABLE
NOT_APPLICABLE
static void invalidate_batched_entropy(void) { int cpu; unsigned long flags; for_each_possible_cpu (cpu) { struct batched_entropy *batched_entropy; batched_entropy = per_cpu_ptr(&batched_entropy_u32, cpu); spin_lock_irqsave(&batched_entropy->batch_lock, flags); batched_entropy->position = 0; spin_unlock(&batched_entropy->batch_lock); batched_entropy = per_cpu_ptr(&batched_entropy_u64, cpu); spin_lock(&batched_entropy->batch_lock); batched_entropy->position = 0; spin_unlock_irqrestore(&batched_entropy->batch_lock, flags); } }
0
Chrome
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
NOT_APPLICABLE
NOT_APPLICABLE
exsltDateDayInMonth (const xmlChar *dateTime) { exsltDateValPtr dt; double ret; if (dateTime == NULL) { #ifdef WITH_TIME dt = exsltDateCurrent(); if (dt == NULL) #endif return xmlXPathNAN; } else { dt = exsltDateParse(dateTime); if (dt == NULL) return xmlXPathNAN; if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) && (dt->type != XS_GMONTHDAY) && (dt->type != XS_GDAY)) { exsltDateFreeDate(dt); return xmlXPathNAN; } } ret = (double) dt->value.date.day; exsltDateFreeDate(dt); return ret; }
0
Chrome
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
NOT_APPLICABLE
NOT_APPLICABLE
bool Element::childShouldCreateRenderer(const NodeRenderingContext& childContext) const { if (childContext.node()->isSVGElement()) return childContext.node()->hasTagName(SVGNames::svgTag) || isSVGElement(); return ContainerNode::childShouldCreateRenderer(childContext); }
0
Chrome
c442b3eda2f1fdd4d1d4864c34c43cbaf223acae
NOT_APPLICABLE
NOT_APPLICABLE
void TestingAutomationProvider::GetPrivateNetworkInfo( DictionaryValue* args, IPC::Message* reply_message) { scoped_ptr<DictionaryValue> return_value(new DictionaryValue); NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary(); const chromeos::VirtualNetworkVector& virtual_networks = network_library->virtual_networks(); if (network_library->virtual_network()) return_value->SetString("connected", network_library->virtual_network()->service_path()); for (chromeos::VirtualNetworkVector::const_iterator iter = virtual_networks.begin(); iter != virtual_networks.end(); ++iter) { const chromeos::VirtualNetwork* virt = *iter; DictionaryValue* item = new DictionaryValue; item->SetString("name", virt->name()); item->SetString("provider_type", VPNProviderTypeToString(virt->provider_type())); item->SetString("hostname", virt->server_hostname()); item->SetString("key", virt->psk_passphrase()); item->SetString("cert_nss", virt->ca_cert_nss()); item->SetString("cert_id", virt->client_cert_id()); item->SetString("username", virt->username()); item->SetString("password", virt->user_passphrase()); return_value->Set(virt->service_path(), item); } AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); }
0
ghostpdl
937ccd17ac65935633b2ebc06cb7089b91e17e6b
NOT_APPLICABLE
NOT_APPLICABLE
static void gx_ttfReader__Read(ttfReader *self, void *p, int n) { gx_ttfReader *r = (gx_ttfReader *)self; const byte *q; if (!r->error) { if (r->extra_glyph_index != -1) { q = r->glyph_data.bits.data + r->pos; r->error = ((r->pos >= r->glyph_data.bits.size || r->glyph_data.bits.size - r->pos < n) ? gs_note_error(gs_error_invalidfont) : 0); if (r->error == 0) memcpy(p, q, n); } else { unsigned int cnt; for (cnt = 0; cnt < (uint)n; cnt += r->error) { r->error = r->pfont->data.string_proc(r->pfont, (ulong)r->pos + cnt, (ulong)n - cnt, &q); if (r->error < 0) break; else if ( r->error == 0) { memcpy((char *)p + cnt, q, n - cnt); break; } else { memcpy((char *)p + cnt, q, r->error); } } } } if (r->error) { memset(p, 0, n); return; } r->pos += n; }
0
linux
84d73cd3fb142bf1298a8c13fd4ca50fd2432372
NOT_APPLICABLE
NOT_APPLICABLE
int rtnl_is_locked(void) { return mutex_is_locked(&rtnl_mutex); }
0
src
3095060f479b86288e31c79ecbc5131a66bcd2f9
NOT_APPLICABLE
NOT_APPLICABLE
add_listen_addr(ServerOptions *options, char *addr, int port) { u_int i; if (port == 0) for (i = 0; i < options->num_ports; i++) add_one_listen_addr(options, addr, options->ports[i]); else add_one_listen_addr(options, addr, port); }
0
CImg
ac8003393569aba51048c9d67e1491559877b1d1
NOT_APPLICABLE
NOT_APPLICABLE
inline float rol(const float a, const unsigned int n=1) { return (float)rol((int)a,n);
0
linux
bcc5364bdcfe131e6379363f089e7b4108d35b70
NOT_APPLICABLE
NOT_APPLICABLE
static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; DECLARE_SOCKADDR(struct sockaddr_ll *, saddr, msg->msg_name); struct sk_buff *skb; struct net_device *dev; __be16 proto; unsigned char *addr; int err, reserve = 0; struct sockcm_cookie sockc; struct virtio_net_hdr vnet_hdr = { 0 }; int offset = 0; struct packet_sock *po = pkt_sk(sk); int hlen, tlen, linear; int extra_len = 0; /* * Get and verify the address. */ if (likely(saddr == NULL)) { dev = packet_cached_dev_get(po); proto = po->num; addr = NULL; } else { err = -EINVAL; if (msg->msg_namelen < sizeof(struct sockaddr_ll)) goto out; if (msg->msg_namelen < (saddr->sll_halen + offsetof(struct sockaddr_ll, sll_addr))) goto out; proto = saddr->sll_protocol; addr = saddr->sll_addr; dev = dev_get_by_index(sock_net(sk), saddr->sll_ifindex); } err = -ENXIO; if (unlikely(dev == NULL)) goto out_unlock; err = -ENETDOWN; if (unlikely(!(dev->flags & IFF_UP))) goto out_unlock; sockc.tsflags = sk->sk_tsflags; sockc.mark = sk->sk_mark; if (msg->msg_controllen) { err = sock_cmsg_send(sk, msg, &sockc); if (unlikely(err)) goto out_unlock; } if (sock->type == SOCK_RAW) reserve = dev->hard_header_len; if (po->has_vnet_hdr) { err = packet_snd_vnet_parse(msg, &len, &vnet_hdr); if (err) goto out_unlock; } if (unlikely(sock_flag(sk, SOCK_NOFCS))) { if (!netif_supports_nofcs(dev)) { err = -EPROTONOSUPPORT; goto out_unlock; } extra_len = 4; /* We're doing our own CRC */ } err = -EMSGSIZE; if (!vnet_hdr.gso_type && (len > dev->mtu + reserve + VLAN_HLEN + extra_len)) goto out_unlock; err = -ENOBUFS; hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; linear = __virtio16_to_cpu(vio_le(), vnet_hdr.hdr_len); linear = max(linear, min_t(int, len, dev->hard_header_len)); skb = packet_alloc_skb(sk, hlen + tlen, hlen, len, linear, msg->msg_flags & MSG_DONTWAIT, &err); if (skb == NULL) goto out_unlock; skb_set_network_header(skb, reserve); err = -EINVAL; if (sock->type == SOCK_DGRAM) { offset = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, len); if (unlikely(offset < 0)) goto out_free; } /* Returns -EFAULT on error */ err = skb_copy_datagram_from_iter(skb, offset, &msg->msg_iter, len); if (err) goto out_free; if (sock->type == SOCK_RAW && !dev_validate_header(dev, skb->data, len)) { err = -EINVAL; goto out_free; } sock_tx_timestamp(sk, sockc.tsflags, &skb_shinfo(skb)->tx_flags); if (!vnet_hdr.gso_type && (len > dev->mtu + reserve + extra_len) && !packet_extra_vlan_len_allowed(dev, skb)) { err = -EMSGSIZE; goto out_free; } skb->protocol = proto; skb->dev = dev; skb->priority = sk->sk_priority; skb->mark = sockc.mark; packet_pick_tx_queue(dev, skb); if (po->has_vnet_hdr) { err = virtio_net_hdr_to_skb(skb, &vnet_hdr, vio_le()); if (err) goto out_free; len += sizeof(vnet_hdr); } skb_probe_transport_header(skb, reserve); if (unlikely(extra_len == 4)) skb->no_fcs = 1; err = po->xmit(skb); if (err > 0 && (err = net_xmit_errno(err)) != 0) goto out_unlock; dev_put(dev); return len; out_free: kfree_skb(skb); out_unlock: if (dev) dev_put(dev); out: return err; }
0
weechat
efb795c74fe954b9544074aafcebb1be4452b03a
NOT_APPLICABLE
NOT_APPLICABLE
string_free_split_command (char **split_command) { int i; if (split_command) { for (i = 0; split_command[i]; i++) free (split_command[i]); free (split_command); } }
0
ceph
92da834cababc4dddd5dbbab5837310478d1e6d4
NOT_APPLICABLE
NOT_APPLICABLE
rgw::auth::s3::LDAPEngine::authenticate( const DoutPrefixProvider* dpp, const boost::string_view& access_key_id, const boost::string_view& signature, const boost::string_view& session_token, const string_to_sign_t& string_to_sign, const signature_factory_t&, const completer_factory_t& completer_factory, const req_state* const s) const { /* boost filters and/or string_ref may throw on invalid input */ rgw::RGWToken base64_token; try { base64_token = rgw::from_base64(access_key_id); } catch (...) { base64_token = std::string(""); } if (! base64_token.valid()) { return result_t::deny(); } //TODO: Uncomment, when we have a migration plan in place. //Check if a user of type other than 'ldap' is already present, if yes, then //return error. /*RGWUserInfo user_info; user_info.user_id = base64_token.id; if (rgw_get_user_info_by_uid(store, user_info.user_id, user_info) >= 0) { if (user_info.type != TYPE_LDAP) { ldpp_dout(dpp, 10) << "ERROR: User id of type: " << user_info.type << " is already present" << dendl; return nullptr; } }*/ if (ldh->auth(base64_token.id, base64_token.key) != 0) { return result_t::deny(-ERR_INVALID_ACCESS_KEY); } auto apl = apl_factory->create_apl_remote(cct, s, get_acl_strategy(), get_creds_info(base64_token)); return result_t::grant(std::move(apl), completer_factory(boost::none)); } /* rgw::auth::s3::LDAPEngine::authenticate */
0
ceph
92da834cababc4dddd5dbbab5837310478d1e6d4
NOT_APPLICABLE
NOT_APPLICABLE
int RGWCopyObj_ObjStore_S3::check_storage_class(const rgw_placement_rule& src_placement) { if (src_placement == s->dest_placement) { /* can only copy object into itself if replacing attrs */ s->err.message = "This copy request is illegal because it is trying to copy " "an object to itself without changing the object's metadata, " "storage class, website redirect location or encryption attributes."; ldpp_dout(this, 0) << s->err.message << dendl; return -ERR_INVALID_REQUEST; } return 0; }
0
haproxy
3b69886f7dcc3cfb3d166309018e6cfec9ce2c95
NOT_APPLICABLE
NOT_APPLICABLE
static inline int htx_almost_full(const struct htx *htx) { if (!htx->size || htx_free_space(htx) < htx->size / 4) return 1; return 0; }
0
linux
f6d8bd051c391c1c0458a30b2a7abcd939329259
NOT_APPLICABLE
NOT_APPLICABLE
int compat_ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { int err; if (optname == MCAST_MSFILTER) return compat_mc_getsockopt(sk, level, optname, optval, optlen, ip_getsockopt); err = do_ip_getsockopt(sk, level, optname, optval, optlen); #ifdef CONFIG_NETFILTER /* we need to exclude all possible ENOPROTOOPTs except default case */ if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS && !ip_mroute_opt(optname)) { int len; if (get_user(len, optlen)) return -EFAULT; lock_sock(sk); err = compat_nf_getsockopt(sk, PF_INET, optname, optval, &len); release_sock(sk); if (err >= 0) err = put_user(len, optlen); return err; } #endif return err; }
0
hhvm
08193b7f0cd3910256e00d599f0f3eb2519c44ca
NOT_APPLICABLE
NOT_APPLICABLE
void popFrame(TraceIterator tIt, Stats& stats) { Frame callee = m_stack.back(); m_stack.pop_back(); Frame& caller = m_stack.back(); char *cp = m_arcBuff; memcpy(cp, caller.trace->symbol, caller.len); cp += caller.len; if (caller.level >= 1) { std::pair<char*, int>& lvl = m_recursion[caller.level]; memcpy(cp, lvl.first, lvl.second); cp += lvl.second; } memcpy(cp, HP_STACK_DELIM, HP_STACK_DELIM_LEN); cp += HP_STACK_DELIM_LEN; memcpy(cp, callee.trace->symbol, callee.len); cp += callee.len; if (callee.level >= 1) { std::pair<char*, int>& lvl = m_recursion[callee.level]; memcpy(cp, lvl.first, lvl.second); cp += lvl.second; } *cp = 0; incStats(m_arcBuff, tIt, callee, stats); }
0
gpac
7bb1b4a4dd23c885f9db9f577dfe79ecc5433109
NOT_APPLICABLE
NOT_APPLICABLE
GF_Err gf_media_vp9_parse_sample(GF_BitStream *bs, GF_VPConfig *vp9_cfg, Bool *key_frame, u32 *FrameWidth, u32 *FrameHeight, u32 *renderWidth, u32 *renderHeight) { Bool FrameIsIntra = GF_FALSE, profile_low_bit, profile_high_bit, show_existing_frame = GF_FALSE, frame_type = GF_FALSE, show_frame = GF_FALSE, error_resilient_mode = GF_FALSE; /*u8 frame_context_idx = 0, reset_frame_context = 0, frame_marker = 0*/; int Sb64Cols = 0, Sb64Rows = 0, i; u8 refresh_frame_flags = 0; assert(bs && key_frame); /*uncompressed header*/ /*frame_marker = */gf_bs_read_int_log(bs, 2, "frame_marker"); profile_low_bit = gf_bs_read_int_log(bs, 1, "profile_low_bit"); profile_high_bit = gf_bs_read_int_log(bs, 1, "profile_high_bit"); vp9_cfg->profile = (profile_high_bit << 1) + profile_low_bit; if (vp9_cfg->profile == 3) { Bool reserved_zero = gf_bs_read_int_log(bs, 1, "reserved_zero"); if (reserved_zero) { GF_LOG(GF_LOG_ERROR, GF_LOG_CODING, ("[VP9] uncompressed header reserved zero is not zero.\n")); return GF_NON_COMPLIANT_BITSTREAM; } } show_existing_frame = gf_bs_read_int_log(bs, 1, "show_existing_frame"); if (show_existing_frame == GF_TRUE) { /*frame_to_show_map_idx = */gf_bs_read_int_log(bs, 3, "frame_to_show_map_idx"); return GF_OK; } frame_type = gf_bs_read_int_log(bs, 1, "frame_type"); show_frame = gf_bs_read_int_log(bs, 1, "show_frame"); error_resilient_mode = gf_bs_read_int_log(bs, 1, "error_resilient_mode"); if (frame_type == VP9_KEY_FRAME) { if (!vp9_frame_sync_code(bs)) return GF_NON_COMPLIANT_BITSTREAM; if (vp9_color_config(bs, vp9_cfg) != GF_OK) return GF_NON_COMPLIANT_BITSTREAM; vp9_frame_size(bs, FrameWidth, FrameHeight, &Sb64Cols, &Sb64Rows); vp9_render_size(bs, *FrameWidth, *FrameHeight, renderWidth, renderHeight); refresh_frame_flags = 0xFF; *key_frame = GF_TRUE; FrameIsIntra = GF_TRUE; } else { Bool intra_only = GF_FALSE; *key_frame = GF_FALSE; if (show_frame == GF_FALSE) { intra_only = gf_bs_read_int_log(bs, 1, "intra_only"); } FrameIsIntra = intra_only; if (error_resilient_mode == GF_FALSE) { /*reset_frame_context = */gf_bs_read_int_log(bs, 2, "reset_frame_context"); } if (intra_only == GF_TRUE) { if (!vp9_frame_sync_code(bs)) return GF_NON_COMPLIANT_BITSTREAM; if (vp9_cfg->profile > 0) { if (vp9_color_config(bs, vp9_cfg) != GF_OK) return GF_NON_COMPLIANT_BITSTREAM; } else { u8 color_space = CS_BT_601; vp9_cfg->colour_primaries = VP9_CS_to_23001_8_colour_primaries[color_space]; vp9_cfg->transfer_characteristics = VP9_CS_to_23001_8_transfer_characteristics[color_space]; vp9_cfg->matrix_coefficients = VP9_CS_to_23001_8_matrix_coefficients[color_space]; vp9_cfg->chroma_subsampling = 0; vp9_cfg->bit_depth = 8; } refresh_frame_flags = gf_bs_read_int_log(bs, 8, "refresh_frame_flags"); vp9_frame_size(bs, FrameWidth, FrameHeight, &Sb64Cols, &Sb64Rows); vp9_render_size(bs, *FrameWidth, *FrameHeight, renderWidth, renderHeight); } else { refresh_frame_flags = gf_bs_read_int_log(bs, 8, "refresh_frame_flags"); u8 ref_frame_idx[3]; for (i = 0; i < 3; i++) { ref_frame_idx[i] = gf_bs_read_int_log_idx(bs, 3, "ref_frame_idx", i); /*ref_frame_sign_bias[LAST_FRAME + i] = */gf_bs_read_int_log_idx(bs, 1, "ref_frame_sign_bias", i); } vp9_frame_size_with_refs(bs, refresh_frame_flags, ref_frame_idx, vp9_cfg->RefFrameWidth, vp9_cfg->RefFrameHeight, FrameWidth, FrameHeight, renderWidth, renderHeight, &Sb64Cols, &Sb64Rows); /*allow_high_precision_mv = */gf_bs_read_int_log(bs, 1, "allow_high_precision_mv"); vp9_read_interpolation_filter(bs); } } if (error_resilient_mode == 0) { /*refresh_frame_context = */gf_bs_read_int_log(bs, 1, "refresh_frame_context"); /*frame_parallel_decoding_mode = */gf_bs_read_int_log(bs, 1, "frame_parallel_decoding_mode"); } /*frame_context_idx = */gf_bs_read_int_log(bs, 2, "frame_context_idx"); if (FrameIsIntra || error_resilient_mode) { /*setup_past_independence + save_probs ...*/ //frame_context_idx = 0; } vp9_loop_filter_params(bs); vp9_quantization_params(bs); vp9_segmentation_params(bs); vp9_tile_info(bs, Sb64Cols); /*header_size_in_bytes = */gf_bs_read_int_log(bs, 16, "header_size_in_bytes"); /*Reference frame update process (8.10 - partial)*/ for (i = 0; i < VP9_NUM_REF_FRAMES; i++) { if ((refresh_frame_flags >> i) & 1) { vp9_cfg->RefFrameWidth[i] = *FrameWidth; vp9_cfg->RefFrameHeight[i] = *FrameHeight; } } return GF_OK; }
0
neomutt
9bfab35522301794483f8f9ed60820bdec9be59e
NOT_APPLICABLE
NOT_APPLICABLE
void nntp_group_unread_stat(struct NntpData *nntp_data) { nntp_data->unread = 0; if (nntp_data->last_message == 0 || nntp_data->first_message > nntp_data->last_message) return; nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1; for (unsigned int i = 0; i < nntp_data->newsrc_len; i++) { anum_t first = nntp_data->newsrc_ent[i].first; if (first < nntp_data->first_message) first = nntp_data->first_message; anum_t last = nntp_data->newsrc_ent[i].last; if (last > nntp_data->last_message) last = nntp_data->last_message; if (first <= last) nntp_data->unread -= last - first + 1; } }
0
gpac
b43f9d1a4b4e33d08edaef6d313e6ce4bdf554d3
NOT_APPLICABLE
NOT_APPLICABLE
static void naludmx_update_clli_mdcv(GF_NALUDmxCtx *ctx, Bool reset_crc) { if (!ctx->opid) return; if (reset_crc) ctx->clli_crc = 0; if ((ctx->hevc_state && ctx->hevc_state->clli_valid) || (ctx->vvc_state && ctx->vvc_state->clli_valid) ) { u8 *clli = ctx->hevc_state ? ctx->hevc_state->clli_data : ctx->vvc_state->clli_data; gf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CONTENT_LIGHT_LEVEL, &PROP_DATA(clli, 4)); ctx->clli_crc = gf_crc_32(clli, 4); } if (reset_crc) ctx->mdcv_crc = 0; if ((ctx->hevc_state && ctx->hevc_state->mdcv_valid) || (ctx->vvc_state && ctx->vvc_state->mdcv_valid) ) { u8 *mdcv = ctx->hevc_state ? ctx->hevc_state->mdcv_data : ctx->vvc_state->mdcv_data; gf_filter_pid_set_property(ctx->opid, GF_PROP_PID_MASTER_DISPLAY_COLOUR, &PROP_DATA(mdcv, 24)); ctx->mdcv_crc = gf_crc_32(mdcv, 24); } }
0
linux-2.6
d7f59dc4642ce2fc7b79fcd4ec02ffce7f21eb02
NOT_APPLICABLE
NOT_APPLICABLE
int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u16 family, u32 *type, u32 *sid) { int rc; struct netlbl_lsm_secattr secattr; if (!netlbl_enabled()) { *sid = SECSID_NULL; return 0; } netlbl_secattr_init(&secattr); rc = netlbl_skbuff_getattr(skb, family, &secattr); if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) rc = selinux_netlbl_sidlookup_cached(skb, &secattr, sid); else *sid = SECSID_NULL; *type = secattr.type; netlbl_secattr_destroy(&secattr); return rc; }
0
kvm
c73f4c998e1fd4249b9edfa39e23f4fda2b9b041
NOT_APPLICABLE
NOT_APPLICABLE
static inline void nested_release_vmcs12(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); if (vmx->nested.current_vmptr == -1ull) return; if (enable_shadow_vmcs) { /* copy to memory all shadowed fields in case they were modified */ copy_shadow_to_vmcs12(vmx); vmx->nested.need_vmcs12_sync = false; vmx_disable_shadow_vmcs(vmx); } vmx->nested.posted_intr_nv = -1; /* Flush VMCS12 to guest memory */ kvm_vcpu_write_guest_page(vcpu, vmx->nested.current_vmptr >> PAGE_SHIFT, vmx->nested.cached_vmcs12, 0, VMCS12_SIZE); kvm_mmu_free_roots(vcpu, &vcpu->arch.guest_mmu, KVM_MMU_ROOTS_ALL); vmx->nested.current_vmptr = -1ull; }
0
linux
a4a5ed2835e8ea042868b7401dced3f517cafa76
NOT_APPLICABLE
NOT_APPLICABLE
acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, u64 *value, u32 width) { int result, size; u32 value32; if (!value) return AE_BAD_PARAMETER; switch (width) { case 8: size = 1; break; case 16: size = 2; break; case 32: size = 4; break; default: return AE_ERROR; } result = raw_pci_read(pci_id->segment, pci_id->bus, PCI_DEVFN(pci_id->device, pci_id->function), reg, size, &value32); *value = value32; return (result ? AE_ERROR : AE_OK); }
0
linux
b4487b93545214a9db8cbf32e86411677b0cca21
NOT_APPLICABLE
NOT_APPLICABLE
static int nfs4_proc_readdir(struct dentry *dentry, const struct cred *cred, u64 cookie, struct page **pages, unsigned int count, bool plus) { struct nfs4_exception exception = { .interruptible = true, }; int err; do { err = _nfs4_proc_readdir(dentry, cred, cookie, pages, count, plus); trace_nfs4_readdir(d_inode(dentry), err); err = nfs4_handle_exception(NFS_SERVER(d_inode(dentry)), err, &exception); } while (exception.retry); return err; }
0
server
2e7891080667c59ac80f788eef4d59d447595772
NOT_APPLICABLE
NOT_APPLICABLE
bool enumerate_field_refs_processor(void *arg) { return orig_item->enumerate_field_refs_processor(arg); }
0
gpac
64a2e1b799352ac7d7aad1989bc06e7b0f2b01db
NOT_APPLICABLE
NOT_APPLICABLE
GF_Err metx_box_size(GF_Box *s) { GF_MetaDataSampleEntryBox *ptr = (GF_MetaDataSampleEntryBox *)s; ptr->size += 8; if (ptr->type!=GF_ISOM_BOX_TYPE_STPP) { if (ptr->content_encoding) ptr->size += strlen(ptr->content_encoding); ptr->size++; } if ((ptr->type==GF_ISOM_BOX_TYPE_METX) || (ptr->type==GF_ISOM_BOX_TYPE_STPP)) { if (ptr->xml_namespace) ptr->size += strlen(ptr->xml_namespace); ptr->size++; if (ptr->xml_schema_loc) ptr->size += strlen(ptr->xml_schema_loc); ptr->size++; if (ptr->type==GF_ISOM_BOX_TYPE_STPP) { if (ptr->mime_type) ptr->size += strlen(ptr->mime_type); ptr->size++; } } //mett, sbtt, stxt else { if (ptr->mime_type) ptr->size += strlen(ptr->mime_type); ptr->size++; } return GF_OK;
0
Chrome
6b5f83842b5edb5d4bd6684b196b3630c6769731
NOT_APPLICABLE
NOT_APPLICABLE
void ExtensionSettingsHandler::MaybeRegisterForNotifications() { if (registered_for_notifications_) return; registered_for_notifications_ = true; Profile* profile = Profile::FromWebUI(web_ui()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED, content::Source<Profile>(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add( this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, content::Source<ExtensionPrefs>(profile->GetExtensionService()-> extension_prefs())); }
0
vim
dbdd16b62560413abcc3c8e893cc3010ccf31666
NOT_APPLICABLE
NOT_APPLICABLE
compile_endif(char_u *arg, cctx_T *cctx) { scope_T *scope = cctx->ctx_scope; ifscope_T *ifscope; garray_T *instr = &cctx->ctx_instr; isn_T *isn; if (misplaced_cmdmod(cctx)) return NULL; if (scope == NULL || scope->se_type != IF_SCOPE) { emsg(_(e_endif_without_if)); return NULL; } ifscope = &scope->se_u.se_if; unwind_locals(cctx, scope->se_local_count); if (!cctx->ctx_had_return) ifscope->is_had_return = FALSE; if (scope->se_u.se_if.is_if_label >= 0) { // previous "if" or "elseif" jumps here isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label; isn->isn_arg.jump.jump_where = instr->ga_len; } // Fill in the "end" label in jumps at the end of the blocks. compile_fill_jump_to_end(&ifscope->is_end_label, instr->ga_len, cctx); #ifdef FEAT_PROFILE // even when skipping we count the endif as executed, unless the block it's // in is skipped if (cctx->ctx_compile_type == CT_PROFILE && cctx->ctx_skip == SKIP_YES && scope->se_skip_save != SKIP_YES) { cctx->ctx_skip = SKIP_NOT; generate_instr(cctx, ISN_PROF_START); } #endif cctx->ctx_skip = scope->se_skip_save; // If all the blocks end in :return and there is an :else then the // had_return flag is set. cctx->ctx_had_return = ifscope->is_had_return && ifscope->is_seen_else; drop_scope(cctx); return arg; }
0
libarchive
3014e198
NOT_APPLICABLE
NOT_APPLICABLE
write_null(struct archive_write *a, size_t size) { size_t remaining; unsigned char *p, *old; int r; remaining = wb_remaining(a); p = wb_buffptr(a); if (size <= remaining) { memset(p, 0, size); return (wb_consume(a, size)); } memset(p, 0, remaining); r = wb_consume(a, remaining); if (r != ARCHIVE_OK) return (r); size -= remaining; old = p; p = wb_buffptr(a); memset(p, 0, old - p); remaining = wb_remaining(a); while (size) { size_t wsize = size; if (wsize > remaining) wsize = remaining; r = wb_consume(a, wsize); if (r != ARCHIVE_OK) return (r); size -= wsize; } return (ARCHIVE_OK); }
0
mesos
2c282f19755ea7518caf6f43e729524b1c6bdb23
CVE-2018-8023
CWE-200
Try<JWT, JWTError> JWT::parse(const string& token, const string& secret) { const vector<string> components = strings::split(token, "."); if (components.size() != 3) { return JWTError( "Expected 3 components in token, got " + stringify(components.size()), JWTError::Type::INVALID_TOKEN); } Try<JWT::Header> header = parse_header(components[0]); if (header.isError()) { return JWTError(header.error(), JWTError::Type::INVALID_TOKEN); } if (header->alg != JWT::Alg::HS256) { return JWTError( "Token 'alg' value \"" + stringify(header->alg) + "\" does not match, expected \"HS256\"", JWTError::Type::INVALID_TOKEN); } Try<JSON::Object> payload = parse_payload(components[1]); if (payload.isError()) { return JWTError(payload.error(), JWTError::Type::INVALID_TOKEN); } const Try<string> signature = base64::decode_url_safe(components[2]); if (signature.isError()) { return JWTError( "Failed to base64url-decode token signature: " + signature.error(), JWTError::Type::INVALID_TOKEN); } // Validate HMAC SHA256 signature. Try<string> hmac = generate_hmac_sha256( components[0] + "." + components[1], secret); if (hmac.isError()) { return JWTError( "Failed to generate HMAC signature: " + hmac.error(), JWTError::Type::UNKNOWN); } const bool valid = hmac.get() == signature.get(); if (!valid) { return JWTError( "Token signature does not match", JWTError::Type::INVALID_TOKEN); } return JWT(header.get(), payload.get(), signature.get()); }
1
ImageMagick6
c5d012a46ae22be9444326aa37969a3f75daa3ba
NOT_APPLICABLE
NOT_APPLICABLE
MagickExport MagickBooleanType FileToImage(Image *image,const char *filename, ExceptionInfo *exception) { int file; MagickBooleanType status; size_t length, quantum; ssize_t count; struct stat file_stats; unsigned char *blob; assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); assert(filename != (const char *) NULL); (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename); status=IsRightsAuthorized(PathPolicyDomain,WritePolicyRights,filename); if (status == MagickFalse) { errno=EPERM; (void) ThrowMagickException(exception,GetMagickModule(),PolicyError, "NotAuthorized","`%s'",filename); return(MagickFalse); } file=fileno(stdin); if (LocaleCompare(filename,"-") != 0) file=open_utf8(filename,O_RDONLY | O_BINARY,0); if (file == -1) { ThrowFileException(exception,BlobError,"UnableToOpenBlob",filename); return(MagickFalse); } quantum=(size_t) MagickMaxBufferExtent; if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0)) quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent); blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob)); if (blob == (unsigned char *) NULL) { file=close(file); ThrowFileException(exception,ResourceLimitError,"MemoryAllocationFailed", filename); return(MagickFalse); } for ( ; ; ) { count=read(file,blob,quantum); if (count <= 0) { count=0; if (errno != EINTR) break; } length=(size_t) count; count=WriteBlobStream(image,length,blob); if (count != (ssize_t) length) { ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename); break; } } file=close(file); if (file == -1) ThrowFileException(exception,BlobError,"UnableToWriteBlob",filename); blob=(unsigned char *) RelinquishMagickMemory(blob); return(MagickTrue); }
0
linux
de9f869616dd95e95c00bdd6b0fcd3421e8a4323
NOT_APPLICABLE
NOT_APPLICABLE
static int get_eff_addr_reg(struct insn *insn, struct pt_regs *regs, int *regoff, long *eff_addr) { insn_get_modrm(insn); if (!insn->modrm.nbytes) return -EINVAL; if (X86_MODRM_MOD(insn->modrm.value) != 3) return -EINVAL; *regoff = get_reg_offset(insn, regs, REG_TYPE_RM); if (*regoff < 0) return -EINVAL; /* Ignore bytes that are outside the address size. */ if (insn->addr_bytes == 2) *eff_addr = regs_get_register(regs, *regoff) & 0xffff; else if (insn->addr_bytes == 4) *eff_addr = regs_get_register(regs, *regoff) & 0xffffffff; else /* 64-bit address */ *eff_addr = regs_get_register(regs, *regoff); return 0; }
0
Chrome
75b803b1c81ed9fa5513cbff550232b4fb915e7b
NOT_APPLICABLE
NOT_APPLICABLE
v8::Local<v8::Value> ModuleSystem::LoadModule(const std::string& module_name) { v8::EscapableHandleScope handle_scope(GetIsolate()); v8::Local<v8::Context> v8_context = context()->v8_context(); v8::Context::Scope context_scope(v8_context); v8::Local<v8::Value> source(GetSource(module_name)); if (source.IsEmpty() || source->IsUndefined()) { Fatal(context_, "No source for require(" + module_name + ")"); return v8::Undefined(GetIsolate()); } v8::Local<v8::String> wrapped_source( WrapSource(v8::Local<v8::String>::Cast(source))); v8::Local<v8::String> v8_module_name; if (!ToV8String(GetIsolate(), module_name.c_str(), &v8_module_name)) { NOTREACHED() << "module_name is too long"; return v8::Undefined(GetIsolate()); } v8::Local<v8::Value> func_as_value = RunString(wrapped_source, v8_module_name); if (func_as_value.IsEmpty() || func_as_value->IsUndefined()) { Fatal(context_, "Bad source for require(" + module_name + ")"); return v8::Undefined(GetIsolate()); } v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(func_as_value); v8::Local<v8::Object> define_object = v8::Object::New(GetIsolate()); gin::ModuleRegistry::InstallGlobals(GetIsolate(), define_object); v8::Local<v8::Object> exports = v8::Object::New(GetIsolate()); v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New( GetIsolate(), &SetExportsProperty); v8::Local<v8::String> v8_key; if (!v8_helpers::ToV8String(GetIsolate(), "$set", &v8_key)) { NOTREACHED(); return v8::Undefined(GetIsolate()); } v8::Local<v8::Function> function; if (!tmpl->GetFunction(v8_context).ToLocal(&function)) { NOTREACHED(); return v8::Undefined(GetIsolate()); } exports->DefineOwnProperty(v8_context, v8_key, function, v8::ReadOnly) .FromJust(); v8::Local<v8::Object> natives(NewInstance()); CHECK(!natives.IsEmpty()); // this can fail if v8 has issues v8::Local<v8::Value> args[] = { GetPropertyUnsafe(v8_context, define_object, "define"), GetPropertyUnsafe(v8_context, natives, "require", v8::NewStringType::kInternalized), GetPropertyUnsafe(v8_context, natives, "requireNative", v8::NewStringType::kInternalized), GetPropertyUnsafe(v8_context, natives, "requireAsync", v8::NewStringType::kInternalized), exports, console::AsV8Object(GetIsolate()), GetPropertyUnsafe(v8_context, natives, "privates", v8::NewStringType::kInternalized), context_->safe_builtins()->GetArray(), context_->safe_builtins()->GetFunction(), context_->safe_builtins()->GetJSON(), context_->safe_builtins()->GetObjekt(), context_->safe_builtins()->GetRegExp(), context_->safe_builtins()->GetString(), context_->safe_builtins()->GetError(), }; { v8::TryCatch try_catch(GetIsolate()); try_catch.SetCaptureMessage(true); context_->CallFunction(func, arraysize(args), args); if (try_catch.HasCaught()) { HandleException(try_catch); return v8::Undefined(GetIsolate()); } } return handle_scope.Escape(exports); }
0
Android
c677ee92595335233eb0e7b59809a1a94e7a678a
NOT_APPLICABLE
NOT_APPLICABLE
static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason, UINT16 conn_handle) { UINT8 old_state = p_dev_rec->sec_state; tBTM_STATUS status = BTM_CMD_STARTED; BTM_TRACE_EVENT ("btm_sec_send_hci_disconnect: handle:0x%x, reason=0x%x", conn_handle, reason); /* if some other thread disconnecting, we do not send second command */ if (BTM_SEC_STATE_DISCONNECTING != old_state) { p_dev_rec->sec_state = BTM_SEC_STATE_DISCONNECTING; #if BTM_DISC_DURING_RS == TRUE /* If a Role Switch is in progress, delay the HCI Disconnect to avoid controller problem (4329B1) */ if (p_dev_rec->rs_disc_pending == BTM_SEC_RS_PENDING && p_dev_rec->hci_handle == conn_handle) { BTM_TRACE_DEBUG("RS in progress - Set DISC Pending flag in btm_sec_send_hci_disconnect to delay disconnect"); p_dev_rec->rs_disc_pending = BTM_SEC_DISC_PENDING; status = BTM_SUCCESS; } else #endif /* Tear down the HCI link */ if (!btsnd_hcic_disconnect (conn_handle, reason)) { /* could not send disconnect. restore old state */ p_dev_rec->sec_state = old_state; status = BTM_NO_RESOURCES; } } return (status); }
0
virglrenderer
28894a30a17a84529be102b21118e55d6c9f23fa
NOT_APPLICABLE
NOT_APPLICABLE
parse_register_1d(struct translate_ctx *ctx, uint *file, int *index ) { if (!parse_register_file_bracket_index( ctx, file, index )) return FALSE; eat_opt_white( &ctx->cur ); if (*ctx->cur != ']') { report_error( ctx, "Expected `]'" ); return FALSE; } ctx->cur++; return TRUE; }
0
Onigmo
00cc7e28a3ed54b3b512ef3b58ea737a57acf1f9
NOT_APPLICABLE
NOT_APPLICABLE
CC_DUP_WARN(ScanEnv *env, OnigCodePoint from ARG_UNUSED, OnigCodePoint to ARG_UNUSED) { if (onig_warn == onig_null_warn || !RTEST(ruby_verbose)) return ; if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_WARN_CC_DUP) && !(env->warnings_flag & ONIG_SYN_WARN_CC_DUP)) { #ifdef WARN_ALL_CC_DUP onig_syntax_warn(env, "character class has duplicated range: %04x-%04x", from, to); #else env->warnings_flag |= ONIG_SYN_WARN_CC_DUP; onig_syntax_warn(env, "character class has duplicated range"); #endif } }
0
linux
4e7c22d447bb6d7e37bfe39ff658486ae78e8d77
NOT_APPLICABLE
NOT_APPLICABLE
static bool always_dump_vma(struct vm_area_struct *vma) { /* Any vsyscall mappings? */ if (vma == get_gate_vma(vma->vm_mm)) return true; /* * Assume that all vmas with a .name op should always be dumped. * If this changes, a new vm_ops field can easily be added. */ if (vma->vm_ops && vma->vm_ops->name && vma->vm_ops->name(vma)) return true; /* * arch_vma_name() returns non-NULL for special architecture mappings, * such as vDSO sections. */ if (arch_vma_name(vma)) return true; return false; }
0
linux
637b58c2887e5e57850865839cc75f59184b23d1
CVE-2015-1805
CWE-17
static int iov_fault_in_pages_write(struct iovec *iov, unsigned long len) { while (!iov->iov_len) iov++; while (len > 0) { unsigned long this_len; this_len = min_t(unsigned long, len, iov->iov_len); if (fault_in_pages_writeable(iov->iov_base, this_len)) break; len -= this_len; iov++; } return len; }
1
linux
4397f04575c44e1440ec2e49b6302785c95fd2f8
NOT_APPLICABLE
NOT_APPLICABLE
static void *saved_cmdlines_start(struct seq_file *m, loff_t *pos) { void *v; loff_t l = 0; preempt_disable(); arch_spin_lock(&trace_cmdline_lock); v = &savedcmd->map_cmdline_to_pid[0]; while (l <= *pos) { v = saved_cmdlines_next(m, v, &l); if (!v) return NULL; } return v; }
0
linux
af6fc858a35b90e89ea7a7ee58e66628c55c776b
NOT_APPLICABLE
NOT_APPLICABLE
static inline int valid_request(int offset, int size) { /* Validate request (no un-aligned requests) */ if ((size == 1 || size == 2 || size == 4) && (offset % size) == 0) return 1; return 0; }
0
WavPack
4bc05fc490b66ef2d45b1de26abf1455b486b0dc
NOT_APPLICABLE
NOT_APPLICABLE
static uint32_t __inline read_code (Bitstream *bs, uint32_t maxcode) { unsigned long local_sr; uint32_t extras, code; int bitcount; if (maxcode < 2) return maxcode ? getbit (bs) : 0; bitcount = count_bits (maxcode); #ifdef USE_BITMASK_TABLES extras = bitset [bitcount] - maxcode - 1; #else extras = (1 << bitcount) - maxcode - 1; #endif local_sr = bs->sr; while (bs->bc < bitcount) { if (++(bs->ptr) == bs->end) bs->wrap (bs); local_sr |= (long)*(bs->ptr) << bs->bc; bs->bc += sizeof (*(bs->ptr)) * 8; } #ifdef USE_BITMASK_TABLES if ((code = local_sr & bitmask [bitcount - 1]) >= extras) #else if ((code = local_sr & ((1 << (bitcount - 1)) - 1)) >= extras) #endif code = (code << 1) - extras + ((local_sr >> (bitcount - 1)) & 1); else bitcount--; if (sizeof (local_sr) < 8 && bs->bc > sizeof (local_sr) * 8) { bs->bc -= bitcount; bs->sr = *(bs->ptr) >> (sizeof (*(bs->ptr)) * 8 - bs->bc); } else { bs->bc -= bitcount; bs->sr = local_sr >> bitcount; } return code; }
0
vim
826bfe4bbd7594188e3d74d2539d9707b1c6a14b
NOT_APPLICABLE
NOT_APPLICABLE
update_debug_sign(buf_T *buf, linenr_T lnum) { win_T *wp; int doit = FALSE; # ifdef FEAT_FOLDING win_foldinfo.fi_level = 0; # endif // update/delete a specific sign redraw_buf_line_later(buf, lnum); // check if it resulted in the need to redraw a window FOR_ALL_WINDOWS(wp) if (wp->w_redr_type != 0) doit = TRUE; // Return when there is nothing to do, screen updating is already // happening (recursive call), messages on the screen or still starting up. if (!doit || updating_screen || State == ASKMORE || State == HITRETURN || msg_scrolled #ifdef FEAT_GUI || gui.starting #endif || starting) return; // update all windows that need updating update_prepare(); FOR_ALL_WINDOWS(wp) { if (wp->w_redr_type != 0) win_update(wp); if (wp->w_redr_status) win_redr_status(wp, FALSE); } update_finish(); }
0
mod_auth_mellon
62041428a32de402e0be6ba45fe12df6a83bedb8
NOT_APPLICABLE
NOT_APPLICABLE
bool am_is_paos_request(request_rec *r, int *error_code) { const char *accept_header = NULL; const char *paos_header = NULL; bool have_paos_media_type = false; bool valid_paos_header = false; bool is_paos = false; ECPServiceOptions ecp_service_options = 0; *error_code = 0; accept_header = apr_table_get(r->headers_in, "Accept"); paos_header = apr_table_get(r->headers_in, "PAOS"); if (accept_header) { if (am_header_has_media_type(r, accept_header, MEDIA_TYPE_PAOS)) { have_paos_media_type = true; } } if (paos_header) { if (am_parse_paos_header(r, paos_header, &ecp_service_options)) { valid_paos_header = true; } else { if (*error_code == 0) *error_code = AM_ERROR_INVALID_PAOS_HEADER; } } if (have_paos_media_type) { if (valid_paos_header) { is_paos = true; } else { AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "request supplied PAOS media type in Accept header " "but omitted valid PAOS header"); if (*error_code == 0) *error_code = AM_ERROR_MISSING_PAOS_HEADER; } } else { if (valid_paos_header) { AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, "request supplied valid PAOS header " "but omitted PAOS media type in Accept header"); if (*error_code == 0) *error_code = AM_ERROR_MISSING_PAOS_MEDIA_TYPE; } } AM_LOG_RERROR(APLOG_MARK, APLOG_DEBUG, 0, r, "have_paos_media_type=%s valid_paos_header=%s is_paos=%s " "error_code=%d ecp options=[%s]", have_paos_media_type ? "True" : "False", valid_paos_header ? "True" : "False", is_paos ? "True" : "False", *error_code, am_ecp_service_options_str(r->pool, ecp_service_options)); if (is_paos) { am_req_cfg_rec *req_cfg; req_cfg = am_get_req_cfg(r); req_cfg->ecp_service_options = ecp_service_options; } return is_paos; }
0
server
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
NOT_APPLICABLE
NOT_APPLICABLE
void join_with_sum_func(const Item *item) { m_with_sum_func|= item->with_sum_func(); }
0
libcomps
e3a5d056633677959ad924a51758876d415e7046
NOT_APPLICABLE
NOT_APPLICABLE
void comps_objmrtree_data_destroy(COMPS_ObjMRTreeData * rtd) { free(rtd->key); COMPS_OBJECT_DESTROY(rtd->data); comps_hslist_destroy(&rtd->subnodes); free(rtd); }
0
radare2
04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9
NOT_APPLICABLE
NOT_APPLICABLE
R_API int r_str_arg_unescape(char *arg) { int dest_i = 0, src_i = 0; if (!arg) { return 0; } for (src_i = 0; arg[src_i] != '\0'; src_i++) { char c = arg[src_i]; if (c == '\\') { if (arg[++src_i] == '\0') { break; } arg[dest_i++] = arg[src_i]; } else { arg[dest_i++] = c; } } arg[dest_i] = '\0'; return dest_i; }
0
gpac
bceb03fd2be95097a7b409ea59914f332fb6bc86
NOT_APPLICABLE
NOT_APPLICABLE
GF_Err dac3_dump(GF_Box *a, FILE * trace) { GF_AC3ConfigBox *p = (GF_AC3ConfigBox *)a; if (p->cfg.is_ec3) { u32 i; a->type = GF_ISOM_BOX_TYPE_DEC3; gf_isom_box_dump_start(a, "EC3SpecificBox", trace); a->type = GF_ISOM_BOX_TYPE_DAC3; fprintf(trace, "nb_streams=\"%d\" data_rate=\"%d\">\n", p->cfg.nb_streams, p->cfg.brcode); for (i=0; i<p->cfg.nb_streams; i++) { fprintf(trace, "<EC3StreamConfig fscod=\"%d\" bsid=\"%d\" bsmod=\"%d\" acmod=\"%d\" lfon=\"%d\" num_sub_dep=\"%d\" chan_loc=\"%d\"/>\n", p->cfg.streams[i].fscod, p->cfg.streams[i].bsid, p->cfg.streams[i].bsmod, p->cfg.streams[i].acmod, p->cfg.streams[i].lfon, p->cfg.streams[i].nb_dep_sub, p->cfg.streams[i].chan_loc); } gf_isom_box_dump_done("EC3SpecificBox", a, trace); } else { gf_isom_box_dump_start(a, "AC3SpecificBox", trace); fprintf(trace, "fscod=\"%d\" bsid=\"%d\" bsmod=\"%d\" acmod=\"%d\" lfon=\"%d\" bit_rate_code=\"%d\">\n", p->cfg.streams[0].fscod, p->cfg.streams[0].bsid, p->cfg.streams[0].bsmod, p->cfg.streams[0].acmod, p->cfg.streams[0].lfon, p->cfg.brcode); gf_isom_box_dump_done("AC3SpecificBox", a, trace); } return GF_OK; }
0
httpd
f990e5ecad40b100a8a5c7c1033c46044a9cb244
NOT_APPLICABLE
NOT_APPLICABLE
static apr_status_t setup_input(h2_stream *stream) { if (stream->input == NULL) { int empty = (stream->input_eof && (!stream->in_buffer || APR_BRIGADE_EMPTY(stream->in_buffer))); if (!empty) { h2_beam_create(&stream->input, stream->pool, stream->id, "input", H2_BEAM_OWNER_SEND, 0, stream->session->s->timeout); h2_beam_send_from(stream->input, stream->pool); } } return APR_SUCCESS; }
0
postgres
28e24125541545483093819efae9bca603441951
NOT_APPLICABLE
NOT_APPLICABLE
pq_is_reading_msg(void) { return PqCommReadingMsg; }
0
linux
bf118a342f10dafe44b14451a1392c3254629a1f
NOT_APPLICABLE
NOT_APPLICABLE
encode_layoutcommit(struct xdr_stream *xdr, struct inode *inode, const struct nfs4_layoutcommit_args *args, struct compound_hdr *hdr) { __be32 *p; dprintk("%s: lbw: %llu type: %d\n", __func__, args->lastbytewritten, NFS_SERVER(args->inode)->pnfs_curr_ld->id); p = reserve_space(xdr, 44 + NFS4_STATEID_SIZE); *p++ = cpu_to_be32(OP_LAYOUTCOMMIT); /* Only whole file layouts */ p = xdr_encode_hyper(p, 0); /* offset */ p = xdr_encode_hyper(p, args->lastbytewritten + 1); /* length */ *p++ = cpu_to_be32(0); /* reclaim */ p = xdr_encode_opaque_fixed(p, args->stateid.data, NFS4_STATEID_SIZE); *p++ = cpu_to_be32(1); /* newoffset = TRUE */ p = xdr_encode_hyper(p, args->lastbytewritten); *p++ = cpu_to_be32(0); /* Never send time_modify_changed */ *p++ = cpu_to_be32(NFS_SERVER(args->inode)->pnfs_curr_ld->id);/* type */ if (NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit) NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit( NFS_I(inode)->layout, xdr, args); else { p = reserve_space(xdr, 4); *p = cpu_to_be32(0); /* no layout-type payload */ } hdr->nops++; hdr->replen += decode_layoutcommit_maxsz; return 0; }
0
php-src
d348cfb96f2543565691010ade5e0346338be5a7
NOT_APPLICABLE
NOT_APPLICABLE
static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel) { int s_den; unsigned u_den; switch(format) { case TAG_FMT_SBYTE: return *(signed char *)value; case TAG_FMT_BYTE: return *(uchar *)value; case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel); case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel); case TAG_FMT_URATIONAL: u_den = php_ifd_get32u(4+(char *)value, motorola_intel); if (u_den == 0) { return 0; } else { return php_ifd_get32u(value, motorola_intel) / u_den; } case TAG_FMT_SRATIONAL: s_den = php_ifd_get32s(4+(char *)value, motorola_intel); if (s_den == 0) { return 0; } else { return (size_t)((double)php_ifd_get32s(value, motorola_intel) / s_den); } case TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel); case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel); /* Not sure if this is correct (never seen float used in Exif format) */ case TAG_FMT_SINGLE: #ifdef EXIF_DEBUG php_error_docref(NULL, E_NOTICE, "Found value of type single"); #endif return (size_t) php_ifd_get_float(value); case TAG_FMT_DOUBLE: #ifdef EXIF_DEBUG php_error_docref(NULL, E_NOTICE, "Found value of type double"); #endif return (size_t) php_ifd_get_double(value); } return 0; }
0
Android
97837bb6cbac21ea679843a0037779d3834bed64
NOT_APPLICABLE
NOT_APPLICABLE
bool OMXCodec::drainAnyInputBuffer() { return drainInputBuffer((BufferInfo *)NULL); }
0
pdns
f9c57c98da1b1007a51680629b667d57d9b702b8
NOT_APPLICABLE
NOT_APPLICABLE
void compactAnswerSet(MOADNSParser::answers_t orig, set<DNSRecord>& compacted) { for(MOADNSParser::answers_t::const_iterator i=orig.begin(); i != orig.end(); ++i) if(i->first.d_place==DNSResourceRecord::ANSWER) compacted.insert(i->first); }
0
linux
e11e0455c0d7d3d62276a0c55d9dfbc16779d691
NOT_APPLICABLE
NOT_APPLICABLE
static struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src) { struct sock *sk = NULL, *sk1 = NULL; read_lock(&rfcomm_sk_list.lock); sk_for_each(sk, &rfcomm_sk_list.head) { if (state && sk->sk_state != state) continue; if (rfcomm_pi(sk)->channel == channel) { /* Exact match. */ if (!bacmp(&bt_sk(sk)->src, src)) break; /* Closest match */ if (!bacmp(&bt_sk(sk)->src, BDADDR_ANY)) sk1 = sk; } } read_unlock(&rfcomm_sk_list.lock); return sk ? sk : sk1; }
0
php
4435b9142ff9813845d5c97ab29a5d637bedb257
NOT_APPLICABLE
NOT_APPLICABLE
PHP_FUNCTION(imagerectangle) { zval *IM; long x1, y1, x2, y2, col; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); gdImageRectangle(im, x1, y1, x2, y2, col); RETURN_TRUE; }
0
qemu
37cee01784ff0df13e5209517e1b3594a5e792d1
NOT_APPLICABLE
NOT_APPLICABLE
static void lan9118_reset(DeviceState *d) { lan9118_state *s = LAN9118(d); s->irq_cfg &= (IRQ_TYPE | IRQ_POL); s->int_sts = 0; s->int_en = 0; s->fifo_int = 0x48000000; s->rx_cfg = 0; s->tx_cfg = 0; s->hw_cfg = s->mode_16bit ? 0x00050000 : 0x00050004; s->pmt_ctrl &= 0x45; s->gpio_cfg = 0; s->txp->fifo_used = 0; s->txp->state = TX_IDLE; s->txp->cmd_a = 0xffffffffu; s->txp->cmd_b = 0xffffffffu; s->txp->len = 0; s->txp->fifo_used = 0; s->tx_fifo_size = 4608; s->tx_status_fifo_used = 0; s->rx_status_fifo_size = 704; s->rx_fifo_size = 2640; s->rx_fifo_used = 0; s->rx_status_fifo_size = 176; s->rx_status_fifo_used = 0; s->rxp_offset = 0; s->rxp_size = 0; s->rxp_pad = 0; s->rx_packet_size_tail = s->rx_packet_size_head; s->rx_packet_size[s->rx_packet_size_head] = 0; s->mac_cmd = 0; s->mac_data = 0; s->afc_cfg = 0; s->e2p_cmd = 0; s->e2p_data = 0; s->free_timer_start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / 40; ptimer_transaction_begin(s->timer); ptimer_stop(s->timer); ptimer_set_count(s->timer, 0xffff); ptimer_transaction_commit(s->timer); s->gpt_cfg = 0xffff; s->mac_cr = MAC_CR_PRMS; s->mac_hashh = 0; s->mac_hashl = 0; s->mac_mii_acc = 0; s->mac_mii_data = 0; s->mac_flow = 0; s->read_word_n = 0; s->write_word_n = 0; phy_reset(s); s->eeprom_writable = 0; lan9118_reload_eeprom(s); }
0
poppler
9cf2325fb22f812b31858e519411f57747d39bd8
NOT_APPLICABLE
NOT_APPLICABLE
static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, void *path) { SplashFTFontPath *p = (SplashFTFontPath *)path; SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xc, yc; if (!p->path->getCurPt(&x0, &y0)) { return 0; } xc = (SplashCoord)ctrl->x * p->textScale / 64.0; yc = (SplashCoord)ctrl->y * p->textScale / 64.0; x3 = (SplashCoord)pt->x * p->textScale / 64.0; y3 = (SplashCoord)pt->y * p->textScale / 64.0; x1 = (SplashCoord)(1.0 / 3.0) * (x0 + (SplashCoord)2 * xc); y1 = (SplashCoord)(1.0 / 3.0) * (y0 + (SplashCoord)2 * yc); x2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * xc + x3); y2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * yc + y3); p->path->curveTo(x1, y1, x2, y2, x3, y3); p->needClose = gTrue; return 0; }
0
Chrome
02a4180d7d533fab4df07d355ec029e719e353af
NOT_APPLICABLE
NOT_APPLICABLE
void StopVirtualTimeAndExitRunLoop() { WebView().Scheduler()->SetVirtualTimePolicy( PageScheduler::VirtualTimePolicy::kPause); testing::ExitRunLoop(); }
0
Chrome
c90c6ca59378d7e86d1a2f28fe96bada35df1508
NOT_APPLICABLE
NOT_APPLICABLE
Browser* Browser::CreateForType(Type type, Profile* profile) { Browser* browser = new Browser(type, profile); browser->CreateBrowserWindow(); return browser; }
0
vim
083692d598139228e101b8c521aaef7bcf256e9a
NOT_APPLICABLE
NOT_APPLICABLE
smsg(const char *s, ...) { if (IObuff == NULL) { // Very early in initialisation and already something wrong, just // give the raw message so the user at least gets a hint. return msg((char *)s); } else { va_list arglist; va_start(arglist, s); vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg((char *)IObuff); } }
0
linux
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
NOT_APPLICABLE
NOT_APPLICABLE
static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(__cast6_encrypt), desc, dst, src, nbytes); }
0
ok-file-formats
8d68dad9c9f220058e86dc7f3d05acca6b9aedf5
NOT_APPLICABLE
NOT_APPLICABLE
static void ok_jpg_progressive_finish(ok_jpg_decoder *decoder) { int16_t out_block[64]; for (int i = 0; i < decoder->num_components; i++) { ok_jpg_component *c = decoder->components + i; c->next_block = 0; } for (int data_unit_y = 0; data_unit_y < decoder->data_units_y; data_unit_y++) { for (int data_unit_x = 0; data_unit_x < decoder->data_units_x; data_unit_x++) { for (int i = 0; i < decoder->num_components; i++) { ok_jpg_component *c = decoder->components + i; size_t block_index = c->next_block; int offset_y = 0; for (int y = 0; y < c->V; y++) { int offset_x = 0; for (int x = 0; x < c->H; x++) { int16_t *in_block = c->blocks + (block_index * 64); ok_jpg_dequantize(decoder, c, in_block, out_block); c->idct(out_block, c->output + offset_x + offset_y); block_index++; offset_x += 8; } offset_y += C_WIDTH * 8; block_index += (size_t)(c->H * (decoder->data_units_x - 1)); } c->next_block += c->H; } ok_jpg_convert_data_unit(decoder, data_unit_x, data_unit_y); } for (int i = 0; i < decoder->num_components; i++) { ok_jpg_component *c = decoder->components + i; c->next_block += (size_t)((c->V - 1) * c->H * decoder->data_units_x); } } }
0
linux
8914a595110a6eca69a5e275b323f5d09e18f4f9
NOT_APPLICABLE
NOT_APPLICABLE
static void bnx2x_set_requested_fc(struct bnx2x *bp) { /* Initialize link parameters structure variables * It is recommended to turn off RX FC for jumbo frames * for better performance */ if (CHIP_IS_E1x(bp) && (bp->dev->mtu > 5000)) bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_TX; else bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH; }
0
openssl
a004e72b95835136d3f1ea90517f706c24c03da7
NOT_APPLICABLE
NOT_APPLICABLE
void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl, unsigned char *cookie, unsigned int cookie_len)) { ctx->app_verify_cookie_cb = cb; }
0
sqlite
18f6ff9eb7db02356102283c28053b0a602f55d7
NOT_APPLICABLE
NOT_APPLICABLE
int sqlite3_fts3_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) return sqlite3Fts3Init(db); }
0
linux
cefa91b2332d7009bc0be5d951d6cbbf349f90f8
NOT_APPLICABLE
NOT_APPLICABLE
static void ovs_nla_free_set_action(const struct nlattr *a) { const struct nlattr *ovs_key = nla_data(a); struct ovs_tunnel_info *ovs_tun; switch (nla_type(ovs_key)) { case OVS_KEY_ATTR_TUNNEL_INFO: ovs_tun = nla_data(ovs_key); dst_release((struct dst_entry *)ovs_tun->tun_dst); break; } }
0
linux
b2853fd6c2d0f383dbdf7427e263eb576a633867
NOT_APPLICABLE
NOT_APPLICABLE
int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse) { struct rdma_id_private *id_priv; unsigned long flags; int ret; id_priv = container_of(id, struct rdma_id_private, id); spin_lock_irqsave(&id_priv->lock, flags); if (reuse || id_priv->state == RDMA_CM_IDLE) { id_priv->reuseaddr = reuse; ret = 0; } else { ret = -EINVAL; } spin_unlock_irqrestore(&id_priv->lock, flags); return ret; }
0
libtiff
ae9365db1b271b62b35ce018eac8799b1d5e8a53
NOT_APPLICABLE
NOT_APPLICABLE
invertImage(uint16 photometric, uint16 spp, uint16 bps, uint32 width, uint32 length, unsigned char *work_buff) { uint32 row, col; unsigned char bytebuff1, bytebuff2, bytebuff3, bytebuff4; unsigned char *src; uint16 *src_uint16; uint32 *src_uint32; if (spp != 1) { TIFFError("invertImage", "Image inversion not supported for more than one sample per pixel"); return (-1); } if (photometric != PHOTOMETRIC_MINISWHITE && photometric != PHOTOMETRIC_MINISBLACK) { TIFFError("invertImage", "Only black and white and grayscale images can be inverted"); return (-1); } src = work_buff; if (src == NULL) { TIFFError ("invertImage", "Invalid crop buffer passed to invertImage"); return (-1); } switch (bps) { case 32: src_uint32 = (uint32 *)src; for (row = 0; row < length; row++) for (col = 0; col < width; col++) { *src_uint32 = (uint32)0xFFFFFFFF - *src_uint32; src_uint32++; } break; case 16: src_uint16 = (uint16 *)src; for (row = 0; row < length; row++) for (col = 0; col < width; col++) { *src_uint16 = (uint16)0xFFFF - *src_uint16; src_uint16++; } break; case 8: for (row = 0; row < length; row++) for (col = 0; col < width; col++) { *src = (uint8)255 - *src; src++; } break; case 4: for (row = 0; row < length; row++) for (col = 0; col < width; col++) { bytebuff1 = 16 - (uint8)(*src & 240 >> 4); bytebuff2 = 16 - (*src & 15); *src = bytebuff1 << 4 & bytebuff2; src++; } break; case 2: for (row = 0; row < length; row++) for (col = 0; col < width; col++) { bytebuff1 = 4 - (uint8)(*src & 192 >> 6); bytebuff2 = 4 - (uint8)(*src & 48 >> 4); bytebuff3 = 4 - (uint8)(*src & 12 >> 2); bytebuff4 = 4 - (uint8)(*src & 3); *src = (bytebuff1 << 6) || (bytebuff2 << 4) || (bytebuff3 << 2) || bytebuff4; src++; } break; case 1: for (row = 0; row < length; row++) for (col = 0; col < width; col += 8 /(spp * bps)) { *src = ~(*src); src++; } break; default: TIFFError("invertImage", "Unsupported bit depth %d", bps); return (-1); } return (0); }
0
linux
342db04ae71273322f0011384a9ed414df8bdae4
NOT_APPLICABLE
NOT_APPLICABLE
void show_ip(struct pt_regs *regs, const char *loglvl) { #ifdef CONFIG_X86_32 printk("%sEIP: %pS\n", loglvl, (void *)regs->ip); #else printk("%sRIP: %04x:%pS\n", loglvl, (int)regs->cs, (void *)regs->ip); #endif show_opcodes(regs, loglvl); }
0
xserver
cad5a1050b7184d828aef9c1dd151c3ab649d37e
NOT_APPLICABLE
NOT_APPLICABLE
XineramaXvSetPortAttribute(ClientPtr client) { REQUEST(xvSetPortAttributeReq); PanoramiXRes *port; int result, i; REQUEST_SIZE_MATCH(xvSetPortAttributeReq); result = dixLookupResourceByType((void **) &port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) return result; FOR_NSCREENS_BACKWARD(i) { if (port->info[i].id) { stuff->port = port->info[i].id; result = ProcXvSetPortAttribute(client); } } return result; }
0
libsolv
0077ef29eb46d2e1df2f230fc95a1d9748d49dec
NOT_APPLICABLE
NOT_APPLICABLE
testcase_resultdiff(const char *result1, const char *result2) { Strqueue sq1, sq2, osq; char *r; strqueue_init(&sq1); strqueue_init(&sq2); strqueue_init(&osq); strqueue_split(&sq1, result1); strqueue_split(&sq2, result2); strqueue_sort(&sq1); strqueue_sort(&sq2); strqueue_diff(&sq1, &sq2, &osq); r = osq.nstr ? strqueue_join(&osq) : 0; strqueue_free(&sq1); strqueue_free(&sq2); strqueue_free(&osq); return r; }
0
linux
096fe9eaea40a17e125569f9e657e34cdb6d73bd
NOT_APPLICABLE
NOT_APPLICABLE
static int __init trusted_shash_alloc(void) { int ret; hmacalg = crypto_alloc_shash(hmac_alg, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(hmacalg)) { pr_info("trusted_key: could not allocate crypto %s\n", hmac_alg); return PTR_ERR(hmacalg); } hashalg = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(hashalg)) { pr_info("trusted_key: could not allocate crypto %s\n", hash_alg); ret = PTR_ERR(hashalg); goto hashalg_fail; } return 0; hashalg_fail: crypto_free_shash(hmacalg); return ret; }
0
Chrome
bf6a6765d44b09c64b8c75d749efb84742a250e7
NOT_APPLICABLE
NOT_APPLICABLE
void PDFiumEngine::DeviceToPage(int page_index, float device_x, float device_y, double* page_x, double* page_y) { *page_x = *page_y = 0; int temp_x = static_cast<int>((device_x + position_.x()) / current_zoom_ - pages_[page_index]->rect().x()); int temp_y = static_cast<int>((device_y + position_.y()) / current_zoom_ - pages_[page_index]->rect().y()); FPDF_DeviceToPage( pages_[page_index]->GetPage(), 0, 0, pages_[page_index]->rect().width(), pages_[page_index]->rect().height(), current_rotation_, temp_x, temp_y, page_x, page_y); }
0
Chrome
20b65d00ca3d8696430e22efad7485366f8c3a21
NOT_APPLICABLE
NOT_APPLICABLE
void NormalPageArena::VerifyMarking() { #if DCHECK_IS_ON() SetAllocationPoint(nullptr, 0); for (NormalPage* page = static_cast<NormalPage*>(first_page_); page; page = static_cast<NormalPage*>(page->Next())) page->VerifyMarking(); #endif // DCHECK_IS_ON() }
0
linux
9060cb719e61b685ec0102574e10337fa5f445ea
NOT_APPLICABLE
NOT_APPLICABLE
void af_alg_async_cb(struct crypto_async_request *_req, int err) { struct af_alg_async_req *areq = _req->data; struct sock *sk = areq->sk; struct kiocb *iocb = areq->iocb; unsigned int resultlen; /* Buffer size written by crypto operation. */ resultlen = areq->outlen; af_alg_free_resources(areq); sock_put(sk); iocb->ki_complete(iocb, err ? err : resultlen, 0); }
0
server
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
NOT_APPLICABLE
NOT_APPLICABLE
bool Item_in_optimizer::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); Item_subselect *sub= 0; uint col; /* MAX/MIN optimization can convert the subquery into expr + Item_singlerow_subselect */ if (args[1]->type() == Item::SUBSELECT_ITEM) sub= (Item_subselect *)args[1]; if (fix_left(thd)) return TRUE; if (args[0]->maybe_null) maybe_null=1; if (args[1]->fix_fields_if_needed(thd, args + 1)) return TRUE; if (!invisible_mode() && ((sub && ((col= args[0]->cols()) != sub->engine->cols())) || (!sub && (args[1]->cols() != (col= 1))))) { my_error(ER_OPERAND_COLUMNS, MYF(0), col); return TRUE; } if (args[1]->maybe_null) maybe_null=1; m_with_subquery= true; join_with_sum_func(args[1]); with_window_func= args[0]->with_window_func; // The subquery cannot have window functions aggregated in this select DBUG_ASSERT(!args[1]->with_window_func); with_field= with_field || args[1]->with_field; with_param= args[0]->with_param || args[1]->with_param; used_tables_and_const_cache_join(args[1]); fixed= 1; return FALSE; }
0
linux
ae7b4e1f213aa659aedf9c6ecad0bf5f0476e1e2
NOT_APPLICABLE
NOT_APPLICABLE
static void __net_init fib6_tables_init(struct net *net) { fib6_link_table(net, net->ipv6.fib6_main_tbl); fib6_link_table(net, net->ipv6.fib6_local_tbl); }
0
linux
fac8e0f579695a3ecbc4d3cac369139d7f819971
NOT_APPLICABLE
NOT_APPLICABLE
static void __netdev_adjacent_dev_unlink_neighbour(struct net_device *dev, struct net_device *upper_dev) { __netdev_adjacent_dev_unlink(dev, upper_dev); __netdev_adjacent_dev_unlink_lists(dev, upper_dev, &dev->adj_list.upper, &upper_dev->adj_list.lower); }
0