project
stringclasses
788 values
commit_id
stringlengths
6
81
CVE ID
stringlengths
13
16
CWE ID
stringclasses
126 values
func
stringlengths
14
482k
vul
int8
0
1
vim
395bd1f6d3edc9f7edb5d1f2d7deaf5a9e3ab93c
NOT_APPLICABLE
NOT_APPLICABLE
set_cursor_for_append_to_line(void) { curwin->w_set_curswant = TRUE; if (get_ve_flags() == VE_ALL) { int save_State = State; // Pretend Insert mode here to allow the cursor on the // character past the end of the line State = MODE_INSERT; coladvance((colnr_T)MAXCOL); State = save_State; } else curwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor()); }
0
linux
d8b8591054575f33237556c32762d54e30774d28
NOT_APPLICABLE
NOT_APPLICABLE
static void free_context_table(struct intel_iommu *iommu) { int i; unsigned long flags; struct context_entry *context; spin_lock_irqsave(&iommu->lock, flags); if (!iommu->root_entry) { goto out; } for (i = 0; i < ROOT_ENTRY_NR; i++) { context = iommu_context_addr(iommu, i, 0, 0); if (context) free_pgtable_page(context); if (!sm_supported(iommu)) continue; context = iommu_context_addr(iommu, i, 0x80, 0); if (context) free_pgtable_page(context); } free_pgtable_page(iommu->root_entry); iommu->root_entry = NULL; out: spin_unlock_irqrestore(&iommu->lock, flags); }
0
ImageMagick
8043433ba9ce0c550e09f2b3b6a3f5f62d802e6d
NOT_APPLICABLE
NOT_APPLICABLE
static MagickBooleanType ReadDCMPixels(Image *image,DCMInfo *info, DCMStreamInfo *stream_info,MagickBooleanType first_segment, ExceptionInfo *exception) { int byte, index; MagickBooleanType status; PixelPacket pixel; ssize_t i, x; Quantum *q; ssize_t y; /* Convert DCM Medical image to pixel packets. */ byte=0; i=0; status=MagickTrue; (void) memset(&pixel,0,sizeof(pixel)); for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { if (info->samples_per_pixel == 1) { int pixel_value; if (info->bytes_per_pixel == 1) pixel_value=info->polarity != MagickFalse ? ((int) info->max_value-ReadDCMByte(stream_info,image)) : ReadDCMByte(stream_info,image); else if ((info->bits_allocated != 12) || (info->significant_bits != 12)) { if (info->signed_data != 0) pixel_value=ReadDCMSignedShort(stream_info,image); else pixel_value=(int) ReadDCMShort(stream_info,image); if (info->polarity != MagickFalse) pixel_value=(int)info->max_value-pixel_value; } else { if ((i & 0x01) != 0) { pixel_value=byte; byte=ReadDCMByte(stream_info,image); if (byte >= 0) pixel_value|=(byte << 8); } else { pixel_value=ReadDCMSignedShort(stream_info,image); byte=(int) (pixel_value & 0x0f); pixel_value>>=4; } i++; } if (info->signed_data == 1) pixel_value-=32767; index=pixel_value; if (info->rescale != MagickFalse) { double scaled_value; scaled_value=pixel_value*info->rescale_slope+ info->rescale_intercept; index=(int) scaled_value; if (info->window_width != 0) { double window_max, window_min; window_min=ceil(info->window_center- (info->window_width-1.0)/2.0-0.5); window_max=floor(info->window_center+ (info->window_width-1.0)/2.0+0.5); if (scaled_value <= window_min) index=0; else if (scaled_value > window_max) index=(int) info->max_value; else index=(int) (info->max_value*(((scaled_value- info->window_center-0.5)/(info->window_width-1))+0.5)); } } index&=info->mask; index=(int) ConstrainColormapIndex(image,(ssize_t) index,exception); if (first_segment != MagickFalse) SetPixelIndex(image,(Quantum) index,q); else SetPixelIndex(image,(Quantum) (((size_t) index) | (((size_t) GetPixelIndex(image,q)) << 8)),q); pixel.red=(unsigned int) image->colormap[index].red; pixel.green=(unsigned int) image->colormap[index].green; pixel.blue=(unsigned int) image->colormap[index].blue; } else { if (info->bytes_per_pixel == 1) { pixel.red=(unsigned int) ReadDCMByte(stream_info,image); pixel.green=(unsigned int) ReadDCMByte(stream_info,image); pixel.blue=(unsigned int) ReadDCMByte(stream_info,image); } else { pixel.red=ReadDCMShort(stream_info,image); pixel.green=ReadDCMShort(stream_info,image); pixel.blue=ReadDCMShort(stream_info,image); } pixel.red&=info->mask; pixel.green&=info->mask; pixel.blue&=info->mask; if (info->scale != (Quantum *) NULL) { if ((MagickSizeType) pixel.red <= GetQuantumRange(info->depth)) pixel.red=(unsigned int) info->scale[pixel.red]; if ((MagickSizeType) pixel.green <= GetQuantumRange(info->depth)) pixel.green=(unsigned int) info->scale[pixel.green]; if ((MagickSizeType) pixel.blue <= GetQuantumRange(info->depth)) pixel.blue=(unsigned int) info->scale[pixel.blue]; } } if (first_segment != MagickFalse) { SetPixelRed(image,(Quantum) pixel.red,q); SetPixelGreen(image,(Quantum) pixel.green,q); SetPixelBlue(image,(Quantum) pixel.blue,q); } else { SetPixelRed(image,(Quantum) (((size_t) pixel.red) | (((size_t) GetPixelRed(image,q)) << 8)),q); SetPixelGreen(image,(Quantum) (((size_t) pixel.green) | (((size_t) GetPixelGreen(image,q)) << 8)),q); SetPixelBlue(image,(Quantum) (((size_t) pixel.blue) | (((size_t) GetPixelBlue(image,q)) << 8)),q); } q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } return(status); }
0
hhvm
6937de5544c3eead3466b75020d8382080ed0cff
NOT_APPLICABLE
NOT_APPLICABLE
void requestInit() override { if (RuntimeOption::EnableUploadProgress) { rfc1867Callback = apc_rfc1867_progress; } else { rfc1867Callback = nullptr; } }
0
haproxy
bfb15ab34ead85f64cd6da0e9fb418c9cd14cee8
NOT_APPLICABLE
NOT_APPLICABLE
int http_process_tarpit(struct stream *s, struct channel *req, int an_bit) { struct http_txn *txn = s->txn; DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn, &txn->req); /* This connection is being tarpitted. The CLIENT side has * already set the connect expiration date to the right * timeout. We just have to check that the client is still * there and that the timeout has not expired. */ channel_dont_connect(req); if ((req->flags & (CF_SHUTR|CF_READ_ERROR)) == 0 && !tick_is_expired(req->analyse_exp, now_ms)) { /* Be sure to drain all data from the request channel */ channel_htx_erase(req, htxbuf(&req->buf)); DBG_TRACE_DEVEL("waiting for tarpit timeout expiry", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn); return 0; } /* We will set the queue timer to the time spent, just for * logging purposes. We fake a 500 server error, so that the * attacker will not suspect his connection has been tarpitted. * It will not cause trouble to the logs because we can exclude * the tarpitted connections by filtering on the 'PT' status flags. */ s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); http_reply_and_close(s, txn->status, (!(req->flags & CF_READ_ERROR) ? http_error_message(s) : NULL)); if (!(s->flags & SF_ERR_MASK)) s->flags |= SF_ERR_PRXCOND; if (!(s->flags & SF_FINST_MASK)) s->flags |= SF_FINST_T; DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn); return 0; }
0
ImageMagick6
35ccb468ee2dcbe8ce9cf1e2f1957acc27f54c34
CVE-2019-13137
CWE-399
static Image *ReadPSImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define BoundingBox "BoundingBox:" #define BeginDocument "BeginDocument:" #define BeginXMPPacket "<?xpacket begin=" #define EndXMPPacket "<?xpacket end=" #define ICCProfile "BeginICCProfile:" #define CMYKCustomColor "CMYKCustomColor:" #define CMYKProcessColor "CMYKProcessColor:" #define DocumentMedia "DocumentMedia:" #define DocumentCustomColors "DocumentCustomColors:" #define DocumentProcessColors "DocumentProcessColors:" #define EndDocument "EndDocument:" #define HiResBoundingBox "HiResBoundingBox:" #define ImageData "ImageData:" #define PageBoundingBox "PageBoundingBox:" #define LanguageLevel "LanguageLevel:" #define PageMedia "PageMedia:" #define Pages "Pages:" #define PhotoshopProfile "BeginPhotoshop:" #define PostscriptLevel "!PS-" #define RenderPostscriptText " Rendering Postscript... " #define SpotColor "+ " char command[MagickPathExtent], *density, filename[MagickPathExtent], geometry[MagickPathExtent], input_filename[MagickPathExtent], message[MagickPathExtent], *options, postscript_filename[MagickPathExtent]; const char *option; const DelegateInfo *delegate_info; GeometryInfo geometry_info; Image *image, *next, *postscript_image; ImageInfo *read_info; int c, file; MagickBooleanType cmyk, fitPage, skip, status; MagickStatusType flags; PointInfo delta, resolution; RectangleInfo page; register char *p; register ssize_t i; SegmentInfo bounds, hires_bounds; short int hex_digits[256]; size_t length; ssize_t count, priority; StringInfo *profile; unsigned long columns, extent, language_level, pages, rows, scene, spotcolor; /* 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,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } status=AcquireUniqueSymbolicLink(image_info->filename,input_filename); if (status == MagickFalse) { ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile", image_info->filename); image=DestroyImageList(image); return((Image *) NULL); } /* Initialize hex values. */ (void) memset(hex_digits,0,sizeof(hex_digits)); hex_digits[(int) '0']=0; hex_digits[(int) '1']=1; hex_digits[(int) '2']=2; hex_digits[(int) '3']=3; hex_digits[(int) '4']=4; hex_digits[(int) '5']=5; hex_digits[(int) '6']=6; hex_digits[(int) '7']=7; hex_digits[(int) '8']=8; hex_digits[(int) '9']=9; hex_digits[(int) 'a']=10; hex_digits[(int) 'b']=11; hex_digits[(int) 'c']=12; hex_digits[(int) 'd']=13; hex_digits[(int) 'e']=14; hex_digits[(int) 'f']=15; hex_digits[(int) 'A']=10; hex_digits[(int) 'B']=11; hex_digits[(int) 'C']=12; hex_digits[(int) 'D']=13; hex_digits[(int) 'E']=14; hex_digits[(int) 'F']=15; /* Set the page density. */ delta.x=DefaultResolution; delta.y=DefaultResolution; if ((image->resolution.x == 0.0) || (image->resolution.y == 0.0)) { flags=ParseGeometry(PSDensityGeometry,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } if (image_info->density != (char *) NULL) { flags=ParseGeometry(image_info->density,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } (void) ParseAbsoluteGeometry(PSPageGeometry,&page); if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); resolution=image->resolution; page.width=(size_t) ceil((double) (page.width*resolution.x/delta.x)-0.5); page.height=(size_t) ceil((double) (page.height*resolution.y/delta.y)-0.5); /* Determine page geometry from the Postscript bounding box. */ (void) memset(&bounds,0,sizeof(bounds)); (void) memset(command,0,sizeof(command)); cmyk=image_info->colorspace == CMYKColorspace ? MagickTrue : MagickFalse; (void) memset(&hires_bounds,0,sizeof(hires_bounds)); columns=0; rows=0; priority=0; rows=0; extent=0; spotcolor=0; language_level=1; pages=(~0UL); skip=MagickFalse; p=command; for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image)) { /* Note document structuring comments. */ *p++=(char) c; if ((strchr("\n\r%",c) == (char *) NULL) && ((size_t) (p-command) < (MagickPathExtent-1))) continue; *p='\0'; p=command; /* Skip %%BeginDocument thru %%EndDocument. */ if (LocaleNCompare(BeginDocument,command,strlen(BeginDocument)) == 0) skip=MagickTrue; if (LocaleNCompare(EndDocument,command,strlen(EndDocument)) == 0) skip=MagickFalse; if (skip != MagickFalse) continue; if (LocaleNCompare(PostscriptLevel,command,strlen(PostscriptLevel)) == 0) { (void) SetImageProperty(image,"ps:Level",command+4,exception); if (GlobExpression(command,"*EPSF-*",MagickTrue) != MagickFalse) pages=1; } if (LocaleNCompare(LanguageLevel,command,strlen(LanguageLevel)) == 0) (void) sscanf(command,LanguageLevel " %lu",&language_level); if (LocaleNCompare(Pages,command,strlen(Pages)) == 0) (void) sscanf(command,Pages " %lu",&pages); if (LocaleNCompare(ImageData,command,strlen(ImageData)) == 0) (void) sscanf(command,ImageData " %lu %lu",&columns,&rows); /* Is this a CMYK document? */ length=strlen(DocumentProcessColors); if (LocaleNCompare(DocumentProcessColors,command,length) == 0) { if ((GlobExpression(command,"*Cyan*",MagickTrue) != MagickFalse) || (GlobExpression(command,"*Magenta*",MagickTrue) != MagickFalse) || (GlobExpression(command,"*Yellow*",MagickTrue) != MagickFalse)) cmyk=MagickTrue; } if (LocaleNCompare(CMYKCustomColor,command,strlen(CMYKCustomColor)) == 0) cmyk=MagickTrue; if (LocaleNCompare(CMYKProcessColor,command,strlen(CMYKProcessColor)) == 0) cmyk=MagickTrue; length=strlen(DocumentCustomColors); if ((LocaleNCompare(DocumentCustomColors,command,length) == 0) || (LocaleNCompare(CMYKCustomColor,command,strlen(CMYKCustomColor)) == 0) || (LocaleNCompare(SpotColor,command,strlen(SpotColor)) == 0)) { char property[MagickPathExtent], *value; register char *q; /* Note spot names. */ (void) FormatLocaleString(property,MagickPathExtent, "ps:SpotColor-%.20g",(double) (spotcolor++)); for (q=command; *q != '\0'; q++) if (isspace((int) (unsigned char) *q) != 0) break; value=ConstantString(q); (void) SubstituteString(&value,"(",""); (void) SubstituteString(&value,")",""); (void) StripString(value); if (*value != '\0') (void) SetImageProperty(image,property,value,exception); value=DestroyString(value); continue; } if (image_info->page != (char *) NULL) continue; /* Note region defined by bounding box. */ count=0; i=0; if (LocaleNCompare(BoundingBox,command,strlen(BoundingBox)) == 0) { count=(ssize_t) sscanf(command,BoundingBox " %lf %lf %lf %lf", &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2); i=2; } if (LocaleNCompare(DocumentMedia,command,strlen(DocumentMedia)) == 0) { count=(ssize_t) sscanf(command,DocumentMedia " %lf %lf %lf %lf", &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2); i=1; } if (LocaleNCompare(HiResBoundingBox,command,strlen(HiResBoundingBox)) == 0) { count=(ssize_t) sscanf(command,HiResBoundingBox " %lf %lf %lf %lf", &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2); i=3; } if (LocaleNCompare(PageBoundingBox,command,strlen(PageBoundingBox)) == 0) { count=(ssize_t) sscanf(command,PageBoundingBox " %lf %lf %lf %lf", &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2); i=1; } if (LocaleNCompare(PageMedia,command,strlen(PageMedia)) == 0) { count=(ssize_t) sscanf(command,PageMedia " %lf %lf %lf %lf", &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2); i=1; } if ((count != 4) || (i < (ssize_t) priority)) continue; if ((fabs(bounds.x2-bounds.x1) <= fabs(hires_bounds.x2-hires_bounds.x1)) || (fabs(bounds.y2-bounds.y1) <= fabs(hires_bounds.y2-hires_bounds.y1))) if (i == (ssize_t) priority) continue; hires_bounds=bounds; priority=i; } if ((fabs(hires_bounds.x2-hires_bounds.x1) >= MagickEpsilon) && (fabs(hires_bounds.y2-hires_bounds.y1) >= MagickEpsilon)) { /* Set Postscript render geometry. */ (void) FormatLocaleString(geometry,MagickPathExtent,"%gx%g%+.15g%+.15g", hires_bounds.x2-hires_bounds.x1,hires_bounds.y2-hires_bounds.y1, hires_bounds.x1,hires_bounds.y1); (void) SetImageProperty(image,"ps:HiResBoundingBox",geometry,exception); page.width=(size_t) ceil((double) ((hires_bounds.x2-hires_bounds.x1)* resolution.x/delta.x)-0.5); page.height=(size_t) ceil((double) ((hires_bounds.y2-hires_bounds.y1)* resolution.y/delta.y)-0.5); } fitPage=MagickFalse; option=GetImageOption(image_info,"eps:fit-page"); if (option != (char *) NULL) { char *page_geometry; page_geometry=GetPageGeometry(option); flags=ParseMetaGeometry(page_geometry,&page.x,&page.y,&page.width, &page.height); if (flags == NoValue) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "InvalidGeometry","`%s'",option); image=DestroyImage(image); return((Image *) NULL); } page.width=(size_t) ceil((double) (page.width*image->resolution.x/delta.x) -0.5); page.height=(size_t) ceil((double) (page.height*image->resolution.y/ delta.y) -0.5); page_geometry=DestroyString(page_geometry); fitPage=MagickTrue; } if (IssRGBCompatibleColorspace(image_info->colorspace) != MagickFalse) cmyk=MagickFalse; /* Create Ghostscript control file. */ file=AcquireUniqueFileResource(postscript_filename); if (file == -1) { ThrowFileException(exception,FileOpenError,"UnableToOpenFile", image_info->filename); image=DestroyImageList(image); return((Image *) NULL); } (void) CopyMagickString(command,"/setpagedevice {pop} bind 1 index where {" "dup wcheck {3 1 roll put} {pop def} ifelse} {def} ifelse\n" "<</UseCIEColor true>>setpagedevice\n",MagickPathExtent); count=write(file,command,(unsigned int) strlen(command)); if (image_info->page == (char *) NULL) { char translate_geometry[MagickPathExtent]; (void) FormatLocaleString(translate_geometry,MagickPathExtent, "%g %g translate\n",-bounds.x1,-bounds.y1); count=write(file,translate_geometry,(unsigned int) strlen(translate_geometry)); } file=close(file)-1; /* Render Postscript with the Ghostscript delegate. */ if (image_info->monochrome != MagickFalse) delegate_info=GetDelegateInfo("ps:mono",(char *) NULL,exception); else if (cmyk != MagickFalse) delegate_info=GetDelegateInfo("ps:cmyk",(char *) NULL,exception); else delegate_info=GetDelegateInfo("ps:alpha",(char *) NULL,exception); if (delegate_info == (const DelegateInfo *) NULL) { (void) RelinquishUniqueFileResource(postscript_filename); image=DestroyImageList(image); return((Image *) NULL); } density=AcquireString(""); options=AcquireString(""); (void) FormatLocaleString(density,MagickPathExtent,"%gx%g",resolution.x, resolution.y); (void) FormatLocaleString(options,MagickPathExtent,"-g%.20gx%.20g ",(double) page.width,(double) page.height); read_info=CloneImageInfo(image_info); *read_info->magick='\0'; if (read_info->number_scenes != 0) { char pages[MagickPathExtent]; (void) FormatLocaleString(pages,MagickPathExtent,"-dFirstPage=%.20g " "-dLastPage=%.20g ",(double) read_info->scene+1,(double) (read_info->scene+read_info->number_scenes)); (void) ConcatenateMagickString(options,pages,MagickPathExtent); read_info->number_scenes=0; if (read_info->scenes != (char *) NULL) *read_info->scenes='\0'; } if (*image_info->magick == 'E') { option=GetImageOption(image_info,"eps:use-cropbox"); if ((option == (const char *) NULL) || (IsStringTrue(option) != MagickFalse)) (void) ConcatenateMagickString(options,"-dEPSCrop ",MagickPathExtent); if (fitPage != MagickFalse) (void) ConcatenateMagickString(options,"-dEPSFitPage ", MagickPathExtent); } (void) CopyMagickString(filename,read_info->filename,MagickPathExtent); (void) AcquireUniqueFilename(filename); (void) RelinquishUniqueFileResource(filename); (void) ConcatenateMagickString(filename,"%d",MagickPathExtent); (void) FormatLocaleString(command,MagickPathExtent, GetDelegateCommands(delegate_info), read_info->antialias != MagickFalse ? 4 : 1, read_info->antialias != MagickFalse ? 4 : 1,density,options,filename, postscript_filename,input_filename); options=DestroyString(options); density=DestroyString(density); *message='\0'; status=InvokePostscriptDelegate(read_info->verbose,command,message,exception); (void) InterpretImageFilename(image_info,image,filename,1, read_info->filename,exception); if ((status == MagickFalse) || (IsPostscriptRendered(read_info->filename) == MagickFalse)) { (void) ConcatenateMagickString(command," -c showpage",MagickPathExtent); status=InvokePostscriptDelegate(read_info->verbose,command,message, exception); } (void) RelinquishUniqueFileResource(postscript_filename); (void) RelinquishUniqueFileResource(input_filename); postscript_image=(Image *) NULL; if (status == MagickFalse) for (i=1; ; i++) { (void) InterpretImageFilename(image_info,image,filename,(int) i, read_info->filename,exception); if (IsPostscriptRendered(read_info->filename) == MagickFalse) break; (void) RelinquishUniqueFileResource(read_info->filename); } else for (i=1; ; i++) { (void) InterpretImageFilename(image_info,image,filename,(int) i, read_info->filename,exception); if (IsPostscriptRendered(read_info->filename) == MagickFalse) break; read_info->blob=NULL; read_info->length=0; next=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); if (next == (Image *) NULL) break; AppendImageToList(&postscript_image,next); } (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); if (postscript_image == (Image *) NULL) { if (*message != '\0') (void) ThrowMagickException(exception,GetMagickModule(), DelegateError,"PostscriptDelegateFailed","`%s'",message); image=DestroyImageList(image); return((Image *) NULL); } if (LocaleCompare(postscript_image->magick,"BMP") == 0) { Image *cmyk_image; cmyk_image=ConsolidateCMYKImages(postscript_image,exception); if (cmyk_image != (Image *) NULL) { postscript_image=DestroyImageList(postscript_image); postscript_image=cmyk_image; } } (void) SeekBlob(image,0,SEEK_SET); for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image)) { /* Note document structuring comments. */ *p++=(char) c; if ((strchr("\n\r%",c) == (char *) NULL) && ((size_t) (p-command) < (MagickPathExtent-1))) continue; *p='\0'; p=command; /* Skip %%BeginDocument thru %%EndDocument. */ if (LocaleNCompare(BeginDocument,command,strlen(BeginDocument)) == 0) skip=MagickTrue; if (LocaleNCompare(EndDocument,command,strlen(EndDocument)) == 0) skip=MagickFalse; if (skip != MagickFalse) continue; if (LocaleNCompare(ICCProfile,command,strlen(ICCProfile)) == 0) { unsigned char *datum; /* Read ICC profile. */ profile=AcquireStringInfo(MagickPathExtent); datum=GetStringInfoDatum(profile); for (i=0; (c=ProfileInteger(image,hex_digits)) != EOF; i++) { if (i >= (ssize_t) GetStringInfoLength(profile)) { SetStringInfoLength(profile,(size_t) i << 1); datum=GetStringInfoDatum(profile); } datum[i]=(unsigned char) c; } SetStringInfoLength(profile,(size_t) i+1); (void) SetImageProfile(image,"icc",profile,exception); profile=DestroyStringInfo(profile); continue; } if (LocaleNCompare(PhotoshopProfile,command,strlen(PhotoshopProfile)) == 0) { unsigned char *q; /* Read Photoshop profile. */ count=(ssize_t) sscanf(command,PhotoshopProfile " %lu",&extent); if (count != 1) continue; length=extent; if ((MagickSizeType) length > GetBlobSize(image)) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); profile=BlobToStringInfo((const void *) NULL,length); if (profile != (StringInfo *) NULL) { q=GetStringInfoDatum(profile); for (i=0; i < (ssize_t) length; i++) *q++=(unsigned char) ProfileInteger(image,hex_digits); (void) SetImageProfile(image,"8bim",profile,exception); profile=DestroyStringInfo(profile); } continue; } if (LocaleNCompare(BeginXMPPacket,command,strlen(BeginXMPPacket)) == 0) { /* Read XMP profile. */ p=command; profile=StringToStringInfo(command); for (i=(ssize_t) GetStringInfoLength(profile)-1; c != EOF; i++) { SetStringInfoLength(profile,(size_t) (i+1)); c=ReadBlobByte(image); GetStringInfoDatum(profile)[i]=(unsigned char) c; *p++=(char) c; if ((strchr("\n\r%",c) == (char *) NULL) && ((size_t) (p-command) < (MagickPathExtent-1))) continue; *p='\0'; p=command; if (LocaleNCompare(EndXMPPacket,command,strlen(EndXMPPacket)) == 0) break; } SetStringInfoLength(profile,(size_t) i); (void) SetImageProfile(image,"xmp",profile,exception); profile=DestroyStringInfo(profile); continue; } } (void) CloseBlob(image); if (image_info->number_scenes != 0) { Image *clone_image; /* Add place holder images to meet the subimage specification requirement. */ for (i=0; i < (ssize_t) image_info->scene; i++) { clone_image=CloneImage(postscript_image,1,1,MagickTrue,exception); if (clone_image != (Image *) NULL) PrependImageToList(&postscript_image,clone_image); } } do { (void) CopyMagickString(postscript_image->filename,filename, MagickPathExtent); (void) CopyMagickString(postscript_image->magick,image->magick, MagickPathExtent); if (columns != 0) postscript_image->magick_columns=columns; if (rows != 0) postscript_image->magick_rows=rows; postscript_image->page=page; (void) CloneImageProfiles(postscript_image,image); (void) CloneImageProperties(postscript_image,image); next=SyncNextImageInList(postscript_image); if (next != (Image *) NULL) postscript_image=next; } while (next != (Image *) NULL); image=DestroyImageList(image); scene=0; for (next=GetFirstImageInList(postscript_image); next != (Image *) NULL; ) { next->scene=scene++; next=GetNextImageInList(next); } return(GetFirstImageInList(postscript_image)); }
1
Chrome
94b3728a2836da335a10085d4089c9d8e1c9d225
NOT_APPLICABLE
NOT_APPLICABLE
void PDFiumEngine::KillFormFocus() { FORM_ForceToKillFocus(form_); SetInFormTextArea(false); }
0
httpd
3f1693d558d0758f829c8b53993f1749ddf6ffcb
NOT_APPLICABLE
NOT_APPLICABLE
static void lua_register_hooks(apr_pool_t *p) { /* ap_register_output_filter("luahood", luahood, NULL, AP_FTYPE_RESOURCE); */ ap_hook_handler(lua_handler, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_create_request(create_request_config, NULL, NULL, APR_HOOK_MIDDLE); /* http_request.h hooks */ ap_hook_translate_name(lua_translate_name_harness_first, NULL, NULL, AP_LUA_HOOK_FIRST); ap_hook_translate_name(lua_translate_name_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_translate_name(lua_translate_name_harness_last, NULL, NULL, AP_LUA_HOOK_LAST); ap_hook_fixups(lua_fixup_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_map_to_storage(lua_map_to_storage_harness, NULL, NULL, APR_HOOK_MIDDLE); /* XXX: Does not work :( * ap_hook_check_user_id(lua_check_user_id_harness_first, NULL, NULL, AP_LUA_HOOK_FIRST); */ ap_hook_check_user_id(lua_check_user_id_harness, NULL, NULL, APR_HOOK_MIDDLE); /* XXX: Does not work :( * ap_hook_check_user_id(lua_check_user_id_harness_last, NULL, NULL, AP_LUA_HOOK_LAST); */ ap_hook_type_checker(lua_type_checker_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_access_checker(lua_access_checker_harness_first, NULL, NULL, AP_LUA_HOOK_FIRST); ap_hook_access_checker(lua_access_checker_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_access_checker(lua_access_checker_harness_last, NULL, NULL, AP_LUA_HOOK_LAST); ap_hook_auth_checker(lua_auth_checker_harness_first, NULL, NULL, AP_LUA_HOOK_FIRST); ap_hook_auth_checker(lua_auth_checker_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_auth_checker(lua_auth_checker_harness_last, NULL, NULL, AP_LUA_HOOK_LAST); ap_hook_insert_filter(lua_insert_filter_harness, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_quick_handler(lua_quick_harness, NULL, NULL, APR_HOOK_FIRST); ap_hook_post_config(lua_post_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_pre_config(lua_pre_config, NULL, NULL, APR_HOOK_MIDDLE); APR_OPTIONAL_HOOK(ap_lua, lua_open, lua_open_hook, NULL, NULL, APR_HOOK_REALLY_FIRST); APR_OPTIONAL_HOOK(ap_lua, lua_request, lua_request_hook, NULL, NULL, APR_HOOK_REALLY_FIRST); ap_hook_handler(lua_map_handler, NULL, NULL, AP_LUA_HOOK_FIRST); /* Hook this right before FallbackResource kicks in */ ap_hook_fixups(lua_map_handler_fixups, NULL, NULL, AP_LUA_HOOK_LAST-2); #if APR_HAS_THREADS ap_hook_child_init(ap_lua_init_mutex, NULL, NULL, APR_HOOK_MIDDLE); #endif /* providers */ lua_authz_providers = apr_hash_make(p); /* Logging catcher */ ap_hook_log_transaction(lua_log_transaction_harness,NULL,NULL, APR_HOOK_FIRST); }
0
imageworsener
a4f247707f08e322f0b41e82c3e06e224240a654
NOT_APPLICABLE
NOT_APPLICABLE
static void iw_set_intermed_channeltypes(struct iw_context *ctx) { int i; for(i=0;i<ctx->intermed_numchannels;i++) { ctx->intermed_ci[i].channeltype = iw_get_channeltype(ctx->intermed_imgtype,i); } }
0
openssl
30c22fa8b1d840036b8e203585738df62a03cec8
NOT_APPLICABLE
NOT_APPLICABLE
int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) { if (dest->meth->group_copy == 0) { ECerr(EC_F_EC_GROUP_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (dest->meth != src->meth) { ECerr(EC_F_EC_GROUP_COPY, EC_R_INCOMPATIBLE_OBJECTS); return 0; } if (dest == src) return 1; dest->curve_name = src->curve_name; /* Copy precomputed */ dest->pre_comp_type = src->pre_comp_type; switch (src->pre_comp_type) { case PCT_none: dest->pre_comp.ec = NULL; break; case PCT_nistz256: #ifdef ECP_NISTZ256_ASM dest->pre_comp.nistz256 = EC_nistz256_pre_comp_dup(src->pre_comp.nistz256); #endif break; #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 case PCT_nistp224: dest->pre_comp.nistp224 = EC_nistp224_pre_comp_dup(src->pre_comp.nistp224); break; case PCT_nistp256: dest->pre_comp.nistp256 = EC_nistp256_pre_comp_dup(src->pre_comp.nistp256); break; case PCT_nistp521: dest->pre_comp.nistp521 = EC_nistp521_pre_comp_dup(src->pre_comp.nistp521); break; #else case PCT_nistp224: case PCT_nistp256: case PCT_nistp521: break; #endif case PCT_ec: dest->pre_comp.ec = EC_ec_pre_comp_dup(src->pre_comp.ec); break; } if (src->mont_data != NULL) { if (dest->mont_data == NULL) { dest->mont_data = BN_MONT_CTX_new(); if (dest->mont_data == NULL) return 0; } if (!BN_MONT_CTX_copy(dest->mont_data, src->mont_data)) return 0; } else { /* src->generator == NULL */ BN_MONT_CTX_free(dest->mont_data); dest->mont_data = NULL; } if (src->generator != NULL) { if (dest->generator == NULL) { dest->generator = EC_POINT_new(dest); if (dest->generator == NULL) return 0; } if (!EC_POINT_copy(dest->generator, src->generator)) return 0; } else { /* src->generator == NULL */ EC_POINT_clear_free(dest->generator); dest->generator = NULL; } if ((src->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) { if (!BN_copy(dest->order, src->order)) return 0; if (!BN_copy(dest->cofactor, src->cofactor)) return 0; } dest->asn1_flag = src->asn1_flag; dest->asn1_form = src->asn1_form; if (src->seed) { OPENSSL_free(dest->seed); if ((dest->seed = OPENSSL_malloc(src->seed_len)) == NULL) { ECerr(EC_F_EC_GROUP_COPY, ERR_R_MALLOC_FAILURE); return 0; } if (!memcpy(dest->seed, src->seed, src->seed_len)) return 0; dest->seed_len = src->seed_len; } else { OPENSSL_free(dest->seed); dest->seed = NULL; dest->seed_len = 0; } return dest->meth->group_copy(dest, src); }
0
w3m
ec9eb22e008a69ea9dc21fdca4b9b836679965ee
CVE-2016-9443
CWE-476
formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form) { Buffer save; char *p; int spos, epos, rows, c_rows, pos, col = 0; Line *l; copyBuffer(&save, buf); gotoLine(buf, a->start.line); switch (form->type) { case FORM_TEXTAREA: case FORM_INPUT_TEXT: case FORM_INPUT_FILE: case FORM_INPUT_PASSWORD: case FORM_INPUT_CHECKBOX: case FORM_INPUT_RADIO: #ifdef MENU_SELECT case FORM_SELECT: #endif /* MENU_SELECT */ spos = a->start.pos; epos = a->end.pos; break; default: spos = a->start.pos + 1; epos = a->end.pos - 1; } switch (form->type) { case FORM_INPUT_CHECKBOX: case FORM_INPUT_RADIO: if (form->checked) buf->currentLine->lineBuf[spos] = '*'; else buf->currentLine->lineBuf[spos] = ' '; break; case FORM_INPUT_TEXT: case FORM_INPUT_FILE: case FORM_INPUT_PASSWORD: case FORM_TEXTAREA: #ifdef MENU_SELECT case FORM_SELECT: if (form->type == FORM_SELECT) { p = form->label->ptr; updateSelectOption(form, form->select_option); } else #endif /* MENU_SELECT */ p = form->value->ptr; l = buf->currentLine; if (!l) break; if (form->type == FORM_TEXTAREA) { int n = a->y - buf->currentLine->linenumber; if (n > 0) for (; l && n; l = l->prev, n--) ; else if (n < 0) for (; l && n; l = l->prev, n++) ; if (!l) break; } rows = form->rows ? form->rows : 1; col = COLPOS(l, a->start.pos); for (c_rows = 0; c_rows < rows; c_rows++, l = l->next) { if (rows > 1) { pos = columnPos(l, col); a = retrieveAnchor(buf->formitem, l->linenumber, pos); if (a == NULL) break; spos = a->start.pos; epos = a->end.pos; } if (a->start.line != a->end.line || spos > epos || epos >= l->len) break; pos = form_update_line(l, &p, spos, epos, COLPOS(l, epos) - col, rows > 1, form->type == FORM_INPUT_PASSWORD); if (pos != epos) { shiftAnchorPosition(buf->href, buf->hmarklist, a->start.line, spos, pos - epos); shiftAnchorPosition(buf->name, buf->hmarklist, a->start.line, spos, pos - epos); shiftAnchorPosition(buf->img, buf->hmarklist, a->start.line, spos, pos - epos); shiftAnchorPosition(buf->formitem, buf->hmarklist, a->start.line, spos, pos - epos); } } break; } copyBuffer(buf, &save); arrangeLine(buf); }
1
linux-stable
0c461cb727d146c9ef2d3e86214f498b78b7d125
NOT_APPLICABLE
NOT_APPLICABLE
static int socket_sockcreate_sid(const struct task_security_struct *tsec, u16 secclass, u32 *socksid) { if (tsec->sockcreate_sid > SECSID_NULL) { *socksid = tsec->sockcreate_sid; return 0; } return security_transition_sid(tsec->sid, tsec->sid, secclass, NULL, socksid); }
0
php-src
b101a6bbd4f2181c360bd38e7683df4a03cba83e
NOT_APPLICABLE
NOT_APPLICABLE
void zend_unset_timeout(void) /* {{{ */ { #ifdef ZEND_WIN32 if (NULL != tq_timer) { if (!DeleteTimerQueueTimer(NULL, tq_timer, NULL)) { EG(timed_out) = 0; tq_timer = NULL; zend_error_noreturn(E_ERROR, "Could not delete queued timer"); return; } tq_timer = NULL; } EG(timed_out) = 0; #else # ifdef HAVE_SETITIMER if (EG(timeout_seconds)) { struct itimerval no_timeout; no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0; #ifdef __CYGWIN__ setitimer(ITIMER_REAL, &no_timeout, NULL); #else setitimer(ITIMER_PROF, &no_timeout, NULL); #endif } # endif #endif } /* }}} */
0
Chrome
eea3300239f0b53e172a320eb8de59d0bea65f27
CVE-2017-5011
CWE-200
void DevToolsUIBindings::RecordEnumeratedHistogram(const std::string& name, int sample, int boundary_value) { if (!(boundary_value >= 0 && boundary_value <= 100 && sample >= 0 && sample < boundary_value)) { frontend_host_->BadMessageRecieved(); return; } if (name == kDevToolsActionTakenHistogram) UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); else if (name == kDevToolsPanelShownHistogram) UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value); else frontend_host_->BadMessageRecieved(); }
1
libarchive
05caadc7eedbef471ac9610809ba683f0c698700
NOT_APPLICABLE
NOT_APPLICABLE
ppmd_free(void *p, void *address) { (void)p; free(address); }
0
samba
9d989c9dd7a5b92d0c5d65287935471b83b6e884
NOT_APPLICABLE
NOT_APPLICABLE
bool asn1_write_BitString(struct asn1_data *data, const void *p, size_t length, uint8_t padding) { if (!asn1_push_tag(data, ASN1_BIT_STRING)) return false; if (!asn1_write_uint8(data, padding)) return false; if (!asn1_write(data, p, length)) return false; return asn1_pop_tag(data); }
0
httpd
3f1693d558d0758f829c8b53993f1749ddf6ffcb
NOT_APPLICABLE
NOT_APPLICABLE
static const char *register_lua_scope(cmd_parms *cmd, void *_cfg, const char *scope, const char *min, const char *max) { ap_lua_dir_cfg *cfg = (ap_lua_dir_cfg *) _cfg; if (strcmp("once", scope) == 0) { cfg->vm_scope = AP_LUA_SCOPE_ONCE; } else if (strcmp("request", scope) == 0) { cfg->vm_scope = AP_LUA_SCOPE_REQUEST; } else if (strcmp("conn", scope) == 0) { cfg->vm_scope = AP_LUA_SCOPE_CONN; } else if (strcmp("thread", scope) == 0) { #if !APR_HAS_THREADS return apr_psprintf(cmd->pool, "Scope type of '%s' cannot be used because this " "server does not have threading support " "(APR_HAS_THREADS)" scope); #endif cfg->vm_scope = AP_LUA_SCOPE_THREAD; } else if (strcmp("server", scope) == 0) { unsigned int vmin, vmax; #if !APR_HAS_THREADS return apr_psprintf(cmd->pool, "Scope type of '%s' cannot be used because this " "server does not have threading support " "(APR_HAS_THREADS)" scope); #endif cfg->vm_scope = AP_LUA_SCOPE_SERVER; vmin = min ? atoi(min) : 1; vmax = max ? atoi(max) : 1; if (vmin == 0) { vmin = 1; } if (vmax < vmin) { vmax = vmin; } cfg->vm_min = vmin; cfg->vm_max = vmax; } else { return apr_psprintf(cmd->pool, "Invalid value for LuaScope, '%s', acceptable " "values are: 'once', 'request', 'conn'" #if APR_HAS_THREADS ", 'thread', 'server'" #endif ,scope); } return NULL; }
0
libxslt
6ce8de69330783977dd14f6569419489875fb71b
NOT_APPLICABLE
NOT_APPLICABLE
xsltNumberFormat(xsltTransformContextPtr ctxt, xsltNumberDataPtr data, xmlNodePtr node) { xmlBufferPtr output = NULL; int amount, i; double number; xsltFormat tokens; if (data->format != NULL) { xsltNumberFormatTokenize(data->format, &tokens); } else { xmlChar *format; /* The format needs to be recomputed each time */ if (data->has_format == 0) return; format = xsltEvalAttrValueTemplate(ctxt, data->node, (const xmlChar *) "format", XSLT_NAMESPACE); if (format == NULL) return; xsltNumberFormatTokenize(format, &tokens); xmlFree(format); } output = xmlBufferCreate(); if (output == NULL) goto XSLT_NUMBER_FORMAT_END; /* * Evaluate the XPath expression to find the value(s) */ if (data->value) { amount = xsltNumberFormatGetValue(ctxt->xpathCtxt, node, data->value, &number); if (amount == 1) { xsltNumberFormatInsertNumbers(data, &number, 1, &tokens, output); } } else if (data->level) { if (xmlStrEqual(data->level, (const xmlChar *) "single")) { amount = xsltNumberFormatGetMultipleLevel(ctxt, node, data->countPat, data->fromPat, &number, 1); if (amount == 1) { xsltNumberFormatInsertNumbers(data, &number, 1, &tokens, output); } } else if (xmlStrEqual(data->level, (const xmlChar *) "multiple")) { double numarray[1024]; int max = sizeof(numarray)/sizeof(numarray[0]); amount = xsltNumberFormatGetMultipleLevel(ctxt, node, data->countPat, data->fromPat, numarray, max); if (amount > 0) { xsltNumberFormatInsertNumbers(data, numarray, amount, &tokens, output); } } else if (xmlStrEqual(data->level, (const xmlChar *) "any")) { amount = xsltNumberFormatGetAnyLevel(ctxt, node, data->countPat, data->fromPat, &number); if (amount > 0) { xsltNumberFormatInsertNumbers(data, &number, 1, &tokens, output); } } /* * Unlike `match` patterns, `count` and `from` patterns can contain * variable references, so we have to clear the pattern match * cache if the "direct" matching algorithm was used. */ if (data->countPat != NULL) xsltCompMatchClearCache(ctxt, data->countPat); if (data->fromPat != NULL) xsltCompMatchClearCache(ctxt, data->fromPat); } /* Insert number as text node */ xsltCopyTextString(ctxt, ctxt->insert, xmlBufferContent(output), 0); xmlBufferFree(output); XSLT_NUMBER_FORMAT_END: if (tokens.start != NULL) xmlFree(tokens.start); if (tokens.end != NULL) xmlFree(tokens.end); for (i = 0;i < tokens.nTokens;i++) { if (tokens.tokens[i].separator != NULL) xmlFree(tokens.tokens[i].separator); } }
0
flatpak
a9107feeb4b8275b78965b36bf21b92d5724699e
NOT_APPLICABLE
NOT_APPLICABLE
setup_seccomp (FlatpakBwrap *bwrap, const char *arch, gulong allowed_personality, FlatpakRunFlags run_flags, GError **error) { gboolean multiarch = (run_flags & FLATPAK_RUN_FLAG_MULTIARCH) != 0; gboolean devel = (run_flags & FLATPAK_RUN_FLAG_DEVEL) != 0; __attribute__((cleanup (cleanup_seccomp))) scmp_filter_ctx seccomp = NULL; /**** BEGIN NOTE ON CODE SHARING * * There are today a number of different Linux container * implementations. That will likely continue for long into the * future. But we can still try to share code, and it's important * to do so because it affects what library and application writers * can do, and we should support code portability between different * container tools. * * This syscall blacklist is copied from linux-user-chroot, which was in turn * clearly influenced by the Sandstorm.io blacklist. * * If you make any changes here, I suggest sending the changes along * to other sandbox maintainers. Using the libseccomp list is also * an appropriate venue: * https://groups.google.com/forum/#!topic/libseccomp * * A non-exhaustive list of links to container tooling that might * want to share this blacklist: * * https://github.com/sandstorm-io/sandstorm * in src/sandstorm/supervisor.c++ * https://github.com/flatpak/flatpak.git * in common/flatpak-run.c * https://git.gnome.org/browse/linux-user-chroot * in src/setup-seccomp.c * **** END NOTE ON CODE SHARING */ struct { int scall; struct scmp_arg_cmp *arg; } syscall_blacklist[] = { /* Block dmesg */ {SCMP_SYS (syslog)}, /* Useless old syscall */ {SCMP_SYS (uselib)}, /* Don't allow disabling accounting */ {SCMP_SYS (acct)}, /* 16-bit code is unnecessary in the sandbox, and modify_ldt is a historic source of interesting information leaks. */ {SCMP_SYS (modify_ldt)}, /* Don't allow reading current quota use */ {SCMP_SYS (quotactl)}, /* Don't allow access to the kernel keyring */ {SCMP_SYS (add_key)}, {SCMP_SYS (keyctl)}, {SCMP_SYS (request_key)}, /* Scary VM/NUMA ops */ {SCMP_SYS (move_pages)}, {SCMP_SYS (mbind)}, {SCMP_SYS (get_mempolicy)}, {SCMP_SYS (set_mempolicy)}, {SCMP_SYS (migrate_pages)}, /* Don't allow subnamespace setups: */ {SCMP_SYS (unshare)}, {SCMP_SYS (mount)}, {SCMP_SYS (pivot_root)}, {SCMP_SYS (clone), &SCMP_A0 (SCMP_CMP_MASKED_EQ, CLONE_NEWUSER, CLONE_NEWUSER)}, /* Don't allow faking input to the controlling tty (CVE-2017-5226) */ {SCMP_SYS (ioctl), &SCMP_A1 (SCMP_CMP_MASKED_EQ, 0xFFFFFFFFu, (int) TIOCSTI)}, }; struct { int scall; struct scmp_arg_cmp *arg; } syscall_nondevel_blacklist[] = { /* Profiling operations; we expect these to be done by tools from outside * the sandbox. In particular perf has been the source of many CVEs. */ {SCMP_SYS (perf_event_open)}, /* Don't allow you to switch to bsd emulation or whatnot */ {SCMP_SYS (personality), &SCMP_A0 (SCMP_CMP_NE, allowed_personality)}, {SCMP_SYS (ptrace)} }; /* Blacklist all but unix, inet, inet6 and netlink */ struct { int family; FlatpakRunFlags flags_mask; } socket_family_whitelist[] = { /* NOTE: Keep in numerical order */ { AF_UNSPEC, 0 }, { AF_LOCAL, 0 }, { AF_INET, 0 }, { AF_INET6, 0 }, { AF_NETLINK, 0 }, { AF_CAN, FLATPAK_RUN_FLAG_CANBUS }, { AF_BLUETOOTH, FLATPAK_RUN_FLAG_BLUETOOTH }, }; int last_allowed_family; int i, r; g_auto(GLnxTmpfile) seccomp_tmpf = { 0, }; seccomp = seccomp_init (SCMP_ACT_ALLOW); if (!seccomp) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Initialize seccomp failed")); if (arch != NULL) { uint32_t arch_id = 0; const uint32_t *extra_arches = NULL; if (strcmp (arch, "i386") == 0) { arch_id = SCMP_ARCH_X86; } else if (strcmp (arch, "x86_64") == 0) { arch_id = SCMP_ARCH_X86_64; extra_arches = seccomp_x86_64_extra_arches; } else if (strcmp (arch, "arm") == 0) { arch_id = SCMP_ARCH_ARM; } #ifdef SCMP_ARCH_AARCH64 else if (strcmp (arch, "aarch64") == 0) { arch_id = SCMP_ARCH_AARCH64; extra_arches = seccomp_aarch64_extra_arches; } #endif /* We only really need to handle arches on multiarch systems. * If only one arch is supported the default is fine */ if (arch_id != 0) { /* This *adds* the target arch, instead of replacing the native one. This is not ideal, because we'd like to only allow the target arch, but we can't really disallow the native arch at this point, because then bubblewrap couldn't continue running. */ r = seccomp_arch_add (seccomp, arch_id); if (r < 0 && r != -EEXIST) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to add architecture to seccomp filter")); if (multiarch && extra_arches != NULL) { unsigned i; for (i = 0; extra_arches[i] != 0; i++) { r = seccomp_arch_add (seccomp, extra_arches[i]); if (r < 0 && r != -EEXIST) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to add multiarch architecture to seccomp filter")); } } } } /* TODO: Should we filter the kernel keyring syscalls in some way? * We do want them to be used by desktop apps, but they could also perhaps * leak system stuff or secrets from other apps. */ for (i = 0; i < G_N_ELEMENTS (syscall_blacklist); i++) { int scall = syscall_blacklist[i].scall; if (syscall_blacklist[i].arg) r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 1, *syscall_blacklist[i].arg); else r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 0); if (r < 0 && r == -EFAULT /* unknown syscall */) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to block syscall %d"), scall); } if (!devel) { for (i = 0; i < G_N_ELEMENTS (syscall_nondevel_blacklist); i++) { int scall = syscall_nondevel_blacklist[i].scall; if (syscall_nondevel_blacklist[i].arg) r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 1, *syscall_nondevel_blacklist[i].arg); else r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 0); if (r < 0 && r == -EFAULT /* unknown syscall */) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to block syscall %d"), scall); } } /* Socket filtering doesn't work on e.g. i386, so ignore failures here * However, we need to user seccomp_rule_add_exact to avoid libseccomp doing * something else: https://github.com/seccomp/libseccomp/issues/8 */ last_allowed_family = -1; for (i = 0; i < G_N_ELEMENTS (socket_family_whitelist); i++) { int family = socket_family_whitelist[i].family; int disallowed; if (socket_family_whitelist[i].flags_mask != 0 && (socket_family_whitelist[i].flags_mask & run_flags) != socket_family_whitelist[i].flags_mask) continue; for (disallowed = last_allowed_family + 1; disallowed < family; disallowed++) { /* Blacklist the in-between valid families */ seccomp_rule_add_exact (seccomp, SCMP_ACT_ERRNO (EAFNOSUPPORT), SCMP_SYS (socket), 1, SCMP_A0 (SCMP_CMP_EQ, disallowed)); } last_allowed_family = family; } /* Blacklist the rest */ seccomp_rule_add_exact (seccomp, SCMP_ACT_ERRNO (EAFNOSUPPORT), SCMP_SYS (socket), 1, SCMP_A0 (SCMP_CMP_GE, last_allowed_family + 1)); if (!glnx_open_anonymous_tmpfile (O_RDWR | O_CLOEXEC, &seccomp_tmpf, error)) return FALSE; if (seccomp_export_bpf (seccomp, seccomp_tmpf.fd) != 0) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to export bpf")); lseek (seccomp_tmpf.fd, 0, SEEK_SET); flatpak_bwrap_add_args_data_fd (bwrap, "--seccomp", glnx_steal_fd (&seccomp_tmpf.fd), NULL); return TRUE; }
0
w3m
8354763b90490d4105695df52674d0fcef823e92
NOT_APPLICABLE
NOT_APPLICABLE
bsearch_double(double e, double *ent, short *indexarray, int nent) { int n = nent; int k = 0; while (n > 0) { int nn = n / 2; int idx = indexarray[k + nn]; double ne = ent[idx]; if (ne == e) { k += nn; break; } else if (ne > e) { n -= nn + 1; k += nn + 1; } else { n = nn; } } return k; }
0
kde
71554140bdaede27b95dbe4c9b5a028a83c83cce
CVE-2017-8849
CWE-20
ActionReply Smb4KMountHelper::mount(const QVariantMap &args) { ActionReply reply; reply.addData("mh_mountpoint", args["mh_mountpoint"]); command << args["mh_unc"].toString(); command << args["mh_mountpoint"].toString(); command << args["mh_options"].toStringList(); #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) command << args["mh_command"].toString(); command << args["mh_options"].toStringList(); command << args["mh_unc"].toString(); command << args["mh_mountpoint"].toString(); #else #endif proc.setProgram(command); proc.start(); if (proc.waitForStarted(-1)) { bool user_kill = false; QStringList command; #if defined(Q_OS_LINUX) command << args["mh_command"].toString(); command << args["mh_unc"].toString(); command << args["mh_mountpoint"].toString(); command << args["mh_options"].toStringList(); #elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) command << args["mh_command"].toString(); command << args["mh_options"].toStringList(); command << args["mh_unc"].toString(); command << args["mh_mountpoint"].toString(); { } if (HelperSupport::isStopped()) { proc.kill(); user_kill = true; break; } else { } } if (proc.exitStatus() == KProcess::CrashExit) { if (!user_kill) { reply.setErrorCode(ActionReply::HelperError); reply.setErrorDescription(i18n("The mount process crashed.")); return reply; } else { } } else { QString stdErr = QString::fromUtf8(proc.readAllStandardError()); reply.addData("mh_error_message", stdErr.trimmed()); } }
1
Sigil
0979ba8d10c96ebca330715bfd4494ea0e019a8f
NOT_APPLICABLE
NOT_APPLICABLE
NoHTMLFiles(const std::string &msg) : std::runtime_error(msg) { };
0
linux
38740a5b87d53ceb89eb2c970150f6e94e00373a
NOT_APPLICABLE
NOT_APPLICABLE
static struct ffs_dev *_ffs_get_single_dev(void) { struct ffs_dev *dev; if (list_is_singular(&ffs_devices)) { dev = list_first_entry(&ffs_devices, struct ffs_dev, entry); if (dev->single) return dev; } return NULL; }
0
linux
1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6
NOT_APPLICABLE
NOT_APPLICABLE
__ctnetlink_change_status(struct nf_conn *ct, unsigned long on, unsigned long off) { unsigned int bit; /* Ignore these unchangable bits */ on &= ~IPS_UNCHANGEABLE_MASK; off &= ~IPS_UNCHANGEABLE_MASK; for (bit = 0; bit < __IPS_MAX_BIT; bit++) { if (on & (1 << bit)) set_bit(bit, &ct->status); else if (off & (1 << bit)) clear_bit(bit, &ct->status); } }
0
openssl
6a51b9e1d0cf0bf8515f7201b68fb0a3482b3dc1
NOT_APPLICABLE
NOT_APPLICABLE
static int evp_EncryptDecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j, bl, cmpl = inl; if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) cmpl = (cmpl + 7) / 8; bl = ctx->cipher->block_size; /* * CCM mode needs to know about the case where inl == 0 && in == NULL - it * means the plaintext/ciphertext length is 0 */ if (inl < 0 || (inl == 0 && EVP_CIPHER_mode(ctx->cipher) != EVP_CIPH_CCM_MODE)) { *outl = 0; return inl == 0; } if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { /* If block size > 1 then the cipher will have to do this check */ if (bl == 1 && is_partially_overlapping(out, in, cmpl)) { EVPerr(EVP_F_EVP_ENCRYPTDECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); return 0; } i = ctx->cipher->do_cipher(ctx, out, in, inl); if (i < 0) return 0; else *outl = i; return 1; } if (is_partially_overlapping(out + ctx->buf_len, in, cmpl)) { EVPerr(EVP_F_EVP_ENCRYPTDECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); return 0; } if (ctx->buf_len == 0 && (inl & (ctx->block_mask)) == 0) { if (ctx->cipher->do_cipher(ctx, out, in, inl)) { *outl = inl; return 1; } else { *outl = 0; return 0; } } i = ctx->buf_len; OPENSSL_assert(bl <= (int)sizeof(ctx->buf)); if (i != 0) { if (bl - i > inl) { memcpy(&(ctx->buf[i]), in, inl); ctx->buf_len += inl; *outl = 0; return 1; } else { j = bl - i; /* * Once we've processed the first j bytes from in, the amount of * data left that is a multiple of the block length is: * (inl - j) & ~(bl - 1) * We must ensure that this amount of data, plus the one block that * we process from ctx->buf does not exceed INT_MAX */ if (((inl - j) & ~(bl - 1)) > INT_MAX - bl) { EVPerr(EVP_F_EVP_ENCRYPTDECRYPTUPDATE, EVP_R_OUTPUT_WOULD_OVERFLOW); return 0; } memcpy(&(ctx->buf[i]), in, j); inl -= j; in += j; if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl)) return 0; out += bl; *outl = bl; } } else *outl = 0; i = inl & (bl - 1); inl -= i; if (inl > 0) { if (!ctx->cipher->do_cipher(ctx, out, in, inl)) return 0; *outl += inl; } if (i != 0) memcpy(ctx->buf, &(in[inl]), i); ctx->buf_len = i; return 1; }
0
FFmpeg
ba4beaf6149f7241c8bd85fe853318c2f6837ad0
NOT_APPLICABLE
NOT_APPLICABLE
static inline int range_get_symbol(APEContext *ctx, const uint16_t counts[], const uint16_t counts_diff[]) { int symbol, cf; cf = range_decode_culshift(ctx, 16); if(cf > 65492){ symbol= cf - 65535 + 63; range_decode_update(ctx, 1, cf); if(cf > 65535) ctx->error=1; return symbol; } /* figure out the symbol inefficiently; a binary search would be much better */ for (symbol = 0; counts[symbol + 1] <= cf; symbol++); range_decode_update(ctx, counts_diff[symbol], counts[symbol]); return symbol; }
0
php-src
75f40ae1f3a7ca837d230f099627d121f9b3a32f
NOT_APPLICABLE
NOT_APPLICABLE
static zend_bool soap_check_xml_ref(zval **data, xmlNodePtr node TSRMLS_DC) { zval **data_ptr; if (SOAP_GLOBAL(ref_map)) { if (zend_hash_index_find(SOAP_GLOBAL(ref_map), (ulong)node, (void**)&data_ptr) == SUCCESS) { if (*data != *data_ptr) { zval_ptr_dtor(data); *data = *data_ptr; Z_SET_ISREF_PP(data); Z_ADDREF_PP(data); return 1; } } else { zend_hash_index_update(SOAP_GLOBAL(ref_map), (ulong)node, (void**)data, sizeof(zval*), NULL); } } return 0; }
0
ChakraCore
402f3d967c0a905ec5b9ca9c240783d3f2c15724
NOT_APPLICABLE
NOT_APPLICABLE
ParseNodePtr Parser::ParseClassDecl(BOOL isDeclaration, LPCOLESTR pNameHint, uint32 *pHintLength, uint32 *pShortNameOffset) { bool hasConstructor = false; bool hasExtends = false; IdentPtr name = nullptr; ParseNodePtr pnodeName = nullptr; ParseNodePtr pnodeConstructor = nullptr; ParseNodePtr pnodeExtends = nullptr; ParseNodePtr pnodeMembers = nullptr; ParseNodePtr *lastMemberNodeRef = nullptr; ParseNodePtr pnodeStaticMembers = nullptr; ParseNodePtr *lastStaticMemberNodeRef = nullptr; uint32 nameHintLength = pHintLength ? *pHintLength : 0; uint32 nameHintOffset = pShortNameOffset ? *pShortNameOffset : 0; ArenaAllocator tempAllocator(_u("ClassMemberNames"), m_nodeAllocator.GetPageAllocator(), Parser::OutOfMemory); ParseNodePtr pnodeClass = nullptr; if (buildAST) { pnodeClass = CreateNode(knopClassDecl); CHAKRATEL_LANGSTATS_INC_LANGFEATURECOUNT(Class, m_scriptContext); } m_pscan->Scan(); if (m_token.tk == tkID) { name = m_token.GetIdentifier(m_phtbl); m_pscan->Scan(); } else if (isDeclaration) { IdentifierExpectedError(m_token); } if (isDeclaration && name == wellKnownPropertyPids.arguments && GetCurrentBlockInfo()->pnodeBlock->sxBlock.blockType == Function) { GetCurrentFunctionNode()->grfpn |= PNodeFlags::fpnArguments_overriddenByDecl; } BOOL strictSave = m_fUseStrictMode; m_fUseStrictMode = TRUE; ParseNodePtr pnodeDeclName = nullptr; if (isDeclaration) { pnodeDeclName = CreateBlockScopedDeclNode(name, knopLetDecl); } ParseNodePtr *ppnodeScopeSave = nullptr; ParseNodePtr *ppnodeExprScopeSave = nullptr; ParseNodePtr pnodeBlock = StartParseBlock<buildAST>(PnodeBlockType::Regular, ScopeType_Block); if (buildAST) { PushFuncBlockScope(pnodeBlock, &ppnodeScopeSave, &ppnodeExprScopeSave); pnodeClass->sxClass.pnodeBlock = pnodeBlock; } if (name) { pnodeName = CreateBlockScopedDeclNode(name, knopConstDecl); } if (m_token.tk == tkEXTENDS) { m_pscan->Scan(); pnodeExtends = ParseExpr<buildAST>(); hasExtends = true; } if (m_token.tk != tkLCurly) { Error(ERRnoLcurly); } OUTPUT_TRACE_DEBUGONLY(Js::ES6VerboseFlag, _u("Parsing class (%s) : %s\n"), GetParseType(), name ? name->Psz() : _u("anonymous class")); RestorePoint beginClass; m_pscan->Capture(&beginClass); m_pscan->ScanForcingPid(); IdentPtr pClassNamePid = pnodeName ? pnodeName->sxVar.pid : nullptr; for (;;) { if (m_token.tk == tkSColon) { m_pscan->ScanForcingPid(); continue; } if (m_token.tk == tkRCurly) { break; } bool isStatic = m_token.tk == tkSTATIC; if (isStatic) { m_pscan->ScanForcingPid(); } ushort fncDeclFlags = fFncNoName | fFncMethod | fFncClassMember; charcount_t ichMin = 0; size_t iecpMin = 0; ParseNodePtr pnodeMemberName = nullptr; IdentPtr pidHint = nullptr; IdentPtr memberPid = nullptr; LPCOLESTR pMemberNameHint = nullptr; uint32 memberNameHintLength = 0; uint32 memberNameOffset = 0; bool isComputedName = false; bool isAsyncMethod = false; if (m_token.tk == tkID && m_token.GetIdentifier(m_phtbl) == wellKnownPropertyPids.async && m_scriptContext->GetConfig()->IsES7AsyncAndAwaitEnabled()) { RestorePoint parsedAsync; m_pscan->Capture(&parsedAsync); ichMin = m_pscan->IchMinTok(); iecpMin = m_pscan->IecpMinTok(); m_pscan->Scan(); if (m_token.tk == tkLParen || m_pscan->FHadNewLine()) { m_pscan->SeekTo(parsedAsync); } else { isAsyncMethod = true; } } bool isGenerator = m_scriptContext->GetConfig()->IsES6GeneratorsEnabled() && m_token.tk == tkStar; if (isGenerator) { fncDeclFlags |= fFncGenerator; m_pscan->ScanForcingPid(); } if (m_token.tk == tkLBrack && m_scriptContext->GetConfig()->IsES6ObjectLiteralsEnabled()) { // Computed member name: [expr] () { } LPCOLESTR emptyHint = nullptr; ParseComputedName<buildAST>(&pnodeMemberName, &emptyHint, &pMemberNameHint, &memberNameHintLength, &memberNameOffset); isComputedName = true; } else // not computed name { memberPid = this->ParseClassPropertyName(&pidHint); if (pidHint) { pMemberNameHint = pidHint->Psz(); memberNameHintLength = pidHint->Cch(); } } if (buildAST && memberPid) { pnodeMemberName = CreateStrNodeWithScanner(memberPid); } if (!isStatic && memberPid == wellKnownPropertyPids.constructor) { if (hasConstructor || isAsyncMethod) { Error(ERRsyntax); } hasConstructor = true; LPCOLESTR pConstructorName = nullptr; uint32 constructorNameLength = 0; uint32 constructorShortNameHintOffset = 0; if (pnodeName && pnodeName->sxVar.pid) { pConstructorName = pnodeName->sxVar.pid->Psz(); constructorNameLength = pnodeName->sxVar.pid->Cch(); } else { pConstructorName = pNameHint; constructorNameLength = nameHintLength; constructorShortNameHintOffset = nameHintOffset; } { AutoParsingSuperRestrictionStateRestorer restorer(this); this->m_parsingSuperRestrictionState = hasExtends ? ParsingSuperRestrictionState_SuperCallAndPropertyAllowed : ParsingSuperRestrictionState_SuperPropertyAllowed; pnodeConstructor = ParseFncDecl<buildAST>(fncDeclFlags, pConstructorName, /* needsPIDOnRCurlyScan */ true, /* resetParsingSuperRestrictionState = */false); } if (pnodeConstructor->sxFnc.IsGenerator()) { Error(ERRConstructorCannotBeGenerator); } Assert(constructorNameLength >= constructorShortNameHintOffset); // The constructor function will get the same name as class. pnodeConstructor->sxFnc.hint = pConstructorName; pnodeConstructor->sxFnc.hintLength = constructorNameLength; pnodeConstructor->sxFnc.hintOffset = constructorShortNameHintOffset; pnodeConstructor->sxFnc.pid = pnodeName && pnodeName->sxVar.pid ? pnodeName->sxVar.pid : wellKnownPropertyPids.constructor; pnodeConstructor->sxFnc.SetIsClassConstructor(TRUE); pnodeConstructor->sxFnc.SetHasNonThisStmt(); pnodeConstructor->sxFnc.SetIsBaseClassConstructor(pnodeExtends == nullptr); } else { ParseNodePtr pnodeMember = nullptr; bool isMemberNamedGetOrSet = false; RestorePoint beginMethodName; m_pscan->Capture(&beginMethodName); if (memberPid == wellKnownPropertyPids.get || memberPid == wellKnownPropertyPids.set) { m_pscan->ScanForcingPid(); } if (m_token.tk == tkLParen) { m_pscan->SeekTo(beginMethodName); isMemberNamedGetOrSet = true; } if ((memberPid == wellKnownPropertyPids.get || memberPid == wellKnownPropertyPids.set) && !isMemberNamedGetOrSet) { bool isGetter = (memberPid == wellKnownPropertyPids.get); if (m_token.tk == tkLBrack && m_scriptContext->GetConfig()->IsES6ObjectLiteralsEnabled()) { // Computed get/set member name: get|set [expr] () { } LPCOLESTR emptyHint = nullptr; ParseComputedName<buildAST>(&pnodeMemberName, &emptyHint, &pMemberNameHint, &memberNameHintLength, &memberNameOffset); isComputedName = true; } else // not computed name { memberPid = this->ParseClassPropertyName(&pidHint); } if ((isStatic ? (memberPid == wellKnownPropertyPids.prototype) : (memberPid == wellKnownPropertyPids.constructor)) || isAsyncMethod) { Error(ERRsyntax); } if (buildAST && memberPid && !isComputedName) { pnodeMemberName = CreateStrNodeWithScanner(memberPid); } ParseNodePtr pnodeFnc = nullptr; { AutoParsingSuperRestrictionStateRestorer restorer(this); this->m_parsingSuperRestrictionState = ParsingSuperRestrictionState_SuperPropertyAllowed; pnodeFnc = ParseFncDecl<buildAST>(fncDeclFlags | (isGetter ? fFncNoArg : fFncOneArg), pidHint ? pidHint->Psz() : nullptr, /* needsPIDOnRCurlyScan */ true, /* resetParsingSuperRestrictionState */false); } pnodeFnc->sxFnc.SetIsStaticMember(isStatic); if (buildAST) { pnodeFnc->sxFnc.SetIsAccessor(); pnodeMember = CreateBinNode(isGetter ? knopGetMember : knopSetMember, pnodeMemberName, pnodeFnc); pMemberNameHint = ConstructFinalHintNode(pClassNamePid, pidHint, isGetter ? wellKnownPropertyPids.get : wellKnownPropertyPids.set, isStatic, &memberNameHintLength, &memberNameOffset, isComputedName, pMemberNameHint); } } else { if (isStatic && (memberPid == wellKnownPropertyPids.prototype)) { Error(ERRsyntax); } ParseNodePtr pnodeFnc = nullptr; { AutoParsingSuperRestrictionStateRestorer restorer(this); this->m_parsingSuperRestrictionState = ParsingSuperRestrictionState_SuperPropertyAllowed; if (isAsyncMethod) { fncDeclFlags |= fFncAsync; } pnodeFnc = ParseFncDecl<buildAST>(fncDeclFlags, pidHint ? pidHint->Psz() : nullptr, /* needsPIDOnRCurlyScan */ true, /* resetParsingSuperRestrictionState */false); if (isAsyncMethod) { pnodeFnc->sxFnc.cbMin = iecpMin; pnodeFnc->ichMin = ichMin; } } pnodeFnc->sxFnc.SetIsStaticMember(isStatic); if (buildAST) { pnodeMember = CreateBinNode(knopMember, pnodeMemberName, pnodeFnc); pMemberNameHint = ConstructFinalHintNode(pClassNamePid, pidHint, nullptr /*pgetset*/, isStatic, &memberNameHintLength, &memberNameOffset, isComputedName, pMemberNameHint); } } if (buildAST) { Assert(memberNameHintLength >= memberNameOffset); pnodeMember->sxBin.pnode2->sxFnc.hint = pMemberNameHint; // Fully qualified name pnodeMember->sxBin.pnode2->sxFnc.hintLength = memberNameHintLength; pnodeMember->sxBin.pnode2->sxFnc.hintOffset = memberNameOffset; pnodeMember->sxBin.pnode2->sxFnc.pid = memberPid; // Short name AddToNodeList(isStatic ? &pnodeStaticMembers : &pnodeMembers, isStatic ? &lastStaticMemberNodeRef : &lastMemberNodeRef, pnodeMember); } } } if (buildAST) { pnodeClass->ichLim = m_pscan->IchLimTok(); } if (!hasConstructor) { OUTPUT_TRACE_DEBUGONLY(Js::ES6VerboseFlag, _u("Generating constructor (%s) : %s\n"), GetParseType(), name ? name->Psz() : _u("anonymous class")); RestorePoint endClass; m_pscan->Capture(&endClass); m_pscan->SeekTo(beginClass); pnodeConstructor = GenerateEmptyConstructor<buildAST>(pnodeExtends != nullptr); if (buildAST) { if (pClassNamePid) { pnodeConstructor->sxFnc.hint = pClassNamePid->Psz(); pnodeConstructor->sxFnc.hintLength = pClassNamePid->Cch(); pnodeConstructor->sxFnc.hintOffset = 0; } else { Assert(nameHintLength >= nameHintOffset); pnodeConstructor->sxFnc.hint = pNameHint; pnodeConstructor->sxFnc.hintLength = nameHintLength; pnodeConstructor->sxFnc.hintOffset = nameHintOffset; } pnodeConstructor->sxFnc.pid = pClassNamePid; } m_pscan->SeekTo(endClass); } if (buildAST) { pnodeConstructor->sxFnc.cbMin = pnodeClass->ichMin; pnodeConstructor->sxFnc.cbLim = pnodeClass->ichLim; pnodeConstructor->ichMin = pnodeClass->ichMin; pnodeConstructor->ichLim = pnodeClass->ichLim; PopFuncBlockScope(ppnodeScopeSave, ppnodeExprScopeSave); pnodeClass->sxClass.pnodeDeclName = pnodeDeclName; pnodeClass->sxClass.pnodeName = pnodeName; pnodeClass->sxClass.pnodeConstructor = pnodeConstructor; pnodeClass->sxClass.pnodeExtends = pnodeExtends; pnodeClass->sxClass.pnodeMembers = pnodeMembers; pnodeClass->sxClass.pnodeStaticMembers = pnodeStaticMembers; pnodeClass->sxClass.isDefaultModuleExport = false; } FinishParseBlock(pnodeBlock); m_fUseStrictMode = strictSave; m_pscan->Scan(); return pnodeClass; }
0
ImageMagick
f5910e91b0778e03ded45b9022be8eb8f77942cd
NOT_APPLICABLE
NOT_APPLICABLE
static inline void VectorSubtract3(const DDSVector3 left, const DDSVector3 right, DDSVector3 *destination) { destination->x = left.x - right.x; destination->y = left.y - right.y; destination->z = left.z - right.z; }
0
ImageMagick
748a03651e5b138bcaf160d15133de2f4b1b89ce
NOT_APPLICABLE
NOT_APPLICABLE
static Image *ReadSIXELImage(const ImageInfo *image_info,ExceptionInfo *exception) { char *sixel_buffer; Image *image; MagickBooleanType status; register char *p; register ssize_t x; register Quantum *q; size_t length; ssize_t i, j, y; unsigned char *sixel_pixels, *sixel_palette; /* 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,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read SIXEL file. */ length=MagickPathExtent; sixel_buffer=(char *) AcquireQuantumMemory((size_t) length+MagickPathExtent, sizeof(*sixel_buffer)); p=sixel_buffer; if (sixel_buffer != (char *) NULL) while (ReadBlobString(image,p) != (char *) NULL) { if ((*p == '#') && ((p == sixel_buffer) || (*(p-1) == '\n'))) continue; if ((*p == '}') && (*(p+1) == ';')) break; p+=strlen(p); if ((size_t) (p-sixel_buffer+MagickPathExtent+1) < length) continue; length<<=1; sixel_buffer=(char *) ResizeQuantumMemory(sixel_buffer,length+ MagickPathExtent+1,sizeof(*sixel_buffer)); if (sixel_buffer == (char *) NULL) break; p=sixel_buffer+strlen(sixel_buffer); }
0
libgadu
77fdc9351bf5c1913c7fc518f8a0c0c87ab3860f
NOT_APPLICABLE
NOT_APPLICABLE
static gg_action_t gg_handle_resolving(struct gg_session *sess, struct gg_event *e, enum gg_state_t next_state, enum gg_state_t alt_state, enum gg_state_t alt2_state) { char buf[256]; int count = -1; int res; unsigned int i; res = gg_resolver_recv(sess->fd, buf, sizeof(buf)); if (res == -1 && (errno == EAGAIN || errno == EINTR)) { gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() non-critical error (errno=%d, %s)\n", errno, strerror(errno)); return GG_ACTION_WAIT; } sess->resolver_cleanup(&sess->resolver, 0); if (res == -1) { gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() read error (errno=%d, %s)\n", errno, strerror(errno)); e->event.failure = GG_FAILURE_RESOLVING; return GG_ACTION_FAIL; } if (res > 0) { char *tmp; tmp = realloc(sess->recv_buf, sess->recv_done + res); if (tmp == NULL) return GG_ACTION_FAIL; sess->recv_buf = tmp; memcpy(sess->recv_buf + sess->recv_done, buf, res); sess->recv_done += res; } /* Sprawdź, czy mamy listę zakończoną INADDR_NONE */ for (i = 0; i < sess->recv_done / sizeof(struct in_addr); i++) { if (((struct in_addr*) sess->recv_buf)[i].s_addr == INADDR_NONE) { count = i; break; } } /* Nie znaleziono hosta */ if (count == 0) { gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() host not found\n"); e->event.failure = GG_FAILURE_RESOLVING; return GG_ACTION_FAIL; } /* Nie mamy pełnej listy, ale połączenie zerwane */ if (res == 0 && count == -1) { gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd() connection broken\n"); e->event.failure = GG_FAILURE_RESOLVING; return GG_ACTION_FAIL; } /* Nie mamy pełnej listy, normalna sytuacja */ if (count == -1) return GG_ACTION_WAIT; #ifndef GG_DEBUG_DISABLE if ((gg_debug_level & GG_DEBUG_DUMP) && (count > 0)) { char *list; size_t len; len = 0; for (i = 0; i < (unsigned int) count; i++) { if (i > 0) len += 2; len += strlen(inet_ntoa(((struct in_addr*) sess->recv_buf)[i])); } list = malloc(len + 1); if (list == NULL) return GG_ACTION_FAIL; list[0] = 0; for (i = 0; i < (unsigned int) count; i++) { if (i > 0) strcat(list, ", "); strcat(list, inet_ntoa(((struct in_addr*) sess->recv_buf)[i])); } gg_debug_session(sess, GG_DEBUG_DUMP, "// gg_watch_fd() resolved: %s\n", list); free(list); } #endif close(sess->fd); sess->fd = -1; sess->state = next_state; sess->resolver_result = (struct in_addr*) sess->recv_buf; sess->resolver_count = count; sess->resolver_index = 0; sess->recv_buf = NULL; sess->recv_done = 0; return GG_ACTION_NEXT; }
0
libarchive
fa7438a0ff4033e4741c807394a9af6207940d71
NOT_APPLICABLE
NOT_APPLICABLE
heap_add_entry(struct archive_read *a, struct heap_queue *heap, struct xar_file *file) { uint64_t file_id, parent_id; int hole, parent; /* Expand our pending files list as necessary. */ if (heap->used >= heap->allocated) { struct xar_file **new_pending_files; int new_size = heap->allocated * 2; if (heap->allocated < 1024) new_size = 1024; /* Overflow might keep us from growing the list. */ if (new_size <= heap->allocated) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); return (ARCHIVE_FATAL); } new_pending_files = (struct xar_file **) malloc(new_size * sizeof(new_pending_files[0])); if (new_pending_files == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); return (ARCHIVE_FATAL); } memcpy(new_pending_files, heap->files, heap->allocated * sizeof(new_pending_files[0])); if (heap->files != NULL) free(heap->files); heap->files = new_pending_files; heap->allocated = new_size; } file_id = file->id; /* * Start with hole at end, walk it up tree to find insertion point. */ hole = heap->used++; while (hole > 0) { parent = (hole - 1)/2; parent_id = heap->files[parent]->id; if (file_id >= parent_id) { heap->files[hole] = file; return (ARCHIVE_OK); } /* Move parent into hole <==> move hole up tree. */ heap->files[hole] = heap->files[parent]; hole = parent; } heap->files[0] = file; return (ARCHIVE_OK); }
0
krb5
5e6d1796106df8ba6bc1973ee0917c170d929086
NOT_APPLICABLE
NOT_APPLICABLE
krb5_get_credentials_for_user(krb5_context context, krb5_flags options, krb5_ccache ccache, krb5_creds *in_creds, krb5_data *subject_cert, krb5_creds **out_creds) { krb5_error_code code; krb5_principal realm = NULL; *out_creds = NULL; if (options & KRB5_GC_CONSTRAINED_DELEGATION) { code = EINVAL; goto cleanup; } if (in_creds->client != NULL) { /* Uncanonicalised check */ code = krb5_get_credentials(context, options | KRB5_GC_CACHED, ccache, in_creds, out_creds); if (code != KRB5_CC_NOTFOUND && code != KRB5_CC_NOT_KTYPE) goto cleanup; if ((options & KRB5_GC_CACHED) && !(options & KRB5_GC_CANONICALIZE)) goto cleanup; } code = s4u_identify_user(context, in_creds, subject_cert, &realm); if (code != 0) goto cleanup; if (in_creds->client != NULL && in_creds->client->type == KRB5_NT_ENTERPRISE_PRINCIPAL) { /* Post-canonicalisation check for enterprise principals */ krb5_creds mcreds = *in_creds; mcreds.client = realm; code = krb5_get_credentials(context, options | KRB5_GC_CACHED, ccache, &mcreds, out_creds); if ((code != KRB5_CC_NOTFOUND && code != KRB5_CC_NOT_KTYPE) || (options & KRB5_GC_CACHED)) goto cleanup; } code = krb5_get_self_cred_from_kdc(context, options, ccache, in_creds, subject_cert, &realm->realm, out_creds); if (code != 0) goto cleanup; assert(*out_creds != NULL); if ((options & KRB5_GC_NO_STORE) == 0) { code = krb5_cc_store_cred(context, ccache, *out_creds); if (code != 0) goto cleanup; } cleanup: if (code != 0 && *out_creds != NULL) { krb5_free_creds(context, *out_creds); *out_creds = NULL; } krb5_free_principal(context, realm); return code; }
0
php-src
c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6
NOT_APPLICABLE
NOT_APPLICABLE
void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) { int c; int x, y; int tox, toy; int ydest; int i; int colorMap[gdMaxColors]; /* Stretch vectors */ int *stx, *sty; if (overflow2(sizeof(int), srcW)) { return; } if (overflow2(sizeof(int), srcH)) { return; } stx = (int *) gdMalloc (sizeof (int) * srcW); sty = (int *) gdMalloc (sizeof (int) * srcH); /* Fixed by Mao Morimoto 2.0.16 */ for (i = 0; (i < srcW); i++) { stx[i] = dstW * (i+1) / srcW - dstW * i / srcW ; } for (i = 0; (i < srcH); i++) { sty[i] = dstH * (i+1) / srcH - dstH * i / srcH ; } for (i = 0; (i < gdMaxColors); i++) { colorMap[i] = (-1); } toy = dstY; for (y = srcY; (y < (srcY + srcH)); y++) { for (ydest = 0; (ydest < sty[y - srcY]); ydest++) { tox = dstX; for (x = srcX; (x < (srcX + srcW)); x++) { int nc = 0; int mapTo; if (!stx[x - srcX]) { continue; } if (dst->trueColor) { /* 2.0.9: Thorben Kundinger: Maybe the source image is not a truecolor image */ if (!src->trueColor) { int tmp = gdImageGetPixel (src, x, y); mapTo = gdImageGetTrueColorPixel (src, x, y); if (gdImageGetTransparent (src) == tmp) { /* 2.0.21, TK: not tox++ */ tox += stx[x - srcX]; continue; } } else { /* TK: old code follows */ mapTo = gdImageGetTrueColorPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == mapTo) { /* 2.0.21, TK: not tox++ */ tox += stx[x - srcX]; continue; } } } else { c = gdImageGetPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == c) { tox += stx[x - srcX]; continue; } if (src->trueColor) { /* Remap to the palette available in the destination image. This is slow and works badly. */ mapTo = gdImageColorResolveAlpha(dst, gdTrueColorGetRed(c), gdTrueColorGetGreen(c), gdTrueColorGetBlue(c), gdTrueColorGetAlpha (c)); } else { /* Have we established a mapping for this color? */ if (colorMap[c] == (-1)) { /* If it's the same image, mapping is trivial */ if (dst == src) { nc = c; } else { /* Find or create the best match */ /* 2.0.5: can't use gdTrueColorGetRed, etc with palette */ nc = gdImageColorResolveAlpha(dst, gdImageRed(src, c), gdImageGreen(src, c), gdImageBlue(src, c), gdImageAlpha(src, c)); } colorMap[c] = nc; } mapTo = colorMap[c]; } } for (i = 0; (i < stx[x - srcX]); i++) { gdImageSetPixel (dst, tox, toy, mapTo); tox++; } } toy++; } } gdFree (stx); gdFree (sty); }
0
php
aa82e99ed8003c01f1ef4f0940e56b85c5b032d4
NOT_APPLICABLE
NOT_APPLICABLE
PHP_FUNCTION(locale_get_display_script) { get_icu_disp_value_src_php( LOC_SCRIPT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ); }
0
ImageMagick
a2e1064f288a353bc5fef7f79ccb7683759e775c
NOT_APPLICABLE
NOT_APPLICABLE
static char *ReadBlobStringWithLongSize(Image *image,char *string,size_t max, ExceptionInfo *exception) { int c; MagickOffsetType offset; register ssize_t i; size_t length; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); assert(max != 0); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); length=ReadBlobMSBLong(image); for (i=0; i < (ssize_t) MagickMin(length,max-1); i++) { c=ReadBlobByte(image); if (c == EOF) return((char *) NULL); string[i]=(char) c; } string[i]='\0'; offset=SeekBlob(image,(MagickOffsetType) (length-i),SEEK_CUR); if (offset < 0) (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageError,"ImproperImageHeader","`%s'",image->filename); return(string); }
0
bro
6c0f101a62489b1c5927b4ed63b0e1d37db40282
NOT_APPLICABLE
NOT_APPLICABLE
ContentLine_Analyzer::ContentLine_Analyzer(const char* name, Connection* conn, bool orig) : TCP_SupportAnalyzer(name, conn, orig) { InitState(); }
0
abrt
8939398b82006ba1fec4ed491339fc075f43fc7c
NOT_APPLICABLE
NOT_APPLICABLE
static pid_t spawn_event_handler_child(const char *dump_dir_name, const char *event_name, int *fdp) { char *args[7]; args[0] = (char *) LIBEXEC_DIR"/abrt-handle-event"; /* Do not forward ASK_* messages to parent*/ args[1] = (char *) "-i"; args[2] = (char *) "-e"; args[3] = (char *) event_name; args[4] = (char *) "--"; args[5] = (char *) dump_dir_name; args[6] = NULL; int pipeout[2]; int flags = EXECFLG_INPUT_NUL | EXECFLG_OUTPUT | EXECFLG_QUIET | EXECFLG_ERR2OUT; VERB1 flags &= ~EXECFLG_QUIET; char *env_vec[2]; /* Intercept ASK_* messages in Client API -> don't wait for user response */ env_vec[0] = xstrdup("REPORT_CLIENT_NONINTERACTIVE=1"); env_vec[1] = NULL; pid_t child = fork_execv_on_steroids(flags, args, pipeout, env_vec, /*dir:*/ NULL, /*uid(unused):*/ 0); if (fdp) *fdp = pipeout[0]; return child; }
0
tor
a0ef3cf0880e3cd343977b3fcbd0a2e7572f0cb4
NOT_APPLICABLE
NOT_APPLICABLE
get_nth_protocol_set_vote(int n, const networkstatus_t *vote) { switch (n) { case 0: return vote->recommended_client_protocols; case 1: return vote->recommended_relay_protocols; case 2: return vote->required_client_protocols; case 3: return vote->required_relay_protocols; default: tor_assert_unreached(); return NULL; } }
0
FFmpeg
e6d3fd942f772f54ab6a5ca619cdaadef26b7702
NOT_APPLICABLE
NOT_APPLICABLE
static int mov_init(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret, hint_track = 0, tmcd_track = 0; mov->fc = s; /* Default mode == MP4 */ mov->mode = MODE_MP4; if (s->oformat) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V; } if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV; /* Set the FRAGMENT flag if any of the fragmentation methods are * enabled. */ if (mov->max_fragment_duration || mov->max_fragment_size || mov->flags & (FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_FRAG_KEYFRAME | FF_MOV_FLAG_FRAG_CUSTOM)) mov->flags |= FF_MOV_FLAG_FRAGMENT; /* Set other implicit flags immediately */ if (mov->mode == MODE_ISM) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF | FF_MOV_FLAG_FRAGMENT; if (mov->flags & FF_MOV_FLAG_DASH) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF; if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) { av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic bitstream filtering\n"); s->flags &= ~AVFMT_FLAG_AUTO_BSF; } if (mov->flags & FF_MOV_FLAG_FASTSTART) { mov->reserved_moov_size = -1; } if (mov->use_editlist < 0) { mov->use_editlist = 1; if (mov->flags & FF_MOV_FLAG_FRAGMENT && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { // If we can avoid needing an edit list by shifting the // tracks, prefer that over (trying to) write edit lists // in fragmented output. if (s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO) mov->use_editlist = 0; } } if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV) && mov->use_editlist) av_log(s, AV_LOG_WARNING, "No meaningful edit list will be written when using empty_moov without delay_moov\n"); if (!mov->use_editlist && s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO) s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO; /* Clear the omit_tfhd_offset flag if default_base_moof is set; * if the latter is set that's enough and omit_tfhd_offset doesn't * add anything extra on top of that. */ if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET && mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) mov->flags &= ~FF_MOV_FLAG_OMIT_TFHD_OFFSET; if (mov->frag_interleave && mov->flags & (FF_MOV_FLAG_OMIT_TFHD_OFFSET | FF_MOV_FLAG_SEPARATE_MOOF)) { av_log(s, AV_LOG_ERROR, "Sample interleaving in fragments is mutually exclusive with " "omit_tfhd_offset and separate_moof\n"); return AVERROR(EINVAL); } /* Non-seekable output is ok if using fragmentation. If ism_lookahead * is enabled, we don't support non-seekable output at all. */ if (!s->pb->seekable && (!(mov->flags & FF_MOV_FLAG_FRAGMENT) || mov->ism_lookahead)) { av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n"); return AVERROR(EINVAL); } mov->nb_streams = s->nb_streams; if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) mov->chapter_track = mov->nb_streams++; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { /* Add hint tracks for each audio and video stream */ hint_track = mov->nb_streams; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { mov->nb_streams++; } } } if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4) || mov->write_tmcd == 1) { tmcd_track = mov->nb_streams; /* +1 tmcd track for each video stream with a timecode */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; AVDictionaryEntry *t = global_tcr; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (t || (t=av_dict_get(st->metadata, "timecode", NULL, 0)))) { AVTimecode tc; ret = mov_check_timecode_track(s, &tc, i, t->value); if (ret >= 0) mov->nb_meta_tmcd++; } } /* check if there is already a tmcd track to remux */ if (mov->nb_meta_tmcd) { for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) { av_log(s, AV_LOG_WARNING, "You requested a copy of the original timecode track " "so timecode metadata are now ignored\n"); mov->nb_meta_tmcd = 0; } } } mov->nb_streams += mov->nb_meta_tmcd; } // Reserve an extra stream for chapters for the case where chapters // are written in the trailer mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); if (mov->encryption_scheme_str != NULL && strcmp(mov->encryption_scheme_str, "none") != 0) { if (strcmp(mov->encryption_scheme_str, "cenc-aes-ctr") == 0) { mov->encryption_scheme = MOV_ENC_CENC_AES_CTR; if (mov->encryption_key_len != AES_CTR_KEY_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption key len %d expected %d\n", mov->encryption_key_len, AES_CTR_KEY_SIZE); return AVERROR(EINVAL); } if (mov->encryption_kid_len != CENC_KID_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption kid len %d expected %d\n", mov->encryption_kid_len, CENC_KID_SIZE); return AVERROR(EINVAL); } } else { av_log(s, AV_LOG_ERROR, "unsupported encryption scheme %s\n", mov->encryption_scheme_str); return AVERROR(EINVAL); } } for (i = 0; i < s->nb_streams; i++) { AVStream *st= s->streams[i]; MOVTrack *track= &mov->tracks[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); track->st = st; track->par = st->codecpar; track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); if (track->language < 0) track->language = 0; track->mode = mov->mode; track->tag = mov_find_codec_tag(s, track); if (!track->tag) { av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in stream #%d, " "codec not currently supported in container\n", avcodec_get_name(st->codecpar->codec_id), i); return AVERROR(EINVAL); } /* If hinting of this track is enabled by a later hint track, * this is updated. */ track->hint_track = -1; track->start_dts = AV_NOPTS_VALUE; track->start_cts = AV_NOPTS_VALUE; track->end_pts = AV_NOPTS_VALUE; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') || track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') || track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) { if (st->codecpar->width != 720 || (st->codecpar->height != 608 && st->codecpar->height != 512)) { av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n"); return AVERROR(EINVAL); } track->height = track->tag >> 24 == 'n' ? 486 : 576; } if (mov->video_track_timescale) { track->timescale = mov->video_track_timescale; } else { track->timescale = st->time_base.den; while(track->timescale < 10000) track->timescale *= 2; } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); return AVERROR(EINVAL); } if (track->mode == MODE_MOV && track->timescale > 100000) av_log(s, AV_LOG_WARNING, "WARNING codec timebase is very high. If duration is too long,\n" "file may not be playable by quicktime. Specify a shorter timebase\n" "or choose different container.\n"); if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->tag == MKTAG('r','a','w',' ')) { enum AVPixelFormat pix_fmt = track->par->format; if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1) pix_fmt = AV_PIX_FMT_MONOWHITE; track->is_unaligned_qt_rgb = pix_fmt == AV_PIX_FMT_RGB24 || pix_fmt == AV_PIX_FMT_BGR24 || pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8 || pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; } if (track->mode == MODE_MP4 && track->par->codec_id == AV_CODEC_ID_VP9) { if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(s, AV_LOG_ERROR, "VP9 in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { track->timescale = st->codecpar->sample_rate; if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) { av_log(s, AV_LOG_WARNING, "track %d: codec frame size is not set\n", i); track->audio_vbr = 1; }else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || st->codecpar->codec_id == AV_CODEC_ID_ILBC){ if (!st->codecpar->block_align) { av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i); return AVERROR(EINVAL); } track->sample_size = st->codecpar->block_align; }else if (st->codecpar->frame_size > 1){ /* assume compressed audio */ track->audio_vbr = 1; }else{ track->sample_size = (av_get_bits_per_sample(st->codecpar->codec_id) >> 3) * st->codecpar->channels; } if (st->codecpar->codec_id == AV_CODEC_ID_ILBC || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_QT) { track->audio_vbr = 1; } if (track->mode != MODE_MOV && track->par->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) { if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n", i, track->par->sample_rate); return AVERROR(EINVAL); } else { av_log(s, AV_LOG_WARNING, "track %d: muxing mp3 at %dhz is not standard in MP4\n", i, track->par->sample_rate); } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { track->timescale = st->time_base.den; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { track->timescale = st->time_base.den; } else { track->timescale = MOV_TIMESCALE; } if (!track->height) track->height = st->codecpar->height; /* The ism specific timescale isn't mandatory, but is assumed by * some tools, such as mp4split. */ if (mov->mode == MODE_ISM) track->timescale = 10000000; avpriv_set_pts_info(st, 64, 1, track->timescale); if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ret = ff_mov_cenc_init(&track->cenc, mov->encryption_key, track->par->codec_id == AV_CODEC_ID_H264, s->flags & AVFMT_FLAG_BITEXACT); if (ret) return ret; } } enable_tracks(s); return 0; }
0
FFmpeg
9a271a9368eaabf99e6c2046103acb33957e63b7
CVE-2013-7018
CWE-119
static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) { uint8_t byte; if (bytestream2_get_bytes_left(&s->g) < 5) return AVERROR_INVALIDDATA; /* nreslevels = number of resolution levels = number of decomposition level +1 */ c->nreslevels = bytestream2_get_byteu(&s->g) + 1; if (c->nreslevels >= JPEG2000_MAX_RESLEVELS) { av_log(s->avctx, AV_LOG_ERROR, "nreslevels %d is invalid\n", c->nreslevels); return AVERROR_INVALIDDATA; } /* compute number of resolution levels to decode */ if (c->nreslevels < s->reduction_factor) c->nreslevels2decode = 1; else c->nreslevels2decode = c->nreslevels - s->reduction_factor; c->log2_cblk_width = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk width c->log2_cblk_height = (bytestream2_get_byteu(&s->g) & 15) + 2; // cblk height if (c->log2_cblk_width > 10 || c->log2_cblk_height > 10 || c->log2_cblk_width + c->log2_cblk_height > 12) { av_log(s->avctx, AV_LOG_ERROR, "cblk size invalid\n"); return AVERROR_INVALIDDATA; } c->cblk_style = bytestream2_get_byteu(&s->g); if (c->cblk_style != 0) { // cblk style av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style); } c->transform = bytestream2_get_byteu(&s->g); // DWT transformation type /* set integer 9/7 DWT in case of BITEXACT flag */ if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97)) c->transform = FF_DWT97_INT; if (c->csty & JPEG2000_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) { byte = bytestream2_get_byte(&s->g); c->log2_prec_widths[i] = byte & 0x0F; // precinct PPx c->log2_prec_heights[i] = (byte >> 4) & 0x0F; // precinct PPy } } else { memset(c->log2_prec_widths , 15, sizeof(c->log2_prec_widths )); memset(c->log2_prec_heights, 15, sizeof(c->log2_prec_heights)); } return 0; }
1
graphviz
784411ca3655c80da0f6025ab20634b2a6ff696b
NOT_APPLICABLE
NOT_APPLICABLE
static int invflip_side(int side, int rankdir) { switch (rankdir) { case RANKDIR_TB: break; case RANKDIR_BT: switch (side) { case TOP: side = BOTTOM; break; case BOTTOM: side = TOP; break; default: break; } break; case RANKDIR_LR: switch (side) { case TOP: side = RIGHT; break; case BOTTOM: side = LEFT; break; case LEFT: side = TOP; break; case RIGHT: side = BOTTOM; break; } break; case RANKDIR_RL: switch (side) { case TOP: side = RIGHT; break; case BOTTOM: side = LEFT; break; case LEFT: side = BOTTOM; break; case RIGHT: side = TOP; break; } break; } return side; }
0
gpac
71460d72ec07df766dab0a4d52687529f3efcf0a
NOT_APPLICABLE
NOT_APPLICABLE
static void isoffin_delete_channel(ISOMChannel *ch) { isor_reset_reader(ch); if (ch->nal_bs) gf_bs_del(ch->nal_bs); if (ch->avcc) gf_odf_avc_cfg_del(ch->avcc); if (ch->hvcc) gf_odf_hevc_cfg_del(ch->hvcc); if (ch->vvcc) gf_odf_vvc_cfg_del(ch->vvcc); gf_free(ch); }
0
libjpeg-turbo
dab6be4cfb2f9307b5378d2d1dc74d9080383dc2
NOT_APPLICABLE
NOT_APPLICABLE
DLLEXPORT tjhandle DLLCALL tjInitCompress(void) { tjinstance *this=NULL; if((this=(tjinstance *)malloc(sizeof(tjinstance)))==NULL) { snprintf(errStr, JMSG_LENGTH_MAX, "tjInitCompress(): Memory allocation failure"); return NULL; } MEMZERO(this, sizeof(tjinstance)); return _tjInitCompress(this); }
0
minisphere
252c1ca184cb38e1acb917aa0e451c5f08519996
NOT_APPLICABLE
NOT_APPLICABLE
person_get_pose(const person_t* person) { return person->direction; }
0
olm
ccc0d122ee1b4d5e5ca4ec1432086be17d5f901b
NOT_APPLICABLE
NOT_APPLICABLE
const char * olm_pk_signing_last_error(OlmPkSigning * sign) { auto error = sign->last_error; return _olm_error_to_string(error); }
0
Chrome
c552cd7b8a0862f6b3c8c6a07f98bda3721101eb
NOT_APPLICABLE
NOT_APPLICABLE
void PaintAttachedBookmarkBar(gfx::Canvas* canvas, BookmarkBarView* view, BrowserView* browser_view, int toolbar_overlap) { gfx::Point background_image_offset = browser_view->OffsetPointForToolbarBackgroundImage( gfx::Point(view->GetMirroredX(), view->y())); PaintBackgroundAttachedMode(canvas, view->GetThemeProvider(), view->GetLocalBounds(), background_image_offset); if (view->height() >= toolbar_overlap) { BrowserView::Paint1pxHorizontalLine( canvas, view->GetThemeProvider()->GetColor( ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), view->GetLocalBounds(), true); } }
0
linux
93a2001bdfd5376c3dc2158653034c20392d15c5
NOT_APPLICABLE
NOT_APPLICABLE
static char *hiddev_devnode(struct device *dev, umode_t *mode) { return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); }
0
Chrome
0749ec24fae74ec32d0567eef0e5ec43c84dbcb9
NOT_APPLICABLE
NOT_APPLICABLE
void BaseArena::completeSweep() { RELEASE_ASSERT(getThreadState()->isSweepingInProgress()); ASSERT(getThreadState()->sweepForbidden()); ASSERT(!getThreadState()->isMainThread() || ScriptForbiddenScope::isScriptForbidden()); while (m_firstUnsweptPage) { sweepUnsweptPage(); } ThreadHeap::reportMemoryUsageForTracing(); }
0
leptonica
3c18c43b6a3f753f0dfff99610d46ad46b8bfac4
NOT_APPLICABLE
NOT_APPLICABLE
pixContrastNorm(PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, l_int32 mindiff, l_int32 smoothx, l_int32 smoothy) { PIX *pixmin, *pixmax; PROCNAME("pixContrastNorm"); if (!pixs || pixGetDepth(pixs) != 8) return (PIX *)ERROR_PTR("pixs undefined or not 8 bpp", procName, pixd); if (pixd && pixd != pixs) return (PIX *)ERROR_PTR("pixd not null or == pixs", procName, pixd); if (pixGetColormap(pixs)) return (PIX *)ERROR_PTR("pixs is colormapped", procName, pixd); if (sx < 5 || sy < 5) return (PIX *)ERROR_PTR("sx and/or sy less than 5", procName, pixd); if (smoothx < 0 || smoothy < 0) return (PIX *)ERROR_PTR("smooth params less than 0", procName, pixd); if (smoothx > 8 || smoothy > 8) return (PIX *)ERROR_PTR("smooth params exceed 8", procName, pixd); /* Get the min and max pixel values in each tile, and represent * each value as a pixel in pixmin and pixmax, respectively. */ pixMinMaxTiles(pixs, sx, sy, mindiff, smoothx, smoothy, &pixmin, &pixmax); /* For each tile, do a linear expansion of the dynamic range * of pixels so that the min value is mapped to 0 and the * max value is mapped to 255. */ pixd = pixLinearTRCTiled(pixd, pixs, sx, sy, pixmin, pixmax); pixDestroy(&pixmin); pixDestroy(&pixmax); return pixd; }
0
linux
34b3be18a04ecdc610aae4c48e5d1b799d8689f6
NOT_APPLICABLE
NOT_APPLICABLE
static void sdma_populate_sde_map(struct sdma_rht_map_elem *map) { int i; for (i = 0; i < roundup_pow_of_two(map->ctr ? : 1) - map->ctr; i++) map->sde[map->ctr + i] = map->sde[i]; }
0
FFmpeg
c24bcb553650b91e9eff15ef6e54ca73de2453b7
NOT_APPLICABLE
NOT_APPLICABLE
static int nsv_resync(AVFormatContext *s) { NSVContext *nsv = s->priv_data; AVIOContext *pb = s->pb; uint32_t v = 0; int i; for (i = 0; i < NSV_MAX_RESYNC; i++) { if (avio_feof(pb)) { av_log(s, AV_LOG_TRACE, "NSV EOF\n"); nsv->state = NSV_UNSYNC; return -1; } v <<= 8; v |= avio_r8(pb); if (i < 8) { av_log(s, AV_LOG_TRACE, "NSV resync: [%d] = %02"PRIx32"\n", i, v & 0x0FF); } if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */ av_log(s, AV_LOG_TRACE, "NSV resynced on BEEF after %d bytes\n", i+1); nsv->state = NSV_FOUND_BEEF; return 0; } /* we read as big-endian, thus the MK*BE* */ if (v == TB_NSVF) { /* NSVf */ av_log(s, AV_LOG_TRACE, "NSV resynced on NSVf after %d bytes\n", i+1); nsv->state = NSV_FOUND_NSVF; return 0; } if (v == MKBETAG('N', 'S', 'V', 's')) { /* NSVs */ av_log(s, AV_LOG_TRACE, "NSV resynced on NSVs after %d bytes\n", i+1); nsv->state = NSV_FOUND_NSVS; return 0; } } av_log(s, AV_LOG_TRACE, "NSV sync lost\n"); return -1; }
0
Chrome
f335421145bb7f82c60fb9d61babcd6ce2e4b21e
NOT_APPLICABLE
NOT_APPLICABLE
ExtensionFunctionDispatcher::Delegate::GetExtensionWindowController() const { return NULL; }
0
libxml2
0bcd05c5cd83dec3406c8f68b769b1d610c72f76
NOT_APPLICABLE
NOT_APPLICABLE
xmlErrEncodingInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, int val) { if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, val, 0, msg, val); if (ctxt != NULL) { ctxt->wellFormed = 0; if (ctxt->recovery == 0) ctxt->disableSAX = 1; } }
0
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
NOT_APPLICABLE
NOT_APPLICABLE
static void Ins_MAX( INS_ARG ) { (void)exc; if ( args[1] > args[0] ) args[0] = args[1]; }
0
git
a02ea577174ab8ed18f847cf1693f213e0b9c473
NOT_APPLICABLE
NOT_APPLICABLE
static struct child_process *git_tcp_connect(int fd[2], char *host, int flags) { int sockfd = git_tcp_connect_sock(host, flags); fd[0] = sockfd; fd[1] = dup(sockfd); return &no_fork; }
0
curl
914aaab9153764ef8fa4178215b8ad89d3ac263a
NOT_APPLICABLE
NOT_APPLICABLE
bool Curl_is_absolute_url(const char *url, char *buf, size_t buflen) { int i; DEBUGASSERT(!buf || (buflen > MAX_SCHEME_LEN)); (void)buflen; /* only used in debug-builds */ if(buf) buf[0] = 0; /* always leave a defined value in buf */ #ifdef WIN32 if(STARTS_WITH_DRIVE_PREFIX(url)) return FALSE; #endif for(i = 0; i < MAX_SCHEME_LEN; ++i) { char s = url[i]; if(s && (ISALNUM(s) || (s == '+') || (s == '-') || (s == '.') )) { /* RFC 3986 3.1 explains: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) */ } else { break; } } if(i && (url[i] == ':') && (url[i + 1] == '/')) { if(buf) { buf[i] = 0; while(i--) { buf[i] = (char)TOLOWER(url[i]); } } return TRUE; } return FALSE; }
0
radare2
e9ce0d64faf19fa4e9c260250fbdf25e3c11e152
NOT_APPLICABLE
NOT_APPLICABLE
R_API void r_bin_java_do_nothing_free(void /*RBinJavaCPTypeObj*/ *obj) { return; }
0
Chrome
4504a474c069d07104237d0c03bfce7b29a42de6
NOT_APPLICABLE
NOT_APPLICABLE
HTMLMediaElement::HTMLMediaElement(const QualifiedName& tag_name, Document& document) : HTMLElement(tag_name, document), PausableObject(&document), load_timer_(document.GetTaskRunner(TaskType::kUnthrottled), this, &HTMLMediaElement::LoadTimerFired), progress_event_timer_(document.GetTaskRunner(TaskType::kUnthrottled), this, &HTMLMediaElement::ProgressEventTimerFired), playback_progress_timer_(document.GetTaskRunner(TaskType::kUnthrottled), this, &HTMLMediaElement::PlaybackProgressTimerFired), audio_tracks_timer_(document.GetTaskRunner(TaskType::kUnthrottled), this, &HTMLMediaElement::AudioTracksTimerFired), check_viewport_intersection_timer_( document.GetTaskRunner(TaskType::kUnthrottled), this, &HTMLMediaElement::CheckViewportIntersectionTimerFired), played_time_ranges_(), async_event_queue_(MediaElementEventQueue::Create(this, &document)), playback_rate_(1.0f), default_playback_rate_(1.0f), network_state_(kNetworkEmpty), ready_state_(kHaveNothing), ready_state_maximum_(kHaveNothing), volume_(1.0f), last_seek_time_(0), previous_progress_time_(std::numeric_limits<double>::max()), duration_(std::numeric_limits<double>::quiet_NaN()), last_time_update_event_media_time_( std::numeric_limits<double>::quiet_NaN()), default_playback_start_position_(0), load_state_(kWaitingForSource), deferred_load_state_(kNotDeferred), deferred_load_timer_(document.GetTaskRunner(TaskType::kUnthrottled), this, &HTMLMediaElement::DeferredLoadTimerFired), web_layer_(nullptr), display_mode_(kUnknown), official_playback_position_(0), official_playback_position_needs_update_(true), fragment_end_time_(std::numeric_limits<double>::quiet_NaN()), pending_action_flags_(0), playing_(false), should_delay_load_event_(false), have_fired_loaded_data_(false), can_autoplay_(true), muted_(false), paused_(true), seeking_(false), sent_stalled_event_(false), ignore_preload_none_(false), text_tracks_visible_(false), should_perform_automatic_track_selection_(true), tracks_are_ready_(true), processing_preference_change_(false), playing_remotely_(false), in_overlay_fullscreen_video_(false), mostly_filling_viewport_(false), audio_tracks_(AudioTrackList::Create(*this)), video_tracks_(VideoTrackList::Create(*this)), audio_source_node_(nullptr), autoplay_policy_(new AutoplayPolicy(this)), remote_playback_client_(nullptr), media_controls_(nullptr), controls_list_(HTMLMediaElementControlsList::Create(this)) { BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; LocalFrame* frame = document.GetFrame(); if (frame) { remote_playback_client_ = frame->Client()->CreateWebRemotePlaybackClient(*this); } SetHasCustomStyleCallbacks(); AddElementToDocumentMap(this, &document); UseCounter::Count(document, WebFeature::kHTMLMediaElement); }
0
kde1-kdebase
04906bd5de2f220bf100b605dad37b4a1d9a91a6
NOT_APPLICABLE
NOT_APPLICABLE
static QString passwordQuery(bool name) { QString retval(""); if (name) { retval = currentUser() + "\n"; } return retval + glocale->translate("Enter Password"); }
0
Chrome
eea3300239f0b53e172a320eb8de59d0bea65f27
NOT_APPLICABLE
NOT_APPLICABLE
void DevToolsWindow::UpdateBrowserWindow() { BrowserWindow* inspected_window = GetInspectedBrowserWindow(); if (inspected_window) inspected_window->UpdateDevTools(); }
0
Chrome
c4f40933f2cd7f975af63e56ea4cdcdc6c636f73
NOT_APPLICABLE
NOT_APPLICABLE
void TaskManagerView::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (child == this) { if (is_add) { parent->AddChildView(about_memory_link_); if (purge_memory_button_) parent->AddChildView(purge_memory_button_); parent->AddChildView(kill_button_); AddChildView(tab_table_); } else { parent->RemoveChildView(kill_button_); if (purge_memory_button_) parent->RemoveChildView(purge_memory_button_); parent->RemoveChildView(about_memory_link_); } } }
0
tensorflow
1361fb7e29449629e1df94d44e0427ebec8c83c7
NOT_APPLICABLE
NOT_APPLICABLE
string InferenceContext::DebugString(const ShapeAndType& shape_and_type) { return strings::StrCat(DebugString(shape_and_type.shape), ":", DataTypeString(shape_and_type.dtype)); }
0
Chrome
ca8cc70b2de822b939f87effc7c2b83bac280a44
NOT_APPLICABLE
NOT_APPLICABLE
void SocketStream::DoRestartWithAuth() { DCHECK_EQ(next_state_, STATE_AUTH_REQUIRED); tunnel_request_headers_ = NULL; tunnel_request_headers_bytes_sent_ = 0; tunnel_response_headers_ = NULL; tunnel_response_headers_capacity_ = 0; tunnel_response_headers_len_ = 0; next_state_ = STATE_TCP_CONNECT; DoLoop(OK); }
0
Chrome
1dab554a7e795dac34313e2f7dbe4325628d12d4
NOT_APPLICABLE
NOT_APPLICABLE
void SessionRestore::RestoreForeignSessionWindows( Profile* profile, std::vector<const SessionWindow*>::const_iterator begin, std::vector<const SessionWindow*>::const_iterator end) { std::vector<GURL> gurls; SessionRestoreImpl restorer(profile, static_cast<Browser*>(NULL), true, false, true, gurls); restorer.RestoreForeignSession(begin, end); }
0
vim
b55986c52d4cd88a22d0b0b0e8a79547ba13e1d5
NOT_APPLICABLE
NOT_APPLICABLE
regc(int b) { if (regcode == JUST_CALC_SIZE) regsize++; else *regcode++ = b; }
0
linux
ed6fe9d614fc1bca95eb8c0ccd0e92db00ef9d5d
NOT_APPLICABLE
NOT_APPLICABLE
static int sock_no_open(struct inode *irrelevant, struct file *dontcare) { return -ENXIO; }
0
ghostpdl
e1134d375e2ca176068e19a2aa9b040baffe1c22
NOT_APPLICABLE
NOT_APPLICABLE
pcstatus_do_reset(pcl_state_t * pcs, pcl_reset_type_t type) { if (type & (pcl_reset_initial | pcl_reset_printer)) { if (type & pcl_reset_initial) { pcs->status.buffer = 0; pcs->status.write_pos = 0; pcs->status.read_pos = 0; } pcs->location_type = 0; pcs->location_unit = 0; } return 0; }
0
linux-stable
9d289715eb5c252ae15bd547cb252ca547a3c4f2
NOT_APPLICABLE
NOT_APPLICABLE
static struct rt6_info *find_rr_leaf(struct fib6_node *fn, struct rt6_info *rr_head, u32 metric, int oif, int strict, bool *do_rr) { struct rt6_info *rt, *match; int mpri = -1; match = NULL; for (rt = rr_head; rt && rt->rt6i_metric == metric; rt = rt->dst.rt6_next) match = find_match(rt, oif, strict, &mpri, match, do_rr); for (rt = fn->leaf; rt && rt != rr_head && rt->rt6i_metric == metric; rt = rt->dst.rt6_next) match = find_match(rt, oif, strict, &mpri, match, do_rr); return match; }
0
Android
b351eabb428c7ca85a34513c64601f437923d576
NOT_APPLICABLE
NOT_APPLICABLE
status_t OMXNodeInstance::setInternalOption( OMX_U32 portIndex, IOMX::InternalOptionType type, const void *data, size_t size) { CLOG_CONFIG(setInternalOption, "%s(%d): %s:%u %zu@%p", asString(type), type, portString(portIndex), portIndex, size, data); switch (type) { case IOMX::INTERNAL_OPTION_SUSPEND: case IOMX::INTERNAL_OPTION_REPEAT_PREVIOUS_FRAME_DELAY: case IOMX::INTERNAL_OPTION_MAX_TIMESTAMP_GAP: case IOMX::INTERNAL_OPTION_MAX_FPS: case IOMX::INTERNAL_OPTION_START_TIME: case IOMX::INTERNAL_OPTION_TIME_LAPSE: { const sp<GraphicBufferSource> &bufferSource = getGraphicBufferSource(); if (bufferSource == NULL || portIndex != kPortIndexInput) { CLOGW("setInternalOption is only for Surface input"); return ERROR_UNSUPPORTED; } if (type == IOMX::INTERNAL_OPTION_SUSPEND) { if (size != sizeof(bool)) { return INVALID_OPERATION; } bool suspend = *(bool *)data; CLOG_CONFIG(setInternalOption, "suspend=%d", suspend); bufferSource->suspend(suspend); } else if (type == IOMX::INTERNAL_OPTION_REPEAT_PREVIOUS_FRAME_DELAY){ if (size != sizeof(int64_t)) { return INVALID_OPERATION; } int64_t delayUs = *(int64_t *)data; CLOG_CONFIG(setInternalOption, "delayUs=%lld", (long long)delayUs); return bufferSource->setRepeatPreviousFrameDelayUs(delayUs); } else if (type == IOMX::INTERNAL_OPTION_MAX_TIMESTAMP_GAP){ if (size != sizeof(int64_t)) { return INVALID_OPERATION; } int64_t maxGapUs = *(int64_t *)data; CLOG_CONFIG(setInternalOption, "gapUs=%lld", (long long)maxGapUs); return bufferSource->setMaxTimestampGapUs(maxGapUs); } else if (type == IOMX::INTERNAL_OPTION_MAX_FPS) { if (size != sizeof(float)) { return INVALID_OPERATION; } float maxFps = *(float *)data; CLOG_CONFIG(setInternalOption, "maxFps=%f", maxFps); return bufferSource->setMaxFps(maxFps); } else if (type == IOMX::INTERNAL_OPTION_START_TIME) { if (size != sizeof(int64_t)) { return INVALID_OPERATION; } int64_t skipFramesBeforeUs = *(int64_t *)data; CLOG_CONFIG(setInternalOption, "beforeUs=%lld", (long long)skipFramesBeforeUs); bufferSource->setSkipFramesBeforeUs(skipFramesBeforeUs); } else { // IOMX::INTERNAL_OPTION_TIME_LAPSE if (size != sizeof(int64_t) * 2) { return INVALID_OPERATION; } int64_t timePerFrameUs = ((int64_t *)data)[0]; int64_t timePerCaptureUs = ((int64_t *)data)[1]; CLOG_CONFIG(setInternalOption, "perFrameUs=%lld perCaptureUs=%lld", (long long)timePerFrameUs, (long long)timePerCaptureUs); bufferSource->setTimeLapseUs((int64_t *)data); } return OK; } default: return ERROR_UNSUPPORTED; } }
0
net
967c05aee439e6e5d7d805e195b3a20ef5c433d6
NOT_APPLICABLE
NOT_APPLICABLE
static void tcp_keepalive_timer (struct timer_list *t) { struct sock *sk = from_timer(sk, t, sk_timer); struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); u32 elapsed; /* Only process if socket is not in use. */ bh_lock_sock(sk); if (sock_owned_by_user(sk)) { /* Try again later. */ inet_csk_reset_keepalive_timer (sk, HZ/20); goto out; } if (sk->sk_state == TCP_LISTEN) { pr_err("Hmm... keepalive on a LISTEN ???\n"); goto out; } tcp_mstamp_refresh(tp); if (sk->sk_state == TCP_FIN_WAIT2 && sock_flag(sk, SOCK_DEAD)) { if (tp->linger2 >= 0) { const int tmo = tcp_fin_time(sk) - TCP_TIMEWAIT_LEN; if (tmo > 0) { tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); goto out; } } tcp_send_active_reset(sk, GFP_ATOMIC); goto death; } if (!sock_flag(sk, SOCK_KEEPOPEN) || ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT))) goto out; elapsed = keepalive_time_when(tp); /* It is alive without keepalive 8) */ if (tp->packets_out || !tcp_write_queue_empty(sk)) goto resched; elapsed = keepalive_time_elapsed(tp); if (elapsed >= keepalive_time_when(tp)) { /* If the TCP_USER_TIMEOUT option is enabled, use that * to determine when to timeout instead. */ if ((icsk->icsk_user_timeout != 0 && elapsed >= msecs_to_jiffies(icsk->icsk_user_timeout) && icsk->icsk_probes_out > 0) || (icsk->icsk_user_timeout == 0 && icsk->icsk_probes_out >= keepalive_probes(tp))) { tcp_send_active_reset(sk, GFP_ATOMIC); tcp_write_err(sk); goto out; } if (tcp_write_wakeup(sk, LINUX_MIB_TCPKEEPALIVE) <= 0) { icsk->icsk_probes_out++; elapsed = keepalive_intvl_when(tp); } else { /* If keepalive was lost due to local congestion, * try harder. */ elapsed = TCP_RESOURCE_PROBE_INTERVAL; } } else { /* It is tp->rcv_tstamp + keepalive_time_when(tp) */ elapsed = keepalive_time_when(tp) - elapsed; } sk_mem_reclaim(sk); resched: inet_csk_reset_keepalive_timer (sk, elapsed); goto out; death: tcp_done(sk); out: bh_unlock_sock(sk); sock_put(sk); }
0
torque
f2f4c950f3d461a249111c8826da3beaafccace9
NOT_APPLICABLE
NOT_APPLICABLE
int tm_atnode( tm_task_id tid, /* in */ tm_node_id *node) /* out */ { task_info *tp; if (!init_done) return TM_BADINIT; if ((tp = find_task(tid)) == NULL) return TM_ENOTFOUND; *node = tp->t_node; return TM_SUCCESS; }
0
libyang
d9feacc4a590d35dbc1af21caf9080008b4450ed
NOT_APPLICABLE
NOT_APPLICABLE
yang_free_include(struct ly_ctx *ctx, struct lys_include *inc, uint8_t start, uint8_t size) { uint8_t i; for (i = start; i < size; ++i){ free((char *)inc[i].submodule); lydict_remove(ctx, inc[i].dsc); lydict_remove(ctx, inc[i].ref); lys_extension_instances_free(ctx, inc[i].ext, inc[i].ext_size, NULL); } }
0
fmt
8cf30aa2be256eba07bb1cefb998c52326e846e7
NOT_APPLICABLE
NOT_APPLICABLE
Result visit_double(double value) { return FMT_DISPATCH(visit_any_double(value)); }
0
ceph
f44a8ae8aa27ecef69528db9aec220f12492810e
NOT_APPLICABLE
NOT_APPLICABLE
int RGWPutObj_ObjStore_SWIFT::verify_permission() { op_ret = RGWPutObj_ObjStore::verify_permission(); /* We have to differentiate error codes depending on whether user is * anonymous (401 Unauthorized) or he doesn't have necessary permissions * (403 Forbidden). */ if (s->auth.identity->is_anonymous() && op_ret == -EACCES) { return -EPERM; } else { return op_ret; } }
0
Chrome
a4150b688a754d3d10d2ca385155b1c95d77d6ae
NOT_APPLICABLE
NOT_APPLICABLE
bool GLES2Implementation::GetUniformIndicesHelper(GLuint program, GLsizei count, const char* const* names, GLuint* indices) { if (!PackStringsToBucket(count, names, nullptr, "glGetUniformIndices")) { return false; } typedef cmds::GetUniformIndices::Result Result; auto result = GetResultAs<Result>(); if (!result) { return false; } result->SetNumResults(0); helper_->GetUniformIndices(program, kResultBucketId, GetResultShmId(), result.offset()); WaitForCmd(); if (result->GetNumResults() != count) { return false; } result->CopyResult(indices); return true; }
0
Chrome
744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
NOT_APPLICABLE
NOT_APPLICABLE
void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, bool is_new_navigation) { DocumentState* document_state = DocumentState::FromDataSource(frame->dataSource()); NavigationState* navigation_state = document_state->navigation_state(); if (document_state->commit_load_time().is_null()) document_state->set_commit_load_time(Time::Now()); if (is_new_navigation) { UpdateSessionHistory(frame); page_id_ = next_page_id_++; if (GetLoadingUrl(frame) != GURL("about:swappedout")) { history_list_offset_++; if (history_list_offset_ >= content::kMaxSessionHistoryEntries) history_list_offset_ = content::kMaxSessionHistoryEntries - 1; history_list_length_ = history_list_offset_ + 1; history_page_ids_.resize(history_list_length_, -1); history_page_ids_[history_list_offset_] = page_id_; } } else { if (navigation_state->pending_page_id() != -1 && navigation_state->pending_page_id() != page_id_ && !navigation_state->request_committed()) { UpdateSessionHistory(frame); page_id_ = navigation_state->pending_page_id(); history_list_offset_ = navigation_state->pending_history_list_offset(); DCHECK(history_list_length_ <= 0 || history_list_offset_ < 0 || history_list_offset_ >= history_list_length_ || history_page_ids_[history_list_offset_] == page_id_); } } FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitProvisionalLoad(frame, is_new_navigation)); navigation_state->set_request_committed(true); UpdateURL(frame); completed_client_redirect_src_ = Referrer(); UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); }
0
zfs
99aa4d2b4fd12c6bef62d02ffd1b375ddd42fcf4
NOT_APPLICABLE
NOT_APPLICABLE
alloc_share(const char *sharepath) { sa_share_impl_t impl_share; impl_share = calloc(sizeof (struct sa_share_impl), 1); if (impl_share == NULL) return (NULL); impl_share->sharepath = strdup(sharepath); if (impl_share->sharepath == NULL) { free(impl_share); return (NULL); } impl_share->fsinfo = calloc(sizeof (sa_share_fsinfo_t), fstypes_count); if (impl_share->fsinfo == NULL) { free(impl_share->sharepath); free(impl_share); return (NULL); } return (impl_share); }
0
haproxy
3b69886f7dcc3cfb3d166309018e6cfec9ce2c95
NOT_APPLICABLE
NOT_APPLICABLE
static inline struct htx *htx_from_buf(struct buffer *buf) { struct htx *htx = htxbuf(buf); b_set_data(buf, b_size(buf)); return htx; }
0
linux
371528caec553785c37f73fa3926ea0de84f986f
NOT_APPLICABLE
NOT_APPLICABLE
void mem_cgroup_replace_page_cache(struct page *oldpage, struct page *newpage) { struct mem_cgroup *memcg; struct page_cgroup *pc; enum charge_type type = MEM_CGROUP_CHARGE_TYPE_CACHE; if (mem_cgroup_disabled()) return; pc = lookup_page_cgroup(oldpage); /* fix accounting on old pages */ lock_page_cgroup(pc); memcg = pc->mem_cgroup; mem_cgroup_charge_statistics(memcg, PageCgroupCache(pc), -1); ClearPageCgroupUsed(pc); unlock_page_cgroup(pc); if (PageSwapBacked(oldpage)) type = MEM_CGROUP_CHARGE_TYPE_SHMEM; /* * Even if newpage->mapping was NULL before starting replacement, * the newpage may be on LRU(or pagevec for LRU) already. We lock * LRU while we overwrite pc->mem_cgroup. */ __mem_cgroup_commit_charge_lrucare(newpage, memcg, type); }
0
ghostscript
60dabde18d7fe12b19da8b509bdfee9cc886aafc
NOT_APPLICABLE
NOT_APPLICABLE
static inline float point_inside_circle(float px, float py, float x, float y, float r) { float dx = px - x; float dy = py - y; return dx * dx + dy * dy <= r * r; }
0
Chrome
e5787005a9004d7be289cc649c6ae4f3051996cd
NOT_APPLICABLE
NOT_APPLICABLE
void RenderWidgetHostImpl::OnImeCancelComposition() { if (view_) view_->ImeCancelComposition(); }
0
mongo-c-driver
0d9a4d98bfdf4acd2c0138d4aaeb4e2e0934bd84
NOT_APPLICABLE
NOT_APPLICABLE
bson_iter_double (const bson_iter_t *iter) /* IN */ { BSON_ASSERT (iter); if (ITER_TYPE (iter) == BSON_TYPE_DOUBLE) { return bson_iter_double_unsafe (iter); } return 0; }
0
Chrome
db97b49fdd856f33bd810db4564c6f2cc14be71a
NOT_APPLICABLE
NOT_APPLICABLE
virtual ~PixelBufferWorkerPoolTaskImpl() {}
0
Little-CMS
768f70ca405cd3159d990e962d54456773bb8cf8
NOT_APPLICABLE
NOT_APPLICABLE
void Writef(SAVESTREAM* f, const char* frm, ...) { char Buffer[4096]; va_list args; va_start(args, frm); vsnprintf(Buffer, 4095, frm, args); Buffer[4095] = 0; WriteStr(f, Buffer); va_end(args); }
0
xserver
d2f813f7db157fc83abc4b3726821c36ee7e40b1
NOT_APPLICABLE
NOT_APPLICABLE
fbFetchPixel_c4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); return indexed->rgba[pixel]; }
0
vim
dbdd16b62560413abcc3c8e893cc3010ccf31666
NOT_APPLICABLE
NOT_APPLICABLE
compile_substitute(char_u *arg, exarg_T *eap, cctx_T *cctx) { char_u *cmd = eap->arg; char_u *expr = (char_u *)strstr((char *)cmd, "\\="); if (expr != NULL) { int delimiter = *cmd++; // There is a \=expr, find it in the substitute part. cmd = skip_regexp_ex(cmd, delimiter, magic_isset(), NULL, NULL, NULL); if (cmd[0] == delimiter && cmd[1] == '\\' && cmd[2] == '=') { garray_T save_ga = cctx->ctx_instr; char_u *end; int expr_res; int trailing_error; int instr_count; isn_T *instr; isn_T *isn; cmd += 3; end = skip_substitute(cmd, delimiter); // Temporarily reset the list of instructions so that the jump // labels are correct. cctx->ctx_instr.ga_len = 0; cctx->ctx_instr.ga_maxlen = 0; cctx->ctx_instr.ga_data = NULL; expr_res = compile_expr0(&cmd, cctx); if (end[-1] == NUL) end[-1] = delimiter; cmd = skipwhite(cmd); trailing_error = *cmd != delimiter && *cmd != NUL; if (expr_res == FAIL || trailing_error || GA_GROW_FAILS(&cctx->ctx_instr, 1)) { if (trailing_error) semsg(_(e_trailing_characters_str), cmd); clear_instr_ga(&cctx->ctx_instr); cctx->ctx_instr = save_ga; return NULL; } // Move the generated instructions into the ISN_SUBSTITUTE // instructions, then restore the list of instructions before // adding the ISN_SUBSTITUTE instruction. instr_count = cctx->ctx_instr.ga_len; instr = cctx->ctx_instr.ga_data; instr[instr_count].isn_type = ISN_FINISH; cctx->ctx_instr = save_ga; if ((isn = generate_instr(cctx, ISN_SUBSTITUTE)) == NULL) { int idx; for (idx = 0; idx < instr_count; ++idx) delete_instr(instr + idx); vim_free(instr); return NULL; } isn->isn_arg.subs.subs_cmd = vim_strsave(arg); isn->isn_arg.subs.subs_instr = instr; // skip over flags if (*end == '&') ++end; while (ASCII_ISALPHA(*end) || *end == '#') ++end; return end; } } return compile_exec(arg, eap, cctx); }
0
linux
104c307147ad379617472dd91a5bcb368d72bd6d
NOT_APPLICABLE
NOT_APPLICABLE
struct dce_i2c_hw *dce100_i2c_hw_create( struct dc_context *ctx, uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); if (!dce_i2c_hw) return NULL; dce100_i2c_hw_construct(dce_i2c_hw, ctx, inst, &i2c_hw_regs[inst], &i2c_shifts, &i2c_masks); return dce_i2c_hw; }
0
w3m
18dcbadf2771cdb0c18509b14e4e73505b242753
NOT_APPLICABLE
NOT_APPLICABLE
pcmap(void) { }
0
linux
7b0d0b40cd78cadb525df760ee4cac151533c2b5
CVE-2014-3215
CWE-264
static int selinux_bprm_set_creds(struct linux_binprm *bprm) { const struct task_security_struct *old_tsec; struct task_security_struct *new_tsec; struct inode_security_struct *isec; struct common_audit_data ad; struct inode *inode = file_inode(bprm->file); int rc; rc = cap_bprm_set_creds(bprm); if (rc) return rc; /* SELinux context only depends on initial program or script and not * the script interpreter */ if (bprm->cred_prepared) return 0; old_tsec = current_security(); new_tsec = bprm->cred->security; isec = inode->i_security; /* Default to the current task SID. */ new_tsec->sid = old_tsec->sid; new_tsec->osid = old_tsec->sid; /* Reset fs, key, and sock SIDs on execve. */ new_tsec->create_sid = 0; new_tsec->keycreate_sid = 0; new_tsec->sockcreate_sid = 0; if (old_tsec->exec_sid) { new_tsec->sid = old_tsec->exec_sid; /* Reset exec SID on execve. */ new_tsec->exec_sid = 0; /* * Minimize confusion: if no_new_privs or nosuid and a * transition is explicitly requested, then fail the exec. */ if (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS) return -EPERM; if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) return -EACCES; } else { /* Check for a default transition on this program. */ rc = security_transition_sid(old_tsec->sid, isec->sid, SECCLASS_PROCESS, NULL, &new_tsec->sid); if (rc) return rc; } ad.type = LSM_AUDIT_DATA_PATH; ad.u.path = bprm->file->f_path; if ((bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) || (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS)) new_tsec->sid = old_tsec->sid; if (new_tsec->sid == old_tsec->sid) { rc = avc_has_perm(old_tsec->sid, isec->sid, SECCLASS_FILE, FILE__EXECUTE_NO_TRANS, &ad); if (rc) return rc; } else { /* Check permissions for the transition. */ rc = avc_has_perm(old_tsec->sid, new_tsec->sid, SECCLASS_PROCESS, PROCESS__TRANSITION, &ad); if (rc) return rc; rc = avc_has_perm(new_tsec->sid, isec->sid, SECCLASS_FILE, FILE__ENTRYPOINT, &ad); if (rc) return rc; /* Check for shared state */ if (bprm->unsafe & LSM_UNSAFE_SHARE) { rc = avc_has_perm(old_tsec->sid, new_tsec->sid, SECCLASS_PROCESS, PROCESS__SHARE, NULL); if (rc) return -EPERM; } /* Make sure that anyone attempting to ptrace over a task that * changes its SID has the appropriate permit */ if (bprm->unsafe & (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) { struct task_struct *tracer; struct task_security_struct *sec; u32 ptsid = 0; rcu_read_lock(); tracer = ptrace_parent(current); if (likely(tracer != NULL)) { sec = __task_cred(tracer)->security; ptsid = sec->sid; } rcu_read_unlock(); if (ptsid != 0) { rc = avc_has_perm(ptsid, new_tsec->sid, SECCLASS_PROCESS, PROCESS__PTRACE, NULL); if (rc) return -EPERM; } } /* Clear any possibly unsafe personality bits on exec: */ bprm->per_clear |= PER_CLEAR_ON_SETID; } return 0; }
1
graphviz
784411ca3655c80da0f6025ab20634b2a6ff696b
NOT_APPLICABLE
NOT_APPLICABLE
static field_t *map_rec_port(field_t * f, char *str) { field_t *rv; int sub; if (f->id && (streq(f->id, str))) rv = f; else { rv = NULL; for (sub = 0; sub < f->n_flds; sub++) if ((rv = map_rec_port(f->fld[sub], str))) break; } return rv; }
0
abrt
17cb66b13997b0159b4253b3f5722db79f476d68
NOT_APPLICABLE
NOT_APPLICABLE
static bool dump_fd_info(const char *dest_filename, char *source_filename, int source_base_ofs, uid_t uid, gid_t gid) { FILE *fp = fopen(dest_filename, "w"); if (!fp) return false; unsigned fd = 0; while (fd <= 99999) /* paranoia check */ { sprintf(source_filename + source_base_ofs, "fd/%u", fd); char *name = malloc_readlink(source_filename); if (!name) break; fprintf(fp, "%u:%s\n", fd, name); free(name); sprintf(source_filename + source_base_ofs, "fdinfo/%u", fd); fd++; FILE *in = fopen(source_filename, "r"); if (!in) continue; char buf[128]; while (fgets(buf, sizeof(buf)-1, in)) { /* in case the line is not terminated, terminate it */ char *eol = strchrnul(buf, '\n'); eol[0] = '\n'; eol[1] = '\0'; fputs(buf, fp); } fclose(in); } const int dest_fd = fileno(fp); if (fchown(dest_fd, uid, gid) < 0) { perror_msg("Can't change '%s' ownership to %lu:%lu", dest_filename, (long)uid, (long)gid); fclose(fp); unlink(dest_filename); return false; } fclose(fp); return true; }
0
muon
c18663aa171c6cdf03da3e8c70df8663645b97c4
NOT_APPLICABLE
NOT_APPLICABLE
void ContentSettingsObserver::DidNotAllowPlugins() { DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS); }
0
enlightment
c21beaf1780cf3ca291735ae7d58a3dde63277a2
NOT_APPLICABLE
NOT_APPLICABLE
do_progress(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity, char *pper, int *py, int y) { int rc = 0; int h = 0; char per; per = (char)((100 * y) / im->h); if (((per - *pper) >= progress_granularity) || (y == (im->h - 1))) { h = y - *py; /* fix off by one in case of the last line */ if (y == (im->h - 1)) h++; rc = !progress(im, per, 0, *py, im->w, h); *pper = per; *py = y; } return rc; }
0
samba
a819d2b440aafa3138d95ff6e8b824da885a70e9
NOT_APPLICABLE
NOT_APPLICABLE
uint8_t smb2cli_conn_get_io_priority(struct smbXcli_conn *conn) { if (conn->protocol < PROTOCOL_SMB3_11) { return 0; } return conn->smb2.io_priority; }
0
Android
5e751957ba692658b7f67eb03ae5ddb2cd3d970c
NOT_APPLICABLE
NOT_APPLICABLE
status_t ESDS::InitCheck() const { return mInitCheck; }
0
linux
a3727a8bac0a9e77c70820655fd8715523ba3db7
NOT_APPLICABLE
NOT_APPLICABLE
static void selinux_task_to_inode(struct task_struct *p, struct inode *inode) { struct inode_security_struct *isec = selinux_inode(inode); u32 sid = task_sid_obj(p); spin_lock(&isec->lock); isec->sclass = inode_mode_to_security_class(inode->i_mode); isec->sid = sid; isec->initialized = LABEL_INITIALIZED; spin_unlock(&isec->lock); }
0
linux
ad9f151e560b016b6ad3280b48e42fa11e1a5440
NOT_APPLICABLE
NOT_APPLICABLE
static int nf_tables_updobj(const struct nft_ctx *ctx, const struct nft_object_type *type, const struct nlattr *attr, struct nft_object *obj) { struct nft_object *newobj; struct nft_trans *trans; int err; trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ, sizeof(struct nft_trans_obj)); if (!trans) return -ENOMEM; newobj = nft_obj_init(ctx, type, attr); if (IS_ERR(newobj)) { err = PTR_ERR(newobj); goto err_free_trans; } nft_trans_obj(trans) = obj; nft_trans_obj_update(trans) = true; nft_trans_obj_newobj(trans) = newobj; nft_trans_commit_list_add_tail(ctx->net, trans); return 0; err_free_trans: kfree(trans); return err; }
0
linux
817b8b9c5396d2b2d92311b46719aad5d3339dbe
NOT_APPLICABLE
NOT_APPLICABLE
static int elo_flush_smartset_responses(struct usb_device *dev) { return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ELO_FLUSH_SMARTSET_RESPONSES, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); }
0
Chrome
befb46ae3385fa13975521e9a2281e35805b339e
NOT_APPLICABLE
NOT_APPLICABLE
bool FrameLoader::allChildrenAreComplete() const { for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { if (!child->loader()->m_isComplete) return false; } return true; }
0