idx
int64
func
string
target
int64
420,258
destroyIoQ(void) { io_req_t *n; if (io_q.stats != NULL) { statsobj.Destruct(&io_q.stats); } pthread_mutex_lock(&io_q.mut); while (!STAILQ_EMPTY(&io_q.q)) { n = STAILQ_FIRST(&io_q.q); STAILQ_REMOVE_HEAD(&io_q.q, link); errmsg.LogError(0, RS_RET_INTERNAL_ERROR, "imptcp: discarded enqueued io-work to allow shutdown - ignored"); free(n); } io_q.sz = 0; pthread_mutex_unlock(&io_q.mut); pthread_cond_destroy(&io_q.wakeup_worker); pthread_mutex_destroy(&io_q.mut); }
0
205,126
bool ExtensionApiTest::RunExtensionTestWithArg( const std::string& extension_name, const char* custom_arg) { return RunExtensionTestImpl(extension_name, std::string(), custom_arg, kFlagEnableFileAccess); }
0
70,160
bool Unpack::UnpackLargeBlock(UnpackThreadData &D) { if (!D.TableRead) { D.TableRead=true; if (!ReadTables(D.Inp,D.BlockHeader,D.BlockTables)) { D.DamagedData=true; return false; } } if (D.Inp.InAddr>D.BlockHeader.HeaderSize+D.BlockHeader.BlockSize) { D.DamagedData=true; return false; } int BlockBorder=D.BlockHeader.BlockStart+D.BlockHeader.BlockSize-1; // Reserve enough space even for filter entry. int DataBorder=D.DataSize-16; int ReadBorder=Min(BlockBorder,DataBorder); while (true) { UnpPtr&=MaxWinMask; if (D.Inp.InAddr>=ReadBorder) { if (D.Inp.InAddr>BlockBorder || D.Inp.InAddr==BlockBorder && D.Inp.InBit>=D.BlockHeader.BlockBitSize) break; // If we do not have any more data in file to read, we must process // what we have until last byte. Otherwise we can return and append // more data to unprocessed few bytes. if ((D.Inp.InAddr>=DataBorder) && !D.NoDataLeft || D.Inp.InAddr>=D.DataSize) { D.Incomplete=true; break; } } if (((WriteBorder-UnpPtr) & MaxWinMask)<MAX_INC_LZ_MATCH && WriteBorder!=UnpPtr) { UnpWriteBuf(); if (WrittenFileSize>DestUnpSize) return false; } uint MainSlot=DecodeNumber(D.Inp,&D.BlockTables.LD); if (MainSlot<256) { Window[UnpPtr++]=(byte)MainSlot; continue; } if (MainSlot>=262) { uint Length=SlotToLength(D.Inp,MainSlot-262); uint DBits,Distance=1,DistSlot=DecodeNumber(D.Inp,&D.BlockTables.DD); if (DistSlot<4) { DBits=0; Distance+=DistSlot; } else { DBits=DistSlot/2 - 1; Distance+=(2 | (DistSlot & 1)) << DBits; } if (DBits>0) { if (DBits>=4) { if (DBits>4) { Distance+=((D.Inp.getbits32()>>(36-DBits))<<4); D.Inp.addbits(DBits-4); } uint LowDist=DecodeNumber(D.Inp,&D.BlockTables.LDD); Distance+=LowDist; } else { Distance+=D.Inp.getbits32()>>(32-DBits); D.Inp.addbits(DBits); } } if (Distance>0x100) { Length++; if (Distance>0x2000) { Length++; if (Distance>0x40000) Length++; } } InsertOldDist(Distance); LastLength=Length; CopyString(Length,Distance); continue; } if (MainSlot==256) { UnpackFilter Filter; if (!ReadFilter(D.Inp,Filter) || !AddFilter(Filter)) break; continue; } if (MainSlot==257) { if (LastLength!=0) CopyString(LastLength,OldDist[0]); continue; } if (MainSlot<262) { uint DistNum=MainSlot-258; uint Distance=OldDist[DistNum]; for (uint I=DistNum;I>0;I--) OldDist[I]=OldDist[I-1]; OldDist[0]=Distance; uint LengthSlot=DecodeNumber(D.Inp,&D.BlockTables.RD); uint Length=SlotToLength(D.Inp,LengthSlot); LastLength=Length; CopyString(Length,Distance); continue; } } return true; }
0
267,465
ALWAYS_INLINE void MulAdd(const Packet a, const bfloat16** binp, float** out) { auto inp = reinterpret_cast<const float*>(*binp); const auto b = LOAD(inp); EXPAND_BFLOAT_L(b, b_0); EXPAND_BFLOAT_U(b, b_1); *binp += 2 * kNumOperands; auto c1 = LOAD(*out); auto c2 = LOAD(*out + kNumOperands); FMA(a, b_0, c1, c1); FMA(a, b_1, c2, c2); STORE(*out, c1); STORE(*out + kNumOperands, c2); *out += 2 * kNumOperands; }
0
324,659
int64_t bdrv_get_block_status_above(BlockDriverState *bs, BlockDriverState *base, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { Coroutine *co; BdrvCoGetBlockStatusData data = { .bs = bs, .base = base, .file = file, .sector_num = sector_num, .nb_sectors = nb_sectors, .pnum = pnum, .done = false, }; if (qemu_in_coroutine()) { /* Fast-path if already in coroutine context */ bdrv_get_block_status_above_co_entry(&data); } else { AioContext *aio_context = bdrv_get_aio_context(bs); co = qemu_coroutine_create(bdrv_get_block_status_above_co_entry, &data); qemu_coroutine_enter(co); while (!data.done) { aio_poll(aio_context, true); } } return data.ret; }
0
477,723
} //! Load a list from a PAR/REC (Philips) file \newinstance.
0
283,326
void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { if (!powered && discovery_session_.get()) { StopDiscoverySession(std::move(discovery_session_)); } if (chooser_.get()) { chooser_->SetAdapterPresence( powered ? BluetoothChooser::AdapterPresence::POWERED_ON : BluetoothChooser::AdapterPresence::POWERED_OFF); if (powered) { OnBluetoothChooserEvent(BluetoothChooser::Event::RESCAN, "" /* device_address */); } } if (!powered) { discovery_session_timer_.Stop(); } }
0
198,569
scoped_refptr<DataPipeConsumerDispatcher> DataPipeConsumerDispatcher::Create( NodeController* node_controller, const ports::PortRef& control_port, base::UnsafeSharedMemoryRegion shared_ring_buffer, const MojoCreateDataPipeOptions& options, uint64_t pipe_id) { scoped_refptr<DataPipeConsumerDispatcher> consumer = new DataPipeConsumerDispatcher(node_controller, control_port, std::move(shared_ring_buffer), options, pipe_id); base::AutoLock lock(consumer->lock_); if (!consumer->InitializeNoLock()) return nullptr; return consumer; }
0
232,912
const cc::TransformNode& GetTransformNode(const cc::Layer* layer) { return *GetPropertyTrees().transform_tree.Node( layer->transform_tree_index()); }
0
271,268
MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count, const size_t quantum) { MemoryInfo *memory_info; size_t length; length=count*quantum; if ((count == 0) || (quantum != (length/count))) { errno=ENOMEM; return((MemoryInfo *) NULL); } memory_info=(MemoryInfo *) MagickAssumeAligned(AcquireAlignedMemory(1, sizeof(*memory_info))); if (memory_info == (MemoryInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(memory_info,0,sizeof(*memory_info)); memory_info->length=length; memory_info->signature=MagickSignature; if (AcquireMagickResource(MemoryResource,length) != MagickFalse) { memory_info->blob=AcquireAlignedMemory(1,length); if (memory_info->blob != NULL) memory_info->type=AlignedVirtualMemory; else RelinquishMagickResource(MemoryResource,length); } if ((memory_info->blob == NULL) && (AcquireMagickResource(MapResource,length) != MagickFalse)) { /* Heap memory failed, try anonymous memory mapping. */ memory_info->blob=MapBlob(-1,IOMode,0,length); if (memory_info->blob != NULL) memory_info->type=MapVirtualMemory; else RelinquishMagickResource(MapResource,length); } if ((memory_info->blob == NULL) && (AcquireMagickResource(DiskResource,length) != MagickFalse)) { int file; /* Anonymous memory mapping failed, try file-backed memory mapping. */ file=AcquireUniqueFileResource(memory_info->filename); if (file == -1) RelinquishMagickResource(DiskResource,length); else { if ((lseek(file,length-1,SEEK_SET) < 0) || (write(file,"",1) != 1)) RelinquishMagickResource(DiskResource,length); else { if (AcquireMagickResource(MapResource,length) == MagickFalse) RelinquishMagickResource(DiskResource,length); else { memory_info->blob=MapBlob(file,IOMode,0,length); if (memory_info->blob != NULL) memory_info->type=MapVirtualMemory; else { RelinquishMagickResource(MapResource,length); RelinquishMagickResource(DiskResource,length); } } } (void) close(file); } } if (memory_info->blob == NULL) { memory_info->blob=AcquireMagickMemory(length); if (memory_info->blob != NULL) memory_info->type=UnalignedVirtualMemory; } if (memory_info->blob == NULL) memory_info=RelinquishVirtualMemory(memory_info); return(memory_info); }
0
47,752
void Database::setLocalMuted(const QString &hash, bool muted) { QSqlQuery query; if (muted) query.prepare(QLatin1String("INSERT INTO `muted` (`hash`) VALUES (?)")); else query.prepare(QLatin1String("DELETE FROM `muted` WHERE `hash` = ?")); query.addBindValue(hash); query.exec(); }
0
82,618
void Magick::Image::strokeColor(const Magick::Color &strokeColor_) { std::string value; modifyImage(); options()->strokeColor(strokeColor_); value=strokeColor_; artifact("stroke",value); }
0
419,773
static int get_source_for_fd(RemoteServer *s, int fd, char *name, RemoteSource **source) { Writer *writer; int r; /* This takes ownership of name, but only on success. */ assert(fd >= 0); assert(source); if (!GREEDY_REALLOC0(s->sources, s->sources_size, fd + 1)) return log_oom(); r = journal_remote_get_writer(s, name, &writer); if (r < 0) return log_warning_errno(r, "Failed to get writer for source %s: %m", name); if (s->sources[fd] == NULL) { s->sources[fd] = source_new(fd, false, name, writer); if (!s->sources[fd]) { writer_unref(writer); return log_oom(); } s->active++; } *source = s->sources[fd]; return 0; }
0
394,610
isofile_free(struct isofile *file) { struct content *con, *tmp; con = file->content.next; while (con != NULL) { tmp = con; con = con->next; free(tmp); } archive_entry_free(file->entry); archive_string_free(&(file->parentdir)); archive_string_free(&(file->basename)); archive_string_free(&(file->basename_utf16)); archive_string_free(&(file->symlink)); free(file); }
0
360,108
nautilus_file_compare_for_sort_internal (NautilusFile *file_1, NautilusFile *file_2, gboolean directories_first, gboolean reversed) { gboolean is_directory_1, is_directory_2; if (directories_first) { is_directory_1 = nautilus_file_is_directory (file_1); is_directory_2 = nautilus_file_is_directory (file_2); if (is_directory_1 && !is_directory_2) { return -1; } if (is_directory_2 && !is_directory_1) { return +1; } } if (file_1->details->sort_order < file_2->details->sort_order) { return reversed ? 1 : -1; } else if (file_1->details->sort_order > file_2->details->sort_order) { return reversed ? -1 : 1; } return 0; }
0
180,740
void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) { if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { select_all_on_gesture_tap_ = true; saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); } views::Textfield::OnGestureEvent(event); if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) { SelectAllForUserGesture(); if (location_bar_view_) location_bar_view_->omnibox_page_action_icon_container_view() ->UpdatePageActionIcon(PageActionIconType::kSendTabToSelf); } if (event->type() == ui::ET_GESTURE_TAP || event->type() == ui::ET_GESTURE_TAP_CANCEL || event->type() == ui::ET_GESTURE_TWO_FINGER_TAP || event->type() == ui::ET_GESTURE_SCROLL_BEGIN || event->type() == ui::ET_GESTURE_PINCH_BEGIN || event->type() == ui::ET_GESTURE_LONG_PRESS || event->type() == ui::ET_GESTURE_LONG_TAP) { select_all_on_gesture_tap_ = false; } }
0
437,436
static struct io_kiocb *io_get_fallback_req(struct io_ring_ctx *ctx) { struct io_kiocb *req; req = ctx->fallback_req; if (!test_and_set_bit_lock(0, (unsigned long *) ctx->fallback_req)) return req; return NULL; }
0
143,438
static int bond_ioctl(struct net *net, unsigned int cmd, struct compat_ifreq __user *ifr32) { struct ifreq kifr; mm_segment_t old_fs; int err; switch (cmd) { case SIOCBONDENSLAVE: case SIOCBONDRELEASE: case SIOCBONDSETHWADDR: case SIOCBONDCHANGEACTIVE: if (copy_from_user(&kifr, ifr32, sizeof(struct compat_ifreq))) return -EFAULT; old_fs = get_fs(); set_fs(KERNEL_DS); err = dev_ioctl(net, cmd, (struct ifreq __user __force *) &kifr); set_fs(old_fs); return err; default: return -ENOIOCTLCMD; } }
0
143,436
MagickExport ssize_t WriteBlobMSBLongLong(Image *image, const MagickSizeType value) { unsigned char buffer[8]; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); buffer[0]=(unsigned char) (value >> 56); buffer[1]=(unsigned char) (value >> 48); buffer[2]=(unsigned char) (value >> 40); buffer[3]=(unsigned char) (value >> 32); buffer[4]=(unsigned char) (value >> 24); buffer[5]=(unsigned char) (value >> 16); buffer[6]=(unsigned char) (value >> 8); buffer[7]=(unsigned char) value; return(WriteBlobStream(image,8,buffer)); }
0
81,542
QPDF::CopiedStreamDataProvider::provideStreamData( int objid, int generation, Pipeline* pipeline) { QPDFObjectHandle foreign_stream = this->foreign_streams[QPDFObjGen(objid, generation)]; foreign_stream.pipeStreamData(pipeline, false, false, false); }
0
41,785
trans_characters( char_u *buf, int bufsize) { int len; // length of string needing translation int room; // room in buffer after string char_u *trs; // translated character int trs_len; // length of trs[] len = (int)STRLEN(buf); room = bufsize - len; while (*buf != 0) { // Assume a multi-byte character doesn't need translation. if (has_mbyte && (trs_len = (*mb_ptr2len)(buf)) > 1) len -= trs_len; else { trs = transchar_byte(*buf); trs_len = (int)STRLEN(trs); if (trs_len > 1) { room -= trs_len - 1; if (room <= 0) return; mch_memmove(buf + trs_len, buf + 1, (size_t)len); } mch_memmove(buf, trs, (size_t)trs_len); --len; } buf += trs_len; } }
0
451,282
int DynamicMetadataMapWrapper::luaPairs(lua_State* state) { if (iterator_.get() != nullptr) { luaL_error(state, "cannot create a second iterator before completing the first"); } iterator_.reset(DynamicMetadataMapIterator::create(state, *this), true); lua_pushcclosure(state, DynamicMetadataMapIterator::static_luaPairsIterator, 1); return 1; }
0
212,755
static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object) { notImplemented(); }
0
475,100
void vrend_renderer_get_meminfo(struct vrend_context *ctx, uint32_t res_handle) { struct vrend_resource *res; struct virgl_memory_info *info; res = vrend_renderer_ctx_res_lookup(ctx, res_handle); if (!res) { vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, res_handle); return; } info = (struct virgl_memory_info *)res->iov->iov_base; if (has_feature(feat_nvx_gpu_memory_info)) { GLint i; glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &i); info->total_device_memory = i; glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &i); info->total_staging_memory = i - info->total_device_memory; glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &i); info->nr_device_memory_evictions = i; glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &i); info->device_memory_evicted = i; } if (has_feature(feat_ati_meminfo)) { GLint i[4]; glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, i); info->avail_device_memory = i[0]; info->avail_staging_memory = i[2]; } }
0
370,169
int sctp_outq_uncork(struct sctp_outq *q) { int error = 0; if (q->cork) q->cork = 0; error = sctp_outq_flush(q, 0); return error; }
0
228,270
static int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) { r->p = p; r->q = q; return 1; }
0
244,418
IV_API_CALL_STATUS_T ihevcd_cxa_api_function(iv_obj_t *ps_handle, void *pv_api_ip, void *pv_api_op) { WORD32 command; UWORD32 *pu4_ptr_cmd; WORD32 ret = 0; IV_API_CALL_STATUS_T e_status; e_status = api_check_struct_sanity(ps_handle, pv_api_ip, pv_api_op); if(e_status != IV_SUCCESS) { DEBUG("error code = %d\n", *((UWORD32 *)pv_api_op + 1)); return IV_FAIL; } pu4_ptr_cmd = (UWORD32 *)pv_api_ip; pu4_ptr_cmd++; command = *pu4_ptr_cmd; switch(command) { case IVD_CMD_CREATE: ret = ihevcd_create(ps_handle, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_DELETE: ret = ihevcd_delete(ps_handle, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_VIDEO_DECODE: ret = ihevcd_decode(ps_handle, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_GET_DISPLAY_FRAME: break; case IVD_CMD_SET_DISPLAY_FRAME: ret = ihevcd_set_display_frame(ps_handle, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_REL_DISPLAY_FRAME: ret = ihevcd_rel_display_frame(ps_handle, (void *)pv_api_ip, (void *)pv_api_op); break; case IVD_CMD_VIDEO_CTL: ret = ihevcd_ctl(ps_handle, (void *)pv_api_ip, (void *)pv_api_op); break; default: ret = IV_FAIL; break; } return (IV_API_CALL_STATUS_T)ret; }
0
438,635
execlists_context_status_change(struct i915_request *rq, unsigned long status) { /* * Only used when GVT-g is enabled now. When GVT-g is disabled, * The compiler should eliminate this function as dead-code. */ if (!IS_ENABLED(CONFIG_DRM_I915_GVT)) return; atomic_notifier_call_chain(&rq->engine->context_status_notifier, status, rq); }
0
514,701
int llhttp__internal__c_update_type_1( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { state->type = 2; return 0; }
0
353,530
BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) { int i, j; BIO *out = NULL, *btmp = NULL, *etmp = NULL, *bio = NULL; X509_ALGOR *xa; ASN1_OCTET_STRING *data_body = NULL; const EVP_MD *evp_md; const EVP_CIPHER *evp_cipher = NULL; EVP_CIPHER_CTX *evp_ctx = NULL; X509_ALGOR *enc_alg = NULL; STACK_OF(X509_ALGOR) *md_sk = NULL; STACK_OF(PKCS7_RECIP_INFO) *rsk = NULL; PKCS7_RECIP_INFO *ri = NULL; unsigned char *ek = NULL, *tkey = NULL; int eklen = 0, tkeylen = 0; i = OBJ_obj2nid(p7->type); p7->state = PKCS7_S_HEADER; switch (i) { case NID_pkcs7_signed: data_body = PKCS7_get_octet_string(p7->d.sign->contents); if (!PKCS7_is_detached(p7) && data_body == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_SIGNED_DATA_TYPE); goto err; } md_sk = p7->d.sign->md_algs; break; case NID_pkcs7_signedAndEnveloped: rsk = p7->d.signed_and_enveloped->recipientinfo; md_sk = p7->d.signed_and_enveloped->md_algs; data_body = p7->d.signed_and_enveloped->enc_data->enc_data; enc_alg = p7->d.signed_and_enveloped->enc_data->algorithm; evp_cipher = EVP_get_cipherbyobj(enc_alg->algorithm); if (evp_cipher == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNSUPPORTED_CIPHER_TYPE); goto err; } break; case NID_pkcs7_enveloped: rsk = p7->d.enveloped->recipientinfo; enc_alg = p7->d.enveloped->enc_data->algorithm; data_body = p7->d.enveloped->enc_data->enc_data; evp_cipher = EVP_get_cipherbyobj(enc_alg->algorithm); if (evp_cipher == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNSUPPORTED_CIPHER_TYPE); goto err; } break; default: PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } /* We will be checking the signature */ if (md_sk != NULL) { for (i = 0; i < sk_X509_ALGOR_num(md_sk); i++) { xa = sk_X509_ALGOR_value(md_sk, i); if ((btmp = BIO_new(BIO_f_md())) == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, ERR_R_BIO_LIB); goto err; } j = OBJ_obj2nid(xa->algorithm); evp_md = EVP_get_digestbynid(j); if (evp_md == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNKNOWN_DIGEST_TYPE); goto err; } BIO_set_md(btmp, evp_md); if (out == NULL) out = btmp; else BIO_push(out, btmp); btmp = NULL; } } if (evp_cipher != NULL) { #if 0 unsigned char key[EVP_MAX_KEY_LENGTH]; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char *p; int keylen, ivlen; int max; X509_OBJECT ret; #endif if ((etmp = BIO_new(BIO_f_cipher())) == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, ERR_R_BIO_LIB); goto err; } /* * It was encrypted, we need to decrypt the secret key with the * private key */ /* * Find the recipientInfo which matches the passed certificate (if * any) */ if (pcert) { for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { ri = sk_PKCS7_RECIP_INFO_value(rsk, i); if (!pkcs7_cmp_ri(ri, pcert)) break; ri = NULL; } if (ri == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); goto err; } } /* If we haven't got a certificate try each ri in turn */ if (pcert == NULL) { /* * Always attempt to decrypt all rinfo even after sucess as a * defence against MMA timing attacks. */ for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { ri = sk_PKCS7_RECIP_INFO_value(rsk, i); if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey) < 0) goto err; ERR_clear_error(); } } else { /* Only exit on fatal errors, not decrypt failure */ if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey) < 0) goto err; ERR_clear_error(); } evp_ctx = NULL; BIO_get_cipher_ctx(etmp, &evp_ctx); if (EVP_CipherInit_ex(evp_ctx, evp_cipher, NULL, NULL, NULL, 0) <= 0) goto err; if (EVP_CIPHER_asn1_to_param(evp_ctx, enc_alg->parameter) < 0) goto err; /* Generate random key as MMA defence */ tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); tkey = OPENSSL_malloc(tkeylen); if (!tkey) goto err; if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) goto err; if (ek == NULL) { ek = tkey; eklen = tkeylen; tkey = NULL; } if (eklen != EVP_CIPHER_CTX_key_length(evp_ctx)) { /* * Some S/MIME clients don't use the same key and effective key * length. The key length is determined by the size of the * decrypted RSA key. */ if (!EVP_CIPHER_CTX_set_key_length(evp_ctx, eklen)) { /* Use random key as MMA defence */ OPENSSL_cleanse(ek, eklen); OPENSSL_free(ek); ek = tkey; eklen = tkeylen; tkey = NULL; } } /* Clear errors so we don't leak information useful in MMA */ ERR_clear_error(); if (EVP_CipherInit_ex(evp_ctx, NULL, NULL, ek, NULL, 0) <= 0) goto err; if (ek) { OPENSSL_cleanse(ek, eklen); OPENSSL_free(ek); ek = NULL; } if (tkey) { OPENSSL_cleanse(tkey, tkeylen); OPENSSL_free(tkey); tkey = NULL; } if (out == NULL) out = etmp; else BIO_push(out, etmp); etmp = NULL; } #if 1 if (PKCS7_is_detached(p7) || (in_bio != NULL)) { bio = in_bio; } else { # if 0 bio = BIO_new(BIO_s_mem()); /* * We need to set this so that when we have read all the data, the * encrypt BIO, if present, will read EOF and encode the last few * bytes */ BIO_set_mem_eof_return(bio, 0); if (data_body->length > 0) BIO_write(bio, (char *)data_body->data, data_body->length); # else if (data_body->length > 0) bio = BIO_new_mem_buf(data_body->data, data_body->length); else { bio = BIO_new(BIO_s_mem()); BIO_set_mem_eof_return(bio, 0); } if (bio == NULL) goto err; # endif } BIO_push(out, bio); bio = NULL; #endif if (0) { err: if (ek) { OPENSSL_cleanse(ek, eklen); OPENSSL_free(ek); } if (tkey) { OPENSSL_cleanse(tkey, tkeylen); OPENSSL_free(tkey); } if (out != NULL) BIO_free_all(out); if (btmp != NULL) BIO_free_all(btmp); if (etmp != NULL) BIO_free_all(etmp); if (bio != NULL) BIO_free_all(bio); out = NULL; } return (out); }
1
35,584
static int vhost_update_used_flags(struct vhost_virtqueue *vq) { void __user *used; if (__put_user(cpu_to_vhost16(vq, vq->used_flags), &vq->used->flags) < 0) return -EFAULT; if (unlikely(vq->log_used)) { /* Make sure the flag is seen before log. */ smp_wmb(); /* Log used flag write. */ used = &vq->used->flags; log_write(vq->log_base, vq->log_addr + (used - (void __user *)vq->used), sizeof vq->used->flags); if (vq->log_ctx) eventfd_signal(vq->log_ctx, 1); } return 0; }
0
327,497
static void gic_set_irq(void *opaque, int irq, int level) { /* Meaning of the 'irq' parameter: * [0..N-1] : external interrupts * [N..N+31] : PPI (internal) interrupts for CPU 0 * [N+32..N+63] : PPI (internal interrupts for CPU 1 * ... */ GICState *s = (GICState *)opaque; int cm, target; if (irq < (s->num_irq - GIC_INTERNAL)) { /* The first external input line is internal interrupt 32. */ cm = ALL_CPU_MASK; irq += GIC_INTERNAL; target = GIC_TARGET(irq); } else { int cpu; irq -= (s->num_irq - GIC_INTERNAL); cpu = irq / GIC_INTERNAL; irq %= GIC_INTERNAL; cm = 1 << cpu; target = cm; } assert(irq >= GIC_NR_SGIS); if (level == GIC_TEST_LEVEL(irq, cm)) { return; } if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) { gic_set_irq_11mpcore(s, irq, level, cm, target); } else { gic_set_irq_generic(s, irq, level, cm, target); } gic_update(s); }
1
283,926
int Width() const { return size_.width; }
0
75,230
ngx_http_auth_spnego_init( ngx_conf_t * cf) { ngx_http_handler_pt *h; ngx_http_core_main_conf_t *cmcf; cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers); if (NULL == h) { return NGX_ERROR; } *h = ngx_http_auth_spnego_handler; return NGX_OK; }
0
217,296
PPAPIFileChooserTestWithSBService() : safe_browsing_service_factory_(&safe_browsing_test_configuration_) {}
0
239,134
void ExtensionPrefs::MakePathsRelative() { const DictionaryValue* dict = prefs_->GetDictionary(kExtensionsPref); if (!dict || dict->empty()) return; std::set<std::string> absolute_keys; for (DictionaryValue::key_iterator i = dict->begin_keys(); i != dict->end_keys(); ++i) { DictionaryValue* extension_dict = NULL; if (!dict->GetDictionaryWithoutPathExpansion(*i, &extension_dict)) continue; int location_value; if (extension_dict->GetInteger(kPrefLocation, &location_value) && location_value == Extension::LOAD) { continue; } FilePath::StringType path_string; if (!extension_dict->GetString(kPrefPath, &path_string)) continue; FilePath path(path_string); if (path.IsAbsolute()) absolute_keys.insert(*i); } if (absolute_keys.empty()) return; DictionaryPrefUpdate update(prefs_, kExtensionsPref); const DictionaryValue* update_dict = update.Get(); for (std::set<std::string>::iterator i = absolute_keys.begin(); i != absolute_keys.end(); ++i) { DictionaryValue* extension_dict = NULL; update_dict->GetDictionaryWithoutPathExpansion(*i, &extension_dict); FilePath::StringType path_string; extension_dict->GetString(kPrefPath, &path_string); FilePath path(path_string); extension_dict->SetString(kPrefPath, MakePathRelative(install_directory_, path)); } SavePrefs(); }
0
481,897
static void clear_atexit(void) { EUID_ROOT(); delete_run_files(getpid()); }
0
515,154
static double invflip_angle(double angle, int rankdir) { switch (rankdir) { case RANKDIR_TB: break; case RANKDIR_BT: angle *= -1; break; case RANKDIR_LR: angle -= M_PI * 0.5; break; case RANKDIR_RL: if (angle == M_PI) angle = -0.5 * M_PI; else if (angle == M_PI * 0.75) angle = -0.25 * M_PI; else if (angle == M_PI * 0.5) angle = 0; /* clang complains about self assignment of double else if (angle == M_PI * 0.25) angle = angle; */ else if (angle == 0) angle = M_PI * 0.5; else if (angle == M_PI * -0.25) angle = M_PI * 0.75; else if (angle == M_PI * -0.5) angle = M_PI; /* clang complains about self assignment of double else if (angle == M_PI * -0.75) angle = angle; */ break; } return angle; }
0
26,724
static VALUE mFixnum_to_json ( int argc , VALUE * argv , VALUE self ) { GENERATE_JSON ( fixnum ) ; }
0
102,764
explicit CopyOp(OpKernelConstruction* ctx) : CopyOpBase(ctx) {}
0
317,717
void GDataFileSystem::RenameAfterGetEntryInfo( const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, GDataFileError error, scoped_ptr<GDataEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error, file_path); return; } DCHECK(entry_proto.get()); FilePath::StringType file_name = new_name; if (entry_proto->has_file_specific_info() && entry_proto->file_specific_info().is_hosted_document()) { FilePath new_file(file_name); if (new_file.Extension() == entry_proto->file_specific_info().document_extension()) { file_name = new_file.RemoveExtension().value(); } } documents_service_->RenameResource( GURL(entry_proto->edit_url()), file_name, base::Bind(&GDataFileSystem::RenameFileOnFileSystem, ui_weak_ptr_, file_path, file_name, callback)); }
0
104,317
static bool atl2_write_eeprom(struct atl2_hw *hw, u32 offset, u32 value) { return true; }
0
191,775
void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame) { EAS_PCM *pAudioBuffer; EAS_I32 k; EAS_I32 b1; EAS_I32 b2; EAS_I32 z1; EAS_I32 z2; EAS_I32 acc0; EAS_I32 acc1; EAS_I32 numSamples; /* initialize some local variables */ numSamples = pWTIntFrame->numSamples; if (numSamples <= 0) { ALOGE("b/26366256"); android_errorWriteLog(0x534e4554, "26366256"); return; } pAudioBuffer = pWTIntFrame->pAudioBuffer; z1 = pFilter->z1; z2 = pFilter->z2; b1 = -pWTIntFrame->frame.b1; /*lint -e{702} <avoid divide> */ b2 = -pWTIntFrame->frame.b2 >> 1; /*lint -e{702} <avoid divide> */ k = pWTIntFrame->frame.k >> 1; while (numSamples--) { /* do filter calculations */ acc0 = *pAudioBuffer; acc1 = z1 * b1; acc1 += z2 * b2; acc0 = acc1 + k * acc0; z2 = z1; /*lint -e{702} <avoid divide> */ z1 = acc0 >> 14; *pAudioBuffer++ = (EAS_I16) z1; } /* save delay values */ pFilter->z1 = (EAS_I16) z1; pFilter->z2 = (EAS_I16) z2; }
0
68,224
int nntp_open_connection(struct NntpAccountData *adata) { struct Connection *conn = adata->conn; char buf[256]; int cap; bool posting = false, auth = true; if (adata->status == NNTP_OK) return 0; if (adata->status == NNTP_BYE) return -1; adata->status = NNTP_NONE; if (mutt_socket_open(conn) < 0) return -1; if (mutt_socket_readln(buf, sizeof(buf), conn) < 0) return nntp_connect_error(adata); if (mutt_str_startswith(buf, "200", CASE_MATCH)) posting = true; else if (!mutt_str_startswith(buf, "201", CASE_MATCH)) { mutt_socket_close(conn); mutt_str_remove_trailing_ws(buf); mutt_error("%s", buf); return -1; } /* get initial capabilities */ cap = nntp_capabilities(adata); if (cap < 0) return -1; /* tell news server to switch to mode reader if it isn't so */ if (cap > 0) { if ((mutt_socket_send(conn, "MODE READER\r\n") < 0) || (mutt_socket_readln(buf, sizeof(buf), conn) < 0)) { return nntp_connect_error(adata); } if (mutt_str_startswith(buf, "200", CASE_MATCH)) posting = true; else if (mutt_str_startswith(buf, "201", CASE_MATCH)) posting = false; /* error if has capabilities, ignore result if no capabilities */ else if (adata->hasCAPABILITIES) { mutt_socket_close(conn); mutt_error(_("Could not switch to reader mode")); return -1; } /* recheck capabilities after MODE READER */ if (adata->hasCAPABILITIES) { cap = nntp_capabilities(adata); if (cap < 0) return -1; } } mutt_message(_("Connected to %s. %s"), conn->account.host, posting ? _("Posting is ok") : _("Posting is NOT ok")); mutt_sleep(1); #ifdef USE_SSL /* Attempt STARTTLS if available and desired. */ if ((adata->use_tls != 1) && (adata->hasSTARTTLS || C_SslForceTls)) { if (adata->use_tls == 0) { adata->use_tls = C_SslForceTls || query_quadoption(C_SslStarttls, _("Secure connection with TLS?")) == MUTT_YES ? 2 : 1; } if (adata->use_tls == 2) { if ((mutt_socket_send(conn, "STARTTLS\r\n") < 0) || (mutt_socket_readln(buf, sizeof(buf), conn) < 0)) { return nntp_connect_error(adata); } // Clear any data after the STARTTLS acknowledgement mutt_socket_empty(conn); if (!mutt_str_startswith(buf, "382", CASE_MATCH)) { adata->use_tls = 0; mutt_error("STARTTLS: %s", buf); } else if (mutt_ssl_starttls(conn)) { adata->use_tls = 0; adata->status = NNTP_NONE; mutt_socket_close(adata->conn); mutt_error(_("Could not negotiate TLS connection")); return -1; } else { /* recheck capabilities after STARTTLS */ cap = nntp_capabilities(adata); if (cap < 0) return -1; } } } #endif /* authentication required? */ if (conn->account.flags & MUTT_ACCT_USER) { if (!conn->account.user[0]) auth = false; } else { if ((mutt_socket_send(conn, "STAT\r\n") < 0) || (mutt_socket_readln(buf, sizeof(buf), conn) < 0)) { return nntp_connect_error(adata); } if (!mutt_str_startswith(buf, "480", CASE_MATCH)) auth = false; } /* authenticate */ if (auth && (nntp_auth(adata) < 0)) return -1; /* get final capabilities after authentication */ if (adata->hasCAPABILITIES && (auth || (cap > 0))) { cap = nntp_capabilities(adata); if (cap < 0) return -1; if (cap > 0) { mutt_socket_close(conn); mutt_error(_("Could not switch to reader mode")); return -1; } } /* attempt features */ if (nntp_attempt_features(adata) < 0) return -1; adata->status = NNTP_OK; return 0; }
0
302,832
static void circ_read(circ_buf_t *cb, pj_uint8_t *dst, pj_size_t len) { pj_size_t size_after = cb->cap - cb->readp; pj_size_t tbc = PJ_MIN(size_after, len); pj_size_t rem = len - tbc; pj_memcpy(dst, cb->buf + cb->readp, tbc); pj_memcpy(dst + tbc, cb->buf, rem); cb->readp += len; cb->readp &= (cb->cap - 1); cb->size -= len; }
0
335,249
struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env, target_ulong pc) { struct kvm_sw_breakpoint *bp; TAILQ_FOREACH(bp, &env->kvm_state->kvm_sw_breakpoints, entry) { if (bp->pc == pc) return bp; } return NULL; }
0
70,786
latin_char2cells(int c UNUSED) { return 1; }
0
422,285
e_ews_connection_get_uri (EEwsConnection *cnc) { g_return_val_if_fail (E_IS_EWS_CONNECTION (cnc), NULL); return cnc->priv->uri; }
0
69,330
TEST(AsyncSSLSocketTest, SSLHandshakeValidationFailure) { EventBase eventBase; auto clientCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>(); NetworkSocket fds[2]; getfds(fds); getctx(clientCtx, dfServerCtx); clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::VERIFY); dfServerCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::VERIFY); AsyncSSLSocket::UniquePtr clientSock( new AsyncSSLSocket(clientCtx, &eventBase, fds[0], false)); AsyncSSLSocket::UniquePtr serverSock( new AsyncSSLSocket(dfServerCtx, &eventBase, fds[1], true)); SSLHandshakeClient client(std::move(clientSock), true, false); clientCtx->loadTrustedCertificates(kTestCA); SSLHandshakeServer server(std::move(serverSock), true, true); eventBase.loop(); EXPECT_TRUE(client.handshakeVerify_); EXPECT_TRUE(!client.handshakeSuccess_); EXPECT_TRUE(client.handshakeError_); EXPECT_LE(0, client.handshakeTime.count()); EXPECT_TRUE(!server.handshakeVerify_); EXPECT_TRUE(!server.handshakeSuccess_); EXPECT_TRUE(server.handshakeError_); EXPECT_LE(0, server.handshakeTime.count()); }
0
211,777
v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod(const char* functionName, int argc, v8::Local<v8::Value> argv[]) { v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScript->Get(toV8StringInternalized(m_isolate, functionName))); DCHECK(m_isolate->InContext()); return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv); }
0
333,233
static av_noinline void emulated_edge_mc_mmxext(uint8_t *buf, const uint8_t *src, ptrdiff_t buf_stride, ptrdiff_t src_stride, int block_w, int block_h, int src_x, int src_y, int w, int h) { emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h, src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx, hfixtbl_mmxext, &ff_emu_edge_hvar_mmxext); }
0
411,880
static ogg_uint32_t bitreverse(ogg_uint32_t x){ x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000); x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00); x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0); x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc); return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa); }
0
67,661
TEST_F(HttpConnectionManagerImplTest, TestSrdsCrossScopeReroute) { setup(false, "", true, true); std::shared_ptr<Router::MockConfig> route_config1 = std::make_shared<NiceMock<Router::MockConfig>>(); std::shared_ptr<Router::MockConfig> route_config2 = std::make_shared<NiceMock<Router::MockConfig>>(); std::shared_ptr<Router::MockRoute> route1 = std::make_shared<NiceMock<Router::MockRoute>>(); std::shared_ptr<Router::MockRoute> route2 = std::make_shared<NiceMock<Router::MockRoute>>(); EXPECT_CALL(*route_config1, route(_, _)).WillRepeatedly(Return(route1)); EXPECT_CALL(*route_config2, route(_, _)).WillRepeatedly(Return(route2)); EXPECT_CALL(*static_cast<const Router::MockScopedConfig*>( scopedRouteConfigProvider()->config<Router::ScopedConfig>().get()), getRouteConfig(_)) // 1. Snap scoped route config; // 2. refreshCachedRoute (both in decodeHeaders(headers,end_stream); // 3. then refreshCachedRoute triggered by decoder_filters_[1]->callbacks_->route(). .Times(3) .WillRepeatedly(Invoke([&](const HeaderMap& headers) -> Router::ConfigConstSharedPtr { auto& test_headers = static_cast<const TestHeaderMapImpl&>(headers); if (test_headers.get_("scope_key") == "foo") { return route_config1; } return route_config2; })); EXPECT_CALL(*codec_, dispatch(_)).WillOnce(Invoke([&](Buffer::Instance& data) -> void { StreamDecoder* decoder = &conn_manager_->newStream(response_encoder_); HeaderMapPtr headers{new TestHeaderMapImpl{ {":authority", "host"}, {":method", "GET"}, {"scope_key", "foo"}, {":path", "/foo"}}}; decoder->decodeHeaders(std::move(headers), false); data.drain(4); })); setupFilterChain(2, 0); EXPECT_CALL(*decoder_filters_[0], decodeHeaders(_, false)) .WillOnce(Invoke([&](Http::HeaderMap& headers, bool) -> FilterHeadersStatus { EXPECT_EQ(route1, decoder_filters_[0]->callbacks_->route()); auto& test_headers = static_cast<TestHeaderMapImpl&>(headers); // Clear cached route and change scope key to "bar". decoder_filters_[0]->callbacks_->clearRouteCache(); test_headers.remove("scope_key"); test_headers.addCopy("scope_key", "bar"); return FilterHeadersStatus::Continue; })); EXPECT_CALL(*decoder_filters_[1], decodeHeaders(_, false)) .WillOnce(Invoke([&](Http::HeaderMap& headers, bool) -> FilterHeadersStatus { auto& test_headers = static_cast<TestHeaderMapImpl&>(headers); EXPECT_EQ(test_headers.get_("scope_key"), "bar"); // Route now switched to route2 as header "scope_key" has changed. EXPECT_EQ(route2, decoder_filters_[1]->callbacks_->route()); EXPECT_EQ(route2->routeEntry(), decoder_filters_[1]->callbacks_->streamInfo().routeEntry()); return FilterHeadersStatus::StopIteration; })); Buffer::OwnedImpl fake_input("1234"); conn_manager_->onData(fake_input, false); }
0
307,979
fep_client_set_status_text (FepClient *client, const char *text, FepAttribute *attr) { FepControlMessage message; message.command = FEP_CONTROL_SET_STATUS_TEXT; _fep_control_message_alloc_args (&message, 2); _fep_control_message_write_string_arg (&message, 0, text, strlen (text) + 1); _fep_control_message_write_attribute_arg (&message, 1, attr ? attr : &empty_attr); if (client->filter_running) client->messages = _fep_append_control_message (client->messages, &message); else _fep_write_control_message (client->control, &message); _fep_control_message_free_args (&message); }
0
499,210
static void intra_prediction_unit_default_value(HEVCContext *s, int x0, int y0, int log2_cb_size) { HEVCLocalContext *lc = &s->HEVClc; int pb_size = 1 << log2_cb_size; int size_in_pus = pb_size >> s->sps->log2_min_pu_size; int min_pu_width = s->sps->min_pu_width; MvField *tab_mvf = s->ref->tab_mvf; int x_pu = x0 >> s->sps->log2_min_pu_size; int y_pu = y0 >> s->sps->log2_min_pu_size; int j, k; if (size_in_pus == 0) size_in_pus = 1; for (j = 0; j < size_in_pus; j++) { memset(&s->tab_ipm[(y_pu + j) * min_pu_width + x_pu], INTRA_DC, size_in_pus); for (k = 0; k < size_in_pus; k++) tab_mvf[(y_pu + j) * min_pu_width + x_pu + k].is_intra = lc->cu.pred_mode == MODE_INTRA; } }
0
172,020
extern "C" int EffectCreate(const effect_uuid_t *uuid, int32_t sessionId __unused, int32_t ioId __unused, effect_handle_t *pHandle){ int ret; int i; int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *); const effect_descriptor_t *desc; ALOGV("\t\nEffectCreate start"); if (pHandle == NULL || uuid == NULL){ ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer"); return -EINVAL; } for (i = 0; i < length; i++) { desc = gDescriptors[i]; if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t)) == 0) { ALOGV("\tEffectCreate - UUID matched Reverb type %d, UUID = %x", i, desc->uuid.timeLow); break; } } if (i == length) { return -ENOENT; } ReverbContext *pContext = new ReverbContext; pContext->itfe = &gReverbInterface; pContext->hInstance = NULL; pContext->auxiliary = false; if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY){ pContext->auxiliary = true; ALOGV("\tEffectCreate - AUX"); }else{ ALOGV("\tEffectCreate - INS"); } pContext->preset = false; if (memcmp(&desc->type, SL_IID_PRESETREVERB, sizeof(effect_uuid_t)) == 0) { pContext->preset = true; pContext->curPreset = REVERB_PRESET_LAST + 1; pContext->nextPreset = REVERB_DEFAULT_PRESET; ALOGV("\tEffectCreate - PRESET"); }else{ ALOGV("\tEffectCreate - ENVIRONMENTAL"); } ALOGV("\tEffectCreate - Calling Reverb_init"); ret = Reverb_init(pContext); if (ret < 0){ ALOGV("\tLVM_ERROR : EffectCreate() init failed"); delete pContext; return ret; } *pHandle = (effect_handle_t)pContext; #ifdef LVM_PCM pContext->PcmInPtr = NULL; pContext->PcmOutPtr = NULL; pContext->PcmInPtr = fopen("/data/tmp/reverb_pcm_in.pcm", "w"); pContext->PcmOutPtr = fopen("/data/tmp/reverb_pcm_out.pcm", "w"); if((pContext->PcmInPtr == NULL)|| (pContext->PcmOutPtr == NULL)){ return -EINVAL; } #endif pContext->InFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2); pContext->OutFrames32 = (LVM_INT32 *)malloc(LVREV_MAX_FRAME_SIZE * sizeof(LVM_INT32) * 2); ALOGV("\tEffectCreate %p, size %d", pContext, sizeof(ReverbContext)); ALOGV("\tEffectCreate end\n"); return 0; } /* end EffectCreate */
0
135,290
CIFSSMBQFSDeviceInfo(const int xid, struct cifs_tcon *tcon) { /* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */ TRANSACTION2_QFSI_REQ *pSMB = NULL; TRANSACTION2_QFSI_RSP *pSMBr = NULL; FILE_SYSTEM_DEVICE_INFO *response_data; int rc = 0; int bytes_returned = 0; __u16 params, byte_count; cFYI(1, "In QFSDeviceInfo"); QFSDeviceRetry: rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, (void **) &pSMBr); if (rc) return rc; params = 2; /* level */ pSMB->TotalDataCount = 0; pSMB->MaxParameterCount = cpu_to_le16(2); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxDataCount = cpu_to_le16(1000); pSMB->MaxSetupCount = 0; pSMB->Reserved = 0; pSMB->Flags = 0; pSMB->Timeout = 0; pSMB->Reserved2 = 0; byte_count = params + 1 /* pad */ ; pSMB->TotalParameterCount = cpu_to_le16(params); pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterOffset = cpu_to_le16(offsetof( struct smb_com_transaction2_qfsi_req, InformationLevel) - 4); pSMB->DataCount = 0; pSMB->DataOffset = 0; pSMB->SetupCount = 1; pSMB->Reserved3 = 0; pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO); inc_rfc1001_len(pSMB, byte_count); pSMB->ByteCount = cpu_to_le16(byte_count); rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, (struct smb_hdr *) pSMBr, &bytes_returned, 0); if (rc) { cFYI(1, "Send error in QFSDeviceInfo = %d", rc); } else { /* decode response */ rc = validate_t2((struct smb_t2_rsp *)pSMBr); if (rc || get_bcc(&pSMBr->hdr) < sizeof(FILE_SYSTEM_DEVICE_INFO)) rc = -EIO; /* bad smb */ else { __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); response_data = (FILE_SYSTEM_DEVICE_INFO *) (((char *) &pSMBr->hdr.Protocol) + data_offset); memcpy(&tcon->fsDevInfo, response_data, sizeof(FILE_SYSTEM_DEVICE_INFO)); } } cifs_buf_release(pSMB); if (rc == -EAGAIN) goto QFSDeviceRetry; return rc; }
0
128,850
TIFFGrowStrips(TIFF* tif, uint32 delta, const char* module) { TIFFDirectory *td = &tif->tif_dir; uint64* new_stripoffset; uint64* new_stripbytecount; assert(td->td_planarconfig == PLANARCONFIG_CONTIG); new_stripoffset = (uint64*)_TIFFrealloc(td->td_stripoffset, (td->td_nstrips + delta) * sizeof (uint64)); new_stripbytecount = (uint64*)_TIFFrealloc(td->td_stripbytecount, (td->td_nstrips + delta) * sizeof (uint64)); if (new_stripoffset == NULL || new_stripbytecount == NULL) { if (new_stripoffset) _TIFFfree(new_stripoffset); if (new_stripbytecount) _TIFFfree(new_stripbytecount); td->td_nstrips = 0; TIFFErrorExt(tif->tif_clientdata, module, "No space to expand strip arrays"); return (0); } td->td_stripoffset = new_stripoffset; td->td_stripbytecount = new_stripbytecount; _TIFFmemset(td->td_stripoffset + td->td_nstrips, 0, delta*sizeof (uint64)); _TIFFmemset(td->td_stripbytecount + td->td_nstrips, 0, delta*sizeof (uint64)); td->td_nstrips += delta; tif->tif_flags |= TIFF_DIRTYDIRECT; return (1); }
0
519,417
int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
0
83,942
static OPJ_BOOL opj_j2k_write_mco(opj_j2k_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) { OPJ_BYTE * l_current_data = 00; OPJ_UINT32 l_mco_size; opj_tcp_t * l_tcp = 00; opj_simple_mcc_decorrelation_data_t * l_mcc_record; OPJ_UINT32 i; /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); l_tcp = &(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]); l_mco_size = 5 + l_tcp->m_nb_mcc_records; if (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) { OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc( p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size); if (! new_header_tile_data) { opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data); p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL; p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0; opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to write MCO marker\n"); return OPJ_FALSE; } p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data; p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mco_size; } l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data; opj_write_bytes(l_current_data, J2K_MS_MCO, 2); /* MCO */ l_current_data += 2; opj_write_bytes(l_current_data, l_mco_size - 2, 2); /* Lmco */ l_current_data += 2; opj_write_bytes(l_current_data, l_tcp->m_nb_mcc_records, 1); /* Nmco : only one transform stage*/ ++l_current_data; l_mcc_record = l_tcp->m_mcc_records; for (i = 0; i < l_tcp->m_nb_mcc_records; ++i) { opj_write_bytes(l_current_data, l_mcc_record->m_index, 1); /* Imco -> use the mcc indicated by 1*/ ++l_current_data; ++l_mcc_record; } if (opj_stream_write_data(p_stream, p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mco_size, p_manager) != l_mco_size) { return OPJ_FALSE; } return OPJ_TRUE; }
0
304,123
static void fmt_bytecount(AVIOContext *pb, int64_t count) { static const char suffix[] = " kMGTP"; const char *s; for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++); avio_printf(pb, "%"PRId64"%c", count, *s); }
0
43,164
TEST_F(SecretManagerImplTest, SdsDynamicSecretUpdateSuccess) { Server::MockInstance server; SecretManagerPtr secret_manager(new SecretManagerImpl(config_tracker_)); NiceMock<Server::Configuration::MockTransportSocketFactoryContext> secret_context; envoy::config::core::v3::ConfigSource config_source; NiceMock<LocalInfo::MockLocalInfo> local_info; NiceMock<Random::MockRandomGenerator> random; Stats::IsolatedStoreImpl stats; NiceMock<Init::MockManager> init_manager; NiceMock<Init::ExpectableWatcherImpl> init_watcher; Init::TargetHandlePtr init_target_handle; EXPECT_CALL(init_manager, add(_)) .WillOnce(Invoke([&init_target_handle](const Init::Target& target) { init_target_handle = target.createHandle("test"); })); EXPECT_CALL(secret_context, stats()).WillOnce(ReturnRef(stats)); EXPECT_CALL(secret_context, initManager()).WillRepeatedly(ReturnRef(init_manager)); EXPECT_CALL(secret_context, mainThreadDispatcher()).WillRepeatedly(ReturnRef(*dispatcher_)); EXPECT_CALL(secret_context, localInfo()).WillOnce(ReturnRef(local_info)); EXPECT_CALL(secret_context, api()).WillRepeatedly(ReturnRef(*api_)); auto secret_provider = secret_manager->findOrCreateTlsCertificateProvider(config_source, "abc.com", secret_context); const std::string yaml = R"EOF( name: "abc.com" tls_certificate: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/selfsigned_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/selfsigned_key.pem" )EOF"; envoy::extensions::transport_sockets::tls::v3::Secret typed_secret; TestUtility::loadFromYaml(TestEnvironment::substitute(yaml), typed_secret); const auto decoded_resources = TestUtility::decodeResources({typed_secret}); init_target_handle->initialize(init_watcher); secret_context.cluster_manager_.subscription_factory_.callbacks_->onConfigUpdate( decoded_resources.refvec_, ""); testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext> ctx; Ssl::TlsCertificateConfigImpl tls_config(*secret_provider->secret(), ctx, *api_); const std::string cert_pem = "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/selfsigned_cert.pem"; EXPECT_EQ(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(cert_pem)), tls_config.certificateChain()); const std::string key_pem = "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/selfsigned_key.pem"; EXPECT_EQ(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute(key_pem)), tls_config.privateKey()); }
0
262,659
void send_fragments(unsigned char *packet, int packet_len, unsigned char *iv, unsigned char *keystream, int fragsize, int ska) { int t, u; int data_size; unsigned char frag[32+fragsize]; int pack_size; int header_size=24; data_size = packet_len-header_size; packet[23] = (rand() % 0xFF); for (t=0; t+=fragsize;) { //Copy header memcpy(frag, packet, header_size); //Copy IV + KeyIndex memcpy(frag+header_size, iv, 4); //Copy data if(fragsize <= packet_len-(header_size+t-fragsize)) memcpy(frag+header_size+4, packet+header_size+t-fragsize, fragsize); else memcpy(frag+header_size+4, packet+header_size+t-fragsize, packet_len-(header_size+t-fragsize)); //Make ToDS frame if(!ska) { frag[1] |= 1; frag[1] &= 253; } //Set fragment bit if (t< data_size) frag[1] |= 4; if (t>=data_size) frag[1] &= 251; //Fragment number frag[22] = 0; for (u=t; u-=fragsize;) { frag[22] += 1; } // frag[23] = 0; //Calculate packet length if(fragsize <= packet_len-(header_size+t-fragsize)) pack_size = header_size + 4 + fragsize; else pack_size = header_size + 4 + (packet_len-(header_size+t-fragsize)); //Add ICV add_icv(frag, pack_size, header_size + 4); pack_size += 4; //Encrypt xor_keystream(frag + header_size + 4, keystream, fragsize+4); //Send send_packet(frag, pack_size); if (t<data_size)usleep(100); if (t>=data_size) break; } }
0
254,771
static UChar32 T_UConverter_getNextUChar_UTF32_LE ( UConverterToUnicodeArgs * args , UErrorCode * err ) { const uint8_t * mySource ; UChar32 myUChar ; int32_t length ; mySource = ( const uint8_t * ) args -> source ; if ( mySource >= ( const uint8_t * ) args -> sourceLimit ) { * err = U_INDEX_OUTOFBOUNDS_ERROR ; return 0xffff ; } length = ( int32_t ) ( ( const uint8_t * ) args -> sourceLimit - mySource ) ; if ( length < 4 ) { uprv_memcpy ( args -> converter -> toUBytes , mySource , length ) ; args -> converter -> toULength = ( int8_t ) length ; args -> source = ( const char * ) ( mySource + length ) ; * err = U_TRUNCATED_CHAR_FOUND ; return 0xffff ; } myUChar = ( ( UChar32 ) mySource [ 3 ] << 24 ) | ( ( UChar32 ) mySource [ 2 ] << 16 ) | ( ( UChar32 ) mySource [ 1 ] << 8 ) | ( ( UChar32 ) mySource [ 0 ] ) ; args -> source = ( const char * ) ( mySource + 4 ) ; if ( ( uint32_t ) myUChar <= MAXIMUM_UTF && ! U_IS_SURROGATE ( myUChar ) ) { return myUChar ; } uprv_memcpy ( args -> converter -> toUBytes , mySource , 4 ) ; args -> converter -> toULength = 4 ; * err = U_ILLEGAL_CHAR_FOUND ; return 0xffff ; }
1
202,580
base::string16 AuthenticatorClientPinTapAgainSheetModel::GetStepDescription() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_PIN_TAP_AGAIN_DESCRIPTION); }
0
473,973
create_work_q(void) { struct Slapi_work_q *work_q = (struct Slapi_work_q *)PR_StackPop(work_q_stack); if (!work_q) { work_q = (struct Slapi_work_q *)slapi_ch_malloc(sizeof(struct Slapi_work_q)); } else { PR_AtomicDecrement(&work_q_stack_size); } return work_q; }
0
192,976
void RenderWidgetHostViewAura::DidReceiveFrameFromRenderer() { if (frame_subscriber() && CanCopyToVideoFrame()) { const base::TimeTicks present_time = base::TimeTicks::Now(); scoped_refptr<media::VideoFrame> frame; RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; if (frame_subscriber()->ShouldCaptureFrame(present_time, &frame, &callback)) { CopyFromCompositingSurfaceToVideoFrame( gfx::Rect(current_frame_size_), frame, base::Bind(callback, present_time)); } } }
0
387,649
xz_skip(xz_statep state, uint64_t len) { unsigned n; /* skip over len bytes or reach end-of-file, whichever comes first */ while (len) /* skip over whatever is in output buffer */ if (state->have) { n = (uint64_t) state->have > len ? (unsigned) len : state->have; state->have -= n; state->next += n; state->pos += n; len -= n; } /* output buffer empty -- return if we're at the end of the input */ else if (state->eof && state->strm.avail_in == 0) break; /* need more data to skip -- load up output buffer */ else { /* get more output, looking for header if required */ if (xz_make(state) == -1) return -1; } return 0; }
0
382,400
pg_stat_get_wal_senders(PG_FUNCTION_ARGS) { #define PG_STAT_GET_WAL_SENDERS_COLS 8 ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; TupleDesc tupdesc; Tuplestorestate *tupstore; MemoryContext per_query_ctx; MemoryContext oldcontext; WalSnd *sync_standby; int i; /* check to see if caller supports us returning a tuplestore */ if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-valued function called in context that cannot accept a set"))); if (!(rsinfo->allowedModes & SFRM_Materialize)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("materialize mode required, but it is not " \ "allowed in this context"))); /* Build a tuple descriptor for our result type */ if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE) elog(ERROR, "return type must be a row type"); per_query_ctx = rsinfo->econtext->ecxt_per_query_memory; oldcontext = MemoryContextSwitchTo(per_query_ctx); tupstore = tuplestore_begin_heap(true, false, work_mem); rsinfo->returnMode = SFRM_Materialize; rsinfo->setResult = tupstore; rsinfo->setDesc = tupdesc; MemoryContextSwitchTo(oldcontext); /* * Get the currently active synchronous standby. */ LWLockAcquire(SyncRepLock, LW_SHARED); sync_standby = SyncRepGetSynchronousStandby(); LWLockRelease(SyncRepLock); for (i = 0; i < max_wal_senders; i++) { /* use volatile pointer to prevent code rearrangement */ volatile WalSnd *walsnd = &WalSndCtl->walsnds[i]; XLogRecPtr sentPtr; XLogRecPtr write; XLogRecPtr flush; XLogRecPtr apply; int priority; WalSndState state; Datum values[PG_STAT_GET_WAL_SENDERS_COLS]; bool nulls[PG_STAT_GET_WAL_SENDERS_COLS]; if (walsnd->pid == 0) continue; SpinLockAcquire(&walsnd->mutex); sentPtr = walsnd->sentPtr; state = walsnd->state; write = walsnd->write; flush = walsnd->flush; apply = walsnd->apply; priority = walsnd->sync_standby_priority; SpinLockRelease(&walsnd->mutex); memset(nulls, 0, sizeof(nulls)); values[0] = Int32GetDatum(walsnd->pid); if (!superuser()) { /* * Only superusers can see details. Other users only get the pid * value to know it's a walsender, but no details. */ MemSet(&nulls[1], true, PG_STAT_GET_WAL_SENDERS_COLS - 1); } else { values[1] = CStringGetTextDatum(WalSndGetStateString(state)); values[2] = LSNGetDatum(sentPtr); if (write == 0) nulls[3] = true; values[3] = LSNGetDatum(write); if (flush == 0) nulls[4] = true; values[4] = LSNGetDatum(flush); if (apply == 0) nulls[5] = true; values[5] = LSNGetDatum(apply); /* * Treat a standby such as a pg_basebackup background process * which always returns an invalid flush location, as an * asynchronous standby. */ priority = XLogRecPtrIsInvalid(walsnd->flush) ? 0 : priority; values[6] = Int32GetDatum(priority); /* * More easily understood version of standby state. This is purely * informational, not different from priority. */ if (priority == 0) values[7] = CStringGetTextDatum("async"); else if (walsnd == sync_standby) values[7] = CStringGetTextDatum("sync"); else values[7] = CStringGetTextDatum("potential"); } tuplestore_putvalues(tupstore, tupdesc, values, nulls); } /* clean up and return the tuplestore */ tuplestore_donestoring(tupstore); return (Datum) 0; }
0
181,886
void AuthenticatorSheetModelBase::OnAccept() { NOTREACHED(); }
0
251,654
static WebHistoryCommitType LoadTypeToCommitType(WebFrameLoadType type) { switch (type) { case WebFrameLoadType::kStandard: return kWebStandardCommit; case WebFrameLoadType::kBackForward: return kWebBackForwardCommit; case WebFrameLoadType::kReload: case WebFrameLoadType::kReplaceCurrentItem: case WebFrameLoadType::kReloadBypassingCache: return kWebHistoryInertCommit; } NOTREACHED(); return kWebHistoryInertCommit; }
0
203,153
void WebRuntimeFeatures::EnableOrientationEvent(bool enable) { RuntimeEnabledFeatures::SetOrientationEventEnabled(enable); }
0
22,787
static HashTable * spl_dllist_object_get_debug_info ( zval * obj , int * is_temp TSRMLS_DC ) { spl_dllist_object * intern = ( spl_dllist_object * ) zend_object_store_get_object ( obj TSRMLS_CC ) ; spl_ptr_llist_element * current = intern -> llist -> head , * next ; zval * tmp , zrv , * dllist_array ; char * pnstr ; int pnlen ; int i = 0 ; * is_temp = 0 ; if ( intern -> debug_info == NULL ) { ALLOC_HASHTABLE ( intern -> debug_info ) ; zend_hash_init ( intern -> debug_info , 1 , NULL , ZVAL_PTR_DTOR , 0 ) ; } if ( intern -> debug_info -> nApplyCount == 0 ) { INIT_PZVAL ( & zrv ) ; Z_ARRVAL ( zrv ) = intern -> debug_info ; if ( ! intern -> std . properties ) { rebuild_object_properties ( & intern -> std ) ; } zend_hash_copy ( intern -> debug_info , intern -> std . properties , ( copy_ctor_func_t ) zval_add_ref , ( void * ) & tmp , sizeof ( zval * ) ) ; pnstr = spl_gen_private_prop_name ( spl_ce_SplDoublyLinkedList , "flags" , sizeof ( "flags" ) - 1 , & pnlen TSRMLS_CC ) ; add_assoc_long_ex ( & zrv , pnstr , pnlen + 1 , intern -> flags ) ; efree ( pnstr ) ; ALLOC_INIT_ZVAL ( dllist_array ) ; array_init ( dllist_array ) ; while ( current ) { next = current -> next ; add_index_zval ( dllist_array , i , ( zval * ) current -> data ) ; Z_ADDREF_P ( current -> data ) ; i ++ ; current = next ; } pnstr = spl_gen_private_prop_name ( spl_ce_SplDoublyLinkedList , "dllist" , sizeof ( "dllist" ) - 1 , & pnlen TSRMLS_CC ) ; add_assoc_zval_ex ( & zrv , pnstr , pnlen + 1 , dllist_array ) ; efree ( pnstr ) ; } return intern -> debug_info ; }
0
108,010
struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) { struct dentry *p; if (p1 == p2) { inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); return NULL; } mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex); p = d_ancestor(p2, p1); if (p) { inode_lock_nested(p2->d_inode, I_MUTEX_PARENT); inode_lock_nested(p1->d_inode, I_MUTEX_CHILD); return p; } p = d_ancestor(p1, p2); if (p) { inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); inode_lock_nested(p2->d_inode, I_MUTEX_CHILD); return p; } inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); inode_lock_nested(p2->d_inode, I_MUTEX_PARENT2); return NULL; }
0
241,526
Element* Document::elementFromPoint(int x, int y) const { if (!renderer()) return 0; return TreeScope::elementFromPoint(x, y); }
0
241,616
static void get_keyword(struct token *t) { int i; for (i = 0; keywords[i].val; i++) { if (!strcmp(t->val, keywords[i].val)) { t->type = keywords[i].type; break; } } }
0
225,057
void VideoRendererBase::Flush(const base::Closure& callback) { base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, kPaused); flush_cb_ = callback; state_ = kFlushingDecoder; base::AutoUnlock auto_unlock(lock_); decoder_->Reset(base::Bind(&VideoRendererBase::OnDecoderFlushDone, this)); }
0
122,259
void Magick::Image::clutChannel(const ChannelType channel_, const Image &clutImage_,const PixelInterpolateMethod method) { modifyImage(); GetPPException; GetAndSetPPChannelMask(channel_); ClutImage(image(),clutImage_.constImage(),method,exceptionInfo); RestorePPChannelMask; ThrowImageException; }
0
517,160
bool check_vcol_func_processor(void *arg) { return FALSE;}
0
70,329
QPDFObjectHandle::getStreamData(qpdf_stream_decode_level_e level) { assertStream(); return dynamic_cast<QPDF_Stream*>( m->obj.getPointer())->getStreamData(level); }
0
182,607
IPC::Message* CreatePpapiClearSiteDataMsg(uint64 max_age) { base::FilePath profile_path = PepperFlashFileMessageFilter::GetDataDirName(browser_context_path_); #if defined(OS_WIN) base::FilePath plugin_data_path = profile_path.Append(base::FilePath(base::UTF8ToUTF16(plugin_name_))); #else base::FilePath plugin_data_path = profile_path.Append(base::FilePath(plugin_name_)); #endif // defined(OS_WIN) return new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(), kClearAllData, max_age); }
0
17,081
TEST_F ( ShortcutsBackendTest , DeleteShortcuts ) { InitBackend ( ) ; ShortcutsDatabase : : Shortcut shortcut1 ( "BD85DBA2-8C29-49F9-84AE-48E1E90880DF" , base : : ASCIIToUTF16 ( "goog" ) , MatchCoreForTesting ( "http://www.google.com" ) , base : : Time : : Now ( ) , 100 ) ; EXPECT_TRUE ( AddShortcut ( shortcut1 ) ) ; ShortcutsDatabase : : Shortcut shortcut2 ( "BD85DBA2-8C29-49F9-84AE-48E1E90880E0" , base : : ASCIIToUTF16 ( "gle" ) , MatchCoreForTesting ( "http://www.google.com" ) , base : : Time : : Now ( ) , 100 ) ; EXPECT_TRUE ( AddShortcut ( shortcut2 ) ) ; ShortcutsDatabase : : Shortcut shortcut3 ( "BD85DBA2-8C29-49F9-84AE-48E1E90880E1" , base : : ASCIIToUTF16 ( "sp" ) , MatchCoreForTesting ( "http://www.sport.com" ) , base : : Time : : Now ( ) , 10 ) ; EXPECT_TRUE ( AddShortcut ( shortcut3 ) ) ; ShortcutsDatabase : : Shortcut shortcut4 ( "BD85DBA2-8C29-49F9-84AE-48E1E90880E2" , base : : ASCIIToUTF16 ( "mov" ) , MatchCoreForTesting ( "http://www.film.com" ) , base : : Time : : Now ( ) , 10 ) ; EXPECT_TRUE ( AddShortcut ( shortcut4 ) ) ; ASSERT_EQ ( 4U , shortcuts_map ( ) . size ( ) ) ; EXPECT_EQ ( shortcut1 . id , shortcuts_map ( ) . find ( shortcut1 . text ) -> second . id ) ; EXPECT_EQ ( shortcut2 . id , shortcuts_map ( ) . find ( shortcut2 . text ) -> second . id ) ; EXPECT_EQ ( shortcut3 . id , shortcuts_map ( ) . find ( shortcut3 . text ) -> second . id ) ; EXPECT_EQ ( shortcut4 . id , shortcuts_map ( ) . find ( shortcut4 . text ) -> second . id ) ; EXPECT_TRUE ( DeleteShortcutsWithURL ( shortcut1 . match_core . destination_url ) ) ; ASSERT_EQ ( 2U , shortcuts_map ( ) . size ( ) ) ; EXPECT_EQ ( 0U , shortcuts_map ( ) . count ( shortcut1 . text ) ) ; EXPECT_EQ ( 0U , shortcuts_map ( ) . count ( shortcut2 . text ) ) ; const ShortcutsBackend : : ShortcutMap : : const_iterator shortcut3_iter ( shortcuts_map ( ) . find ( shortcut3 . text ) ) ; ASSERT_TRUE ( shortcut3_iter != shortcuts_map ( ) . end ( ) ) ; EXPECT_EQ ( shortcut3 . id , shortcut3_iter -> second . id ) ; const ShortcutsBackend : : ShortcutMap : : const_iterator shortcut4_iter ( shortcuts_map ( ) . find ( shortcut4 . text ) ) ; ASSERT_TRUE ( shortcut4_iter != shortcuts_map ( ) . end ( ) ) ; EXPECT_EQ ( shortcut4 . id , shortcut4_iter -> second . id ) ; ShortcutsDatabase : : ShortcutIDs deleted_ids ; deleted_ids . push_back ( shortcut3 . id ) ; deleted_ids . push_back ( shortcut4 . id ) ; EXPECT_TRUE ( DeleteShortcutsWithIDs ( deleted_ids ) ) ; ASSERT_EQ ( 0U , shortcuts_map ( ) . size ( ) ) ; }
0
210,368
void ewk_frame_load_provisional(Evas_Object* ewkFrame) { evas_object_smart_callback_call(ewkFrame, "load,provisional", 0); }
0
400,179
dirserv_set_node_flags_from_authoritative_status(node_t *node, uint32_t authstatus) { node->is_valid = (authstatus & FP_INVALID) ? 0 : 1; node->is_bad_exit = (authstatus & FP_BADEXIT) ? 1 : 0; }
0
62,405
static int disas_cp_insn(CPUState *env, DisasContext *s, uint32_t insn) { TCGv tmp, tmp2; uint32_t rd = (insn >> 12) & 0xf; uint32_t cp = (insn >> 8) & 0xf; if (IS_USER(s)) { return 1; } if (insn & ARM_CP_RW_BIT) { if (!env->cp[cp].cp_read) return 1; gen_set_pc_im(s->pc); tmp = new_tmp(); tmp2 = tcg_const_i32(insn); gen_helper_get_cp(tmp, cpu_env, tmp2); tcg_temp_free(tmp2); store_reg(s, rd, tmp); } else { if (!env->cp[cp].cp_write) return 1; gen_set_pc_im(s->pc); tmp = load_reg(s, rd); tmp2 = tcg_const_i32(insn); gen_helper_set_cp(cpu_env, tmp2, tmp); tcg_temp_free(tmp2); dead_tmp(tmp); } return 0; }
1
117,246
static inline void control_tx_modulation_enable(struct cx23885_dev *dev, bool enable) { cx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_MOD, enable ? CNTRL_MOD : 0); }
0
32,094
read_passphrase_hash (const char *passphrase_file, const md_kt_t *digest, uint8_t *output, int len) { unsigned int outlen = 0; md_ctx_t md; ASSERT (len >= md_kt_size(digest)); memset (output, 0, len); md_ctx_init(&md, digest); /* read passphrase file */ { const int min_passphrase_size = 8; uint8_t buf[64]; int total_size = 0; int fd = platform_open (passphrase_file, O_RDONLY, 0); if (fd == -1) msg (M_ERR, "Cannot open passphrase file: '%s'", passphrase_file); for (;;) { int size = read (fd, buf, sizeof (buf)); if (size == 0) break; if (size == -1) msg (M_ERR, "Read error on passphrase file: '%s'", passphrase_file); md_ctx_update(&md, buf, size); total_size += size; } close (fd); warn_if_group_others_accessible (passphrase_file); if (total_size < min_passphrase_size) msg (M_FATAL, "Passphrase file '%s' is too small (must have at least %d characters)", passphrase_file, min_passphrase_size); } md_ctx_final(&md, output); md_ctx_cleanup(&md); return md_kt_size(digest); }
0
311,807
validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config, DrawablePtr pDraw, int *err) { ScreenPtr pScreen = pDraw->pScreen; VisualPtr pVisual = NULL; XID vid; int i; vid = wVisual((WindowPtr)pDraw); for (i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].vid == vid) { pVisual = &pScreen->visuals[i]; break; } } /* FIXME: What exactly should we check here... */ if (pVisual->class != glxConvertToXVisualType(config->visualType) || !(config->drawableType & GLX_WINDOW_BIT)) { client->errorValue = pDraw->id; *err = BadMatch; return FALSE; } return TRUE; }
0
516,845
Item_func_between::add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, SARGABLE_PARAM **sargables) { /* Build list of possible keys for 'a BETWEEN low AND high'. It is handled similar to the equivalent condition 'a >= low AND a <= high': */ Item_field *field_item; bool equal_func= false; uint num_values= 2; bool binary_cmp= (args[0]->real_item()->type() == Item::FIELD_ITEM) ? ((Item_field*) args[0]->real_item())->field->binary() : true; /* Additional optimization: If 'low = high': Handle as if the condition was "t.key = low". */ if (!negated && args[1]->eq(args[2], binary_cmp)) { equal_func= true; num_values= 1; } /* Append keys for 'field <cmp> value[]' if the condition is of the form:: '<field> BETWEEN value[1] AND value[2]' */ if (is_local_field(args[0])) { field_item= (Item_field *) (args[0]->real_item()); add_key_equal_fields(join, key_fields, *and_level, this, field_item, equal_func, &args[1], num_values, usable_tables, sargables); } /* Append keys for 'value[0] <cmp> field' if the condition is of the form: 'value[0] BETWEEN field1 AND field2' */ for (uint i= 1; i <= num_values; i++) { if (is_local_field(args[i])) { field_item= (Item_field *) (args[i]->real_item()); add_key_equal_fields(join, key_fields, *and_level, this, field_item, equal_func, args, 1, usable_tables, sargables); } } }
0
165,376
sp<SoundTriggerHwService::Model> SoundTriggerHwService::Module::getModel( sound_model_handle_t handle) { sp<Model> model; ssize_t index = mModels.indexOfKey(handle); if (index >= 0) { model = mModels.valueAt(index); } return model; }
0
42,445
main (int argc, char **argv) { mode_t old_umask; const char *base_path = NULL; int clone_flags; char *old_cwd = NULL; pid_t pid; int event_fd = -1; int child_wait_fd = -1; int setup_finished_pipe[] = {-1, -1}; const char *new_cwd; uid_t ns_uid; gid_t ns_gid; struct stat sbuf; uint64_t val; int res UNUSED; cleanup_free char *seccomp_data = NULL; size_t seccomp_len; struct sock_fprog seccomp_prog; cleanup_free char *args_data = NULL; /* Handle --version early on before we try to acquire/drop * any capabilities so it works in a build environment; * right now flatpak's build runs bubblewrap --version. * https://github.com/projectatomic/bubblewrap/issues/185 */ if (argc == 2 && (strcmp (argv[1], "--version") == 0)) print_version_and_exit (); real_uid = getuid (); real_gid = getgid (); /* Get the (optional) privileges we need */ acquire_privs (); /* Never gain any more privs during exec */ if (prctl (PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) die_with_error ("prctl(PR_SET_NO_NEW_CAPS) failed"); /* The initial code is run with high permissions (i.e. CAP_SYS_ADMIN), so take lots of care. */ read_overflowids (); argv0 = argv[0]; if (isatty (1)) host_tty_dev = ttyname (1); argv++; argc--; if (argc == 0) usage (EXIT_FAILURE, stderr); parse_args (&argc, (const char ***) &argv); /* suck the args into a cleanup_free variable to control their lifecycle */ args_data = opt_args_data; opt_args_data = NULL; if ((requested_caps[0] || requested_caps[1]) && is_privileged) die ("--cap-add in setuid mode can be used only by root"); if (opt_userns_block_fd != -1 && !opt_unshare_user) die ("--userns-block-fd requires --unshare-user"); if (opt_userns_block_fd != -1 && opt_info_fd == -1) die ("--userns-block-fd requires --info-fd"); /* We have to do this if we weren't installed setuid (and we're not * root), so let's just DWIM */ if (!is_privileged && getuid () != 0) opt_unshare_user = TRUE; #ifdef ENABLE_REQUIRE_USERNS /* In this build option, we require userns. */ if (is_privileged && getuid () != 0) opt_unshare_user = TRUE; #endif if (opt_unshare_user_try && stat ("/proc/self/ns/user", &sbuf) == 0) { bool disabled = FALSE; /* RHEL7 has a kernel module parameter that lets you enable user namespaces */ if (stat ("/sys/module/user_namespace/parameters/enable", &sbuf) == 0) { cleanup_free char *enable = NULL; enable = load_file_at (AT_FDCWD, "/sys/module/user_namespace/parameters/enable"); if (enable != NULL && enable[0] == 'N') disabled = TRUE; } /* Check for max_user_namespaces */ if (stat ("/proc/sys/user/max_user_namespaces", &sbuf) == 0) { cleanup_free char *max_user_ns = NULL; max_user_ns = load_file_at (AT_FDCWD, "/proc/sys/user/max_user_namespaces"); if (max_user_ns != NULL && strcmp(max_user_ns, "0\n") == 0) disabled = TRUE; } /* Debian lets you disable *unprivileged* user namespaces. However this is not a problem if we're privileged, and if we're not opt_unshare_user is TRUE already, and there is not much we can do, its just a non-working setup. */ if (!disabled) opt_unshare_user = TRUE; } if (argc == 0) usage (EXIT_FAILURE, stderr); __debug__ (("Creating root mount point\n")); if (opt_sandbox_uid == -1) opt_sandbox_uid = real_uid; if (opt_sandbox_gid == -1) opt_sandbox_gid = real_gid; if (!opt_unshare_user && opt_sandbox_uid != real_uid) die ("Specifying --uid requires --unshare-user"); if (!opt_unshare_user && opt_sandbox_gid != real_gid) die ("Specifying --gid requires --unshare-user"); if (!opt_unshare_uts && opt_sandbox_hostname != NULL) die ("Specifying --hostname requires --unshare-uts"); if (opt_as_pid_1 && !opt_unshare_pid) die ("Specifying --as-pid-1 requires --unshare-pid"); if (opt_as_pid_1 && lock_files != NULL) die ("Specifying --as-pid-1 and --lock-file is not permitted"); /* We need to read stuff from proc during the pivot_root dance, etc. Lets keep a fd to it open */ proc_fd = open ("/proc", O_PATH); if (proc_fd == -1) die_with_error ("Can't open /proc"); /* We need *some* mountpoint where we can mount the root tmpfs. * Because we use pivot_root, it won't appear to be mounted from * the perspective of the sandboxed process, so we can use anywhere * that is sure to exist, that is sure to not be a symlink controlled * by someone malicious, and that we won't immediately need to * access ourselves. */ base_path = "/tmp"; __debug__ (("creating new namespace\n")); if (opt_unshare_pid && !opt_as_pid_1) { event_fd = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK); if (event_fd == -1) die_with_error ("eventfd()"); } /* We block sigchild here so that we can use signalfd in the monitor. */ block_sigchild (); clone_flags = SIGCHLD | CLONE_NEWNS; if (opt_unshare_user) clone_flags |= CLONE_NEWUSER; if (opt_unshare_pid) clone_flags |= CLONE_NEWPID; if (opt_unshare_net) clone_flags |= CLONE_NEWNET; if (opt_unshare_ipc) clone_flags |= CLONE_NEWIPC; if (opt_unshare_uts) clone_flags |= CLONE_NEWUTS; if (opt_unshare_cgroup) { if (stat ("/proc/self/ns/cgroup", &sbuf)) { if (errno == ENOENT) die ("Cannot create new cgroup namespace because the kernel does not support it"); else die_with_error ("stat on /proc/self/ns/cgroup failed"); } clone_flags |= CLONE_NEWCGROUP; } if (opt_unshare_cgroup_try) if (!stat ("/proc/self/ns/cgroup", &sbuf)) clone_flags |= CLONE_NEWCGROUP; child_wait_fd = eventfd (0, EFD_CLOEXEC); if (child_wait_fd == -1) die_with_error ("eventfd()"); /* Track whether pre-exec setup finished if we're reporting process exit */ if (opt_json_status_fd != -1) { int ret; ret = pipe2 (setup_finished_pipe, O_CLOEXEC); if (ret == -1) die_with_error ("pipe2()"); } pid = raw_clone (clone_flags, NULL); if (pid == -1) { if (opt_unshare_user) { if (errno == EINVAL) die ("Creating new namespace failed, likely because the kernel does not support user namespaces. bwrap must be installed setuid on such systems."); else if (errno == EPERM && !is_privileged) die ("No permissions to creating new namespace, likely because the kernel does not allow non-privileged user namespaces. On e.g. debian this can be enabled with 'sysctl kernel.unprivileged_userns_clone=1'."); } die_with_error ("Creating new namespace failed"); } ns_uid = opt_sandbox_uid; ns_gid = opt_sandbox_gid; if (pid != 0) { /* Parent, outside sandbox, privileged (initially) */ if (is_privileged && opt_unshare_user && opt_userns_block_fd == -1) { /* We're running as euid 0, but the uid we want to map is * not 0. This means we're not allowed to write this from * the child user namespace, so we do it from the parent. * * Also, we map uid/gid 0 in the namespace (to overflowuid) * if opt_needs_devpts is true, because otherwise the mount * of devpts fails due to root not being mapped. */ write_uid_gid_map (ns_uid, real_uid, ns_gid, real_gid, pid, TRUE, opt_needs_devpts); } /* Initial launched process, wait for exec:ed command to exit */ /* We don't need any privileges in the launcher, drop them immediately. */ drop_privs (FALSE); /* Optionally bind our lifecycle to that of the parent */ handle_die_with_parent (); if (opt_info_fd != -1) { cleanup_free char *output = xasprintf ("{\n \"child-pid\": %i\n}\n", pid); dump_info (opt_info_fd, output, TRUE); close (opt_info_fd); } if (opt_json_status_fd != -1) { cleanup_free char *output = xasprintf ("{ \"child-pid\": %i }\n", pid); dump_info (opt_json_status_fd, output, TRUE); } if (opt_userns_block_fd != -1) { char b[1]; (void) TEMP_FAILURE_RETRY (read (opt_userns_block_fd, b, 1)); close (opt_userns_block_fd); } /* Let child run now that the uid maps are set up */ val = 1; res = write (child_wait_fd, &val, 8); /* Ignore res, if e.g. the child died and closed child_wait_fd we don't want to error out here */ close (child_wait_fd); return monitor_child (event_fd, pid, setup_finished_pipe[0]); } /* Child, in sandbox, privileged in the parent or in the user namespace (if --unshare-user). * * Note that for user namespaces we run as euid 0 during clone(), so * the child user namespace is owned by euid 0., This means that the * regular user namespace parent (with uid != 0) doesn't have any * capabilities in it, which is nice as we can't exploit those. In * particular the parent user namespace doesn't have CAP_PTRACE * which would otherwise allow the parent to hijack of the child * after this point. * * Unfortunately this also means you can't ptrace the final * sandboxed process from outside the sandbox either. */ if (opt_info_fd != -1) close (opt_info_fd); if (opt_json_status_fd != -1) close (opt_json_status_fd); /* Wait for the parent to init uid/gid maps and drop caps */ res = read (child_wait_fd, &val, 8); close (child_wait_fd); /* At this point we can completely drop root uid, but retain the * required permitted caps. This allow us to do full setup as * the user uid, which makes e.g. fuse access work. */ switch_to_user_with_privs (); if (opt_unshare_net) loopback_setup (); /* Will exit if unsuccessful */ ns_uid = opt_sandbox_uid; ns_gid = opt_sandbox_gid; if (!is_privileged && opt_unshare_user && opt_userns_block_fd == -1) { /* In the unprivileged case we have to write the uid/gid maps in * the child, because we have no caps in the parent */ if (opt_needs_devpts) { /* This is a bit hacky, but we need to first map the real uid/gid to 0, otherwise we can't mount the devpts filesystem because root is not mapped. Later we will create another child user namespace and map back to the real uid */ ns_uid = 0; ns_gid = 0; } write_uid_gid_map (ns_uid, real_uid, ns_gid, real_gid, -1, TRUE, FALSE); } old_umask = umask (0); /* Need to do this before the chroot, but after we're the real uid */ resolve_symlinks_in_ops (); /* Mark everything as slave, so that we still * receive mounts from the real root, but don't * propagate mounts to the real root. */ if (mount (NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) < 0) die_with_error ("Failed to make / slave"); /* Create a tmpfs which we will use as / in the namespace */ if (mount ("tmpfs", base_path, "tmpfs", MS_NODEV | MS_NOSUID, NULL) != 0) die_with_error ("Failed to mount tmpfs"); old_cwd = get_current_dir_name (); /* Chdir to the new root tmpfs mount. This will be the CWD during the entire setup. Access old or new root via "oldroot" and "newroot". */ if (chdir (base_path) != 0) die_with_error ("chdir base_path"); /* We create a subdir "$base_path/newroot" for the new root, that * way we can pivot_root to base_path, and put the old root at * "$base_path/oldroot". This avoids problems accessing the oldroot * dir if the user requested to bind mount something over / (or * over /tmp, now that we use that for base_path). */ if (mkdir ("newroot", 0755)) die_with_error ("Creating newroot failed"); if (mount ("newroot", "newroot", NULL, MS_MGC_VAL | MS_BIND | MS_REC, NULL) < 0) die_with_error ("setting up newroot bind"); if (mkdir ("oldroot", 0755)) die_with_error ("Creating oldroot failed"); if (pivot_root (base_path, "oldroot")) die_with_error ("pivot_root"); if (chdir ("/") != 0) die_with_error ("chdir / (base path)"); if (is_privileged) { pid_t child; int privsep_sockets[2]; if (socketpair (AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, privsep_sockets) != 0) die_with_error ("Can't create privsep socket"); child = fork (); if (child == -1) die_with_error ("Can't fork unprivileged helper"); if (child == 0) { /* Unprivileged setup process */ drop_privs (FALSE); close (privsep_sockets[0]); setup_newroot (opt_unshare_pid, privsep_sockets[1]); exit (0); } else { int status; uint32_t buffer[2048]; /* 8k, but is int32 to guarantee nice alignment */ uint32_t op, flags; const char *arg1, *arg2; cleanup_fd int unpriv_socket = -1; unpriv_socket = privsep_sockets[0]; close (privsep_sockets[1]); do { op = read_priv_sec_op (unpriv_socket, buffer, sizeof (buffer), &flags, &arg1, &arg2); privileged_op (-1, op, flags, arg1, arg2); if (write (unpriv_socket, buffer, 1) != 1) die ("Can't write to op_socket"); } while (op != PRIV_SEP_OP_DONE); waitpid (child, &status, 0); /* Continue post setup */ } } else { setup_newroot (opt_unshare_pid, -1); } close_ops_fd (); /* The old root better be rprivate or we will send unmount events to the parent namespace */ if (mount ("oldroot", "oldroot", NULL, MS_REC | MS_PRIVATE, NULL) != 0) die_with_error ("Failed to make old root rprivate"); if (umount2 ("oldroot", MNT_DETACH)) die_with_error ("unmount old root"); /* This is our second pivot. It's like we're a Silicon Valley startup flush * with cash but short on ideas! * * We're aiming to make /newroot the real root, and get rid of /oldroot. To do * that we need a temporary place to store it before we can unmount it. */ { cleanup_fd int oldrootfd = open ("/", O_DIRECTORY | O_RDONLY); if (oldrootfd < 0) die_with_error ("can't open /"); if (chdir ("/newroot") != 0) die_with_error ("chdir /newroot"); /* While the documentation claims that put_old must be underneath * new_root, it is perfectly fine to use the same directory as the * kernel checks only if old_root is accessible from new_root. * * Both runc and LXC are using this "alternative" method for * setting up the root of the container: * * https://github.com/opencontainers/runc/blob/master/libcontainer/rootfs_linux.go#L671 * https://github.com/lxc/lxc/blob/master/src/lxc/conf.c#L1121 */ if (pivot_root (".", ".") != 0) die_with_error ("pivot_root(/newroot)"); if (fchdir (oldrootfd) < 0) die_with_error ("fchdir to oldroot"); if (umount2 (".", MNT_DETACH) < 0) die_with_error ("umount old root"); if (chdir ("/") != 0) die_with_error ("chdir /"); } if (opt_unshare_user && (ns_uid != opt_sandbox_uid || ns_gid != opt_sandbox_gid) && opt_userns_block_fd == -1) { /* Now that devpts is mounted and we've no need for mount permissions we can create a new userspace and map our uid 1:1 */ if (unshare (CLONE_NEWUSER)) die_with_error ("unshare user ns"); write_uid_gid_map (opt_sandbox_uid, ns_uid, opt_sandbox_gid, ns_gid, -1, FALSE, FALSE); } /* All privileged ops are done now, so drop caps we don't need */ drop_privs (!is_privileged); if (opt_block_fd != -1) { char b[1]; (void) TEMP_FAILURE_RETRY (read (opt_block_fd, b, 1)); close (opt_block_fd); } if (opt_seccomp_fd != -1) { seccomp_data = load_file_data (opt_seccomp_fd, &seccomp_len); if (seccomp_data == NULL) die_with_error ("Can't read seccomp data"); if (seccomp_len % 8 != 0) die ("Invalid seccomp data, must be multiple of 8"); seccomp_prog.len = seccomp_len / 8; seccomp_prog.filter = (struct sock_filter *) seccomp_data; close (opt_seccomp_fd); } umask (old_umask); new_cwd = "/"; if (opt_chdir_path) { if (chdir (opt_chdir_path)) die_with_error ("Can't chdir to %s", opt_chdir_path); new_cwd = opt_chdir_path; } else if (chdir (old_cwd) == 0) { /* If the old cwd is mapped in the sandbox, go there */ new_cwd = old_cwd; } else { /* If the old cwd is not mapped, go to home */ const char *home = getenv ("HOME"); if (home != NULL && chdir (home) == 0) new_cwd = home; } xsetenv ("PWD", new_cwd, 1); free (old_cwd); if (opt_new_session && setsid () == (pid_t) -1) die_with_error ("setsid"); if (label_exec (opt_exec_label) == -1) die_with_error ("label_exec %s", argv[0]); __debug__ (("forking for child\n")); if (!opt_as_pid_1 && (opt_unshare_pid || lock_files != NULL || opt_sync_fd != -1)) { /* We have to have a pid 1 in the pid namespace, because * otherwise we'll get a bunch of zombies as nothing reaps * them. Alternatively if we're using sync_fd or lock_files we * need some process to own these. */ pid = fork (); if (pid == -1) die_with_error ("Can't fork for pid 1"); if (pid != 0) { drop_all_caps (FALSE); /* Close fds in pid 1, except stdio and optionally event_fd (for syncing pid 2 lifetime with monitor_child) and opt_sync_fd (for syncing sandbox lifetime with outside process). Any other fds will been passed on to the child though. */ { int dont_close[3]; int j = 0; if (event_fd != -1) dont_close[j++] = event_fd; if (opt_sync_fd != -1) dont_close[j++] = opt_sync_fd; dont_close[j++] = -1; fdwalk (proc_fd, close_extra_fds, dont_close); } return do_init (event_fd, pid, seccomp_data != NULL ? &seccomp_prog : NULL); } } __debug__ (("launch executable %s\n", argv[0])); if (proc_fd != -1) close (proc_fd); /* If we are using --as-pid-1 leak the sync fd into the sandbox. --sync-fd will still work unless the container process doesn't close this file. */ if (!opt_as_pid_1) { if (opt_sync_fd != -1) close (opt_sync_fd); } /* We want sigchild in the child */ unblock_sigchild (); /* Optionally bind our lifecycle */ handle_die_with_parent (); if (!is_privileged) set_ambient_capabilities (); /* Should be the last thing before execve() so that filters don't * need to handle anything above */ if (seccomp_data != NULL && prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &seccomp_prog) != 0) die_with_error ("prctl(PR_SET_SECCOMP)"); if (setup_finished_pipe[1] != -1) { char data = 0; res = write_to_fd (setup_finished_pipe[1], &data, 1); /* Ignore res, if e.g. the parent died and closed setup_finished_pipe[0] we don't want to error out here */ } if (execvp (argv[0], argv) == -1) { if (setup_finished_pipe[1] != -1) { int saved_errno = errno; char data = 0; res = write_to_fd (setup_finished_pipe[1], &data, 1); errno = saved_errno; /* Ignore res, if e.g. the parent died and closed setup_finished_pipe[0] we don't want to error out here */ } die_with_error ("execvp %s", argv[0]); } return 0; }
0
85,308
static void php_mysqlnd_cmd_free_mem(void * _packet, zend_bool stack_allocation TSRMLS_DC) { if (!stack_allocation) { MYSQLND_PACKET_COMMAND * p = (MYSQLND_PACKET_COMMAND *) _packet; mnd_pefree(p, p->header.persistent); }
0
306,325
Command(vector<string>& c, ceph_tid_t t, bufferlist& bl, Connection *co) : cmd(c), tid(t), indata(bl), con(co) {}
0
317,048
static MagickBooleanType WriteRGFImage(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { MagickBooleanType status; int bit; register const PixelPacket *p; register ssize_t x; ssize_t y; unsigned char byte; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); (void) TransformImageColorspace(image,sRGBColorspace); if((image->columns > 255L) || (image->rows > 255L)) ThrowWriterException(ImageError,"Dimensions must be less than 255x255"); /* Write header (just the image dimensions) */ (void) WriteBlobByte(image,image->columns & 0xff); (void) WriteBlobByte(image,image->rows & 0xff); /* Convert MIFF to bit pixels. */ (void) SetImageType(image,BilevelType); x=0; y=0; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const PixelPacket *) NULL) break; bit=0; byte=0; for (x=0; x < (ssize_t) image->columns; x++) { byte>>=1; if (GetPixelLuma(image,p) < (QuantumRange/2)) byte|=0x80; bit++; if (bit == 8) { /* Write a bitmap byte to the image file. */ (void) WriteBlobByte(image,byte); bit=0; byte=0; } p++; } if (bit != 0) (void) WriteBlobByte(image,byte); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } (void) CloseBlob(image); return(MagickTrue); }
0
330,162
static void dump_aml_files(test_data *data, bool rebuild) { AcpiSdtTable *sdt; GError *error = NULL; gchar *aml_file = NULL; gint fd; ssize_t ret; int i; for (i = 0; i < data->tables->len; ++i) { const char *ext = data->variant ? data->variant : ""; sdt = &g_array_index(data->tables, AcpiSdtTable, i); g_assert(sdt->aml); if (rebuild) { uint32_t signature = cpu_to_le32(sdt->header.signature); aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine, (gchar *)&signature, ext); fd = g_open(aml_file, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH); } else { fd = g_file_open_tmp("aml-XXXXXX", &sdt->aml_file, &error); g_assert_no_error(error); } g_assert(fd >= 0); ret = qemu_write_full(fd, sdt, sizeof(AcpiTableHeader)); g_assert(ret == sizeof(AcpiTableHeader)); ret = qemu_write_full(fd, sdt->aml, sdt->aml_len); g_assert(ret == sdt->aml_len); close(fd); if (aml_file) { g_free(aml_file); } } }
0
330,972
static void scsi_read_complete(void * opaque, int ret) { SCSIGenericReq *r = (SCSIGenericReq *)opaque; SCSIDevice *s = r->req.dev; int len; r->req.aiocb = NULL; if (ret || r->req.io_canceled) { scsi_command_complete(r, ret); return; } len = r->io_header.dxfer_len - r->io_header.resid; DPRINTF("Data ready tag=0x%x len=%d\n", r->req.tag, len); r->len = -1; if (len == 0) { scsi_command_complete(r, 0); } else { /* Snoop READ CAPACITY output to set the blocksize. */ if (r->req.cmd.buf[0] == READ_CAPACITY_10 && (ldl_be_p(&r->buf[0]) != 0xffffffffU || s->max_lba == 0)) { s->blocksize = ldl_be_p(&r->buf[4]); s->max_lba = ldl_be_p(&r->buf[0]) & 0xffffffffULL; } else if (r->req.cmd.buf[0] == SERVICE_ACTION_IN_16 && (r->req.cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { s->blocksize = ldl_be_p(&r->buf[8]); s->max_lba = ldq_be_p(&r->buf[0]); } bdrv_set_guest_block_size(s->conf.bs, s->blocksize); scsi_req_data(&r->req, len); scsi_req_unref(&r->req); } }
0
134,313
static void error(const char *format,...) { va_list args; va_start(args, format); error_or_warning(format, args, "ERROR"); va_end(args); }
0
234,297
parse_pop_vlan(struct ofpbuf *ofpacts) { ofpact_put_STRIP_VLAN(ofpacts)->ofpact.raw = OFPAT_RAW11_POP_VLAN; return NULL; }
0
485,749
static long snd_pcm_oss_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) { /* * Everything is compatbile except SNDCTL_DSP_MAPINBUF/SNDCTL_DSP_MAPOUTBUF, * which are not implemented for the native case either */ return snd_pcm_oss_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); }
0
383,105
cache_disabled_value (PKT_public_key *pk) { #ifdef NO_TRUST_MODELS (void)pk; return 0; #else return tdb_cache_disabled_value (pk); #endif }
0