idx
int64
func
string
target
int64
97,950
static int check_reg_arg(struct reg_state *regs, u32 regno, enum reg_arg_type t) { if (regno >= MAX_BPF_REG) { verbose("R%d is invalid\n", regno); return -EINVAL; } if (t == SRC_OP) { /* check whether register used as source operand can be read */ if (regs[regno].type == NOT_INIT) { verbose("R%d !read_ok\n", regno); return -EACCES; } } else { /* check whether register used as dest operand can be written to */ if (regno == BPF_REG_FP) { verbose("frame pointer is read only\n"); return -EACCES; } if (t == DST_OP) mark_reg_unknown_value(regs, regno); } return 0; }
0
451,568
static BROTLI_INLINE size_t NextBlockTypeCode( BlockTypeCodeCalculator* calculator, uint8_t type) { size_t type_code = (type == calculator->last_type + 1) ? 1u : (type == calculator->second_last_type) ? 0u : type + 2u; calculator->second_last_type = calculator->last_type; calculator->last_type = type; return type_code; }
0
237,016
TestInterstitialPageDelegate(TestInterstitialPage* interstitial_page) : interstitial_page_(interstitial_page) {}
0
153,800
BOOL update_write_opaque_rect_order(wStream* s, ORDER_INFO* orderInfo, const OPAQUE_RECT_ORDER* opaque_rect) { BYTE byte; int inf = update_approximate_opaque_rect_order(orderInfo, opaque_rect); if (!Stream_EnsureRemainingCapacity(s, inf)) return FALSE; // TODO: Color format conversion orderInfo->fieldFlags = 0; orderInfo->fieldFlags |= ORDER_FIELD_01; update_write_coord(s, opaque_rect->nLeftRect); orderInfo->fieldFlags |= ORDER_FIELD_02; update_write_coord(s, opaque_rect->nTopRect); orderInfo->fieldFlags |= ORDER_FIELD_03; update_write_coord(s, opaque_rect->nWidth); orderInfo->fieldFlags |= ORDER_FIELD_04; update_write_coord(s, opaque_rect->nHeight); orderInfo->fieldFlags |= ORDER_FIELD_05; byte = opaque_rect->color & 0x000000FF; Stream_Write_UINT8(s, byte); orderInfo->fieldFlags |= ORDER_FIELD_06; byte = (opaque_rect->color & 0x0000FF00) >> 8; Stream_Write_UINT8(s, byte); orderInfo->fieldFlags |= ORDER_FIELD_07; byte = (opaque_rect->color & 0x00FF0000) >> 16; Stream_Write_UINT8(s, byte); return TRUE; }
0
139,190
flatpak_run_add_pcsc_args (FlatpakBwrap *bwrap) { const char * pcsc_socket; const char * sandbox_pcsc_socket = "/run/pcscd/pcscd.comm"; pcsc_socket = g_getenv ("PCSCLITE_CSOCK_NAME"); if (pcsc_socket) { if (!g_file_test (pcsc_socket, G_FILE_TEST_EXISTS)) { flatpak_bwrap_unset_env (bwrap, "PCSCLITE_CSOCK_NAME"); return; } } else { pcsc_socket = "/run/pcscd/pcscd.comm"; if (!g_file_test (pcsc_socket, G_FILE_TEST_EXISTS)) return; } flatpak_bwrap_add_args (bwrap, "--ro-bind", pcsc_socket, sandbox_pcsc_socket, NULL); flatpak_bwrap_set_env (bwrap, "PCSCLITE_CSOCK_NAME", sandbox_pcsc_socket, TRUE); }
0
429,086
static Image *ReadPCXImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define ThrowPCXException(severity,tag) \ { \ if (scanline != (unsigned char *) NULL) \ scanline=(unsigned char *) RelinquishMagickMemory(scanline); \ if (pixel_info != (MemoryInfo *) NULL) \ pixel_info=RelinquishVirtualMemory(pixel_info); \ if (page_table != (MagickOffsetType *) NULL) \ page_table=(MagickOffsetType *) RelinquishMagickMemory(page_table); \ ThrowReaderException(severity,tag); \ } Image *image; int bits, id, mask; MagickBooleanType status; MagickOffsetType offset, *page_table; MemoryInfo *pixel_info; PCXInfo pcx_info; register IndexPacket *indexes; register ssize_t x; register PixelPacket *q; register ssize_t i; register unsigned char *p, *r; size_t one, pcx_packets; ssize_t count, y; unsigned char packet, pcx_colormap[768], *pixels, *scanline; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Determine if this a PCX file. */ page_table=(MagickOffsetType *) NULL; scanline=(unsigned char *) NULL; pixel_info=(MemoryInfo *) NULL; if (LocaleCompare(image_info->magick,"DCX") == 0) { size_t magic; /* Read the DCX page table. */ magic=ReadBlobLSBLong(image); if (magic != 987654321) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); page_table=(MagickOffsetType *) AcquireQuantumMemory(1024UL, sizeof(*page_table)); if (page_table == (MagickOffsetType *) NULL) ThrowPCXException(ResourceLimitError,"MemoryAllocationFailed"); for (id=0; id < 1024; id++) { page_table[id]=(MagickOffsetType) ReadBlobLSBLong(image); if (page_table[id] == 0) break; } } if (page_table != (MagickOffsetType *) NULL) { offset=SeekBlob(image,(MagickOffsetType) page_table[0],SEEK_SET); if (offset < 0) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); } count=ReadBlob(image,1,&pcx_info.identifier); for (id=1; id < 1024; id++) { int bits_per_pixel; /* Verify PCX identifier. */ pcx_info.version=(unsigned char) ReadBlobByte(image); if ((count != 1) || (pcx_info.identifier != 0x0a)) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); pcx_info.encoding=(unsigned char) ReadBlobByte(image); bits_per_pixel=ReadBlobByte(image); if (bits_per_pixel == -1) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); pcx_info.bits_per_pixel=(unsigned char) bits_per_pixel; pcx_info.left=ReadBlobLSBShort(image); pcx_info.top=ReadBlobLSBShort(image); pcx_info.right=ReadBlobLSBShort(image); pcx_info.bottom=ReadBlobLSBShort(image); pcx_info.horizontal_resolution=ReadBlobLSBShort(image); pcx_info.vertical_resolution=ReadBlobLSBShort(image); /* Read PCX raster colormap. */ image->columns=(size_t) MagickAbsoluteValue((ssize_t) pcx_info.right- pcx_info.left)+1UL; image->rows=(size_t) MagickAbsoluteValue((ssize_t) pcx_info.bottom- pcx_info.top)+1UL; if ((image->columns == 0) || (image->rows == 0) || ((pcx_info.bits_per_pixel != 1) && (pcx_info.bits_per_pixel != 2) && (pcx_info.bits_per_pixel != 4) && (pcx_info.bits_per_pixel != 8))) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); image->depth=pcx_info.bits_per_pixel; image->units=PixelsPerInchResolution; image->x_resolution=(double) pcx_info.horizontal_resolution; image->y_resolution=(double) pcx_info.vertical_resolution; image->colors=16; if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) ThrowPCXException(image->exception.severity,image->exception.reason); (void) SetImageBackgroundColor(image); (void) memset(pcx_colormap,0,sizeof(pcx_colormap)); count=ReadBlob(image,3*image->colors,pcx_colormap); if (count != (ssize_t) (3*image->colors)) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); pcx_info.reserved=(unsigned char) ReadBlobByte(image); pcx_info.planes=(unsigned char) ReadBlobByte(image); if (pcx_info.planes > 6) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); if ((pcx_info.bits_per_pixel*pcx_info.planes) >= 64) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); if (pcx_info.planes == 0) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); one=1; if ((pcx_info.bits_per_pixel != 8) || (pcx_info.planes == 1)) if ((pcx_info.version == 3) || (pcx_info.version == 5) || ((pcx_info.bits_per_pixel*pcx_info.planes) == 1)) image->colors=(size_t) MagickMin(one << (1UL* (pcx_info.bits_per_pixel*pcx_info.planes)),256UL); if (AcquireImageColormap(image,image->colors) == MagickFalse) ThrowPCXException(ResourceLimitError,"MemoryAllocationFailed"); if ((pcx_info.bits_per_pixel >= 8) && (pcx_info.planes != 1)) image->storage_class=DirectClass; p=pcx_colormap; for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ScaleCharToQuantum(*p++); image->colormap[i].green=ScaleCharToQuantum(*p++); image->colormap[i].blue=ScaleCharToQuantum(*p++); } pcx_info.bytes_per_line=ReadBlobLSBShort(image); pcx_info.palette_info=ReadBlobLSBShort(image); pcx_info.horizontal_screensize=ReadBlobLSBShort(image); pcx_info.vertical_screensize=ReadBlobLSBShort(image); for (i=0; i < 54; i++) (void) ReadBlobByte(image); /* Read image data. */ if (HeapOverflowSanityCheck(image->rows, (size_t) pcx_info.bytes_per_line) != MagickFalse) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); pcx_packets=(size_t) image->rows*pcx_info.bytes_per_line; if (HeapOverflowSanityCheck(pcx_packets, (size_t) pcx_info.planes) != MagickFalse) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); pcx_packets=(size_t) pcx_packets*pcx_info.planes; if ((size_t) (pcx_info.bits_per_pixel*pcx_info.planes*image->columns) > (pcx_packets*8U)) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); if ((MagickSizeType) (pcx_packets/8) > GetBlobSize(image)) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); scanline=(unsigned char *) AcquireQuantumMemory(MagickMax(image->columns, pcx_info.bytes_per_line),MagickMax(pcx_info.planes,8)*sizeof(*scanline)); pixel_info=AcquireVirtualMemory(pcx_packets,2*sizeof(*pixels)); if ((scanline == (unsigned char *) NULL) || (pixel_info == (MemoryInfo *) NULL)) { if (scanline != (unsigned char *) NULL) scanline=(unsigned char *) RelinquishMagickMemory(scanline); if (pixel_info != (MemoryInfo *) NULL) pixel_info=RelinquishVirtualMemory(pixel_info); ThrowPCXException(ResourceLimitError,"MemoryAllocationFailed"); } (void) memset(scanline,0,(size_t) MagickMax(image->columns, pcx_info.bytes_per_line)*MagickMax(pcx_info.planes,8)*sizeof(*scanline)); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); (void) memset(pixels,0,(size_t) pcx_packets*(2*sizeof(*pixels))); /* Uncompress image data. */ p=pixels; if (pcx_info.encoding == 0) while (pcx_packets != 0) { packet=(unsigned char) ReadBlobByte(image); if (EOFBlob(image) != MagickFalse) ThrowPCXException(CorruptImageError,"UnexpectedEndOfFile"); *p++=packet; pcx_packets--; } else while (pcx_packets != 0) { packet=(unsigned char) ReadBlobByte(image); if (EOFBlob(image) != MagickFalse) ThrowPCXException(CorruptImageError,"UnexpectedEndOfFile"); if ((packet & 0xc0) != 0xc0) { *p++=packet; pcx_packets--; continue; } count=(ssize_t) (packet & 0x3f); packet=(unsigned char) ReadBlobByte(image); if (EOFBlob(image) != MagickFalse) ThrowPCXException(CorruptImageError,"UnexpectedEndOfFile"); for ( ; count != 0; count--) { *p++=packet; pcx_packets--; if (pcx_packets == 0) break; } } if (image->storage_class == DirectClass) image->matte=pcx_info.planes > 3 ? MagickTrue : MagickFalse; else if ((pcx_info.version == 5) || ((pcx_info.bits_per_pixel*pcx_info.planes) == 1)) { /* Initialize image colormap. */ if (image->colors > 256) ThrowPCXException(CorruptImageError,"ColormapExceeds256Colors"); if ((pcx_info.bits_per_pixel*pcx_info.planes) == 1) { /* Monochrome colormap. */ image->colormap[0].red=(Quantum) 0; image->colormap[0].green=(Quantum) 0; image->colormap[0].blue=(Quantum) 0; image->colormap[1].red=QuantumRange; image->colormap[1].green=QuantumRange; image->colormap[1].blue=QuantumRange; } else if (image->colors > 16) { /* 256 color images have their color map at the end of the file. */ pcx_info.colormap_signature=(unsigned char) ReadBlobByte(image); count=ReadBlob(image,3*image->colors,pcx_colormap); p=pcx_colormap; for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ScaleCharToQuantum(*p++); image->colormap[i].green=ScaleCharToQuantum(*p++); image->colormap[i].blue=ScaleCharToQuantum(*p++); } } } /* Convert PCX raster image to pixel packets. */ for (y=0; y < (ssize_t) image->rows; y++) { p=pixels+(y*pcx_info.bytes_per_line*pcx_info.planes); q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); r=scanline; if (image->storage_class == DirectClass) for (i=0; i < pcx_info.planes; i++) { r=scanline+i; for (x=0; x < (ssize_t) pcx_info.bytes_per_line; x++) { switch (i) { case 0: { *r=(*p++); break; } case 1: { *r=(*p++); break; } case 2: { *r=(*p++); break; } case 3: default: { *r=(*p++); break; } } r+=pcx_info.planes; } } else if (pcx_info.planes > 1) { for (x=0; x < (ssize_t) image->columns; x++) *r++=0; for (i=0; i < pcx_info.planes; i++) { r=scanline; for (x=0; x < (ssize_t) pcx_info.bytes_per_line; x++) { bits=(*p++); for (mask=0x80; mask != 0; mask>>=1) { if (bits & mask) *r|=1 << i; r++; } } } } else switch (pcx_info.bits_per_pixel) { case 1: { register ssize_t bit; for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=7; bit >= 0; bit--) *r++=(unsigned char) ((*p) & (0x01 << bit) ? 0x01 : 0x00); p++; } if ((image->columns % 8) != 0) { for (bit=7; bit >= (ssize_t) (8-(image->columns % 8)); bit--) *r++=(unsigned char) ((*p) & (0x01 << bit) ? 0x01 : 0x00); p++; } break; } case 2: { for (x=0; x < ((ssize_t) image->columns-3); x+=4) { *r++=(*p >> 6) & 0x3; *r++=(*p >> 4) & 0x3; *r++=(*p >> 2) & 0x3; *r++=(*p) & 0x3; p++; } if ((image->columns % 4) != 0) { for (i=3; i >= (ssize_t) (4-(image->columns % 4)); i--) *r++=(unsigned char) ((*p >> (i*2)) & 0x03); p++; } break; } case 4: { for (x=0; x < ((ssize_t) image->columns-1); x+=2) { *r++=(*p >> 4) & 0xf; *r++=(*p) & 0xf; p++; } if ((image->columns % 2) != 0) *r++=(*p++ >> 4) & 0xf; break; } case 8: { (void) memcpy(r,p,image->columns); break; } default: break; } /* Transfer image scanline. */ r=scanline; for (x=0; x < (ssize_t) image->columns; x++) { if (image->storage_class == PseudoClass) SetPixelIndex(indexes+x,*r++); else { SetPixelRed(q,ScaleCharToQuantum(*r++)); SetPixelGreen(q,ScaleCharToQuantum(*r++)); SetPixelBlue(q,ScaleCharToQuantum(*r++)); if (image->matte != MagickFalse) SetPixelAlpha(q,ScaleCharToQuantum(*r++)); } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (image->storage_class == PseudoClass) (void) SyncImage(image); scanline=(unsigned char *) RelinquishMagickMemory(scanline); pixel_info=RelinquishVirtualMemory(pixel_info); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if (page_table == (MagickOffsetType *) NULL) break; if (page_table[id] == 0) break; offset=SeekBlob(image,(MagickOffsetType) page_table[id],SEEK_SET); if (offset < 0) ThrowPCXException(CorruptImageError,"ImproperImageHeader"); count=ReadBlob(image,1,&pcx_info.identifier); if ((count != 0) && (pcx_info.identifier == 0x0a)) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { status=MagickFalse; break; } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } if (page_table != (MagickOffsetType *) NULL) page_table=(MagickOffsetType *) RelinquishMagickMemory(page_table); (void) CloseBlob(image); if (status == MagickFalse) return(DestroyImageList(image)); return(GetFirstImageInList(image)); }
0
103,618
static int nf_tables_loop_check_setelem(const struct nft_ctx *ctx, const struct nft_set *set, const struct nft_set_iter *iter, const struct nft_set_elem *elem) { if (elem->flags & NFT_SET_ELEM_INTERVAL_END) return 0; switch (elem->data.verdict) { case NFT_JUMP: case NFT_GOTO: return nf_tables_check_loops(ctx, elem->data.chain); default: return 0; } }
0
71,600
bool AdminRequestHandler::handleRandomStaticStringsRequest( const std::string& /*cmd*/, Transport* transport) { size_t count = 1; auto countParam = transport->getParam("count"); if (countParam != "") { try { count = folly::to<size_t>(countParam); } catch (...) { // do the default on invalid input } } std::string output; auto list = lookupDefinedStaticStrings(); if (count < list.size()) { for (size_t i = 0; i < count; i++) { size_t j = folly::Random::rand64(i, list.size()); std::swap(list[i], list[j]); } list.resize(count); } for (auto item : list) { output += formatStaticString(item); } transport->sendString(output); return true; }
0
300,376
TEST_F(SecretManagerImplTest, ConfigDumpHandler) { Server::MockInstance server; auto secret_manager = std::make_unique<SecretManagerImpl>(config_tracker_); time_system_.setSystemTime(std::chrono::milliseconds(1234567891234)); NiceMock<Server::Configuration::MockTransportSocketFactoryContext> secret_context; envoy::config::core::v3::ConfigSource config_source; NiceMock<LocalInfo::MockLocalInfo> local_info; NiceMock<Event::MockDispatcher> dispatcher; 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(_)) .WillRepeatedly(Invoke([&init_target_handle](const Init::Target& target) { init_target_handle = target.createHandle("test"); })); EXPECT_CALL(secret_context, stats()).WillRepeatedly(ReturnRef(stats)); EXPECT_CALL(secret_context, initManager()).WillRepeatedly(ReturnRef(init_manager)); EXPECT_CALL(secret_context, mainThreadDispatcher()).WillRepeatedly(ReturnRef(dispatcher)); EXPECT_CALL(secret_context, localInfo()).WillRepeatedly(ReturnRef(local_info)); 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: inline_string: "DUMMY_INLINE_BYTES_FOR_CERT_CHAIN" private_key: inline_string: "DUMMY_INLINE_BYTES_FOR_PRIVATE_KEY" password: inline_string: "DUMMY_PASSWORD" )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_, "keycert-v1"); testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext> ctx; Ssl::TlsCertificateConfigImpl tls_config(*secret_provider->secret(), ctx, *api_); EXPECT_EQ("DUMMY_INLINE_BYTES_FOR_CERT_CHAIN", tls_config.certificateChain()); EXPECT_EQ("DUMMY_INLINE_BYTES_FOR_PRIVATE_KEY", tls_config.privateKey()); EXPECT_EQ("DUMMY_PASSWORD", tls_config.password()); // Private key and password are removed. const std::string expected_secrets_config_dump = R"EOF( dynamic_active_secrets: - name: "abc.com" version_info: "keycert-v1" last_updated: seconds: 1234567891 nanos: 234000000 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com" tls_certificate: certificate_chain: inline_string: "DUMMY_INLINE_BYTES_FOR_CERT_CHAIN" private_key: inline_string: "[redacted]" password: inline_string: "[redacted]" )EOF"; checkConfigDump(expected_secrets_config_dump); StrictMock<MockStringMatcher> mock_matcher; EXPECT_CALL(mock_matcher, match("abc.com")).WillOnce(Return(false)); checkConfigDump("{}", mock_matcher); // Add a dynamic tls validation context provider. time_system_.setSystemTime(std::chrono::milliseconds(1234567899000)); auto context_secret_provider = secret_manager->findOrCreateCertificateValidationContextProvider( config_source, "abc.com.validation", secret_context); const std::string validation_yaml = R"EOF( name: "abc.com.validation" validation_context: trusted_ca: inline_string: "DUMMY_INLINE_STRING_TRUSTED_CA" )EOF"; TestUtility::loadFromYaml(TestEnvironment::substitute(validation_yaml), typed_secret); const auto decoded_resources_2 = TestUtility::decodeResources({typed_secret}); init_target_handle->initialize(init_watcher); secret_context.cluster_manager_.subscription_factory_.callbacks_->onConfigUpdate( decoded_resources_2.refvec_, "validation-context-v1"); Ssl::CertificateValidationContextConfigImpl cert_validation_context( *context_secret_provider->secret(), *api_); EXPECT_EQ("DUMMY_INLINE_STRING_TRUSTED_CA", cert_validation_context.caCert()); const std::string updated_config_dump = R"EOF( dynamic_active_secrets: - name: "abc.com" version_info: "keycert-v1" last_updated: seconds: 1234567891 nanos: 234000000 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com" tls_certificate: certificate_chain: inline_string: "DUMMY_INLINE_BYTES_FOR_CERT_CHAIN" private_key: inline_string: "[redacted]" password: inline_string: "[redacted]" - name: "abc.com.validation" version_info: "validation-context-v1" last_updated: seconds: 1234567899 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com.validation" validation_context: trusted_ca: inline_string: "DUMMY_INLINE_STRING_TRUSTED_CA" )EOF"; checkConfigDump(updated_config_dump); EXPECT_CALL(mock_matcher, match("abc.com")).WillOnce(Return(false)); EXPECT_CALL(mock_matcher, match("abc.com.validation")).WillOnce(Return(false)); checkConfigDump("{}", mock_matcher); // Add a dynamic tls session ticket encryption keys context provider. time_system_.setSystemTime(std::chrono::milliseconds(1234567899000)); auto stek_secret_provider = secret_manager->findOrCreateTlsSessionTicketKeysContextProvider( config_source, "abc.com.stek", secret_context); const std::string stek_yaml = R"EOF( name: "abc.com.stek" session_ticket_keys: keys: - filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ticket_key_a" - inline_string: "DUMMY_INLINE_STRING" - inline_bytes: "RFVNTVlfSU5MSU5FX0JZVEVT" )EOF"; TestUtility::loadFromYaml(TestEnvironment::substitute(stek_yaml), typed_secret); const auto decoded_resources_3 = TestUtility::decodeResources({typed_secret}); init_target_handle->initialize(init_watcher); secret_context.cluster_manager_.subscription_factory_.callbacks_->onConfigUpdate( decoded_resources_3.refvec_, "stek-context-v1"); EXPECT_EQ(stek_secret_provider->secret()->keys()[1].inline_string(), "DUMMY_INLINE_STRING"); const std::string updated_once_more_config_dump = R"EOF( dynamic_active_secrets: - name: "abc.com" version_info: "keycert-v1" last_updated: seconds: 1234567891 nanos: 234000000 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com" tls_certificate: certificate_chain: inline_string: "DUMMY_INLINE_BYTES_FOR_CERT_CHAIN" private_key: inline_string: "[redacted]" password: inline_string: "[redacted]" - name: "abc.com.validation" version_info: "validation-context-v1" last_updated: seconds: 1234567899 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com.validation" validation_context: trusted_ca: inline_string: "DUMMY_INLINE_STRING_TRUSTED_CA" - name: "abc.com.stek" version_info: "stek-context-v1" last_updated: seconds: 1234567899 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com.stek" session_ticket_keys: keys: - filename: "[redacted]" - inline_string: "[redacted]" - inline_bytes: "W3JlZGFjdGVkXQ==" )EOF"; checkConfigDump(TestEnvironment::substitute(updated_once_more_config_dump)); EXPECT_CALL(mock_matcher, match("abc.com")).WillOnce(Return(false)); EXPECT_CALL(mock_matcher, match("abc.com.validation")).WillOnce(Return(false)); EXPECT_CALL(mock_matcher, match("abc.com.stek")).WillOnce(Return(false)); checkConfigDump("{}", mock_matcher); // Add a dynamic generic secret provider. time_system_.setSystemTime(std::chrono::milliseconds(1234567900000)); auto generic_secret_provider = secret_manager->findOrCreateGenericSecretProvider( config_source, "signing_key", secret_context); const std::string generic_secret_yaml = R"EOF( name: "signing_key" generic_secret: secret: inline_string: "DUMMY_ECDSA_KEY" )EOF"; TestUtility::loadFromYaml(TestEnvironment::substitute(generic_secret_yaml), typed_secret); const auto decoded_resources_4 = TestUtility::decodeResources({typed_secret}); init_target_handle->initialize(init_watcher); secret_context.cluster_manager_.subscription_factory_.callbacks_->onConfigUpdate( decoded_resources_4.refvec_, "signing-key-v1"); const envoy::extensions::transport_sockets::tls::v3::GenericSecret generic_secret( *generic_secret_provider->secret()); EXPECT_EQ("DUMMY_ECDSA_KEY", generic_secret.secret().inline_string()); const std::string config_dump_with_generic_secret = R"EOF( dynamic_active_secrets: - name: "abc.com" version_info: "keycert-v1" last_updated: seconds: 1234567891 nanos: 234000000 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com" tls_certificate: certificate_chain: inline_string: "DUMMY_INLINE_BYTES_FOR_CERT_CHAIN" private_key: inline_string: "[redacted]" password: inline_string: "[redacted]" - name: "abc.com.validation" version_info: "validation-context-v1" last_updated: seconds: 1234567899 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com.validation" validation_context: trusted_ca: inline_string: "DUMMY_INLINE_STRING_TRUSTED_CA" - name: "abc.com.stek" version_info: "stek-context-v1" last_updated: seconds: 1234567899 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com.stek" session_ticket_keys: keys: - filename: "[redacted]" - inline_string: "[redacted]" - inline_bytes: "W3JlZGFjdGVkXQ==" - name: "signing_key" version_info: "signing-key-v1" last_updated: seconds: 1234567900 secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "signing_key" generic_secret: secret: inline_string: "[redacted]" )EOF"; checkConfigDump(TestEnvironment::substitute(config_dump_with_generic_secret)); EXPECT_CALL(mock_matcher, match("abc.com")).WillOnce(Return(false)); EXPECT_CALL(mock_matcher, match("abc.com.validation")).WillOnce(Return(false)); EXPECT_CALL(mock_matcher, match("abc.com.stek")).WillOnce(Return(false)); EXPECT_CALL(mock_matcher, match("signing_key")).WillOnce(Return(false)); checkConfigDump("{}", mock_matcher); }
0
342,147
static int int_pow(int i, int *exp_ptr) { int e, er, eq, j; int a, a1; /* renormalize */ a = i; e = POW_FRAC_BITS; while (a < (1 << (POW_FRAC_BITS - 1))) { a = a << 1; e--; } a -= (1 << POW_FRAC_BITS); a1 = 0; for(j = DEV_ORDER - 1; j >= 0; j--) a1 = POW_MULL(a, dev_4_3_coefs[j] + a1); a = (1 << POW_FRAC_BITS) + a1; /* exponent compute (exact) */ e = e * 4; er = e % 3; eq = e / 3; a = POW_MULL(a, pow_mult3[er]); while (a >= 2 * POW_FRAC_ONE) { a = a >> 1; eq++; } /* convert to float */ while (a < POW_FRAC_ONE) { a = a << 1; eq--; } /* now POW_FRAC_ONE <= a < 2 * POW_FRAC_ONE */ #if (POW_FRAC_BITS - 1) > FRAC_BITS a = (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS); /* correct overflow */ if (a >= 2 * (1 << FRAC_BITS)) { a = a >> 1; eq++; } #endif *exp_ptr = eq; return a; }
1
42,355
static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc, struct nfs_entry *entry, struct page **xdr_pages, unsigned int buflen, struct page **arrays, size_t narrays) { struct address_space *mapping = desc->file->f_mapping; struct xdr_stream stream; struct xdr_buf buf; struct page *scratch, *new, *page = *arrays; int status; scratch = alloc_page(GFP_KERNEL); if (scratch == NULL) return -ENOMEM; xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen); xdr_set_scratch_page(&stream, scratch); do { if (entry->fattr->label) entry->fattr->label->len = NFS4_MAXLABELLEN; status = xdr_decode(desc, entry, &stream); if (status != 0) break; if (desc->plus) nfs_prime_dcache(file_dentry(desc->file), entry, desc->dir_verifier); status = nfs_readdir_add_to_array(entry, page); if (status != -ENOSPC) continue; if (page->mapping != mapping) { if (!--narrays) break; new = nfs_readdir_page_array_alloc(entry->prev_cookie, GFP_KERNEL); if (!new) break; arrays++; *arrays = page = new; } else { new = nfs_readdir_page_get_next(mapping, page->index + 1, entry->prev_cookie); if (!new) break; if (page != *arrays) nfs_readdir_page_unlock_and_put(page); page = new; } status = nfs_readdir_add_to_array(entry, page); } while (!status && !entry->eof); switch (status) { case -EBADCOOKIE: if (entry->eof) { nfs_readdir_page_set_eof(page); status = 0; } break; case -ENOSPC: case -EAGAIN: status = 0; break; } if (page != *arrays) nfs_readdir_page_unlock_and_put(page); put_page(scratch); return status; }
0
389,490
_encode(ImagingEncoderObject* encoder, PyObject* args) { PyObject* buf; PyObject* result; int status; /* Encode to a Python string (allocated by this method) */ int bufsize = 16384; if (!PyArg_ParseTuple(args, "|i", &bufsize)) return NULL; buf = PyBytes_FromStringAndSize(NULL, bufsize); if (!buf) return NULL; status = encoder->encode(encoder->im, &encoder->state, (UINT8*) PyBytes_AsString(buf), bufsize); /* adjust string length to avoid slicing in encoder */ if (_PyBytes_Resize(&buf, (status > 0) ? status : 0) < 0) return NULL; result = Py_BuildValue("iiO", status, encoder->state.errcode, buf); Py_DECREF(buf); /* must release buffer!!! */ return result; }
0
160,385
static inline bool rom_order_compare(Rom *rom, Rom *item) { return ((uintptr_t)(void *)rom->as > (uintptr_t)(void *)item->as) || (rom->as == item->as && rom->addr >= item->addr); }
0
87,117
#ifndef GPAC_DISABLE_ISOM_WRITE GF_Err tsro_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_TimeOffHintEntryBox *ptr = (GF_TimeOffHintEntryBox *)s; if (ptr == NULL) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->TimeOffset); return GF_OK;
0
210,871
void BrowserWindowGtk::Close() { if (!window_) return; if (!CanClose()) return; tabstrip_->StopAnimation(); SaveWindowPosition(); if (accel_group_) { AcceleratorsGtk* accelerators = AcceleratorsGtk::GetInstance(); for (AcceleratorsGtk::const_iterator iter = accelerators->begin(); iter != accelerators->end(); ++iter) { gtk_accel_group_disconnect_key(accel_group_, iter->second.GetGdkKeyCode(), static_cast<GdkModifierType>(iter->second.modifiers())); } gtk_window_remove_accel_group(window_, accel_group_); g_object_unref(accel_group_); accel_group_ = NULL; } window_configure_debounce_timer_.Stop(); loading_animation_timer_.Stop(); GtkWidget* window = GTK_WIDGET(window_); window_ = NULL; window_has_shown_ = false; titlebar_->set_window(NULL); global_menu_bar_->Disable(); gtk_widget_destroy(window); }
0
115,951
QUInt8(const uint8_t v) : value(v) {}
0
273,937
bson_iter_key (const bson_iter_t *iter) /* IN */ { BSON_ASSERT (iter); return bson_iter_key_unsafe (iter); }
0
172,501
Browser::~Browser() { registrar_.RemoveAll(); extension_registry_observer_.RemoveAll(); DCHECK(tab_strip_model_->empty()); tab_strip_model_->RemoveObserver(this); bubble_manager_.reset(); command_controller_.reset(); BrowserList::RemoveBrowser(this); int num_downloads; if (!browser_defaults::kBrowserAliveWithNoWindows && OkToCloseWithInProgressDownloads(&num_downloads) == DOWNLOAD_CLOSE_BROWSER_SHUTDOWN) { DownloadCoreService::CancelAllDownloads(); } SessionService* session_service = SessionServiceFactory::GetForProfile(profile_); if (session_service) session_service->WindowClosed(session_id_); sessions::TabRestoreService* tab_restore_service = TabRestoreServiceFactory::GetForProfile(profile()); if (tab_restore_service) tab_restore_service->BrowserClosed(live_tab_context()); profile_pref_registrar_.RemoveAll(); extension_window_controller_.reset(); instant_controller_.reset(); if (profile_->IsOffTheRecord() && profile_->GetOriginalProfile()->HasOffTheRecordProfile() && profile_->GetOriginalProfile()->GetOffTheRecordProfile() == profile_ && !BrowserList::IsIncognitoSessionActiveForProfile(profile_) && !profile_->GetOriginalProfile()->IsSystemProfile()) { if (profile_->IsGuestSession()) { #if !defined(OS_CHROMEOS) profiles::RemoveBrowsingDataForProfile(profile_->GetPath()); #endif } else { #if BUILDFLAG(ENABLE_PRINT_PREVIEW) g_browser_process->background_printing_manager() ->DeletePreviewContentsForBrowserContext(profile_); #endif ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); } } if (select_file_dialog_.get()) select_file_dialog_->ListenerDestroyed(); }
0
408,433
string_isupper(PyStringObject *self) { register const unsigned char *p = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; int cased; /* Shortcut for single character strings */ if (PyString_GET_SIZE(self) == 1) return PyBool_FromLong(isupper(*p) != 0); /* Special case for empty strings */ if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); e = p + PyString_GET_SIZE(self); cased = 0; for (; p < e; p++) { if (islower(*p)) return PyBool_FromLong(0); else if (!cased && isupper(*p)) cased = 1; } return PyBool_FromLong(cased); }
0
96,076
mrb_obj_new(mrb_state *mrb, struct RClass *c, mrb_int argc, const mrb_value *argv) { mrb_value obj; mrb_sym mid; obj = mrb_instance_alloc(mrb, mrb_obj_value(c)); mid = MRB_SYM(initialize); if (!mrb_func_basic_p(mrb, obj, mid, mrb_do_nothing)) { mrb_funcall_argv(mrb, obj, mid, argc, argv); } return obj; }
0
483,419
static void *cgroup_idr_replace(struct idr *idr, void *ptr, int id) { void *ret; spin_lock_bh(&cgroup_idr_lock); ret = idr_replace(idr, ptr, id); spin_unlock_bh(&cgroup_idr_lock); return ret; }
0
202,297
RenderFrameHostImpl::GetFindInPage() { if (!find_in_page_ || !find_in_page_.is_bound() || find_in_page_.encountered_error()) GetRemoteAssociatedInterfaces()->GetInterface(&find_in_page_); return find_in_page_; }
0
492,096
backup_cleanup() { free(mysql_binlog_position); free(buffer_pool_filename); free(backup_uuid); backup_uuid = NULL; if (mysql_connection) { mysql_close(mysql_connection); } }
0
167,370
void BlobStorageContext::NotifyTransportComplete(const std::string& uuid) { BlobEntry* entry = registry_.GetEntry(uuid); CHECK(entry) << "There is no blob entry with uuid " << uuid; DCHECK(BlobStatusIsPending(entry->status())); NotifyTransportCompleteInternal(entry); }
0
99,240
PHP_FUNCTION(imagecolorresolvealpha) { zval *IM; long red, green, blue, alpha; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); RETURN_LONG(gdImageColorResolveAlpha(im, red, green, blue, alpha)); }
0
10,458
qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, GNode * stbl) { int offset; GNode *stsc; GNode *stsz; GNode *stco; GNode *co64; GNode *stts; GNode *stss; GNode *ctts; const guint8 *stsc_data, *stsz_data, *stco_data; int sample_size; int sample_index; int n_samples; int n_samples_per_chunk; int n_sample_times; QtDemuxSample *samples; gint i, j, k; int index; guint64 timestamp, time; /* sample to chunk */ if (!(stsc = qtdemux_tree_get_child_by_type (stbl, FOURCC_stsc))) goto corrupt_file; stsc_data = (const guint8 *) stsc->data; /* sample size */ if (!(stsz = qtdemux_tree_get_child_by_type (stbl, FOURCC_stsz))) goto corrupt_file; stsz_data = (const guint8 *) stsz->data; /* chunk offsets */ stco = qtdemux_tree_get_child_by_type (stbl, FOURCC_stco); co64 = qtdemux_tree_get_child_by_type (stbl, FOURCC_co64); if (stco) { stco_data = (const guint8 *) stco->data; } else { stco_data = NULL; if (co64 == NULL) goto corrupt_file; } /* sample time */ if (!(stts = qtdemux_tree_get_child_by_type (stbl, FOURCC_stts))) goto corrupt_file; /* sample sync, can be NULL */ stss = qtdemux_tree_get_child_by_type (stbl, FOURCC_stss); sample_size = QT_UINT32 (stsz_data + 12); if (sample_size == 0 || stream->sampled) { n_samples = QT_UINT32 (stsz_data + 16); GST_DEBUG_OBJECT (qtdemux, "stsz sample_size 0, allocating n_samples %d", n_samples); stream->n_samples = n_samples; samples = g_new0 (QtDemuxSample, n_samples); stream->samples = samples; for (i = 0; i < n_samples; i++) { if (sample_size == 0) samples[i].size = QT_UINT32 (stsz_data + i * 4 + 20); else samples[i].size = sample_size; GST_LOG_OBJECT (qtdemux, "sample %d has size %d", i, samples[i].size); /* init other fields to defaults for this sample */ samples[i].keyframe = FALSE; } n_samples_per_chunk = QT_UINT32 (stsc_data + 12); index = 0; for (i = 0; i < n_samples_per_chunk; i++) { guint32 first_chunk, last_chunk; guint32 samples_per_chunk; first_chunk = QT_UINT32 (stsc_data + 16 + i * 12 + 0) - 1; if (i == n_samples_per_chunk - 1) { last_chunk = G_MAXUINT32; } else { last_chunk = QT_UINT32 (stsc_data + 16 + i * 12 + 12) - 1; } samples_per_chunk = QT_UINT32 (stsc_data + 16 + i * 12 + 4); for (j = first_chunk; j < last_chunk; j++) { guint64 chunk_offset; if (stco) { chunk_offset = QT_UINT32 (stco_data + 16 + j * 4); } else { chunk_offset = QT_UINT64 ((guint8 *) co64->data + 16 + j * 8); } for (k = 0; k < samples_per_chunk; k++) { GST_LOG_OBJECT (qtdemux, "Creating entry %d with offset %lld", index, chunk_offset); samples[index].chunk = j; samples[index].offset = chunk_offset; chunk_offset += samples[index].size; index++; if (index >= n_samples) goto done2; } } } done2: n_sample_times = QT_UINT32 ((guint8 *) stts->data + 12); timestamp = 0; stream->min_duration = 0; time = 0; index = 0; for (i = 0; i < n_sample_times; i++) { guint32 n; guint32 duration; n = QT_UINT32 ((guint8 *) stts->data + 16 + 8 * i); duration = QT_UINT32 ((guint8 *) stts->data + 16 + 8 * i + 4); for (j = 0; j < n; j++) { GST_DEBUG_OBJECT (qtdemux, "sample %d: timestamp %" GST_TIME_FORMAT, index, GST_TIME_ARGS (timestamp)); samples[index].timestamp = timestamp; /* take first duration for fps */ if (stream->min_duration == 0) stream->min_duration = duration; /* add non-scaled values to avoid rounding errors */ time += duration; timestamp = gst_util_uint64_scale (time, GST_SECOND, stream->timescale); samples[index].duration = timestamp - samples[index].timestamp; index++; } } if (stss) { /* mark keyframes */ guint32 n_sample_syncs; n_sample_syncs = QT_UINT32 ((guint8 *) stss->data + 12); if (n_sample_syncs == 0) { stream->all_keyframe = TRUE; } else { offset = 16; for (i = 0; i < n_sample_syncs; i++) { /* note that the first sample is index 1, not 0 */ index = QT_UINT32 ((guint8 *) stss->data + offset); if (index > 0) { samples[index - 1].keyframe = TRUE; offset += 4; } } } } else { /* no stss, all samples are keyframes */ stream->all_keyframe = TRUE; } } else { GST_DEBUG_OBJECT (qtdemux, "stsz sample_size %d != 0, treating chunks as samples", sample_size); /* treat chunks as samples */ if (stco) { n_samples = QT_UINT32 (stco_data + 12); } else { n_samples = QT_UINT32 ((guint8 *) co64->data + 12); } stream->n_samples = n_samples; GST_DEBUG_OBJECT (qtdemux, "allocating n_samples %d", n_samples); samples = g_new0 (QtDemuxSample, n_samples); stream->samples = samples; n_samples_per_chunk = QT_UINT32 (stsc_data + 12); GST_DEBUG_OBJECT (qtdemux, "n_samples_per_chunk %d", n_samples_per_chunk); sample_index = 0; timestamp = 0; for (i = 0; i < n_samples_per_chunk; i++) { guint32 first_chunk, last_chunk; guint32 samples_per_chunk; first_chunk = QT_UINT32 (stsc_data + 16 + i * 12 + 0) - 1; /* the last chunk of each entry is calculated by taking the first chunk * of the next entry; except if there is no next, where we fake it with * INT_MAX */ if (i == n_samples_per_chunk - 1) { last_chunk = G_MAXUINT32; } else { last_chunk = QT_UINT32 (stsc_data + 16 + i * 12 + 12) - 1; } samples_per_chunk = QT_UINT32 (stsc_data + 16 + i * 12 + 4); GST_LOG_OBJECT (qtdemux, "entry %d has first_chunk %d, last_chunk %d, samples_per_chunk %d", i, first_chunk, last_chunk, samples_per_chunk); for (j = first_chunk; j < last_chunk; j++) { guint64 chunk_offset; if (j >= n_samples) goto done; if (stco) { chunk_offset = QT_UINT32 (stco_data + 16 + j * 4); } else { chunk_offset = QT_UINT64 ((guint8 *) co64->data + 16 + j * 8); } GST_LOG_OBJECT (qtdemux, "Creating entry %d with offset %" G_GUINT64_FORMAT, j, chunk_offset); samples[j].chunk = j; samples[j].offset = chunk_offset; if (stream->samples_per_frame * stream->bytes_per_frame) { samples[j].size = (samples_per_chunk * stream->n_channels) / stream->samples_per_frame * stream->bytes_per_frame; } else { samples[j].size = samples_per_chunk; } GST_DEBUG_OBJECT (qtdemux, "sample %d: timestamp %" GST_TIME_FORMAT ", size %u", j, GST_TIME_ARGS (timestamp), samples[j].size); samples[j].timestamp = timestamp; sample_index += samples_per_chunk; timestamp = gst_util_uint64_scale (sample_index, GST_SECOND, stream->timescale); samples[j].duration = timestamp - samples[j].timestamp; samples[j].keyframe = TRUE; } } } /* composition time to sample */ if ((ctts = qtdemux_tree_get_child_by_type (stbl, FOURCC_ctts))) { const guint8 *ctts_data = (const guint8 *) ctts->data; guint32 n_entries = QT_UINT32 (ctts_data + 12); guint32 count; gint32 soffset; /* Fill in the pts_offsets */ for (i = 0, j = 0; (j < stream->n_samples) && (i < n_entries); i++) { count = QT_UINT32 (ctts_data + 16 + i * 8); soffset = QT_UINT32 (ctts_data + 20 + i * 8); for (k = 0; k < count; k++, j++) { /* we operate with very small soffset values here, it shouldn't overflow */ samples[j].pts_offset = soffset * GST_SECOND / stream->timescale; } } } done: return TRUE; /* ERRORS */ corrupt_file: { GST_ELEMENT_ERROR (qtdemux, STREAM, DECODE, (_("This file is corrupt and cannot be played.")), (NULL)); return FALSE; } }
1
272,208
//! Return pixel value, using cubic interpolation and mirror boundary conditions for the X and Y-coordinates. Tfloat cubic_atXY_p(const float fx, const float fy, const int z=0, const int c=0) const { if (is_empty()) throw CImgInstanceException(_cimg_instance "cubic_atXY_p(): Empty instance.", cimg_instance); return _cubic_atXY_p(fx,fy,z,c);
0
447,229
int efi_mem_type(unsigned long phys_addr) { const efi_memory_desc_t *md; if (!efi_enabled(EFI_MEMMAP)) return -ENOTSUPP; for_each_efi_memory_desc(md) { if ((md->phys_addr <= phys_addr) && (phys_addr < (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT)))) return md->type; } return -EINVAL; }
0
409,797
static int __skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len, unsigned int recursion_level) { int start = skb_headlen(skb); int i, copy = start - offset; struct sk_buff *frag_iter; int elt = 0; if (unlikely(recursion_level >= 24)) return -EMSGSIZE; if (copy > 0) { if (copy > len) copy = len; sg_set_buf(sg, skb->data + offset, copy); elt++; if ((len -= copy) == 0) return elt; offset += copy; } for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { int end; WARN_ON(start > offset + len); end = start + skb_frag_size(&skb_shinfo(skb)->frags[i]); if ((copy = end - offset) > 0) { skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; if (unlikely(elt && sg_is_last(&sg[elt - 1]))) return -EMSGSIZE; if (copy > len) copy = len; sg_set_page(&sg[elt], skb_frag_page(frag), copy, frag->page_offset+offset-start); elt++; if (!(len -= copy)) return elt; offset += copy; } start = end; } skb_walk_frags(skb, frag_iter) { int end, ret; WARN_ON(start > offset + len); end = start + frag_iter->len; if ((copy = end - offset) > 0) { if (unlikely(elt && sg_is_last(&sg[elt - 1]))) return -EMSGSIZE; if (copy > len) copy = len; ret = __skb_to_sgvec(frag_iter, sg+elt, offset - start, copy, recursion_level + 1); if (unlikely(ret < 0)) return ret; elt += ret; if ((len -= copy) == 0) return elt; offset += copy; } start = end; } BUG_ON(len); return elt;
0
284,058
launch_login(struct passwd *pw, const char *hostname) { /* Launch login(1). */ execl(LOGIN_PROGRAM, "login", "-h", hostname, #ifdef xxxLOGIN_NEEDS_TERM (s->term ? s->term : "unknown"), #endif /* LOGIN_NEEDS_TERM */ #ifdef LOGIN_NO_ENDOPT "-p", "-f", pw->pw_name, (char *)NULL); #else "-p", "-f", "--", pw->pw_name, (char *)NULL); #endif /* Login couldn't be executed, die. */ perror("login"); exit(1); }
0
432,089
static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event) { time_t current; tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; if(event) *event = TFTP_EVENT_NONE; time(&current); if(current > state->max_time) { DEBUGF(infof(conn->data, "timeout: %ld > %ld\n", (long)current, (long)state->max_time)); state->error = TFTP_ERR_TIMEOUT; state->state = TFTP_STATE_FIN; return 0; } if(current > state->rx_time + state->retry_time) { if(event) *event = TFTP_EVENT_TIMEOUT; time(&state->rx_time); /* update even though we received nothing */ } /* there's a typecast below here since 'time_t' may in fact be larger than 'long', but we estimate that a 'long' will still be able to hold number of seconds even if "only" 32 bit */ return (long)(state->max_time - current); }
0
315,531
void DTLS_RECORD_LAYER_set_saved_w_epoch(RECORD_LAYER *rl, unsigned short e) { if (e == rl->d->w_epoch - 1) { memcpy(rl->d->curr_write_sequence, rl->write_sequence, sizeof(rl->write_sequence)); memcpy(rl->write_sequence, rl->d->last_write_sequence, sizeof(rl->write_sequence)); } else if (e == rl->d->w_epoch + 1) { memcpy(rl->d->last_write_sequence, rl->write_sequence, sizeof(unsigned char[8])); memcpy(rl->write_sequence, rl->d->curr_write_sequence, sizeof(rl->write_sequence)); } rl->d->w_epoch = e; }
0
348,152
ks_http_fetch (ctrl_t ctrl, const char *url, unsigned int flags, estream_t *r_fp) { gpg_error_t err; http_session_t session = NULL; unsigned int session_flags; http_t http = NULL; int redirects_left = MAX_REDIRECTS; estream_t fp = NULL; char *request_buffer = NULL; parsed_uri_t uri = NULL; int is_onion, is_https; err = http_parse_uri (&uri, url, 0); if (err) goto leave; is_onion = uri->onion; is_https = uri->use_tls; /* By default we only use the system provided certificates with this * fetch command. */ session_flags = HTTP_FLAG_TRUST_SYS; if ((flags & KS_HTTP_FETCH_NO_CRL) || ctrl->http_no_crl) session_flags |= HTTP_FLAG_NO_CRL; if ((flags & KS_HTTP_FETCH_TRUST_CFG)) session_flags |= HTTP_FLAG_TRUST_CFG; once_more: err = http_session_new (&session, NULL, session_flags, gnupg_http_tls_verify_cb, ctrl); if (err) goto leave; http_session_set_log_cb (session, cert_log_cb); http_session_set_timeout (session, ctrl->timeout); *r_fp = NULL; err = http_open (&http, HTTP_REQ_GET, url, /* httphost */ NULL, /* fixme: AUTH */ NULL, ((opt.honor_http_proxy? HTTP_FLAG_TRY_PROXY:0) | (DBG_LOOKUP? HTTP_FLAG_LOG_RESP:0) | (dirmngr_use_tor ()? HTTP_FLAG_FORCE_TOR:0) | (opt.disable_ipv4? HTTP_FLAG_IGNORE_IPv4 : 0) | (opt.disable_ipv6? HTTP_FLAG_IGNORE_IPv6 : 0)), ctrl->http_proxy, session, NULL, /*FIXME curl->srvtag*/NULL); if (!err) { fp = http_get_write_ptr (http); /* Avoid caches to get the most recent copy of the key. We set * both the Pragma and Cache-Control versions of the header, so * we're good with both HTTP 1.0 and 1.1. */ if ((flags & KS_HTTP_FETCH_NOCACHE)) es_fputs ("Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n", fp); http_start_data (http); if (es_ferror (fp)) err = gpg_error_from_syserror (); } if (err) { /* Fixme: After a redirection we show the old host name. */ log_error (_("error connecting to '%s': %s\n"), url, gpg_strerror (err)); goto leave; } /* Wait for the response. */ dirmngr_tick (ctrl); err = http_wait_response (http); if (err) { log_error (_("error reading HTTP response for '%s': %s\n"), url, gpg_strerror (err)); goto leave; } switch (http_get_status_code (http)) { case 200: err = 0; break; /* Success. */ case 301: case 302: case 307: { const char *s = http_get_header (http, "Location"); log_info (_("URL '%s' redirected to '%s' (%u)\n"), url, s?s:"[none]", http_get_status_code (http)); if (s && *s && redirects_left-- ) { if (is_onion || is_https) { /* Make sure that an onion address only redirects to * another onion address, or that a https address * only redirects to a https address. */ http_release_parsed_uri (uri); uri = NULL; err = http_parse_uri (&uri, s, 0); if (err) goto leave; if (is_onion && !uri->onion) { err = gpg_error (GPG_ERR_FORBIDDEN); goto leave; } if (!(flags & KS_HTTP_FETCH_ALLOW_DOWNGRADE) && is_https && !uri->use_tls) { err = gpg_error (GPG_ERR_FORBIDDEN); goto leave; } } xfree (request_buffer); request_buffer = xtrystrdup (s); if (request_buffer) { url = request_buffer; http_close (http, 0); http = NULL; http_session_release (session); goto once_more; } err = gpg_error_from_syserror (); } else err = gpg_error (GPG_ERR_NO_DATA); log_error (_("too many redirections\n")); } goto leave; default: log_error (_("error accessing '%s': http status %u\n"), url, http_get_status_code (http)); err = gpg_error (GPG_ERR_NO_DATA); goto leave; } fp = http_get_read_ptr (http); if (!fp) { err = gpg_error (GPG_ERR_BUG); goto leave; } /* Return the read stream and close the HTTP context. */ *r_fp = fp; http_close (http, 1); http = NULL; leave: http_close (http, 0); http_session_release (session); xfree (request_buffer); http_release_parsed_uri (uri); return err; }
1
63,838
static int jit_subprogs(struct bpf_verifier_env *env) { struct bpf_prog *prog = env->prog, **func, *tmp; int i, j, subprog_start, subprog_end = 0, len, subprog; struct bpf_insn *insn; void *old_bpf_func; int err = -ENOMEM; if (env->subprog_cnt <= 1) return 0; for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { if (insn->code != (BPF_JMP | BPF_CALL) || insn->src_reg != BPF_PSEUDO_CALL) continue; /* Upon error here we cannot fall back to interpreter but * need a hard reject of the program. Thus -EFAULT is * propagated in any case. */ subprog = find_subprog(env, i + insn->imm + 1); if (subprog < 0) { WARN_ONCE(1, "verifier bug. No program starts at insn %d\n", i + insn->imm + 1); return -EFAULT; } /* temporarily remember subprog id inside insn instead of * aux_data, since next loop will split up all insns into funcs */ insn->off = subprog; /* remember original imm in case JIT fails and fallback * to interpreter will be needed */ env->insn_aux_data[i].call_imm = insn->imm; /* point imm to __bpf_call_base+1 from JITs point of view */ insn->imm = 1; } func = kcalloc(env->subprog_cnt, sizeof(prog), GFP_KERNEL); if (!func) goto out_undo_insn; for (i = 0; i < env->subprog_cnt; i++) { subprog_start = subprog_end; subprog_end = env->subprog_info[i + 1].start; len = subprog_end - subprog_start; func[i] = bpf_prog_alloc(bpf_prog_size(len), GFP_USER); if (!func[i]) goto out_free; memcpy(func[i]->insnsi, &prog->insnsi[subprog_start], len * sizeof(struct bpf_insn)); func[i]->type = prog->type; func[i]->len = len; if (bpf_prog_calc_tag(func[i])) goto out_free; func[i]->is_func = 1; /* Use bpf_prog_F_tag to indicate functions in stack traces. * Long term would need debug info to populate names */ func[i]->aux->name[0] = 'F'; func[i]->aux->stack_depth = env->subprog_info[i].stack_depth; func[i]->jit_requested = 1; func[i] = bpf_int_jit_compile(func[i]); if (!func[i]->jited) { err = -ENOTSUPP; goto out_free; } cond_resched(); } /* at this point all bpf functions were successfully JITed * now populate all bpf_calls with correct addresses and * run last pass of JIT */ for (i = 0; i < env->subprog_cnt; i++) { insn = func[i]->insnsi; for (j = 0; j < func[i]->len; j++, insn++) { if (insn->code != (BPF_JMP | BPF_CALL) || insn->src_reg != BPF_PSEUDO_CALL) continue; subprog = insn->off; insn->imm = (u64 (*)(u64, u64, u64, u64, u64)) func[subprog]->bpf_func - __bpf_call_base; } /* we use the aux data to keep a list of the start addresses * of the JITed images for each function in the program * * for some architectures, such as powerpc64, the imm field * might not be large enough to hold the offset of the start * address of the callee's JITed image from __bpf_call_base * * in such cases, we can lookup the start address of a callee * by using its subprog id, available from the off field of * the call instruction, as an index for this list */ func[i]->aux->func = func; func[i]->aux->func_cnt = env->subprog_cnt; } for (i = 0; i < env->subprog_cnt; i++) { old_bpf_func = func[i]->bpf_func; tmp = bpf_int_jit_compile(func[i]); if (tmp != func[i] || func[i]->bpf_func != old_bpf_func) { verbose(env, "JIT doesn't support bpf-to-bpf calls\n"); err = -ENOTSUPP; goto out_free; } cond_resched(); } /* finally lock prog and jit images for all functions and * populate kallsysm */ for (i = 0; i < env->subprog_cnt; i++) { bpf_prog_lock_ro(func[i]); bpf_prog_kallsyms_add(func[i]); } /* Last step: make now unused interpreter insns from main * prog consistent for later dump requests, so they can * later look the same as if they were interpreted only. */ for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { if (insn->code != (BPF_JMP | BPF_CALL) || insn->src_reg != BPF_PSEUDO_CALL) continue; insn->off = env->insn_aux_data[i].call_imm; subprog = find_subprog(env, i + insn->off + 1); insn->imm = subprog; } prog->jited = 1; prog->bpf_func = func[0]->bpf_func; prog->aux->func = func; prog->aux->func_cnt = env->subprog_cnt; return 0; out_free: for (i = 0; i < env->subprog_cnt; i++) if (func[i]) bpf_jit_free(func[i]); kfree(func); out_undo_insn: /* cleanup main prog to be interpreted */ prog->jit_requested = 0; for (i = 0, insn = prog->insnsi; i < prog->len; i++, insn++) { if (insn->code != (BPF_JMP | BPF_CALL) || insn->src_reg != BPF_PSEUDO_CALL) continue; insn->off = 0; insn->imm = env->insn_aux_data[i].call_imm; } return err; }
0
1,888
static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_kpp rkpp; strlcpy(rkpp.type, "kpp", sizeof(rkpp.type)); if (nla_put(skb, CRYPTOCFGA_REPORT_KPP, sizeof(struct crypto_report_kpp), &rkpp)) goto nla_put_failure; return 0; nla_put_failure: return -EMSGSIZE; }
1
111,599
static int descriptors_changed(struct usb_device *udev, struct usb_device_descriptor *old_device_descriptor, struct usb_host_bos *old_bos) { int changed = 0; unsigned index; unsigned serial_len = 0; unsigned len; unsigned old_length; int length; char *buf; if (memcmp(&udev->descriptor, old_device_descriptor, sizeof(*old_device_descriptor)) != 0) return 1; if ((old_bos && !udev->bos) || (!old_bos && udev->bos)) return 1; if (udev->bos) { len = le16_to_cpu(udev->bos->desc->wTotalLength); if (len != le16_to_cpu(old_bos->desc->wTotalLength)) return 1; if (memcmp(udev->bos->desc, old_bos->desc, len)) return 1; } /* Since the idVendor, idProduct, and bcdDevice values in the * device descriptor haven't changed, we will assume the * Manufacturer and Product strings haven't changed either. * But the SerialNumber string could be different (e.g., a * different flash card of the same brand). */ if (udev->serial) serial_len = strlen(udev->serial) + 1; len = serial_len; for (index = 0; index < udev->descriptor.bNumConfigurations; index++) { old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); len = max(len, old_length); } buf = kmalloc(len, GFP_NOIO); if (!buf) /* assume the worst */ return 1; for (index = 0; index < udev->descriptor.bNumConfigurations; index++) { old_length = le16_to_cpu(udev->config[index].desc.wTotalLength); length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf, old_length); if (length != old_length) { dev_dbg(&udev->dev, "config index %d, error %d\n", index, length); changed = 1; break; } if (memcmp(buf, udev->rawdescriptors[index], old_length) != 0) { dev_dbg(&udev->dev, "config index %d changed (#%d)\n", index, ((struct usb_config_descriptor *) buf)-> bConfigurationValue); changed = 1; break; } } if (!changed && serial_len) { length = usb_string(udev, udev->descriptor.iSerialNumber, buf, serial_len); if (length + 1 != serial_len) { dev_dbg(&udev->dev, "serial string error %d\n", length); changed = 1; } else if (memcmp(buf, udev->serial, length) != 0) { dev_dbg(&udev->dev, "serial string changed\n"); changed = 1; } } kfree(buf); return changed; }
0
442,540
static bool rbuf_alloc(conn *c) { if (c->rbuf == NULL) { c->rbuf = do_cache_alloc(c->thread->rbuf_cache); if (!c->rbuf) { THR_STATS_LOCK(c); c->thread->stats.read_buf_oom++; THR_STATS_UNLOCK(c); return false; } c->rsize = READ_BUFFER_SIZE; c->rcurr = c->rbuf; } return true; }
0
269,259
void HeaderMapImpl::addReferenceKey(const LowerCaseString& key, uint64_t value) { HeaderString ref_key(key); HeaderString new_value; new_value.setInteger(value); insertByKey(std::move(ref_key), std::move(new_value)); ASSERT(new_value.empty()); // NOLINT(bugprone-use-after-move) }
0
210,622
RTCPeerConnectionHandler::GetConfiguration() const { return configuration_; }
0
440,225
add_ctype_to_cc(CClassNode* cc, int ctype, int not, ScanEnv* env) { #define ASCII_LIMIT 127 int c, r; int ascii_mode; int is_single; const OnigCodePoint *ranges; OnigCodePoint limit; OnigCodePoint sb_out; OnigEncoding enc = env->enc; ascii_mode = IS_ASCII_MODE_CTYPE_OPTION(ctype, env->options); r = ONIGENC_GET_CTYPE_CODE_RANGE(enc, ctype, &sb_out, &ranges); if (r == 0) { if (ascii_mode == 0) r = add_ctype_to_cc_by_range(cc, ctype, not, env->enc, sb_out, ranges); else r = add_ctype_to_cc_by_range_limit(cc, ctype, not, env->enc, sb_out, ranges, ASCII_LIMIT); return r; } else if (r != ONIG_NO_SUPPORT_CONFIG) { return r; } r = 0; is_single = ONIGENC_IS_SINGLEBYTE(enc); limit = ascii_mode ? ASCII_LIMIT : SINGLE_BYTE_SIZE; switch (ctype) { case ONIGENC_CTYPE_ALPHA: case ONIGENC_CTYPE_BLANK: case ONIGENC_CTYPE_CNTRL: case ONIGENC_CTYPE_DIGIT: case ONIGENC_CTYPE_LOWER: case ONIGENC_CTYPE_PUNCT: case ONIGENC_CTYPE_SPACE: case ONIGENC_CTYPE_UPPER: case ONIGENC_CTYPE_XDIGIT: case ONIGENC_CTYPE_ASCII: case ONIGENC_CTYPE_ALNUM: if (not != 0) { for (c = 0; c < (int )limit; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) { if (! ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } } for (c = limit; c < SINGLE_BYTE_SIZE; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) BITSET_SET_BIT(cc->bs, c); } if (is_single == 0) ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf); } else { for (c = 0; c < (int )limit; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) { if (ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } } } break; case ONIGENC_CTYPE_GRAPH: case ONIGENC_CTYPE_PRINT: case ONIGENC_CTYPE_WORD: if (not != 0) { for (c = 0; c < (int )limit; c++) { /* check invalid code point */ if ((is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) && ! ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } for (c = limit; c < SINGLE_BYTE_SIZE; c++) { if (is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) BITSET_SET_BIT(cc->bs, c); } if (ascii_mode != 0 && is_single == 0) ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf); } else { for (c = 0; c < (int )limit; c++) { if ((is_single != 0 || ONIGENC_CODE_TO_MBCLEN(enc, c) == 1) && ONIGENC_IS_CODE_CTYPE(enc, (OnigCodePoint )c, ctype)) BITSET_SET_BIT(cc->bs, c); } if (ascii_mode == 0 && is_single == 0) ADD_ALL_MULTI_BYTE_RANGE(enc, cc->mbuf); } break; default: return ONIGERR_PARSER_BUG; break; } return r; }
0
388,034
start_conversation (GdmSession *self, const char *service_name) { GdmSessionConversation *conversation; char *job_name; conversation = g_new0 (GdmSessionConversation, 1); conversation->session = g_object_ref (self); conversation->service_name = g_strdup (service_name); conversation->worker_pid = -1; conversation->job = gdm_session_worker_job_new (); gdm_session_worker_job_set_server_address (conversation->job, g_dbus_server_get_client_address (self->priv->worker_server)); gdm_session_worker_job_set_for_reauth (conversation->job, self->priv->verification_mode == GDM_SESSION_VERIFICATION_MODE_REAUTHENTICATE); if (self->priv->conversation_environment != NULL) { gdm_session_worker_job_set_environment (conversation->job, (const char * const *) self->priv->conversation_environment); } g_signal_connect (conversation->job, "started", G_CALLBACK (worker_started), conversation); g_signal_connect (conversation->job, "exited", G_CALLBACK (worker_exited), conversation); g_signal_connect (conversation->job, "died", G_CALLBACK (worker_died), conversation); job_name = g_strdup_printf ("gdm-session-worker [pam/%s]", service_name); if (!gdm_session_worker_job_start (conversation->job, job_name)) { g_object_unref (conversation->job); g_free (conversation->service_name); g_free (conversation); g_free (job_name); return NULL; } g_free (job_name); conversation->worker_pid = gdm_session_worker_job_get_pid (conversation->job); return conversation; }
0
104,909
static int vmx_cpu_uses_apicv(struct kvm_vcpu *vcpu) { return enable_apicv && lapic_in_kernel(vcpu); }
0
413,579
static void _rpc_prolog(slurm_msg_t *msg) { int rc = SLURM_SUCCESS; prolog_launch_msg_t *req = (prolog_launch_msg_t *)msg->data; job_env_t job_env; bool first_job_run; uid_t req_uid; if (req == NULL) return; req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); if (!_slurm_authorized_user(req_uid)) { error("REQUEST_LAUNCH_PROLOG request from uid %u", (unsigned int) req_uid); return; } if (!req->user_name) req->user_name = uid_to_string(req->uid); if (slurm_send_rc_msg(msg, rc) < 0) { error("Error starting prolog: %m"); } if (rc) { int term_sig, exit_status; if (WIFSIGNALED(rc)) { exit_status = 0; term_sig = WTERMSIG(rc); } else { exit_status = WEXITSTATUS(rc); term_sig = 0; } error("[job %u] prolog start failed status=%d:%d", req->job_id, exit_status, term_sig); rc = ESLURMD_PROLOG_FAILED; } slurm_mutex_lock(&prolog_mutex); first_job_run = !slurm_cred_jobid_cached(conf->vctx, req->job_id); if (first_job_run) { if (slurmctld_conf.prolog_flags & PROLOG_FLAG_CONTAIN) _make_prolog_mem_container(msg); if (container_g_create(req->job_id)) error("container_g_create(%u): %m", req->job_id); slurm_cred_insert_jobid(conf->vctx, req->job_id); _add_job_running_prolog(req->job_id); slurm_mutex_unlock(&prolog_mutex); memset(&job_env, 0, sizeof(job_env_t)); job_env.jobid = req->job_id; job_env.step_id = 0; /* not available */ job_env.node_list = req->nodes; job_env.partition = req->partition; job_env.spank_job_env = req->spank_job_env; job_env.spank_job_env_size = req->spank_job_env_size; job_env.uid = req->uid; job_env.user_name = req->user_name; #if defined(HAVE_BG) select_g_select_jobinfo_get(req->select_jobinfo, SELECT_JOBDATA_BLOCK_ID, &job_env.resv_id); #elif defined(HAVE_ALPS_CRAY) job_env.resv_id = select_g_select_jobinfo_xstrdup( req->select_jobinfo, SELECT_PRINT_RESV_ID); #endif rc = _run_prolog(&job_env, req->cred); if (rc) { int term_sig, exit_status; if (WIFSIGNALED(rc)) { exit_status = 0; term_sig = WTERMSIG(rc); } else { exit_status = WEXITSTATUS(rc); term_sig = 0; } error("[job %u] prolog failed status=%d:%d", req->job_id, exit_status, term_sig); rc = ESLURMD_PROLOG_FAILED; } } else slurm_mutex_unlock(&prolog_mutex); if (!(slurmctld_conf.prolog_flags & PROLOG_FLAG_NOHOLD)) _notify_slurmctld_prolog_fini(req->job_id, rc); if (rc == SLURM_SUCCESS) { if (slurmctld_conf.prolog_flags & PROLOG_FLAG_CONTAIN) _spawn_prolog_stepd(msg); } else { _launch_job_fail(req->job_id, rc); send_registration_msg(rc, false); } }
0
296,721
static void run_tests() { test_simple(); test_secure_funcs(); }
0
35,392
void usb_sg_cancel(struct usb_sg_request *io) { unsigned long flags; int i, retval; spin_lock_irqsave(&io->lock, flags); if (io->status || io->count == 0) { spin_unlock_irqrestore(&io->lock, flags); return; } /* shut everything down */ io->status = -ECONNRESET; io->count++; /* Keep the request alive until we're done */ spin_unlock_irqrestore(&io->lock, flags); for (i = io->entries - 1; i >= 0; --i) { usb_block_urb(io->urbs[i]); retval = usb_unlink_urb(io->urbs[i]); if (retval != -EINPROGRESS && retval != -ENODEV && retval != -EBUSY && retval != -EIDRM) dev_warn(&io->dev->dev, "%s, unlink --> %d\n", __func__, retval); } spin_lock_irqsave(&io->lock, flags); io->count--; if (!io->count) complete(&io->complete); spin_unlock_irqrestore(&io->lock, flags); }
0
85,358
static void tb_phys_invalidate__locked(TCGContext *tcg_ctx, TranslationBlock *tb) { do_tb_phys_invalidate(tcg_ctx, tb, true); }
0
223,972
void RootWindow::OnLayerAnimationAborted( ui::LayerAnimationSequence* animation) { }
0
356,663
static jas_cmpxformseq_t *jas_cmpxformseq_copy(jas_cmpxformseq_t *pxformseq) { jas_cmpxformseq_t *newpxformseq; if (!(newpxformseq = jas_cmpxformseq_create())) goto error; if (jas_cmpxformseq_append(newpxformseq, pxformseq)) goto error; return newpxformseq; error: return 0; }
0
433,111
static int read_rindex_entry(struct gfs2_inode *ip) { struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); const unsigned bsize = sdp->sd_sb.sb_bsize; loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex); struct gfs2_rindex buf; int error; struct gfs2_rgrpd *rgd; if (pos >= i_size_read(&ip->i_inode)) return 1; error = gfs2_internal_read(ip, (char *)&buf, &pos, sizeof(struct gfs2_rindex)); if (error != sizeof(struct gfs2_rindex)) return (error == 0) ? 1 : error; rgd = kmem_cache_zalloc(gfs2_rgrpd_cachep, GFP_NOFS); error = -ENOMEM; if (!rgd) return error; rgd->rd_sbd = sdp; rgd->rd_addr = be64_to_cpu(buf.ri_addr); rgd->rd_length = be32_to_cpu(buf.ri_length); rgd->rd_data0 = be64_to_cpu(buf.ri_data0); rgd->rd_data = be32_to_cpu(buf.ri_data); rgd->rd_bitbytes = be32_to_cpu(buf.ri_bitbytes); spin_lock_init(&rgd->rd_rsspin); error = compute_bitstructs(rgd); if (error) goto fail; error = gfs2_glock_get(sdp, rgd->rd_addr, &gfs2_rgrp_glops, CREATE, &rgd->rd_gl); if (error) goto fail; rgd->rd_rgl = (struct gfs2_rgrp_lvb *)rgd->rd_gl->gl_lksb.sb_lvbptr; rgd->rd_flags &= ~(GFS2_RDF_UPTODATE | GFS2_RDF_PREFERRED); if (rgd->rd_data > sdp->sd_max_rg_data) sdp->sd_max_rg_data = rgd->rd_data; spin_lock(&sdp->sd_rindex_spin); error = rgd_insert(rgd); spin_unlock(&sdp->sd_rindex_spin); if (!error) { rgd->rd_gl->gl_object = rgd; rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) & PAGE_MASK; rgd->rd_gl->gl_vm.end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1; return 0; } error = 0; /* someone else read in the rgrp; free it and ignore it */ gfs2_glock_put(rgd->rd_gl); fail: kfree(rgd->rd_bits); rgd->rd_bits = NULL; kmem_cache_free(gfs2_rgrpd_cachep, rgd); return error; }
0
10,246
tt_cmap14_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p; FT_ULong length; FT_ULong num_selectors; if ( table + 2 + 4 + 4 > valid->limit ) FT_INVALID_TOO_SHORT; p = table + 2; length = TT_NEXT_ULONG( p ); num_selectors = TT_NEXT_ULONG( p ); if ( length > (FT_ULong)( valid->limit - table ) || /* length < 10 + 11 * num_selectors ? */ length < 10 || ( length - 10 ) / 11 < num_selectors ) FT_INVALID_TOO_SHORT; /* check selectors, they must be in increasing order */ { /* we start lastVarSel at 1 because a variant selector value of 0 * isn't valid. */ FT_ULong n, lastVarSel = 1; for ( n = 0; n < num_selectors; n++ ) { FT_ULong varSel = TT_NEXT_UINT24( p ); FT_ULong defOff = TT_NEXT_ULONG( p ); FT_ULong nondefOff = TT_NEXT_ULONG( p ); if ( defOff >= length || nondefOff >= length ) FT_INVALID_TOO_SHORT; if ( varSel < lastVarSel ) FT_INVALID_DATA; lastVarSel = varSel + 1; /* check the default table (these glyphs should be reached */ /* through the normal Unicode cmap, no GIDs, just check order) */ if ( defOff != 0 ) { FT_Byte* defp = table + defOff; FT_ULong numRanges = TT_NEXT_ULONG( defp ); FT_ULong i; FT_ULong lastBase = 0; /* defp + numRanges * 4 > valid->limit ? */ if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 ) FT_INVALID_TOO_SHORT; if ( base + cnt >= 0x110000UL ) /* end of Unicode */ FT_INVALID_DATA; if ( base < lastBase ) FT_INVALID_DATA; lastBase = base + cnt + 1U; } } /* and the non-default table (these glyphs are specified here) */ if ( nondefOff != 0 ) { FT_Byte* ndp = table + nondefOff; FT_ULong numMappings = TT_NEXT_ULONG( ndp ); /* and the non-default table (these glyphs are specified here) */ if ( nondefOff != 0 ) { FT_Byte* ndp = table + nondefOff; FT_ULong numMappings = TT_NEXT_ULONG( ndp ); FT_ULong i, lastUni = 0; /* numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ? */ if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 4 ) FT_INVALID_TOO_SHORT; for ( i = 0; i < numMappings; ++i ) lastUni = uni + 1U; if ( valid->level >= FT_VALIDATE_TIGHT && gid >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } } }
1
115,915
static u64 dev_extent_search_start(struct btrfs_device *device, u64 start) { switch (device->fs_devices->chunk_alloc_policy) { case BTRFS_CHUNK_ALLOC_REGULAR: /* * We don't want to overwrite the superblock on the drive nor * any area used by the boot loader (grub for example), so we * make sure to start at an offset of at least 1MB. */ return max_t(u64, start, SZ_1M); case BTRFS_CHUNK_ALLOC_ZONED: /* * We don't care about the starting region like regular * allocator, because we anyway use/reserve the first two zones * for superblock logging. */ return ALIGN(start, device->zone_info->zone_size); default: BUG(); } }
0
425,054
void acquire_daemonlock(int closeflag) { static int fd = -1; char buf[3 * MAX_FNAME]; const char *pidfile; char *ep; long otherpid = -1; ssize_t num, len; pid_t pid = getpid(); if (closeflag) { /* close stashed fd for child so we don't leak it. */ if (fd != -1) { close(fd); fd = -1; } /* and restore default sig handlers so we don't remove pid file if killed */ signal(SIGINT,SIG_DFL); signal(SIGTERM,SIG_DFL); return; } if (NoFork == 1) return; //move along, nothing to do here... if (fd == -1) { pidfile = _PATH_CRON_PID; /* Initial mode is 0600 to prevent flock() race/DoS. */ if ((fd = open(pidfile, O_RDWR | O_CREAT, 0600)) == -1) { int save_errno = errno; sprintf(buf, "can't open or create %s", pidfile); fprintf(stderr, "%s: %s: %s\n", ProgramName, buf, strerror(save_errno)); log_it("CRON", pid, "DEATH", buf, save_errno); exit(ERROR_EXIT); } if (trylock_file(fd) < OK) { int save_errno = errno; memset(buf, 0, sizeof (buf)); if ((num = read(fd, buf, sizeof (buf) - 1)) > 0 && (otherpid = strtol(buf, &ep, 10)) > 0 && ep != buf && *ep == '\n' && otherpid != LONG_MAX) { snprintf(buf, sizeof (buf), "can't lock %s, otherpid may be %ld", pidfile, otherpid); } else { snprintf(buf, sizeof (buf), "can't lock %s, otherpid unknown", pidfile); } fprintf(stderr, "%s: %s: %s\n", ProgramName, buf, strerror(save_errno)); log_it("CRON", pid, "DEATH", buf, save_errno); exit(ERROR_EXIT); } (void) fchmod(fd, 0644); (void) fcntl(fd, F_SETFD, 1); } #if !defined(HAVE_FLOCK) else { /* Racy but better than nothing, just hope the parent exits */ sleep(0); trylock_file(fd); } #endif sprintf(buf, "%ld\n", (long) pid); (void) lseek(fd, (off_t) 0, SEEK_SET); len = (ssize_t)strlen(buf); if ((num = write(fd, buf, (size_t)len)) != len) log_it("CRON", pid, "ERROR", "write() failed", errno); else { if (ftruncate(fd, num) == -1) log_it("CRON", pid, "ERROR", "ftruncate() failed", errno); } /* abandon fd even though the file is open. we need to keep * it open and locked, but we don't need the handles elsewhere. */ }
0
452,025
static void rbd_osd_setup_write_ops(struct ceph_osd_request *osd_req, int which) { struct rbd_obj_request *obj_req = osd_req->r_priv; switch (obj_req->img_request->op_type) { case OBJ_OP_WRITE: __rbd_osd_setup_write_ops(osd_req, which); break; case OBJ_OP_DISCARD: __rbd_osd_setup_discard_ops(osd_req, which); break; case OBJ_OP_ZEROOUT: __rbd_osd_setup_zeroout_ops(osd_req, which); break; default: BUG(); } }
0
243,330
void LocalFrameClientImpl::DidChangePerformanceTiming() { if (web_frame_->Client()) web_frame_->Client()->DidChangePerformanceTiming(); }
0
363,533
hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name, void *pointer, const char *arguments) { struct t_hook *ptr_hook, *next_hook; struct t_infolist *value; /* make C compiler happy */ (void) plugin; if (!infolist_name || !infolist_name[0]) return NULL; hook_exec_start (); ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST]; while (ptr_hook) { next_hook = ptr_hook->next_hook; if (!ptr_hook->deleted && !ptr_hook->running && (string_strcasecmp (HOOK_INFOLIST(ptr_hook, infolist_name), infolist_name) == 0)) { ptr_hook->running = 1; value = (HOOK_INFOLIST(ptr_hook, callback)) (ptr_hook->callback_data, infolist_name, pointer, arguments); ptr_hook->running = 0; hook_exec_end (); return value; } ptr_hook = next_hook; } hook_exec_end (); /* infolist not found */ return NULL; }
0
486,104
static int fprintf_utab_fs(FILE *f, struct libmnt_fs *fs) { char *p; int rc = 0; assert(fs); assert(f); if (!fs || !f) return -EINVAL; p = mangle(mnt_fs_get_source(fs)); if (p) { rc = fprintf(f, "SRC=%s ", p); free(p); } if (rc >= 0) { p = mangle(mnt_fs_get_target(fs)); if (p) { rc = fprintf(f, "TARGET=%s ", p); free(p); } } if (rc >= 0) { p = mangle(mnt_fs_get_root(fs)); if (p) { rc = fprintf(f, "ROOT=%s ", p); free(p); } } if (rc >= 0) { p = mangle(mnt_fs_get_bindsrc(fs)); if (p) { rc = fprintf(f, "BINDSRC=%s ", p); free(p); } } if (rc >= 0) { p = mangle(mnt_fs_get_attributes(fs)); if (p) { rc = fprintf(f, "ATTRS=%s ", p); free(p); } } if (rc >= 0) { p = mangle(mnt_fs_get_user_options(fs)); if (p) { rc = fprintf(f, "OPTS=%s", p); free(p); } } if (rc >= 0) rc = fprintf(f, "\n"); if (rc > 0) rc = 0; /* success */ return rc; }
0
401,551
gboolean menu_cache_app_get_is_visible( MenuCacheApp* app, guint32 de_flags ) { if(app->flags & FLAG_IS_NODISPLAY) return FALSE; return (!app->show_in_flags || (app->show_in_flags & de_flags)) && _can_be_exec(app); }
0
365,332
str_gsub(argc, argv, str, bang) int argc; VALUE *argv; VALUE str; int bang; { VALUE pat, val, repl, match, dest; struct re_registers *regs; long beg, n; long offset, blen, slen, len; int iter = 0; char *buf, *bp, *sp, *cp; int tainted = 0; if (argc == 1) { RETURN_ENUMERATOR(str, argc, argv); iter = 1; } else if (argc == 2) { repl = argv[1]; StringValue(repl); if (OBJ_TAINTED(repl)) tainted = 1; } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)", argc); } pat = get_pat(argv[0], 1); offset=0; n=0; beg = rb_reg_search(pat, str, 0, 0); if (beg < 0) { if (bang) return Qnil; /* no match, no substitution */ return rb_str_dup(str); } blen = RSTRING(str)->len + 30; /* len + margin */ dest = str_new(0, 0, blen); buf = RSTRING(dest)->ptr; bp = buf; sp = cp = RSTRING(str)->ptr; slen = RSTRING(str)->len; rb_str_locktmp(dest); while (beg >= 0) { n++; match = rb_backref_get(); regs = RMATCH(match)->regs; if (iter) { rb_match_busy(match); val = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match))); str_mod_check(str, sp, slen); if (bang) str_frozen_check(str); if (val == dest) { /* paranoid chack [ruby-dev:24827] */ rb_raise(rb_eRuntimeError, "block should not cheat"); } rb_backref_set(match); } else { val = rb_reg_regsub(repl, str, regs); } if (OBJ_TAINTED(val)) tainted = 1; len = (bp - buf) + (beg - offset) + RSTRING(val)->len + 3; if (blen < len) { while (blen < len) blen *= 2; len = bp - buf; RESIZE_CAPA(dest, blen); RSTRING(dest)->len = blen; buf = RSTRING(dest)->ptr; bp = buf + len; } len = beg - offset; /* copy pre-match substr */ memcpy(bp, cp, len); bp += len; memcpy(bp, RSTRING(val)->ptr, RSTRING(val)->len); bp += RSTRING(val)->len; offset = END(0); if (BEG(0) == END(0)) { /* * Always consume at least one character of the input string * in order to prevent infinite loops. */ if (RSTRING(str)->len <= END(0)) break; len = mbclen2(RSTRING(str)->ptr[END(0)], pat); memcpy(bp, RSTRING(str)->ptr+END(0), len); bp += len; offset = END(0) + len; } cp = RSTRING(str)->ptr + offset; if (offset > RSTRING(str)->len) break; beg = rb_reg_search(pat, str, offset, 0); } if (RSTRING(str)->len > offset) { len = bp - buf; if (blen - len < RSTRING(str)->len - offset) { blen = len + RSTRING(str)->len - offset; RESIZE_CAPA(dest, blen); buf = RSTRING(dest)->ptr; bp = buf + len; } memcpy(bp, cp, RSTRING(str)->len - offset); bp += RSTRING(str)->len - offset; } rb_backref_set(match); *bp = '\0'; rb_str_unlocktmp(dest); if (bang) { if (str_independent(str)) { free(RSTRING(str)->ptr); } FL_UNSET(str, STR_NOCAPA); RSTRING(str)->ptr = buf; RSTRING(str)->aux.capa = blen; RSTRING(dest)->ptr = 0; RSTRING(dest)->len = 0; } else { RBASIC(dest)->klass = rb_obj_class(str); OBJ_INFECT(dest, str); str = dest; } RSTRING(str)->len = bp - buf; if (tainted) OBJ_TAINT(str); return str; }
0
84,765
frame_add_height(frame_T *frp, int n) { frame_new_height(frp, frp->fr_height + n, FALSE, FALSE); for (;;) { frp = frp->fr_parent; if (frp == NULL) break; frp->fr_height += n; } }
0
366,583
MP4::Properties::bitsPerSample() const { return d->bitsPerSample; }
0
501,539
void setupServiceRegexPatternValidationHC() { std::string yaml = R"EOF( timeout: 1s interval: 1s interval_jitter: 1s unhealthy_threshold: 2 healthy_threshold: 2 http_health_check: service_name_matcher: safe_regex: google_re2: {} regex: 'locations-.*-.*$' path: /healthcheck )EOF"; allocHealthChecker(yaml); addCompletionCallback(); }
0
230,083
qtdemux_tag_add_blob (GNode * node, GstQTDemux * demux) { gint len; guint8 *data; GstBuffer *buf; gchar *media_type, *style; GstCaps *caps; data = node->data; len = QT_UINT32 (data); buf = gst_buffer_new_and_alloc (len); memcpy (GST_BUFFER_DATA (buf), data, len); /* heuristic to determine style of tag */ if (QT_FOURCC (data + 4) == FOURCC_____ || (len > 8 + 12 && QT_FOURCC (data + 12) == FOURCC_data)) style = "itunes"; else if (demux->major_brand == GST_MAKE_FOURCC ('q', 't', ' ', ' ')) style = "quicktime"; /* fall back to assuming iso/3gp tag style */ else style = "iso"; media_type = g_strdup_printf ("application/x-gst-qt-%c%c%c%c-tag", g_ascii_tolower (data[4]), g_ascii_tolower (data[5]), g_ascii_tolower (data[6]), g_ascii_tolower (data[7])); caps = gst_caps_new_simple (media_type, "style", G_TYPE_STRING, style, NULL); gst_buffer_set_caps (buf, caps); gst_caps_unref (caps); g_free (media_type); GST_DEBUG_OBJECT (demux, "adding private tag; size %d, caps %" GST_PTR_FORMAT, GST_BUFFER_SIZE (buf), caps); gst_tag_list_add (demux->tag_list, GST_TAG_MERGE_APPEND, GST_QT_DEMUX_PRIVATE_TAG, buf, NULL); gst_buffer_unref (buf); }
0
299,873
static bool mtrr_lookup_fixed_start(struct mtrr_iter *iter) { int seg, index; if (!fixed_mtrr_is_enabled(iter->mtrr_state)) return false; seg = fixed_mtrr_addr_to_seg(iter->start); if (seg < 0) return false; iter->fixed = true; index = fixed_mtrr_addr_seg_to_range_index(iter->start, seg); iter->index = index; iter->seg = seg; return true; }
0
231,444
QString IRCView::closeToTagString(TextHtmlData* data, const QString& _tag) { QString ret; QString tag; int i = data->openHtmlTags.count() - 1; for ( ; i >= 0 ; --i) { tag = data->openHtmlTags.at(i); ret += QLatin1String("</") + tag + QLatin1Char('>'); if (tag == _tag) { data->openHtmlTags.removeAt(i); break; } } if (i > -1) ret += openTags(data, i); return ret; }
0
194,234
void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr) { vdev->vq[n].vring.desc = addr; virtio_queue_update_rings(vdev, n); }
0
314,190
static int wait_on_pipe(struct trace_iterator *iter, int full) { /* Iterators are static, they should be filled or empty */ if (trace_buffer_iter(iter, iter->cpu_file)) return 0; return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file, full); }
0
504,404
TPMI_DH_SAVED_Marshal(TPMI_DH_CONTEXT *source, BYTE **buffer, INT32 *size) { UINT16 written = 0; written += TPM_HANDLE_Marshal(source, buffer, size); return written; }
0
391,679
xmlDOMWrapNewCtxt(void) { xmlDOMWrapCtxtPtr ret; ret = xmlMalloc(sizeof(xmlDOMWrapCtxt)); if (ret == NULL) { xmlTreeErrMemory("allocating DOM-wrapper context"); return (NULL); } memset(ret, 0, sizeof(xmlDOMWrapCtxt)); return (ret); }
0
251,304
void WebGL2RenderingContextBase::uniformMatrix2fv( const WebGLUniformLocation* location, GLboolean transpose, Vector<GLfloat>& v) { WebGLRenderingContextBase::uniformMatrix2fv(location, transpose, v); }
0
119,783
StartSelect(XtermWidget xw, const CELL *cell) { TScreen *screen = TScreenOf(xw); TRACE(("StartSelect row=%d, col=%d\n", cell->row, cell->col)); if (screen->cursor_state) HideCursor(xw); if (screen->numberOfClicks == 1) { /* set start of selection */ screen->rawPos = *cell; } /* else use old values in rawPos */ screen->saveStartR = screen->startExt = screen->rawPos; screen->saveEndR = screen->endExt = screen->rawPos; if (Coordinate(screen, cell) < Coordinate(screen, &(screen->rawPos))) { screen->eventMode = LEFTEXTENSION; screen->startExt = *cell; } else { screen->eventMode = RIGHTEXTENSION; screen->endExt = *cell; } ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False, True); }
0
23,812
char * evhttp_encode_uri ( const char * uri ) { struct evbuffer * buf = evbuffer_new ( ) ; char * p ; for ( p = ( char * ) uri ; * p != '\0' ; p ++ ) { if ( uri_chars [ ( u_char ) ( * p ) ] ) { evbuffer_add ( buf , p , 1 ) ; } else { evbuffer_add_printf ( buf , "%%%02X" , ( u_char ) ( * p ) ) ; } } evbuffer_add ( buf , "" , 1 ) ; p = strdup ( ( char * ) EVBUFFER_DATA ( buf ) ) ; evbuffer_free ( buf ) ; return ( p ) ; }
0
278,166
void js_defaccessor(js_State *J, int idx, const char *name, int atts) { jsR_defproperty(J, js_toobject(J, idx), name, atts, NULL, jsR_tofunction(J, -2), jsR_tofunction(J, -1)); js_pop(J, 2); }
0
31,486
static struct in_ifaddr *inet_alloc_ifa(void) { return kzalloc(sizeof(struct in_ifaddr), GFP_KERNEL); }
0
157,768
DEFINE_TEST(test_read_format_rar5_invalid_dict_reference) { uint8_t buf[16]; PROLOGUE("test_read_format_rar5_invalid_dict_reference.rar"); /* This test should fail on parsing the header. */ assertA(archive_read_next_header(a, &ae) != ARCHIVE_OK); /* This archive is invalid. However, processing it shouldn't cause any * errors related to buffer underflow when using -fsanitize. */ assertA(archive_read_data(a, buf, sizeof(buf)) <= 0); /* This test only cares about not returning success here. */ assertA(ARCHIVE_OK != archive_read_next_header(a, &ae)); EPILOGUE(); }
0
195,735
bool DrawingBuffer::Initialize(const IntSize& size, bool use_multisampling) { ScopedStateRestorer scoped_state_restorer(this); if (gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { return false; } gl_->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size_); int max_sample_count = 0; anti_aliasing_mode_ = kNone; if (use_multisampling) { gl_->GetIntegerv(GL_MAX_SAMPLES_ANGLE, &max_sample_count); anti_aliasing_mode_ = kMSAAExplicitResolve; if (extensions_util_->SupportsExtension( "GL_EXT_multisampled_render_to_texture")) { anti_aliasing_mode_ = kMSAAImplicitResolve; } else if (extensions_util_->SupportsExtension( "GL_CHROMIUM_screen_space_antialiasing")) { anti_aliasing_mode_ = kScreenSpaceAntialiasing; } } storage_texture_supported_ = (webgl_version_ > kWebGL1 || extensions_util_->SupportsExtension("GL_EXT_texture_storage")) && anti_aliasing_mode_ == kScreenSpaceAntialiasing; sample_count_ = std::min(4, max_sample_count); state_restorer_->SetFramebufferBindingDirty(); gl_->GenFramebuffers(1, &fbo_); gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); if (WantExplicitResolve()) { gl_->GenFramebuffers(1, &multisample_fbo_); gl_->BindFramebuffer(GL_FRAMEBUFFER, multisample_fbo_); gl_->GenRenderbuffers(1, &multisample_renderbuffer_); } if (!ResizeFramebufferInternal(size)) return false; if (depth_stencil_buffer_) { DCHECK(WantDepthOrStencil()); has_implicit_stencil_buffer_ = !want_stencil_; } if (gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { return false; } return true; }
0
402,305
static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v) { XHCIInterrupter *intr; dma_addr_t erdp; unsigned int dp_idx; if (v >= xhci->numintrs) { DPRINTF("intr nr out of range (%d >= %d)\n", v, xhci->numintrs); return; } intr = &xhci->intr[v]; if (intr->er_full) { DPRINTF("xhci_event(): ER full, queueing\n"); if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { DPRINTF("xhci: event queue full, dropping event!\n"); return; } intr->ev_buffer[intr->ev_buffer_put++] = *event; if (intr->ev_buffer_put == EV_QUEUE) { intr->ev_buffer_put = 0; } return; } erdp = xhci_addr64(intr->erdp_low, intr->erdp_high); if (erdp < intr->er_start || erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) { DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", v, intr->er_start, intr->er_size); xhci_die(xhci); return; } dp_idx = (erdp - intr->er_start) / TRB_SIZE; assert(dp_idx < intr->er_size); if ((intr->er_ep_idx+1) % intr->er_size == dp_idx) { DPRINTF("xhci_event(): ER full, queueing\n"); #ifndef ER_FULL_HACK XHCIEvent full = {ER_HOST_CONTROLLER, CC_EVENT_RING_FULL_ERROR}; xhci_write_event(xhci, &full); #endif intr->er_full = 1; if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { DPRINTF("xhci: event queue full, dropping event!\n"); return; } intr->ev_buffer[intr->ev_buffer_put++] = *event; if (intr->ev_buffer_put == EV_QUEUE) { intr->ev_buffer_put = 0; } } else { xhci_write_event(xhci, event, v); } xhci_intr_raise(xhci, v); }
0
87,898
int __kvm_set_memory_region(struct kvm *kvm, const struct kvm_userspace_memory_region *mem) { int r; gfn_t base_gfn; unsigned long npages; struct kvm_memory_slot *slot; struct kvm_memory_slot old, new; struct kvm_memslots *slots = NULL, *old_memslots; int as_id, id; enum kvm_mr_change change; r = check_memory_region_flags(mem); if (r) goto out; r = -EINVAL; as_id = mem->slot >> 16; id = (u16)mem->slot; /* General sanity checks */ if (mem->memory_size & (PAGE_SIZE - 1)) goto out; if (mem->guest_phys_addr & (PAGE_SIZE - 1)) goto out; /* We can read the guest memory with __xxx_user() later on. */ if ((id < KVM_USER_MEM_SLOTS) && ((mem->userspace_addr & (PAGE_SIZE - 1)) || !access_ok((void __user *)(unsigned long)mem->userspace_addr, mem->memory_size))) goto out; if (as_id >= KVM_ADDRESS_SPACE_NUM || id >= KVM_MEM_SLOTS_NUM) goto out; if (mem->guest_phys_addr + mem->memory_size < mem->guest_phys_addr) goto out; slot = id_to_memslot(__kvm_memslots(kvm, as_id), id); base_gfn = mem->guest_phys_addr >> PAGE_SHIFT; npages = mem->memory_size >> PAGE_SHIFT; if (npages > KVM_MEM_MAX_NR_PAGES) goto out; new = old = *slot; new.id = id; new.base_gfn = base_gfn; new.npages = npages; new.flags = mem->flags; if (npages) { if (!old.npages) change = KVM_MR_CREATE; else { /* Modify an existing slot. */ if ((mem->userspace_addr != old.userspace_addr) || (npages != old.npages) || ((new.flags ^ old.flags) & KVM_MEM_READONLY)) goto out; if (base_gfn != old.base_gfn) change = KVM_MR_MOVE; else if (new.flags != old.flags) change = KVM_MR_FLAGS_ONLY; else { /* Nothing to change. */ r = 0; goto out; } } } else { if (!old.npages) goto out; change = KVM_MR_DELETE; new.base_gfn = 0; new.flags = 0; } if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { /* Check for overlaps */ r = -EEXIST; kvm_for_each_memslot(slot, __kvm_memslots(kvm, as_id)) { if (slot->id == id) continue; if (!((base_gfn + npages <= slot->base_gfn) || (base_gfn >= slot->base_gfn + slot->npages))) goto out; } } /* Free page dirty bitmap if unneeded */ if (!(new.flags & KVM_MEM_LOG_DIRTY_PAGES)) new.dirty_bitmap = NULL; r = -ENOMEM; if (change == KVM_MR_CREATE) { new.userspace_addr = mem->userspace_addr; if (kvm_arch_create_memslot(kvm, &new, npages)) goto out_free; } /* Allocate page dirty bitmap if needed */ if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) { if (kvm_create_dirty_bitmap(&new) < 0) goto out_free; } slots = kvzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); if (!slots) goto out_free; memcpy(slots, __kvm_memslots(kvm, as_id), sizeof(struct kvm_memslots)); if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { slot = id_to_memslot(slots, id); slot->flags |= KVM_MEMSLOT_INVALID; old_memslots = install_new_memslots(kvm, as_id, slots); /* From this point no new shadow pages pointing to a deleted, * or moved, memslot will be created. * * validation of sp->gfn happens in: * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) * - kvm_is_visible_gfn (mmu_check_roots) */ kvm_arch_flush_shadow_memslot(kvm, slot); /* * We can re-use the old_memslots from above, the only difference * from the currently installed memslots is the invalid flag. This * will get overwritten by update_memslots anyway. */ slots = old_memslots; } r = kvm_arch_prepare_memory_region(kvm, &new, mem, change); if (r) goto out_slots; /* actual memory is freed via old in kvm_free_memslot below */ if (change == KVM_MR_DELETE) { new.dirty_bitmap = NULL; memset(&new.arch, 0, sizeof(new.arch)); } update_memslots(slots, &new, change); old_memslots = install_new_memslots(kvm, as_id, slots); kvm_arch_commit_memory_region(kvm, mem, &old, &new, change); kvm_free_memslot(kvm, &old, &new); kvfree(old_memslots); return 0; out_slots: kvfree(slots); out_free: kvm_free_memslot(kvm, &new, &old); out: return r; }
0
46,672
bool isInvalid() const override { return data == nullptr; }
0
361,488
struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, unsigned long flags, struct key *dest) { struct key *keyring; int ret; keyring = key_alloc(&key_type_keyring, description, uid, gid, cred, (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL, flags); if (!IS_ERR(keyring)) { ret = key_instantiate_and_link(keyring, NULL, 0, dest, NULL); if (ret < 0) { key_put(keyring); keyring = ERR_PTR(ret); } } return keyring; } /* end keyring_alloc() */
0
288,901
static const char * ultag_getRegion ( const ULanguageTag * langtag ) { return langtag -> region ; }
0
281,773
static void voidMethodSequenceDictionaryArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); TestObjectPythonV8Internal::voidMethodSequenceDictionaryArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
0
143,687
static int ocfs2_dir_open(struct inode *inode, struct file *file) { return ocfs2_init_file_private(inode, file); }
0
182,282
int64 GetAmountOfFreeDiskSpace() { if (global_free_disk_getter_for_testing) return global_free_disk_getter_for_testing->AmountOfFreeDiskSpace(); return base::SysInfo::AmountOfFreeDiskSpace( FilePath::FromUTF8Unsafe(GetHomeDirectory())); }
0
21,060
static int qdev_add_one_global(QemuOpts *opts, void *opaque) { GlobalProperty *g; ObjectClass *oc; g = g_malloc0(sizeof(*g)); g->driver = qemu_opt_get(opts, "driver"); g->property = qemu_opt_get(opts, "property"); g->value = qemu_opt_get(opts, "value"); oc = object_class_by_name(g->driver); if (oc) { DeviceClass *dc = DEVICE_CLASS(oc); if (dc->hotpluggable) { /* If hotpluggable then skip not_used checking. */ g->not_used = false; } else { /* Maybe a typo. */ g->not_used = true; } } else { /* Maybe a typo. */ g->not_used = true; } qdev_prop_register_global(g); return 0; }
1
70,591
static void snd_timer_clear_callbacks(struct snd_timer *timer, struct list_head *head) { unsigned long flags; spin_lock_irqsave(&timer->lock, flags); while (!list_empty(head)) list_del_init(head->next); spin_unlock_irqrestore(&timer->lock, flags); }
0
147,724
nvmet_fc_find_target_assoc(struct nvmet_fc_tgtport *tgtport, u64 association_id) { struct nvmet_fc_tgt_assoc *assoc; struct nvmet_fc_tgt_assoc *ret = NULL; unsigned long flags; spin_lock_irqsave(&tgtport->lock, flags); list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { if (association_id == assoc->association_id) { ret = assoc; nvmet_fc_tgt_a_get(assoc); break; } } spin_unlock_irqrestore(&tgtport->lock, flags); return ret; }
0
123,126
static int create_std_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, struct usb_host_interface *alts) { struct usb_ms_header_descriptor *mshd; struct usb_ms_endpoint_descriptor *msepd; /* must have the MIDIStreaming interface header descriptor*/ mshd = (struct usb_ms_header_descriptor *)alts->extra; if (alts->extralen < 7 || mshd->bLength < 7 || mshd->bDescriptorType != USB_DT_CS_INTERFACE || mshd->bDescriptorSubtype != USB_MS_HEADER) return -ENODEV; /* must have the MIDIStreaming endpoint descriptor*/ msepd = (struct usb_ms_endpoint_descriptor *)alts->endpoint[0].extra; if (alts->endpoint[0].extralen < 4 || msepd->bLength < 4 || msepd->bDescriptorType != USB_DT_CS_ENDPOINT || msepd->bDescriptorSubtype != UAC_MS_GENERAL || msepd->bNumEmbMIDIJack < 1 || msepd->bNumEmbMIDIJack > 16) return -ENODEV; return create_any_midi_quirk(chip, iface, driver, NULL); }
0
277,176
static bool cmd_identify(IDEState *s, uint8_t cmd) { if (s->blk && s->drive_kind != IDE_CD) { if (s->drive_kind != IDE_CFATA) { ide_identify(s); } else { ide_cfata_identify(s); } s->status = READY_STAT | SEEK_STAT; ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop); ide_set_irq(s->bus); return false; } else { if (s->drive_kind == IDE_CD) { ide_set_signature(s); } ide_abort_command(s); } return true; }
0
125,216
void* leak_realloc(void* oldMem, size_t bytes) { if (oldMem == NULL) { return leak_malloc(bytes); } void* newMem = NULL; AllocationEntry* header = (AllocationEntry*)oldMem - 1; if (header && header->guard == GUARD) { size_t oldSize = header->entry->size & ~SIZE_FLAG_MASK; newMem = leak_malloc(bytes); if (newMem != NULL) { size_t copySize = (oldSize <= bytes) ? oldSize : bytes; memcpy(newMem, oldMem, copySize); leak_free(oldMem); } } else { newMem = dlrealloc(oldMem, bytes); } return newMem; }
0
377,316
static gnutls_datum_t mmap_file(const char *file) { int fd; gnutls_datum_t mmaped_file = { NULL, 0 }; struct stat stat_st; void *ptr; fd = open(file, 0); if (fd == -1) return mmaped_file; fstat(fd, &stat_st); if ((ptr = mmap(NULL, stat_st.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { close(fd); return mmaped_file; } close(fd); mmaped_file.data = (unsigned char*)ptr; mmaped_file.size = stat_st.st_size; return mmaped_file; }
0
243,560
ShellWindowViews::~ShellWindowViews() { web_view_->SetWebContents(NULL); }
0
199,398
ACodec::BaseState::BaseState(ACodec *codec, const sp<AState> &parentState) : AState(parentState), mCodec(codec) { }
0
125,484
static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) { struct inode *inode = dentry->d_inode; struct task_struct *task = get_proc_task(inode); int fd = proc_fd(inode); struct files_struct *files; const struct cred *cred; if (task) { files = get_files_struct(task); if (files) { rcu_read_lock(); if (fcheck_files(files, fd)) { rcu_read_unlock(); put_files_struct(files); if (task_dumpable(task)) { rcu_read_lock(); cred = __task_cred(task); inode->i_uid = cred->euid; inode->i_gid = cred->egid; rcu_read_unlock(); } else { inode->i_uid = 0; inode->i_gid = 0; } inode->i_mode &= ~(S_ISUID | S_ISGID); security_task_to_inode(task, inode); put_task_struct(task); return 1; } rcu_read_unlock(); put_files_struct(files); } put_task_struct(task); } d_drop(dentry); return 0; }
0
37,974
static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount) { rfds[*rcount] = (void*)(long)(client->context->rdp->transport->TcpIn->sockfd); (*rcount)++; return TRUE; }
0
28,597
int min_heap_elem_greater ( struct event * a , struct event * b ) { return evutil_timercmp ( & a -> ev_timeout , & b -> ev_timeout , > ) ; }
0
445,873
exif_data_load_data_content (ExifData *data, ExifIfd ifd, const unsigned char *d, unsigned int ds, unsigned int offset, unsigned int recursion_cost) { ExifLong o, thumbnail_offset = 0, thumbnail_length = 0; ExifShort n; ExifEntry *entry; unsigned int i; ExifTag tag; if (!data || !data->priv) return; /* check for valid ExifIfd enum range */ if ((((int)ifd) < 0) || ( ((int)ifd) >= EXIF_IFD_COUNT)) return; if (recursion_cost > 170) { /* * recursion_cost is a logarithmic-scale indicator of how expensive this * recursive call might end up being. It is an indicator of the depth of * recursion as well as the potential for worst-case future recursive * calls. Since it's difficult to tell ahead of time how often recursion * will occur, this assumes the worst by assuming every tag could end up * causing recursion. * The value of 170 was chosen to limit typical EXIF structures to a * recursive depth of about 6, but pathological ones (those with very * many tags) to only 2. */ exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData", "Deep/expensive recursion detected!"); return; } /* Read the number of entries */ if (CHECKOVERFLOW(offset, ds, 2)) { exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData", "Tag data past end of buffer (%u+2 > %u)", offset, ds); return; } n = exif_get_short (d + offset, data->priv->order); exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Loading %hu entries...", n); offset += 2; /* Check if we have enough data. */ if (CHECKOVERFLOW(offset, ds, 12*n)) { n = (ds - offset) / 12; exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Short data; only loading %hu entries...", n); } for (i = 0; i < n; i++) { tag = exif_get_short (d + offset + 12 * i, data->priv->order); switch (tag) { case EXIF_TAG_EXIF_IFD_POINTER: case EXIF_TAG_GPS_INFO_IFD_POINTER: case EXIF_TAG_INTEROPERABILITY_IFD_POINTER: case EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: case EXIF_TAG_JPEG_INTERCHANGE_FORMAT: o = exif_get_long (d + offset + 12 * i + 8, data->priv->order); if (o >= ds) { exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData", "Tag data past end of buffer (%u > %u)", offset+2, ds); return; } /* FIXME: IFD_POINTER tags aren't marked as being in a * specific IFD, so exif_tag_get_name_in_ifd won't work */ exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Sub-IFD entry 0x%x ('%s') at %u.", tag, exif_tag_get_name(tag), o); switch (tag) { case EXIF_TAG_EXIF_IFD_POINTER: CHECK_REC (EXIF_IFD_EXIF); exif_data_load_data_content (data, EXIF_IFD_EXIF, d, ds, o, recursion_cost + level_cost(n)); break; case EXIF_TAG_GPS_INFO_IFD_POINTER: CHECK_REC (EXIF_IFD_GPS); exif_data_load_data_content (data, EXIF_IFD_GPS, d, ds, o, recursion_cost + level_cost(n)); break; case EXIF_TAG_INTEROPERABILITY_IFD_POINTER: CHECK_REC (EXIF_IFD_INTEROPERABILITY); exif_data_load_data_content (data, EXIF_IFD_INTEROPERABILITY, d, ds, o, recursion_cost + level_cost(n)); break; case EXIF_TAG_JPEG_INTERCHANGE_FORMAT: thumbnail_offset = o; if (thumbnail_offset && thumbnail_length) exif_data_load_data_thumbnail (data, d, ds, thumbnail_offset, thumbnail_length); break; case EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: thumbnail_length = o; if (thumbnail_offset && thumbnail_length) exif_data_load_data_thumbnail (data, d, ds, thumbnail_offset, thumbnail_length); break; default: return; } break; default: /* * If we don't know the tag, don't fail. It could be that new * versions of the standard have defined additional tags. Note that * 0 is a valid tag in the GPS IFD. */ if (!exif_tag_get_name_in_ifd (tag, ifd)) { /* * Special case: Tag and format 0. That's against specification * (at least up to 2.2). But Photoshop writes it anyways. */ if (!memcmp (d + offset + 12 * i, "\0\0\0\0", 4)) { exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Skipping empty entry at position %u in '%s'.", i, exif_ifd_get_name (ifd)); break; } exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Unknown tag 0x%04x (entry %u in '%s'). Please report this tag " "to <[email protected]>.", tag, i, exif_ifd_get_name (ifd)); if (data->priv->options & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS) break; } entry = exif_entry_new_mem (data->priv->mem); if (!entry) { exif_log (data->priv->log, EXIF_LOG_CODE_NO_MEMORY, "ExifData", "Could not allocate memory"); return; } if (exif_data_load_data_entry (data, entry, d, ds, offset + 12 * i)) exif_content_add_entry (data->ifd[ifd], entry); exif_entry_unref (entry); break; } } }
0
477,623
static inline void ax25_hold_route(ax25_route *ax25_rt) { refcount_inc(&ax25_rt->refcount); }
0
517,943
bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, const char *fname, Item **args, uint nargs, uint flags, int item_sep) { THD *thd= current_thd; if (thd->lex->is_ps_or_view_context_analysis()) return false; Item **arg, *safe_args[2]= {NULL, NULL}; /* For better error reporting: save the first and the second argument. We need this only if the the number of args is 3 or 2: - for a longer argument list, "Illegal mix of collations" doesn't display each argument's characteristics. - if nargs is 1, then this error cannot happen. */ if (nargs >=2 && nargs <= 3) { safe_args[0]= args[0]; safe_args[1]= args[item_sep]; } bool res= FALSE; uint i; DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare()); for (i= 0, arg= args; i < nargs; i++, arg+= item_sep) { Item* conv= (*arg)->safe_charset_converter(thd, coll.collation); if (conv == *arg) continue; if (!conv) { if (nargs >=2 && nargs <= 3) { /* restore the original arguments for better error message */ args[0]= safe_args[0]; args[item_sep]= safe_args[1]; } my_coll_agg_error(args, nargs, fname, item_sep); res= TRUE; break; // we cannot return here, we need to restore "arena". } thd->change_item_tree(arg, conv); if (conv->fix_fields(thd, arg)) { res= TRUE; break; // we cannot return here, we need to restore "arena". } } return res; }
0
189,049
static void TestInterfaceOrLongMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); TestInterfaceOrLong result; impl->testInterfaceOrLongMethod(result); V8SetReturnValue(info, result); }
0
41,104
void ssl_handshake_free( ssl_handshake_params *handshake ) { #if defined(POLARSSL_DHM_C) dhm_free( &handshake->dhm_ctx ); #endif memset( handshake, 0, sizeof( ssl_handshake_params ) ); }
0